xmlhelp/source/cxxhelp/provider/content.cxx | 15 xmlhelp/source/cxxhelp/provider/contentcaps.cxx | 38 - xmlhelp/source/cxxhelp/provider/databases.cxx | 30 xmlhelp/source/cxxhelp/provider/inputstream.cxx | 2 xmlhelp/source/cxxhelp/provider/provider.cxx | 4 xmlhelp/source/cxxhelp/provider/resultsetbase.cxx | 4 xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx | 2 xmlhelp/source/treeview/tvfactory.cxx | 6 xmlhelp/source/treeview/tvread.cxx | 18 xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx | 4 xmlsecurity/qa/unit/signing/signing.cxx | 138 ++-- xmlsecurity/qa/unit/signing/signing2.cxx | 60 - xmlsecurity/source/component/certificatecontainer.cxx | 4 xmlsecurity/source/component/documentdigitalsignatures.cxx | 22 xmlsecurity/source/dialogs/certificatechooser.cxx | 20 xmlsecurity/source/dialogs/certificateviewer.cxx | 54 - xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx | 42 - xmlsecurity/source/dialogs/macrosecurity.cxx | 60 - xmlsecurity/source/framework/saxeventkeeperimpl.cxx | 4 xmlsecurity/source/framework/signaturecreatorimpl.cxx | 4 xmlsecurity/source/framework/signatureverifierimpl.cxx | 4 xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx | 4 xmlsecurity/source/gpg/CertificateImpl.cxx | 6 xmlsecurity/source/gpg/SEInitializer.cxx | 4 xmlsecurity/source/gpg/SecurityEnvironment.cxx | 6 xmlsecurity/source/gpg/XMLSecurityContext.cxx | 10 xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx | 36 - xmlsecurity/source/helper/UriBindingHelper.cxx | 4 xmlsecurity/source/helper/documentsignaturehelper.cxx | 108 +-- xmlsecurity/source/helper/documentsignaturemanager.cxx | 11 xmlsecurity/source/helper/ooxmlsecexporter.cxx | 302 +++++----- xmlsecurity/source/helper/ooxmlsecparser.cxx | 32 - xmlsecurity/source/helper/pdfsignaturehelper.cxx | 14 xmlsecurity/source/helper/xmlsignaturehelper.cxx | 26 xmlsecurity/source/helper/xsecctl.cxx | 170 ++--- xmlsecurity/source/helper/xsecparser.cxx | 40 - xmlsecurity/source/helper/xsecsign.cxx | 2 xmlsecurity/source/helper/xsecverify.cxx | 2 xmlsecurity/source/xmlsec/nss/ciphercontext.cxx | 34 - xmlsecurity/source/xmlsec/nss/nssinitializer.cxx | 24 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx | 4 xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx | 8 xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx | 2 xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx | 4 xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx | 6 xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx | 6 xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl.cxx | 4 xmlsecurity/source/xmlsec/xmlsec_init.cxx | 6 xmlsecurity/workben/pdfverify.cxx | 2 49 files changed, 714 insertions(+), 698 deletions(-)
New commits: commit eee70d4e776a970a700db5379355292c480f8a02 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed May 15 13:13:12 2024 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed May 15 18:04:00 2024 +0200 loplugin:ostr in xmlhelp Change-Id: I8330bfe9cd4f551824b0c908f7902f10b1111efb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167669 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/xmlhelp/source/cxxhelp/provider/content.cxx b/xmlhelp/source/cxxhelp/provider/content.cxx index 6d12041de9ec..5b1c1794186e 100644 --- a/xmlhelp/source/cxxhelp/provider/content.cxx +++ b/xmlhelp/source/cxxhelp/provider/content.cxx @@ -100,13 +100,13 @@ uno::Sequence< uno::Type > SAL_CALL Content::getTypes() // virtual OUString SAL_CALL Content::getImplementationName() { - return "CHelpContent"; + return u"CHelpContent"_ustr; } // virtual uno::Sequence< OUString > SAL_CALL Content::getSupportedServiceNames() { - return { "com.sun.star.ucb.CHelpContent" }; + return { u"com.sun.star.ucb.CHelpContent"_ustr }; } // XContent methods. @@ -334,8 +334,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( if ( rProp.Name == "ContentType" ) xRow->appendString( rProp, - OUString( - "application/vnd.sun.star.help" ) ); + u"application/vnd.sun.star.help"_ustr ); else if ( rProp.Name == "Title" ) xRow->appendString ( rProp,m_aURLParameter.get_title() ); else if ( rProp.Name == "IsReadOnly" ) @@ -354,14 +353,14 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( if( m_aURLParameter.isActive() ) xRow->appendString( rProp, - OUString( "text/plain" ) ); + u"text/plain"_ustr ); else if( m_aURLParameter.isFile() ) xRow->appendString( - rProp,OUString( "text/html" ) ); + rProp,u"text/html"_ustr ); else if( m_aURLParameter.isRoot() ) xRow->appendString( rProp, - OUString( "text/css" ) ); + u"text/css"_ustr ); else xRow->appendVoid( rProp ); else if( m_aURLParameter.isModule() ) @@ -411,7 +410,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( } else if ( rProp.Name == "SearchScopes" ) { - uno::Sequence< OUString > seq{ "Heading", "FullText" }; + uno::Sequence< OUString > seq{ u"Heading"_ustr, u"FullText"_ustr }; xRow->appendObject( rProp, uno::Any(seq) ); } else if ( rProp.Name == "Order" ) diff --git a/xmlhelp/source/cxxhelp/provider/contentcaps.cxx b/xmlhelp/source/cxxhelp/provider/contentcaps.cxx index b18061e43474..840dd043db37 100644 --- a/xmlhelp/source/cxxhelp/provider/contentcaps.cxx +++ b/xmlhelp/source/cxxhelp/provider/contentcaps.cxx @@ -48,42 +48,42 @@ uno::Sequence< beans::Property > Content::getProperties( sal_Int32 idx = 0; pprops[idx++] = beans::Property( - "ContentType", + u"ContentType"_ustr, -1, cppu::UnoType<OUString>::get(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ); pprops[idx++] = beans::Property( - "IsReadOnly", + u"IsReadOnly"_ustr, -1, cppu::UnoType<bool>::get(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ); pprops[idx++] = beans::Property( - "IsErrorDocument", + u"IsErrorDocument"_ustr, -1, cppu::UnoType<bool>::get(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ); pprops[idx++] = beans::Property( - "IsDocument", + u"IsDocument"_ustr, -1, cppu::UnoType<bool>::get(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ); pprops[idx++] = beans::Property( - "IsFolder", + u"IsFolder"_ustr, -1, cppu::UnoType<bool>::get(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ); pprops[idx++] = beans::Property( - "Title", + u"Title"_ustr, -1, cppu::UnoType<OUString>::get(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ); @@ -91,7 +91,7 @@ uno::Sequence< beans::Property > Content::getProperties( if( withMediaType ) pprops[idx++] = beans::Property( - "MediaType", + u"MediaType"_ustr, -1, cppu::UnoType<OUString>::get(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ); @@ -100,42 +100,42 @@ uno::Sequence< beans::Property > Content::getProperties( { pprops[idx++] = beans::Property( - "Order", + u"Order"_ustr, -1, cppu::UnoType<sal_Int32>::get(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ); pprops[idx++] = beans::Property( - "KeywordList", + u"KeywordList"_ustr, -1, cppu::UnoType<uno::Sequence< OUString >>::get(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ); pprops[idx++] = beans::Property( - "KeywordRef", + u"KeywordRef"_ustr, -1, cppu::UnoType<uno::Sequence< uno::Sequence< OUString > >>::get(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ); pprops[idx++] = beans::Property( - "KeywordTitleForRef", + u"KeywordTitleForRef"_ustr, -1, cppu::UnoType<uno::Sequence< uno::Sequence< OUString > >>::get(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ); pprops[idx++] = beans::Property( - "KeywordAnchorForRef", + u"KeywordAnchorForRef"_ustr, -1, cppu::UnoType<uno::Sequence< uno::Sequence< OUString > >>::get(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ); pprops[idx++] = beans::Property( - "SearchScopes", + u"SearchScopes"_ustr, -1, cppu::UnoType<uno::Sequence< OUString >>::get(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ); @@ -145,7 +145,7 @@ uno::Sequence< beans::Property > Content::getProperties( { pprops[idx++] = beans::Property( - "AnchorName", + u"AnchorName"_ustr, -1, cppu::UnoType<OUString>::get(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY ); @@ -166,27 +166,27 @@ uno::Sequence< ucb::CommandInfo > Content::getCommands( { // Required commands ucb::CommandInfo( - "getCommandInfo", + u"getCommandInfo"_ustr, -1, cppu::UnoType<void>::get() ), ucb::CommandInfo( - "getPropertySetInfo", + u"getPropertySetInfo"_ustr, -1, cppu::UnoType<void>::get() ), ucb::CommandInfo( - "getPropertyValues", + u"getPropertyValues"_ustr, -1, cppu::UnoType<uno::Sequence< beans::Property >>::get() ), ucb::CommandInfo( - "setPropertyValues", + u"setPropertyValues"_ustr, -1, cppu::UnoType<uno::Sequence< beans::PropertyValue >>::get() ), ucb::CommandInfo( - "open", + u"open"_ustr, -1, cppu::UnoType<ucb::OpenCommandArgument2>::get() ) diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx index 2f20a2d75a73..69fe80d78552 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.cxx +++ b/xmlhelp/source/cxxhelp/provider/databases.cxx @@ -184,16 +184,16 @@ OString Databases::getImageTheme() const // set root path uno::Sequence<uno::Any> lParams(comphelper::InitAnyPropertySequence( { - {"nodepath", uno::Any(OUString("org.openoffice.Office.Common"))} + {"nodepath", uno::Any(u"org.openoffice.Office.Common"_ustr)} })); // open it uno::Reference< uno::XInterface > xCFG( xConfigProvider->createInstanceWithArguments( - "com.sun.star.configuration.ConfigurationAccess", + u"com.sun.star.configuration.ConfigurationAccess"_ustr, lParams) ); uno::Reference< container::XHierarchicalNameAccess > xAccess(xCFG, uno::UNO_QUERY_THROW); - uno::Any aResult = xAccess->getByHierarchicalName("Misc/SymbolStyle"); + uno::Any aResult = xAccess->getByHierarchicalName(u"Misc/SymbolStyle"_ustr); OUString aSymbolsStyleName; aResult >>= aSymbolsStyleName; @@ -353,7 +353,7 @@ StaticModuleInformation* Databases::getStaticInformationForModule( std::u16strin const sal_Unicode* str = fileContent.getStr(); OUString current,program,startid,title; - OUString order( "1" ); + OUString order( u"1"_ustr ); for( sal_Int32 i = 0;i < fileContent.getLength();i++ ) { @@ -453,7 +453,7 @@ helpdatafileproxy::Hdf* Databases::getHelpDataFile(std::unique_lock<std::mutex>& if( Database.empty() || Language.isEmpty() ) return nullptr; - OUString aFileExt( helpText ? OUString(".ht") : OUString(".db") ); + OUString aFileExt( helpText ? u".ht"_ustr : u".db"_ustr ); OUString dbFileName = OUString::Concat("/") + Database + aFileExt; OUString key; if( pExtensionPath == nullptr ) @@ -853,7 +853,7 @@ Reference< XHierarchicalNameAccess > Databases::jarFile( Reference< XInterface > xIfc = m_xSMgr->createInstanceWithArgumentsAndContext( - "com.sun.star.packages.comp.ZipPackage", + u"com.sun.star.packages.comp.ZipPackage"_ustr, aArguments, m_xContext ); if ( xIfc.is() ) @@ -967,7 +967,7 @@ void Databases::cascadingStylesheet( const OUString& Language, uno::Reference< awt::XVclWindowPeer > xVclWindowPeer( xTopWindow, uno::UNO_QUERY ); if ( xVclWindowPeer.is() ) { - uno::Any aHCMode = xVclWindowPeer->getProperty( "HighContrastMode" ); + uno::Any aHCMode = xVclWindowPeer->getProperty( u"HighContrastMode"_ustr ); if ( ( aHCMode >>= bHighContrastMode ) && bHighContrastMode ) { aCSS = "highcontrastblack"; @@ -1186,7 +1186,7 @@ Reference< deployment::XPackage > ExtensionIteratorBase::implGetHelpPackageFromP } if( bRegistered ) { - OUString aHelpMediaType( "application/vnd.sun.star.help" ); + OUString aHelpMediaType( u"application/vnd.sun.star.help"_ustr ); if( xPackage->isBundle() ) { const Sequence< Reference< deployment::XPackage > > aPkgSeq = xPackage->getBundle @@ -1227,7 +1227,7 @@ Reference< deployment::XPackage > ExtensionIteratorBase::implGetNextUserHelpPack { Reference< XExtensionManager > xExtensionManager = ExtensionManager::get(m_xContext); m_aUserPackagesSeq = xExtensionManager->getDeployedExtensions - ( "user", Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() ); + ( u"user"_ustr, Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() ); m_bUserPackagesLoaded = true; } @@ -1255,7 +1255,7 @@ Reference< deployment::XPackage > ExtensionIteratorBase::implGetNextSharedHelpPa { Reference< XExtensionManager > xExtensionManager = ExtensionManager::get(m_xContext); m_aSharedPackagesSeq = xExtensionManager->getDeployedExtensions - ( "shared", Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() ); + ( u"shared"_ustr, Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() ); m_bSharedPackagesLoaded = true; } @@ -1283,7 +1283,7 @@ Reference< deployment::XPackage > ExtensionIteratorBase::implGetNextBundledHelpP { Reference< XExtensionManager > xExtensionManager = ExtensionManager::get(m_xContext); m_aBundledPackagesSeq = xExtensionManager->getDeployedExtensions - ( "bundled", Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() ); + ( u"bundled"_ustr, Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() ); m_bBundledPackagesLoaded = true; } @@ -1481,7 +1481,7 @@ helpdatafileproxy::Hdf* DataBaseIterator::implGetHdfFromPackage( const Reference { OUString aRegDataUrl = optRegData.Value + "/"; - OUString aHelpFilesBaseName("help"); + OUString aHelpFilesBaseName(u"help"_ustr); OUString aUsedLanguage = m_aLanguage; pRetHdf = m_rDatabases.getHelpDataFile( @@ -1666,14 +1666,14 @@ Reference< XHierarchicalNameAccess > JarFileIterator::implGetJarFromPackage( Sequence< Any > aArguments{ Any(zipFile), // let ZipPackage be used ( no manifest.xml is required ) - Any(comphelper::makePropertyValue("StorageFormat", + Any(comphelper::makePropertyValue(u"StorageFormat"_ustr, ZIP_STORAGE_FORMAT_STRING)) }; Reference< XMultiComponentFactory >xSMgr = m_xContext->getServiceManager(); Reference< XInterface > xIfc = xSMgr->createInstanceWithArgumentsAndContext( - "com.sun.star.packages.comp.ZipPackage", + u"com.sun.star.packages.comp.ZipPackage"_ustr, aArguments, m_xContext ); if ( xIfc.is() ) @@ -1839,7 +1839,7 @@ OUString IndexFolderIterator::implGetIndexFolderFromPackage( bool& o_rbTemporary } } - HelpIndexer aIndexer(aLang, "help", aLangURL, aZipDir); + HelpIndexer aIndexer(aLang, u"help"_ustr, aLangURL, aZipDir); aIndexer.indexDocuments(); if( bIsWriteAccess ) diff --git a/xmlhelp/source/cxxhelp/provider/inputstream.cxx b/xmlhelp/source/cxxhelp/provider/inputstream.cxx index 59c87cef40fc..30b2e1e2e4db 100644 --- a/xmlhelp/source/cxxhelp/provider/inputstream.cxx +++ b/xmlhelp/source/cxxhelp/provider/inputstream.cxx @@ -107,7 +107,7 @@ XInputStream_impl::skipBytes( { if (m_aFile.setPos(osl_Pos_Current, sal_uInt64(nBytesToSkip)) != osl::FileBase::E_None) { - throw io::IOException("XInputStream_impl::skipBytes failed seek"); + throw io::IOException(u"XInputStream_impl::skipBytes failed seek"_ustr); } } diff --git a/xmlhelp/source/cxxhelp/provider/provider.cxx b/xmlhelp/source/cxxhelp/provider/provider.cxx index eb28f5a9ca37..457dec5b71d7 100644 --- a/xmlhelp/source/cxxhelp/provider/provider.cxx +++ b/xmlhelp/source/cxxhelp/provider/provider.cxx @@ -57,7 +57,7 @@ ContentProvider::~ContentProvider() OUString SAL_CALL ContentProvider::getImplementationName() { - return "CHelpContentProvider"; + return u"CHelpContentProvider"_ustr; } sal_Bool SAL_CALL @@ -69,7 +69,7 @@ ContentProvider::supportsService(const OUString& ServiceName ) uno::Sequence< OUString > SAL_CALL ContentProvider::getSupportedServiceNames() { - return { "com.sun.star.help.XMLHelp", "com.sun.star.ucb.HelpContentProvider" }; + return { u"com.sun.star.help.XMLHelp"_ustr, u"com.sun.star.ucb.HelpContentProvider"_ustr }; } // XContentProvider methods. diff --git a/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx b/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx index 58d8e70c5b49..3a040bbf62a4 100644 --- a/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx +++ b/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx @@ -388,8 +388,8 @@ ResultSetBase::getPropertySetInfo() { uno::Sequence< beans::Property > seq { - { "RowCount", -1, cppu::UnoType<sal_Int32>::get(), beans::PropertyAttribute::READONLY }, - { "IsRowCountFinal", -1, cppu::UnoType<sal_Bool>::get(), beans::PropertyAttribute::READONLY } + { u"RowCount"_ustr, -1, cppu::UnoType<sal_Int32>::get(), beans::PropertyAttribute::READONLY }, + { u"IsRowCountFinal"_ustr, -1, cppu::UnoType<sal_Bool>::get(), beans::PropertyAttribute::READONLY } }; //t diff --git a/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx b/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx index b598c241e75e..07cbdb15b6e6 100644 --- a/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx +++ b/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx @@ -292,7 +292,7 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentConte aIndexFolderResultVectorVector.clear(); sal_Int32 replIdx = strlen( "#HLP#" ); - OUString replWith = "vnd.sun.star.help://"; + OUString replWith = u"vnd.sun.star.help://"_ustr; int nResultCount = aCompleteResultVector.size(); for( int r = 0 ; r < nResultCount ; ++r ) diff --git a/xmlhelp/source/treeview/tvfactory.cxx b/xmlhelp/source/treeview/tvfactory.cxx index 99a55580f9e0..4d6c3d5d5771 100644 --- a/xmlhelp/source/treeview/tvfactory.cxx +++ b/xmlhelp/source/treeview/tvfactory.cxx @@ -49,7 +49,7 @@ TVFactory::~TVFactory() OUString SAL_CALL TVFactory::getImplementationName() { - return "com.sun.star.help.TreeViewImpl"; + return u"com.sun.star.help.TreeViewImpl"_ustr; } sal_Bool SAL_CALL TVFactory::supportsService( const OUString& ServiceName ) @@ -60,7 +60,7 @@ sal_Bool SAL_CALL TVFactory::supportsService( const OUString& ServiceName ) Sequence< OUString > SAL_CALL TVFactory::getSupportedServiceNames() { - return { "com.sun.star.help.TreeView", "com.sun.star.ucb.HiearchyDataSource" }; + return { u"com.sun.star.help.TreeView"_ustr, u"com.sun.star.ucb.HiearchyDataSource"_ustr }; } // XMultiServiceFactory @@ -118,7 +118,7 @@ TVFactory::createInstanceWithArguments( Sequence< OUString > SAL_CALL TVFactory::getAvailableServiceNames( ) { - return { "com.sun.star.ucb.HierarchyDataReadAccess" }; + return { u"com.sun.star.ucb.HierarchyDataReadAccess"_ustr }; } extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx index 31f1815979ec..054ad493849a 100644 --- a/xmlhelp/source/treeview/tvread.cxx +++ b/xmlhelp/source/treeview/tvread.cxx @@ -261,7 +261,7 @@ TVRead::getByName( const OUString& aName ) Sequence< OUString > SAL_CALL TVRead::getElementNames( ) { - return { "Title", "TargetURL", "Children" }; + return { u"Title"_ustr, u"TargetURL"_ustr, u"Children"_ustr }; } sal_Bool SAL_CALL @@ -609,16 +609,16 @@ ConfigData TVChildTarget::init( const Reference< XComponentContext >& xContext ) uno::Sequence<uno::Any> lParams(comphelper::InitAnyPropertySequence( { - {"nodepath", uno::Any(OUString("/org.openoffice.Setup/Product"))} + {"nodepath", uno::Any(u"/org.openoffice.Setup/Product"_ustr)} })); // open it uno::Reference< uno::XInterface > xCFG( xConfigProvider->createInstanceWithArguments( - "com.sun.star.configuration.ConfigurationAccess", + u"com.sun.star.configuration.ConfigurationAccess"_ustr, lParams) ); uno::Reference< container::XNameAccess > xDirectAccess(xCFG, uno::UNO_QUERY); - uno::Any aRet = xDirectAccess->getByName("ooSetupExtension"); + uno::Any aRet = xDirectAccess->getByName(u"ooSetupExtension"_ustr); aRet >>= setupextension; } @@ -761,7 +761,7 @@ TVChildTarget::getHierAccess( const Reference< XMultiServiceFactory >& sProvider { xHierAccess = Reference< XHierarchicalNameAccess > - ( sProvider->createInstanceWithArguments( "com.sun.star.configuration.ConfigurationAccess", { Any(OUString::createFromAscii(file)) }), + ( sProvider->createInstanceWithArguments( u"com.sun.star.configuration.ConfigurationAccess"_ustr, { Any(OUString::createFromAscii(file)) }), UNO_QUERY ); } catch( const css::uno::Exception& ) @@ -832,7 +832,7 @@ TreeFileIterator::TreeFileIterator( OUString aLanguage ) m_xContext = ::comphelper::getProcessComponentContext(); if( !m_xContext.is() ) { - throw RuntimeException( "TreeFileIterator::TreeFileIterator(), no XComponentContext" ); + throw RuntimeException( u"TreeFileIterator::TreeFileIterator(), no XComponentContext"_ustr ); } m_xSFA = ucb::SimpleFileAccess::create(m_xContext); @@ -902,7 +902,7 @@ Reference< deployment::XPackage > TreeFileIterator::implGetNextUserHelpPackage if( !m_bUserPackagesLoaded ) { Reference< XPackageManager > xUserManager = - thePackageManagerFactory::get( m_xContext )->getPackageManager("user"); + thePackageManagerFactory::get( m_xContext )->getPackageManager(u"user"_ustr); m_aUserPackagesSeq = xUserManager->getDeployedPackages ( Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() ); @@ -932,7 +932,7 @@ Reference< deployment::XPackage > TreeFileIterator::implGetNextSharedHelpPackage if( !m_bSharedPackagesLoaded ) { Reference< XPackageManager > xSharedManager = - thePackageManagerFactory::get( m_xContext )->getPackageManager("shared"); + thePackageManagerFactory::get( m_xContext )->getPackageManager(u"shared"_ustr); m_aSharedPackagesSeq = xSharedManager->getDeployedPackages ( Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() ); @@ -962,7 +962,7 @@ Reference< deployment::XPackage > TreeFileIterator::implGetNextBundledHelpPackag if( !m_bBundledPackagesLoaded ) { Reference< XPackageManager > xBundledManager = - thePackageManagerFactory::get( m_xContext )->getPackageManager("bundled"); + thePackageManagerFactory::get( m_xContext )->getPackageManager(u"bundled"_ustr); m_aBundledPackagesSeq = xBundledManager->getDeployedPackages ( Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() ); commit 6e267990695548db227c918679b907c60263cb81 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed May 15 13:12:42 2024 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed May 15 18:03:51 2024 +0200 loplugin:ostr in xmlsecurity Change-Id: Ifb936c230f68447b3bb5993705adb5e5b790371f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167668 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Jenkins diff --git a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx index 46981b250a6f..9d774735d30c 100644 --- a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx +++ b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx @@ -70,7 +70,7 @@ PDFSigningTest::PDFSigningTest() {} void PDFSigningTest::setUp() { test::BootstrapFixture::setUp(); - MacrosTest::setUpX509(m_directories, "xmlsecurity_pdfsigning"); + MacrosTest::setUpX509(m_directories, u"xmlsecurity_pdfsigning"_ustr); uno::Reference<xml::crypto::XSEInitializer> xSEInitializer = xml::crypto::SEInitializer::create(mxComponentContext); @@ -148,7 +148,7 @@ bool PDFSigningTest::sign(const OUString& rInURL, const OUString& rOutURL, } else { - bool bSignResult = aDocument.Sign(cert, "test", /*bAdES=*/true); + bool bSignResult = aDocument.Sign(cert, u"test"_ustr, /*bAdES=*/true); #ifdef _WIN32 if (!bSignResult) { diff --git a/xmlsecurity/qa/unit/signing/signing.cxx b/xmlsecurity/qa/unit/signing/signing.cxx index 316eaf22f5b7..11bd8627c4d0 100644 --- a/xmlsecurity/qa/unit/signing/signing.cxx +++ b/xmlsecurity/qa/unit/signing/signing.cxx @@ -84,7 +84,7 @@ protected: }; SigningTest::SigningTest() - : UnoApiXmlTest("/xmlsecurity/qa/unit/signing/data/") + : UnoApiXmlTest(u"/xmlsecurity/qa/unit/signing/data/"_ustr) { } @@ -92,8 +92,8 @@ void SigningTest::setUp() { UnoApiXmlTest::setUp(); - MacrosTest::setUpX509(m_directories, "xmlsecurity_signing"); - MacrosTest::setUpGpg(m_directories, "xmlsecurity_signing"); + MacrosTest::setUpX509(m_directories, u"xmlsecurity_signing"_ustr); + MacrosTest::setUpGpg(m_directories, u"xmlsecurity_signing"_ustr); // Initialize crypto after setting up the environment variables. mxSEInitializer = xml::crypto::SEInitializer::create(mxComponentContext); @@ -137,9 +137,9 @@ SigningTest::getCertificate(DocumentSignatureManager& rSignatureManager, CPPUNIT_TEST_FIXTURE(SigningTest, testDescription) { // Create an empty document and store it to a tempfile, finally load it as a storage. - load("private:factory/swriter"); + load(u"private:factory/swriter"_ustr); - save("writer8"); + save(u"writer8"_ustr); DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content); CPPUNIT_ASSERT(aManager.init()); @@ -155,7 +155,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testDescription) = getCertificate(aManager, svl::crypto::SignatureMethodAlgorithm::RSA); if (!xCertificate.is()) return; - OUString aDescription("SigningTest::testDescription"); + OUString aDescription(u"SigningTest::testDescription"_ustr); sal_Int32 nSecurityId; aManager.add(xCertificate, mxSecurityContext, aDescription, nSecurityId, false); @@ -169,9 +169,9 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testDescription) CPPUNIT_TEST_FIXTURE(SigningTest, testECDSA) { // Create an empty document and store it to a tempfile, finally load it as a storage. - load("private:factory/swriter"); + load(u"private:factory/swriter"_ustr); - save("writer8"); + save(u"writer8"_ustr); DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content); CPPUNIT_ASSERT(aManager.init()); @@ -188,7 +188,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testECDSA) if (!xCertificate.is()) return; sal_Int32 nSecurityId; - aManager.add(xCertificate, mxSecurityContext, "", nSecurityId, false); + aManager.add(xCertificate, mxSecurityContext, u""_ustr, nSecurityId, false); // Read back the signature and make sure that it's valid. aManager.read(/*bUseTempStream=*/true); @@ -203,9 +203,9 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testECDSA) CPPUNIT_TEST_FIXTURE(SigningTest, testECDSAOOXML) { // Create an empty document and store it to a tempfile, finally load it as a storage. - load("private:factory/swriter"); + load(u"private:factory/swriter"_ustr); - save("MS Word 2007 XML"); + save(u"MS Word 2007 XML"_ustr); DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content); CPPUNIT_ASSERT(aManager.init()); @@ -222,7 +222,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testECDSAOOXML) if (!xCertificate.is()) return; sal_Int32 nSecurityId; - aManager.add(xCertificate, mxSecurityContext, "", nSecurityId, + aManager.add(xCertificate, mxSecurityContext, u""_ustr, nSecurityId, /*bAdESCompliant=*/false); // Read back the signature and make sure that it's valid. @@ -239,9 +239,9 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testECDSAPDF) { // Create an empty document and store it to a tempfile, finally load it as // a stream. - load("private:factory/swriter"); + load(u"private:factory/swriter"_ustr); - save("writer_pdf_Export"); + save(u"writer_pdf_Export"_ustr); DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content); CPPUNIT_ASSERT(aManager.init()); @@ -257,7 +257,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testECDSAPDF) if (!xCertificate.is()) return; sal_Int32 nSecurityId; - aManager.add(xCertificate, mxSecurityContext, "", nSecurityId, + aManager.add(xCertificate, mxSecurityContext, u""_ustr, nSecurityId, /*bAdESCompliant=*/true); // Read back the signature and make sure that it's valid. @@ -279,9 +279,9 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testECDSAPDF) CPPUNIT_TEST_FIXTURE(SigningTest, testOOXMLDescription) { // Create an empty document and store it to a tempfile, finally load it as a storage. - load("private:factory/swriter"); + load(u"private:factory/swriter"_ustr); - save("MS Word 2007 XML"); + save(u"MS Word 2007 XML"_ustr); DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content); CPPUNIT_ASSERT(aManager.init()); @@ -297,7 +297,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testOOXMLDescription) = getCertificate(aManager, svl::crypto::SignatureMethodAlgorithm::RSA); if (!xCertificate.is()) return; - OUString aDescription("SigningTest::testDescription"); + OUString aDescription(u"SigningTest::testDescription"_ustr); sal_Int32 nSecurityId; aManager.add(xCertificate, mxSecurityContext, aDescription, nSecurityId, false); @@ -367,7 +367,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testOOXMLRemove) // Read back the signatures and make sure that only purpose1 is left. aManager.read(/*bUseTempStream=*/true); CPPUNIT_ASSERT_EQUAL(static_cast<std::size_t>(1), rInformations.size()); - CPPUNIT_ASSERT_EQUAL(OUString("purpose1"), rInformations[0].ouDescription); + CPPUNIT_ASSERT_EQUAL(u"purpose1"_ustr, rInformations[0].ouDescription); } /// Test removing all signatures from a document. @@ -399,11 +399,11 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testOOXMLRemoveAll) // Make sure that the signature count is zero and the whole signature storage is removed completely. CPPUNIT_ASSERT_EQUAL(static_cast<std::size_t>(0), rInformations.size()); - CPPUNIT_ASSERT(!xStorage->hasByName("_xmlsignatures")); + CPPUNIT_ASSERT(!xStorage->hasByName(u"_xmlsignatures"_ustr)); // And that content types no longer contains signature types. uno::Reference<io::XStream> xStream - = xStorage->openStreamElement("[Content_Types].xml", embed::ElementModes::READWRITE); + = xStorage->openStreamElement(u"[Content_Types].xml"_ustr, embed::ElementModes::READWRITE); uno::Reference<io::XInputStream> xInputStream = xStream->getInputStream(); uno::Sequence<uno::Sequence<beans::StringPair>> aContentTypeInfo = comphelper::OFOPXMLHelper::ReadContentTypeSequence(xInputStream, mxComponentContext); @@ -497,7 +497,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, aaa_testODFX509CertificateChain) CPPUNIT_ASSERT_EQUAL(security::CertificateValidity::VALID, infos[0].CertificateStatus); CPPUNIT_ASSERT(infos[0].Signer.is()); CPPUNIT_ASSERT_EQUAL( - OUString("CN=Xmlsecurity RSA Test example Alice,O=Xmlsecurity RSA Test,ST=England,C=UK"), + u"CN=Xmlsecurity RSA Test example Alice,O=Xmlsecurity RSA Test,ST=England,C=UK"_ustr, // CryptoAPI puts a space after comma, NSS does not... infos[0].Signer->getSubjectName().replaceAll(", ", ",")); } @@ -725,9 +725,10 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testPDFAddVisibleSignature) createTempCopy(u"add-visible-signature.pdf"); // Open it. - uno::Sequence<beans::PropertyValue> aArgs = { comphelper::makePropertyValue("ReadOnly", true) }; + uno::Sequence<beans::PropertyValue> aArgs + = { comphelper::makePropertyValue(u"ReadOnly"_ustr, true) }; mxComponent - = loadFromDesktop(maTempFile.GetURL(), "com.sun.star.drawing.DrawingDocument", aArgs); + = loadFromDesktop(maTempFile.GetURL(), u"com.sun.star.drawing.DrawingDocument"_ustr, aArgs); SfxBaseModel* pBaseModel = dynamic_cast<SfxBaseModel*>(mxComponent.get()); CPPUNIT_ASSERT(pBaseModel); SfxObjectShell* pObjectShell = pBaseModel->GetObjectShell(); @@ -736,7 +737,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testPDFAddVisibleSignature) // Add a signature line. uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); uno::Reference<drawing::XShape> xShape( - xFactory->createInstance("com.sun.star.drawing.GraphicObjectShape"), uno::UNO_QUERY); + xFactory->createInstance(u"com.sun.star.drawing.GraphicObjectShape"_ustr), uno::UNO_QUERY); xShape->setPosition(awt::Point(1000, 15000)); xShape->setSize(awt::Size(10000, 10000)); uno::Reference<drawing::XDrawPagesSupplier> xSupplier(mxComponent, uno::UNO_QUERY); @@ -795,14 +796,14 @@ CPPUNIT_TEST_FIXTURE(SigningTest, test96097Calc) // Save a copy uno::Sequence<beans::PropertyValue> descSaveACopy(comphelper::InitPropertySequence( - { { "SaveACopy", uno::Any(true) }, { "FilterName", uno::Any(OUString("calc8")) } })); + { { "SaveACopy", uno::Any(true) }, { "FilterName", uno::Any(u"calc8"_ustr) } })); xDocStorable->storeToURL(maTempFile.GetURL(), descSaveACopy); // FIXME: Error: element "document-signatures" is missing "version" attribute skipValidation(); // Save As - save("calc8"); + save(u"calc8"_ustr); } CPPUNIT_TEST_FIXTURE(SigningTest, test96097Doc) @@ -822,14 +823,14 @@ CPPUNIT_TEST_FIXTURE(SigningTest, test96097Doc) // Save a copy uno::Sequence<beans::PropertyValue> descSaveACopy(comphelper::InitPropertySequence( - { { "SaveACopy", uno::Any(true) }, { "FilterName", uno::Any(OUString("writer8")) } })); + { { "SaveACopy", uno::Any(true) }, { "FilterName", uno::Any(u"writer8"_ustr) } })); xDocStorable->storeToURL(maTempFile.GetURL(), descSaveACopy); // FIXME: Error: element "document-signatures" is missing "version" attribute skipValidation(); // Save As - save("writer8"); + save(u"writer8"_ustr); } CPPUNIT_TEST_FIXTURE(SigningTest, testXAdESNotype) @@ -865,9 +866,9 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testXAdESNotype) // Parse the resulting XML. uno::Reference<embed::XStorage> xMetaInf - = xStorage->openStorageElement("META-INF", embed::ElementModes::READ); + = xStorage->openStorageElement(u"META-INF"_ustr, embed::ElementModes::READ); uno::Reference<io::XInputStream> xInputStream( - xMetaInf->openStreamElement("documentsignatures.xml", embed::ElementModes::READ), + xMetaInf->openStreamElement(u"documentsignatures.xml"_ustr, embed::ElementModes::READ), uno::UNO_QUERY); std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true)); xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); @@ -883,16 +884,16 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testXAdESNotype) assertXPath(pXmlDoc, "/odfds:document-signatures/dsig:Signature[2]/dsig:SignedInfo/" "dsig:Reference[starts-with(@URI, '#idSignedProperties')]"_ostr, - "Type"_ostr, "http://uri.etsi.org/01903#SignedProperties"); + "Type"_ostr, u"http://uri.etsi.org/01903#SignedProperties"_ustr); } /// Creates a XAdES signature from scratch. CPPUNIT_TEST_FIXTURE(SigningTest, testXAdES) { // Create an empty document, store it to a tempfile and load it as a storage. - load("private:factory/swriter"); + load(u"private:factory/swriter"_ustr); - save("writer8"); + save(u"writer8"_ustr); DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content); CPPUNIT_ASSERT(aManager.init()); @@ -920,9 +921,9 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testXAdES) // Parse the resulting XML. uno::Reference<embed::XStorage> xMetaInf - = xStorage->openStorageElement("META-INF", embed::ElementModes::READ); + = xStorage->openStorageElement(u"META-INF"_ustr, embed::ElementModes::READ); uno::Reference<io::XInputStream> xInputStream( - xMetaInf->openStreamElement("documentsignatures.xml", embed::ElementModes::READ), + xMetaInf->openStreamElement(u"documentsignatures.xml"_ustr, embed::ElementModes::READ), uno::UNO_QUERY); std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true)); xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); @@ -938,14 +939,14 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testXAdES) // Assert that the Type attribute is set on all URI's that start with #idSignedProperties assertXPath(pXmlDoc, "//dsig:Reference[starts-with(@URI, '#idSignedProperties')]"_ostr, - "Type"_ostr, "http://uri.etsi.org/01903#SignedProperties"); + "Type"_ostr, u"http://uri.etsi.org/01903#SignedProperties"_ustr); } CPPUNIT_TEST_FIXTURE(SigningTest, testSigningMultipleTimes_ODT) { - load("private:factory/swriter"); + load(u"private:factory/swriter"_ustr); - save("writer8"); + save(u"writer8"_ustr); { DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content); CPPUNIT_ASSERT(aManager.init()); @@ -1016,9 +1017,9 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testSigningMultipleTimes_ODT) CPPUNIT_TEST_FIXTURE(SigningTest, testSigningMultipleTimes_OOXML) { - load("private:factory/swriter"); + load(u"private:factory/swriter"_ustr); - save("MS Word 2007 XML"); + save(u"MS Word 2007 XML"_ustr); { DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content); CPPUNIT_ASSERT(aManager.init()); @@ -1036,7 +1037,8 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testSigningMultipleTimes_OOXML) return; sal_Int32 nSecurityId; - aManager.add(xCertificate, mxSecurityContext, "", nSecurityId, /*bAdESCompliant=*/false); + aManager.add(xCertificate, mxSecurityContext, u""_ustr, nSecurityId, + /*bAdESCompliant=*/false); aManager.read(/*bUseTempStream=*/true); { std::vector<SignatureInformation>& rInformations @@ -1046,7 +1048,8 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testSigningMultipleTimes_OOXML) rInformations[0].nStatus); } - aManager.add(xCertificate, mxSecurityContext, "", nSecurityId, /*bAdESCompliant=*/false); + aManager.add(xCertificate, mxSecurityContext, u""_ustr, nSecurityId, + /*bAdESCompliant=*/false); aManager.read(/*bUseTempStream=*/true); { std::vector<SignatureInformation>& rInformations @@ -1056,7 +1059,8 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testSigningMultipleTimes_OOXML) rInformations[1].nStatus); } - aManager.add(xCertificate, mxSecurityContext, "", nSecurityId, /*bAdESCompliant=*/false); + aManager.add(xCertificate, mxSecurityContext, u""_ustr, nSecurityId, + /*bAdESCompliant=*/false); aManager.read(/*bUseTempStream=*/true); { std::vector<SignatureInformation>& rInformations @@ -1119,7 +1123,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testSignatureLineOOXML) // The signature should have a valid signature, and signature line with two valid images CPPUNIT_ASSERT(xSignatureInfo[0].SignatureIsValid); - CPPUNIT_ASSERT_EQUAL(OUString("{DEE0514B-13E8-4674-A831-46E3CDB18BB4}"), + CPPUNIT_ASSERT_EQUAL(u"{DEE0514B-13E8-4674-A831-46E3CDB18BB4}"_ustr, xSignatureInfo[0].SignatureLineId); CPPUNIT_ASSERT(xSignatureInfo[0].ValidSignatureLineImage.is()); CPPUNIT_ASSERT(xSignatureInfo[0].InvalidSignatureLineImage.is()); @@ -1139,7 +1143,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testSignatureLineODF) CPPUNIT_ASSERT(xSignatureInfo.getLength()); CPPUNIT_ASSERT(xSignatureInfo[0].SignatureIsValid); - CPPUNIT_ASSERT_EQUAL(OUString("{41CF56EE-331B-4125-97D8-2F5669DD3AAC}"), + CPPUNIT_ASSERT_EQUAL(u"{41CF56EE-331B-4125-97D8-2F5669DD3AAC}"_ustr, xSignatureInfo[0].SignatureLineId); CPPUNIT_ASSERT(xSignatureInfo[0].ValidSignatureLineImage.is()); CPPUNIT_ASSERT(xSignatureInfo[0].InvalidSignatureLineImage.is()); @@ -1221,7 +1225,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testODFEncryptedGPG) CPPUNIT_ASSERT(pObjectShell); // export and import again - saveAndReload("writer8"); + saveAndReload(u"writer8"_ustr); pBaseModel = dynamic_cast<SfxBaseModel*>(mxComponent.get()); CPPUNIT_ASSERT(pBaseModel); @@ -1253,7 +1257,7 @@ SfxObjectShell* SigningTest::assertDocument(const ::CppUnit::SourceLine aSrcLine OUString aODFVersion; uno::Reference<beans::XPropertySet> xPropSet(pObjectShell->GetStorage(), uno::UNO_QUERY_THROW); - xPropSet->getPropertyValue("Version") >>= aODFVersion; + xPropSet->getPropertyValue(u"Version"_ustr) >>= aODFVersion; CPPUNIT_ASSERT_EQUAL(sVersion, aODFVersion); return pObjectShell; @@ -1262,7 +1266,7 @@ SfxObjectShell* SigningTest::assertDocument(const ::CppUnit::SourceLine aSrcLine /// Test if a macro signature from a OTT 1.2 template is preserved for ODT 1.2 CPPUNIT_TEST_FIXTURE(SigningTest, testPreserveMacroTemplateSignature12_ODF) { - const OUString aFormats[] = { "writer8", "writer8_template" }; + const OUString aFormats[] = { u"writer8"_ustr, u"writer8_template"_ustr }; for (OUString const& sFormat : aFormats) { @@ -1275,7 +1279,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testPreserveMacroTemplateSignature12_ODF) comphelper::InitPropertySequence({ { "AsTemplate", uno::Any(false) } })); // we are a template, and have a valid document and macro signature - assertDocument(CPPUNIT_SOURCELINE(), "writer8_template", SignatureState::OK, + assertDocument(CPPUNIT_SOURCELINE(), u"writer8_template"_ustr, SignatureState::OK, SignatureState::OK, ODFVER_012_TEXT); // create new document from template @@ -1284,7 +1288,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testPreserveMacroTemplateSignature12_ODF) mxComponent.is()); // we are somehow a template (?), and have just a valid macro signature - assertDocument(CPPUNIT_SOURCELINE(), "writer8_template", SignatureState::NOSIGNATURES, + assertDocument(CPPUNIT_SOURCELINE(), u"writer8_template"_ustr, SignatureState::NOSIGNATURES, SignatureState::OK, ODFVER_012_TEXT); // FIXME: Error: element "document-signatures" is missing "version" attribute @@ -1296,7 +1300,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testPreserveMacroTemplateSignature12_ODF) else { // save as new OTT template - save("writer8_template"); + save(u"writer8_template"_ustr); // load the saved OTT template as-is to validate signatures mxComponent->dispose(); @@ -1310,7 +1314,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testPreserveMacroTemplateSignature12_ODF) SignatureState::OK, ODFVER_013_TEXT); // save as new OTT template - save("writer8_template"); + save(u"writer8_template"_ustr); // load the template as-is to validate signatures mxComponent->dispose(); @@ -1319,7 +1323,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testPreserveMacroTemplateSignature12_ODF) comphelper::InitPropertySequence({ { "AsTemplate", uno::Any(false) } })); // the loaded document is a OTT with a valid macro signature - assertDocument(CPPUNIT_SOURCELINE(), "writer8_template", SignatureState::NOSIGNATURES, + assertDocument(CPPUNIT_SOURCELINE(), u"writer8_template"_ustr, SignatureState::NOSIGNATURES, SignatureState::OK, ODFVER_013_TEXT); mxComponent->dispose(); @@ -1338,7 +1342,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testDropMacroTemplateSignature) aURL, OUString(), comphelper::InitPropertySequence({ { "AsTemplate", uno::Any(false) } })); // we are a template, and have a non-invalid macro signature - assertDocument(CPPUNIT_SOURCELINE(), "writer8_template", SignatureState::NOSIGNATURES, + assertDocument(CPPUNIT_SOURCELINE(), u"writer8_template"_ustr, SignatureState::NOSIGNATURES, SignatureState::NOTVALIDATED, OUString()); // create new document from template @@ -1347,14 +1351,14 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testDropMacroTemplateSignature) mxComponent.is()); // we are somehow a template (?), and have just a valid macro signature - assertDocument(CPPUNIT_SOURCELINE(), "writer8_template", SignatureState::NOSIGNATURES, + assertDocument(CPPUNIT_SOURCELINE(), u"writer8_template"_ustr, SignatureState::NOSIGNATURES, SignatureState::NOTVALIDATED, OUString()); // save as new ODT document - saveAndReload("writer8"); + saveAndReload(u"writer8"_ustr); // the loaded document is a 1.2 ODT without any signatures - assertDocument(CPPUNIT_SOURCELINE(), "writer8", SignatureState::NOSIGNATURES, + assertDocument(CPPUNIT_SOURCELINE(), u"writer8"_ustr, SignatureState::NOSIGNATURES, SignatureState::NOSIGNATURES, ODFVER_013_TEXT); // load the template as-is to validate signatures @@ -1363,11 +1367,11 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testDropMacroTemplateSignature) aURL, OUString(), comphelper::InitPropertySequence({ { "AsTemplate", uno::Any(false) } })); // we are a template, and have a non-invalid macro signature - assertDocument(CPPUNIT_SOURCELINE(), "writer8_template", SignatureState::NOSIGNATURES, + assertDocument(CPPUNIT_SOURCELINE(), u"writer8_template"_ustr, SignatureState::NOSIGNATURES, SignatureState::NOTVALIDATED, OUString()); // save as new OTT template - save("writer8_template"); + save(u"writer8_template"_ustr); // load the template as-is to validate signatures mxComponent->dispose(); @@ -1376,7 +1380,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testDropMacroTemplateSignature) comphelper::InitPropertySequence({ { "AsTemplate", uno::Any(false) } })); // the loaded document is a 1.2 OTT without any signatures - assertDocument(CPPUNIT_SOURCELINE(), "writer8_template", SignatureState::NOSIGNATURES, + assertDocument(CPPUNIT_SOURCELINE(), u"writer8_template"_ustr, SignatureState::NOSIGNATURES, SignatureState::NOSIGNATURES, ODFVER_013_TEXT); } @@ -1395,7 +1399,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testPreserveMacroTemplateSignature10) officecfg::Office::Common::Save::ODF::DefaultVersion::set(2, pBatch); pBatch->commit(); - const OUString aFormats[] = { "writer8", "writer8_template" }; + const OUString aFormats[] = { u"writer8"_ustr, u"writer8_template"_ustr }; for (OUString const& sFormat : aFormats) { @@ -1408,7 +1412,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testPreserveMacroTemplateSignature10) comphelper::InitPropertySequence({ { "AsTemplate", uno::Any(false) } })); // we are a template, and have a non-invalid macro signature - assertDocument(CPPUNIT_SOURCELINE(), "writer8_template", SignatureState::NOSIGNATURES, + assertDocument(CPPUNIT_SOURCELINE(), u"writer8_template"_ustr, SignatureState::NOSIGNATURES, SignatureState::NOTVALIDATED, OUString()); // create new document from template @@ -1417,7 +1421,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testPreserveMacroTemplateSignature10) mxComponent.is()); // we are somehow a template (?), and have just a valid macro signature - assertDocument(CPPUNIT_SOURCELINE(), "writer8_template", SignatureState::NOSIGNATURES, + assertDocument(CPPUNIT_SOURCELINE(), u"writer8_template"_ustr, SignatureState::NOSIGNATURES, SignatureState::NOTVALIDATED, OUString()); // FIXME: Error: element "manifest:manifest" is missing "version" attribute @@ -1429,7 +1433,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testPreserveMacroTemplateSignature10) else { // save as new OTT template - save("writer8_template"); + save(u"writer8_template"_ustr); // load the saved OTT template as-is to validate signatures mxComponent->dispose(); @@ -1441,7 +1445,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testPreserveMacroTemplateSignature10) assertDocument(CPPUNIT_SOURCELINE(), sFormat, SignatureState::NOSIGNATURES, SignatureState::NOTVALIDATED, OUString()); - save("writer8_template"); + save(u"writer8_template"_ustr); // load the template as-is to validate signatures mxComponent->dispose(); @@ -1450,7 +1454,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testPreserveMacroTemplateSignature10) comphelper::InitPropertySequence({ { "AsTemplate", uno::Any(false) } })); // the loaded document is a OTT with a non-invalid macro signature - assertDocument(CPPUNIT_SOURCELINE(), "writer8_template", SignatureState::NOSIGNATURES, + assertDocument(CPPUNIT_SOURCELINE(), u"writer8_template"_ustr, SignatureState::NOSIGNATURES, SignatureState::NOTVALIDATED, OUString()); mxComponent->dispose(); diff --git a/xmlsecurity/qa/unit/signing/signing2.cxx b/xmlsecurity/qa/unit/signing/signing2.cxx index 46bdc303d0ee..d59cfbec92eb 100644 --- a/xmlsecurity/qa/unit/signing/signing2.cxx +++ b/xmlsecurity/qa/unit/signing/signing2.cxx @@ -48,7 +48,7 @@ public: }; SigningTest2::SigningTest2() - : UnoApiXmlTest("/xmlsecurity/qa/unit/signing/data/") + : UnoApiXmlTest(u"/xmlsecurity/qa/unit/signing/data/"_ustr) { } @@ -56,8 +56,8 @@ void SigningTest2::setUp() { UnoApiXmlTest::setUp(); - MacrosTest::setUpX509(m_directories, "xmlsecurity_signing2"); - MacrosTest::setUpGpg(m_directories, "xmlsecurity_signing2"); + MacrosTest::setUpX509(m_directories, u"xmlsecurity_signing2"_ustr); + MacrosTest::setUpGpg(m_directories, u"xmlsecurity_signing2"_ustr); // Initialize crypto after setting up the environment variables. mxSEInitializer = xml::crypto::SEInitializer::create(mxComponentContext); @@ -84,7 +84,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest2, testPreserveMacroSignatureODB) loadFromFile(u"odb_signed_macros.odb"); // save as ODB - save("StarOffice XML (Base)"); + save(u"StarOffice XML (Base)"_ustr); // Parse the resulting XML. uno::Reference<embed::XStorage> xStorage @@ -92,16 +92,16 @@ CPPUNIT_TEST_FIXTURE(SigningTest2, testPreserveMacroSignatureODB) ZIP_STORAGE_FORMAT_STRING, maTempFile.GetURL(), embed::ElementModes::READ); CPPUNIT_ASSERT(xStorage.is()); uno::Reference<embed::XStorage> xMetaInf - = xStorage->openStorageElement("META-INF", embed::ElementModes::READ); + = xStorage->openStorageElement(u"META-INF"_ustr, embed::ElementModes::READ); uno::Reference<io::XInputStream> xInputStream( - xMetaInf->openStreamElement("macrosignatures.xml", embed::ElementModes::READ), + xMetaInf->openStreamElement(u"macrosignatures.xml"_ustr, embed::ElementModes::READ), uno::UNO_QUERY); std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true)); xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); // Make sure the signature is still there assertXPath(pXmlDoc, "//dsig:Signature"_ostr, "Id"_ostr, - "ID_00a7002f009000bc00ce00f7004400460080002f002e00e400e0003700df00e8"); + u"ID_00a7002f009000bc00ce00f7004400460080002f002e00e400e0003700df00e8"_ustr); } CPPUNIT_TEST_FIXTURE(SigningTest2, testPasswordPreserveMacroSignatureODF13) @@ -110,7 +110,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest2, testPasswordPreserveMacroSignatureODF13) load(createFileURL(u"encrypted_scriptsig_odf13.odt"), "password"); { uno::Reference<text::XTextDocument> xTextDoc(mxComponent, uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT_EQUAL(OUString("secret"), xTextDoc->getText()->getString()); + CPPUNIT_ASSERT_EQUAL(u"secret"_ustr, xTextDoc->getText()->getString()); // test macro signature SfxBaseModel* pBaseModel(dynamic_cast<SfxBaseModel*>(mxComponent.get())); CPPUNIT_ASSERT(pBaseModel); @@ -118,7 +118,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest2, testPasswordPreserveMacroSignatureODF13) uno::Reference<beans::XPropertySet> xPropSet(pObjectShell->GetStorage(), uno::UNO_QUERY_THROW); CPPUNIT_ASSERT_EQUAL(ODFVER_013_TEXT, - xPropSet->getPropertyValue("Version").get<OUString>()); + xPropSet->getPropertyValue(u"Version"_ustr).get<OUString>()); CPPUNIT_ASSERT_EQUAL(SignatureState::OK, pObjectShell->GetScriptingSignatureState()); } @@ -135,10 +135,10 @@ CPPUNIT_TEST_FIXTURE(SigningTest2, testPasswordPreserveMacroSignatureODF13) officecfg::Office::Common::Save::ODF::DefaultVersion::set(10, pBatch); pBatch->commit(); - saveAndReload("writer8", "password"); + saveAndReload(u"writer8"_ustr, "password"); - xmlDocUniquePtr pXmlDoc = parseExport("META-INF/manifest.xml"); - assertXPath(pXmlDoc, "/manifest:manifest"_ostr, "version"_ostr, "1.3"); + xmlDocUniquePtr pXmlDoc = parseExport(u"META-INF/manifest.xml"_ustr); + assertXPath(pXmlDoc, "/manifest:manifest"_ostr, "version"_ostr, u"1.3"_ustr); assertXPath(pXmlDoc, "/manifest:manifest/manifest:file-entry[@manifest:size != '0']"_ostr, 8); assertXPath( @@ -171,7 +171,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest2, testPasswordPreserveMacroSignatureODF13) 8); // test reimport uno::Reference<text::XTextDocument> xTextDoc(mxComponent, uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT_EQUAL(OUString("secret"), xTextDoc->getText()->getString()); + CPPUNIT_ASSERT_EQUAL(u"secret"_ustr, xTextDoc->getText()->getString()); // test macro signature - this didn't actually work! // using Zip Storage means the encrypted streams are signed, so // after encrypting again the signature didn't match and was dropped @@ -181,14 +181,14 @@ CPPUNIT_TEST_FIXTURE(SigningTest2, testPasswordPreserveMacroSignatureODF13) { // store it with new wholesome ODF extended encryption - reload - saveAndReload("writer8", "password"); + saveAndReload(u"writer8"_ustr, "password"); // test wholesome ODF extended encryption - xmlDocUniquePtr pXmlDoc = parseExport("META-INF/manifest.xml"); - assertXPath(pXmlDoc, "/manifest:manifest"_ostr, "version"_ostr, "1.3"); + xmlDocUniquePtr pXmlDoc = parseExport(u"META-INF/manifest.xml"_ustr); + assertXPath(pXmlDoc, "/manifest:manifest"_ostr, "version"_ostr, u"1.3"_ustr); assertXPath(pXmlDoc, "/manifest:manifest/manifest:file-entry"_ostr, 1); assertXPath(pXmlDoc, "/manifest:manifest/manifest:file-entry"_ostr, "full-path"_ostr, - "encrypted-package"); + u"encrypted-package"_ustr); assertXPath(pXmlDoc, "/manifest:manifest/manifest:file-entry[@manifest:size != '0']"_ostr, 1); assertXPath( @@ -225,7 +225,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest2, testPasswordPreserveMacroSignatureODF13) 1); // test reimport uno::Reference<text::XTextDocument> xTextDoc(mxComponent, uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT_EQUAL(OUString("secret"), xTextDoc->getText()->getString()); + CPPUNIT_ASSERT_EQUAL(u"secret"_ustr, xTextDoc->getText()->getString()); } } @@ -235,7 +235,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest2, testPasswordPreserveMacroSignatureODFWholesom load(createFileURL(u"encrypted_scriptsig_lo242.odt"), "password"); { uno::Reference<text::XTextDocument> xTextDoc(mxComponent, uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT_EQUAL(OUString("secret"), xTextDoc->getText()->getString()); + CPPUNIT_ASSERT_EQUAL(u"secret"_ustr, xTextDoc->getText()->getString()); // test macro signature SfxBaseModel* pBaseModel(dynamic_cast<SfxBaseModel*>(mxComponent.get())); CPPUNIT_ASSERT(pBaseModel); @@ -243,20 +243,20 @@ CPPUNIT_TEST_FIXTURE(SigningTest2, testPasswordPreserveMacroSignatureODFWholesom uno::Reference<beans::XPropertySet> xPropSet(pObjectShell->GetStorage(), uno::UNO_QUERY_THROW); CPPUNIT_ASSERT_EQUAL(ODFVER_013_TEXT, - xPropSet->getPropertyValue("Version").get<OUString>()); + xPropSet->getPropertyValue(u"Version"_ustr).get<OUString>()); CPPUNIT_ASSERT_EQUAL(SignatureState::OK, pObjectShell->GetScriptingSignatureState()); } { // store it with new wholesome ODF extended encryption - reload - saveAndReload("writer8", "password"); + saveAndReload(u"writer8"_ustr, "password"); // test wholesome ODF extended encryption - xmlDocUniquePtr pXmlDoc = parseExport("META-INF/manifest.xml"); - assertXPath(pXmlDoc, "/manifest:manifest"_ostr, "version"_ostr, "1.3"); + xmlDocUniquePtr pXmlDoc = parseExport(u"META-INF/manifest.xml"_ustr); + assertXPath(pXmlDoc, "/manifest:manifest"_ostr, "version"_ostr, u"1.3"_ustr); assertXPath(pXmlDoc, "/manifest:manifest/manifest:file-entry"_ostr, 1); assertXPath(pXmlDoc, "/manifest:manifest/manifest:file-entry"_ostr, "full-path"_ostr, - "encrypted-package"); + u"encrypted-package"_ustr); assertXPath(pXmlDoc, "/manifest:manifest/manifest:file-entry[@manifest:size != '0']"_ostr, 1); assertXPath( @@ -293,7 +293,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest2, testPasswordPreserveMacroSignatureODFWholesom 1); // test reimport uno::Reference<text::XTextDocument> xTextDoc(mxComponent, uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT_EQUAL(OUString("secret"), xTextDoc->getText()->getString()); + CPPUNIT_ASSERT_EQUAL(u"secret"_ustr, xTextDoc->getText()->getString()); // test macro signature - this should work now SfxBaseModel* pBaseModel(dynamic_cast<SfxBaseModel*>(mxComponent.get())); CPPUNIT_ASSERT(pBaseModel); @@ -301,7 +301,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest2, testPasswordPreserveMacroSignatureODFWholesom uno::Reference<beans::XPropertySet> xPropSet(pObjectShell->GetStorage(), uno::UNO_QUERY_THROW); CPPUNIT_ASSERT_EQUAL(ODFVER_013_TEXT, - xPropSet->getPropertyValue("Version").get<OUString>()); + xPropSet->getPropertyValue(u"Version"_ustr).get<OUString>()); CPPUNIT_ASSERT_EQUAL(SignatureState::OK, pObjectShell->GetScriptingSignatureState()); } @@ -318,10 +318,10 @@ CPPUNIT_TEST_FIXTURE(SigningTest2, testPasswordPreserveMacroSignatureODFWholesom officecfg::Office::Common::Save::ODF::DefaultVersion::set(10, pBatch); pBatch->commit(); - saveAndReload("writer8", "password"); + saveAndReload(u"writer8"_ustr, "password"); - xmlDocUniquePtr pXmlDoc = parseExport("META-INF/manifest.xml"); - assertXPath(pXmlDoc, "/manifest:manifest"_ostr, "version"_ostr, "1.3"); + xmlDocUniquePtr pXmlDoc = parseExport(u"META-INF/manifest.xml"_ustr); + assertXPath(pXmlDoc, "/manifest:manifest"_ostr, "version"_ostr, u"1.3"_ustr); assertXPath(pXmlDoc, "/manifest:manifest/manifest:file-entry[@manifest:size != '0']"_ostr, 8); assertXPath( @@ -354,7 +354,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest2, testPasswordPreserveMacroSignatureODFWholesom 8); // test reimport uno::Reference<text::XTextDocument> xTextDoc(mxComponent, uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT_EQUAL(OUString("secret"), xTextDoc->getText()->getString()); + CPPUNIT_ASSERT_EQUAL(u"secret"_ustr, xTextDoc->getText()->getString()); // test macro signature - this didn't actually work! // using Zip Storage means the encrypted streams are signed, so // after encrypting again the signature didn't match and was dropped diff --git a/xmlsecurity/source/component/certificatecontainer.cxx b/xmlsecurity/source/component/certificatecontainer.cxx index e230c7b2ce83..a5842bf5eaa9 100644 --- a/xmlsecurity/source/component/certificatecontainer.cxx +++ b/xmlsecurity/source/component/certificatecontainer.cxx @@ -126,7 +126,7 @@ CertificateContainer::hasCertificate( const OUString & url, const OUString & cer OUString SAL_CALL CertificateContainer::getImplementationName( ) { - return "com.sun.star.security.CertificateContainer"; + return u"com.sun.star.security.CertificateContainer"_ustr; } sal_Bool SAL_CALL @@ -138,7 +138,7 @@ CertificateContainer::supportsService( const OUString& ServiceName ) Sequence< OUString > SAL_CALL CertificateContainer::getSupportedServiceNames( ) { - return { "com.sun.star.security.CertificateContainer" }; + return { u"com.sun.star.security.CertificateContainer"_ustr }; } extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx b/xmlsecurity/source/component/documentdigitalsignatures.cxx index c0f9a58b14f7..3833a76e81e5 100644 --- a/xmlsecurity/source/component/documentdigitalsignatures.cxx +++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx @@ -228,7 +228,7 @@ void DocumentDigitalSignatures::initialize( const Sequence< Any >& aArguments) { if (aArguments.getLength() > 2) throw css::lang::IllegalArgumentException( - "DocumentDigitalSignatures::initialize requires zero, one, or two arguments", + u"DocumentDigitalSignatures::initialize requires zero, one, or two arguments"_ustr, static_cast<XInitialization*>(this), 0); m_nArgumentsCount = aArguments.getLength(); @@ -238,13 +238,13 @@ void DocumentDigitalSignatures::initialize( const Sequence< Any >& aArguments) if (!(aArguments[0] >>= m_sODFVersion)) throw css::lang::IllegalArgumentException( - "DocumentDigitalSignatures::initialize: the first arguments must be a string", + u"DocumentDigitalSignatures::initialize: the first arguments must be a string"_ustr, static_cast<XInitialization*>(this), 0); if (aArguments.getLength() == 2 && !(aArguments[1] >>= m_bHasDocumentSignature)) throw css::lang::IllegalArgumentException( - "DocumentDigitalSignatures::initialize: the second arguments must be a bool", + u"DocumentDigitalSignatures::initialize: the second arguments must be a bool"_ustr, static_cast<XInitialization*>(this), 1); //the Version is supported as of ODF1.2, so for and 1.1 document or older we will receive the @@ -256,7 +256,7 @@ void DocumentDigitalSignatures::initialize( const Sequence< Any >& aArguments) OUString DocumentDigitalSignatures::getImplementationName() { - return "com.sun.star.security.DocumentDigitalSignatures"; + return u"com.sun.star.security.DocumentDigitalSignatures"_ustr; } sal_Bool DocumentDigitalSignatures::supportsService( @@ -268,7 +268,7 @@ sal_Bool DocumentDigitalSignatures::supportsService( css::uno::Sequence<OUString> DocumentDigitalSignatures::getSupportedServiceNames() { - Sequence<OUString> aRet{ "com.sun.star.security.DocumentDigitalSignatures" }; + Sequence<OUString> aRet{ u"com.sun.star.security.DocumentDigitalSignatures"_ustr }; return aRet; } @@ -710,8 +710,8 @@ DocumentDigitalSignatures::chooseCertificatesImpl(std::map<OUString, OUString>& return { Reference< css::security::XCertificate >(nullptr) }; uno::Sequence< Reference< css::security::XCertificate > > xCerts = aChooser->GetSelectedCertificates(); - rProperties["Description"] = aChooser->GetDescription(); - rProperties["Usage"] = aChooser->GetUsageText(); + rProperties[u"Description"_ustr] = aChooser->GetDescription(); + rProperties[u"Usage"_ustr] = aChooser->GetUsageText(); return xCerts; } @@ -725,7 +725,7 @@ Reference< css::security::XCertificate > DocumentDigitalSignatures::chooseSignin { std::map<OUString, OUString> aProperties; Reference< css::security::XCertificate > xCert = chooseCertificatesImpl( aProperties, CertificateChooserUserAction::Sign )[0]; - rDescription = aProperties["Description"]; + rDescription = aProperties[u"Description"_ustr]; return xCert; } @@ -733,7 +733,7 @@ Reference< css::security::XCertificate > DocumentDigitalSignatures::selectSignin { std::map<OUString, OUString> aProperties; Reference< css::security::XCertificate > xCert = chooseCertificatesImpl( aProperties, CertificateChooserUserAction::SelectSign )[0]; - rDescription = aProperties["Description"]; + rDescription = aProperties[u"Description"_ustr]; return xCert; } @@ -744,7 +744,7 @@ DocumentDigitalSignatures::selectSigningCertificateWithType(const CertificateKin std::map<OUString, OUString> aProperties; Reference<css::security::XCertificate> xCert = chooseCertificatesImpl(aProperties, CertificateChooserUserAction::SelectSign, certificateKind)[0]; - rDescription = aProperties["Description"]; + rDescription = aProperties[u"Description"_ustr]; return xCert; } @@ -885,7 +885,7 @@ bool DocumentDigitalSignatures::signWithCertificateImpl( sal_Int32 nSecurityId; - bool bSuccess = aSignatureManager.add(xCertificate, xSecurityContext, "", nSecurityId, true); + bool bSuccess = aSignatureManager.add(xCertificate, xSecurityContext, u""_ustr, nSecurityId, true); if (!bSuccess) return false; diff --git a/xmlsecurity/source/dialogs/certificatechooser.cxx b/xmlsecurity/source/dialogs/certificatechooser.cxx index c95ad1947d0b..0575ae758cfe 100644 --- a/xmlsecurity/source/dialogs/certificatechooser.cxx +++ b/xmlsecurity/source/dialogs/certificatechooser.cxx @@ -41,17 +41,17 @@ using namespace css; CertificateChooser::CertificateChooser(weld::Window* _pParent, std::vector< css::uno::Reference< css::xml::crypto::XXMLSecurityContext > > && rxSecurityContexts, CertificateChooserUserAction eAction) - : GenericDialogController(_pParent, "xmlsec/ui/selectcertificatedialog.ui", "SelectCertificateDialog") + : GenericDialogController(_pParent, u"xmlsec/ui/selectcertificatedialog.ui"_ustr, u"SelectCertificateDialog"_ustr) , meAction(eAction) - , m_xFTSign(m_xBuilder->weld_label("sign")) - , m_xFTEncrypt(m_xBuilder->weld_label("encrypt")) - , m_xCertLB(m_xBuilder->weld_tree_view("signatures")) - , m_xViewBtn(m_xBuilder->weld_button("viewcert")) - , m_xOKBtn(m_xBuilder->weld_button("ok")) - , m_xFTDescription(m_xBuilder->weld_label("description-label")) - , m_xDescriptionED(m_xBuilder->weld_entry("description")) - , m_xSearchBox(m_xBuilder->weld_entry("searchbox")) - , m_xReloadBtn(m_xBuilder->weld_button("reloadcert")) + , m_xFTSign(m_xBuilder->weld_label(u"sign"_ustr)) + , m_xFTEncrypt(m_xBuilder->weld_label(u"encrypt"_ustr)) + , m_xCertLB(m_xBuilder->weld_tree_view(u"signatures"_ustr)) + , m_xViewBtn(m_xBuilder->weld_button(u"viewcert"_ustr)) + , m_xOKBtn(m_xBuilder->weld_button(u"ok"_ustr)) + , m_xFTDescription(m_xBuilder->weld_label(u"description-label"_ustr)) + , m_xDescriptionED(m_xBuilder->weld_entry(u"description"_ustr)) + , m_xSearchBox(m_xBuilder->weld_entry(u"searchbox"_ustr)) + , m_xReloadBtn(m_xBuilder->weld_button(u"reloadcert"_ustr)) { auto nControlWidth = m_xCertLB->get_approximate_digit_width() * 105; m_xCertLB->set_size_request(nControlWidth, m_xCertLB->get_height_rows(12)); diff --git a/xmlsecurity/source/dialogs/certificateviewer.cxx b/xmlsecurity/source/dialogs/certificateviewer.cxx index 62de673c00e4..5d197490bac1 100644 --- a/xmlsecurity/source/dialogs/certificateviewer.cxx +++ b/xmlsecurity/source/dialogs/certificateviewer.cxx @@ -49,23 +49,23 @@ CertificateViewer::CertificateViewer(weld::Window* _pParent, const css::uno::Reference< css::xml::crypto::XSecurityEnvironment >& _rxSecurityEnvironment, const css::uno::Reference< css::security::XCertificate >& _rXCert, bool bCheckForPrivateKey, CertificateChooser* pParentChooser) - : GenericDialogController(_pParent, "xmlsec/ui/viewcertdialog.ui", "ViewCertDialog") + : GenericDialogController(_pParent, u"xmlsec/ui/viewcertdialog.ui"_ustr, u"ViewCertDialog"_ustr) , mbCheckForPrivateKey(bCheckForPrivateKey) , mpParentChooser(pParentChooser) - , mxTabCtrl(m_xBuilder->weld_notebook("tabcontrol")) + , mxTabCtrl(m_xBuilder->weld_notebook(u"tabcontrol"_ustr)) { mxTabCtrl->connect_enter_page(LINK(this, CertificateViewer, ActivatePageHdl)); mxSecurityEnvironment = _rxSecurityEnvironment; mxCert = _rXCert; - mxGeneralPage.reset(new CertificateViewerGeneralTP(mxTabCtrl->get_page("general"), this)); - mxDetailsPage.reset(new CertificateViewerDetailsTP(mxTabCtrl->get_page("details"), this)); + mxGeneralPage.reset(new CertificateViewerGeneralTP(mxTabCtrl->get_page(u"general"_ustr), this)); + mxDetailsPage.reset(new CertificateViewerDetailsTP(mxTabCtrl->get_page(u"details"_ustr), this)); if (!mxSecurityEnvironment->buildCertificatePath(mxCert).hasElements()) - mxTabCtrl->remove_page("path"); + mxTabCtrl->remove_page(u"path"_ustr); else - mxPathId.reset(new CertificateViewerCertPathTP(mxTabCtrl->get_page("path"), this)); - mxTabCtrl->set_current_page("general"); + mxPathId.reset(new CertificateViewerCertPathTP(mxTabCtrl->get_page(u"path"_ustr), this)); + mxTabCtrl->set_current_page(u"general"_ustr); } IMPL_LINK(CertificateViewer, ActivatePageHdl, const OUString&, rPage, void) @@ -83,17 +83,17 @@ CertificateViewerTP::CertificateViewerTP(weld::Container* pParent, const OUStrin } CertificateViewerGeneralTP::CertificateViewerGeneralTP(weld::Container* pParent, CertificateViewer* pDlg) - : CertificateViewerTP(pParent, "xmlsec/ui/certgeneral.ui", "CertGeneral", pDlg) - , m_xCertImg(mxBuilder->weld_image("certimage")) - , m_xHintNotTrustedFT(mxBuilder->weld_label("hintnotrust")) - , m_xIssuedToLabelFT(mxBuilder->weld_label("issued_to")) - , m_xIssuedToFT(mxBuilder->weld_label("issued_to_value")) - , m_xIssuedByLabelFT(mxBuilder->weld_label("issued_by")) - , m_xIssuedByFT(mxBuilder->weld_label("issued_by_value")) - , m_xValidFromDateFT(mxBuilder->weld_label("valid_from_value")) - , m_xValidToDateFT(mxBuilder->weld_label("valid_to_value")) - , m_xKeyImg(mxBuilder->weld_image("keyimage")) - , m_xHintCorrespPrivKeyFT(mxBuilder->weld_label("privatekey")) + : CertificateViewerTP(pParent, u"xmlsec/ui/certgeneral.ui"_ustr, u"CertGeneral"_ustr, pDlg) + , m_xCertImg(mxBuilder->weld_image(u"certimage"_ustr)) + , m_xHintNotTrustedFT(mxBuilder->weld_label(u"hintnotrust"_ustr)) + , m_xIssuedToLabelFT(mxBuilder->weld_label(u"issued_to"_ustr)) + , m_xIssuedToFT(mxBuilder->weld_label(u"issued_to_value"_ustr)) + , m_xIssuedByLabelFT(mxBuilder->weld_label(u"issued_by"_ustr)) + , m_xIssuedByFT(mxBuilder->weld_label(u"issued_by_value"_ustr)) + , m_xValidFromDateFT(mxBuilder->weld_label(u"valid_from_value"_ustr)) + , m_xValidToDateFT(mxBuilder->weld_label(u"valid_to_value"_ustr)) + , m_xKeyImg(mxBuilder->weld_image(u"keyimage"_ustr)) + , m_xHintCorrespPrivKeyFT(mxBuilder->weld_label(u"privatekey"_ustr)) { //Verify the certificate sal_Int32 certStatus = mpDlg->mxSecurityEnvironment->verifyCertificate(mpDlg->mxCert, @@ -157,9 +157,9 @@ void CertificateViewerDetailsTP::InsertElement(const OUString& rField, const OUS } CertificateViewerDetailsTP::CertificateViewerDetailsTP(weld::Container* pParent, CertificateViewer* pDlg) - : CertificateViewerTP(pParent, "xmlsec/ui/certdetails.ui", "CertDetails", pDlg) - , m_xElementsLB(mxBuilder->weld_tree_view("tablecontainer")) - , m_xValueDetails(mxBuilder->weld_text_view("valuedetails")) + : CertificateViewerTP(pParent, u"xmlsec/ui/certdetails.ui"_ustr, u"CertDetails"_ustr, pDlg) + , m_xElementsLB(mxBuilder->weld_tree_view(u"tablecontainer"_ustr)) + , m_xValueDetails(mxBuilder->weld_text_view(u"valuedetails"_ustr)) { const int nWidth = m_xElementsLB->get_approximate_digit_width() * 60; const int nHeight = m_xElementsLB->get_height_rows(8); @@ -252,15 +252,15 @@ IMPL_LINK_NOARG(CertificateViewerDetailsTP, ElementSelectHdl, weld::TreeView&, v } CertificateViewerCertPathTP::CertificateViewerCertPathTP(weld::Container* pParent, CertificateViewer* pDlg) - : CertificateViewerTP(pParent, "xmlsec/ui/certpage.ui", "CertPage", pDlg) + : CertificateViewerTP(pParent, u"xmlsec/ui/certpage.ui"_ustr, u"CertPage"_ustr, pDlg) , mpParent(pDlg) , mbFirstActivateDone(false) - , mxCertPathLB(mxBuilder->weld_tree_view("signatures")) + , mxCertPathLB(mxBuilder->weld_tree_view(u"signatures"_ustr)) , mxScratchIter(mxCertPathLB->make_iterator()) - , mxViewCertPB(mxBuilder->weld_button("viewcert")) - , mxCertStatusML(mxBuilder->weld_text_view("status")) - , mxCertOK(mxBuilder->weld_label("certok")) - , mxCertNotValidated(mxBuilder->weld_label("certnotok")) + , mxViewCertPB(mxBuilder->weld_button(u"viewcert"_ustr)) + , mxCertStatusML(mxBuilder->weld_text_view(u"status"_ustr)) + , mxCertOK(mxBuilder->weld_label(u"certok"_ustr)) + , mxCertNotValidated(mxBuilder->weld_label(u"certnotok"_ustr)) { const int nWidth = mxCertPathLB->get_approximate_digit_width() * 60; const int nHeight = mxCertPathLB->get_height_rows(6); diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx index cfe6845cee34..da396d7ba0a7 100644 --- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx +++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx @@ -193,28 +193,28 @@ DigitalSignaturesDialog::DigitalSignaturesDialog( weld::Window* pParent, const uno::Reference< uno::XComponentContext >& rxCtx, DocumentSignatureMode eMode, bool bReadOnly, OUString sODFVersion, bool bHasDocumentSignature) - : GenericDialogController(pParent, "xmlsec/ui/digitalsignaturesdialog.ui", "DigitalSignaturesDialog") + : GenericDialogController(pParent, u"xmlsec/ui/digitalsignaturesdialog.ui"_ustr, u"DigitalSignaturesDialog"_ustr) , maSignatureManager(rxCtx, eMode) , m_sODFVersion (std::move(sODFVersion)) , m_bHasDocumentSignature(bHasDocumentSignature) , m_bWarningShowSignMacro(false) - , m_xHintDocFT(m_xBuilder->weld_label("dochint")) - , m_xHintBasicFT(m_xBuilder->weld_label("macrohint")) - , m_xHintPackageFT(m_xBuilder->weld_label("packagehint")) - , m_xSignaturesLB(m_xBuilder->weld_tree_view("signatures")) - , m_xSigsValidImg(m_xBuilder->weld_image("validimg")) - , m_xSigsValidFI(m_xBuilder->weld_label("validft")) - , m_xSigsInvalidImg(m_xBuilder->weld_image("invalidimg")) - , m_xSigsInvalidFI(m_xBuilder->weld_label("invalidft")) - , m_xSigsNotvalidatedImg(m_xBuilder->weld_image("notvalidatedimg")) - , m_xSigsNotvalidatedFI(m_xBuilder->weld_label("notvalidatedft")) - , m_xSigsOldSignatureImg(m_xBuilder->weld_image("oldsignatureimg")) - , m_xSigsOldSignatureFI(m_xBuilder->weld_label("oldsignatureft")) - , m_xViewBtn(m_xBuilder->weld_button("view")) - , m_xAddBtn(m_xBuilder->weld_button("sign")) - , m_xRemoveBtn(m_xBuilder->weld_button("remove")) - , m_xStartCertMgrBtn(m_xBuilder->weld_button("start_certmanager")) - , m_xCloseBtn(m_xBuilder->weld_button("close")) + , m_xHintDocFT(m_xBuilder->weld_label(u"dochint"_ustr)) + , m_xHintBasicFT(m_xBuilder->weld_label(u"macrohint"_ustr)) + , m_xHintPackageFT(m_xBuilder->weld_label(u"packagehint"_ustr)) + , m_xSignaturesLB(m_xBuilder->weld_tree_view(u"signatures"_ustr)) + , m_xSigsValidImg(m_xBuilder->weld_image(u"validimg"_ustr)) + , m_xSigsValidFI(m_xBuilder->weld_label(u"validft"_ustr)) + , m_xSigsInvalidImg(m_xBuilder->weld_image(u"invalidimg"_ustr)) + , m_xSigsInvalidFI(m_xBuilder->weld_label(u"invalidft"_ustr)) + , m_xSigsNotvalidatedImg(m_xBuilder->weld_image(u"notvalidatedimg"_ustr)) + , m_xSigsNotvalidatedFI(m_xBuilder->weld_label(u"notvalidatedft"_ustr)) + , m_xSigsOldSignatureImg(m_xBuilder->weld_image(u"oldsignatureimg"_ustr)) + , m_xSigsOldSignatureFI(m_xBuilder->weld_label(u"oldsignatureft"_ustr)) + , m_xViewBtn(m_xBuilder->weld_button(u"view"_ustr)) + , m_xAddBtn(m_xBuilder->weld_button(u"sign"_ustr)) + , m_xRemoveBtn(m_xBuilder->weld_button(u"remove"_ustr)) + , m_xStartCertMgrBtn(m_xBuilder->weld_button(u"start_certmanager"_ustr)) + , m_xCloseBtn(m_xBuilder->weld_button(u"close"_ustr)) { auto nControlWidth = m_xSignaturesLB->get_approximate_digit_width() * 105; m_xSignaturesLB->set_size_request(nControlWidth, m_xSignaturesLB->get_height_rows(10)); @@ -307,7 +307,7 @@ void DigitalSignaturesDialog::SetStorage( const css::uno::Reference < css::embed } // only ODF 1.1 wants to be non-XAdES (m_sODFVersion="1.0" for OOXML somehow?) - m_bAdESCompliant = !rxStore->hasByName("META-INF") // it's a Zip storage + m_bAdESCompliant = !rxStore->hasByName(u"META-INF"_ustr) // it's a Zip storage || !DocumentSignatureHelper::isODFPre_1_2(m_sODFVersion); maSignatureManager.setStore(rxStore); @@ -324,7 +324,7 @@ bool DigitalSignaturesDialog::canAddRemove() //FIXME: this func needs some cleanup, such as real split between //'canAdd' and 'canRemove' case uno::Reference<container::XNameAccess> xNameAccess = maSignatureManager.getStore(); - if (xNameAccess.is() && xNameAccess->hasByName("[Content_Types].xml")) + if (xNameAccess.is() && xNameAccess->hasByName(u"[Content_Types].xml"_ustr)) // It's always possible to append an OOXML signature. return true; @@ -789,7 +789,7 @@ uno::Reference<xml::crypto::XSecurityEnvironment> DigitalSignaturesDialog::getSe case CertificateKind_X509: return maSignatureManager.getSecurityEnvironment(); default: - throw RuntimeException("Unknown certificate kind"); + throw RuntimeException(u"Unknown certificate kind"_ustr); } } diff --git a/xmlsecurity/source/dialogs/macrosecurity.cxx b/xmlsecurity/source/dialogs/macrosecurity.cxx index 9ff7b4088bd7..03b078fcedae 100644 --- a/xmlsecurity/source/dialogs/macrosecurity.cxx +++ b/xmlsecurity/source/dialogs/macrosecurity.cxx @@ -55,18 +55,18 @@ IMPL_LINK_NOARG(MacroSecurity, OkBtnHdl, weld::Button&, void) MacroSecurity::MacroSecurity(weld::Window* pParent, css::uno::Reference<css::xml::crypto::XSecurityEnvironment> xSecurityEnvironment) - : GenericDialogController(pParent, "xmlsec/ui/macrosecuritydialog.ui", "MacroSecurityDialog") + : GenericDialogController(pParent, u"xmlsec/ui/macrosecuritydialog.ui"_ustr, u"MacroSecurityDialog"_ustr) , m_xSecurityEnvironment(std::move(xSecurityEnvironment)) - , m_xTabCtrl(m_xBuilder->weld_notebook("tabcontrol")) - , m_xOkBtn(m_xBuilder->weld_button("ok")) - , m_xResetBtn(m_xBuilder->weld_button("reset")) + , m_xTabCtrl(m_xBuilder->weld_notebook(u"tabcontrol"_ustr)) + , m_xOkBtn(m_xBuilder->weld_button(u"ok"_ustr)) + , m_xResetBtn(m_xBuilder->weld_button(u"reset"_ustr)) { m_xTabCtrl->connect_enter_page(LINK(this, MacroSecurity, ActivatePageHdl)); - m_xLevelTP.reset(new MacroSecurityLevelTP(m_xTabCtrl->get_page("SecurityLevelPage"), this)); - m_xTrustSrcTP.reset(new MacroSecurityTrustedSourcesTP(m_xTabCtrl->get_page("SecurityTrustPage"), this)); + m_xLevelTP.reset(new MacroSecurityLevelTP(m_xTabCtrl->get_page(u"SecurityLevelPage"_ustr), this)); + m_xTrustSrcTP.reset(new MacroSecurityTrustedSourcesTP(m_xTabCtrl->get_page(u"SecurityTrustPage"_ustr), this)); - m_xTabCtrl->set_current_page("SecurityLevelPage"); + m_xTabCtrl->set_current_page(u"SecurityLevelPage"_ustr); m_xOkBtn->connect_clicked(LINK(this, MacroSecurity, OkBtnHdl)); } @@ -95,18 +95,18 @@ MacroSecurityTP::~MacroSecurityTP() } MacroSecurityLevelTP::MacroSecurityLevelTP(weld::Container* pParent, MacroSecurity* pDlg) - : MacroSecurityTP(pParent, "xmlsec/ui/securitylevelpage.ui", "SecurityLevelPage", pDlg) - , m_xVeryHighRB(m_xBuilder->weld_radio_button("vhigh")) - , m_xHighRB(m_xBuilder->weld_radio_button("high")) - , m_xMediumRB(m_xBuilder->weld_radio_button("med")) - , m_xLowRB(m_xBuilder->weld_radio_button("low")) - , m_xVHighImg(m_xBuilder->weld_widget("vhighimg")) - , m_xHighImg(m_xBuilder->weld_widget("highimg")) - , m_xMedImg(m_xBuilder->weld_widget("medimg")) - , m_xLowImg(m_xBuilder->weld_widget("lowimg")) - , m_xWarningLb(m_xBuilder->weld_label("warningmsg")) - , m_xWarningImg(m_xBuilder->weld_image("warningimg")) - , m_xWarningBox(m_xBuilder->weld_box("warningbox")) + : MacroSecurityTP(pParent, u"xmlsec/ui/securitylevelpage.ui"_ustr, u"SecurityLevelPage"_ustr, pDlg) + , m_xVeryHighRB(m_xBuilder->weld_radio_button(u"vhigh"_ustr)) + , m_xHighRB(m_xBuilder->weld_radio_button(u"high"_ustr)) + , m_xMediumRB(m_xBuilder->weld_radio_button(u"med"_ustr)) + , m_xLowRB(m_xBuilder->weld_radio_button(u"low"_ustr)) + , m_xVHighImg(m_xBuilder->weld_widget(u"vhighimg"_ustr)) + , m_xHighImg(m_xBuilder->weld_widget(u"highimg"_ustr)) + , m_xMedImg(m_xBuilder->weld_widget(u"medimg"_ustr)) + , m_xLowImg(m_xBuilder->weld_widget(u"lowimg"_ustr)) + , m_xWarningLb(m_xBuilder->weld_label(u"warningmsg"_ustr)) + , m_xWarningImg(m_xBuilder->weld_image(u"warningimg"_ustr)) + , m_xWarningBox(m_xBuilder->weld_box(u"warningbox"_ustr)) { m_xLowRB->connect_toggled( LINK( this, MacroSecurityLevelTP, RadioButtonHdl ) ); m_xMediumRB->connect_toggled( LINK( this, MacroSecurityLevelTP, RadioButtonHdl ) ); @@ -170,7 +170,7 @@ MacroSecurityLevelTP::MacroSecurityLevelTP(weld::Container* pParent, MacroSecuri m_xLowRB->set_sensitive(false); } - SetWarningLabel(""); + SetWarningLabel(u""_ustr); // Use same font color as in InfobarType::WARNING m_xWarningLb->set_font_color(Color(0x70, 0x43, 0x00)); m_xWarningImg->set_size_request(24, 24); @@ -214,7 +214,7 @@ IMPL_LINK_NOARG(MacroSecurityLevelTP, RadioButtonHdl, weld::Toggleable&, void) SetWarningLabel(XsResId(STR_RELOAD_FILE_WARNING)); else { - SetWarningLabel(""); + SetWarningLabel(u""_ustr); } } @@ -398,15 +398,15 @@ void MacroSecurityTrustedSourcesTP::FillCertLB(const bool bShowWarnings) } MacroSecurityTrustedSourcesTP::MacroSecurityTrustedSourcesTP(weld::Container* pParent, MacroSecurity* pDlg) - : MacroSecurityTP(pParent, "xmlsec/ui/securitytrustpage.ui", "SecurityTrustPage", pDlg) - , m_xTrustCertROFI(m_xBuilder->weld_image("lockcertimg")) - , m_xTrustCertLB(m_xBuilder->weld_tree_view("certificates")) - , m_xViewCertPB(m_xBuilder->weld_button("viewcert")) - , m_xRemoveCertPB(m_xBuilder->weld_button("removecert")) - , m_xTrustFileROFI(m_xBuilder->weld_image("lockfileimg")) - , m_xTrustFileLocLB(m_xBuilder->weld_tree_view("locations")) - , m_xAddLocPB(m_xBuilder->weld_button("addfile")) - , m_xRemoveLocPB(m_xBuilder->weld_button("removefile")) + : MacroSecurityTP(pParent, u"xmlsec/ui/securitytrustpage.ui"_ustr, u"SecurityTrustPage"_ustr, pDlg) + , m_xTrustCertROFI(m_xBuilder->weld_image(u"lockcertimg"_ustr)) + , m_xTrustCertLB(m_xBuilder->weld_tree_view(u"certificates"_ustr)) + , m_xViewCertPB(m_xBuilder->weld_button(u"viewcert"_ustr)) + , m_xRemoveCertPB(m_xBuilder->weld_button(u"removecert"_ustr)) + , m_xTrustFileROFI(m_xBuilder->weld_image(u"lockfileimg"_ustr)) + , m_xTrustFileLocLB(m_xBuilder->weld_tree_view(u"locations"_ustr)) + , m_xAddLocPB(m_xBuilder->weld_button(u"addfile"_ustr)) + , m_xRemoveLocPB(m_xBuilder->weld_button(u"removefile"_ustr)) { auto nColWidth = m_xTrustCertLB->get_approximate_digit_width() * 12; std::vector<int> aWidths diff --git a/xmlsecurity/source/framework/saxeventkeeperimpl.cxx b/xmlsecurity/source/framework/saxeventkeeperimpl.cxx index b490e24327d3..8a0da7185dcc 100644 --- a/xmlsecurity/source/framework/saxeventkeeperimpl.cxx +++ b/xmlsecurity/source/framework/saxeventkeeperimpl.cxx @@ -1127,12 +1127,12 @@ void SAL_CALL SAXEventKeeperImpl::initialize( const css::uno::Sequence< css::uno OUString SAXEventKeeperImpl_getImplementationName () { - return "com.sun.star.xml.security.framework.SAXEventKeeperImpl"; + return u"com.sun.star.xml.security.framework.SAXEventKeeperImpl"_ustr; } css::uno::Sequence< OUString > SAXEventKeeperImpl_getSupportedServiceNames( ) { - return { "com.sun.star.xml.crypto.sax.SAXEventKeeper" }; + return { u"com.sun.star.xml.crypto.sax.SAXEventKeeper"_ustr }; } /* XServiceInfo */ diff --git a/xmlsecurity/source/framework/signaturecreatorimpl.cxx b/xmlsecurity/source/framework/signaturecreatorimpl.cxx index 4371b7ae696d..ebb796bd8350 100644 --- a/xmlsecurity/source/framework/signaturecreatorimpl.cxx +++ b/xmlsecurity/source/framework/signaturecreatorimpl.cxx @@ -148,12 +148,12 @@ void SAL_CALL SignatureCreatorImpl::initialize( const css::uno::Sequence< css::u OUString SignatureCreatorImpl_getImplementationName () { - return "com.sun.star.xml.security.framework.SignatureCreatorImpl"; + return u"com.sun.star.xml.security.framework.SignatureCreatorImpl"_ustr; } css::uno::Sequence< OUString > SignatureCreatorImpl_getSupportedServiceNames( ) { - return { "com.sun.star.xml.crypto.sax.SignatureCreator" }; + return { u"com.sun.star.xml.crypto.sax.SignatureCreator"_ustr }; } /* XServiceInfo */ diff --git a/xmlsecurity/source/framework/signatureverifierimpl.cxx b/xmlsecurity/source/framework/signatureverifierimpl.cxx index 44e9e4c0a46c..b96050d5c0bd 100644 --- a/xmlsecurity/source/framework/signatureverifierimpl.cxx +++ b/xmlsecurity/source/framework/signatureverifierimpl.cxx @@ -103,12 +103,12 @@ void SAL_CALL SignatureVerifierImpl::initialize( OUString SignatureVerifierImpl_getImplementationName () { - return "com.sun.star.xml.security.framework.SignatureVerifierImpl"; + return u"com.sun.star.xml.security.framework.SignatureVerifierImpl"_ustr; } css::uno::Sequence< OUString > SignatureVerifierImpl_getSupportedServiceNames( ) { - return { "com.sun.star.xml.crypto.sax.SignatureVerifier" }; + return { u"com.sun.star.xml.crypto.sax.SignatureVerifier"_ustr }; } /* XServiceInfo */ diff --git a/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx b/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx index 203f0fea2072..3553a77f7e87 100644 --- a/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx +++ b/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx @@ -98,12 +98,12 @@ Sequence< OUString > SAL_CALL XMLSignatureTemplateImpl::getSupportedServiceNames //Helper for XServiceInfo Sequence< OUString > XMLSignatureTemplateImpl::impl_getSupportedServiceNames() { - Sequence<OUString> seqServiceNames { "com.sun.star.xml.crypto.XMLSignatureTemplate" }; + Sequence<OUString> seqServiceNames { u"com.sun.star.xml.crypto.XMLSignatureTemplate"_ustr }; return seqServiceNames ; } OUString XMLSignatureTemplateImpl::impl_getImplementationName() { - return "com.sun.star.xml.security.framework.XMLSignatureTemplateImpl" ; + return u"com.sun.star.xml.security.framework.XMLSignatureTemplateImpl"_ustr ; } //Helper for registry diff --git a/xmlsecurity/source/gpg/CertificateImpl.cxx b/xmlsecurity/source/gpg/CertificateImpl.cxx index 563011e6d688..7e3d942313d6 100644 --- a/xmlsecurity/source/gpg/CertificateImpl.cxx +++ b/xmlsecurity/source/gpg/CertificateImpl.cxx @@ -133,7 +133,7 @@ Sequence< sal_Int8 > SAL_CALL CertificateImpl::getEncoded() ); if (err) - throw RuntimeException("The GpgME library failed to retrieve the public key"); + throw RuntimeException(u"The GpgME library failed to retrieve the public key"_ustr); off_t result = data_out.seek(0,SEEK_SET); (void) result; @@ -147,7 +147,7 @@ Sequence< sal_Int8 > SAL_CALL CertificateImpl::getEncoded() result = data_out.seek(0,SEEK_SET); assert(result == 0); if( data_out.read(m_aBits.getArray(), len) != len ) - throw RuntimeException("The GpgME library failed to read the key"); + throw RuntimeException(u"The GpgME library failed to read the key"_ustr); // Export key to base64Empty for gpg return m_aBits; @@ -234,7 +234,7 @@ const GpgME::Key* CertificateImpl::getCertificate() const /* XServiceInfo */ OUString SAL_CALL CertificateImpl::getImplementationName() { - return "com.sun.star.xml.security.gpg.XCertificate_GpgImpl"; + return u"com.sun.star.xml.security.gpg.XCertificate_GpgImpl"_ustr; } /* XServiceInfo */ diff --git a/xmlsecurity/source/gpg/SEInitializer.cxx b/xmlsecurity/source/gpg/SEInitializer.cxx index 5cfe325aa88b..e81407bef8d8 100644 --- a/xmlsecurity/source/gpg/SEInitializer.cxx +++ b/xmlsecurity/source/gpg/SEInitializer.cxx @@ -62,12 +62,12 @@ sal_Bool SAL_CALL SEInitializerGpg::supportsService(const OUString& rServiceName uno::Sequence<OUString> SAL_CALL SEInitializerGpg::getSupportedServiceNames() { - return { "com.sun.star.xml.crypto.GPGSEInitializer" }; + return { u"com.sun.star.xml.crypto.GPGSEInitializer"_ustr }; } OUString SAL_CALL SEInitializerGpg::getImplementationName() { - return "com.sun.star.xml.security.SEInitializer_Gpg"; + return u"com.sun.star.xml.security.SEInitializer_Gpg"_ustr; } extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* diff --git a/xmlsecurity/source/gpg/SecurityEnvironment.cxx b/xmlsecurity/source/gpg/SecurityEnvironment.cxx index 1fed32d5399e..371291ab5cd2 100644 --- a/xmlsecurity/source/gpg/SecurityEnvironment.cxx +++ b/xmlsecurity/source/gpg/SecurityEnvironment.cxx @@ -79,11 +79,11 @@ SecurityEnvironmentGpg::SecurityEnvironmentGpg() #endif GpgME::Error err = GpgME::checkEngine(GpgME::OpenPGP); if (err) - throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); m_ctx.reset( GpgME::Context::createForProtocol(GpgME::OpenPGP) ); if (m_ctx == nullptr) - throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); m_ctx->setArmor(false); } @@ -144,7 +144,7 @@ Reference< XCertificate > SecurityEnvironmentGpg::getCertificate( const OUString xmlSecSize nWritten; int nRet = xmlSecBase64Decode_ex(strKeyId, const_cast<xmlSecByte*>(strKeyId), xmlStrlen(strKeyId), &nWritten); if(nRet < 0) - throw RuntimeException("Base64 decode failed"); + throw RuntimeException(u"Base64 decode failed"_ustr); m_ctx->setKeyListMode(GPGME_KEYLIST_MODE_LOCAL); GpgME::Error err = m_ctx->startKeyListing("", false); diff --git a/xmlsecurity/source/gpg/XMLSecurityContext.cxx b/xmlsecurity/source/gpg/XMLSecurityContext.cxx index 1fb407113f7a..1dbbb0e2183f 100644 --- a/xmlsecurity/source/gpg/XMLSecurityContext.cxx +++ b/xmlsecurity/source/gpg/XMLSecurityContext.cxx @@ -27,7 +27,7 @@ sal_Int32 SAL_CALL XMLSecurityContextGpg::addSecurityEnvironment( const Reference<XSecurityEnvironment>& aSecurityEnvironment) { if (!aSecurityEnvironment.is()) - throw RuntimeException("Invalid SecurityEnvironment given!"); + throw RuntimeException(u"Invalid SecurityEnvironment given!"_ustr); m_vSecurityEnvironments.push_back(aSecurityEnvironment); return m_vSecurityEnvironments.size() - 1; @@ -42,7 +42,7 @@ Reference<XSecurityEnvironment> SAL_CALL XMLSecurityContextGpg::getSecurityEnvironmentByIndex(sal_Int32 index) { if (index < 0 || o3tl::make_unsigned(index) >= m_vSecurityEnvironments.size()) - throw RuntimeException("Invalid index"); + throw RuntimeException(u"Invalid index"_ustr); return m_vSecurityEnvironments[index]; } @@ -51,7 +51,7 @@ Reference<XSecurityEnvironment> SAL_CALL XMLSecurityContextGpg::getSecurityEnvir { if (m_nDefaultEnvIndex < 0 || o3tl::make_unsigned(m_nDefaultEnvIndex) >= m_vSecurityEnvironments.size()) - throw RuntimeException("Invalid index"); + throw RuntimeException(u"Invalid index"_ustr); return getSecurityEnvironmentByIndex(m_nDefaultEnvIndex); } @@ -69,7 +69,7 @@ void SAL_CALL XMLSecurityContextGpg::setDefaultSecurityEnvironmentIndex(sal_Int3 /* XServiceInfo */ OUString SAL_CALL XMLSecurityContextGpg::getImplementationName() { - return "com.sun.star.xml.security.gpg.XMLSecurityContext_GpgImpl"; + return u"com.sun.star.xml.security.gpg.XMLSecurityContext_GpgImpl"_ustr; } /* XServiceInfo */ @@ -81,7 +81,7 @@ sal_Bool SAL_CALL XMLSecurityContextGpg::supportsService(const OUString& service /* XServiceInfo */ Sequence<OUString> SAL_CALL XMLSecurityContextGpg::getSupportedServiceNames() { - return { OUString("com.sun.star.xml.crypto.XMLSecurityContext") }; + return { u"com.sun.star.xml.crypto.XMLSecurityContext"_ustr }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx b/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx index 04b4bec56ec3..2eff021eb38f 100644 --- a/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx +++ b/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx @@ -166,10 +166,10 @@ SAL_CALL XMLSignature_GpgImpl::generate( // TODO assert that... nodeset = xmlSecNodeSetGetChildren(pNode->doc, cur, 1, 0); if(nodeset == nullptr) - throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); if( xmlSecTransformCtxXmlExecute(&(pDsigCtx->transformCtx), nodeset) < 0 ) - throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); // now extract the keyid from PGPData // walk xml tree to PGPData node - go to children, first is @@ -182,12 +182,12 @@ SAL_CALL XMLSignature_GpgImpl::generate( cur = xmlSecGetNextElementNode(cur->children); // check that this is now PGPData if(!xmlSecCheckNodeName(cur, xmlSecNodePGPData, xmlSecDSigNs)) - throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); // check that this is now PGPKeyID cur = xmlSecGetNextElementNode(cur->children); static const xmlChar xmlSecNodePGPKeyID[] = "PGPKeyID"; if(!xmlSecCheckNodeName(cur, xmlSecNodePGPKeyID, xmlSecDSigNs)) - throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); GpgME::Context& rCtx=pSecEnv->getGpgContext(); rCtx.setKeyListMode(GPGME_KEYLIST_MODE_LOCAL); @@ -196,11 +196,11 @@ SAL_CALL XMLSignature_GpgImpl::generate( xmlSecSize nWritten; int nRet = xmlSecBase64Decode_ex(pKey, reinterpret_cast<xmlSecByte*>(pKey), xmlStrlen(pKey), &nWritten); if(nRet < 0) - throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); if( rCtx.addSigningKey( rCtx.key( reinterpret_cast<char*>(pKey), err, true)) ) - throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); xmlFree(pKey); @@ -224,21 +224,21 @@ SAL_CALL XMLSignature_GpgImpl::generate( len += curr; if(sign_res.error() || !len) - throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); // write signed data to xml xmlChar* signature = static_cast<xmlChar*>(xmlMalloc(len + 1)); if(signature == nullptr) - throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); result = data_out.seek(0,SEEK_SET); assert(result == 0); if( data_out.read(signature, len) != len ) - throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); // conversion to base64 xmlChar* signatureEncoded=nullptr; if( !(signatureEncoded=xmlSecBase64Encode(reinterpret_cast<xmlSecByte*>(signature), len, 79)) ) - throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); xmlFree(signature); // walk xml tree to sign value node - go to children, first is @@ -340,11 +340,11 @@ SAL_CALL XMLSignature_GpgImpl::validate( // TODO assert that... nodeset = xmlSecNodeSetGetChildren(pNode->doc, cur, 1, 0); if(nodeset == nullptr) - throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); + throw RuntimeException(u"The GpgME library failed to initialize for the OpenPGP protocol."_ustr); // TODO assert we really have the SignatureInfo here? if( xmlSecTransformCtxXmlExecute(&(pDsigCtx->transformCtx), nodeset) < 0 ) - throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); -e ... etc. - the rest is truncated