diff options
Diffstat (limited to 'extensions/source')
150 files changed, 1579 insertions, 1886 deletions
diff --git a/extensions/source/abpilot/abpfinalpage.cxx b/extensions/source/abpilot/abpfinalpage.cxx index 6469691b1f99..c75f9cc5b168 100644 --- a/extensions/source/abpilot/abpfinalpage.cxx +++ b/extensions/source/abpilot/abpfinalpage.cxx @@ -27,13 +27,10 @@ #include <unotools/pathoptions.hxx> #include <svl/filenotation.hxx> #include <sfx2/docfilt.hxx> +#include <o3tl/string_view.hxx> namespace abp { - - using namespace ::svt; - using namespace ::utl; - static std::shared_ptr<const SfxFilter> lcl_getBaseFilter() { std::shared_ptr<const SfxFilter> pFilter = SfxFilter::GetFilterByName("StarOffice XML (Base)"); @@ -94,14 +91,14 @@ namespace abp INetURLObject aURL( rSettings.sDataSourceName ); if( aURL.GetProtocol() == INetProtocol::NotValid ) { - OUString sPath = SvtPathOptions().GetWorkPath(); - sPath += "/" + rSettings.sDataSourceName; + OUString sPath = SvtPathOptions().GetWorkPath() + + "/" + rSettings.sDataSourceName; std::shared_ptr<const SfxFilter> pFilter = lcl_getBaseFilter(); if ( pFilter ) { OUString sExt = pFilter->GetDefaultExtension(); - sPath += sExt.getToken(1,'*'); + sPath += o3tl::getToken(sExt,1,'*'); } aURL.SetURL(sPath); diff --git a/extensions/source/abpilot/abspage.cxx b/extensions/source/abpilot/abspage.cxx index ee36cee27ab1..fbe338ea56c8 100644 --- a/extensions/source/abpilot/abspage.cxx +++ b/extensions/source/abpilot/abspage.cxx @@ -23,9 +23,8 @@ namespace abp { using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - AddressBookSourcePage::AddressBookSourcePage(weld::Container* pPage, OAddressBookSourcePilot* pDialog, const OUString& rUIXMLDescription, const OString& rID) + AddressBookSourcePage::AddressBookSourcePage(weld::Container* pPage, OAddressBookSourcePilot* pDialog, const OUString& rUIXMLDescription, const OUString& rID) : AddressBookSourcePage_Base(pPage, pDialog, rUIXMLDescription, rID) , m_pDialog(pDialog) { diff --git a/extensions/source/abpilot/abspage.hxx b/extensions/source/abpilot/abspage.hxx index 4d78533ad885..407713fab99d 100644 --- a/extensions/source/abpilot/abspage.hxx +++ b/extensions/source/abpilot/abspage.hxx @@ -37,7 +37,7 @@ namespace abp OAddressBookSourcePilot* m_pDialog; protected: - AddressBookSourcePage(weld::Container* pPage, OAddressBookSourcePilot* pController, const OUString& rUIXMLDescription, const OString& rID); + AddressBookSourcePage(weld::Container* pPage, OAddressBookSourcePilot* pController, const OUString& rUIXMLDescription, const OUString& rID); protected: // helper diff --git a/extensions/source/abpilot/abspilot.cxx b/extensions/source/abpilot/abspilot.cxx index 0a5cba073f0b..fc135ec80c8f 100644 --- a/extensions/source/abpilot/abspilot.cxx +++ b/extensions/source/abpilot/abspilot.cxx @@ -50,7 +50,6 @@ namespace abp #define PATH_NO_SETTINGS_NO_FIELDS 4 using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; OAddressBookSourcePilot::OAddressBookSourcePilot(weld::Window* _pParent, const Reference< XComponentContext >& _rxORB) :OAddressBookSourcePilot_Base( _pParent ) @@ -361,7 +360,7 @@ namespace abp std::unique_ptr<BuilderPage> OAddressBookSourcePilot::createPage(WizardState _nState) { - OString sIdent(OString::number(_nState)); + OUString sIdent(OUString::number(_nState)); weld::Container* pPageContainer = m_xAssistant->append_page(sIdent); std::unique_ptr<vcl::OWizardPage> xRet; diff --git a/extensions/source/abpilot/admininvokationimpl.cxx b/extensions/source/abpilot/admininvokationimpl.cxx index c8ec00b681a7..7e919c7e7ce0 100644 --- a/extensions/source/abpilot/admininvokationimpl.cxx +++ b/extensions/source/abpilot/admininvokationimpl.cxx @@ -18,7 +18,7 @@ */ #include "admininvokationimpl.hxx" -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <tools/debug.hxx> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <com/sun/star/awt/XWindow.hpp> @@ -26,6 +26,7 @@ #include <comphelper/propertysequence.hxx> #include <strings.hrc> #include <componentmodule.hxx> +#include <utility> #include <vcl/stdtext.hxx> #include <vcl/weld.hxx> @@ -36,15 +37,14 @@ namespace abp using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::awt; using namespace ::com::sun::star::ui::dialogs; using namespace ::com::sun::star::sdbc; OAdminDialogInvokation::OAdminDialogInvokation(const Reference< XComponentContext >& _rxContext, - const css::uno::Reference< css::beans::XPropertySet >& _rxDataSource, + css::uno::Reference< css::beans::XPropertySet > _xDataSource, weld::Window* _pMessageParent) :m_xContext(_rxContext) - ,m_xDataSource(_rxDataSource) + ,m_xDataSource(std::move(_xDataSource)) ,m_pMessageParent(_pMessageParent) { DBG_ASSERT(m_xContext.is(), "OAdminDialogInvokation::OAdminDialogInvokation: invalid service factory!"); diff --git a/extensions/source/abpilot/admininvokationimpl.hxx b/extensions/source/abpilot/admininvokationimpl.hxx index 2003809c8727..fef7a11eb388 100644 --- a/extensions/source/abpilot/admininvokationimpl.hxx +++ b/extensions/source/abpilot/admininvokationimpl.hxx @@ -40,7 +40,7 @@ namespace abp public: OAdminDialogInvokation( const css::uno::Reference< css::uno::XComponentContext >& _rxContext, - const css::uno::Reference< css::beans::XPropertySet >& _rDataSource, + css::uno::Reference< css::beans::XPropertySet > _xDataSource, weld::Window* _pMessageParent ); diff --git a/extensions/source/abpilot/datasourcehandling.cxx b/extensions/source/abpilot/datasourcehandling.cxx index 806acca41f16..fd5820fce1ee 100644 --- a/extensions/source/abpilot/datasourcehandling.cxx +++ b/extensions/source/abpilot/datasourcehandling.cxx @@ -43,7 +43,7 @@ #include <comphelper/interaction.hxx> #include <comphelper/processfactory.hxx> #include <tools/debug.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <unotools/sharedunocomponent.hxx> #include <vcl/stdtext.hxx> #include <vcl/weld.hxx> @@ -141,7 +141,7 @@ namespace abp { xNewDataSource->setPropertyValue( "URL", - makeAny( OUString::createFromAscii( _pInitialAsciiURL ) ) + Any( OUString::createFromAscii( _pInitialAsciiURL ) ) ); } @@ -360,9 +360,9 @@ namespace abp uno::Reference<embed::XStorage> xStorage = pObjectShell->GetStorage(); uno::Sequence<beans::PropertyValue> aSequence = comphelper::InitPropertySequence( { - {"TargetStorage", uno::makeAny(xStorage)}, - {"StreamRelPath", uno::makeAny(aStreamRelPath)}, - {"BaseURI", uno::makeAny(aOwnURL)} + {"TargetStorage", uno::Any(xStorage)}, + {"StreamRelPath", uno::Any(aStreamRelPath)}, + {"BaseURI", uno::Any(aOwnURL)} }); xStorable->storeAsURL(sTmpName, aSequence); m_pImpl->sName = sTmpName; @@ -371,7 +371,7 @@ namespace abp // we can load it again next time the file is imported. uno::Reference<lang::XMultiServiceFactory> xFactory(pObjectShell->GetModel(), uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xPropertySet(xFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY); - xPropertySet->setPropertyValue("EmbeddedDatabaseName", uno::makeAny(aStreamRelPath)); + xPropertySet->setPropertyValue("EmbeddedDatabaseName", uno::Any(aStreamRelPath)); } } } @@ -558,17 +558,17 @@ namespace abp if ( aException.Message.isEmpty() ) { // prepend some context info - SQLContext aDetailedError; - aDetailedError.Message = compmodule::ModuleRes(RID_STR_NOCONNECTION); - aDetailedError.Details = compmodule::ModuleRes(RID_STR_PLEASECHECKSETTINGS); - aDetailedError.NextException = aError; + SQLContext aDetailedError(compmodule::ModuleRes(RID_STR_NOCONNECTION), // message + {}, {}, 0, + aError, // next exception + compmodule::ModuleRes(RID_STR_PLEASECHECKSETTINGS)); // details // handle (aka display) the new context info - xInteractions->handle( new OInteractionRequest( makeAny( aDetailedError ) ) ); + xInteractions->handle( new OInteractionRequest( Any( aDetailedError ) ) ); } else { // handle (aka display) the original error - xInteractions->handle( new OInteractionRequest( makeAny( aException ) ) ); + xInteractions->handle( new OInteractionRequest( Any( aException ) ) ); } } catch( const Exception& ) diff --git a/extensions/source/abpilot/datasourcehandling.hxx b/extensions/source/abpilot/datasourcehandling.hxx index 485c3c15bd90..c6058e45e30a 100644 --- a/extensions/source/abpilot/datasourcehandling.hxx +++ b/extensions/source/abpilot/datasourcehandling.hxx @@ -163,7 +163,7 @@ namespace abp */ bool hasTable( const OUString& _rTableName ) const; - /// return the intern data source object + /// return the internal data source object css::uno::Reference< css::beans::XPropertySet > getDataSource() const; diff --git a/extensions/source/abpilot/fieldmappingimpl.cxx b/extensions/source/abpilot/fieldmappingimpl.cxx index 43a75cf19ee4..b8e8ac56686c 100644 --- a/extensions/source/abpilot/fieldmappingimpl.cxx +++ b/extensions/source/abpilot/fieldmappingimpl.cxx @@ -24,13 +24,12 @@ #include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/sdb/CommandType.hpp> #include <tools/debug.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <vcl/weld.hxx> #include <com/sun/star/util/AliasProgrammaticPair.hpp> #include <strings.hrc> #include <componentmodule.hxx> #include <unotools/confignode.hxx> -#include <sal/macros.h> #include <sal/log.hxx> @@ -50,7 +49,7 @@ namespace abp const char16_t sDriverSettingsNodeName[] = u"/org.openoffice.Office.DataAccess/DriverSettings/com.sun.star.comp.sdbc.MozabDriver"; - constexpr OUStringLiteral sAddressBookNodeName = u"/org.openoffice.Office.DataAccess/AddressBook"; + constexpr OUString sAddressBookNodeName = u"/org.openoffice.Office.DataAccess/AddressBook"_ustr; namespace fieldmapping { @@ -162,10 +161,10 @@ namespace abp _rxContext, sDriverAliasesNodeName, -1, OConfigurationTreeRoot::CM_READONLY); // loop through all programmatic pairs - DBG_ASSERT( 0 == SAL_N_ELEMENTS( pMappingProgrammatics ) % 2, + DBG_ASSERT( 0 == std::size( pMappingProgrammatics ) % 2, "fieldmapping::defaultMapping: invalid programmatic map!" ); // number of pairs - sal_Int32 const nIntersectedProgrammatics = SAL_N_ELEMENTS( pMappingProgrammatics ) / 2; + sal_Int32 const nIntersectedProgrammatics = std::size( pMappingProgrammatics ) / 2; const char** pProgrammatic = pMappingProgrammatics; OUString sAddressProgrammatic; @@ -219,8 +218,8 @@ namespace abp const OUString* pExistentFields = aExistentFields.getConstArray(); const OUString* pExistentFieldsEnd = pExistentFields + aExistentFields.getLength(); - static const OUStringLiteral sProgrammaticNodeName( u"ProgrammaticFieldName" ); - static const OUStringLiteral sAssignedNodeName( u"AssignedFieldName" ); + static constexpr OUString sProgrammaticNodeName( u"ProgrammaticFieldName"_ustr ); + static constexpr OUString sAssignedNodeName( u"AssignedFieldName"_ustr ); for ( ; pExistentFields != pExistentFieldsEnd; ++pExistentFields ) { @@ -238,7 +237,7 @@ namespace abp { // yes // -> set a new value OConfigurationNode aExistentField = aFields.openNode( *pExistentFields ); - aExistentField.setNodeValue( sAssignedNodeName, makeAny( aPos->second ) ); + aExistentField.setNodeValue( sAssignedNodeName, Any( aPos->second ) ); // and remove the mapping entry aFieldAssignment.erase( *pExistentFields ); } @@ -258,8 +257,8 @@ namespace abp // in case the config node for the fields already has the node named <aNewMapping->first>, // the entry should have been removed from aNewMapping (in the above loop) OConfigurationNode aNewField = aFields.createNode( elem.first ); - aNewField.setNodeValue( sProgrammaticNodeName, makeAny( elem.first ) ); - aNewField.setNodeValue( sAssignedNodeName, makeAny( elem.second ) ); + aNewField.setNodeValue( sProgrammaticNodeName, Any( elem.first ) ); + aNewField.setNodeValue( sAssignedNodeName, Any( elem.second ) ); } // commit the changes done @@ -283,9 +282,9 @@ namespace abp OConfigurationTreeRoot aAddressBookSettings = OConfigurationTreeRoot::createWithComponentContext( _rxContext, sAddressBookNodeName); - aAddressBookSettings.setNodeValue( OUString( "DataSourceName" ), makeAny( _rDataSourceName ) ); - aAddressBookSettings.setNodeValue( OUString( "Command" ), makeAny( _rTableName ) ); - aAddressBookSettings.setNodeValue( OUString( "CommandType" ), makeAny( sal_Int16(CommandType::TABLE) ) ); + aAddressBookSettings.setNodeValue( OUString( "DataSourceName" ), Any( _rDataSourceName ) ); + aAddressBookSettings.setNodeValue( OUString( "Command" ), Any( _rTableName ) ); + aAddressBookSettings.setNodeValue( OUString( "CommandType" ), Any( sal_Int16(CommandType::TABLE) ) ); // commit the changes done aAddressBookSettings.commit(); @@ -301,7 +300,7 @@ namespace abp _rxContext, sAddressBookNodeName); // set the flag - aAddressBookSettings.setNodeValue( OUString( "AutoPilotCompleted" ), makeAny( true ) ); + aAddressBookSettings.setNodeValue( OUString( "AutoPilotCompleted" ), Any( true ) ); // commit the changes done aAddressBookSettings.commit(); diff --git a/extensions/source/abpilot/typeselectionpage.cxx b/extensions/source/abpilot/typeselectionpage.cxx index 79cfd5d6b035..8db9f5a2ae43 100644 --- a/extensions/source/abpilot/typeselectionpage.cxx +++ b/extensions/source/abpilot/typeselectionpage.cxx @@ -107,13 +107,13 @@ namespace abp #endif // Items are displayed in list order - m_aAllTypes.push_back( ButtonItem( m_xEvolution.get(), AST_EVOLUTION, bHaveEvolution ) ); - m_aAllTypes.push_back( ButtonItem( m_xEvolutionGroupwise.get(), AST_EVOLUTION_GROUPWISE, bHaveEvolution ) ); - m_aAllTypes.push_back( ButtonItem( m_xEvolutionLdap.get(), AST_EVOLUTION_LDAP, bHaveEvolution ) ); - m_aAllTypes.push_back( ButtonItem( m_xThunderbird.get(), AST_THUNDERBIRD, true ) ); - m_aAllTypes.push_back( ButtonItem( m_xKab.get(), AST_KAB, bHaveKab ) ); - m_aAllTypes.push_back( ButtonItem( m_xMacab.get(), AST_MACAB, bHaveMacab ) ); - m_aAllTypes.push_back( ButtonItem( m_xOther.get(), AST_OTHER, true ) ); + m_aAllTypes.emplace_back(m_xEvolution.get(), AST_EVOLUTION, bHaveEvolution); + m_aAllTypes.emplace_back(m_xEvolutionGroupwise.get(), AST_EVOLUTION_GROUPWISE, bHaveEvolution); + m_aAllTypes.emplace_back(m_xEvolutionLdap.get(), AST_EVOLUTION_LDAP, bHaveEvolution); + m_aAllTypes.emplace_back(m_xThunderbird.get(), AST_THUNDERBIRD, true); + m_aAllTypes.emplace_back(m_xKab.get(), AST_KAB, bHaveKab); + m_aAllTypes.emplace_back(m_xMacab.get(), AST_MACAB, bHaveMacab); + m_aAllTypes.emplace_back(m_xOther.get(), AST_OTHER, true); Link<weld::Toggleable&,void> aTypeSelectionHandler = LINK(this, TypeSelectionPage, OnTypeSelected ); for (auto const& elem : m_aAllTypes) diff --git a/extensions/source/abpilot/unodialogabp.cxx b/extensions/source/abpilot/unodialogabp.cxx index dd878f03e5c3..9608f2551f2b 100644 --- a/extensions/source/abpilot/unodialogabp.cxx +++ b/extensions/source/abpilot/unodialogabp.cxx @@ -31,7 +31,6 @@ namespace abp { using namespace ::com::sun::star; using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::ui::dialogs; @@ -106,7 +105,7 @@ namespace abp Reference<awt::XWindow> xParentWindow; if (aArguments.getLength() == 1 && (aArguments[0] >>= xParentWindow) ) { Sequence< Any > aNewArgs{ Any(PropertyValue( - "ParentWindow", 0, makeAny(xParentWindow), PropertyState_DIRECT_VALUE )) }; + "ParentWindow", 0, Any(xParentWindow), PropertyState_DIRECT_VALUE )) }; OGenericUnoDialog::initialize(aNewArgs); } else { OGenericUnoDialog::initialize(aArguments); @@ -129,8 +128,8 @@ namespace abp // User has one chance to accept it or not. // (or he can start it again by using wizard-menu!) // So we should deregister it on our general job execution service by using right protocol parameters. - css::uno::Sequence< css::beans::NamedValue > lProtocol { { "Deactivate", css::uno::makeAny( true ) } }; - return makeAny( lProtocol ); + css::uno::Sequence< css::beans::NamedValue > lProtocol { { "Deactivate", css::uno::Any( true ) } }; + return Any( lProtocol ); } void OABSPilotUno::executedDialog(sal_Int16 _nExecutionResult) diff --git a/extensions/source/activex/SOActionsApproval.cxx b/extensions/source/activex/SOActionsApproval.cxx index a4092166272b..6fd6d0888141 100644 --- a/extensions/source/activex/SOActionsApproval.cxx +++ b/extensions/source/activex/SOActionsApproval.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -// SOActionsApproval.cpp : Implementation of CHelpApp and DLL registration. +// SOActionsApproval.cxx : Implementation of CHelpApp and DLL registration. #include <sal/config.h> @@ -25,33 +25,14 @@ #include "StdAfx2.h" +#include <so_activex.h> #include "SOActionsApproval.h" #include <sal/macros.h> -#if defined __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wnon-virtual-dtor" -#endif -#include <so_activex.h> -#if defined __clang__ -#pragma clang diagnostic pop -#endif - COM_DECLSPEC_NOTHROW STDMETHODIMP SOActionsApproval::InterfaceSupportsErrorInfo(REFIID riid) { - static const IID* arr[] = { - &IID_ISOActionsApproval, - }; - - for (std::size_t i = 0; i < SAL_N_ELEMENTS(arr); i++) - { -#ifdef _MSC_VER - if (InlineIsEqualGUID(*arr[i], riid)) -#else - if (::ATL::InlineIsEqualGUID(*arr[i], riid)) -#endif - return S_OK; - } + if (InlineIsEqualGUID(IID_ISOActionsApproval, riid)) + return S_OK; return S_FALSE; } diff --git a/extensions/source/activex/SOActionsApproval.h b/extensions/source/activex/SOActionsApproval.h index 2484e74620dd..9b8f4c1e992e 100644 --- a/extensions/source/activex/SOActionsApproval.h +++ b/extensions/source/activex/SOActionsApproval.h @@ -32,14 +32,7 @@ #include <atlctl.h> -#if defined __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wnon-virtual-dtor" -#endif #include <so_activex.h> -#if defined __clang__ -#pragma clang diagnostic pop -#endif // SOActionsApproval diff --git a/extensions/source/activex/SOActiveX.cxx b/extensions/source/activex/SOActiveX.cxx index 2d8dc2a73b91..b72ab0d66ca0 100644 --- a/extensions/source/activex/SOActiveX.cxx +++ b/extensions/source/activex/SOActiveX.cxx @@ -20,21 +20,13 @@ // SOActiveX.cpp : Implementation of CSOActiveX #include "StdAfx2.h" +#include <so_activex.h> #include "SOActiveX.h" #include "SOComWindowPeer.h" #include "SODispatchInterceptor.h" #include "SOActionsApproval.h" #include "com_uno_helper.h" -#if defined __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wnon-virtual-dtor" -#endif -#include <so_activex.h> -#if defined __clang__ -#pragma clang diagnostic pop -#endif - #define STAROFFICE_WINDOWCLASS L"SOParentWindow" @@ -359,7 +351,7 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CSOActiveX::Load( LPPROPERTYBAG pPropBag, LPER // all information from the 'object' tag is in strings if (aVal[ind].vt == VT_BSTR && !wcscmp(aPropNames[ind].pstrName, L"src")) { - mCurFileUrl = wcsdup( aVal[ind].bstrVal ); + mCurFileUrl.AssignBSTR(aVal[ind].bstrVal); } else if( aVal[ind].vt == VT_BSTR && !wcscmp(aPropNames[ind].pstrName, L"readonly")) @@ -384,16 +376,10 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP CSOActiveX::Load( LPPROPERTYBAG pPropBag, LPER return hr; mbReadyForActivation = FALSE; - if (BSTR bStrUrl = SysAllocString(mCurFileUrl)) - { - hr = CBindStatusCallback<CSOActiveX>::Download( - this, &CSOActiveX::CallbackCreateXInputStream, bStrUrl, m_spClientSite, FALSE); - SysFreeString(bStrUrl); - if (hr == MK_S_ASYNCHRONOUS) - hr = S_OK; - } - else - hr = E_OUTOFMEMORY; + hr = CBindStatusCallback<CSOActiveX>::Download( + this, &CSOActiveX::CallbackCreateXInputStream, mCurFileUrl, m_spClientSite, FALSE); + if (hr == MK_S_ASYNCHRONOUS) + hr = S_OK; if ( !SUCCEEDED( hr ) ) { diff --git a/extensions/source/activex/SOActiveX.h b/extensions/source/activex/SOActiveX.h index f3a66e183ed5..49f33d796047 100644 --- a/extensions/source/activex/SOActiveX.h +++ b/extensions/source/activex/SOActiveX.h @@ -29,14 +29,7 @@ #include <atlctl.h> -#if defined __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wnon-virtual-dtor" -#endif #include <so_activex.h> -#if defined __clang__ -#pragma clang diagnostic pop -#endif class SODispatchInterceptor; @@ -81,7 +74,7 @@ protected: CComPtr<IDispatch> mpDispFrame; CComPtr<IDispatch> mpInstanceLocker; CComPtr<IDispatch> mpDispWin; - OLECHAR const * mCurFileUrl; + CComBSTR mCurFileUrl; BOOL mbLoad; BOOL mbViewOnly; WNDCLASSW mPWinClass; diff --git a/extensions/source/activex/SOComWindowPeer.cxx b/extensions/source/activex/SOComWindowPeer.cxx index 0a556466d32f..59510c24a7a7 100644 --- a/extensions/source/activex/SOComWindowPeer.cxx +++ b/extensions/source/activex/SOComWindowPeer.cxx @@ -17,40 +17,21 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -// SOComWindowPeer.cpp : Implementation of CHelpApp and DLL registration. +// SOComWindowPeer.cxx : Implementation of CHelpApp and DLL registration. #include <sal/config.h> #include <cstddef> #include "StdAfx2.h" +#include <so_activex.h> #include "SOComWindowPeer.h" #include <sal/macros.h> -#if defined __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wnon-virtual-dtor" -#endif -#include <so_activex.h> -#if defined __clang__ -#pragma clang diagnostic pop -#endif - COM_DECLSPEC_NOTHROW STDMETHODIMP SOComWindowPeer::InterfaceSupportsErrorInfo(REFIID riid) { - static const IID* arr[] = { - &IID_ISOComWindowPeer, - }; - - for (std::size_t i = 0; i < SAL_N_ELEMENTS(arr); i++) - { -#ifdef _MSC_VER - if (InlineIsEqualGUID(*arr[i], riid)) -#else - if (::ATL::InlineIsEqualGUID(*arr[i], riid)) -#endif - return S_OK; - } + if (InlineIsEqualGUID(IID_ISOComWindowPeer, riid)) + return S_OK; return S_FALSE; } diff --git a/extensions/source/activex/SOComWindowPeer.h b/extensions/source/activex/SOComWindowPeer.h index 379ca767a66a..58136e813637 100644 --- a/extensions/source/activex/SOComWindowPeer.h +++ b/extensions/source/activex/SOComWindowPeer.h @@ -32,14 +32,7 @@ #include <atlctl.h> -#if defined __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wnon-virtual-dtor" -#endif #include <so_activex.h> -#if defined __clang__ -#pragma clang diagnostic pop -#endif // SOComWindowPeer diff --git a/extensions/source/activex/SODispatchInterceptor.cxx b/extensions/source/activex/SODispatchInterceptor.cxx index f40f6263512d..97ea07568fde 100644 --- a/extensions/source/activex/SODispatchInterceptor.cxx +++ b/extensions/source/activex/SODispatchInterceptor.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -// SODispatchInterceptor.cpp : Implementation of CHelpApp and DLL registration. +// SODispatchInterceptor.cxx : Implementation of CHelpApp and DLL registration. #include <sal/config.h> @@ -25,36 +25,16 @@ #include <stdio.h> #include "StdAfx2.h" +#include <so_activex.h> #include "SOActiveX.h" #include "SODispatchInterceptor.h" #include "com_uno_helper.h" #include <sal/macros.h> -#if defined __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wnon-virtual-dtor" -#endif -#include <so_activex.h> -#if defined __clang__ -#pragma clang diagnostic pop -#endif - COM_DECLSPEC_NOTHROW STDMETHODIMP SODispatchInterceptor::InterfaceSupportsErrorInfo(REFIID riid) { - static const IID* arr[] = - { - &IID_ISODispatchInterceptor, - }; - - for (std::size_t i=0;i<SAL_N_ELEMENTS(arr);i++) - { -#ifdef _MSC_VER - if (InlineIsEqualGUID(*arr[i],riid)) -#else - if (::ATL::InlineIsEqualGUID(*arr[i],riid)) -#endif - return S_OK; - } + if (InlineIsEqualGUID(IID_ISODispatchInterceptor, riid)) + return S_OK; return S_FALSE; } diff --git a/extensions/source/activex/StdAfx2.h b/extensions/source/activex/StdAfx2.h index 56bd75b8ac32..b2ab095e91f3 100644 --- a/extensions/source/activex/StdAfx2.h +++ b/extensions/source/activex/StdAfx2.h @@ -41,7 +41,6 @@ #pragma clang diagnostic ignored "-Wmicrosoft" #pragma clang diagnostic ignored "-Wmissing-field-initializers" #pragma clang diagnostic ignored "-Wnon-pod-varargs" -#pragma clang diagnostic ignored "-Wnon-virtual-dtor" #pragma clang diagnostic ignored "-Wnonportable-include-path" #pragma clang diagnostic ignored "-Wsequence-point" #pragma clang diagnostic ignored "-Wsign-compare" @@ -56,6 +55,7 @@ extern CComModule _Module; #include <atlcom.h> #include <atlctl.h> +#undef min #if defined __clang__ #pragma clang diagnostic pop diff --git a/extensions/source/activex/so_activex.cxx b/extensions/source/activex/so_activex.cxx index 70682a416b53..a4ce480613dc 100644 --- a/extensions/source/activex/so_activex.cxx +++ b/extensions/source/activex/so_activex.cxx @@ -27,15 +27,7 @@ #include "StdAfx2.h" #include "resource.h" #include <initguid.h> - -#if defined __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wnon-virtual-dtor" -#endif #include <so_activex.h> -#if defined __clang__ -#pragma clang diagnostic pop -#endif #if defined __clang__ #pragma clang diagnostic push diff --git a/extensions/source/bibliography/bibconfig.cxx b/extensions/source/bibliography/bibconfig.cxx index 1b9ce9e53d02..11ba8999a62c 100644 --- a/extensions/source/bibliography/bibconfig.cxx +++ b/extensions/source/bibliography/bibconfig.cxx @@ -24,16 +24,16 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/sdb/DatabaseContext.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <o3tl/any.hxx> using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; using namespace ::com::sun::star::sdb; -constexpr OUStringLiteral cDataSourceHistory = u"DataSourceHistory"; +constexpr OUString cDataSourceHistory = u"DataSourceHistory"_ustr; Sequence<OUString> const & BibConfig::GetPropertyNames() { @@ -235,14 +235,11 @@ void BibConfig::ImplCommit() !pMapping->aColumnPairs[nFieldAssignment].sLogicalColumnName.isEmpty()) { OUString sSubPrefix = sPrefix + "/_" + OUString::number(nFieldAssignment); - Sequence< PropertyValue > aAssignmentValues(2); - PropertyValue* pAssignmentValues = aAssignmentValues.getArray(); - pAssignmentValues[0].Name = sSubPrefix; - pAssignmentValues[0].Name += sFieldName; - pAssignmentValues[0].Value <<= pMapping->aColumnPairs[nFieldAssignment].sLogicalColumnName; - pAssignmentValues[1].Name = sSubPrefix; - pAssignmentValues[1].Name += sDatabaseFieldName; - pAssignmentValues[1].Value <<= pMapping->aColumnPairs[nFieldAssignment].sRealColumnName; + Sequence< PropertyValue > aAssignmentValues + { + comphelper::makePropertyValue(sSubPrefix + sFieldName, pMapping->aColumnPairs[nFieldAssignment].sLogicalColumnName), + comphelper::makePropertyValue(sSubPrefix + sDatabaseFieldName, pMapping->aColumnPairs[nFieldAssignment].sRealColumnName) + }; SetSetProperties( sPrefix, aAssignmentValues ); nFieldAssignment++; } diff --git a/extensions/source/bibliography/bibcont.cxx b/extensions/source/bibliography/bibcont.cxx index 7c24b0fb3fd2..7e31f8b9b095 100644 --- a/extensions/source/bibliography/bibcont.cxx +++ b/extensions/source/bibliography/bibcont.cxx @@ -49,7 +49,6 @@ BibSplitWindow::BibSplitWindow( vcl::Window* pParent, WinBits nStyle ) : SplitWi } using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; //split window size is a percent value #define WIN_MIN_HEIGHT 10 @@ -193,7 +192,7 @@ void BibBookContainer::GetFocus() bool BibBookContainer::PreNotify( NotifyEvent& rNEvt ) { bool bHandled = false; - if( MouseNotifyEvent::KEYINPUT == rNEvt.GetType() ) + if( NotifyEventType::KEYINPUT == rNEvt.GetType() ) { const KeyEvent* pKEvt = rNEvt.GetKeyEvent(); const vcl::KeyCode aKeyCode = pKEvt->GetKeyCode(); diff --git a/extensions/source/bibliography/bibload.cxx b/extensions/source/bibliography/bibload.cxx index 546b16e054ee..c8d88d8d0160 100644 --- a/extensions/source/bibliography/bibload.cxx +++ b/extensions/source/bibliography/bibload.cxx @@ -18,11 +18,12 @@ */ #include <tools/debug.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <cppuhelper/supportsservice.hxx> #include <svl/itemprop.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <comphelper/processfactory.hxx> +#include <com/sun/star/awt/XVclWindowPeer.hpp> #include <com/sun/star/sdbc/ResultSetType.hpp> #include <com/sun/star/sdbc/ResultSetConcurrency.hpp> #include <com/sun/star/sdbc/SQLException.hpp> @@ -52,6 +53,7 @@ #include "bibconfig.hxx" #include <cppuhelper/implbase.hxx> #include <rtl/ref.hxx> +#include <o3tl/string_view.hxx> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -174,7 +176,7 @@ void BibliographyLoader::load(const Reference< XFrame > & rFrame, const OUString m_pBibMod = OpenBibModul(); - OUString aPartName = rURL.getToken( 1, '/' ); + std::u16string_view aPartName = o3tl::getToken(rURL, 1, '/' ); Reference<XPropertySet> xPrSet(rFrame, UNO_QUERY); if(xPrSet.is()) { @@ -182,7 +184,7 @@ void BibliographyLoader::load(const Reference< XFrame > & rFrame, const OUString aTitle <<= BibResId(RID_BIB_STR_FRAME_TITLE); xPrSet->setPropertyValue("Title", aTitle); } - if(aPartName == "View" || aPartName == "View1") + if(aPartName == u"View" || aPartName == u"View1") { loadView(rFrame, rListener); } @@ -513,8 +515,7 @@ Reference< XPropertySetInfo > BibliographyLoader::getPropertySetInfo() { static const SfxItemPropertyMapEntry aBibProps_Impl[] = { - { u"BibliographyDataFieldNames", 0, cppu::UnoType<Sequence<PropertyValue>>::get(), PropertyAttribute::READONLY, 0}, - { u"", 0, css::uno::Type(), 0, 0 } + { u"BibliographyDataFieldNames"_ustr, 0, cppu::UnoType<Sequence<PropertyValue>>::get(), PropertyAttribute::READONLY, 0}, }; static Reference< XPropertySetInfo > xRet = SfxItemPropertySet(aBibProps_Impl).getPropertySetInfo(); diff --git a/extensions/source/bibliography/bibmod.cxx b/extensions/source/bibliography/bibmod.cxx index 3a6d06672004..9d7ac60330ba 100644 --- a/extensions/source/bibliography/bibmod.cxx +++ b/extensions/source/bibliography/bibmod.cxx @@ -29,10 +29,6 @@ static BibModul* pBibModul=nullptr; static sal_uInt32 nBibModulCount=0; using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::util; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::ucb; HdlBibModul OpenBibModul() { diff --git a/extensions/source/bibliography/bibview.cxx b/extensions/source/bibliography/bibview.cxx index b175fb78a5f9..0809789854ce 100644 --- a/extensions/source/bibliography/bibview.cxx +++ b/extensions/source/bibliography/bibview.cxx @@ -32,7 +32,6 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::form; -using namespace ::com::sun::star::beans; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::uno; diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx index 24dd48de477e..a15a3e889c18 100644 --- a/extensions/source/bibliography/datman.cxx +++ b/extensions/source/bibliography/datman.cxx @@ -21,7 +21,7 @@ #include <o3tl/any.hxx> #include <sal/log.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <comphelper/processfactory.hxx> #include <com/sun/star/sdbc/ResultSetType.hpp> #include <com/sun/star/sdbc/ResultSetConcurrency.hpp> @@ -73,7 +73,7 @@ using namespace ::com::sun::star::lang; // PropertyNames constexpr OUStringLiteral FM_PROP_LABEL = u"Label"; -constexpr OUStringLiteral FM_PROP_CONTROLSOURCE = u"DataField"; +constexpr OUString FM_PROP_CONTROLSOURCE = u"DataField"_ustr; constexpr OUStringLiteral FM_PROP_NAME = u"Name"; static Reference< XConnection > getConnection(const OUString& _rURL) @@ -530,9 +530,7 @@ void SAL_CALL BibInterceptorHelper::setMasterDispatchProvider( const css::uno::R constexpr OUStringLiteral gGridName(u"theGrid"); BibDataManager::BibDataManager() - :BibDataManager_Base( GetMutex() ) - ,m_aLoadListeners(m_aMutex) - ,pBibView( nullptr ) + :pBibView( nullptr ) ,pToolbar(nullptr) { } @@ -630,11 +628,11 @@ void BibDataManager::InsertFields(const Reference< XFormComponent > & _rxGrid) Any aFormatted(bFormattedIsNumeric); xCurrentCol->setPropertyValue("TreatAsNumber", aFormatted); } - Any aColName = makeAny( rField ); + Any aColName( rField ); xCurrentCol->setPropertyValue(FM_PROP_CONTROLSOURCE, aColName); xCurrentCol->setPropertyValue(FM_PROP_LABEL, aColName); - xColContainer->insertByName( rField, makeAny( xCurrentCol ) ); + xColContainer->insertByName( rField, Any( xCurrentCol ) ); } } catch (const Exception&) @@ -661,7 +659,7 @@ Reference< awt::XControlModel > const & BibDataManager::updateGridModel(const Re m_xGridModel = createGridModel( gGridName ); Reference< XNameContainer > xNameCont(xDbForm, UNO_QUERY); - xNameCont->insertByName( sName, makeAny( m_xGridModel ) ); + xNameCont->insertByName( sName, Any( m_xGridModel ) ); } // insert the fields @@ -788,8 +786,8 @@ void BibDataManager::setFilter(const OUString& rQuery) m_xParser->setFilter( rQuery ); OUString aQuery = m_xParser->getFilter(); Reference< XPropertySet > xFormProps( m_xForm, UNO_QUERY_THROW ); - xFormProps->setPropertyValue( "Filter", makeAny( aQuery ) ); - xFormProps->setPropertyValue( "ApplyFilter", makeAny( true ) ); + xFormProps->setPropertyValue( "Filter", Any( aQuery ) ); + xFormProps->setPropertyValue( "ApplyFilter", Any( true ) ); reload(); } catch (const Exception&) @@ -899,7 +897,7 @@ void BibDataManager::setActiveDataSource(const OUString& rURL) aActiveDataTable = aTableNameSeq[0]; aVal <<= aActiveDataTable; aPropertySet->setPropertyValue("Command", aVal); - aPropertySet->setPropertyValue("CommandType", makeAny(CommandType::TABLE)); + aPropertySet->setPropertyValue("CommandType", Any(CommandType::TABLE)); //Caching for Performance aVal <<= sal_Int32(50); aPropertySet->setPropertyValue("FetchSize", aVal); @@ -1014,8 +1012,9 @@ void SAL_CALL BibDataManager::load( ) { xFormAsLoadable->load(); + std::unique_lock g(m_aMutex); EventObject aEvt( static_cast< XWeak* >( this ) ); - m_aLoadListeners.notifyEach( &XLoadListener::loaded, aEvt ); + m_aLoadListeners.notifyEach( g, &XLoadListener::loaded, aEvt ); } } @@ -1034,13 +1033,15 @@ void SAL_CALL BibDataManager::unload( ) EventObject aEvt( static_cast< XWeak* >( this ) ); { - m_aLoadListeners.notifyEach( &XLoadListener::unloading, aEvt ); + std::unique_lock g(m_aMutex); + m_aLoadListeners.notifyEach( g, &XLoadListener::unloading, aEvt ); } xFormAsLoadable->unload(); { - m_aLoadListeners.notifyEach( &XLoadListener::unloaded, aEvt ); + std::unique_lock g(m_aMutex); + m_aLoadListeners.notifyEach( g, &XLoadListener::unloaded, aEvt ); } } @@ -1059,13 +1060,15 @@ void SAL_CALL BibDataManager::reload( ) EventObject aEvt( static_cast< XWeak* >( this ) ); { - m_aLoadListeners.notifyEach( &XLoadListener::reloading, aEvt ); + std::unique_lock g(m_aMutex); + m_aLoadListeners.notifyEach( g, &XLoadListener::reloading, aEvt ); } xFormAsLoadable->reload(); { - m_aLoadListeners.notifyEach( &XLoadListener::reloaded, aEvt ); + std::unique_lock g(m_aMutex); + m_aLoadListeners.notifyEach( g, &XLoadListener::reloaded, aEvt ); } } @@ -1084,13 +1087,15 @@ sal_Bool SAL_CALL BibDataManager::isLoaded( ) void SAL_CALL BibDataManager::addLoadListener( const Reference< XLoadListener >& aListener ) { - m_aLoadListeners.addInterface( aListener ); + std::unique_lock g(m_aMutex); + m_aLoadListeners.addInterface( g, aListener ); } void SAL_CALL BibDataManager::removeLoadListener( const Reference< XLoadListener >& aListener ) { - m_aLoadListeners.removeInterface( aListener ); + std::unique_lock g(m_aMutex); + m_aLoadListeners.removeInterface( g, aListener ); } @@ -1107,7 +1112,7 @@ Reference< awt::XControlModel > BibDataManager::createGridModel(const OUString& // set the Reference< XPropertySet > xPropSet( xModel, UNO_QUERY ); - xPropSet->setPropertyValue( "Name", makeAny( rName ) ); + xPropSet->setPropertyValue( "Name", Any( rName ) ); // set the name of the to-be-created control Any aAny(OUString("com.sun.star.form.control.InteractionGridControl")); @@ -1119,7 +1124,7 @@ Reference< awt::XControlModel > BibDataManager::createGridModel(const OUString& if (xPropInfo->hasPropertyByName(uProp)) { xPropSet->setPropertyValue( - uProp, makeAny<OUString>(INET_HID_SCHEME + HID_BIB_DB_GRIDCTRL)); + uProp, Any(OUString(INET_HID_SCHEME + HID_BIB_DB_GRIDCTRL))); } } catch (const Exception&) @@ -1206,8 +1211,8 @@ Reference< awt::XControlModel > BibDataManager::loadControlModel( Any aFieldName; aFieldName <<= aName; xPropSet->setPropertyValue( FM_PROP_NAME,aFieldName); - xPropSet->setPropertyValue( FM_PROP_CONTROLSOURCE, makeAny( rName ) ); - xPropSet->setPropertyValue("NativeWidgetLook", makeAny( true ) ); + xPropSet->setPropertyValue( FM_PROP_CONTROLSOURCE, Any( rName ) ); + xPropSet->setPropertyValue("NativeWidgetLook", Any( true ) ); if (bForceListBox) { @@ -1265,7 +1270,7 @@ Reference< awt::XControlModel > BibDataManager::loadControlModel( Reference< XFormComponent > aFormComp(xModel,UNO_QUERY ); Reference< XNameContainer > xNameCont( m_xForm, UNO_QUERY ); - xNameCont->insertByName(aName, makeAny( aFormComp ) ); + xNameCont->insertByName(aName, Any( aFormComp ) ); // now if the form where we inserted the new model is already loaded, notify the model of this // Note that this implementation below is a HACK as it relies on the fact that the model adds itself diff --git a/extensions/source/bibliography/datman.hxx b/extensions/source/bibliography/datman.hxx index 36cbdcd594b6..405cf83d85a5 100644 --- a/extensions/source/bibliography/datman.hxx +++ b/extensions/source/bibliography/datman.hxx @@ -25,10 +25,9 @@ #include <com/sun/star/form/XForm.hpp> #include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp> #include <com/sun/star/form/runtime/XFormController.hpp> -#include <cppuhelper/compbase.hxx> -#include <comphelper/interfacecontainer2.hxx> +#include <comphelper/compbase.hxx> +#include <comphelper/interfacecontainer4.hxx> #include <com/sun/star/form/XLoadable.hpp> -#include <comphelper/broadcasthelper.hxx> #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> #include <com/sun/star/frame/XDispatchProviderInterception.hpp> #include <cppuhelper/implbase.hxx> @@ -72,11 +71,9 @@ public: virtual void SAL_CALL setMasterDispatchProvider( const css::uno::Reference< css::frame::XDispatchProvider >& xNewMasterDispatchProvider ) override; }; -typedef cppu::WeakComponentImplHelper < css::form::XLoadable +typedef comphelper::WeakComponentImplHelper < css::form::XLoadable > BibDataManager_Base; -class BibDataManager final - :public ::comphelper::OMutexAndBroadcastHelper - ,public BibDataManager_Base +class BibDataManager final : public BibDataManager_Base { private: css::uno::Reference< css::form::XForm > m_xForm; @@ -90,7 +87,7 @@ private: OUString aDataSourceURL; OUString aQuoteChar; - ::comphelper::OInterfaceContainerHelper2 m_aLoadListeners; + ::comphelper::OInterfaceContainerHelper4<css::form::XLoadListener> m_aLoadListeners; VclPtr< ::bib::BibView> pBibView; VclPtr<BibToolBar> pToolbar; diff --git a/extensions/source/bibliography/formcontrolcontainer.cxx b/extensions/source/bibliography/formcontrolcontainer.cxx index c6ec73700656..f8d43a8a7c88 100644 --- a/extensions/source/bibliography/formcontrolcontainer.cxx +++ b/extensions/source/bibliography/formcontrolcontainer.cxx @@ -19,7 +19,7 @@ #include "formcontrolcontainer.hxx" #include <sal/log.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <algorithm> diff --git a/extensions/source/bibliography/framectr.cxx b/extensions/source/bibliography/framectr.cxx index 1c5f85c03f35..758c8b3484c2 100644 --- a/extensions/source/bibliography/framectr.cxx +++ b/extensions/source/bibliography/framectr.cxx @@ -18,16 +18,19 @@ */ #include <comphelper/types.hxx> +#include <comphelper/propertyvalue.hxx> #include <comphelper/sequence.hxx> #include "framectr.hxx" #include "datman.hxx" #include <toolkit/helper/vclunohelper.hxx> #include "bibconfig.hxx" #include <cppuhelper/implbase.hxx> +#include <utility> #include <vcl/event.hxx> #include <vcl/svapp.hxx> #include <comphelper/processfactory.hxx> #include <com/sun/star/awt/XTextComponent.hpp> +#include <com/sun/star/awt/XVclWindowPeer.hpp> #include <com/sun/star/form/XConfirmDeleteListener.hpp> #include <com/sun/star/form/runtime/XFormController.hpp> #include <com/sun/star/beans/PropertyValue.hpp> @@ -42,7 +45,7 @@ #include <cppuhelper/supportsservice.hxx> #include <sot/exchange.hxx> #include <sot/formats.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <vcl/weld.hxx> #include <osl/mutex.hxx> @@ -145,9 +148,9 @@ void BibFrameCtrl_Impl::disposing( const lang::EventObject& /*Source*/ ) pController->getFrame()->removeFrameActionListener( this ); } -BibFrameController_Impl::BibFrameController_Impl( const uno::Reference< awt::XWindow > & xComponent, +BibFrameController_Impl::BibFrameController_Impl( uno::Reference< awt::XWindow > xComponent, BibDataManager* pDataManager) - :m_xWindow( xComponent ) + :m_xWindow(std::move( xComponent )) ,m_xDatMan( pDataManager ) { m_bDisposing = false; @@ -225,12 +228,15 @@ void BibFrameController_Impl::dispose() if (xFrame.is()) xFrame->removeFrameActionListener( m_xImpl ); + m_xFrame.clear(); aObject.Source = static_cast<XController*>(this); m_xImpl->aLC.disposeAndClear(aObject); m_xDatMan.clear(); m_aStatusListeners.clear(); m_xLastQueriedFocusWin.clear(); + m_xWindow.clear(); + m_xImpl.clear(); } void BibFrameController_Impl::addEventListener( const uno::Reference< lang::XEventListener > & aListener ) @@ -393,10 +399,11 @@ void BibFrameController_Impl::dispatch(const util::URL& _rURL, const uno::Sequen { try { - uno::Sequence< beans::PropertyValue > aNewDataSource(2); - beans::PropertyValue* pProps = aNewDataSource.getArray(); - pProps[0].Value <<= OUString(); - pProps[1].Value <<= aURL; + uno::Sequence< beans::PropertyValue > aNewDataSource + { + comphelper::makePropertyValue( {}, OUString() ), + comphelper::makePropertyValue( {}, aURL ) + }; ChangeDataSource(aNewDataSource); } catch(const Exception&) @@ -478,7 +485,7 @@ void BibFrameController_Impl::dispatch(const util::URL& _rURL, const uno::Sequen { RemoveFilter(); } - else if( _rURL.Complete == "slot:5503" || aCommand == "CloseDoc" ) + else if( _rURL.Complete == ".uno:CloseDoc" || aCommand == "CloseDoc" ) { Application::PostUserEvent( LINK( this, BibFrameController_Impl, DisposeHdl ) ); diff --git a/extensions/source/bibliography/framectr.hxx b/extensions/source/bibliography/framectr.hxx index be91982ccfe4..9aac2cee0dab 100644 --- a/extensions/source/bibliography/framectr.hxx +++ b/extensions/source/bibliography/framectr.hxx @@ -27,6 +27,7 @@ #include <cppuhelper/implbase.hxx> #include <rtl/ref.hxx> #include <tools/link.hxx> +#include <utility> #include <vcl/window.hxx> #include <vector> #include <memory> @@ -44,9 +45,9 @@ class BibStatusDispatch public: css::util::URL aURL; css::uno::Reference< css::frame::XStatusListener > xListener; - BibStatusDispatch( const css::util::URL& rURL, const css::uno::Reference< css::frame::XStatusListener >& rRef ) - : aURL( rURL ) - , xListener( rRef ) + BibStatusDispatch( css::util::URL _aURL, css::uno::Reference< css::frame::XStatusListener > xRef ) + : aURL(std::move( _aURL )) + , xListener(std::move( xRef )) {} }; @@ -73,7 +74,7 @@ friend class BibFrameCtrl_Impl; static bool SaveModified(const css::uno::Reference< css::form::runtime::XFormController>& xController); public: - BibFrameController_Impl( const css::uno::Reference< css::awt::XWindow > & xComponent, + BibFrameController_Impl( css::uno::Reference< css::awt::XWindow > xComponent, BibDataManager* pDatMan); virtual ~BibFrameController_Impl() override; diff --git a/extensions/source/bibliography/general.cxx b/extensions/source/bibliography/general.cxx index a6e6b20beeed..92a4c6843ec1 100644 --- a/extensions/source/bibliography/general.cxx +++ b/extensions/source/bibliography/general.cxx @@ -27,8 +27,11 @@ #include <com/sun/star/uri/UriReferenceFactory.hpp> #include <o3tl/safeint.hxx> +#include <o3tl/string_view.hxx> #include <sal/log.hxx> +#include <osl/diagnose.h> #include <cppuhelper/implbase.hxx> +#include <utility> #include <vcl/event.hxx> #include <vcl/mnemonic.hxx> #include "general.hxx" @@ -72,7 +75,7 @@ bool SplitUrlAndPage(const OUString& rText, OUString& rUrl, int& nPageNumber) return false; } - nPageNumber = xUriRef->getFragment().copy(aPagePrefix.getLength()).toInt32(); + nPageNumber = o3tl::toInt32(xUriRef->getFragment().subView(aPagePrefix.getLength())); xUriRef->clearFragment(); rUrl = xUriRef->getUriReference(); return true; @@ -360,9 +363,8 @@ IMPL_LINK_NOARG(BibGeneralPage, BrowseHdl, weld::Button&, void) } else { - SfxObjectShell* pShell = SfxObjectShell::Current(); OUString aBaseURL; - if (pShell) + if (SfxObjectShell* pShell = SfxObjectShell::Current()) { aBaseURL = pShell->getDocumentBaseURL(); } @@ -475,8 +477,8 @@ BibGeneralPage::~BibGeneralPage() class ChangeListener : public cppu::WeakImplHelper<css::beans::XPropertyChangeListener> { public: - explicit ChangeListener(const css::uno::Reference<css::beans::XPropertySet>& rPropSet) - : m_xPropSet(rPropSet) + explicit ChangeListener(css::uno::Reference<css::beans::XPropertySet> xPropSet) + : m_xPropSet(std::move(xPropSet)) , m_bSelfChanging(false) { } @@ -592,7 +594,7 @@ namespace { aText = m_rEntry.get_text(); } - m_xPropSet->setPropertyValue("Text", makeAny(aText)); + m_xPropSet->setPropertyValue("Text", Any(aText)); css::uno::Reference<css::form::XBoundComponent> xBound(m_xPropSet, css::uno::UNO_QUERY); if (xBound.is()) @@ -666,7 +668,7 @@ namespace m_bSelfChanging = true; Sequence<sal_Int16> aSelection{ o3tl::narrowing<sal_Int16>(m_rComboBox.get_active()) }; - m_xPropSet->setPropertyValue("SelectedItems", makeAny(aSelection)); + m_xPropSet->setPropertyValue("SelectedItems", Any(aSelection)); css::uno::Reference<css::form::XBoundComponent> xBound(m_xPropSet, css::uno::UNO_QUERY); if (xBound.is()) @@ -781,7 +783,6 @@ bool BibGeneralPage::AddXControl(const OUString& rName, weld::Entry& rEntry) if( xPropSet.is()) { - uno::Reference< beans::XPropertySetInfo > xPropInfo = xPropSet->getPropertySetInfo(); maChangeListeners.emplace_back(new EntryChangeListener(rEntry, xPropSet, *this)); maChangeListeners.back()->start(); if (&rEntry == m_xLocalURLED.get()) @@ -822,7 +823,7 @@ IMPL_LINK(BibGeneralPage, GainFocusHdl, weld::Widget&, rWidget, void) } template<class Target> void BibGeneralPage::AddControlWithError(const OUString& rColumnName, const OUString& rColumnUIName, - Target& rWidget, OUString& rErrorString, const OString& rHelpId) + Target& rWidget, OUString& rErrorString, const OUString& rHelpId) { rWidget.set_help_id(rHelpId); rWidget.connect_focus_in(LINK(this, BibGeneralPage, GainFocusHdl)); @@ -848,11 +849,9 @@ bool BibGeneralPage::AddXControl(const OUString& rName, weld::ComboBox& rList) if( xPropSet.is()) { - uno::Reference< beans::XPropertySetInfo > xPropInfo = xPropSet->getPropertySetInfo(); - css::uno::Sequence<OUString> aEntries; xPropSet->getPropertyValue("StringItemList") >>= aEntries; - for (const OUString& rString : std::as_const(aEntries)) + for (const OUString& rString : aEntries) rList.append_text(rString); sal_Int16 nSelection = -1; diff --git a/extensions/source/bibliography/general.hxx b/extensions/source/bibliography/general.hxx index b4d981955891..9708174ffa1f 100644 --- a/extensions/source/bibliography/general.hxx +++ b/extensions/source/bibliography/general.hxx @@ -127,7 +127,7 @@ class BibGeneralPage : public InterimItemWindow bool AddXControl(const OUString& rName, weld::ComboBox& rList); template<class Target> void AddControlWithError(const OUString& rColumnName, const OUString& rColumnUIName, - Target& rWidget, OUString& rErrorString, const OString& rHelpId); + Target& rWidget, OUString& rErrorString, const OUString& rHelpId); void SaveChanges(); diff --git a/extensions/source/bibliography/toolbar.cxx b/extensions/source/bibliography/toolbar.cxx index 8d32a1f4d205..e4041c5a80f1 100644 --- a/extensions/source/bibliography/toolbar.cxx +++ b/extensions/source/bibliography/toolbar.cxx @@ -19,6 +19,7 @@ #include <sal/config.h> +#include <comphelper/propertyvalue.hxx> #include <comphelper/processfactory.hxx> #include <com/sun/star/frame/XDispatch.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> @@ -30,6 +31,7 @@ #include <o3tl/any.hxx> #include <svtools/miscopt.hxx> #include <svtools/imgdef.hxx> +#include <utility> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> #include <vcl/mnemonic.hxx> @@ -47,9 +49,9 @@ using namespace ::com::sun::star::beans; // Constants -------------------------------------------------------------- -BibToolBarListener::BibToolBarListener(BibToolBar *pTB, const OUString& aStr, ToolBoxItemId nId): +BibToolBarListener::BibToolBarListener(BibToolBar *pTB, OUString aStr, ToolBoxItemId nId): nIndex(nId), - aCommand(aStr), + aCommand(std::move(aStr)), pToolBar(pTB) { } @@ -233,8 +235,7 @@ BibToolBar::BibToolBar(vcl::Window* pParent, Link<void*,void> aLink) , aLayoutManager(aLink) , nSymbolsSize(SFX_SYMBOLS_SIZE_SMALL) { - SvtMiscOptions aSvtMiscOptions; - nSymbolsSize = aSvtMiscOptions.GetCurrentSymbolsSize(); + nSymbolsSize = SvtMiscOptions::GetCurrentSymbolsSize(); xSource->Show(); pLbSource->connect_changed(LINK( this, BibToolBar, SelHdl)); @@ -348,14 +349,11 @@ void BibToolBar::Select() } else { - Sequence<PropertyValue> aPropVal(2); - PropertyValue* pPropertyVal = const_cast<PropertyValue*>(aPropVal.getConstArray()); - pPropertyVal[0].Name="QueryText"; - OUString aSelection = pEdQuery->get_text(); - pPropertyVal[0].Value <<= aSelection; - - pPropertyVal[1].Name="QueryField"; - pPropertyVal[1].Value <<= aQueryField; + Sequence<PropertyValue> aPropVal + { + comphelper::makePropertyValue("QueryText", pEdQuery->get_text()), + comphelper::makePropertyValue("QueryField", aQueryField) + }; SendDispatch(nId,aPropVal); } } @@ -425,7 +423,7 @@ sal_uInt16 BibToolBar::InsertFilterItem(const OUString& rMenuEntry) void BibToolBar::SelectFilterItem(sal_uInt16 nId) { - OString sId = OString::number(nId); + OUString sId = OUString::number(nId); xPopupMenu->set_active(sId, true); sSelMenuItem = sId; aQueryField = MnemonicGenerator::EraseAllMnemonicChars(xPopupMenu->get_label(sId)); @@ -473,20 +471,18 @@ bool BibToolBar::PreNotify( NotifyEvent& rNEvt ) { bool bResult = true; - MouseNotifyEvent nSwitch=rNEvt.GetType(); - if (pEdQuery && pEdQuery->has_focus() && nSwitch == MouseNotifyEvent::KEYINPUT) + NotifyEventType nSwitch=rNEvt.GetType(); + if (pEdQuery && pEdQuery->has_focus() && nSwitch == NotifyEventType::KEYINPUT) { const vcl::KeyCode& aKeyCode=rNEvt.GetKeyEvent()->GetKeyCode(); sal_uInt16 nKey = aKeyCode.GetCode(); if(nKey == KEY_RETURN) { - Sequence<PropertyValue> aPropVal(2); - PropertyValue* pPropertyVal = const_cast<PropertyValue*>(aPropVal.getConstArray()); - pPropertyVal[0].Name = "QueryText"; - OUString aSelection = pEdQuery->get_text(); - pPropertyVal[0].Value <<= aSelection; - pPropertyVal[1].Name="QueryField"; - pPropertyVal[1].Value <<= aQueryField; + Sequence<PropertyValue> aPropVal + { + comphelper::makePropertyValue("QueryText", pEdQuery->get_text()), + comphelper::makePropertyValue("QueryField", aQueryField) + }; SendDispatch(nTBC_BT_AUTOFILTER, aPropVal); return bResult; } @@ -505,11 +501,10 @@ IMPL_LINK_NOARG( BibToolBar, SelHdl, weld::ComboBox&, void ) IMPL_LINK_NOARG( BibToolBar, SendSelHdl, Timer*, void ) { - Sequence<PropertyValue> aPropVal(1); - PropertyValue* pPropertyVal = const_cast<PropertyValue*>(aPropVal.getConstArray()); - pPropertyVal[0].Name = "DataSourceName"; - OUString aEntry( MnemonicGenerator::EraseAllMnemonicChars( pLbSource->get_active_text() ) ); - pPropertyVal[0].Value <<= aEntry; + Sequence<PropertyValue> aPropVal + { + comphelper::makePropertyValue("DataSourceName", MnemonicGenerator::EraseAllMnemonicChars( pLbSource->get_active_text() )) + }; SendDispatch(nTBC_SOURCE, aPropVal); } @@ -525,7 +520,7 @@ IMPL_LINK_NOARG(BibToolBar, MenuHdl, ToolBox*, void) tools::Rectangle aRect(GetItemRect(nTBC_BT_AUTOFILTER)); weld::Window* pParent = weld::GetPopupParent(*this, aRect); - OString sId = xPopupMenu->popup_at_rect(pParent, aRect); + OUString sId = xPopupMenu->popup_at_rect(pParent, aRect); if (!sId.isEmpty()) { @@ -533,13 +528,11 @@ IMPL_LINK_NOARG(BibToolBar, MenuHdl, ToolBox*, void) xPopupMenu->set_active(sId, true); sSelMenuItem = sId; aQueryField = MnemonicGenerator::EraseAllMnemonicChars(xPopupMenu->get_label(sId)); - Sequence<PropertyValue> aPropVal(2); - PropertyValue* pPropertyVal = const_cast<PropertyValue*>(aPropVal.getConstArray()); - pPropertyVal[0].Name = "QueryText"; - OUString aSelection = pEdQuery->get_text(); - pPropertyVal[0].Value <<= aSelection; - pPropertyVal[1].Name="QueryField"; - pPropertyVal[1].Value <<= aQueryField; + Sequence<PropertyValue> aPropVal + { + comphelper::makePropertyValue("QueryText", pEdQuery->get_text()), + comphelper::makePropertyValue("QueryField", aQueryField) + }; SendDispatch(nTBC_BT_AUTOFILTER, aPropVal); } @@ -567,7 +560,7 @@ void BibToolBar::DataChanged( const DataChangedEvent& rDCEvt ) IMPL_LINK_NOARG( BibToolBar, OptionsChanged_Impl, LinkParamNone*, void ) { bool bRebuildToolBar = false; - sal_Int16 eSymbolsSize = SvtMiscOptions().GetCurrentSymbolsSize(); + sal_Int16 eSymbolsSize = SvtMiscOptions::GetCurrentSymbolsSize(); if ( nSymbolsSize != eSymbolsSize ) { nSymbolsSize = eSymbolsSize; @@ -581,7 +574,7 @@ IMPL_LINK_NOARG( BibToolBar, OptionsChanged_Impl, LinkParamNone*, void ) IMPL_LINK_NOARG( BibToolBar, SettingsChanged_Impl, VclSimpleEvent&, void ) { // Check if toolbar button size have changed and we have to use system settings - sal_Int16 eSymbolsSize = SvtMiscOptions().GetCurrentSymbolsSize(); + sal_Int16 eSymbolsSize = SvtMiscOptions::GetCurrentSymbolsSize(); if ( eSymbolsSize != nSymbolsSize ) { nSymbolsSize = eSymbolsSize; @@ -598,9 +591,9 @@ void BibToolBar::RebuildToolbar() void BibToolBar::ApplyImageList() { - SetItemImage(nTBC_BT_AUTOFILTER, Image(StockImage::Yes, nSymbolsSize == SFX_SYMBOLS_SIZE_SMALL ? OUString(RID_EXTBMP_AUTOFILTER_SC) : OUString(RID_EXTBMP_AUTOFILTER_LC))); - SetItemImage(nTBC_BT_FILTERCRIT, Image(StockImage::Yes, nSymbolsSize == SFX_SYMBOLS_SIZE_SMALL ? OUString(RID_EXTBMP_FILTERCRIT_SC) : OUString(RID_EXTBMP_FILTERCRIT_LC))); - SetItemImage(nTBC_BT_REMOVEFILTER, Image(StockImage::Yes, nSymbolsSize == SFX_SYMBOLS_SIZE_SMALL ? OUString(RID_EXTBMP_REMOVE_FILTER_SORT_SC) : OUString(RID_EXTBMP_REMOVE_FILTER_SORT_LC))); + SetItemImage(nTBC_BT_AUTOFILTER, Image(StockImage::Yes, nSymbolsSize == SFX_SYMBOLS_SIZE_SMALL ? RID_EXTBMP_AUTOFILTER_SC : RID_EXTBMP_AUTOFILTER_LC)); + SetItemImage(nTBC_BT_FILTERCRIT, Image(StockImage::Yes, nSymbolsSize == SFX_SYMBOLS_SIZE_SMALL ? RID_EXTBMP_FILTERCRIT_SC : RID_EXTBMP_FILTERCRIT_LC)); + SetItemImage(nTBC_BT_REMOVEFILTER, Image(StockImage::Yes, nSymbolsSize == SFX_SYMBOLS_SIZE_SMALL ? RID_EXTBMP_REMOVE_FILTER_SORT_SC : RID_EXTBMP_REMOVE_FILTER_SORT_LC)); AdjustToolBox(); } diff --git a/extensions/source/bibliography/toolbar.hxx b/extensions/source/bibliography/toolbar.hxx index 4f800f050b66..d4e45b2e0b80 100644 --- a/extensions/source/bibliography/toolbar.hxx +++ b/extensions/source/bibliography/toolbar.hxx @@ -44,7 +44,7 @@ protected: public: - BibToolBarListener(BibToolBar *pTB, const OUString& aStr, ToolBoxItemId nId); + BibToolBarListener(BibToolBar *pTB, OUString aStr, ToolBoxItemId nId); virtual ~BibToolBarListener() override; const OUString& GetCommand() const { return aCommand;} @@ -150,7 +150,7 @@ class BibToolBar: public ToolBox std::unique_ptr<weld::Builder> xBuilder; std::unique_ptr<weld::Menu> xPopupMenu; sal_uInt16 nMenuId; - OString sSelMenuItem; + OUString sSelMenuItem; OUString aQueryField; Link<void*,void> aLayoutManager; sal_Int16 nSymbolsSize; diff --git a/extensions/source/config/WinUserInfo/WinUserInfoBe.cxx b/extensions/source/config/WinUserInfo/WinUserInfoBe.cxx index ce4d147220c2..3e76f6faa9ce 100644 --- a/extensions/source/config/WinUserInfo/WinUserInfoBe.cxx +++ b/extensions/source/config/WinUserInfo/WinUserInfoBe.cxx @@ -11,14 +11,12 @@ #include <com/sun/star/beans/Optional.hpp> #include <comphelper/base64.hxx> -#include <comphelper/configurationhelper.hxx> -#include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/container/XNameReplace.hpp> -#include <com/sun/star/util/XChangesBatch.hpp> +#include <comphelper/configuration.hxx> #include <cppuhelper/supportsservice.hxx> #include <map> #include <o3tl/char16_t2wchar_t.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> +#include <officecfg/UserProfile.hxx> #include <Iads.h> #include <Adshlp.h> @@ -27,6 +25,7 @@ #include <Security.h> #include <systools/win32/comtools.hxx> +#include <systools/win32/oleauto.hxx> namespace extensions { @@ -62,23 +61,23 @@ public: namespace { -constexpr OUStringLiteral givenname(u"givenname"); -constexpr OUStringLiteral sn(u"sn"); -constexpr char fathersname[]("fathersname"); -constexpr OUStringLiteral initials(u"initials"); -constexpr OUStringLiteral street(u"street"); -constexpr OUStringLiteral l(u"l"); -constexpr OUStringLiteral st(u"st"); -constexpr char apartment[]("apartment"); -constexpr OUStringLiteral postalcode(u"postalcode"); -constexpr OUStringLiteral c(u"c"); -constexpr OUStringLiteral o(u"o"); -constexpr char position[]("position"); -constexpr OUStringLiteral title(u"title"); -constexpr OUStringLiteral homephone(u"homephone"); -constexpr OUStringLiteral telephonenumber(u"telephonenumber"); -constexpr OUStringLiteral facsimiletelephonenumber(u"facsimiletelephonenumber"); -constexpr OUStringLiteral mail(u"mail"); +constexpr OUString _givenname(u"givenname"_ustr); +constexpr OUString _sn(u"sn"_ustr); +constexpr char _fathersname[]("fathersname"); +constexpr OUString _initials(u"initials"_ustr); +constexpr OUString _street(u"street"_ustr); +constexpr OUString _l(u"l"_ustr); +constexpr OUString _st(u"st"_ustr); +constexpr char _apartment[]("apartment"); +constexpr OUString _postalcode(u"postalcode"_ustr); +constexpr OUString _c(u"c"_ustr); +constexpr OUString _o(u"o"_ustr); +constexpr char _position[]("position"); +constexpr OUString _title(u"title"_ustr); +constexpr OUString _homephone(u"homephone"_ustr); +constexpr OUString _telephonenumber(u"telephonenumber"_ustr); +constexpr OUString _facsimiletelephonenumber(u"facsimiletelephonenumber"_ustr); +constexpr OUString _mail(u"mail"_ustr); // Backend class implementing access to Active Directory user data. It caches its encoded data // in a configuration entry, to allow reusing it when user later doesn't have access to AD DC @@ -86,21 +85,21 @@ constexpr OUStringLiteral mail(u"mail"); class ADsUserAccess : public extensions::config::WinUserInfo::WinUserInfoBe_Impl { public: - ADsUserAccess(const css::uno::Reference<css::uno::XComponentContext>& xContext) + ADsUserAccess() { try { sal::systools::CoInitializeGuard aCoInitializeGuard(COINIT_APARTMENTTHREADED); - auto pADsys = sal::systools::COMReference<IADsADSystemInfo>().CoCreateInstance( - CLSID_ADSystemInfo, nullptr, CLSCTX_INPROC_SERVER); + sal::systools::COMReference<IADsADSystemInfo> pADsys(CLSID_ADSystemInfo, nullptr, + CLSCTX_INPROC_SERVER); - smartBSTR sUserDN; - sal::systools::ThrowIfFailed(pADsys->get_UserName(&sUserDN.ptr), "get_UserName failed"); + sal::systools::BStr sUserDN; + sal::systools::ThrowIfFailed(pADsys->get_UserName(&sUserDN), "get_UserName failed"); // If this user is an AD user, then without an active connection to the domain, all the // above will succeed, and m_sUserDN will be correctly initialized, but the following // call to ADsGetObject will fail, and we will attempt reading cached values. - m_sUserDN = o3tl::toU(sUserDN.ptr); + m_sUserDN = sUserDN; OUString sLdapUserDN = "LDAP://" + m_sUserDN; sal::systools::COMReference<IADsUser> pUser; sal::systools::ThrowIfFailed(ADsGetObject(o3tl::toW(sLdapUserDN.getStr()), IID_IADsUser, @@ -108,69 +107,63 @@ public: "ADsGetObject failed"); // Fetch all the required information right now, when we know to have access to AD // (later the connection may already be lost) - m_aMap[givenname] = Str(pUser, &IADsUser::get_FirstName); - m_aMap[sn] = Str(pUser, &IADsUser::get_LastName); - m_aMap[initials] = Str(pUser, L"initials"); - m_aMap[street] = Str(pUser, L"streetAddress"); - m_aMap[l] = Str(pUser, L"l"); - m_aMap[st] = Str(pUser, L"st"); - m_aMap[postalcode] = Str(pUser, L"postalCode"); - m_aMap[c] = Str(pUser, L"co"); - m_aMap[o] = Str(pUser, L"company"); - m_aMap[title] = Str(pUser, &IADsUser::get_Title); - m_aMap[homephone] = Str(pUser, L"homePhone"); - m_aMap[telephonenumber] = Str(pUser, L"TelephoneNumber"); - m_aMap[facsimiletelephonenumber] = Str(pUser, L"facsimileTelephoneNumber"); - m_aMap[mail] = Str(pUser, &IADsUser::get_EmailAddress); - - CacheData(xContext); + m_aMap[_givenname] = Str(pUser, &IADsUser::get_FirstName); + m_aMap[_sn] = Str(pUser, &IADsUser::get_LastName); + m_aMap[_initials] = Str(pUser, L"initials"); + m_aMap[_street] = Str(pUser, L"streetAddress"); + m_aMap[_l] = Str(pUser, L"l"); + m_aMap[_st] = Str(pUser, L"st"); + m_aMap[_postalcode] = Str(pUser, L"postalCode"); + m_aMap[_c] = Str(pUser, L"co"); + m_aMap[_o] = Str(pUser, L"company"); + m_aMap[_title] = Str(pUser, &IADsUser::get_Title); + m_aMap[_homephone] = Str(pUser, L"homePhone"); + m_aMap[_telephonenumber] = Str(pUser, L"TelephoneNumber"); + m_aMap[_facsimiletelephonenumber] = Str(pUser, L"facsimileTelephoneNumber"); + m_aMap[_mail] = Str(pUser, &IADsUser::get_EmailAddress); + + CacheData(); } catch (sal::systools::ComError&) { // Maybe we temporarily lost connection to AD; try to get cached data - GetCachedData(xContext); + GetCachedData(); } } - virtual OUString GetGivenName() override { return m_aMap[givenname]; } - virtual OUString GetSn() override { return m_aMap[sn]; } - virtual OUString GetInitials() override { return m_aMap[initials]; } - virtual OUString GetStreet() override { return m_aMap[street]; } - virtual OUString GetCity() override { return m_aMap[l]; } - virtual OUString GetState() override { return m_aMap[st]; } - virtual OUString GetPostalCode() override { return m_aMap[postalcode]; } - virtual OUString GetCountry() override { return m_aMap[c]; } - virtual OUString GetOrganization() override { return m_aMap[o]; } - virtual OUString GetTitle() override { return m_aMap[title]; } - virtual OUString GetHomePhone() override { return m_aMap[homephone]; } - virtual OUString GetTelephoneNumber() override { return m_aMap[telephonenumber]; } - virtual OUString GetFaxNumber() override { return m_aMap[facsimiletelephonenumber]; } - virtual OUString GetMail() override { return m_aMap[mail]; } + virtual OUString GetGivenName() override { return m_aMap[_givenname]; } + virtual OUString GetSn() override { return m_aMap[_sn]; } + virtual OUString GetInitials() override { return m_aMap[_initials]; } + virtual OUString GetStreet() override { return m_aMap[_street]; } + virtual OUString GetCity() override { return m_aMap[_l]; } + virtual OUString GetState() override { return m_aMap[_st]; } + virtual OUString GetPostalCode() override { return m_aMap[_postalcode]; } + virtual OUString GetCountry() override { return m_aMap[_c]; } + virtual OUString GetOrganization() override { return m_aMap[_o]; } + virtual OUString GetTitle() override { return m_aMap[_title]; } + virtual OUString GetHomePhone() override { return m_aMap[_homephone]; } + virtual OUString GetTelephoneNumber() override { return m_aMap[_telephonenumber]; } + virtual OUString GetFaxNumber() override { return m_aMap[_facsimiletelephonenumber]; } + virtual OUString GetMail() override { return m_aMap[_mail]; } private: - struct smartBSTR - { - BSTR ptr = nullptr; - ~smartBSTR() { SysFreeString(ptr); } - }; - typedef HRESULT (__stdcall IADsUser::*getstrfunc)(BSTR*); static OUString Str(IADsUser* pUser, getstrfunc func) { - smartBSTR sBstr; - if (FAILED((pUser->*func)(&sBstr.ptr))) + sal::systools::BStr sBstr; + if (FAILED((pUser->*func)(&sBstr))) return ""; - return OUString(o3tl::toU(sBstr.ptr)); + return OUString(sBstr); } static OUString Str(IADsUser* pUser, const wchar_t* property) { - smartBSTR sBstrProp{ SysAllocString(property) }; + sal::systools::BStr sBstrProp{ o3tl::toU(property) }; struct AutoVariant : public VARIANT { AutoVariant() { VariantInit(this); } ~AutoVariant() { VariantClear(this); } } varArr; - if (FAILED(pUser->GetEx(sBstrProp.ptr, &varArr))) + if (FAILED(pUser->GetEx(sBstrProp, &varArr))) return ""; SAFEARRAY* sa = V_ARRAY(&varArr); LONG nStart, nEnd; @@ -188,41 +181,35 @@ private: return ""; } - void CacheData(const css::uno::Reference<css::uno::XComponentContext>& xContext) + void CacheData() { try { OUString sCachedData = "user=" + m_sUserDN // user DN - + "\0" + givenname + "=" + GetGivenName() // 1st name - + "\0" + sn + "=" + GetSn() // sn - + "\0" + initials + "=" + GetInitials() // initials - + "\0" + street + "=" + GetStreet() // street - + "\0" + l + "=" + GetCity() // l - + "\0" + st + "=" + GetState() // st - + "\0" + postalcode + "=" + GetPostalCode() // p.code - + "\0" + c + "=" + GetCountry() // c - + "\0" + o + "=" + GetOrganization() // o - + "\0" + title + "=" + GetTitle() // title - + "\0" + homephone + "=" + GetHomePhone() // h.phone - + "\0" + telephonenumber + "=" + GetTelephoneNumber() // tel - + "\0" + facsimiletelephonenumber + "=" + GetFaxNumber() // fax - + "\0" + mail + "=" + GetMail(); // mail + + "\0" + _givenname + "=" + GetGivenName() // 1st name + + "\0" + _sn + "=" + GetSn() // sn + + "\0" + _initials + "=" + GetInitials() // initials + + "\0" + _street + "=" + GetStreet() // street + + "\0" + _l + "=" + GetCity() // l + + "\0" + _st + "=" + GetState() // st + + "\0" + _postalcode + "=" + GetPostalCode() // p.code + + "\0" + _c + "=" + GetCountry() // c + + "\0" + _o + "=" + GetOrganization() // o + + "\0" + _title + "=" + GetTitle() // title + + "\0" + _homephone + "=" + GetHomePhone() // h.phone + + "\0" + _telephonenumber + "=" + GetTelephoneNumber() // tel + + "\0" + _facsimiletelephonenumber + "=" + GetFaxNumber() // fax + + "\0" + _mail + "=" + GetMail(); // mail const css::uno::Sequence<sal_Int8> seqCachedData( reinterpret_cast<const sal_Int8*>(sCachedData.getStr()), sCachedData.getLength() * sizeof(sal_Unicode)); OUStringBuffer sOutBuf; comphelper::Base64::encode(sOutBuf, seqCachedData); - auto xIface = comphelper::ConfigurationHelper::openConfig( - xContext, "org.openoffice.UserProfile/WinUserInfo", - comphelper::EConfigurationModes::Standard); - css::uno::Reference<css::container::XNameReplace> xNameReplace( - xIface, css::uno::UNO_QUERY_THROW); - xNameReplace->replaceByName("Cache", css::uno::makeAny(sOutBuf.makeStringAndClear())); - - css::uno::Reference<css::util::XChangesBatch> xChangesBatch(xIface, - css::uno::UNO_QUERY_THROW); - xChangesBatch->commitChanges(); + std::shared_ptr<comphelper::ConfigurationChanges> batch( + comphelper::ConfigurationChanges::create()); + officecfg::UserProfile::WinUserInfo::Cache::set(sOutBuf.makeStringAndClear(), batch); + batch->commit(); } catch (const css::uno::Exception&) { @@ -231,18 +218,13 @@ private: } } - void GetCachedData(const css::uno::Reference<css::uno::XComponentContext>& xContext) + void GetCachedData() { if (m_sUserDN.isEmpty()) throw css::uno::RuntimeException(); - auto xIface = comphelper::ConfigurationHelper::openConfig( - xContext, "org.openoffice.UserProfile/WinUserInfo", - comphelper::EConfigurationModes::ReadOnly); - css::uno::Reference<css::container::XNameAccess> xNameAccess(xIface, - css::uno::UNO_QUERY_THROW); - OUString sCache; - xNameAccess->getByName("Cache") >>= sCache; + OUString sCache = officecfg::UserProfile::WinUserInfo::Cache::get(); + if (sCache.isEmpty()) throw css::uno::RuntimeException(); @@ -321,13 +303,13 @@ namespace config { namespace WinUserInfo { -WinUserInfoBe::WinUserInfoBe(const css::uno::Reference<css::uno::XComponentContext>& xContext) +WinUserInfoBe::WinUserInfoBe() : WinUserInfoMutexHolder() , BackendBase(mMutex) { try { - m_pImpl.reset(new ADsUserAccess(xContext)); + m_pImpl.reset(new ADsUserAccess()); } catch (css::uno::RuntimeException&) { @@ -348,79 +330,79 @@ css::uno::Any WinUserInfoBe::getPropertyValue(OUString const& PropertyName) OUString sValue; // Only process the first argument of possibly multiple space- or comma-separated arguments OUString sToken = PropertyName.getToken(0, ' ').getToken(0, ','); - if (sToken == givenname) + if (sToken == _givenname) { sValue = m_pImpl->GetGivenName(); } - else if (sToken == sn) + else if (sToken == _sn) { sValue = m_pImpl->GetSn(); } - else if (sToken == fathersname) + else if (sToken == _fathersname) { sValue = m_pImpl->GetFathersname(); } - else if (sToken == initials) + else if (sToken == _initials) { sValue = m_pImpl->GetInitials(); } - else if (sToken == street) + else if (sToken == _street) { sValue = m_pImpl->GetStreet(); } - else if (sToken == l) + else if (sToken == _l) { sValue = m_pImpl->GetCity(); } - else if (sToken == st) + else if (sToken == _st) { sValue = m_pImpl->GetState(); } - else if (sToken == apartment) + else if (sToken == _apartment) { sValue = m_pImpl->GetApartment(); } - else if (sToken == postalcode) + else if (sToken == _postalcode) { sValue = m_pImpl->GetPostalCode(); } - else if (sToken == c) + else if (sToken == _c) { sValue = m_pImpl->GetCountry(); } - else if (sToken == o) + else if (sToken == _o) { sValue = m_pImpl->GetOrganization(); } - else if (sToken == position) + else if (sToken == _position) { sValue = m_pImpl->GetPosition(); } - else if (sToken == title) + else if (sToken == _title) { sValue = m_pImpl->GetTitle(); } - else if (sToken == homephone) + else if (sToken == _homephone) { sValue = m_pImpl->GetHomePhone(); } - else if (sToken == telephonenumber) + else if (sToken == _telephonenumber) { sValue = m_pImpl->GetTelephoneNumber(); } - else if (sToken == facsimiletelephonenumber) + else if (sToken == _facsimiletelephonenumber) { sValue = m_pImpl->GetFaxNumber(); } - else if (sToken == mail) + else if (sToken == _mail) { sValue = m_pImpl->GetMail(); } else throw css::beans::UnknownPropertyException(sToken, static_cast<cppu::OWeakObject*>(this)); - return css::uno::makeAny(css::beans::Optional<css::uno::Any>( - !sValue.isEmpty(), sValue.isEmpty() ? css::uno::Any() : css::uno::makeAny(sValue))); + return css::uno::Any(css::beans::Optional<css::uno::Any>( + !sValue.isEmpty(), sValue.isEmpty() ? css::uno::Any() : css::uno::Any(sValue))); } OUString SAL_CALL WinUserInfoBe::getImplementationName() @@ -442,10 +424,10 @@ css::uno::Sequence<OUString> SAL_CALL WinUserInfoBe::getSupportedServiceNames() } extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* -extensions_WinUserInfoBe_get_implementation(css::uno::XComponentContext* context, +extensions_WinUserInfoBe_get_implementation(css::uno::XComponentContext*, css::uno::Sequence<css::uno::Any> const&) { - return cppu::acquire(new extensions::config::WinUserInfo::WinUserInfoBe(context)); + return cppu::acquire(new extensions::config::WinUserInfo::WinUserInfoBe()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/config/WinUserInfo/WinUserInfoBe.hxx b/extensions/source/config/WinUserInfo/WinUserInfoBe.hxx index 7914121469c7..30ca088c3aca 100644 --- a/extensions/source/config/WinUserInfo/WinUserInfoBe.hxx +++ b/extensions/source/config/WinUserInfo/WinUserInfoBe.hxx @@ -51,7 +51,7 @@ struct WinUserInfoMutexHolder class WinUserInfoBe : private WinUserInfoMutexHolder, public BackendBase { public: - explicit WinUserInfoBe(const css::uno::Reference<css::uno::XComponentContext>& xContext); + explicit WinUserInfoBe(); virtual ~WinUserInfoBe() override; // XServiceInfo diff --git a/extensions/source/config/ldap/ldapuserprofilebe.cxx b/extensions/source/config/ldap/ldapuserprofilebe.cxx index 41fbe634cc34..a735b5fbd71a 100644 --- a/extensions/source/config/ldap/ldapuserprofilebe.cxx +++ b/extensions/source/config/ldap/ldapuserprofilebe.cxx @@ -21,7 +21,7 @@ #include "ldapaccess.hxx" #include "ldapuserprofilebe.hxx" #include <sal/log.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <rtl/instance.hxx> #include <com/sun/star/beans/NamedValue.hpp> @@ -46,7 +46,7 @@ LdapUserProfileBe::LdapUserProfileBe( const uno::Reference<uno::XComponentContex // the configuration for the backend would create another instance of the // backend, which would try and read the configuration which would... { - osl::Mutex & aInitMutex = rtl::Static< osl::Mutex, LdapUserProfileBe >::get(); + static osl::Mutex aInitMutex; osl::MutexGuard aInitGuard(aInitMutex); static bool bReentrantCall; // = false @@ -93,7 +93,7 @@ bool LdapUserProfileBe::readLdapConfiguration( uno::Reference< lang::XMultiServiceFactory > xCfgProvider( css::configuration::theDefaultProvider::get(context)); - css::beans::NamedValue aPath("nodepath", uno::makeAny(OUString("org.openoffice.LDAP/UserDirectory")) ); + css::beans::NamedValue aPath("nodepath", uno::Any(OUString("org.openoffice.LDAP/UserDirectory")) ); uno::Sequence< uno::Any > aArgs{ uno::Any(aPath) }; @@ -172,16 +172,16 @@ css::uno::Any LdapUserProfileBe::getPropertyValue( } LdapData::iterator k(data_.find(PropertyName.copy(i, j - i))); if (k != data_.end()) { - return css::uno::makeAny( + return css::uno::Any( css::beans::Optional< css::uno::Any >( - true, css::uno::makeAny(k->second))); + true, css::uno::Any(k->second))); } if (j == PropertyName.getLength()) { break; } i = j + 1; } - return css::uno::makeAny(css::beans::Optional< css::uno::Any >()); + return css::uno::Any(css::beans::Optional< css::uno::Any >()); } diff --git a/extensions/source/dbpilots/commonpagesdbp.cxx b/extensions/source/dbpilots/commonpagesdbp.cxx index 3566e91c5c61..8bac5d09c42c 100644 --- a/extensions/source/dbpilots/commonpagesdbp.cxx +++ b/extensions/source/dbpilots/commonpagesdbp.cxx @@ -31,7 +31,7 @@ #include <com/sun/star/sdb/CommandType.hpp> #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> #include <tools/debug.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <comphelper/interaction.hxx> #include <connectivity/dbtools.hxx> #include <sfx2/docfilt.hxx> @@ -46,7 +46,6 @@ namespace dbp using namespace ::com::sun::star; using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; using namespace ::com::sun::star::container; using namespace ::com::sun::star::sdb; using namespace ::com::sun::star::sdbc; @@ -58,7 +57,6 @@ namespace dbp : OControlWizardPage(pPage, pWizard, "modules/sabpilot/ui/tableselectionpage.ui", "TableSelectionPage") , m_xTable(m_xBuilder->weld_tree_view("table")) , m_xDatasource(m_xBuilder->weld_tree_view("datasource")) - , m_xDatasourceLabel(m_xBuilder->weld_label("datasourcelabel")) , m_xSearchDatabase(m_xBuilder->weld_button("search")) , m_xSourceBox(m_xBuilder->weld_container("sourcebox")) { @@ -162,13 +160,13 @@ namespace dbp xOldConn = getFormConnection(); OUString sDataSource = m_xDatasource->get_selected_text(); - rContext.xForm->setPropertyValue("DataSourceName", makeAny( sDataSource ) ); + rContext.xForm->setPropertyValue("DataSourceName", Any( sDataSource ) ); } OUString sCommand = m_xTable->get_selected_text(); sal_Int32 nCommandType = m_xTable->get_selected_id().toInt32(); - rContext.xForm->setPropertyValue("Command", makeAny( sCommand ) ); - rContext.xForm->setPropertyValue("CommandType", makeAny( nCommandType ) ); + rContext.xForm->setPropertyValue("Command", Any( sCommand ) ); + rContext.xForm->setPropertyValue("CommandType", Any( nCommandType ) ); if ( !rContext.bEmbedded ) setFormConnection( xOldConn, false ); @@ -344,7 +342,7 @@ namespace dbp lcl_fillEntries(*m_xTable, aQueryNames, BMP_QUERY, CommandType::QUERY); } - OMaybeListSelectionPage::OMaybeListSelectionPage(weld::Container* pPage, OControlWizard* pWizard, const OUString& rUIXMLDescription, const OString& rID) + OMaybeListSelectionPage::OMaybeListSelectionPage(weld::Container* pPage, OControlWizard* pWizard, const OUString& rUIXMLDescription, const OUString& rID) : OControlWizardPage(pPage, pWizard, rUIXMLDescription, rID) , m_pYes(nullptr) , m_pNo(nullptr) diff --git a/extensions/source/dbpilots/commonpagesdbp.hxx b/extensions/source/dbpilots/commonpagesdbp.hxx index 1ae74215009a..66115a14451c 100644 --- a/extensions/source/dbpilots/commonpagesdbp.hxx +++ b/extensions/source/dbpilots/commonpagesdbp.hxx @@ -29,7 +29,6 @@ namespace dbp { std::unique_ptr<weld::TreeView> m_xTable; std::unique_ptr<weld::TreeView> m_xDatasource; - std::unique_ptr<weld::Label> m_xDatasourceLabel; std::unique_ptr<weld::Button> m_xSearchDatabase; std::unique_ptr<weld::Container> m_xSourceBox; @@ -66,7 +65,7 @@ namespace dbp weld::ComboBox* m_pList; public: - OMaybeListSelectionPage(weld::Container* pPage, OControlWizard* pWizard, const OUString& rUIXMLDescription, const OString& rID); + OMaybeListSelectionPage(weld::Container* pPage, OControlWizard* pWizard, const OUString& rUIXMLDescription, const OUString& rID); virtual ~OMaybeListSelectionPage() override; protected: @@ -89,7 +88,6 @@ namespace dbp class ODBFieldPage : public OMaybeListSelectionPage { - protected: std::unique_ptr<weld::Label> m_xDescription; std::unique_ptr<weld::RadioButton> m_xStoreYes; std::unique_ptr<weld::RadioButton> m_xStoreNo; diff --git a/extensions/source/dbpilots/controlwizard.cxx b/extensions/source/dbpilots/controlwizard.cxx index e8a2dfef1189..1b0d3ceaf77c 100644 --- a/extensions/source/dbpilots/controlwizard.cxx +++ b/extensions/source/dbpilots/controlwizard.cxx @@ -19,7 +19,7 @@ #include "controlwizard.hxx" #include <tools/debug.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/sdbcx/XTablesSupplier.hpp> #include <com/sun/star/sdb/DatabaseContext.hpp> @@ -50,7 +50,6 @@ namespace dbp { using namespace ::com::sun::star::uno; using namespace ::com::sun::star::awt; - using namespace ::com::sun::star::lang; using namespace ::com::sun::star::sdb; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::sdbcx; @@ -72,7 +71,7 @@ namespace dbp OAccessRegulator() { } }; - OControlWizardPage::OControlWizardPage(weld::Container* pPage, OControlWizard* pWizard, const OUString& rUIXMLDescription, const OString& rID) + OControlWizardPage::OControlWizardPage(weld::Container* pPage, OControlWizard* pWizard, const OUString& rUIXMLDescription, const OUString& rID) : OControlWizardPage_Base(pPage, pWizard, rUIXMLDescription, rID) , m_pDialog(pWizard) { @@ -150,7 +149,6 @@ namespace dbp m_xFormDatasource = m_xBuilder->weld_label("datasource"); m_xFormDatasourceLabel = m_xBuilder->weld_label("datasourcelabel"); m_xFormTable = m_xBuilder->weld_label("formtable"); - m_xFormTableLabel = m_xBuilder->weld_label("formtablelabel"); const OControlWizardContext& rContext = getContext(); if ( rContext.bEmbedded ) @@ -411,7 +409,7 @@ namespace dbp } else { - m_aContext.xForm->setPropertyValue("ActiveConnection", makeAny( _rxConn ) ); + m_aContext.xForm->setPropertyValue("ActiveConnection", Any( _rxConn ) ); } } catch(const Exception&) @@ -527,7 +525,7 @@ namespace dbp // not interested in any results, only in the fields Reference< XPropertySet > xStatementProps(xStatement, UNO_QUERY); - xStatementProps->setPropertyValue("MaxRows", makeAny(sal_Int32(0))); + xStatementProps->setPropertyValue("MaxRows", Any(sal_Int32(0))); // TODO: think about handling local SQLExceptions here ... Reference< XColumnsSupplier > xSupplyCols(xStatement->executeQuery(), UNO_QUERY); @@ -576,16 +574,15 @@ namespace dbp { // an SQLException (or derivee) was thrown ... // prepend an extra SQLContext explaining what we were doing - SQLContext aContext; - aContext.Message = compmodule::ModuleRes(RID_STR_COULDNOTOPENTABLE); - aContext.NextException = aSQLException; + SQLContext aContext(compmodule::ModuleRes(RID_STR_COULDNOTOPENTABLE), {}, {}, 0, + aSQLException, {}); // create an interaction handler to display this exception Reference< XInteractionHandler > xHandler = getInteractionHandler(m_xAssistant.get()); if ( !xHandler.is() ) return false; - Reference< XInteractionRequest > xRequest = new OInteractionRequest(makeAny(aContext)); + Reference< XInteractionRequest > xRequest = new OInteractionRequest(Any(aContext)); try { xHandler->handle(xRequest); @@ -613,7 +610,7 @@ namespace dbp OUString sControlLabel(_pSettings->sControlLabel); m_aContext.xObjectModel->setPropertyValue( "Label", - makeAny(sControlLabel) + Any(sControlLabel) ); } } diff --git a/extensions/source/dbpilots/controlwizard.hxx b/extensions/source/dbpilots/controlwizard.hxx index cf55c655e574..12138899f9dd 100644 --- a/extensions/source/dbpilots/controlwizard.hxx +++ b/extensions/source/dbpilots/controlwizard.hxx @@ -49,7 +49,6 @@ namespace dbp std::unique_ptr<weld::Label> m_xFormDatasource; std::unique_ptr<weld::Label> m_xFormContentTypeLabel; std::unique_ptr<weld::Label> m_xFormContentType; - std::unique_ptr<weld::Label> m_xFormTableLabel; std::unique_ptr<weld::Label> m_xFormTable; std::unique_ptr<weld::Frame> m_xFrame; @@ -62,7 +61,7 @@ namespace dbp css::uno::Reference< css::sdbc::XConnection > getFormConnection() const; public: - OControlWizardPage(weld::Container* pPage, OControlWizard* pWizard, const OUString& rUIXMLDescription, const OString& rID); + OControlWizardPage(weld::Container* pPage, OControlWizard* pWizard, const OUString& rUIXMLDescription, const OUString& rID); virtual ~OControlWizardPage() override; protected: diff --git a/extensions/source/dbpilots/gridwizard.cxx b/extensions/source/dbpilots/gridwizard.cxx index 0559858ca1ca..4b382e228264 100644 --- a/extensions/source/dbpilots/gridwizard.cxx +++ b/extensions/source/dbpilots/gridwizard.cxx @@ -40,7 +40,6 @@ namespace dbp using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::container; @@ -93,8 +92,8 @@ namespace dbp if (!xColumnFactory.is() || !xColumnContainer.is()) return; - static constexpr OUStringLiteral s_sMouseWheelBehavior = u"MouseWheelBehavior"; - static constexpr OUStringLiteral s_sEmptyString = u""; + static constexpr OUString s_sMouseWheelBehavior = u"MouseWheelBehavior"_ustr; + static constexpr OUString s_sEmptyString = u""_ustr; // collect "descriptors" for the to-be-created (grid)columns std::vector< OUString > aColumnServiceNames; // service names to be used with the XGridColumnFactory @@ -121,14 +120,14 @@ namespace dbp { case DataType::BIT: case DataType::BOOLEAN: - aColumnServiceNames.push_back(OUString("CheckBox")); + aColumnServiceNames.emplace_back("CheckBox"); aColumnLabelPostfixes.push_back(s_sEmptyString); break; case DataType::TINYINT: case DataType::SMALLINT: case DataType::INTEGER: - aColumnServiceNames.push_back(OUString("NumericField")); + aColumnServiceNames.emplace_back("NumericField"); aColumnLabelPostfixes.push_back(s_sEmptyString); break; @@ -137,31 +136,31 @@ namespace dbp case DataType::DOUBLE: case DataType::NUMERIC: case DataType::DECIMAL: - aColumnServiceNames.push_back(OUString("FormattedField")); + aColumnServiceNames.emplace_back("FormattedField"); aColumnLabelPostfixes.push_back(s_sEmptyString); break; case DataType::DATE: - aColumnServiceNames.push_back(OUString("DateField")); + aColumnServiceNames.emplace_back("DateField"); aColumnLabelPostfixes.push_back(s_sEmptyString); break; case DataType::TIME: - aColumnServiceNames.push_back(OUString("TimeField")); + aColumnServiceNames.emplace_back("TimeField"); aColumnLabelPostfixes.push_back(s_sEmptyString); break; case DataType::TIMESTAMP: - aColumnServiceNames.push_back(OUString("DateField")); + aColumnServiceNames.emplace_back("DateField"); aColumnLabelPostfixes.push_back(compmodule::ModuleRes(RID_STR_DATEPOSTFIX)); aFormFieldNames.push_back(*pSelectedFields); - aColumnServiceNames.push_back(OUString("TimeField")); + aColumnServiceNames.emplace_back("TimeField"); aColumnLabelPostfixes.push_back(compmodule::ModuleRes(RID_STR_TIMEPOSTFIX)); break; default: - aColumnServiceNames.push_back(OUString("TextField")); + aColumnServiceNames.emplace_back("TextField"); aColumnLabelPostfixes.push_back(s_sEmptyString); } } @@ -189,17 +188,17 @@ namespace dbp disambiguateName(xExistenceChecker, sColumnName); // the data field the column should be bound to - xColumn->setPropertyValue("DataField", makeAny(*pFormFieldName)); + xColumn->setPropertyValue("DataField", Any(*pFormFieldName)); // the label - xColumn->setPropertyValue("Label", makeAny(*pFormFieldName + *pColumnLabelPostfix)); + xColumn->setPropertyValue("Label", Any(*pFormFieldName + *pColumnLabelPostfix)); // the width (<void/> => column will be auto-sized) xColumn->setPropertyValue("Width", Any()); if ( xColumnPSI->hasPropertyByName( s_sMouseWheelBehavior ) ) - xColumn->setPropertyValue( s_sMouseWheelBehavior, makeAny( MouseWheelBehavior::SCROLL_DISABLED ) ); + xColumn->setPropertyValue( s_sMouseWheelBehavior, Any( MouseWheelBehavior::SCROLL_DISABLED ) ); // insert the column - xColumnContainer->insertByName(sColumnName, makeAny(xColumn)); + xColumnContainer->insertByName(sColumnName, Any(xColumn)); } catch(const Exception&) { @@ -216,7 +215,7 @@ namespace dbp std::unique_ptr<BuilderPage> OGridWizard::createPage(WizardState _nState) { - OString sIdent(OString::number(_nState)); + OUString sIdent(OUString::number(_nState)); weld::Container* pPageContainer = m_xAssistant->append_page(sIdent); switch (_nState) diff --git a/extensions/source/dbpilots/gridwizard.hxx b/extensions/source/dbpilots/gridwizard.hxx index 774e6cd69d34..dc2c069e9f76 100644 --- a/extensions/source/dbpilots/gridwizard.hxx +++ b/extensions/source/dbpilots/gridwizard.hxx @@ -60,7 +60,7 @@ namespace dbp class OGridPage : public OControlWizardPage { public: - OGridPage(weld::Container* pPage, OGridWizard* pWizard, const OUString& rUIXMLDescription, const OString& rID) + OGridPage(weld::Container* pPage, OGridWizard* pWizard, const OUString& rUIXMLDescription, const OUString& rID) : OControlWizardPage(pPage, pWizard, rUIXMLDescription, rID) { } diff --git a/extensions/source/dbpilots/groupboxwiz.cxx b/extensions/source/dbpilots/groupboxwiz.cxx index ead0e4a4e48e..37b79d8ed4e3 100644 --- a/extensions/source/dbpilots/groupboxwiz.cxx +++ b/extensions/source/dbpilots/groupboxwiz.cxx @@ -20,7 +20,7 @@ #include "groupboxwiz.hxx" #include "commonpagesdbp.hxx" #include <tools/debug.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include "optiongrouplayouter.hxx" #include <helpids.h> #include <o3tl/safeint.hxx> @@ -34,7 +34,6 @@ namespace dbp { using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::form; @@ -60,7 +59,7 @@ namespace dbp std::unique_ptr<BuilderPage> OGroupBoxWizard::createPage(::vcl::WizardTypes::WizardState _nState) { - OString sIdent(OString::number(_nState)); + OUString sIdent(OUString::number(_nState)); weld::Container* pPageContainer = m_xAssistant->append_page(sIdent); switch (_nState) @@ -280,17 +279,21 @@ namespace dbp m_xMoveLeft->set_sensitive(bSelectedSome); m_xMoveRight->set_sensitive(bUnfinishedInput); - getDialog()->enableButtons(WizardButtonFlags::NEXT, bHaveSome); + OControlWizard* pDialogController = getDialog(); + + pDialogController->enableButtons(WizardButtonFlags::NEXT, bHaveSome); + + weld::Dialog* pDialog = pDialogController->getDialog(); if (bUnfinishedInput) { - if (!m_xMoveRight->get_has_default()) - getDialog()->defaultButton(m_xMoveRight.get()); + if (!pDialog->is_default_widget(m_xMoveRight.get())) + pDialogController->defaultButton(m_xMoveRight.get()); } else { - if (m_xMoveRight->get_has_default()) - getDialog()->defaultButton(WizardButtonFlags::NEXT); + if (pDialog->is_default_widget(m_xMoveRight.get())) + pDialogController->defaultButton(WizardButtonFlags::NEXT); } } diff --git a/extensions/source/dbpilots/groupboxwiz.hxx b/extensions/source/dbpilots/groupboxwiz.hxx index 18fa12c7ffe5..73950ed36918 100644 --- a/extensions/source/dbpilots/groupboxwiz.hxx +++ b/extensions/source/dbpilots/groupboxwiz.hxx @@ -65,7 +65,7 @@ namespace dbp class OGBWPage : public OControlWizardPage { public: - OGBWPage(weld::Container* pPage, OControlWizard* pWizard, const OUString& rUIXMLDescription, const OString& rID) + OGBWPage(weld::Container* pPage, OControlWizard* pWizard, const OUString& rUIXMLDescription, const OUString& rID) : OControlWizardPage(pPage, pWizard, rUIXMLDescription, rID) { } diff --git a/extensions/source/dbpilots/listcombowizard.cxx b/extensions/source/dbpilots/listcombowizard.cxx index cde03e22356e..1e90b3c33df9 100644 --- a/extensions/source/dbpilots/listcombowizard.cxx +++ b/extensions/source/dbpilots/listcombowizard.cxx @@ -25,7 +25,7 @@ #include <com/sun/star/form/ListSourceType.hpp> #include <com/sun/star/sdbcx/XColumnsSupplier.hpp> #include <tools/debug.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <connectivity/dbtools.hxx> #include <helpids.h> #include <osl/diagnose.h> @@ -36,7 +36,6 @@ namespace dbp using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::sdbcx; @@ -83,7 +82,7 @@ namespace dbp std::unique_ptr<BuilderPage> OListComboWizard::createPage(WizardState _nState) { - OString sIdent(OString::number(_nState)); + OUString sIdent(OUString::number(_nState)); weld::Container* pPageContainer = m_xAssistant->append_page(sIdent); switch (_nState) @@ -170,19 +169,20 @@ namespace dbp } // ListSourceType: SQL - getContext().xObjectModel->setPropertyValue("ListSourceType", makeAny(sal_Int32(ListSourceType_SQL))); + getContext().xObjectModel->setPropertyValue("ListSourceType", Any(sal_Int32(ListSourceType_SQL))); if (isListBox()) { // BoundColumn: 1 - getContext().xObjectModel->setPropertyValue("BoundColumn", makeAny(sal_Int16(1))); - - // build the statement to set as list source - OUString sStatement = "SELECT " + - getSettings().sListContentField + ", " + getSettings().sLinkedListField + - " FROM " + getSettings().sListContentTable; - Sequence< OUString > aListSource { sStatement }; - getContext().xObjectModel->setPropertyValue("ListSource", makeAny(aListSource)); + getContext().xObjectModel->setPropertyValue("BoundColumn", Any(sal_Int16(1))); + + Sequence< OUString > aListSource { + // build the statement to set as list source + OUString("SELECT " + + getSettings().sListContentField + ", " + getSettings().sLinkedListField + + " FROM " + getSettings().sListContentTable) + }; + getContext().xObjectModel->setPropertyValue("ListSource", Any(aListSource)); } else { @@ -190,11 +190,11 @@ namespace dbp OUString sStatement = "SELECT DISTINCT " + getSettings().sListContentField + " FROM " + getSettings().sListContentTable; - getContext().xObjectModel->setPropertyValue( "ListSource", makeAny(sStatement)); + getContext().xObjectModel->setPropertyValue( "ListSource", Any(sStatement)); } // the bound field - getContext().xObjectModel->setPropertyValue("DataField", makeAny(getSettings().sLinkedFormField)); + getContext().xObjectModel->setPropertyValue("DataField", Any(getSettings().sLinkedFormField)); } catch(const Exception&) { diff --git a/extensions/source/dbpilots/listcombowizard.hxx b/extensions/source/dbpilots/listcombowizard.hxx index 7ab6a8a21d0f..5e61296f89be 100644 --- a/extensions/source/dbpilots/listcombowizard.hxx +++ b/extensions/source/dbpilots/listcombowizard.hxx @@ -77,7 +77,7 @@ namespace dbp class OLCPage : public OControlWizardPage { public: - OLCPage(weld::Container* pPage, OListComboWizard* pWizard, const OUString& rUIXMLDescription, const OString& rID) + OLCPage(weld::Container* pPage, OListComboWizard* pWizard, const OUString& rUIXMLDescription, const OUString& rID) : OControlWizardPage(pPage, pWizard, rUIXMLDescription, rID) { } diff --git a/extensions/source/dbpilots/optiongrouplayouter.cxx b/extensions/source/dbpilots/optiongrouplayouter.cxx index 23afd922cec4..c35b0cefc8d7 100644 --- a/extensions/source/dbpilots/optiongrouplayouter.cxx +++ b/extensions/source/dbpilots/optiongrouplayouter.cxx @@ -28,7 +28,7 @@ #include <com/sun/star/view/XSelectionSupplier.hpp> #include "groupboxwiz.hxx" #include "dbptools.hxx" -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> namespace dbp @@ -116,20 +116,20 @@ namespace dbp UNO_QUERY); // the label - xRadioModel->setPropertyValue("Label", makeAny(*aLabelIter)); + xRadioModel->setPropertyValue("Label", Any(*aLabelIter)); // the value - xRadioModel->setPropertyValue("RefValue", makeAny(*aValueIter)); + xRadioModel->setPropertyValue("RefValue", Any(*aValueIter)); // default selection if (_rSettings.sDefaultField == *aLabelIter) - xRadioModel->setPropertyValue("DefaultState", makeAny(sal_Int16(1))); + xRadioModel->setPropertyValue("DefaultState", Any(sal_Int16(1))); // the connection to the database field if (!_rSettings.sDBField.isEmpty()) - xRadioModel->setPropertyValue("DataField", makeAny(_rSettings.sDBField)); + xRadioModel->setPropertyValue("DataField", Any(_rSettings.sDBField)); // the name for the model - xRadioModel->setPropertyValue("Name", makeAny(sElementsName)); + xRadioModel->setPropertyValue("Name", Any(sElementsName)); // create a shape for the radio button Reference< XControlShape > xRadioShape( @@ -164,7 +164,7 @@ namespace dbp // set the GroupBox as "LabelControl" for the RadioButton // (_after_ having inserted the model into the page!) - xRadioModel->setPropertyValue("LabelControl", makeAny(_rContext.xObjectModel)); + xRadioModel->setPropertyValue("LabelControl", Any(_rContext.xObjectModel)); } // group the shapes @@ -176,7 +176,7 @@ namespace dbp Reference< XShapeGroup > xGroupedOptions = xGrouper->group(xButtonCollection); Reference< XSelectionSupplier > xSelector(_rContext.xDocumentModel->getCurrentController(), UNO_QUERY); if (xSelector.is()) - xSelector->select(makeAny(xGroupedOptions)); + xSelector->select(Any(xGroupedOptions)); } } catch(Exception&) @@ -189,12 +189,12 @@ namespace dbp void OOptionGroupLayouter::implAnchorShape(const Reference< XPropertySet >& _rxShapeProps) { - static constexpr OUStringLiteral s_sAnchorPropertyName = u"AnchorType"; + static constexpr OUString s_sAnchorPropertyName = u"AnchorType"_ustr; Reference< XPropertySetInfo > xPropertyInfo; if (_rxShapeProps.is()) xPropertyInfo = _rxShapeProps->getPropertySetInfo(); if (xPropertyInfo.is() && xPropertyInfo->hasPropertyByName(s_sAnchorPropertyName)) - _rxShapeProps->setPropertyValue(s_sAnchorPropertyName, makeAny(TextContentAnchorType_AT_PAGE)); + _rxShapeProps->setPropertyValue(s_sAnchorPropertyName, Any(TextContentAnchorType_AT_PAGE)); } diff --git a/extensions/source/dbpilots/unoautopilot.hxx b/extensions/source/dbpilots/unoautopilot.hxx index a61df8a6a205..ea6e886d2d13 100644 --- a/extensions/source/dbpilots/unoautopilot.hxx +++ b/extensions/source/dbpilots/unoautopilot.hxx @@ -26,6 +26,7 @@ #include <cppuhelper/typeprovider.hxx> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/PropertyValue.hpp> +#include <utility> #include <vcl/svapp.hxx> namespace dbp @@ -41,7 +42,7 @@ namespace dbp OUString aImplementationName, const css::uno::Sequence<OUString>& aSupportedServices) : OUnoAutoPilot_Base(_rxORB), - m_ImplementationName(aImplementationName), + m_ImplementationName(std::move(aImplementationName)), m_SupportedServices(aSupportedServices) { } diff --git a/extensions/source/logging/csvformatter.cxx b/extensions/source/logging/csvformatter.cxx index 8e749db42831..a9ea13f208ca 100644 --- a/extensions/source/logging/csvformatter.cxx +++ b/extensions/source/logging/csvformatter.cxx @@ -90,32 +90,34 @@ namespace { const sal_Unicode quote_char = '"'; const sal_Unicode comma_char = ','; - constexpr OUStringLiteral dos_newline = u"\r\n"; + constexpr OUString dos_newline = u"\r\n"_ustr; bool needsQuoting(std::u16string_view str) { return str.find_first_of(u"\",\n\r") != std::u16string_view::npos; }; - void appendEncodedString(OUStringBuffer& buf, const OUString& str) + void appendEncodedString(OUStringBuffer& buf, std::u16string_view str) { if(needsQuoting(str)) { // each double-quote will get replaced by two double-quotes buf.append(quote_char); const sal_Int32 buf_offset = buf.getLength(); - const sal_Int32 str_length = str.getLength(); + const size_t str_length = str.size(); buf.append(str); // special treatment for the last character if(quote_char==str[str_length-1]) buf.append(quote_char); // iterating backwards because the index at which we insert won't be shifted // when moving that way. - for(sal_Int32 i = str_length; i>=0; ) + for(size_t i = str_length;; ) { - i=str.lastIndexOf(quote_char, --i); - if(i!=-1) - buf.insert(buf_offset + i, quote_char); + --i; + i=str.substr(i).rfind(quote_char); + if(i==std::u16string_view::npos) + break; + buf.insert(buf_offset + i, quote_char); } buf.append(quote_char); } @@ -200,8 +202,7 @@ namespace logging sal_Int32 columns = m_Columnnames.getLength(); for(sal_Int32 i=0; i<columns; i++) { - buf.append(m_Columnnames[i]); - buf.append(comma_char); + buf.append(m_Columnnames[i] + OUStringChar(comma_char)); } buf.setLength(buf.getLength()-1); buf.append(dos_newline); @@ -214,14 +215,12 @@ namespace logging if(m_LogEventNo) { - aLogEntry.append( record.SequenceNumber ); - aLogEntry.append(comma_char); + aLogEntry.append(record.SequenceNumber + comma_char); } if(m_LogThread) { - aLogEntry.append( record.ThreadID ); - aLogEntry.append(comma_char); + aLogEntry.append(record.ThreadID + OUStringChar(comma_char)); } if(m_LogTimestamp) diff --git a/extensions/source/logging/filehandler.cxx b/extensions/source/logging/filehandler.cxx index 200a3a64bbd0..8108f7c6abf8 100644 --- a/extensions/source/logging/filehandler.cxx +++ b/extensions/source/logging/filehandler.cxx @@ -29,7 +29,7 @@ #include <com/sun/star/util/PathSubstitution.hpp> #include <com/sun/star/util/XStringSubstitution.hpp> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <cppuhelper/compbase.hxx> #include <cppuhelper/basemutex.hxx> diff --git a/extensions/source/logging/logger.cxx b/extensions/source/logging/logger.cxx index 322ad7ab9ec7..4ae2f79362fc 100644 --- a/extensions/source/logging/logger.cxx +++ b/extensions/source/logging/logger.cxx @@ -33,6 +33,7 @@ #include <cppuhelper/supportsservice.hxx> #include <cppuhelper/weakref.hxx> #include <map> +#include <utility> namespace logging @@ -63,7 +64,7 @@ namespace logging // </attributes> public: - EventLogger( const Reference< XComponentContext >& _rxContext, const OUString& _rName ); + EventLogger( const Reference< XComponentContext >& _rxContext, OUString _aName ); // XLogger virtual OUString SAL_CALL getName() override; @@ -113,11 +114,11 @@ namespace logging } - EventLogger::EventLogger( const Reference< XComponentContext >& _rxContext, const OUString& _rName ) + EventLogger::EventLogger( const Reference< XComponentContext >& _rxContext, OUString _aName ) :m_aHandlers( m_aMutex ) ,m_nEventNumber( 0 ) ,m_nLogLevel( css::logging::LogLevel::OFF ) - ,m_sName( _rName ) + ,m_sName(std::move( _aName )) { osl_atomic_increment( &m_refCount ); { diff --git a/extensions/source/logging/loggerconfig.cxx b/extensions/source/logging/loggerconfig.cxx index 2ad97cc311b5..daf42859b833 100644 --- a/extensions/source/logging/loggerconfig.cxx +++ b/extensions/source/logging/loggerconfig.cxx @@ -34,7 +34,7 @@ #include <com/sun/star/logging/XLogHandler.hpp> #include <com/sun/star/logging/XLogFormatter.hpp> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <osl/process.h> #include <cppuhelper/component_context.hxx> @@ -54,7 +54,6 @@ namespace logging using ::com::sun::star::lang::XSingleServiceFactory; using ::com::sun::star::uno::XInterface; using ::com::sun::star::util::XChangesBatch; - using ::com::sun::star::uno::makeAny; using ::com::sun::star::lang::NullPointerException; using ::com::sun::star::uno::Exception; using ::com::sun::star::lang::ServiceNotRegisteredException; @@ -105,22 +104,19 @@ namespace logging ::sal::static_int_cast< sal_Int16 >( aDateTime.NanoSeconds / 10000000 ) ); OUString sTime = OUString::createFromAscii( buffer ); - OUString sDateTime = sDate + "." + sTime; - oslProcessIdentifier aProcessId = 0; oslProcessInfo info; info.Size = sizeof (oslProcessInfo); if ( osl_getProcessInfo ( nullptr, osl_Process_IDENTIFIER, &info ) == osl_Process_E_None) aProcessId = info.Ident; - OUString aPID = OUString::number( aProcessId ); Variable const aVariables[] = { {std::u16string_view(u"$(loggername)"), sLoggerName}, {std::u16string_view(u"$(date)"), sDate}, {std::u16string_view(u"$(time)"), sTime}, - {std::u16string_view(u"$(datetime)"), sDateTime}, - {std::u16string_view(u"$(pid)"), aPID} + {std::u16string_view(u"$(datetime)"), sDate + "." + sTime }, + {std::u16string_view(u"$(pid)"), OUString::number(aProcessId)} }; for (Variable const & aVariable : aVariables) @@ -222,7 +218,7 @@ namespace logging // write access to the "Settings" node (which includes settings for all loggers) Sequence<Any> aArguments{ Any(NamedValue( - "nodepath", makeAny(OUString("/org.openoffice.Office.Logging/Settings")))) }; + "nodepath", Any(OUString("/org.openoffice.Office.Logging/Settings")))) }; Reference< XNameContainer > xAllSettings( xConfigProvider->createInstanceWithArguments( "com.sun.star.configuration.ConfigurationUpdateAccess", aArguments @@ -234,7 +230,7 @@ namespace logging // no node yet for this logger. Create default settings. Reference< XSingleServiceFactory > xNodeFactory( xAllSettings, UNO_QUERY_THROW ); Reference< XInterface > xLoggerSettings( xNodeFactory->createInstance(), css::uno::UNO_SET_THROW ); - xAllSettings->insertByName( sLoggerName, makeAny( xLoggerSettings ) ); + xAllSettings->insertByName( sLoggerName, Any( xLoggerSettings ) ); Reference< XChangesBatch > xChanges( xAllSettings, UNO_QUERY_THROW ); xChanges->commitChanges(); } diff --git a/extensions/source/logging/loghandler.cxx b/extensions/source/logging/loghandler.cxx index afc33605b9fc..a398bd053acd 100644 --- a/extensions/source/logging/loghandler.cxx +++ b/extensions/source/logging/loghandler.cxx @@ -25,7 +25,7 @@ #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/logging/PlainTextFormatter.hpp> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <rtl/tencinfo.h> @@ -36,7 +36,6 @@ namespace logging using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::XComponentContext; using ::com::sun::star::logging::LogRecord; - using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::logging::XLogFormatter; using ::com::sun::star::uno::Exception; using ::com::sun::star::lang::IllegalArgumentException; diff --git a/extensions/source/logging/plaintextformatter.cxx b/extensions/source/logging/plaintextformatter.cxx index 23392b61c491..2c534a2a2e8f 100644 --- a/extensions/source/logging/plaintextformatter.cxx +++ b/extensions/source/logging/plaintextformatter.cxx @@ -105,14 +105,11 @@ namespace logging if ( !(_rRecord.SourceClassName.isEmpty() || _rRecord.SourceMethodName.isEmpty()) ) { - aLogEntry.append( _rRecord.SourceClassName ); - aLogEntry.append( "::" ); - aLogEntry.append( _rRecord.SourceMethodName ); - aLogEntry.append( ": " ); + aLogEntry.append( _rRecord.SourceClassName + "::" + + _rRecord.SourceMethodName + ": " ); } - aLogEntry.append( _rRecord.Message ); - aLogEntry.append( "\n" ); + aLogEntry.append( _rRecord.Message + "\n" ); return aLogEntry.makeStringAndClear(); } diff --git a/extensions/source/ole/oledll.cxx b/extensions/source/ole/oledll.cxx index 1275f4dc60c5..9ed73a33042d 100644 --- a/extensions/source/ole/oledll.cxx +++ b/extensions/source/ole/oledll.cxx @@ -30,7 +30,6 @@ #pragma clang diagnostic ignored "-Winvalid-noreturn" #pragma clang diagnostic ignored "-Wmicrosoft" #pragma clang diagnostic ignored "-Wnon-pod-varargs" -#pragma clang diagnostic ignored "-Wnon-virtual-dtor" #endif #include <atlbase.h> diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx index 85f410c54604..160b094acb64 100644 --- a/extensions/source/ole/oleobjw.cxx +++ b/extensions/source/ole/oleobjw.cxx @@ -1550,7 +1550,7 @@ TypeDescription IUnknownWrapper::getInterfaceMemberDescOfCurrentCall(std::u16str { TypeDescription ret; - for( auto const & rType : std::as_const(m_seqTypes) ) + for (auto const& rType : m_seqTypes) { TypeDescription _curDesc( rType ); _curDesc.makeComplete(); diff --git a/extensions/source/ole/olethread.cxx b/extensions/source/ole/olethread.cxx index 1580c0b7d44a..503f8bc096c1 100644 --- a/extensions/source/ole/olethread.cxx +++ b/extensions/source/ole/olethread.cxx @@ -34,14 +34,17 @@ void o2u_attachCurrentThread() { // FIXME: is it a problem that this ends up in STA currently? assert(RPC_E_CHANGED_MODE == hr); // Let's find out explicitly what apartment mode we are in. - SAL_WARN("extensions.olebridge", "CoInitializeEx failed" - << (hr == RPC_E_CHANGED_MODE ? " (expectedly)" : "") - << ": " << WindowsErrorStringFromHRESULT(hr)); + if (hr == RPC_E_CHANGED_MODE) + SAL_INFO("extensions.olebridge", "CoInitializeEx failed (expectedly): " + << WindowsErrorStringFromHRESULT(hr)); + else + SAL_WARN("extensions.olebridge", + "CoInitializeEx failed: " << WindowsErrorStringFromHRESULT(hr)); APTTYPE nAptType; APTTYPEQUALIFIER nAptTypeQualifier; if (SUCCEEDED(CoGetApartmentType(&nAptType, &nAptTypeQualifier))) { - SAL_WARN("extensions.olebridge", + SAL_INFO("extensions.olebridge", " Thread is in a " << (nAptType == APTTYPE_STA ? OUString("single-threaded") : (nAptType == APTTYPE_MTA ? OUString("multi-threaded") : diff --git a/extensions/source/ole/servprov.cxx b/extensions/source/ole/servprov.cxx index ea69be1d9fe2..0c3920ccca11 100644 --- a/extensions/source/ole/servprov.cxx +++ b/extensions/source/ole/servprov.cxx @@ -33,6 +33,7 @@ #include <cppuhelper/supportsservice.hxx> #include <o3tl/any.hxx> #include <o3tl/char16_t2wchar_t.hxx> +#include <officecfg/Office/Common.hxx> #include <ooo/vba/XHelperInterface.hpp> #include <sal/log.hxx> @@ -144,8 +145,12 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP OneInstanceOleWrapper::CreateInstance(IUnknown SAL_INFO("extensions.olebridge", "OneInstanceOleWrapper::CreateInstance(" << riid << ")"); - HRESULT ret = ResultFromScode(E_UNEXPECTED); + if (officecfg::Office::Common::Security::Scripting::DisableOLEAutomation::get()) + { + return ResultFromScode(E_NOINTERFACE); + } + HRESULT ret = ResultFromScode(E_UNEXPECTED); const Reference<XInterface>& xInst = m_xInstFunction(); if (xInst.is()) { @@ -305,8 +310,7 @@ css::uno::Sequence<OUString> OleConverter::getSupportedServiceNames() "com.sun.star.bridge.OleBridgeSupplier2", "com.sun.star.bridge.oleautomation.BridgeSupplier"}; } - return css::uno::Sequence<OUString>{ - "com.sun.star.bridge.OleBridgeSupplierVar1"}; + return {"com.sun.star.bridge.OleBridgeSupplierVar1"}; } // XInitialize ------------------------------------------------------------------------------ diff --git a/extensions/source/ole/unoconversionutilities.hxx b/extensions/source/ole/unoconversionutilities.hxx index 6cf3dc961731..a73a714abe55 100644 --- a/extensions/source/ole/unoconversionutilities.hxx +++ b/extensions/source/ole/unoconversionutilities.hxx @@ -405,7 +405,7 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANTARG* pArg, Any& rAny, { try { - Any anySeq = makeAny(unoSeq); + Any anySeq(unoSeq); Any convAny = conv->convertTo(anySeq, ptype); rAny = convAny; } diff --git a/extensions/source/ole/unoobjw.cxx b/extensions/source/ole/unoobjw.cxx index 28286bddb1e3..915ecd92f8fc 100644 --- a/extensions/source/ole/unoobjw.cxx +++ b/extensions/source/ole/unoobjw.cxx @@ -41,7 +41,6 @@ #pragma clang diagnostic ignored "-Winvalid-noreturn" #pragma clang diagnostic ignored "-Wmicrosoft" #pragma clang diagnostic ignored "-Wnon-pod-varargs" -#pragma clang diagnostic ignored "-Wnon-virtual-dtor" #pragma clang diagnostic ignored "-Wnonportable-include-path" #pragma clang diagnostic ignored "-Wsequence-point" #pragma clang diagnostic ignored "-Wtypename-missing" @@ -1818,7 +1817,7 @@ COM_DECLSPEC_NOTHROW STDMETHODIMP InterfaceOleWrapper::Invoke(DISPID dispidMembe sParams += ","; std::stringstream aStringStream; aStringStream << pdispparams->rgvarg[i]; - sParams += OUString::createFromAscii(aStringStream.str().c_str()); + sParams += OUString::createFromAscii(aStringStream.str()); } sParams += "]"; #endif diff --git a/extensions/source/ole/wincrap.hxx b/extensions/source/ole/wincrap.hxx index 4da57d53c173..3c8417cf929a 100644 --- a/extensions/source/ole/wincrap.hxx +++ b/extensions/source/ole/wincrap.hxx @@ -43,7 +43,6 @@ #pragma clang diagnostic ignored "-Winvalid-noreturn" #pragma clang diagnostic ignored "-Wmicrosoft" #pragma clang diagnostic ignored "-Wnon-pod-varargs" -#pragma clang diagnostic ignored "-Wnon-virtual-dtor" #endif // from oleobjw.hxx diff --git a/extensions/source/ole/windata.hxx b/extensions/source/ole/windata.hxx index edf3c1d45ab8..d9c4cb31436d 100644 --- a/extensions/source/ole/windata.hxx +++ b/extensions/source/ole/windata.hxx @@ -29,7 +29,6 @@ #pragma clang diagnostic ignored "-Winvalid-noreturn" #pragma clang diagnostic ignored "-Wmicrosoft" #pragma clang diagnostic ignored "-Wnon-pod-varargs" -#pragma clang diagnostic ignored "-Wnon-virtual-dtor" #endif #include <atlbase.h> diff --git a/extensions/source/propctrlr/MasterDetailLinkDialog.cxx b/extensions/source/propctrlr/MasterDetailLinkDialog.cxx index 5f38856fc9c4..4f4e6d9a97f1 100644 --- a/extensions/source/propctrlr/MasterDetailLinkDialog.cxx +++ b/extensions/source/propctrlr/MasterDetailLinkDialog.cxx @@ -28,7 +28,6 @@ namespace pcr using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; MasterDetailLinkDialog::MasterDetailLinkDialog(const Reference< XComponentContext >& _rxContext ) diff --git a/extensions/source/propctrlr/browserline.cxx b/extensions/source/propctrlr/browserline.cxx index 814c24f4b306..f4619000dcf8 100644 --- a/extensions/source/propctrlr/browserline.cxx +++ b/extensions/source/propctrlr/browserline.cxx @@ -28,7 +28,8 @@ #include <comphelper/propertyvalue.hxx> #include <comphelper/string.hxx> #include <tools/debug.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> +#include <utility> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <vcl/weld.hxx> @@ -42,19 +43,17 @@ namespace pcr using ::com::sun::star::uno::XComponentContext; using ::com::sun::star::inspection::XPropertyControl; using ::com::sun::star::inspection::XPropertyControlContext; - using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::uno::Exception; using ::com::sun::star::graphic::GraphicProvider; using ::com::sun::star::graphic::XGraphicProvider; using ::com::sun::star::uno::Sequence; - using ::com::sun::star::beans::PropertyValue; using ::com::sun::star::graphic::XGraphic; namespace PropertyLineElement = ::com::sun::star::inspection::PropertyLineElement; - OBrowserLine::OBrowserLine(const OUString& rEntryName, weld::Container* pParent, weld::SizeGroup* pLabelGroup, + OBrowserLine::OBrowserLine(OUString aEntryName, weld::Container* pParent, weld::SizeGroup* pLabelGroup, weld::Container* pInitialControlParent) - : m_sEntryName(rEntryName) + : m_sEntryName(std::move(aEntryName)) , m_xBuilder(Application::CreateBuilder(pParent, "modules/spropctrlr/ui/browserline.ui")) , m_xContainer(m_xBuilder->weld_container("BrowserLine")) , m_xFtTitle(m_xBuilder->weld_label("label")) @@ -89,7 +88,7 @@ namespace pcr } } - void OBrowserLine::SetComponentHelpIds(const OString& rHelpId) + void OBrowserLine::SetComponentHelpIds(const OUString& rHelpId) { if (m_pControlWindow) m_pControlWindow->set_help_id(rHelpId); diff --git a/extensions/source/propctrlr/browserline.hxx b/extensions/source/propctrlr/browserline.hxx index db33b7a5560f..dfde2969f41f 100644 --- a/extensions/source/propctrlr/browserline.hxx +++ b/extensions/source/propctrlr/browserline.hxx @@ -68,7 +68,7 @@ namespace pcr bool m_bReadOnly; public: - OBrowserLine(const OUString& rEntryName, weld::Container* pParent, weld::SizeGroup* pLabelGroup, + OBrowserLine(OUString aEntryName, weld::Container* pParent, weld::SizeGroup* pLabelGroup, weld::Container* pInitialControlParent); ~OBrowserLine(); @@ -84,7 +84,7 @@ namespace pcr const OUString& GetEntryName() const { return m_sEntryName; } - void SetComponentHelpIds(const OString& rHelpId); + void SetComponentHelpIds(const OUString& rHelpId); void SetTitle(const OUString& rString ); void FullFillTitleString(); diff --git a/extensions/source/propctrlr/browserlistbox.cxx b/extensions/source/propctrlr/browserlistbox.cxx index 04e9e44b388d..b48fc7fa227e 100644 --- a/extensions/source/propctrlr/browserlistbox.cxx +++ b/extensions/source/propctrlr/browserlistbox.cxx @@ -29,7 +29,7 @@ #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/inspection/PropertyControlType.hpp> #include <tools/debug.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <comphelper/asyncnotification.hxx> #include <cppuhelper/implbase.hxx> #include <vcl/svapp.hxx> diff --git a/extensions/source/propctrlr/browserlistbox.hxx b/extensions/source/propctrlr/browserlistbox.hxx index 1a7232612a29..fc1f35541208 100644 --- a/extensions/source/propctrlr/browserlistbox.hxx +++ b/extensions/source/propctrlr/browserlistbox.hxx @@ -23,6 +23,7 @@ #include <com/sun/star/inspection/XPropertyControl.hpp> #include <com/sun/star/inspection/XPropertyHandler.hpp> +#include <utility> #include <vcl/weld.hxx> #include <rtl/ref.hxx> @@ -53,10 +54,10 @@ namespace pcr css::uno::Reference< css::inspection::XPropertyHandler > xHandler; - ListBoxLine( const OUString& rName, const BrowserLinePointer& _pLine, const css::uno::Reference< css::inspection::XPropertyHandler >& _rxHandler ) - : aName( rName ), - pLine( _pLine ), - xHandler( _rxHandler ) + ListBoxLine( OUString _aName, BrowserLinePointer _pLine, css::uno::Reference< css::inspection::XPropertyHandler > _xHandler ) + : aName(std::move( _aName )), + pLine(std::move( _pLine )), + xHandler(std::move( _xHandler )) { } }; diff --git a/extensions/source/propctrlr/browserpage.hxx b/extensions/source/propctrlr/browserpage.hxx index 0db6cc3c7522..5f9220a7961f 100644 --- a/extensions/source/propctrlr/browserpage.hxx +++ b/extensions/source/propctrlr/browserpage.hxx @@ -37,7 +37,7 @@ namespace pcr explicit OBrowserPage(weld::Container* pParent, weld::Container* pContainer); ~OBrowserPage(); - void SetHelpId(const OString& rHelpId) { m_xContainer->set_help_id(rHelpId); } + void SetHelpId(const OUString& rHelpId) { m_xContainer->set_help_id(rHelpId); } OBrowserListBox& getListBox() { return *m_xListBox; } const OBrowserListBox& getListBox() const { return *m_xListBox; } diff --git a/extensions/source/propctrlr/browserview.cxx b/extensions/source/propctrlr/browserview.cxx index df0c6693b9bd..3be48abe41a2 100644 --- a/extensions/source/propctrlr/browserview.cxx +++ b/extensions/source/propctrlr/browserview.cxx @@ -35,9 +35,9 @@ namespace pcr m_xPropBox->setPageActivationHandler(LINK(this, OPropertyBrowserView, OnPageActivation)); } - IMPL_LINK_NOARG(OPropertyBrowserView, OnPageActivation, LinkParamNone*, void) + IMPL_LINK(OPropertyBrowserView, OnPageActivation, const OUString&, rNewPage, void) { - m_nActivePage = m_xPropBox->GetCurPage(); + m_nActivePage = rNewPage.toUInt32(); m_aPageActivationHandler.Call(nullptr); } diff --git a/extensions/source/propctrlr/browserview.hxx b/extensions/source/propctrlr/browserview.hxx index 35195d20e199..d64039813757 100644 --- a/extensions/source/propctrlr/browserview.hxx +++ b/extensions/source/propctrlr/browserview.hxx @@ -48,7 +48,7 @@ namespace pcr css::awt::Size getMinimumSize() const; private: - DECL_LINK(OnPageActivation, LinkParamNone*, void); + DECL_LINK(OnPageActivation, const OUString&, void); }; } // namespace pcr diff --git a/extensions/source/propctrlr/buttonnavigationhandler.cxx b/extensions/source/propctrlr/buttonnavigationhandler.cxx index 618d9db46b86..43ed02a952d6 100644 --- a/extensions/source/propctrlr/buttonnavigationhandler.cxx +++ b/extensions/source/propctrlr/buttonnavigationhandler.cxx @@ -29,10 +29,7 @@ namespace pcr using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::script; - using namespace ::com::sun::star::frame; using namespace ::com::sun::star::inspection; ButtonNavigationHandler::ButtonNavigationHandler( const Reference< XComponentContext >& _rxContext ) diff --git a/extensions/source/propctrlr/cellbindinghandler.cxx b/extensions/source/propctrlr/cellbindinghandler.cxx index 32517a6c4be9..bd1628192eb8 100644 --- a/extensions/source/propctrlr/cellbindinghandler.cxx +++ b/extensions/source/propctrlr/cellbindinghandler.cxx @@ -27,7 +27,7 @@ #include <com/sun/star/table/CellAddress.hpp> #include <com/sun/star/inspection/XObjectInspectorUI.hpp> #include <tools/debug.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> namespace pcr @@ -38,7 +38,6 @@ namespace pcr using namespace ::com::sun::star::table; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::script; using namespace ::com::sun::star::frame; using namespace ::com::sun::star::inspection; using namespace ::com::sun::star::form::binding; @@ -129,7 +128,7 @@ namespace pcr // ensure that the "transfer selection as" property is reset. Since we can't remember // it at the object itself, but derive it from the binding only, we have to normalize // it now that there *is* no binding anymore. - setPropertyValue( PROPERTY_CELL_EXCHANGE_TYPE, makeAny( sal_Int16(0) ) ); + setPropertyValue( PROPERTY_CELL_EXCHANGE_TYPE, Any( sal_Int16(0) ) ); } } break; @@ -156,8 +155,8 @@ namespace pcr { if ( !xSource.is() ) { - setPropertyValue( PROPERTY_STRINGITEMLIST, makeAny( Sequence< OUString >() ) ); - setPropertyValue( PROPERTY_TYPEDITEMLIST, makeAny( Sequence< Any >() ) ); + setPropertyValue( PROPERTY_STRINGITEMLIST, Any( Sequence< OUString >() ) ); + setPropertyValue( PROPERTY_TYPEDITEMLIST, Any( Sequence< Any >() ) ); } } catch( const Exception& ) diff --git a/extensions/source/propctrlr/cellbindinghelper.cxx b/extensions/source/propctrlr/cellbindinghelper.cxx index e2bc47f16cc2..bd2c6d41989c 100644 --- a/extensions/source/propctrlr/cellbindinghelper.cxx +++ b/extensions/source/propctrlr/cellbindinghelper.cxx @@ -32,10 +32,11 @@ #include <com/sun/star/sheet/XSpreadsheet.hpp> #include <unotools/transliterationwrapper.hxx> #include <osl/diagnose.h> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include "formstrings.hxx" #include <algorithm> +#include <utility> namespace pcr @@ -51,7 +52,6 @@ namespace pcr using namespace ::com::sun::star::table; using namespace ::com::sun::star::form; using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::i18n; using namespace ::com::sun::star::form::binding; namespace @@ -63,7 +63,7 @@ namespace pcr OUString m_sReference; public: - explicit StringCompare( const OUString& _rReference ) : m_sReference( _rReference ) { } + explicit StringCompare( OUString _aReference ) : m_sReference(std::move( _aReference )) { } bool operator()( std::u16string_view _rCompare ) { @@ -146,7 +146,7 @@ namespace pcr Any aAddress; return doConvertAddressRepresentations( PROPERTY_UI_REPRESENTATION, - makeAny( _rAddressDescription ), + Any( _rAddressDescription ), PROPERTY_ADDRESS, aAddress, false @@ -162,7 +162,7 @@ namespace pcr Reference< XPropertySet > xConverter( createDocumentDependentInstance( - _bIsRange ? OUString(SERVICE_RANGEADDRESS_CONVERSION) : OUString(SERVICE_ADDRESS_CONVERSION), + _bIsRange ? SERVICE_RANGEADDRESS_CONVERSION : SERVICE_ADDRESS_CONVERSION, OUString(), Any() ), @@ -174,7 +174,7 @@ namespace pcr try { Reference< XSpreadsheet > xSheet; - xConverter->setPropertyValue( PROPERTY_REFERENCE_SHEET, makeAny( static_cast<sal_Int32>(getControlSheetIndex( xSheet )) ) ); + xConverter->setPropertyValue( PROPERTY_REFERENCE_SHEET, Any( static_cast<sal_Int32>(getControlSheetIndex( xSheet )) ) ); xConverter->setPropertyValue( _rInputProperty, _rInputValue ); _rOutputValue = xConverter->getPropertyValue( _rOutputProperty ); bSuccess = true; @@ -195,7 +195,7 @@ namespace pcr Any aAddress; return doConvertAddressRepresentations( PROPERTY_UI_REPRESENTATION, - makeAny( _rAddressDescription ), + Any( _rAddressDescription ), PROPERTY_ADDRESS, aAddress, true @@ -207,9 +207,9 @@ namespace pcr Reference< XValueBinding > CellBindingHelper::createCellBindingFromAddress( const CellAddress& _rAddress, bool _bSupportIntegerExchange ) const { Reference< XValueBinding > xBinding( createDocumentDependentInstance( - _bSupportIntegerExchange ? OUString(SERVICE_SHEET_CELL_INT_BINDING) : OUString(SERVICE_SHEET_CELL_BINDING), + _bSupportIntegerExchange ? SERVICE_SHEET_CELL_INT_BINDING : SERVICE_SHEET_CELL_BINDING, PROPERTY_BOUND_CELL, - makeAny( _rAddress ) + Any( _rAddress ) ), UNO_QUERY ); return xBinding; @@ -244,7 +244,7 @@ namespace pcr xSource.set(createDocumentDependentInstance( SERVICE_SHEET_CELLRANGE_LISTSOURCE, PROPERTY_LIST_CELL_RANGE, - makeAny( aRangeAddress ) + Any( aRangeAddress ) ), css::uno::UNO_QUERY); return xSource; @@ -316,7 +316,7 @@ namespace pcr if ( getAddressFromCellBinding( _rxBinding, aAddress ) ) { Any aStringAddress; - doConvertAddressRepresentations( PROPERTY_ADDRESS, makeAny( aAddress ), + doConvertAddressRepresentations( PROPERTY_ADDRESS, Any( aAddress ), PROPERTY_UI_REPRESENTATION, aStringAddress, false ); aStringAddress >>= sAddress; @@ -345,7 +345,7 @@ namespace pcr xSourceProps->getPropertyValue( PROPERTY_LIST_CELL_RANGE ) >>= aRangeAddress; Any aStringAddress; - doConvertAddressRepresentations( PROPERTY_ADDRESS, makeAny( aRangeAddress ), + doConvertAddressRepresentations( PROPERTY_ADDRESS, Any( aRangeAddress ), PROPERTY_UI_REPRESENTATION, aStringAddress, true ); aStringAddress >>= sAddress; } @@ -495,7 +495,6 @@ namespace pcr return bDoes; } - Reference< XValueBinding > CellBindingHelper::getCurrentBinding( ) const { Reference< XValueBinding > xBinding; @@ -505,17 +504,14 @@ namespace pcr return xBinding; } - Reference< XListEntrySource > CellBindingHelper::getCurrentListSource( ) const { - Reference< XListEntrySource > xSource; Reference< XListEntrySink > xSink( m_xControlModel, UNO_QUERY ); - if ( xSink.is() ) - xSource = xSink->getListEntrySource(); - return xSource; + if (xSink.is()) + return xSink->getListEntrySource(); + return Reference<XListEntrySource>(); } - void CellBindingHelper::setBinding( const Reference< XValueBinding >& _rxBinding ) { Reference< XBindableValue > xBindable( m_xControlModel, UNO_QUERY ); @@ -524,7 +520,6 @@ namespace pcr xBindable->setValueBinding( _rxBinding ); } - void CellBindingHelper::setListSource( const Reference< XListEntrySource >& _rxSource ) { Reference< XListEntrySink > xSink( m_xControlModel, UNO_QUERY ); @@ -533,7 +528,6 @@ namespace pcr xSink->setListEntrySource( _rxSource ); } - } // namespace pcr diff --git a/extensions/source/propctrlr/commoncontrol.cxx b/extensions/source/propctrlr/commoncontrol.cxx index 243bbd813b57..4f44f3e568ca 100644 --- a/extensions/source/propctrlr/commoncontrol.cxx +++ b/extensions/source/propctrlr/commoncontrol.cxx @@ -18,7 +18,7 @@ */ #include "commoncontrol.hxx" -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> namespace pcr diff --git a/extensions/source/propctrlr/composeduiupdate.cxx b/extensions/source/propctrlr/composeduiupdate.cxx index 0e32ef19a9db..247dd4ab3e71 100644 --- a/extensions/source/propctrlr/composeduiupdate.cxx +++ b/extensions/source/propctrlr/composeduiupdate.cxx @@ -766,7 +766,7 @@ namespace pcr singleUI.second->dispose(); } m_pCollectedUIs.reset(); - m_xDelegatorUI.set( nullptr ); + m_xDelegatorUI.clear(); } diff --git a/extensions/source/propctrlr/controlfontdialog.cxx b/extensions/source/propctrlr/controlfontdialog.cxx index 08088e074f76..33da88b14ff4 100644 --- a/extensions/source/propctrlr/controlfontdialog.cxx +++ b/extensions/source/propctrlr/controlfontdialog.cxx @@ -32,14 +32,13 @@ namespace pcr using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; OControlFontDialog::OControlFontDialog(const Reference< XComponentContext >& _rxContext ) - :OGenericUnoDialog( _rxContext ) - ,m_pItemPoolDefaults(nullptr) + : OGenericUnoDialog( _rxContext ) + , maFontList(Application::GetDefaultDevice()) { - registerProperty(PROPERTY_INTROSPECTEDOBJECT, OWN_PROPERTY_ID_INTROSPECTEDOBJECT, + registerProperty(PROPERTY_INTROSPECTEDOBJECT, static_cast<sal_Int32>(OwnPropertyId::INTROSPECTEDOBJECT), PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT, &m_xControlModel, cppu::UnoType<decltype(m_xControlModel)>::get()); } @@ -53,7 +52,7 @@ namespace pcr if (m_xDialog) { destroyDialog(); - ControlCharacterDialog::destroyItemSet(m_pFontItems, m_pItemPool, m_pItemPoolDefaults); + ControlCharacterDialog::destroyItemSet(m_pFontItems, m_pItemPool); } } } @@ -112,7 +111,7 @@ namespace pcr std::unique_ptr<weld::DialogController> OControlFontDialog::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent) { - ControlCharacterDialog::createItemSet(m_pFontItems, m_pItemPool, m_pItemPoolDefaults); + ControlCharacterDialog::createItemSet(m_pFontItems, m_pItemPool, maFontList); OSL_ENSURE(m_xControlModel.is(), "OControlFontDialog::createDialog: no introspectee set!"); if (m_xControlModel.is()) diff --git a/extensions/source/propctrlr/controlfontdialog.hxx b/extensions/source/propctrlr/controlfontdialog.hxx index 8dc52010273f..29dd95d2192a 100644 --- a/extensions/source/propctrlr/controlfontdialog.hxx +++ b/extensions/source/propctrlr/controlfontdialog.hxx @@ -21,10 +21,10 @@ #include <comphelper/proparrhlp.hxx> #include <svtools/genericunodialog.hxx> +#include <svtools/ctrltool.hxx> class SfxItemSet; class SfxItemPool; -class SfxPoolItem; namespace pcr { @@ -45,8 +45,7 @@ namespace pcr std::unique_ptr<SfxItemSet> m_pFontItems; // item set for the dialog rtl::Reference<SfxItemPool> m_pItemPool; // item pool for the item set for the dialog - std::vector<SfxPoolItem*>* - m_pItemPoolDefaults; // pool defaults + FontList maFontList; public: explicit OControlFontDialog(const css::uno::Reference< css::uno::XComponentContext >& _rxContext); diff --git a/extensions/source/propctrlr/defaultforminspection.cxx b/extensions/source/propctrlr/defaultforminspection.cxx index 7de6673f0d2e..3fa7fa5658a5 100644 --- a/extensions/source/propctrlr/defaultforminspection.cxx +++ b/extensions/source/propctrlr/defaultforminspection.cxx @@ -34,7 +34,6 @@ namespace pcr { - using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Any; using ::com::sun::star::uno::XInterface; @@ -131,8 +130,8 @@ namespace pcr { const char* programmaticName; TranslateId uiNameResId; - rtl::OUStringConstExpr helpId; - } const aCategories[] = { + OUString helpId; + } constexpr aCategories[] = { { "General", RID_STR_PROPPAGE_DEFAULT, HID_FM_PROPDLG_TAB_GENERAL }, { "Data", RID_STR_PROPPAGE_DATA, HID_FM_PROPDLG_TAB_DATA }, { "Events", RID_STR_EVENTS, HID_FM_PROPDLG_TAB_EVT } diff --git a/extensions/source/propctrlr/defaulthelpprovider.cxx b/extensions/source/propctrlr/defaulthelpprovider.cxx index 8f1e22b82f12..96c99af67e27 100644 --- a/extensions/source/propctrlr/defaulthelpprovider.cxx +++ b/extensions/source/propctrlr/defaulthelpprovider.cxx @@ -27,7 +27,7 @@ #include <toolkit/helper/vclunohelper.hxx> #include <vcl/window.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <cppuhelper/supportsservice.hxx> @@ -47,7 +47,6 @@ namespace pcr using ::com::sun::star::ucb::AlreadyInitializedException; using ::com::sun::star::lang::IllegalArgumentException; using ::com::sun::star::uno::UNO_QUERY; - using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::awt::XWindow; DefaultHelpProvider::DefaultHelpProvider() diff --git a/extensions/source/propctrlr/editpropertyhandler.cxx b/extensions/source/propctrlr/editpropertyhandler.cxx index 72fc1042ab48..272e24428e20 100644 --- a/extensions/source/propctrlr/editpropertyhandler.cxx +++ b/extensions/source/propctrlr/editpropertyhandler.cxx @@ -23,13 +23,17 @@ #include <com/sun/star/inspection/XObjectInspectorUI.hpp> #include <com/sun/star/lang/NullPointerException.hpp> -#include <tools/diagnose_ex.h> - -#define TEXTTYPE_SINGLELINE 0 -#define TEXTTYPE_MULTILINE 1 -#define TEXTTYPE_RICHTEXT 2 - +#include <comphelper/diagnose_ex.hxx> +namespace +{ + enum class TextType + { + SINGLELINE = 0, + MULTILINE = 1, + RICHTEXT = 2 + }; +}; namespace pcr { @@ -37,8 +41,6 @@ namespace pcr using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::script; - using namespace ::com::sun::star::frame; using namespace ::com::sun::star::inspection; @@ -91,21 +93,21 @@ namespace pcr case PROPERTY_ID_TEXTTYPE: { - sal_Int32 nTextType = TEXTTYPE_SINGLELINE; + TextType nTextType = TextType::SINGLELINE; bool bRichText = false; OSL_VERIFY( m_xComponent->getPropertyValue( PROPERTY_RICHTEXT ) >>= bRichText ); if ( bRichText ) - nTextType = TEXTTYPE_RICHTEXT; + nTextType = TextType::RICHTEXT; else { bool bMultiLine = false; OSL_VERIFY( m_xComponent->getPropertyValue( PROPERTY_MULTILINE ) >>= bMultiLine ); if ( bMultiLine ) - nTextType = TEXTTYPE_MULTILINE; + nTextType = TextType::MULTILINE; else - nTextType = TEXTTYPE_SINGLELINE; + nTextType = TextType::SINGLELINE; } - aReturn <<= nTextType; + aReturn <<= static_cast<sal_Int32>(nTextType); } break; @@ -141,8 +143,8 @@ namespace pcr bool bHasVScroll = 0 != ( nScrollbars & 2 ); bool bHasHScroll = 0 != ( nScrollbars & 1 ); - m_xComponent->setPropertyValue( PROPERTY_VSCROLL, makeAny( bHasVScroll ) ); - m_xComponent->setPropertyValue( PROPERTY_HSCROLL, makeAny( bHasHScroll ) ); + m_xComponent->setPropertyValue( PROPERTY_VSCROLL, Any( bHasVScroll ) ); + m_xComponent->setPropertyValue( PROPERTY_HSCROLL, Any( bHasHScroll ) ); } break; @@ -150,19 +152,19 @@ namespace pcr { bool bMultiLine = false; bool bRichText = false; - sal_Int32 nTextType = TEXTTYPE_SINGLELINE; + sal_Int32 nTextType = static_cast<sal_Int32>(TextType::SINGLELINE); OSL_VERIFY( _rValue >>= nTextType ); - switch ( nTextType ) + switch ( static_cast<TextType>(nTextType) ) { - case TEXTTYPE_SINGLELINE: bMultiLine = bRichText = false; break; - case TEXTTYPE_MULTILINE: bMultiLine = true; bRichText = false; break; - case TEXTTYPE_RICHTEXT: bMultiLine = true; bRichText = true; break; + case TextType::SINGLELINE: bMultiLine = bRichText = false; break; + case TextType::MULTILINE: bMultiLine = true; bRichText = false; break; + case TextType::RICHTEXT: bMultiLine = true; bRichText = true; break; default: OSL_FAIL( "EditPropertyHandler::setPropertyValue: invalid text type!" ); } - m_xComponent->setPropertyValue( PROPERTY_MULTILINE, makeAny( bMultiLine ) ); - m_xComponent->setPropertyValue( PROPERTY_RICHTEXT, makeAny( bRichText ) ); + m_xComponent->setPropertyValue( PROPERTY_MULTILINE, Any( bMultiLine ) ); + m_xComponent->setPropertyValue( PROPERTY_RICHTEXT, Any( bRichText ) ); } break; @@ -261,21 +263,23 @@ namespace pcr { case PROPERTY_ID_TEXTTYPE: { - sal_Int32 nTextType = TEXTTYPE_SINGLELINE; - getPropertyValue( PROPERTY_TEXTTYPE ) >>= nTextType; + sal_Int32 nTextTypeInt = static_cast<sal_Int32>(TextType::SINGLELINE); + getPropertyValue( PROPERTY_TEXTTYPE ) >>= nTextTypeInt; + + TextType nTextType = static_cast<TextType>(nTextTypeInt); if ( impl_isSupportedProperty_nothrow( PROPERTY_ID_WORDBREAK ) ) - _rxInspectorUI->enablePropertyUI( PROPERTY_WORDBREAK, nTextType == TEXTTYPE_RICHTEXT ); - _rxInspectorUI->enablePropertyUI( PROPERTY_MAXTEXTLEN, nTextType != TEXTTYPE_RICHTEXT ); - _rxInspectorUI->enablePropertyUI( PROPERTY_ECHO_CHAR, nTextType == TEXTTYPE_SINGLELINE ); - _rxInspectorUI->enablePropertyUI( PROPERTY_FONT, nTextType != TEXTTYPE_RICHTEXT ); - _rxInspectorUI->enablePropertyUI( PROPERTY_ALIGN, nTextType != TEXTTYPE_RICHTEXT ); - _rxInspectorUI->enablePropertyUI( PROPERTY_DEFAULT_TEXT, nTextType != TEXTTYPE_RICHTEXT ); - _rxInspectorUI->enablePropertyUI( PROPERTY_SHOW_SCROLLBARS, nTextType != TEXTTYPE_SINGLELINE ); - _rxInspectorUI->enablePropertyUI( PROPERTY_LINEEND_FORMAT, nTextType != TEXTTYPE_SINGLELINE ); - _rxInspectorUI->enablePropertyUI( PROPERTY_VERTICAL_ALIGN, nTextType == TEXTTYPE_SINGLELINE ); - - _rxInspectorUI->showCategory( "Data", nTextType != TEXTTYPE_RICHTEXT ); + _rxInspectorUI->enablePropertyUI( PROPERTY_WORDBREAK, nTextType == TextType::RICHTEXT ); + _rxInspectorUI->enablePropertyUI( PROPERTY_MAXTEXTLEN, nTextType != TextType::RICHTEXT ); + _rxInspectorUI->enablePropertyUI( PROPERTY_ECHO_CHAR, nTextType == TextType::SINGLELINE ); + _rxInspectorUI->enablePropertyUI( PROPERTY_FONT, nTextType != TextType::RICHTEXT ); + _rxInspectorUI->enablePropertyUI( PROPERTY_ALIGN, nTextType != TextType::RICHTEXT ); + _rxInspectorUI->enablePropertyUI( PROPERTY_DEFAULT_TEXT, nTextType != TextType::RICHTEXT ); + _rxInspectorUI->enablePropertyUI( PROPERTY_SHOW_SCROLLBARS, nTextType != TextType::SINGLELINE ); + _rxInspectorUI->enablePropertyUI( PROPERTY_LINEEND_FORMAT, nTextType != TextType::SINGLELINE ); + _rxInspectorUI->enablePropertyUI( PROPERTY_VERTICAL_ALIGN, nTextType == TextType::SINGLELINE ); + + _rxInspectorUI->showCategory( "Data", nTextType != TextType::RICHTEXT ); } break; diff --git a/extensions/source/propctrlr/eformshelper.cxx b/extensions/source/propctrlr/eformshelper.cxx index 95d9eeb6aa99..bcc0b25987c8 100644 --- a/extensions/source/propctrlr/eformshelper.cxx +++ b/extensions/source/propctrlr/eformshelper.cxx @@ -31,7 +31,7 @@ #include <com/sun/star/xforms/XFormsUIHelper1.hpp> #include <com/sun/star/xsd/DataTypeClass.hpp> #include <com/sun/star/form/binding/XListEntrySink.hpp> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <algorithm> #include <o3tl/functional.hxx> @@ -374,7 +374,6 @@ namespace pcr return xModel; } - OUString EFormsHelper::getCurrentFormModelName() const { OUString sModelName; @@ -391,7 +390,6 @@ namespace pcr return sModelName; } - Reference< XPropertySet > EFormsHelper::getCurrentBinding() const { Reference< XPropertySet > xBinding; @@ -409,7 +407,6 @@ namespace pcr return xBinding; } - OUString EFormsHelper::getCurrentBindingName() const { OUString sBindingName; @@ -429,19 +426,18 @@ namespace pcr Reference< XListEntrySource > EFormsHelper::getCurrentListSourceBinding() const { - Reference< XListEntrySource > xReturn; try { Reference< XListEntrySink > xAsSink( m_xControlModel, UNO_QUERY ); OSL_ENSURE( xAsSink.is(), "EFormsHelper::getCurrentListSourceBinding: you should have used isListEntrySink before!" ); - if ( xAsSink.is() ) - xReturn = xAsSink->getListEntrySource(); + if (xAsSink.is()) + return xAsSink->getListEntrySource(); } catch( const Exception& ) { TOOLS_WARN_EXCEPTION( "extensions.propctrlr", "EFormsHelper::getCurrentListSourceBinding" ); } - return xReturn; + return Reference<XListEntrySource>(); } @@ -460,7 +456,6 @@ namespace pcr } } - void EFormsHelper::setBinding( const Reference< css::beans::XPropertySet >& _rxBinding ) { if ( !m_xBindableControl.is() ) @@ -525,8 +520,8 @@ namespace pcr xBinding = xModel->createBinding( ); if ( xBinding.is() ) { - xBinding->setPropertyValue( PROPERTY_BINDING_ID, makeAny( _rBindingName ) ); - xModel->getBindings()->insert( makeAny( xBinding ) ); + xBinding->setPropertyValue( PROPERTY_BINDING_ID, Any( _rBindingName ) ); + xModel->getBindings()->insert( Any( xBinding ) ); } } } @@ -547,7 +542,7 @@ namespace pcr Reference< XNamed > xName( xBinding, UNO_QUERY_THROW ); xName->setName( sNewName ); // and insert into the model - xModel->getBindings()->insert( makeAny( xBinding ) ); + xModel->getBindings()->insert( Any( xBinding ) ); } } } @@ -674,7 +669,7 @@ namespace pcr xElement->getPropertyValue( PROPERTY_MODEL ) >>= xElementsModel; OSL_ENSURE( xElementsModel == xModel, "EFormsHelper::getAllElementUINames: inconsistency in the model-element relationship!" ); if ( xElementsModel != xModel ) - xElement->setPropertyValue( PROPERTY_MODEL, makeAny( xModel ) ); + xElement->setPropertyValue( PROPERTY_MODEL, Any( xModel ) ); } #endif OUString sElementName = ( _eType == Submission ) ? xHelper->getSubmissionName( xElement, true ) : xHelper->getBindingName( xElement, true ); diff --git a/extensions/source/propctrlr/eformspropertyhandler.cxx b/extensions/source/propctrlr/eformspropertyhandler.cxx index 23d468a7d909..68e8ebb4f423 100644 --- a/extensions/source/propctrlr/eformspropertyhandler.cxx +++ b/extensions/source/propctrlr/eformspropertyhandler.cxx @@ -29,7 +29,7 @@ #include <com/sun/star/inspection/PropertyControlType.hpp> #include <com/sun/star/inspection/XObjectInspectorUI.hpp> #include <tools/debug.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <sal/log.hxx> @@ -42,7 +42,6 @@ namespace pcr using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::xforms; - using namespace ::com::sun::star::script; using namespace ::com::sun::star::ui::dialogs; using namespace ::com::sun::star::form::binding; using namespace ::com::sun::star::inspection; @@ -178,7 +177,7 @@ namespace pcr OUString sOldBindingName = m_pHelper->getCurrentBindingName(); m_pHelper->setBinding( nullptr ); firePropertyChange( PROPERTY_BINDING_NAME, PROPERTY_ID_BINDING_NAME, - makeAny( sOldBindingName ), makeAny( OUString() ) ); + Any( sOldBindingName ), Any( OUString() ) ); } } break; @@ -211,7 +210,7 @@ namespace pcr // However, there's no such mechanism in place currently. m_bSimulatingModelChange = true; firePropertyChange( PROPERTY_XML_DATA_MODEL, PROPERTY_ID_XML_DATA_MODEL, - makeAny( OUString() ), makeAny( getModelNamePropertyValue() ) ); + Any( OUString() ), Any( getModelNamePropertyValue() ) ); m_bSimulatingModelChange = false; } } @@ -281,7 +280,7 @@ namespace pcr { if ( m_pHelper->canBindToAnyDataType() ) { - aProperties.reserve( 7 ); + aProperties.reserve(9); addStringPropertyDescription( aProperties, PROPERTY_XML_DATA_MODEL ); addStringPropertyDescription( aProperties, PROPERTY_BINDING_NAME ); addStringPropertyDescription( aProperties, PROPERTY_BIND_EXPRESSION ); @@ -499,9 +498,9 @@ namespace pcr if ( !xModel.is() || !xBinding.is() || sFacetName.isEmpty() ) return InteractiveSelectionResult_Cancelled; - xDialogProps->setPropertyValue("FormModel", makeAny( xModel ) ); - xDialogProps->setPropertyValue("Binding", makeAny( xBinding ) ); - xDialogProps->setPropertyValue("FacetName", makeAny( sFacetName ) ); + xDialogProps->setPropertyValue("FormModel", Any( xModel ) ); + xDialogProps->setPropertyValue("Binding", Any( xBinding ) ); + xDialogProps->setPropertyValue("FacetName", Any( sFacetName ) ); if ( !xDialog->execute() ) // cancelled diff --git a/extensions/source/propctrlr/eventhandler.cxx b/extensions/source/propctrlr/eventhandler.cxx index 5939110d0ede..7e4ca0747cb4 100644 --- a/extensions/source/propctrlr/eventhandler.cxx +++ b/extensions/source/propctrlr/eventhandler.cxx @@ -59,12 +59,13 @@ #include <rtl/ref.hxx> #include <rtl/ustrbuf.hxx> #include <svx/svxdlg.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <map> #include <algorithm> #include <iterator> #include <string_view> +#include <utility> namespace pcr { @@ -98,7 +99,6 @@ namespace pcr using ::com::sun::star::form::runtime::FormController; using ::com::sun::star::form::runtime::XFormController; using ::com::sun::star::beans::UnknownPropertyException; - using ::com::sun::star::uno::makeAny; using ::com::sun::star::container::NoSuchElementException; using ::com::sun::star::beans::XPropertySetInfo; using ::com::sun::star::container::XNameReplace; @@ -117,34 +117,28 @@ namespace pcr using com::sun::star::uri::UriReferenceFactory; using com::sun::star::uri::XUriReferenceFactory; using com::sun::star::uri::XVndSunStarScriptUrlReference; - using ::com::sun::star::lang::XEventListener; namespace PropertyControlType = css::inspection::PropertyControlType; namespace PropertyAttribute = css::beans::PropertyAttribute; namespace FormComponentType = css::form::FormComponentType; - EventDescription::EventDescription( EventId _nId, const char* _pListenerNamespaceAscii, const char* _pListenerClassAsciiName, - const char* _pListenerMethodAsciiName, TranslateId pDisplayNameResId, const OUString& _sHelpId, const OString& _sUniqueBrowseId ) + EventDescription::EventDescription( EventId _nId, std::u16string_view listenerClassName, + std::u16string_view listenerMethodName, TranslateId pDisplayNameResId, OUString _sHelpId, OString _sUniqueBrowseId ) :sDisplayName(PcrRes( pDisplayNameResId )) - ,sListenerMethodName( OUString::createFromAscii( _pListenerMethodAsciiName ) ) - ,sHelpId( _sHelpId ) - ,sUniqueBrowseId( _sUniqueBrowseId ) + ,sListenerClassName( listenerClassName ) + ,sListenerMethodName( listenerMethodName ) + ,sHelpId(std::move( _sHelpId )) + ,sUniqueBrowseId(std::move( _sUniqueBrowseId )) ,nId( _nId ) { - OUStringBuffer aQualifiedListenerClass; - aQualifiedListenerClass.append( "com.sun.star." ); - aQualifiedListenerClass.appendAscii( _pListenerNamespaceAscii ); - aQualifiedListenerClass.append( "." ); - aQualifiedListenerClass.appendAscii( _pListenerClassAsciiName ); - sListenerClassName = aQualifiedListenerClass.makeStringAndClear(); } namespace { - #define DESCRIBE_EVENT( map, asciinamespace, asciilistener, asciimethod, id_postfix ) \ + #define DESCRIBE_EVENT( map, listener, method, id_postfix ) \ map.emplace( \ - asciimethod, \ - EventDescription( ++nEventId, asciinamespace, asciilistener, asciimethod, RID_STR_EVT_##id_postfix, HID_EVT_##id_postfix, UID_BRWEVT_##id_postfix ) ) + u"" method##_ustr, \ + EventDescription( ++nEventId, u"com.sun.star." listener, u"" method, RID_STR_EVT_##id_postfix, HID_EVT_##id_postfix, UID_BRWEVT_##id_postfix ) ) bool lcl_getEventDescriptionForMethod( const OUString& _rMethodName, EventDescription& _out_rDescription ) { @@ -152,39 +146,39 @@ namespace pcr EventMap aMap; sal_Int32 nEventId = 0; - DESCRIBE_EVENT(aMap, "form", "XApproveActionListener", "approveAction", APPROVEACTIONPERFORMED); - DESCRIBE_EVENT(aMap, "awt", "XActionListener", "actionPerformed", ACTIONPERFORMED); - DESCRIBE_EVENT(aMap, "form", "XChangeListener", "changed", CHANGED); - DESCRIBE_EVENT(aMap, "awt", "XTextListener", "textChanged", TEXTCHANGED); - DESCRIBE_EVENT(aMap, "awt", "XItemListener", "itemStateChanged", ITEMSTATECHANGED); - DESCRIBE_EVENT(aMap, "awt", "XFocusListener", "focusGained", FOCUSGAINED); - DESCRIBE_EVENT(aMap, "awt", "XFocusListener", "focusLost", FOCUSLOST); - DESCRIBE_EVENT(aMap, "awt", "XKeyListener", "keyPressed", KEYTYPED); - DESCRIBE_EVENT(aMap, "awt", "XKeyListener", "keyReleased", KEYUP); - DESCRIBE_EVENT(aMap, "awt", "XMouseListener", "mouseEntered", MOUSEENTERED); - DESCRIBE_EVENT(aMap, "awt", "XMouseMotionListener", "mouseDragged", MOUSEDRAGGED); - DESCRIBE_EVENT(aMap, "awt", "XMouseMotionListener", "mouseMoved", MOUSEMOVED); - DESCRIBE_EVENT(aMap, "awt", "XMouseListener", "mousePressed", MOUSEPRESSED); - DESCRIBE_EVENT(aMap, "awt", "XMouseListener", "mouseReleased", MOUSERELEASED); - DESCRIBE_EVENT(aMap, "awt", "XMouseListener", "mouseExited", MOUSEEXITED); - DESCRIBE_EVENT(aMap, "form", "XResetListener", "approveReset", APPROVERESETTED); - DESCRIBE_EVENT(aMap, "form", "XResetListener", "resetted", RESETTED); - DESCRIBE_EVENT(aMap, "form", "XSubmitListener", "approveSubmit", SUBMITTED); - DESCRIBE_EVENT(aMap, "form", "XUpdateListener", "approveUpdate", BEFOREUPDATE); - DESCRIBE_EVENT(aMap, "form", "XUpdateListener", "updated", AFTERUPDATE); - DESCRIBE_EVENT(aMap, "form", "XLoadListener", "loaded", LOADED); - DESCRIBE_EVENT(aMap, "form", "XLoadListener", "reloading", RELOADING); - DESCRIBE_EVENT(aMap, "form", "XLoadListener", "reloaded", RELOADED); - DESCRIBE_EVENT(aMap, "form", "XLoadListener", "unloading", UNLOADING); - DESCRIBE_EVENT(aMap, "form", "XLoadListener", "unloaded", UNLOADED); - DESCRIBE_EVENT(aMap, "form", "XConfirmDeleteListener", "confirmDelete", CONFIRMDELETE); - DESCRIBE_EVENT(aMap, "sdb", "XRowSetApproveListener", "approveRowChange", APPROVEROWCHANGE); - DESCRIBE_EVENT(aMap, "sdbc", "XRowSetListener", "rowChanged", ROWCHANGE); - DESCRIBE_EVENT(aMap, "sdb", "XRowSetApproveListener", "approveCursorMove", POSITIONING); - DESCRIBE_EVENT(aMap, "sdbc", "XRowSetListener", "cursorMoved", POSITIONED); - DESCRIBE_EVENT(aMap, "form", "XDatabaseParameterListener", "approveParameter", APPROVEPARAMETER); - DESCRIBE_EVENT(aMap, "sdb", "XSQLErrorListener", "errorOccured", ERROROCCURRED); - DESCRIBE_EVENT(aMap, "awt", "XAdjustmentListener", "adjustmentValueChanged", ADJUSTMENTVALUECHANGED); + DESCRIBE_EVENT(aMap, "form.XApproveActionListener", "approveAction", APPROVEACTIONPERFORMED); + DESCRIBE_EVENT(aMap, "awt.XActionListener", "actionPerformed", ACTIONPERFORMED); + DESCRIBE_EVENT(aMap, "form.XChangeListener", "changed", CHANGED); + DESCRIBE_EVENT(aMap, "awt.XTextListener", "textChanged", TEXTCHANGED); + DESCRIBE_EVENT(aMap, "awt.XItemListener", "itemStateChanged", ITEMSTATECHANGED); + DESCRIBE_EVENT(aMap, "awt.XFocusListener", "focusGained", FOCUSGAINED); + DESCRIBE_EVENT(aMap, "awt.XFocusListener", "focusLost", FOCUSLOST); + DESCRIBE_EVENT(aMap, "awt.XKeyListener", "keyPressed", KEYTYPED); + DESCRIBE_EVENT(aMap, "awt.XKeyListener", "keyReleased", KEYUP); + DESCRIBE_EVENT(aMap, "awt.XMouseListener", "mouseEntered", MOUSEENTERED); + DESCRIBE_EVENT(aMap, "awt.XMouseMotionListener", "mouseDragged", MOUSEDRAGGED); + DESCRIBE_EVENT(aMap, "awt.XMouseMotionListener", "mouseMoved", MOUSEMOVED); + DESCRIBE_EVENT(aMap, "awt.XMouseListener", "mousePressed", MOUSEPRESSED); + DESCRIBE_EVENT(aMap, "awt.XMouseListener", "mouseReleased", MOUSERELEASED); + DESCRIBE_EVENT(aMap, "awt.XMouseListener", "mouseExited", MOUSEEXITED); + DESCRIBE_EVENT(aMap, "form.XResetListener", "approveReset", APPROVERESETTED); + DESCRIBE_EVENT(aMap, "form.XResetListener", "resetted", RESETTED); + DESCRIBE_EVENT(aMap, "form.XSubmitListener", "approveSubmit", SUBMITTED); + DESCRIBE_EVENT(aMap, "form.XUpdateListener", "approveUpdate", BEFOREUPDATE); + DESCRIBE_EVENT(aMap, "form.XUpdateListener", "updated", AFTERUPDATE); + DESCRIBE_EVENT(aMap, "form.XLoadListener", "loaded", LOADED); + DESCRIBE_EVENT(aMap, "form.XLoadListener", "reloading", RELOADING); + DESCRIBE_EVENT(aMap, "form.XLoadListener", "reloaded", RELOADED); + DESCRIBE_EVENT(aMap, "form.XLoadListener", "unloading", UNLOADING); + DESCRIBE_EVENT(aMap, "form.XLoadListener", "unloaded", UNLOADED); + DESCRIBE_EVENT(aMap, "form.XConfirmDeleteListener", "confirmDelete", CONFIRMDELETE); + DESCRIBE_EVENT(aMap, "sdb.XRowSetApproveListener", "approveRowChange", APPROVEROWCHANGE); + DESCRIBE_EVENT(aMap, "sdbc.XRowSetListener", "rowChanged", ROWCHANGE); + DESCRIBE_EVENT(aMap, "sdb.XRowSetApproveListener", "approveCursorMove", POSITIONING); + DESCRIBE_EVENT(aMap, "sdbc.XRowSetListener", "cursorMoved", POSITIONED); + DESCRIBE_EVENT(aMap, "form.XDatabaseParameterListener", "approveParameter", APPROVEPARAMETER); + DESCRIBE_EVENT(aMap, "sdb.XSQLErrorListener", "errorOccured", ERROROCCURRED); + DESCRIBE_EVENT(aMap, "awt.XAdjustmentListener", "adjustmentValueChanged", ADJUSTMENTVALUECHANGED); return aMap; }(); @@ -237,11 +231,11 @@ namespace pcr sal_Int32 nPrefixLen = aScriptEvent.ScriptCode.indexOf( ':' ); OSL_ENSURE( nPrefixLen > 0, "lcl_getAssignedScriptEvent: illegal location!" ); - OUString sLocation = aScriptEvent.ScriptCode.copy( 0, nPrefixLen ); - OUString sMacroPath = aScriptEvent.ScriptCode.copy( nPrefixLen + 1 ); + std::u16string_view sLocation = aScriptEvent.ScriptCode.subView( 0, nPrefixLen ); + std::u16string_view sMacroPath = aScriptEvent.ScriptCode.subView( nPrefixLen + 1 ); aScriptEvent.ScriptCode = - "vnd.sun.star.script:" + + OUString::Concat("vnd.sun.star.script:") + sMacroPath + "?language=Basic&location=" + sLocation; @@ -275,7 +269,7 @@ namespace pcr OSL_PRECOND( _rxIntrospection.is(), "lcl_addListenerTypesFor_throw: this will crash!" ); Reference< XIntrospectionAccess > xIntrospectionAccess( - _rxIntrospection->inspect( makeAny( _rxComponent ) ), UNO_SET_THROW ); + _rxIntrospection->inspect( Any( _rxComponent ) ), UNO_SET_THROW ); const Sequence< Type > aListeners( xIntrospectionAccess->getSupportedListeners() ); @@ -381,7 +375,7 @@ namespace pcr comphelper::makePropertyValue("Script", aDescriptor.ScriptCode) }; - return makeAny( aScriptDescriptor ); + return Any( aScriptDescriptor ); } Sequence< OUString > SAL_CALL EventHolder::getElementNames( ) @@ -511,7 +505,7 @@ namespace pcr } } - return makeAny( aPropertyValue ); + return Any( aPropertyValue ); } void SAL_CALL EventHandler::setPropertyValue( const OUString& _rPropertyName, const Any& _rValue ) @@ -568,7 +562,7 @@ namespace pcr // there is no need for this code... aAssignedScript.ScriptCode = sNewScriptCode; - return makeAny( aAssignedScript ); + return Any( aAssignedScript ); } Any SAL_CALL EventHandler::convertToControlValue( const OUString& /*_rPropertyName*/, const Any& _rPropertyValue, const Type& _rControlValueType ) @@ -608,8 +602,7 @@ namespace pcr OSL_ENSURE( !sLocation.isEmpty(), "EventHandler::convertToControlValue: unexpected: no location!" ); if ( !sLocation.isEmpty() ) { - aComposeBuffer.append( sLocation ); - aComposeBuffer.append( ", " ); + aComposeBuffer.append( sLocation + ", " ); } // language @@ -629,7 +622,7 @@ namespace pcr } } - return makeAny( sScript ); + return Any( sScript ); } PropertyState SAL_CALL EventHandler::getPropertyState( const OUString& /*_rPropertyName*/ ) @@ -802,7 +795,7 @@ namespace pcr // set the new "property value" setPropertyValue( lcl_getEventPropertyName( event.second.sListenerClassName, event.second.sListenerMethodName ), - makeAny( aScriptDescriptor ) + Any( aScriptDescriptor ) ); } } @@ -973,14 +966,14 @@ namespace pcr namespace { - bool lcl_endsWith( const OUString& _rText, const OUString& _rCheck ) + bool lcl_endsWith( std::u16string_view _rText, std::u16string_view _rCheck ) { - sal_Int32 nTextLen = _rText.getLength(); - sal_Int32 nCheckLen = _rCheck.getLength(); + size_t nTextLen = _rText.size(); + size_t nCheckLen = _rCheck.size(); if ( nCheckLen > nTextLen ) return false; - return _rText.indexOf( _rCheck ) == ( nTextLen - nCheckLen ); + return _rText.find( _rCheck ) == ( nTextLen - nCheckLen ); } } diff --git a/extensions/source/propctrlr/eventhandler.hxx b/extensions/source/propctrlr/eventhandler.hxx index 4506f1b066d8..4fa5c85d2ed5 100644 --- a/extensions/source/propctrlr/eventhandler.hxx +++ b/extensions/source/propctrlr/eventhandler.hxx @@ -56,12 +56,11 @@ namespace pcr EventDescription( EventId _nId, - const char* _pListenerNamespaceAscii, - const char* _pListenerClassAsciiName, - const char* _pListenerMethodAsciiName, + std::u16string_view listenerClassName, + std::u16string_view listenerMethodName, TranslateId pDisplayNameResId, - const OUString& _sHelpId, - const OString& _sUniqueBrowseId ); + OUString _sHelpId, + OString _sUniqueBrowseId ); }; typedef std::unordered_map< OUString, EventDescription > EventMap; diff --git a/extensions/source/propctrlr/fontdialog.cxx b/extensions/source/propctrlr/fontdialog.cxx index 89e6fb80e635..78dd50c8475d 100644 --- a/extensions/source/propctrlr/fontdialog.cxx +++ b/extensions/source/propctrlr/fontdialog.cxx @@ -32,7 +32,6 @@ #include <com/sun/star/awt/FontUnderline.hpp> #include <com/sun/star/awt/FontStrikeout.hpp> #include "formstrings.hxx" -#include "fontitemids.hxx" #include <editeng/charreliefitem.hxx> #include <editeng/emphasismarkitem.hxx> #include <editeng/fontitem.hxx> @@ -49,7 +48,7 @@ #include <editeng/shdditem.hxx> #include <editeng/flstitem.hxx> #include <svtools/ctrltool.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <com/sun/star/beans/XPropertyState.hpp> #include <svx/svxids.hrc> #include <svx/svxdlg.hxx> @@ -67,6 +66,35 @@ namespace pcr //= OFontPropertyExtractor + namespace FontItemIds + { + constexpr sal_uInt16 CFID_FONT = 1; + constexpr sal_uInt16 CFID_HEIGHT = 2; + constexpr sal_uInt16 CFID_WEIGHT = 3; + constexpr sal_uInt16 CFID_POSTURE = 4; + constexpr sal_uInt16 CFID_LANGUAGE = 5; + constexpr sal_uInt16 CFID_UNDERLINE = 6; + constexpr sal_uInt16 CFID_STRIKEOUT = 7; + constexpr TypedWhichId<SvxWordLineModeItem> CFID_WORDLINEMODE(8); + constexpr sal_uInt16 CFID_CHARCOLOR = 9; + constexpr sal_uInt16 CFID_RELIEF = 10; + constexpr TypedWhichId<SvxEmphasisMarkItem> CFID_EMPHASIS(11); + + constexpr sal_uInt16 CFID_CJK_FONT = 12; + constexpr sal_uInt16 CFID_CJK_HEIGHT = 13; + constexpr sal_uInt16 CFID_CJK_WEIGHT = 14; + constexpr sal_uInt16 CFID_CJK_POSTURE = 15; + constexpr sal_uInt16 CFID_CJK_LANGUAGE = 16; + constexpr sal_uInt16 CFID_CASEMAP = 17; + constexpr TypedWhichId<SvxContourItem> CFID_CONTOUR(18); + constexpr TypedWhichId<SvxShadowedItem> CFID_SHADOWED(19); + + constexpr sal_uInt16 CFID_FONTLIST = 20; + + constexpr sal_uInt16 CFID_FIRST_ITEM_ID = CFID_FONT; + constexpr sal_uInt16 CFID_LAST_ITEM_ID = CFID_FONTLIST; + } + namespace { class OFontPropertyExtractor @@ -216,32 +244,32 @@ namespace pcr sal_Int32 nColor32 = aPropExtractor.getInt32FontProperty(PROPERTY_TEXTCOLOR, 0); // build SfxItems with the values - SvxFontItem aFontItem(static_cast<FontFamily>(nFontFamily), aFontName, aFontStyleName, PITCH_DONTKNOW, nFontCharset, CFID_FONT); + SvxFontItem aFontItem(static_cast<FontFamily>(nFontFamily), aFontName, aFontStyleName, PITCH_DONTKNOW, nFontCharset, FontItemIds::CFID_FONT); nFontHeight = static_cast<float>(o3tl::convert(nFontHeight, o3tl::Length::pt, o3tl::Length::twip)); - SvxFontHeightItem aSvxFontHeightItem(static_cast<sal_uInt32>(nFontHeight),100,CFID_HEIGHT); + SvxFontHeightItem aSvxFontHeightItem(static_cast<sal_uInt32>(nFontHeight),100,FontItemIds::CFID_HEIGHT); FontWeight eWeight=vcl::unohelper::ConvertFontWeight(nFontWeight); FontItalic eItalic=vcl::unohelper::ConvertFontSlant(nFontSlant); FontLineStyle eUnderline=static_cast<FontLineStyle>(nFontLineStyle); FontStrikeout eStrikeout=static_cast<FontStrikeout>(nFontStrikeout); - SvxWeightItem aWeightItem(eWeight,CFID_WEIGHT); - SvxPostureItem aPostureItem(eItalic,CFID_POSTURE); + SvxWeightItem aWeightItem(eWeight,FontItemIds::CFID_WEIGHT); + SvxPostureItem aPostureItem(eItalic,FontItemIds::CFID_POSTURE); - SvxCrossedOutItem aCrossedOutItem(eStrikeout,CFID_STRIKEOUT); - SvxWordLineModeItem aWordLineModeItem(bWordLineMode, CFID_WORDLINEMODE); + SvxCrossedOutItem aCrossedOutItem(eStrikeout,FontItemIds::CFID_STRIKEOUT); + SvxWordLineModeItem aWordLineModeItem(bWordLineMode, FontItemIds::CFID_WORDLINEMODE); - SvxUnderlineItem aUnderlineItem(eUnderline,CFID_UNDERLINE); + SvxUnderlineItem aUnderlineItem(eUnderline,FontItemIds::CFID_UNDERLINE); aUnderlineItem.SetColor(Color(ColorTransparency, nTextLineColor)); - SvxColorItem aSvxColorItem(Color(ColorTransparency, nColor32),CFID_CHARCOLOR); - SvxLanguageItem aLanguageItem(Application::GetSettings().GetUILanguageTag().getLanguageType(), CFID_LANGUAGE); + SvxColorItem aSvxColorItem(Color(ColorTransparency, nColor32),FontItemIds::CFID_CHARCOLOR); + SvxLanguageItem aLanguageItem(Application::GetSettings().GetUILanguageTag().getLanguageType(), FontItemIds::CFID_LANGUAGE); // the 2 CJK props - SvxCharReliefItem aFontReliefItem(static_cast<FontRelief>(nFontRelief), CFID_RELIEF); - SvxEmphasisMarkItem aEmphasisMarkitem(static_cast<FontEmphasisMark>(nFontEmphasisMark), CFID_EMPHASIS); + SvxCharReliefItem aFontReliefItem(static_cast<FontRelief>(nFontRelief), FontItemIds::CFID_RELIEF); + SvxEmphasisMarkItem aEmphasisMarkitem(static_cast<FontEmphasisMark>(nFontEmphasisMark), FontItemIds::CFID_EMPHASIS); _pSet->Put(aFontItem); _pSet->Put(aSvxFontHeightItem); @@ -255,16 +283,16 @@ namespace pcr _pSet->Put(aFontReliefItem); _pSet->Put(aEmphasisMarkitem); - aPropExtractor.invalidateItem(PROPERTY_FONT_NAME, CFID_FONT, *_pSet); - aPropExtractor.invalidateItem(PROPERTY_FONT_HEIGHT, CFID_HEIGHT, *_pSet); - aPropExtractor.invalidateItem(PROPERTY_FONT_WEIGHT, CFID_WEIGHT, *_pSet, css::awt::FontWeight::DONTKNOW == nFontWeight); - aPropExtractor.invalidateItem(PROPERTY_FONT_SLANT, CFID_POSTURE, *_pSet, css::awt::FontSlant_DONTKNOW == nFontSlant); - aPropExtractor.invalidateItem(PROPERTY_FONT_UNDERLINE, CFID_UNDERLINE, *_pSet, css::awt::FontUnderline::DONTKNOW == nFontLineStyle); - aPropExtractor.invalidateItem(PROPERTY_FONT_STRIKEOUT, CFID_STRIKEOUT, *_pSet, css::awt::FontStrikeout::DONTKNOW == nFontStrikeout); - aPropExtractor.invalidateItem(PROPERTY_WORDLINEMODE, CFID_WORDLINEMODE, *_pSet); - aPropExtractor.invalidateItem(PROPERTY_TEXTCOLOR, CFID_CHARCOLOR, *_pSet); - aPropExtractor.invalidateItem(PROPERTY_FONT_RELIEF, CFID_RELIEF, *_pSet); - aPropExtractor.invalidateItem(PROPERTY_FONT_EMPHASIS_MARK, CFID_EMPHASIS, *_pSet); + aPropExtractor.invalidateItem(PROPERTY_FONT_NAME, FontItemIds::CFID_FONT, *_pSet); + aPropExtractor.invalidateItem(PROPERTY_FONT_HEIGHT, FontItemIds::CFID_HEIGHT, *_pSet); + aPropExtractor.invalidateItem(PROPERTY_FONT_WEIGHT, FontItemIds::CFID_WEIGHT, *_pSet, css::awt::FontWeight::DONTKNOW == nFontWeight); + aPropExtractor.invalidateItem(PROPERTY_FONT_SLANT, FontItemIds::CFID_POSTURE, *_pSet, css::awt::FontSlant_DONTKNOW == nFontSlant); + aPropExtractor.invalidateItem(PROPERTY_FONT_UNDERLINE, FontItemIds::CFID_UNDERLINE, *_pSet, css::awt::FontUnderline::DONTKNOW == nFontLineStyle); + aPropExtractor.invalidateItem(PROPERTY_FONT_STRIKEOUT, FontItemIds::CFID_STRIKEOUT, *_pSet, css::awt::FontStrikeout::DONTKNOW == nFontStrikeout); + aPropExtractor.invalidateItem(PROPERTY_WORDLINEMODE, FontItemIds::CFID_WORDLINEMODE, *_pSet); + aPropExtractor.invalidateItem(PROPERTY_TEXTCOLOR, FontItemIds::CFID_CHARCOLOR, *_pSet); + aPropExtractor.invalidateItem(PROPERTY_FONT_RELIEF, FontItemIds::CFID_RELIEF, *_pSet); + aPropExtractor.invalidateItem(PROPERTY_FONT_EMPHASIS_MARK, FontItemIds::CFID_EMPHASIS, *_pSet); } catch (const Exception&) { @@ -298,70 +326,70 @@ namespace pcr { // font name - SfxItemState eState = _rSet.GetItemState(CFID_FONT); + SfxItemState eState = _rSet.GetItemState(FontItemIds::CFID_FONT); if ( eState == SfxItemState::SET ) { const SvxFontItem& rFontItem = - static_cast<const SvxFontItem&>(_rSet.Get(CFID_FONT)); + static_cast<const SvxFontItem&>(_rSet.Get(FontItemIds::CFID_FONT)); - lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_NAME , makeAny(rFontItem.GetFamilyName())); - lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_STYLENAME, makeAny(rFontItem.GetStyleName())); - lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_FAMILY , makeAny(static_cast<sal_Int16>(rFontItem.GetFamily()))); - lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_CHARSET , makeAny(static_cast<sal_Int16>(rFontItem.GetCharSet()))); + lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_NAME , Any(rFontItem.GetFamilyName())); + lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_STYLENAME, Any(rFontItem.GetStyleName())); + lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_FAMILY , Any(static_cast<sal_Int16>(rFontItem.GetFamily()))); + lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_CHARSET , Any(static_cast<sal_Int16>(rFontItem.GetCharSet()))); } // font height - eState = _rSet.GetItemState(CFID_HEIGHT); + eState = _rSet.GetItemState(FontItemIds::CFID_HEIGHT); if ( eState == SfxItemState::SET ) { const SvxFontHeightItem& rSvxFontHeightItem = - static_cast<const SvxFontHeightItem&>(_rSet.Get(CFID_HEIGHT)); + static_cast<const SvxFontHeightItem&>(_rSet.Get(FontItemIds::CFID_HEIGHT)); float nHeight = static_cast<float>(o3tl::convert(rSvxFontHeightItem.GetHeight(), o3tl::Length::twip, o3tl::Length::pt)); - lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_HEIGHT,makeAny(nHeight)); + lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_HEIGHT,Any(nHeight)); } // font weight - eState = _rSet.GetItemState(CFID_WEIGHT); + eState = _rSet.GetItemState(FontItemIds::CFID_WEIGHT); if ( eState == SfxItemState::SET ) { const SvxWeightItem& rWeightItem = - static_cast<const SvxWeightItem&>(_rSet.Get(CFID_WEIGHT)); + static_cast<const SvxWeightItem&>(_rSet.Get(FontItemIds::CFID_WEIGHT)); float nWeight = vcl::unohelper::ConvertFontWeight(rWeightItem.GetWeight()); - lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_WEIGHT,makeAny(nWeight)); + lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_WEIGHT,Any(nWeight)); } // font slant - eState = _rSet.GetItemState(CFID_POSTURE); + eState = _rSet.GetItemState(FontItemIds::CFID_POSTURE); if ( eState == SfxItemState::SET ) { const SvxPostureItem& rPostureItem = - static_cast<const SvxPostureItem&>(_rSet.Get(CFID_POSTURE)); + static_cast<const SvxPostureItem&>(_rSet.Get(FontItemIds::CFID_POSTURE)); css::awt::FontSlant eSlant = vcl::unohelper::ConvertFontSlant(rPostureItem.GetPosture()); - lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_SLANT, makeAny(static_cast<sal_Int16>(eSlant))); + lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_SLANT, Any(static_cast<sal_Int16>(eSlant))); } // font underline - eState = _rSet.GetItemState(CFID_UNDERLINE); + eState = _rSet.GetItemState(FontItemIds::CFID_UNDERLINE); if ( eState == SfxItemState::SET ) { const SvxUnderlineItem& rUnderlineItem = - static_cast<const SvxUnderlineItem&>(_rSet.Get(CFID_UNDERLINE)); + static_cast<const SvxUnderlineItem&>(_rSet.Get(FontItemIds::CFID_UNDERLINE)); sal_Int16 nUnderline = static_cast<sal_Int16>(rUnderlineItem.GetLineStyle()); - lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_UNDERLINE,makeAny(nUnderline)); + lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_UNDERLINE,Any(nUnderline)); // the text line color is transported in this item, too Color nColor = rUnderlineItem.GetColor(); @@ -375,37 +403,37 @@ namespace pcr // font strikeout - eState = _rSet.GetItemState(CFID_STRIKEOUT); + eState = _rSet.GetItemState(FontItemIds::CFID_STRIKEOUT); if ( eState == SfxItemState::SET ) { const SvxCrossedOutItem& rCrossedOutItem = - static_cast<const SvxCrossedOutItem&>(_rSet.Get(CFID_STRIKEOUT)); + static_cast<const SvxCrossedOutItem&>(_rSet.Get(FontItemIds::CFID_STRIKEOUT)); sal_Int16 nStrikeout = static_cast<sal_Int16>(rCrossedOutItem.GetStrikeout()); - lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_STRIKEOUT,makeAny(nStrikeout)); + lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_STRIKEOUT,Any(nStrikeout)); } // font wordline mode - eState = _rSet.GetItemState(CFID_WORDLINEMODE); + eState = _rSet.GetItemState(FontItemIds::CFID_WORDLINEMODE); if ( eState == SfxItemState::SET ) { const SvxWordLineModeItem& rWordLineModeItem = - static_cast<const SvxWordLineModeItem&>(_rSet.Get(CFID_WORDLINEMODE)); + _rSet.Get(FontItemIds::CFID_WORDLINEMODE); - lcl_pushBackPropertyValue( _out_properties, PROPERTY_WORDLINEMODE, css::uno::makeAny(rWordLineModeItem.GetValue())); + lcl_pushBackPropertyValue( _out_properties, PROPERTY_WORDLINEMODE, css::uno::Any(rWordLineModeItem.GetValue())); } // text color - eState = _rSet.GetItemState(CFID_CHARCOLOR); + eState = _rSet.GetItemState(FontItemIds::CFID_CHARCOLOR); if ( eState == SfxItemState::SET ) { const SvxColorItem& rColorItem = - static_cast<const SvxColorItem&>(_rSet.Get(CFID_CHARCOLOR)); + static_cast<const SvxColorItem&>(_rSet.Get(FontItemIds::CFID_CHARCOLOR)); Color nColor = rColorItem.GetValue(); @@ -418,26 +446,25 @@ namespace pcr // font relief - eState = _rSet.GetItemState(CFID_RELIEF); + eState = _rSet.GetItemState(FontItemIds::CFID_RELIEF); if ( eState == SfxItemState::SET ) { const SvxCharReliefItem& rReliefItem = - static_cast<const SvxCharReliefItem&>(_rSet.Get(CFID_RELIEF)); + static_cast<const SvxCharReliefItem&>(_rSet.Get(FontItemIds::CFID_RELIEF)); - lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_RELIEF, makeAny(static_cast<sal_Int16>(rReliefItem.GetValue())) ); + lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_RELIEF, Any(static_cast<sal_Int16>(rReliefItem.GetValue())) ); } // font emphasis mark - eState = _rSet.GetItemState(CFID_EMPHASIS); + eState = _rSet.GetItemState(FontItemIds::CFID_EMPHASIS); if ( eState == SfxItemState::SET ) { - const SvxEmphasisMarkItem& rEmphMarkItem = - static_cast<const SvxEmphasisMarkItem&>(_rSet.Get(CFID_EMPHASIS)); + const SvxEmphasisMarkItem& rEmphMarkItem = _rSet.Get(FontItemIds::CFID_EMPHASIS); - lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_EMPHASIS_MARK, makeAny(static_cast<sal_Int16>(rEmphMarkItem.GetEmphasisMark())) ); + lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_EMPHASIS_MARK, Any(static_cast<sal_Int16>(rEmphMarkItem.GetEmphasisMark())) ); } } catch (const Exception& ) @@ -465,103 +492,89 @@ namespace pcr } } - void ControlCharacterDialog::createItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults) + static ItemInfoPackage& getItemInfoPackageCntChrDlg() { - // just to be sure... - _rpSet = nullptr; - _rpPool = nullptr; - _rpDefaults = nullptr; - - // create and initialize the defaults - _rpDefaults = new std::vector<SfxPoolItem*>(CFID_LAST_ITEM_ID - CFID_FIRST_ITEM_ID + 1); - - vcl::Font aDefaultVCLFont = Application::GetDefaultDevice()->GetSettings().GetStyleSettings().GetAppFont(); - - SfxPoolItem** pCounter = _rpDefaults->data(); // want to modify this without affecting the out param _rppDefaults - *pCounter++ = new SvxFontItem(aDefaultVCLFont.GetFamilyType(), aDefaultVCLFont.GetFamilyName(), aDefaultVCLFont.GetStyleName(), aDefaultVCLFont.GetPitch(), aDefaultVCLFont.GetCharSet(), CFID_FONT); - *pCounter++ = new SvxFontHeightItem(aDefaultVCLFont.GetFontHeight(), 100, CFID_HEIGHT); - *pCounter++ = new SvxWeightItem(aDefaultVCLFont.GetWeight(), CFID_WEIGHT); - *pCounter++ = new SvxPostureItem(aDefaultVCLFont.GetItalic(), CFID_POSTURE); - *pCounter++ = new SvxLanguageItem(Application::GetSettings().GetUILanguageTag().getLanguageType(), CFID_LANGUAGE); - *pCounter++ = new SvxUnderlineItem(aDefaultVCLFont.GetUnderline(), CFID_UNDERLINE); - *pCounter++ = new SvxCrossedOutItem(aDefaultVCLFont.GetStrikeout(), CFID_STRIKEOUT); - *pCounter++ = new SvxWordLineModeItem(aDefaultVCLFont.IsWordLineMode(), CFID_WORDLINEMODE); - *pCounter++ = new SvxColorItem(aDefaultVCLFont.GetColor(), CFID_CHARCOLOR); - *pCounter++ = new SvxCharReliefItem(aDefaultVCLFont.GetRelief(), CFID_RELIEF); - *pCounter++ = new SvxEmphasisMarkItem(aDefaultVCLFont.GetEmphasisMark(), CFID_EMPHASIS); - - *pCounter++ = new SvxFontItem(aDefaultVCLFont.GetFamilyType(), aDefaultVCLFont.GetFamilyName(), aDefaultVCLFont.GetStyleName(), aDefaultVCLFont.GetPitch(), aDefaultVCLFont.GetCharSet(), CFID_CJK_FONT); - *pCounter++ = new SvxFontHeightItem(aDefaultVCLFont.GetFontHeight(), 100, CFID_CJK_HEIGHT); - *pCounter++ = new SvxWeightItem(aDefaultVCLFont.GetWeight(), CFID_CJK_WEIGHT); - *pCounter++ = new SvxPostureItem(aDefaultVCLFont.GetItalic(), CFID_CJK_POSTURE); - *pCounter++ = new SvxLanguageItem(Application::GetSettings().GetUILanguageTag().getLanguageType(), CFID_CJK_LANGUAGE); - - *pCounter++ = new SvxCaseMapItem(SvxCaseMap::NotMapped, CFID_CASEMAP); - *pCounter++ = new SvxContourItem(false, CFID_CONTOUR); - *pCounter++ = new SvxShadowedItem(false, CFID_SHADOWED); - - *pCounter++ = new SvxFontListItem (new FontList(Application::GetDefaultDevice()), CFID_FONTLIST); - - // create the pool - static SfxItemInfo const aItemInfos[CFID_LAST_ITEM_ID - CFID_FIRST_ITEM_ID + 1] = + class ItemInfoPackageCntChrDlg : public ItemInfoPackage { - { SID_ATTR_CHAR_FONT, false }, - { SID_ATTR_CHAR_FONTHEIGHT, false }, - { SID_ATTR_CHAR_WEIGHT, false }, - { SID_ATTR_CHAR_POSTURE, false }, - { SID_ATTR_CHAR_LANGUAGE, false }, - { SID_ATTR_CHAR_UNDERLINE, false }, - { SID_ATTR_CHAR_STRIKEOUT, false }, - { SID_ATTR_CHAR_WORDLINEMODE, false }, - { SID_ATTR_CHAR_COLOR, false }, - { SID_ATTR_CHAR_RELIEF, false }, - { SID_ATTR_CHAR_EMPHASISMARK, false }, - { 0, false }, - { 0, false }, - { 0, false }, - { 0, false }, - { 0, false }, - { 0, false }, - { 0, false }, - { 0, false }, - { SID_ATTR_CHAR_FONTLIST, false } + vcl::Font maDefaultVCLFont{Application::GetDefaultDevice()->GetSettings().GetStyleSettings().GetAppFont()}; + typedef std::array<ItemInfoStatic, FontItemIds::CFID_LAST_ITEM_ID - FontItemIds::CFID_FIRST_ITEM_ID + 1> ItemInfoArrayCntChrDlg; + ItemInfoArrayCntChrDlg maItemInfos {{ + // m_nWhich, m_pItem, m_nSlotID, m_nItemInfoFlags + { FontItemIds::CFID_FONT, new SvxFontItem(maDefaultVCLFont.GetFamilyType(), maDefaultVCLFont.GetFamilyName(), maDefaultVCLFont.GetStyleName(), maDefaultVCLFont.GetPitch(), maDefaultVCLFont.GetCharSet(), FontItemIds::CFID_FONT), SID_ATTR_CHAR_FONT, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_HEIGHT, new SvxFontHeightItem(maDefaultVCLFont.GetFontHeight(), 100, FontItemIds::CFID_HEIGHT), SID_ATTR_CHAR_FONTHEIGHT, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_WEIGHT, new SvxWeightItem(maDefaultVCLFont.GetWeight(), FontItemIds::CFID_WEIGHT), SID_ATTR_CHAR_WEIGHT, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_POSTURE, new SvxPostureItem(maDefaultVCLFont.GetItalic(), FontItemIds::CFID_POSTURE), SID_ATTR_CHAR_POSTURE, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_LANGUAGE, new SvxLanguageItem(Application::GetSettings().GetUILanguageTag().getLanguageType(), FontItemIds::CFID_LANGUAGE), SID_ATTR_CHAR_LANGUAGE, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_UNDERLINE, new SvxUnderlineItem(maDefaultVCLFont.GetUnderline(), FontItemIds::CFID_UNDERLINE), SID_ATTR_CHAR_UNDERLINE, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_STRIKEOUT, new SvxCrossedOutItem(maDefaultVCLFont.GetStrikeout(), FontItemIds::CFID_STRIKEOUT), SID_ATTR_CHAR_STRIKEOUT, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_WORDLINEMODE, new SvxWordLineModeItem(maDefaultVCLFont.IsWordLineMode(), FontItemIds::CFID_WORDLINEMODE), SID_ATTR_CHAR_WORDLINEMODE, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_CHARCOLOR, new SvxColorItem(maDefaultVCLFont.GetColor(), FontItemIds::CFID_CHARCOLOR), SID_ATTR_CHAR_COLOR, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_RELIEF, new SvxCharReliefItem(maDefaultVCLFont.GetRelief(), FontItemIds::CFID_RELIEF), SID_ATTR_CHAR_RELIEF, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_EMPHASIS, new SvxEmphasisMarkItem(maDefaultVCLFont.GetEmphasisMark(), FontItemIds::CFID_EMPHASIS), SID_ATTR_CHAR_EMPHASISMARK, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_CJK_FONT, new SvxFontItem(maDefaultVCLFont.GetFamilyType(), maDefaultVCLFont.GetFamilyName(), maDefaultVCLFont.GetStyleName(), maDefaultVCLFont.GetPitch(), maDefaultVCLFont.GetCharSet(), FontItemIds::CFID_CJK_FONT), 0, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_CJK_HEIGHT, new SvxFontHeightItem(maDefaultVCLFont.GetFontHeight(), 100, FontItemIds::CFID_CJK_HEIGHT), 0, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_CJK_WEIGHT, new SvxWeightItem(maDefaultVCLFont.GetWeight(), FontItemIds::CFID_CJK_WEIGHT), 0, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_CJK_POSTURE, new SvxPostureItem(maDefaultVCLFont.GetItalic(), FontItemIds::CFID_CJK_POSTURE), 0, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_CJK_LANGUAGE, new SvxLanguageItem(Application::GetSettings().GetUILanguageTag().getLanguageType(), FontItemIds::CFID_CJK_LANGUAGE), 0, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_CASEMAP, new SvxCaseMapItem(SvxCaseMap::NotMapped, FontItemIds::CFID_CASEMAP), 0, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_CONTOUR, new SvxContourItem(false, FontItemIds::CFID_CONTOUR), 0, SFX_ITEMINFOFLAG_NONE }, + { FontItemIds::CFID_SHADOWED, new SvxShadowedItem(false, FontItemIds::CFID_SHADOWED), 0, SFX_ITEMINFOFLAG_NONE }, + + // SvxFontListItem has to be DynamicDefault. It is pool-dependent in the sense + // that it cannot/should not exist. Additionally SvxFontListItem has NO destructor + // and does not delete the contained/set FontList - this is done 'handish' in + // ControlCharacterDialog::destroyItemSet, see below... + { FontItemIds::CFID_FONTLIST, nullptr, SID_ATTR_CHAR_FONTLIST, SFX_ITEMINFOFLAG_NONE } + }}; + + virtual const ItemInfoStatic& getItemInfoStatic(size_t nIndex) const override { return maItemInfos[nIndex]; } + + public: + virtual size_t size() const override { return maItemInfos.size(); } + virtual const ItemInfo& getItemInfo(size_t nIndex, SfxItemPool& /*rPool*/) override { return maItemInfos[nIndex]; } }; - _rpPool = new SfxItemPool("PCRControlFontItemPool", CFID_FIRST_ITEM_ID, CFID_LAST_ITEM_ID, - aItemInfos, _rpDefaults); - _rpPool->FreezeIdRanges(); + static std::unique_ptr<ItemInfoPackageCntChrDlg> g_aItemInfoPackageCntChrDlg; + if (!g_aItemInfoPackageCntChrDlg) + g_aItemInfoPackageCntChrDlg.reset(new ItemInfoPackageCntChrDlg); + return *g_aItemInfoPackageCntChrDlg; + } + + void ControlCharacterDialog::createItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool, FontList& rFontList) + { + // just to be sure... + _rpSet = nullptr; + _rpPool = nullptr; + _rpPool = new SfxItemPool("PCRControlFontItemPool"); + _rpPool->registerItemInfoPackage( + getItemInfoPackageCntChrDlg(), + [&rFontList](sal_uInt16 nWhich) + { + SfxPoolItem* pRetval(nullptr); + if (FontItemIds::CFID_FONTLIST == nWhich) + pRetval = new SvxFontListItem(&rFontList, FontItemIds::CFID_FONTLIST); + return pRetval; + }); // and, finally, the set _rpSet.reset(new SfxItemSet(*_rpPool)); } - void ControlCharacterDialog::destroyItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults) + void ControlCharacterDialog::destroyItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool) { - // from the pool, get and remember the font list (needs to be deleted) - const SvxFontListItem& rFontListItem = static_cast<const SvxFontListItem&>(_rpPool->GetDefaultItem(CFID_FONTLIST)); - const FontList* pFontList = rFontListItem.GetFontList(); - // _first_ delete the set (referring the pool) _rpSet.reset(); // delete the pool - _rpPool->ReleaseDefaults(true); - // the "true" means delete the items, too _rpPool = nullptr; - - // reset the defaults ptr - _rpDefaults = nullptr; - // no need to explicitly delete the defaults, this has been done by the ReleaseDefaults - - delete pFontList; } - void ControlCharacterDialog::PageCreated(const OString& rId, SfxTabPage& rPage) + void ControlCharacterDialog::PageCreated(const OUString& rId, SfxTabPage& rPage) { SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); if (rId == "font") { - aSet.Put (static_cast<const SvxFontListItem&>(GetInputSetImpl()->Get(CFID_FONTLIST))); + aSet.Put (static_cast<const SvxFontListItem&>(GetInputSetImpl()->Get(FontItemIds::CFID_FONTLIST))); aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_HIDE_LANGUAGE)); rPage.PageCreated(aSet); } diff --git a/extensions/source/propctrlr/fontdialog.hxx b/extensions/source/propctrlr/fontdialog.hxx index eaba29db0b9c..07d72a600f4d 100644 --- a/extensions/source/propctrlr/fontdialog.hxx +++ b/extensions/source/propctrlr/fontdialog.hxx @@ -22,6 +22,7 @@ #include <sfx2/tabdlg.hxx> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/NamedValue.hpp> +#include <svtools/ctrltool.hxx> namespace pcr @@ -36,10 +37,10 @@ namespace pcr virtual ~ControlCharacterDialog() override; /// creates an item set to be used with this dialog - static void createItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults); + static void createItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool, FontList& rFontList); /// destroys an item previously created with <method>createItemSet</method> - static void destroyItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool, std::vector<SfxPoolItem*>*& _rpDefaults); + static void destroyItemSet(std::unique_ptr<SfxItemSet>& _rpSet, rtl::Reference<SfxItemPool>& _rpPool); /// fills the given item set with values obtained from the given property set static void translatePropertiesToItems( @@ -59,7 +60,7 @@ namespace pcr std::vector< css::beans::NamedValue >& _out_properties ); protected: - virtual void PageCreated(const OString& rId, SfxTabPage& rPage) override; + virtual void PageCreated(const OUString& rId, SfxTabPage& rPage) override; }; } // namespace pcr diff --git a/extensions/source/propctrlr/fontitemids.hxx b/extensions/source/propctrlr/fontitemids.hxx deleted file mode 100644 index c9b3a455ffb8..000000000000 --- a/extensions/source/propctrlr/fontitemids.hxx +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#pragma once - -#define CFID_FONT 1 -#define CFID_HEIGHT 2 -#define CFID_WEIGHT 3 -#define CFID_POSTURE 4 -#define CFID_LANGUAGE 5 -#define CFID_UNDERLINE 6 -#define CFID_STRIKEOUT 7 -#define CFID_WORDLINEMODE 8 -#define CFID_CHARCOLOR 9 -#define CFID_RELIEF 10 -#define CFID_EMPHASIS 11 - -#define CFID_CJK_FONT 12 -#define CFID_CJK_HEIGHT 13 -#define CFID_CJK_WEIGHT 14 -#define CFID_CJK_POSTURE 15 -#define CFID_CJK_LANGUAGE 16 -#define CFID_CASEMAP 17 -#define CFID_CONTOUR 18 -#define CFID_SHADOWED 19 - -#define CFID_FONTLIST 20 - -#define CFID_FIRST_ITEM_ID CFID_FONT -#define CFID_LAST_ITEM_ID CFID_FONTLIST - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/formbrowsertools.hxx b/extensions/source/propctrlr/formbrowsertools.hxx index 08d48747ce75..707ae2bc6b02 100644 --- a/extensions/source/propctrlr/formbrowsertools.hxx +++ b/extensions/source/propctrlr/formbrowsertools.hxx @@ -24,6 +24,7 @@ #include <rtl/ustring.hxx> #include <set> +#include <utility> namespace pcr @@ -54,7 +55,7 @@ namespace pcr OUString m_sName; public: - explicit FindPropertyByName( const OUString& _rName ) : m_sName( _rName ) { } + explicit FindPropertyByName( OUString _aName ) : m_sName(std::move( _aName )) { } bool operator()( const css::beans::Property& _rProp ) const { return m_sName == _rProp.Name; diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index 20a21ad8ae72..1b36dd64e387 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -100,9 +100,10 @@ #include <svx/svxids.hrc> #include <vcl/graph.hxx> #include <vcl/unohelp.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <sal/macros.h> #include <sal/log.hxx> +#include <vcl/svapp.hxx> #include <limits> #include <memory> @@ -117,7 +118,6 @@ namespace pcr using namespace lang; using namespace beans; using namespace frame; - using namespace script; using namespace form; using namespace util; using namespace awt; @@ -192,14 +192,14 @@ namespace pcr namespace { - bool lcl_isLanguageDependentProperty( const OUString& aName ) + bool lcl_isLanguageDependentProperty( std::u16string_view aName ) { bool bRet = false; const LanguageDependentProp* pLangDepProp = aLanguageDependentProp; while( pLangDepProp->pPropName != nullptr ) { - if( aName.equalsAsciiL( pLangDepProp->pPropName, pLangDepProp->nPropNameLength )) + if( o3tl::equalsAscii( aName, std::string_view(pLangDepProp->pPropName, pLangDepProp->nPropNameLength) )) { bRet = true; break; @@ -210,7 +210,7 @@ namespace pcr } Reference< resource::XStringResourceResolver > lcl_getStringResourceResolverForProperty - ( const Reference< XPropertySet >& _xComponent, const OUString& _rPropertyName, + ( const Reference< XPropertySet >& _xComponent, std::u16string_view _rPropertyName, const Any& _rPropertyValue ) { Reference< resource::XStringResourceResolver > xRet; @@ -243,6 +243,10 @@ namespace pcr { const PropertyId nPropId( impl_getPropertyId_throwUnknownProperty( _rPropertyName ) ); + // tdf#117159 crash with chart in database report + if (!m_xComponent) + return Any(); + Any aPropertyValue( m_xComponent->getPropertyValue( _rPropertyName ) ); Reference< resource::XStringResourceResolver > xStringResourceResolver @@ -274,7 +278,7 @@ namespace pcr aResolvedStrings.reserve( aStrings.getLength() ); try { - for ( const OUString& rIdStr : std::as_const(aStrings) ) + for (const OUString& rIdStr : aStrings) { OUString aPureIdStr = rIdStr.copy( 1 ); if( xStringResourceResolver->hasEntryForId( aPureIdStr ) ) @@ -318,7 +322,7 @@ namespace pcr if ( PROPERTY_ID_IMAGE_URL == nPropId && ( _rValue >>= xGrfObj ) ) { DBG_ASSERT( xGrfObj.is(), "FormComponentPropertyHandler::setPropertyValue() xGrfObj is invalid"); - m_xComponent->setPropertyValue(PROPERTY_GRAPHIC, uno::makeAny(xGrfObj->getGraphic())); + m_xComponent->setPropertyValue(PROPERTY_GRAPHIC, uno::Any(xGrfObj->getGraphic())); } else if ( PROPERTY_ID_FONT == nPropId ) { @@ -327,7 +331,7 @@ namespace pcr if( ! (_rValue >>= aFontPropertyValues) ) SAL_WARN("extensions.propctrlr", "setPropertyValue: unable to get property " << PROPERTY_ID_FONT); - for ( const NamedValue& fontPropertyValue : std::as_const(aFontPropertyValues) ) + for (const NamedValue& fontPropertyValue : aFontPropertyValues) m_xComponent->setPropertyValue( fontPropertyValue.Name, fontPropertyValue.Value ); } else @@ -440,7 +444,7 @@ namespace pcr aValue <<= aNewIdStrings; // Remove old ids from resource for all locales - for( const OUString& rIdStr : std::as_const(aOldIdStrings) ) + for (const OUString& rIdStr : aOldIdStrings) { OUString aPureIdStr = rIdStr.copy( 1 ); for ( const Locale& rLocale : aLocaleSeq ) @@ -717,7 +721,7 @@ namespace pcr break; } - aControlValue = PropertyHandlerComponent::convertToControlValue( _rPropertyName, makeAny( nNormalized ), _rControlValueType ); + aControlValue = PropertyHandlerComponent::convertToControlValue( _rPropertyName, Any( nNormalized ), _rControlValueType ); } break; @@ -735,8 +739,7 @@ namespace pcr else { // font name - displayName.append( aFont.Name ); - displayName.append( ", " ); + displayName.append( aFont.Name + ", " ); // font style ::FontWeight eWeight = vcl::unohelper::ConvertFontWeight( aFont.Weight ); @@ -758,8 +761,7 @@ namespace pcr // font size if ( aFont.Height ) { - displayName.append( ", " ); - displayName.append( sal_Int32( aFont.Height ) ); + displayName.append( ", " + OUString::number( sal_Int32( aFont.Height ) ) ); } } @@ -877,7 +879,6 @@ namespace pcr Sequence< OUString > SAL_CALL FormComponentPropertyHandler::getActuatingProperties( ) { - ::osl::MutexGuard aGuard( m_aMutex ); return { PROPERTY_DATASOURCE, @@ -999,8 +1000,8 @@ namespace pcr aDescriptor.Control = pControl; aDescriptor.PrimaryButtonId = PROPERTY_ID_TARGET_URL == nPropId - ? OUString(UID_PROP_DLG_ATTR_TARGET_URL) - : OUString(UID_PROP_DLG_IMAGE_URL); + ? UID_PROP_DLG_ATTR_TARGET_URL + : UID_PROP_DLG_IMAGE_URL; break; } @@ -1484,7 +1485,7 @@ namespace pcr OSL_PRECOND( _rxInspectorUI.is(), "lcl_rebuildAndResetCommand: invalid BrowserUI!" ); OSL_PRECOND( _rxHandler.is(), "lcl_rebuildAndResetCommand: invalid handler!" ); _rxInspectorUI->rebuildPropertyUI( PROPERTY_COMMAND ); - _rxHandler->setPropertyValue( PROPERTY_COMMAND, makeAny( OUString() ) ); + _rxHandler->setPropertyValue( PROPERTY_COMMAND, Any( OUString() ) ); } } @@ -1670,7 +1671,7 @@ namespace pcr // ----- TriState ----- case PROPERTY_ID_TRISTATE: if ( !_bFirstTimeInit ) - _rxInspectorUI->rebuildPropertyUI( m_eComponentClass == eFormControl ? OUString(PROPERTY_DEFAULT_STATE) : OUString(PROPERTY_STATE) ); + _rxInspectorUI->rebuildPropertyUI( m_eComponentClass == eFormControl ? PROPERTY_DEFAULT_STATE : PROPERTY_STATE ); break; // case PROPERTY_ID_TRISTATE // ----- DecimalAccuracy ----- @@ -1693,7 +1694,7 @@ namespace pcr } // propagate the changes to the min/max/default fields - OUString aAffectedProps[] = { OUString(PROPERTY_VALUE), OUString(PROPERTY_DEFAULT_VALUE), OUString(PROPERTY_VALUEMIN), OUString(PROPERTY_VALUEMAX) }; + OUString aAffectedProps[] = { PROPERTY_VALUE, PROPERTY_DEFAULT_VALUE, PROPERTY_VALUEMIN, PROPERTY_VALUEMAX }; for (const OUString & aAffectedProp : aAffectedProps) { Reference< XPropertyControl > xControl; @@ -1738,7 +1739,7 @@ namespace pcr // give each control which has to know this an own copy of the description OUString aFormattedPropertyControls[] = { - OUString(PROPERTY_EFFECTIVE_MIN), OUString(PROPERTY_EFFECTIVE_MAX), OUString(PROPERTY_EFFECTIVE_DEFAULT), OUString(PROPERTY_EFFECTIVE_VALUE) + PROPERTY_EFFECTIVE_MIN, PROPERTY_EFFECTIVE_MAX, PROPERTY_EFFECTIVE_DEFAULT, PROPERTY_EFFECTIVE_VALUE }; for (const OUString & aFormattedPropertyControl : aFormattedPropertyControls) { @@ -2269,7 +2270,7 @@ namespace pcr break; case PROPERTY_ID_WRITING_MODE: - if ( !SvtCTLOptions().IsCTLFontEnabled() ) + if ( !SvtCTLOptions::IsCTLFontEnabled() ) return true; break; } @@ -2421,9 +2422,7 @@ namespace pcr if ( aParser.GetProtocol() != INetProtocol::NotValid ) sDataSourceName = aParser.getBase( INetURLObject::LAST_SEGMENT, true, INetURLObject::DecodeMechanism::WithCharset ); OUString sInfo(PcrRes(RID_STR_UNABLETOCONNECT).replaceAll("$name$", sDataSourceName)); - SQLContext aContext; - aContext.Message = sInfo; - aContext.NextException = aError.get(); + SQLContext aContext(sInfo, {}, {}, 0, aError.get(), {}); impl_displaySQLError_nothrow( aContext ); } @@ -2523,13 +2522,12 @@ namespace pcr OUStringBuffer sTemp; if ( bAdd ) { - sTemp.append(_sName); - sTemp.append("/"); + sTemp.append(OUString::Concat(_sName) + "/"); } sTemp.append(rQueryName); Reference< XNameAccess > xSubQueries(_xQueryNames->getByName(rQueryName),UNO_QUERY); if ( xSubQueries.is() ) - impl_fillQueryNames_throw(xSubQueries,_out_rNames,sTemp.makeStringAndClear()); + impl_fillQueryNames_throw(xSubQueries,_out_rNames,sTemp); else _out_rNames.push_back( sTemp.makeStringAndClear() ); } @@ -2629,11 +2627,11 @@ namespace pcr // initialize the dialog Reference< XPropertySet > xDialogProps( xDialog, UNO_QUERY_THROW ); - xDialogProps->setPropertyValue("QueryComposer", makeAny( xComposer ) ); - xDialogProps->setPropertyValue("RowSet", makeAny( m_xComponent ) ); + xDialogProps->setPropertyValue("QueryComposer", Any( xComposer ) ); + xDialogProps->setPropertyValue("RowSet", Any( m_xComponent ) ); if (auto pTopLevel = impl_getDefaultDialogFrame_nothrow()) - xDialogProps->setPropertyValue("ParentWindow", makeAny(pTopLevel->GetXWindow())); - xDialogProps->setPropertyValue("Title", makeAny( sPropertyUIName ) ); + xDialogProps->setPropertyValue("ParentWindow", Any(pTopLevel->GetXWindow())); + xDialogProps->setPropertyValue("Title", Any( sPropertyUIName ) ); _rClearBeforeDialog.clear(); bSuccess = ( xDialog->execute() != 0 ); @@ -2715,18 +2713,15 @@ namespace pcr { const SfxItemSet* pResult = aDialog.GetOutputItemSet(); - const SfxPoolItem* pItem = pResult->GetItem( SID_ATTR_NUMBERFORMAT_INFO ); - const SvxNumberInfoItem* pInfoItem = dynamic_cast< const SvxNumberInfoItem* >( pItem ); - if (pInfoItem) + if (const SvxNumberInfoItem* pInfoItem = pResult->GetItem( SID_ATTR_NUMBERFORMAT_INFO )) { for (sal_uInt32 key : pInfoItem->GetDelFormats()) pFormatter->DeleteEntry(key); } - pItem = nullptr; - if ( SfxItemState::SET == pResult->GetItemState( SID_ATTR_NUMBERFORMAT_VALUE, false, &pItem ) ) + if ( const SfxUInt32Item* pItem = pResult->GetItemIfSet( SID_ATTR_NUMBERFORMAT_VALUE, false ) ) { - _out_rNewValue <<= static_cast<sal_Int32>( static_cast< const SfxUInt32Item* >( pItem )->GetValue() ); + _out_rNewValue <<= static_cast<sal_Int32>( pItem->GetValue() ); bChanged = true; } } @@ -2839,8 +2834,8 @@ namespace pcr // create an item set for use with the dialog std::unique_ptr<SfxItemSet> pSet; rtl::Reference<SfxItemPool> pPool; - std::vector<SfxPoolItem*>* pDefaults = nullptr; - ControlCharacterDialog::createItemSet(pSet, pPool, pDefaults); + FontList aFontList(Application::GetDefaultDevice()); + ControlCharacterDialog::createItemSet(pSet, pPool, aFontList); ControlCharacterDialog::translatePropertiesToItems(m_xComponent, pSet.get()); { // do this in an own block. The dialog needs to be destroyed before we call @@ -2860,7 +2855,7 @@ namespace pcr } } - ControlCharacterDialog::destroyItemSet(pSet, pPool, pDefaults); + ControlCharacterDialog::destroyItemSet(pSet, pPool); return bSuccess; } @@ -3025,23 +3020,23 @@ namespace pcr void FormSQLCommandUI::setSQLCommand( const OUString& _rCommand ) const { - m_xObject->setPropertyValue( PROPERTY_COMMAND, makeAny( _rCommand ) ); + m_xObject->setPropertyValue( PROPERTY_COMMAND, Any( _rCommand ) ); } void FormSQLCommandUI::setEscapeProcessing( const bool _bEscapeProcessing ) const { - m_xObject->setPropertyValue( PROPERTY_ESCAPE_PROCESSING, makeAny( _bEscapeProcessing ) ); + m_xObject->setPropertyValue( PROPERTY_ESCAPE_PROCESSING, Any( _bEscapeProcessing ) ); } OUString* FormSQLCommandUI::getPropertiesToDisable() { static OUString s_aCommandProps[] = { - OUString(PROPERTY_DATASOURCE), - OUString(PROPERTY_COMMAND), - OUString(PROPERTY_COMMANDTYPE), - OUString(PROPERTY_ESCAPE_PROCESSING), + PROPERTY_DATASOURCE, + PROPERTY_COMMAND, + PROPERTY_COMMANDTYPE, + PROPERTY_ESCAPE_PROCESSING, OUString() }; return s_aCommandProps; @@ -3125,7 +3120,7 @@ namespace pcr void ValueListCommandUI::setEscapeProcessing( const bool _bEscapeProcessing ) const { - m_xObject->setPropertyValue( PROPERTY_LISTSOURCETYPE, makeAny( + m_xObject->setPropertyValue( PROPERTY_LISTSOURCETYPE, Any( _bEscapeProcessing ? ListSourceType_SQL : ListSourceType_SQLPASSTHROUGH ) ); } @@ -3133,8 +3128,8 @@ namespace pcr OUString* ValueListCommandUI::getPropertiesToDisable() { static OUString s_aListSourceProps[] = { - OUString(PROPERTY_LISTSOURCETYPE), - OUString(PROPERTY_LISTSOURCE), + PROPERTY_LISTSOURCETYPE, + PROPERTY_LISTSOURCE, OUString() }; return s_aListSourceProps; @@ -3154,7 +3149,7 @@ namespace pcr return true; } m_xCommandDesigner->dispose(); - m_xCommandDesigner.set( nullptr ); + m_xCommandDesigner.clear(); } if ( !impl_ensureRowsetConnection_nothrow() ) diff --git a/extensions/source/propctrlr/formcontroller.cxx b/extensions/source/propctrlr/formcontroller.cxx index 6e94aa0d1eb3..f2daf2dbd329 100644 --- a/extensions/source/propctrlr/formcontroller.cxx +++ b/extensions/source/propctrlr/formcontroller.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/util/VetoException.hpp> #include <cppuhelper/typeprovider.hxx> +#include <utility> namespace pcr @@ -56,12 +57,12 @@ namespace pcr FormController::FormController( const Reference< XComponentContext >& _rxContext, - const OUString& sImplementationName, + OUString sImplementationName, const css::uno::Sequence<OUString>& aSupportedServiceNames, bool _bUseFormFormComponentHandlers ) :OPropertyBrowserController( _rxContext ) ,FormController_PropertyBase1( m_aBHelper ) - ,m_sImplementationName( sImplementationName ) + ,m_sImplementationName(std::move( sImplementationName )) ,m_aSupportedServiceNames( aSupportedServiceNames ) { osl_atomic_increment( &m_refCount ); @@ -130,13 +131,13 @@ namespace pcr Sequence< Property > aProps{ Property( PROPERTY_CURRENTPAGE, - OWN_PROPERTY_ID_CURRENTPAGE, + static_cast<sal_Int32>(OwnPropertyId::CURRENTPAGE), ::cppu::UnoType<OUString>::get(), PropertyAttribute::TRANSIENT ), Property( PROPERTY_INTROSPECTEDOBJECT, - OWN_PROPERTY_ID_INTROSPECTEDOBJECT, + static_cast<sal_Int32>(OwnPropertyId::INTROSPECTEDOBJECT), cppu::UnoType<XPropertySet>::get(), PropertyAttribute::TRANSIENT | PropertyAttribute::CONSTRAINED ) @@ -147,16 +148,18 @@ namespace pcr sal_Bool SAL_CALL FormController::convertFastPropertyValue( Any & rConvertedValue, Any & rOldValue, sal_Int32 nHandle, const Any& rValue ) { - switch ( nHandle ) + switch ( static_cast<OwnPropertyId>(nHandle) ) { - case OWN_PROPERTY_ID_INTROSPECTEDOBJECT: + case OwnPropertyId::INTROSPECTEDOBJECT: if ( rValue.getValueTypeClass() != TypeClass_INTERFACE ) throw IllegalArgumentException(); break; - case OWN_PROPERTY_ID_CURRENTPAGE: + case OwnPropertyId::CURRENTPAGE: if ( rValue.getValueTypeClass() != TypeClass_STRING ) throw IllegalArgumentException(); break; + default: + break; } getFastPropertyValue( rOldValue, nHandle ); @@ -167,9 +170,9 @@ namespace pcr void SAL_CALL FormController::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const Any& _rValue) { - switch ( _nHandle ) + switch ( static_cast<OwnPropertyId>(_nHandle) ) { - case OWN_PROPERTY_ID_INTROSPECTEDOBJECT: + case OwnPropertyId::INTROSPECTEDOBJECT: { Reference< XObjectInspectorModel > xModel( getInspectorModel() ); if ( xModel.is() ) @@ -193,24 +196,28 @@ namespace pcr } } break; - case OWN_PROPERTY_ID_CURRENTPAGE: + case OwnPropertyId::CURRENTPAGE: restoreViewData( _rValue ); break; + default: + break; } } void SAL_CALL FormController::getFastPropertyValue( css::uno::Any& rValue, sal_Int32 nHandle ) const { - switch ( nHandle ) + switch ( static_cast<OwnPropertyId>(nHandle) ) { - case OWN_PROPERTY_ID_INTROSPECTEDOBJECT: + case OwnPropertyId::INTROSPECTEDOBJECT: rValue <<= m_xCurrentInspectee; break; - case OWN_PROPERTY_ID_CURRENTPAGE: + case OwnPropertyId::CURRENTPAGE: rValue = const_cast< FormController* >( this )->getViewData(); break; + default: + break; } } diff --git a/extensions/source/propctrlr/formcontroller.hxx b/extensions/source/propctrlr/formcontroller.hxx index 8c285160e676..f3415057fc80 100644 --- a/extensions/source/propctrlr/formcontroller.hxx +++ b/extensions/source/propctrlr/formcontroller.hxx @@ -52,7 +52,7 @@ namespace pcr public: FormController( const css::uno::Reference< css::uno::XComponentContext >& _rxContext, - const OUString& sImplementName, + OUString sImplementName, const css::uno::Sequence<OUString>& aSupportedServiceNames, bool _bUseFormFormComponentHandlers ); diff --git a/extensions/source/propctrlr/formgeometryhandler.cxx b/extensions/source/propctrlr/formgeometryhandler.cxx index 356a694dc513..b07cd7eb145e 100644 --- a/extensions/source/propctrlr/formgeometryhandler.cxx +++ b/extensions/source/propctrlr/formgeometryhandler.cxx @@ -44,7 +44,8 @@ #include <comphelper/interfacecontainer2.hxx> #include <comphelper/componentbase.hxx> #include <rtl/ref.hxx> -#include <tools/diagnose_ex.h> +#include <utility> +#include <comphelper/diagnose_ex.hxx> namespace pcr { @@ -58,7 +59,6 @@ namespace pcr using ::com::sun::star::uno::Exception; using ::com::sun::star::uno::RuntimeException; using ::com::sun::star::uno::Any; - using ::com::sun::star::uno::makeAny; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::XComponentContext; using ::com::sun::star::beans::Property; @@ -306,7 +306,7 @@ namespace pcr Reference< XMap > xControlMap; Any any = m_xContext->getValueByName( "ControlShapeAccess" ); any >>= xControlMap; - m_xAssociatedShape.set( xControlMap->get( makeAny( xControlModel ) ), UNO_QUERY_THROW ); + m_xAssociatedShape.set( xControlMap->get( Any( xControlModel ) ), UNO_QUERY_THROW ); m_xShapeProperties.set( m_xAssociatedShape, UNO_QUERY_THROW ); } } @@ -640,7 +640,7 @@ namespace pcr continue; sal_Int32 nHeightOrWidth( 0 ); - OSL_VERIFY( xRowOrColumn->getPropertyValue( _bRows ? OUString(PROPERTY_HEIGHT) : OUString(PROPERTY_WIDTH) ) >>= nHeightOrWidth ); + OSL_VERIFY( xRowOrColumn->getPropertyValue( _bRows ? PROPERTY_HEIGHT : PROPERTY_WIDTH ) >>= nHeightOrWidth ); if ( nAccumulated + nHeightOrWidth > rRelativePos ) break; @@ -671,7 +671,7 @@ namespace pcr if ( xSheet.is() ) { css::awt::Point aPreservePosition( m_xAssociatedShape->getPosition() ); - m_xShapeProperties->setPropertyValue( PROPERTY_ANCHOR, makeAny( xSheet ) ); + m_xShapeProperties->setPropertyValue( PROPERTY_ANCHOR, Any( xSheet ) ); m_xAssociatedShape->setPosition( aPreservePosition ); } break; @@ -720,9 +720,9 @@ namespace pcr OUString sPropertyName; Any aNewPropertyValue; - EventTranslation( const OUString& _propertyName, const Any& _newPropertyValue ) - :sPropertyName( _propertyName ) - ,aNewPropertyValue( _newPropertyValue ) + EventTranslation( OUString _propertyName, Any _newPropertyValue ) + :sPropertyName(std::move( _propertyName )) + ,aNewPropertyValue(std::move( _newPropertyValue )) { } }; @@ -739,22 +739,22 @@ namespace pcr if ( _event.PropertyName == "Position" ) { css::awt::Point aPos = m_xShape->getPosition(); - aEventTranslations.push_back( EventTranslation( PROPERTY_POSITIONX, makeAny( aPos.X ) ) ); - aEventTranslations.push_back( EventTranslation( PROPERTY_POSITIONY, makeAny( aPos.Y ) ) ); + aEventTranslations.emplace_back(PROPERTY_POSITIONX, Any( aPos.X )); + aEventTranslations.emplace_back(PROPERTY_POSITIONY, Any( aPos.Y )); } else if ( _event.PropertyName == "Size" ) { css::awt::Size aSize = m_xShape->getSize(); - aEventTranslations.push_back( EventTranslation( PROPERTY_WIDTH, makeAny( aSize.Width ) ) ); - aEventTranslations.push_back( EventTranslation( PROPERTY_HEIGHT, makeAny( aSize.Height ) ) ); + aEventTranslations.emplace_back(PROPERTY_WIDTH, Any( aSize.Width )); + aEventTranslations.emplace_back(PROPERTY_HEIGHT, Any( aSize.Height )); } else if ( _event.PropertyName == PROPERTY_ANCHOR_TYPE ) { - aEventTranslations.push_back( EventTranslation( PROPERTY_TEXT_ANCHOR_TYPE, _event.NewValue ) ); + aEventTranslations.emplace_back(PROPERTY_TEXT_ANCHOR_TYPE, _event.NewValue); } else if ( _event.PropertyName == PROPERTY_ANCHOR ) { - aEventTranslations.push_back( EventTranslation( PROPERTY_SHEET_ANCHOR_TYPE, _event.NewValue ) ); + aEventTranslations.emplace_back(PROPERTY_SHEET_ANCHOR_TYPE, _event.NewValue); } PropertyChangeEvent aTranslatedEvent( _event ); diff --git a/extensions/source/propctrlr/formlinkdialog.cxx b/extensions/source/propctrlr/formlinkdialog.cxx index 7f2d794b4010..605837c5d1b3 100644 --- a/extensions/source/propctrlr/formlinkdialog.cxx +++ b/extensions/source/propctrlr/formlinkdialog.cxx @@ -24,7 +24,8 @@ #include <strings.hrc> #include "formstrings.hxx" #include <sal/log.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> +#include <utility> #include <vcl/svapp.hxx> #include <connectivity/dbtools.hxx> #include <connectivity/dbexception.hxx> @@ -45,7 +46,6 @@ namespace pcr using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; using namespace ::com::sun::star::sdb; using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::sdbcx; @@ -136,14 +136,14 @@ namespace pcr FormLinkDialog::FormLinkDialog(weld::Window* _pParent, const Reference< XPropertySet >& _rxDetailForm, const Reference< XPropertySet >& _rxMasterForm, const Reference< XComponentContext >& _rxContext, const OUString& _sExplanation, - const OUString& _sDetailLabel, - const OUString& _sMasterLabel) + OUString _sDetailLabel, + OUString _sMasterLabel) : GenericDialogController(_pParent, "modules/spropctrlr/ui/formlinksdialog.ui", "FormLinks") , m_xContext ( _rxContext ) , m_xDetailForm( _rxDetailForm ) , m_xMasterForm( _rxMasterForm ) - , m_sDetailLabel(_sDetailLabel) - , m_sMasterLabel(_sMasterLabel) + , m_sDetailLabel(std::move(_sDetailLabel)) + , m_sMasterLabel(std::move(_sMasterLabel)) , m_xExplanation(m_xBuilder->weld_label("explanationLabel")) , m_xDetailLabel(m_xBuilder->weld_label("detailLabel")) , m_xMasterLabel(m_xBuilder->weld_label("masterLabel")) @@ -209,8 +209,8 @@ namespace pcr { if ( m_xDetailForm.is() ) { - m_xDetailForm->setPropertyValue( PROPERTY_DETAILFIELDS, makeAny( Sequence< OUString >( aDetailFields.data(), aDetailFields.size() ) ) ); - m_xDetailForm->setPropertyValue( PROPERTY_MASTERFIELDS, makeAny( Sequence< OUString >( aMasterFields.data(), aMasterFields.size() ) ) ); + m_xDetailForm->setPropertyValue( PROPERTY_DETAILFIELDS, Any( Sequence< OUString >( aDetailFields.data(), aDetailFields.size() ) ) ); + m_xDetailForm->setPropertyValue( PROPERTY_MASTERFIELDS, Any( Sequence< OUString >( aMasterFields.data(), aMasterFields.size() ) ) ); } } catch( const Exception& ) @@ -413,9 +413,7 @@ namespace pcr sErrorMessage = sErrorMessage.replaceFirst("#", sCommand); } - SQLContext aContext; - aContext.Message = sErrorMessage; - aContext.NextException = aErrorInfo.get(); + SQLContext aContext(sErrorMessage, {}, {}, 0, aErrorInfo.get(), {}); ::dbtools::showError(aContext, m_xDialog->GetXWindow(), m_xContext); } diff --git a/extensions/source/propctrlr/formlinkdialog.hxx b/extensions/source/propctrlr/formlinkdialog.hxx index 80cc086cc156..58e9fe27dea0 100644 --- a/extensions/source/propctrlr/formlinkdialog.hxx +++ b/extensions/source/propctrlr/formlinkdialog.hxx @@ -67,8 +67,8 @@ namespace pcr const css::uno::Reference< css::beans::XPropertySet >& _rxMasterForm, const css::uno::Reference< css::uno::XComponentContext >& _rxContext, const OUString& _sExplanation = OUString(), - const OUString& _sDetailLabel = OUString(), - const OUString& _sMasterLabel = OUString() + OUString _sDetailLabel = OUString(), + OUString _sMasterLabel = OUString() ); virtual ~FormLinkDialog() override; diff --git a/extensions/source/propctrlr/formmetadata.cxx b/extensions/source/propctrlr/formmetadata.cxx index 1f51ee3994ed..c6e1e0d6020e 100644 --- a/extensions/source/propctrlr/formmetadata.cxx +++ b/extensions/source/propctrlr/formmetadata.cxx @@ -25,9 +25,10 @@ #include <strings.hrc> #include <stringarrays.hrc> #include <comphelper/extract.hxx> +#include <o3tl/safeint.hxx> #include <osl/diagnose.h> -#include <sal/macros.h> #include <algorithm> +#include <utility> namespace pcr { @@ -46,20 +47,20 @@ namespace pcr sal_uInt32 nUIFlags; OPropertyInfoImpl( - const OUString& rName, + OUString aName, sal_Int32 _nId, - const OUString& aTranslation, + OUString aTranslation, sal_uInt16 nPosId, - const OUString&, + OUString , sal_uInt32 _nUIFlags); }; - OPropertyInfoImpl::OPropertyInfoImpl(const OUString& _rName, sal_Int32 _nId, - const OUString& aString, sal_uInt16 nP, const OUString& sHid, sal_uInt32 _nUIFlags) - :sName(_rName) - ,sTranslation(aString) - ,sHelpId(sHid) + OPropertyInfoImpl::OPropertyInfoImpl(OUString _aName, sal_Int32 _nId, + OUString aString, sal_uInt16 nP, OUString sHid, sal_uInt32 _nUIFlags) + :sName(std::move(_aName)) + ,sTranslation(std::move(aString)) + ,sHelpId(std::move(sHid)) ,nId(_nId) ,nPos(nP) ,nUIFlags(_nUIFlags) @@ -97,7 +98,7 @@ namespace pcr #define DEF_INFO_4( ident, uinameres, pos, helpid, flag1, flag2, flag3, flag4 ) \ DEF_INFO( ident, uinameres, pos, helpid, PROP_FLAG_##flag1 | PROP_FLAG_##flag2 | PROP_FLAG_##flag3 | PROP_FLAG_##flag4 ) - sal_uInt16 OPropertyInfoService::s_nCount = 0; + std::size_t OPropertyInfoService::s_nCount = 0; OPropertyInfoImpl* OPropertyInfoService::s_pPropertyInfos = nullptr; const OPropertyInfoImpl* OPropertyInfoService::getPropertyInfo() @@ -358,7 +359,7 @@ namespace pcr }; s_pPropertyInfos = aPropertyInfos; - s_nCount = SAL_N_ELEMENTS(aPropertyInfos); + s_nCount = std::size(aPropertyInfos); // sort std::sort( s_pPropertyInfos, s_pPropertyInfos + s_nCount, PropertyInfoLessByName() ); @@ -410,131 +411,131 @@ namespace pcr OSL_ENSURE( ( ( getPropertyUIFlags( _nId ) & PROP_FLAG_ENUM ) != 0 ) || ( _nId == PROPERTY_ID_TARGET_FRAME ), "OPropertyInfoService::getPropertyEnumRepresentations: this is no enum property!" ); + if (_nId == PROPERTY_ID_SUBMIT_METHOD) + { + return { "Get", "Post" }; + } const TranslateId* pStringItemsResId = nullptr; - int nElements = 0; + std::size_t nElements = 0; switch ( _nId ) { case PROPERTY_ID_IMAGEPOSITION: pStringItemsResId = RID_RSC_ENUM_IMAGE_POSITION; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_IMAGE_POSITION); + nElements = std::size(RID_RSC_ENUM_IMAGE_POSITION); break; case PROPERTY_ID_BORDER: pStringItemsResId = RID_RSC_ENUM_BORDER_TYPE; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_BORDER_TYPE); + nElements = std::size(RID_RSC_ENUM_BORDER_TYPE); break; case PROPERTY_ID_ICONSIZE: pStringItemsResId = RID_RSC_ENUM_ICONSIZE_TYPE; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_ICONSIZE_TYPE); + nElements = std::size(RID_RSC_ENUM_ICONSIZE_TYPE); break; case PROPERTY_ID_COMMANDTYPE: pStringItemsResId = RID_RSC_ENUM_COMMAND_TYPE; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_COMMAND_TYPE); + nElements = std::size(RID_RSC_ENUM_COMMAND_TYPE); break; case PROPERTY_ID_LISTSOURCETYPE: pStringItemsResId = RID_RSC_ENUM_LISTSOURCE_TYPE; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_LISTSOURCE_TYPE); + nElements = std::size(RID_RSC_ENUM_LISTSOURCE_TYPE); break; case PROPERTY_ID_ALIGN: pStringItemsResId = RID_RSC_ENUM_ALIGNMENT; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_ALIGNMENT); + nElements = std::size(RID_RSC_ENUM_ALIGNMENT); break; case PROPERTY_ID_VERTICAL_ALIGN: pStringItemsResId = RID_RSC_ENUM_VERTICAL_ALIGN; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_VERTICAL_ALIGN); + nElements = std::size(RID_RSC_ENUM_VERTICAL_ALIGN); break; case PROPERTY_ID_BUTTONTYPE: pStringItemsResId = RID_RSC_ENUM_BUTTONTYPE; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_BUTTONTYPE); + nElements = std::size(RID_RSC_ENUM_BUTTONTYPE); break; case PROPERTY_ID_PUSHBUTTONTYPE: pStringItemsResId = RID_RSC_ENUM_PUSHBUTTONTYPE; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_PUSHBUTTONTYPE); - break; - case PROPERTY_ID_SUBMIT_METHOD: - pStringItemsResId = RID_RSC_ENUM_SUBMIT_METHOD; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_SUBMIT_METHOD); + nElements = std::size(RID_RSC_ENUM_PUSHBUTTONTYPE); break; case PROPERTY_ID_SUBMIT_ENCODING: pStringItemsResId = RID_RSC_ENUM_SUBMIT_ENCODING; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_SUBMIT_ENCODING); + nElements = std::size(RID_RSC_ENUM_SUBMIT_ENCODING); break; case PROPERTY_ID_DATEFORMAT: pStringItemsResId = RID_RSC_ENUM_DATEFORMAT_LIST; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_DATEFORMAT_LIST); + nElements = std::size(RID_RSC_ENUM_DATEFORMAT_LIST); break; case PROPERTY_ID_TIMEFORMAT: pStringItemsResId = RID_RSC_ENUM_TIMEFORMAT_LIST; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_TIMEFORMAT_LIST); + nElements = std::size(RID_RSC_ENUM_TIMEFORMAT_LIST); break; case PROPERTY_ID_DEFAULT_STATE: case PROPERTY_ID_STATE: pStringItemsResId = RID_RSC_ENUM_CHECKED; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_CHECKED); + nElements = std::size(RID_RSC_ENUM_CHECKED); break; case PROPERTY_ID_CYCLE: pStringItemsResId = RID_RSC_ENUM_CYCLE; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_CYCLE); + nElements = std::size(RID_RSC_ENUM_CYCLE); break; case PROPERTY_ID_NAVIGATION: pStringItemsResId = RID_RSC_ENUM_NAVIGATION; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_NAVIGATION); + nElements = std::size(RID_RSC_ENUM_NAVIGATION); break; case PROPERTY_ID_TARGET_FRAME: pStringItemsResId = RID_RSC_ENUM_SUBMIT_TARGET; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_SUBMIT_TARGET); + nElements = std::size(RID_RSC_ENUM_SUBMIT_TARGET); break; case PROPERTY_ID_ORIENTATION: pStringItemsResId = RID_RSC_ENUM_ORIENTATION; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_ORIENTATION); + nElements = std::size(RID_RSC_ENUM_ORIENTATION); break; case PROPERTY_ID_CELL_EXCHANGE_TYPE: pStringItemsResId = RID_RSC_ENUM_CELL_EXCHANGE_TYPE; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_CELL_EXCHANGE_TYPE); + nElements = std::size(RID_RSC_ENUM_CELL_EXCHANGE_TYPE); break; case PROPERTY_ID_SHOW_SCROLLBARS: pStringItemsResId = RID_RSC_ENUM_SCROLLBARS; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_SCROLLBARS); + nElements = std::size(RID_RSC_ENUM_SCROLLBARS); break; case PROPERTY_ID_VISUALEFFECT: pStringItemsResId = RID_RSC_ENUM_VISUALEFFECT; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_VISUALEFFECT); + nElements = std::size(RID_RSC_ENUM_VISUALEFFECT); break; case PROPERTY_ID_TEXTTYPE: pStringItemsResId = RID_RSC_ENUM_TEXTTYPE; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_TEXTTYPE); + nElements = std::size(RID_RSC_ENUM_TEXTTYPE); break; case PROPERTY_ID_LINEEND_FORMAT: pStringItemsResId = RID_RSC_ENUM_LINEEND_FORMAT; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_LINEEND_FORMAT); + nElements = std::size(RID_RSC_ENUM_LINEEND_FORMAT); break; case PROPERTY_ID_XSD_WHITESPACES: pStringItemsResId = RID_RSC_ENUM_WHITESPACE_HANDLING; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_WHITESPACE_HANDLING); + nElements = std::size(RID_RSC_ENUM_WHITESPACE_HANDLING); break; case PROPERTY_ID_SELECTION_TYPE: case PROPERTY_ID_SELECTIONMODEL: pStringItemsResId = RID_RSC_ENUM_SELECTION_TYPE; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_SELECTION_TYPE); + nElements = std::size(RID_RSC_ENUM_SELECTION_TYPE); break; case PROPERTY_ID_SCALE_MODE: pStringItemsResId = RID_RSC_ENUM_SCALE_MODE; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_SCALE_MODE); + nElements = std::size(RID_RSC_ENUM_SCALE_MODE); break; case PROPERTY_ID_WRITING_MODE: pStringItemsResId = RID_RSC_ENUM_WRITING_MODE; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_WRITING_MODE); + nElements = std::size(RID_RSC_ENUM_WRITING_MODE); break; case PROPERTY_ID_WHEEL_BEHAVIOR: pStringItemsResId = RID_RSC_ENUM_WHEEL_BEHAVIOR; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_WHEEL_BEHAVIOR); + nElements = std::size(RID_RSC_ENUM_WHEEL_BEHAVIOR); break; case PROPERTY_ID_TEXT_ANCHOR_TYPE: pStringItemsResId = RID_RSC_ENUM_TEXT_ANCHOR_TYPE; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_TEXT_ANCHOR_TYPE); + nElements = std::size(RID_RSC_ENUM_TEXT_ANCHOR_TYPE); break; case PROPERTY_ID_SHEET_ANCHOR_TYPE: pStringItemsResId = RID_RSC_ENUM_SHEET_ANCHOR_TYPE; - nElements = SAL_N_ELEMENTS(RID_RSC_ENUM_SHEET_ANCHOR_TYPE); + nElements = std::size(RID_RSC_ENUM_SHEET_ANCHOR_TYPE); break; default: OSL_FAIL( "OPropertyInfoService::getPropertyEnumRepresentations: unknown enum property!" ); @@ -544,7 +545,7 @@ namespace pcr std::vector< OUString > aReturn; aReturn.reserve(nElements); - for (int i = 0; i < nElements; ++i) + for (std::size_t i = 0; i < nElements; ++i) { aReturn.push_back(PcrRes(pStringItemsResId[i])); } @@ -590,7 +591,7 @@ namespace pcr getPropertyInfo(); // TODO: a real structure which allows quick access by name as well as by id - for (sal_uInt16 i = 0; i < s_nCount; i++) + for (std::size_t i = 0; i < s_nCount; ++i) if (s_pPropertyInfos[i].nId == _nId) return &s_pPropertyInfos[i]; @@ -675,7 +676,7 @@ namespace pcr --nIntValue; std::vector< OUString > aEnumStrings = m_rMetaData.getPropertyEnumRepresentations( m_nPropertyId ); - if ( ( nIntValue >= 0 ) && ( nIntValue < static_cast<sal_Int32>(aEnumStrings.size()) ) ) + if ( ( nIntValue >= 0 ) && ( o3tl::make_unsigned(nIntValue) < aEnumStrings.size() ) ) { sReturn = aEnumStrings[ nIntValue ]; } diff --git a/extensions/source/propctrlr/formmetadata.hxx b/extensions/source/propctrlr/formmetadata.hxx index 0f7aa67d2c59..c2c297740b01 100644 --- a/extensions/source/propctrlr/formmetadata.hxx +++ b/extensions/source/propctrlr/formmetadata.hxx @@ -35,7 +35,7 @@ namespace pcr class OPropertyInfoService final :public IPropertyInfoService { - static sal_uInt16 s_nCount; + static std::size_t s_nCount; static OPropertyInfoImpl* s_pPropertyInfos; // TODO: a real structure which allows quick access by name as well as by id diff --git a/extensions/source/propctrlr/formstrings.hxx b/extensions/source/propctrlr/formstrings.hxx index df151ab950c7..41deed74c8fb 100644 --- a/extensions/source/propctrlr/formstrings.hxx +++ b/extensions/source/propctrlr/formstrings.hxx @@ -21,281 +21,281 @@ #include <rtl/ustring.hxx> -inline constexpr OUStringLiteral PROPERTY_DEFAULTCONTROL = u"DefaultControl"; -inline constexpr OUStringLiteral PROPERTY_INTROSPECTEDOBJECT = u"IntrospectedObject"; -inline constexpr OUStringLiteral PROPERTY_CURRENTPAGE = u"CurrentPage"; -inline constexpr OUStringLiteral PROPERTY_CONTROLCONTEXT = u"ControlContext"; +inline constexpr OUString PROPERTY_DEFAULTCONTROL = u"DefaultControl"_ustr; +inline constexpr OUString PROPERTY_INTROSPECTEDOBJECT = u"IntrospectedObject"_ustr; +inline constexpr OUString PROPERTY_CURRENTPAGE = u"CurrentPage"_ustr; +inline constexpr OUString PROPERTY_CONTROLCONTEXT = u"ControlContext"_ustr; // properties -inline constexpr OUStringLiteral PROPERTY_CLASSID = u"ClassId"; -inline constexpr OUStringLiteral PROPERTY_CONTROLLABEL = u"LabelControl"; -inline constexpr OUStringLiteral PROPERTY_LABEL = u"Label"; -inline constexpr OUStringLiteral PROPERTY_TABINDEX = u"TabIndex"; -inline constexpr OUStringLiteral PROPERTY_WHEEL_BEHAVIOR = u"MouseWheelBehavior"; -inline constexpr OUStringLiteral PROPERTY_TAG = u"Tag"; -inline constexpr OUStringLiteral PROPERTY_NAME = u"Name"; -inline constexpr OUStringLiteral PROPERTY_GROUP_NAME = u"GroupName"; -inline constexpr OUStringLiteral PROPERTY_VALUE = u"Value"; -inline constexpr OUStringLiteral PROPERTY_TEXT = u"Text"; -inline constexpr OUStringLiteral PROPERTY_NAVIGATION = u"NavigationBarMode"; -inline constexpr OUStringLiteral PROPERTY_CYCLE = u"Cycle"; -inline constexpr OUStringLiteral PROPERTY_CONTROLSOURCE = u"DataField"; -inline constexpr OUStringLiteral PROPERTY_INPUT_REQUIRED = u"InputRequired"; -inline constexpr OUStringLiteral PROPERTY_ENABLED = u"Enabled"; -inline constexpr OUStringLiteral PROPERTY_ENABLE_VISIBLE = u"EnableVisible"; -inline constexpr OUStringLiteral PROPERTY_READONLY = u"ReadOnly"; -inline constexpr OUStringLiteral PROPERTY_FILTER = u"Filter"; -inline constexpr OUStringLiteral PROPERTY_WIDTH = u"Width"; -inline constexpr OUStringLiteral PROPERTY_MULTILINE = u"MultiLine"; -inline constexpr OUStringLiteral PROPERTY_WORDBREAK = u"WordBreak"; -inline constexpr OUStringLiteral PROPERTY_TARGET_URL = u"TargetURL"; -inline constexpr OUStringLiteral PROPERTY_TARGET_FRAME = u"TargetFrame"; -inline constexpr OUStringLiteral PROPERTY_MAXTEXTLEN = u"MaxTextLen"; -inline constexpr OUStringLiteral PROPERTY_EDITMASK = u"EditMask"; -inline constexpr OUStringLiteral PROPERTY_SPIN = u"Spin"; -inline constexpr OUStringLiteral PROPERTY_TRISTATE = u"TriState"; -inline constexpr OUStringLiteral PROPERTY_HIDDEN_VALUE = u"HiddenValue"; -inline constexpr OUStringLiteral PROPERTY_BUTTONTYPE = u"ButtonType"; -inline constexpr OUStringLiteral PROPERTY_XFORMS_BUTTONTYPE = u"XFormsButtonType"; -inline constexpr OUStringLiteral PROPERTY_STRINGITEMLIST = u"StringItemList"; -inline constexpr OUStringLiteral PROPERTY_TYPEDITEMLIST = u"TypedItemList"; -inline constexpr OUStringLiteral PROPERTY_DEFAULT_TEXT = u"DefaultText"; -inline constexpr OUStringLiteral PROPERTY_DEFAULT_STATE = u"DefaultState"; -inline constexpr OUStringLiteral PROPERTY_FORMATKEY = u"FormatKey"; -inline constexpr OUStringLiteral PROPERTY_FORMATSSUPPLIER = u"FormatsSupplier"; -inline constexpr OUStringLiteral PROPERTY_SUBMIT_ACTION = u"SubmitAction"; -inline constexpr OUStringLiteral PROPERTY_SUBMIT_TARGET = u"SubmitTarget"; -inline constexpr OUStringLiteral PROPERTY_SUBMIT_METHOD = u"SubmitMethod"; -inline constexpr OUStringLiteral PROPERTY_SUBMIT_ENCODING = u"SubmitEncoding"; -inline constexpr OUStringLiteral PROPERTY_IMAGE_URL = u"ImageURL"; -inline constexpr OUStringLiteral PROPERTY_GRAPHIC = u"Graphic"; -inline constexpr OUStringLiteral PROPERTY_EMPTY_IS_NULL = u"ConvertEmptyToNull"; -inline constexpr OUStringLiteral PROPERTY_LISTSOURCETYPE = u"ListSourceType"; -inline constexpr OUStringLiteral PROPERTY_LISTSOURCE = u"ListSource"; -inline constexpr OUStringLiteral PROPERTY_DEFAULT_SELECT_SEQ = u"DefaultSelection"; -inline constexpr OUStringLiteral PROPERTY_MULTISELECTION = u"MultiSelection"; -inline constexpr OUStringLiteral PROPERTY_ALIGN = u"Align"; -inline constexpr OUStringLiteral PROPERTY_VERTICAL_ALIGN = u"VerticalAlign"; -inline constexpr OUStringLiteral PROPERTY_DEFAULT_DATE = u"DefaultDate"; -inline constexpr OUStringLiteral PROPERTY_DEFAULT_TIME = u"DefaultTime"; -inline constexpr OUStringLiteral PROPERTY_DEFAULT_VALUE = u"DefaultValue"; -inline constexpr OUStringLiteral PROPERTY_DECIMAL_ACCURACY = u"DecimalAccuracy"; -inline constexpr OUStringLiteral PROPERTY_REFVALUE = u"RefValue"; -inline constexpr OUStringLiteral PROPERTY_UNCHECKEDREFVALUE = u"SecondaryRefValue"; -inline constexpr OUStringLiteral PROPERTY_VALUEMIN = u"ValueMin"; -inline constexpr OUStringLiteral PROPERTY_VALUEMAX = u"ValueMax"; -inline constexpr OUStringLiteral PROPERTY_STRICTFORMAT = u"StrictFormat"; -inline constexpr OUStringLiteral PROPERTY_ALLOWADDITIONS = u"AllowInserts"; -inline constexpr OUStringLiteral PROPERTY_ALLOWEDITS = u"AllowUpdates"; -inline constexpr OUStringLiteral PROPERTY_ALLOWDELETIONS = u"AllowDeletes"; -inline constexpr OUStringLiteral PROPERTY_MASTERFIELDS = u"MasterFields"; -inline constexpr OUStringLiteral PROPERTY_LITERALMASK = u"LiteralMask"; -inline constexpr OUStringLiteral PROPERTY_VALUESTEP = u"ValueStep"; -inline constexpr OUStringLiteral PROPERTY_SHOWTHOUSANDSEP = u"ShowThousandsSeparator"; -inline constexpr OUStringLiteral PROPERTY_CURRENCYSYMBOL = u"CurrencySymbol"; -inline constexpr OUStringLiteral PROPERTY_DATEFORMAT = u"DateFormat"; -inline constexpr OUStringLiteral PROPERTY_DATEMIN = u"DateMin"; -inline constexpr OUStringLiteral PROPERTY_DATEMAX = u"DateMax"; -inline constexpr OUStringLiteral PROPERTY_TIMEFORMAT = u"TimeFormat"; -inline constexpr OUStringLiteral PROPERTY_TIMEMIN = u"TimeMin"; -inline constexpr OUStringLiteral PROPERTY_TIMEMAX = u"TimeMax"; -inline constexpr OUStringLiteral PROPERTY_LINECOUNT = u"LineCount"; -inline constexpr OUStringLiteral PROPERTY_BOUNDCOLUMN = u"BoundColumn"; -inline constexpr OUStringLiteral PROPERTY_BACKGROUNDCOLOR = u"BackgroundColor"; -inline constexpr OUStringLiteral PROPERTY_FILLCOLOR = u"FillColor"; -inline constexpr OUStringLiteral PROPERTY_TEXTCOLOR = u"TextColor"; -inline constexpr OUStringLiteral PROPERTY_LINECOLOR = u"LineColor"; -inline constexpr OUStringLiteral PROPERTY_BORDER = u"Border"; -inline constexpr OUStringLiteral PROPERTY_ICONSIZE = u"IconSize"; -inline constexpr OUStringLiteral PROPERTY_DROPDOWN = u"Dropdown"; -inline constexpr OUStringLiteral PROPERTY_HSCROLL = u"HScroll"; -inline constexpr OUStringLiteral PROPERTY_VSCROLL = u"VScroll"; -inline constexpr OUStringLiteral PROPERTY_SHOW_SCROLLBARS = u"ShowScrollbars"; -inline constexpr OUStringLiteral PROPERTY_TABSTOP = u"Tabstop"; -inline constexpr OUStringLiteral PROPERTY_AUTOCOMPLETE = u"Autocomplete"; -inline constexpr OUStringLiteral PROPERTY_PRINTABLE = u"Printable"; -inline constexpr OUStringLiteral PROPERTY_ECHO_CHAR = u"EchoChar"; -inline constexpr OUStringLiteral PROPERTY_ROWHEIGHT = u"RowHeight"; -inline constexpr OUStringLiteral PROPERTY_HELPTEXT = u"HelpText"; -inline constexpr OUStringLiteral PROPERTY_FONT = u"FontDescriptor"; -inline constexpr OUStringLiteral PROPERTY_FONT_NAME = u"FontName"; -inline constexpr OUStringLiteral PROPERTY_FONT_STYLENAME = u"FontStyleName"; -inline constexpr OUStringLiteral PROPERTY_FONT_FAMILY = u"FontFamily"; -inline constexpr OUStringLiteral PROPERTY_FONT_CHARSET = u"FontCharset"; -inline constexpr OUStringLiteral PROPERTY_FONT_HEIGHT = u"FontHeight"; -inline constexpr OUStringLiteral PROPERTY_FONT_WEIGHT = u"FontWeight"; -inline constexpr OUStringLiteral PROPERTY_FONT_SLANT = u"FontSlant"; -inline constexpr OUStringLiteral PROPERTY_FONT_UNDERLINE = u"FontUnderline"; -inline constexpr OUStringLiteral PROPERTY_FONT_STRIKEOUT = u"FontStrikeout"; -inline constexpr OUStringLiteral PROPERTY_FONT_RELIEF = u"FontRelief"; -inline constexpr OUStringLiteral PROPERTY_FONT_EMPHASIS_MARK = u"FontEmphasisMark"; -inline constexpr OUStringLiteral PROPERTY_TEXTLINECOLOR = u"TextLineColor"; -inline constexpr OUStringLiteral PROPERTY_HELPURL = u"HelpURL"; -inline constexpr OUStringLiteral PROPERTY_RECORDMARKER = u"HasRecordMarker"; -inline constexpr OUStringLiteral PROPERTY_EFFECTIVE_DEFAULT = u"EffectiveDefault"; -inline constexpr OUStringLiteral PROPERTY_EFFECTIVE_MIN = u"EffectiveMin"; -inline constexpr OUStringLiteral PROPERTY_EFFECTIVE_MAX = u"EffectiveMax"; -inline constexpr OUStringLiteral PROPERTY_FILTERPROPOSAL = u"UseFilterValueProposal"; -inline constexpr OUStringLiteral PROPERTY_CURRSYM_POSITION = u"PrependCurrencySymbol"; -inline constexpr OUStringLiteral PROPERTY_COMMAND = u"Command"; -inline constexpr OUStringLiteral PROPERTY_COMMANDTYPE = u"CommandType"; -inline constexpr OUStringLiteral PROPERTY_INSERTONLY = u"IgnoreResult"; -inline constexpr OUStringLiteral PROPERTY_ESCAPE_PROCESSING = u"EscapeProcessing"; -inline constexpr OUStringLiteral PROPERTY_TITLE = u"Title"; -inline constexpr OUStringLiteral PROPERTY_SORT = u"Order"; -inline constexpr OUStringLiteral PROPERTY_DATASOURCE = u"DataSourceName"; -inline constexpr OUStringLiteral PROPERTY_DETAILFIELDS = u"DetailFields"; -inline constexpr OUStringLiteral PROPERTY_DEFAULTBUTTON = u"DefaultButton"; -inline constexpr OUStringLiteral PROPERTY_LISTINDEX = u"ListIndex"; -inline constexpr OUStringLiteral PROPERTY_HEIGHT = u"Height"; -inline constexpr OUStringLiteral PROPERTY_HASNAVIGATION = u"HasNavigationBar"; -inline constexpr OUStringLiteral PROPERTY_POSITIONX = u"PositionX"; -inline constexpr OUStringLiteral PROPERTY_POSITIONY = u"PositionY"; -inline constexpr OUStringLiteral PROPERTY_AUTOGROW = u"AutoGrow"; -inline constexpr OUStringLiteral PROPERTY_STEP = u"Step"; -inline constexpr OUStringLiteral PROPERTY_WORDLINEMODE = u"FontWordLineMode"; -inline constexpr OUStringLiteral PROPERTY_PROGRESSVALUE = u"ProgressValue"; -inline constexpr OUStringLiteral PROPERTY_PROGRESSVALUE_MIN = u"ProgressValueMin"; -inline constexpr OUStringLiteral PROPERTY_PROGRESSVALUE_MAX = u"ProgressValueMax"; -inline constexpr OUStringLiteral PROPERTY_SCROLLVALUE = u"ScrollValue"; -inline constexpr OUStringLiteral PROPERTY_DEFAULT_SCROLLVALUE = u"DefaultScrollValue"; -inline constexpr OUStringLiteral PROPERTY_SCROLLVALUE_MIN = u"ScrollValueMin"; -inline constexpr OUStringLiteral PROPERTY_SCROLLVALUE_MAX = u"ScrollValueMax"; -inline constexpr OUStringLiteral PROPERTY_SCROLL_WIDTH = u"ScrollWidth"; -inline constexpr OUStringLiteral PROPERTY_SCROLL_HEIGHT = u"ScrollHeight"; -inline constexpr OUStringLiteral PROPERTY_SCROLL_TOP = u"ScrollTop"; -inline constexpr OUStringLiteral PROPERTY_SCROLL_LEFT = u"ScrollLeft"; -inline constexpr OUStringLiteral PROPERTY_LINEINCREMENT = u"LineIncrement"; -inline constexpr OUStringLiteral PROPERTY_BLOCKINCREMENT = u"BlockIncrement"; -inline constexpr OUStringLiteral PROPERTY_VISIBLESIZE = u"VisibleSize"; -inline constexpr OUStringLiteral PROPERTY_ORIENTATION = u"Orientation"; -inline constexpr OUStringLiteral PROPERTY_IMAGEPOSITION = u"ImagePosition"; -inline constexpr OUStringLiteral PROPERTY_ACTIVE_CONNECTION = u"ActiveConnection"; -inline constexpr OUStringLiteral PROPERTY_ACTIVECOMMAND = u"ActiveCommand"; -inline constexpr OUStringLiteral PROPERTY_DATE = u"Date"; -inline constexpr OUStringLiteral PROPERTY_STATE = u"State"; -inline constexpr OUStringLiteral PROPERTY_TIME = u"Time"; -inline constexpr OUStringLiteral PROPERTY_SCALEIMAGE = u"ScaleImage"; -inline constexpr OUStringLiteral PROPERTY_SCALE_MODE = u"ScaleMode"; -inline constexpr OUStringLiteral PROPERTY_PUSHBUTTONTYPE = u"PushButtonType"; -inline constexpr OUStringLiteral PROPERTY_EFFECTIVE_VALUE = u"EffectiveValue"; -inline constexpr OUStringLiteral PROPERTY_SELECTEDITEMS = u"SelectedItems"; -inline constexpr OUStringLiteral PROPERTY_REPEAT = u"Repeat"; -inline constexpr OUStringLiteral PROPERTY_REPEAT_DELAY = u"RepeatDelay"; -inline constexpr OUStringLiteral PROPERTY_SYMBOLCOLOR = u"SymbolColor"; -inline constexpr OUStringLiteral PROPERTY_SPINVALUE = u"SpinValue"; -inline constexpr OUStringLiteral PROPERTY_SPINVALUE_MIN = u"SpinValueMin"; -inline constexpr OUStringLiteral PROPERTY_SPINVALUE_MAX = u"SpinValueMax"; -inline constexpr OUStringLiteral PROPERTY_DEFAULT_SPINVALUE = u"DefaultSpinValue"; -inline constexpr OUStringLiteral PROPERTY_SPININCREMENT = u"SpinIncrement"; -inline constexpr OUStringLiteral PROPERTY_SHOW_POSITION = u"ShowPosition"; -inline constexpr OUStringLiteral PROPERTY_SHOW_NAVIGATION = u"ShowNavigation"; -inline constexpr OUStringLiteral PROPERTY_SHOW_RECORDACTIONS = u"ShowRecordActions"; -inline constexpr OUStringLiteral PROPERTY_SHOW_FILTERSORT = u"ShowFilterSort"; -inline constexpr OUStringLiteral PROPERTY_LINEEND_FORMAT = u"LineEndFormat"; -inline constexpr OUStringLiteral PROPERTY_DECORATION = u"Decoration"; -inline constexpr OUStringLiteral PROPERTY_NOLABEL = u"NoLabel"; -inline constexpr OUStringLiteral PROPERTY_URL = u"URL"; +inline constexpr OUString PROPERTY_CLASSID = u"ClassId"_ustr; +inline constexpr OUString PROPERTY_CONTROLLABEL = u"LabelControl"_ustr; +inline constexpr OUString PROPERTY_LABEL = u"Label"_ustr; +inline constexpr OUString PROPERTY_TABINDEX = u"TabIndex"_ustr; +inline constexpr OUString PROPERTY_WHEEL_BEHAVIOR = u"MouseWheelBehavior"_ustr; +inline constexpr OUString PROPERTY_TAG = u"Tag"_ustr; +inline constexpr OUString PROPERTY_NAME = u"Name"_ustr; +inline constexpr OUString PROPERTY_GROUP_NAME = u"GroupName"_ustr; +inline constexpr OUString PROPERTY_VALUE = u"Value"_ustr; +inline constexpr OUString PROPERTY_TEXT = u"Text"_ustr; +inline constexpr OUString PROPERTY_NAVIGATION = u"NavigationBarMode"_ustr; +inline constexpr OUString PROPERTY_CYCLE = u"Cycle"_ustr; +inline constexpr OUString PROPERTY_CONTROLSOURCE = u"DataField"_ustr; +inline constexpr OUString PROPERTY_INPUT_REQUIRED = u"InputRequired"_ustr; +inline constexpr OUString PROPERTY_ENABLED = u"Enabled"_ustr; +inline constexpr OUString PROPERTY_ENABLE_VISIBLE = u"EnableVisible"_ustr; +inline constexpr OUString PROPERTY_READONLY = u"ReadOnly"_ustr; +inline constexpr OUString PROPERTY_FILTER = u"Filter"_ustr; +inline constexpr OUString PROPERTY_WIDTH = u"Width"_ustr; +inline constexpr OUString PROPERTY_MULTILINE = u"MultiLine"_ustr; +inline constexpr OUString PROPERTY_WORDBREAK = u"WordBreak"_ustr; +inline constexpr OUString PROPERTY_TARGET_URL = u"TargetURL"_ustr; +inline constexpr OUString PROPERTY_TARGET_FRAME = u"TargetFrame"_ustr; +inline constexpr OUString PROPERTY_MAXTEXTLEN = u"MaxTextLen"_ustr; +inline constexpr OUString PROPERTY_EDITMASK = u"EditMask"_ustr; +inline constexpr OUString PROPERTY_SPIN = u"Spin"_ustr; +inline constexpr OUString PROPERTY_TRISTATE = u"TriState"_ustr; +inline constexpr OUString PROPERTY_HIDDEN_VALUE = u"HiddenValue"_ustr; +inline constexpr OUString PROPERTY_BUTTONTYPE = u"ButtonType"_ustr; +inline constexpr OUString PROPERTY_XFORMS_BUTTONTYPE = u"XFormsButtonType"_ustr; +inline constexpr OUString PROPERTY_STRINGITEMLIST = u"StringItemList"_ustr; +inline constexpr OUString PROPERTY_TYPEDITEMLIST = u"TypedItemList"_ustr; +inline constexpr OUString PROPERTY_DEFAULT_TEXT = u"DefaultText"_ustr; +inline constexpr OUString PROPERTY_DEFAULT_STATE = u"DefaultState"_ustr; +inline constexpr OUString PROPERTY_FORMATKEY = u"FormatKey"_ustr; +inline constexpr OUString PROPERTY_FORMATSSUPPLIER = u"FormatsSupplier"_ustr; +inline constexpr OUString PROPERTY_SUBMIT_ACTION = u"SubmitAction"_ustr; +inline constexpr OUString PROPERTY_SUBMIT_TARGET = u"SubmitTarget"_ustr; +inline constexpr OUString PROPERTY_SUBMIT_METHOD = u"SubmitMethod"_ustr; +inline constexpr OUString PROPERTY_SUBMIT_ENCODING = u"SubmitEncoding"_ustr; +inline constexpr OUString PROPERTY_IMAGE_URL = u"ImageURL"_ustr; +inline constexpr OUString PROPERTY_GRAPHIC = u"Graphic"_ustr; +inline constexpr OUString PROPERTY_EMPTY_IS_NULL = u"ConvertEmptyToNull"_ustr; +inline constexpr OUString PROPERTY_LISTSOURCETYPE = u"ListSourceType"_ustr; +inline constexpr OUString PROPERTY_LISTSOURCE = u"ListSource"_ustr; +inline constexpr OUString PROPERTY_DEFAULT_SELECT_SEQ = u"DefaultSelection"_ustr; +inline constexpr OUString PROPERTY_MULTISELECTION = u"MultiSelection"_ustr; +inline constexpr OUString PROPERTY_ALIGN = u"Align"_ustr; +inline constexpr OUString PROPERTY_VERTICAL_ALIGN = u"VerticalAlign"_ustr; +inline constexpr OUString PROPERTY_DEFAULT_DATE = u"DefaultDate"_ustr; +inline constexpr OUString PROPERTY_DEFAULT_TIME = u"DefaultTime"_ustr; +inline constexpr OUString PROPERTY_DEFAULT_VALUE = u"DefaultValue"_ustr; +inline constexpr OUString PROPERTY_DECIMAL_ACCURACY = u"DecimalAccuracy"_ustr; +inline constexpr OUString PROPERTY_REFVALUE = u"RefValue"_ustr; +inline constexpr OUString PROPERTY_UNCHECKEDREFVALUE = u"SecondaryRefValue"_ustr; +inline constexpr OUString PROPERTY_VALUEMIN = u"ValueMin"_ustr; +inline constexpr OUString PROPERTY_VALUEMAX = u"ValueMax"_ustr; +inline constexpr OUString PROPERTY_STRICTFORMAT = u"StrictFormat"_ustr; +inline constexpr OUString PROPERTY_ALLOWADDITIONS = u"AllowInserts"_ustr; +inline constexpr OUString PROPERTY_ALLOWEDITS = u"AllowUpdates"_ustr; +inline constexpr OUString PROPERTY_ALLOWDELETIONS = u"AllowDeletes"_ustr; +inline constexpr OUString PROPERTY_MASTERFIELDS = u"MasterFields"_ustr; +inline constexpr OUString PROPERTY_LITERALMASK = u"LiteralMask"_ustr; +inline constexpr OUString PROPERTY_VALUESTEP = u"ValueStep"_ustr; +inline constexpr OUString PROPERTY_SHOWTHOUSANDSEP = u"ShowThousandsSeparator"_ustr; +inline constexpr OUString PROPERTY_CURRENCYSYMBOL = u"CurrencySymbol"_ustr; +inline constexpr OUString PROPERTY_DATEFORMAT = u"DateFormat"_ustr; +inline constexpr OUString PROPERTY_DATEMIN = u"DateMin"_ustr; +inline constexpr OUString PROPERTY_DATEMAX = u"DateMax"_ustr; +inline constexpr OUString PROPERTY_TIMEFORMAT = u"TimeFormat"_ustr; +inline constexpr OUString PROPERTY_TIMEMIN = u"TimeMin"_ustr; +inline constexpr OUString PROPERTY_TIMEMAX = u"TimeMax"_ustr; +inline constexpr OUString PROPERTY_LINECOUNT = u"LineCount"_ustr; +inline constexpr OUString PROPERTY_BOUNDCOLUMN = u"BoundColumn"_ustr; +inline constexpr OUString PROPERTY_BACKGROUNDCOLOR = u"BackgroundColor"_ustr; +inline constexpr OUString PROPERTY_FILLCOLOR = u"FillColor"_ustr; +inline constexpr OUString PROPERTY_TEXTCOLOR = u"TextColor"_ustr; +inline constexpr OUString PROPERTY_LINECOLOR = u"LineColor"_ustr; +inline constexpr OUString PROPERTY_BORDER = u"Border"_ustr; +inline constexpr OUString PROPERTY_ICONSIZE = u"IconSize"_ustr; +inline constexpr OUString PROPERTY_DROPDOWN = u"Dropdown"_ustr; +inline constexpr OUString PROPERTY_HSCROLL = u"HScroll"_ustr; +inline constexpr OUString PROPERTY_VSCROLL = u"VScroll"_ustr; +inline constexpr OUString PROPERTY_SHOW_SCROLLBARS = u"ShowScrollbars"_ustr; +inline constexpr OUString PROPERTY_TABSTOP = u"Tabstop"_ustr; +inline constexpr OUString PROPERTY_AUTOCOMPLETE = u"Autocomplete"_ustr; +inline constexpr OUString PROPERTY_PRINTABLE = u"Printable"_ustr; +inline constexpr OUString PROPERTY_ECHO_CHAR = u"EchoChar"_ustr; +inline constexpr OUString PROPERTY_ROWHEIGHT = u"RowHeight"_ustr; +inline constexpr OUString PROPERTY_HELPTEXT = u"HelpText"_ustr; +inline constexpr OUString PROPERTY_FONT = u"FontDescriptor"_ustr; +inline constexpr OUString PROPERTY_FONT_NAME = u"FontName"_ustr; +inline constexpr OUString PROPERTY_FONT_STYLENAME = u"FontStyleName"_ustr; +inline constexpr OUString PROPERTY_FONT_FAMILY = u"FontFamily"_ustr; +inline constexpr OUString PROPERTY_FONT_CHARSET = u"FontCharset"_ustr; +inline constexpr OUString PROPERTY_FONT_HEIGHT = u"FontHeight"_ustr; +inline constexpr OUString PROPERTY_FONT_WEIGHT = u"FontWeight"_ustr; +inline constexpr OUString PROPERTY_FONT_SLANT = u"FontSlant"_ustr; +inline constexpr OUString PROPERTY_FONT_UNDERLINE = u"FontUnderline"_ustr; +inline constexpr OUString PROPERTY_FONT_STRIKEOUT = u"FontStrikeout"_ustr; +inline constexpr OUString PROPERTY_FONT_RELIEF = u"FontRelief"_ustr; +inline constexpr OUString PROPERTY_FONT_EMPHASIS_MARK = u"FontEmphasisMark"_ustr; +inline constexpr OUString PROPERTY_TEXTLINECOLOR = u"TextLineColor"_ustr; +inline constexpr OUString PROPERTY_HELPURL = u"HelpURL"_ustr; +inline constexpr OUString PROPERTY_RECORDMARKER = u"HasRecordMarker"_ustr; +inline constexpr OUString PROPERTY_EFFECTIVE_DEFAULT = u"EffectiveDefault"_ustr; +inline constexpr OUString PROPERTY_EFFECTIVE_MIN = u"EffectiveMin"_ustr; +inline constexpr OUString PROPERTY_EFFECTIVE_MAX = u"EffectiveMax"_ustr; +inline constexpr OUString PROPERTY_FILTERPROPOSAL = u"UseFilterValueProposal"_ustr; +inline constexpr OUString PROPERTY_CURRSYM_POSITION = u"PrependCurrencySymbol"_ustr; +inline constexpr OUString PROPERTY_COMMAND = u"Command"_ustr; +inline constexpr OUString PROPERTY_COMMANDTYPE = u"CommandType"_ustr; +inline constexpr OUString PROPERTY_INSERTONLY = u"IgnoreResult"_ustr; +inline constexpr OUString PROPERTY_ESCAPE_PROCESSING = u"EscapeProcessing"_ustr; +inline constexpr OUString PROPERTY_TITLE = u"Title"_ustr; +inline constexpr OUString PROPERTY_SORT = u"Order"_ustr; +inline constexpr OUString PROPERTY_DATASOURCE = u"DataSourceName"_ustr; +inline constexpr OUString PROPERTY_DETAILFIELDS = u"DetailFields"_ustr; +inline constexpr OUString PROPERTY_DEFAULTBUTTON = u"DefaultButton"_ustr; +inline constexpr OUString PROPERTY_LISTINDEX = u"ListIndex"_ustr; +inline constexpr OUString PROPERTY_HEIGHT = u"Height"_ustr; +inline constexpr OUString PROPERTY_HASNAVIGATION = u"HasNavigationBar"_ustr; +inline constexpr OUString PROPERTY_POSITIONX = u"PositionX"_ustr; +inline constexpr OUString PROPERTY_POSITIONY = u"PositionY"_ustr; +inline constexpr OUString PROPERTY_AUTOGROW = u"AutoGrow"_ustr; +inline constexpr OUString PROPERTY_STEP = u"Step"_ustr; +inline constexpr OUString PROPERTY_WORDLINEMODE = u"FontWordLineMode"_ustr; +inline constexpr OUString PROPERTY_PROGRESSVALUE = u"ProgressValue"_ustr; +inline constexpr OUString PROPERTY_PROGRESSVALUE_MIN = u"ProgressValueMin"_ustr; +inline constexpr OUString PROPERTY_PROGRESSVALUE_MAX = u"ProgressValueMax"_ustr; +inline constexpr OUString PROPERTY_SCROLLVALUE = u"ScrollValue"_ustr; +inline constexpr OUString PROPERTY_DEFAULT_SCROLLVALUE = u"DefaultScrollValue"_ustr; +inline constexpr OUString PROPERTY_SCROLLVALUE_MIN = u"ScrollValueMin"_ustr; +inline constexpr OUString PROPERTY_SCROLLVALUE_MAX = u"ScrollValueMax"_ustr; +inline constexpr OUString PROPERTY_SCROLL_WIDTH = u"ScrollWidth"_ustr; +inline constexpr OUString PROPERTY_SCROLL_HEIGHT = u"ScrollHeight"_ustr; +inline constexpr OUString PROPERTY_SCROLL_TOP = u"ScrollTop"_ustr; +inline constexpr OUString PROPERTY_SCROLL_LEFT = u"ScrollLeft"_ustr; +inline constexpr OUString PROPERTY_LINEINCREMENT = u"LineIncrement"_ustr; +inline constexpr OUString PROPERTY_BLOCKINCREMENT = u"BlockIncrement"_ustr; +inline constexpr OUString PROPERTY_VISIBLESIZE = u"VisibleSize"_ustr; +inline constexpr OUString PROPERTY_ORIENTATION = u"Orientation"_ustr; +inline constexpr OUString PROPERTY_IMAGEPOSITION = u"ImagePosition"_ustr; +inline constexpr OUString PROPERTY_ACTIVE_CONNECTION = u"ActiveConnection"_ustr; +inline constexpr OUString PROPERTY_ACTIVECOMMAND = u"ActiveCommand"_ustr; +inline constexpr OUString PROPERTY_DATE = u"Date"_ustr; +inline constexpr OUString PROPERTY_STATE = u"State"_ustr; +inline constexpr OUString PROPERTY_TIME = u"Time"_ustr; +inline constexpr OUString PROPERTY_SCALEIMAGE = u"ScaleImage"_ustr; +inline constexpr OUString PROPERTY_SCALE_MODE = u"ScaleMode"_ustr; +inline constexpr OUString PROPERTY_PUSHBUTTONTYPE = u"PushButtonType"_ustr; +inline constexpr OUString PROPERTY_EFFECTIVE_VALUE = u"EffectiveValue"_ustr; +inline constexpr OUString PROPERTY_SELECTEDITEMS = u"SelectedItems"_ustr; +inline constexpr OUString PROPERTY_REPEAT = u"Repeat"_ustr; +inline constexpr OUString PROPERTY_REPEAT_DELAY = u"RepeatDelay"_ustr; +inline constexpr OUString PROPERTY_SYMBOLCOLOR = u"SymbolColor"_ustr; +inline constexpr OUString PROPERTY_SPINVALUE = u"SpinValue"_ustr; +inline constexpr OUString PROPERTY_SPINVALUE_MIN = u"SpinValueMin"_ustr; +inline constexpr OUString PROPERTY_SPINVALUE_MAX = u"SpinValueMax"_ustr; +inline constexpr OUString PROPERTY_DEFAULT_SPINVALUE = u"DefaultSpinValue"_ustr; +inline constexpr OUString PROPERTY_SPININCREMENT = u"SpinIncrement"_ustr; +inline constexpr OUString PROPERTY_SHOW_POSITION = u"ShowPosition"_ustr; +inline constexpr OUString PROPERTY_SHOW_NAVIGATION = u"ShowNavigation"_ustr; +inline constexpr OUString PROPERTY_SHOW_RECORDACTIONS = u"ShowRecordActions"_ustr; +inline constexpr OUString PROPERTY_SHOW_FILTERSORT = u"ShowFilterSort"_ustr; +inline constexpr OUString PROPERTY_LINEEND_FORMAT = u"LineEndFormat"_ustr; +inline constexpr OUString PROPERTY_DECORATION = u"Decoration"_ustr; +inline constexpr OUString PROPERTY_NOLABEL = u"NoLabel"_ustr; +inline constexpr OUString PROPERTY_URL = u"URL"_ustr; -inline constexpr OUStringLiteral PROPERTY_SELECTION_TYPE = u"SelectionType"; -inline constexpr OUStringLiteral PROPERTY_ROOT_DISPLAYED = u"RootDisplayed"; -inline constexpr OUStringLiteral PROPERTY_SHOWS_HANDLES = u"ShowsHandles"; -inline constexpr OUStringLiteral PROPERTY_SHOWS_ROOT_HANDLES = u"ShowsRootHandles"; -inline constexpr OUStringLiteral PROPERTY_EDITABLE = u"Editable"; -inline constexpr OUStringLiteral PROPERTY_INVOKES_STOP_NOT_EDITING = u"InvokesStopNodeEditing"; +inline constexpr OUString PROPERTY_SELECTION_TYPE = u"SelectionType"_ustr; +inline constexpr OUString PROPERTY_ROOT_DISPLAYED = u"RootDisplayed"_ustr; +inline constexpr OUString PROPERTY_SHOWS_HANDLES = u"ShowsHandles"_ustr; +inline constexpr OUString PROPERTY_SHOWS_ROOT_HANDLES = u"ShowsRootHandles"_ustr; +inline constexpr OUString PROPERTY_EDITABLE = u"Editable"_ustr; +inline constexpr OUString PROPERTY_INVOKES_STOP_NOT_EDITING = u"InvokesStopNodeEditing"_ustr; -inline constexpr OUStringLiteral PROPERTY_TOGGLE = u"Toggle"; -inline constexpr OUStringLiteral PROPERTY_FOCUSONCLICK = u"FocusOnClick"; -inline constexpr OUStringLiteral PROPERTY_HIDEINACTIVESELECTION = u"HideInactiveSelection"; -inline constexpr OUStringLiteral PROPERTY_VISUALEFFECT = u"VisualEffect"; -inline constexpr OUStringLiteral PROPERTY_BORDERCOLOR = u"BorderColor"; +inline constexpr OUString PROPERTY_TOGGLE = u"Toggle"_ustr; +inline constexpr OUString PROPERTY_FOCUSONCLICK = u"FocusOnClick"_ustr; +inline constexpr OUString PROPERTY_HIDEINACTIVESELECTION = u"HideInactiveSelection"_ustr; +inline constexpr OUString PROPERTY_VISUALEFFECT = u"VisualEffect"_ustr; +inline constexpr OUString PROPERTY_BORDERCOLOR = u"BorderColor"_ustr; -inline constexpr OUStringLiteral PROPERTY_ADDRESS = u"Address"; -inline constexpr OUStringLiteral PROPERTY_REFERENCE_SHEET = u"ReferenceSheet"; -inline constexpr OUStringLiteral PROPERTY_UI_REPRESENTATION = u"UserInterfaceRepresentation"; +inline constexpr OUString PROPERTY_ADDRESS = u"Address"_ustr; +inline constexpr OUString PROPERTY_REFERENCE_SHEET = u"ReferenceSheet"_ustr; +inline constexpr OUString PROPERTY_UI_REPRESENTATION = u"UserInterfaceRepresentation"_ustr; -inline constexpr OUStringLiteral PROPERTY_XML_DATA_MODEL = u"XMLDataModel"; -inline constexpr OUStringLiteral PROPERTY_BINDING_NAME = u"BindingName"; -inline constexpr OUStringLiteral PROPERTY_BIND_EXPRESSION = u"BindingExpression"; -inline constexpr OUStringLiteral PROPERTY_LIST_BINDING = u"ListBinding"; -inline constexpr OUStringLiteral PROPERTY_XSD_REQUIRED = u"RequiredExpression"; -inline constexpr OUStringLiteral PROPERTY_XSD_RELEVANT = u"RelevantExpression"; -inline constexpr OUStringLiteral PROPERTY_XSD_READONLY = u"ReadonlyExpression"; -inline constexpr OUStringLiteral PROPERTY_XSD_CONSTRAINT = u"ConstraintExpression"; -inline constexpr OUStringLiteral PROPERTY_XSD_CALCULATION = u"CalculateExpression"; -inline constexpr OUStringLiteral PROPERTY_XSD_DATA_TYPE = u"Type"; -inline constexpr OUStringLiteral PROPERTY_XSD_WHITESPACES = u"WhiteSpace"; -inline constexpr OUStringLiteral PROPERTY_XSD_PATTERN = u"Pattern"; -inline constexpr OUStringLiteral PROPERTY_XSD_LENGTH = u"Length"; -inline constexpr OUStringLiteral PROPERTY_XSD_MIN_LENGTH = u"MinLength"; -inline constexpr OUStringLiteral PROPERTY_XSD_MAX_LENGTH = u"MaxLength"; -inline constexpr OUStringLiteral PROPERTY_XSD_TOTAL_DIGITS = u"TotalDigits"; -inline constexpr OUStringLiteral PROPERTY_XSD_FRACTION_DIGITS = u"FractionDigits"; -inline constexpr OUStringLiteral PROPERTY_XSD_MAX_INCLUSIVE_INT = u"MaxInclusiveInt"; -inline constexpr OUStringLiteral PROPERTY_XSD_MAX_EXCLUSIVE_INT = u"MaxExclusiveInt"; -inline constexpr OUStringLiteral PROPERTY_XSD_MIN_INCLUSIVE_INT = u"MinInclusiveInt"; -inline constexpr OUStringLiteral PROPERTY_XSD_MIN_EXCLUSIVE_INT = u"MinExclusiveInt"; -inline constexpr OUStringLiteral PROPERTY_XSD_MAX_INCLUSIVE_DOUBLE = u"MaxInclusiveDouble"; -inline constexpr OUStringLiteral PROPERTY_XSD_MAX_EXCLUSIVE_DOUBLE = u"MaxExclusiveDouble"; -inline constexpr OUStringLiteral PROPERTY_XSD_MIN_INCLUSIVE_DOUBLE = u"MinInclusiveDouble"; -inline constexpr OUStringLiteral PROPERTY_XSD_MIN_EXCLUSIVE_DOUBLE = u"MinExclusiveDouble"; -inline constexpr OUStringLiteral PROPERTY_XSD_MAX_INCLUSIVE_DATE = u"MaxInclusiveDate"; -inline constexpr OUStringLiteral PROPERTY_XSD_MAX_EXCLUSIVE_DATE = u"MaxExclusiveDate"; -inline constexpr OUStringLiteral PROPERTY_XSD_MIN_INCLUSIVE_DATE = u"MinInclusiveDate"; -inline constexpr OUStringLiteral PROPERTY_XSD_MIN_EXCLUSIVE_DATE = u"MinExclusiveDate"; -inline constexpr OUStringLiteral PROPERTY_XSD_MAX_INCLUSIVE_TIME = u"MaxInclusiveTime"; -inline constexpr OUStringLiteral PROPERTY_XSD_MAX_EXCLUSIVE_TIME = u"MaxExclusiveTime"; -inline constexpr OUStringLiteral PROPERTY_XSD_MIN_INCLUSIVE_TIME = u"MinInclusiveTime"; -inline constexpr OUStringLiteral PROPERTY_XSD_MIN_EXCLUSIVE_TIME = u"MinExclusiveTime"; -inline constexpr OUStringLiteral PROPERTY_XSD_MAX_INCLUSIVE_DATE_TIME = u"MaxInclusiveDateTime"; -inline constexpr OUStringLiteral PROPERTY_XSD_MAX_EXCLUSIVE_DATE_TIME = u"MaxExclusiveDateTime"; -inline constexpr OUStringLiteral PROPERTY_XSD_MIN_INCLUSIVE_DATE_TIME = u"MinInclusiveDateTime"; -inline constexpr OUStringLiteral PROPERTY_XSD_MIN_EXCLUSIVE_DATE_TIME = u"MinExclusiveDateTime"; -inline constexpr OUStringLiteral PROPERTY_SUBMISSION_ID = u"SubmissionID"; -inline constexpr OUStringLiteral PROPERTY_BINDING_ID = u"BindingID"; -inline constexpr OUStringLiteral PROPERTY_WRITING_MODE = u"WritingMode"; -inline constexpr OUStringLiteral PROPERTY_TEXT_ANCHOR_TYPE = u"TextAnchorType"; -inline constexpr OUStringLiteral PROPERTY_SHEET_ANCHOR_TYPE = u"SheetAnchorType"; -inline constexpr OUStringLiteral PROPERTY_ANCHOR_TYPE = u"AnchorType"; -inline constexpr OUStringLiteral PROPERTY_ANCHOR = u"Anchor"; -inline constexpr OUStringLiteral PROPERTY_IS_VISIBLE = u"IsVisible"; +inline constexpr OUString PROPERTY_XML_DATA_MODEL = u"XMLDataModel"_ustr; +inline constexpr OUString PROPERTY_BINDING_NAME = u"BindingName"_ustr; +inline constexpr OUString PROPERTY_BIND_EXPRESSION = u"BindingExpression"_ustr; +inline constexpr OUString PROPERTY_LIST_BINDING = u"ListBinding"_ustr; +inline constexpr OUString PROPERTY_XSD_REQUIRED = u"RequiredExpression"_ustr; +inline constexpr OUString PROPERTY_XSD_RELEVANT = u"RelevantExpression"_ustr; +inline constexpr OUString PROPERTY_XSD_READONLY = u"ReadonlyExpression"_ustr; +inline constexpr OUString PROPERTY_XSD_CONSTRAINT = u"ConstraintExpression"_ustr; +inline constexpr OUString PROPERTY_XSD_CALCULATION = u"CalculateExpression"_ustr; +inline constexpr OUString PROPERTY_XSD_DATA_TYPE = u"Type"_ustr; +inline constexpr OUString PROPERTY_XSD_WHITESPACES = u"WhiteSpace"_ustr; +inline constexpr OUString PROPERTY_XSD_PATTERN = u"Pattern"_ustr; +inline constexpr OUString PROPERTY_XSD_LENGTH = u"Length"_ustr; +inline constexpr OUString PROPERTY_XSD_MIN_LENGTH = u"MinLength"_ustr; +inline constexpr OUString PROPERTY_XSD_MAX_LENGTH = u"MaxLength"_ustr; +inline constexpr OUString PROPERTY_XSD_TOTAL_DIGITS = u"TotalDigits"_ustr; +inline constexpr OUString PROPERTY_XSD_FRACTION_DIGITS = u"FractionDigits"_ustr; +inline constexpr OUString PROPERTY_XSD_MAX_INCLUSIVE_INT = u"MaxInclusiveInt"_ustr; +inline constexpr OUString PROPERTY_XSD_MAX_EXCLUSIVE_INT = u"MaxExclusiveInt"_ustr; +inline constexpr OUString PROPERTY_XSD_MIN_INCLUSIVE_INT = u"MinInclusiveInt"_ustr; +inline constexpr OUString PROPERTY_XSD_MIN_EXCLUSIVE_INT = u"MinExclusiveInt"_ustr; +inline constexpr OUString PROPERTY_XSD_MAX_INCLUSIVE_DOUBLE = u"MaxInclusiveDouble"_ustr; +inline constexpr OUString PROPERTY_XSD_MAX_EXCLUSIVE_DOUBLE = u"MaxExclusiveDouble"_ustr; +inline constexpr OUString PROPERTY_XSD_MIN_INCLUSIVE_DOUBLE = u"MinInclusiveDouble"_ustr; +inline constexpr OUString PROPERTY_XSD_MIN_EXCLUSIVE_DOUBLE = u"MinExclusiveDouble"_ustr; +inline constexpr OUString PROPERTY_XSD_MAX_INCLUSIVE_DATE = u"MaxInclusiveDate"_ustr; +inline constexpr OUString PROPERTY_XSD_MAX_EXCLUSIVE_DATE = u"MaxExclusiveDate"_ustr; +inline constexpr OUString PROPERTY_XSD_MIN_INCLUSIVE_DATE = u"MinInclusiveDate"_ustr; +inline constexpr OUString PROPERTY_XSD_MIN_EXCLUSIVE_DATE = u"MinExclusiveDate"_ustr; +inline constexpr OUString PROPERTY_XSD_MAX_INCLUSIVE_TIME = u"MaxInclusiveTime"_ustr; +inline constexpr OUString PROPERTY_XSD_MAX_EXCLUSIVE_TIME = u"MaxExclusiveTime"_ustr; +inline constexpr OUString PROPERTY_XSD_MIN_INCLUSIVE_TIME = u"MinInclusiveTime"_ustr; +inline constexpr OUString PROPERTY_XSD_MIN_EXCLUSIVE_TIME = u"MinExclusiveTime"_ustr; +inline constexpr OUString PROPERTY_XSD_MAX_INCLUSIVE_DATE_TIME = u"MaxInclusiveDateTime"_ustr; +inline constexpr OUString PROPERTY_XSD_MAX_EXCLUSIVE_DATE_TIME = u"MaxExclusiveDateTime"_ustr; +inline constexpr OUString PROPERTY_XSD_MIN_INCLUSIVE_DATE_TIME = u"MinInclusiveDateTime"_ustr; +inline constexpr OUString PROPERTY_XSD_MIN_EXCLUSIVE_DATE_TIME = u"MinExclusiveDateTime"_ustr; +inline constexpr OUString PROPERTY_SUBMISSION_ID = u"SubmissionID"_ustr; +inline constexpr OUString PROPERTY_BINDING_ID = u"BindingID"_ustr; +inline constexpr OUString PROPERTY_WRITING_MODE = u"WritingMode"_ustr; +inline constexpr OUString PROPERTY_TEXT_ANCHOR_TYPE = u"TextAnchorType"_ustr; +inline constexpr OUString PROPERTY_SHEET_ANCHOR_TYPE = u"SheetAnchorType"_ustr; +inline constexpr OUString PROPERTY_ANCHOR_TYPE = u"AnchorType"_ustr; +inline constexpr OUString PROPERTY_ANCHOR = u"Anchor"_ustr; +inline constexpr OUString PROPERTY_IS_VISIBLE = u"IsVisible"_ustr; -inline constexpr OUStringLiteral PROPERTY_MODEL = u"Model"; +inline constexpr OUString PROPERTY_MODEL = u"Model"_ustr; -inline constexpr OUStringLiteral PROPERTY_CELL_EXCHANGE_TYPE = u"ExchangeSelectionIndex"; -inline constexpr OUStringLiteral PROPERTY_BOUND_CELL = u"BoundCell"; -inline constexpr OUStringLiteral PROPERTY_LIST_CELL_RANGE = u"CellRange"; -inline constexpr OUStringLiteral PROPERTY_TEXTTYPE = u"TextType"; -inline constexpr OUStringLiteral PROPERTY_RICHTEXT = u"RichText"; -inline constexpr OUStringLiteral PROPERTY_ROWSET = u"RowSet"; -inline constexpr OUStringLiteral PROPERTY_SELECTIONMODEL = u"SelectionModel"; -inline constexpr OUStringLiteral PROPERTY_USEGRIDLINE = u"UseGridLines"; -inline constexpr OUStringLiteral PROPERTY_GRIDLINECOLOR = u"GridLineColor"; -inline constexpr OUStringLiteral PROPERTY_SHOWCOLUMNHEADER = u"ShowColumnHeader"; -inline constexpr OUStringLiteral PROPERTY_SHOWROWHEADER = u"ShowRowHeader"; -inline constexpr OUStringLiteral PROPERTY_HEADERBACKGROUNDCOLOR = u"HeaderBackgroundColor"; -inline constexpr OUStringLiteral PROPERTY_HEADERTEXTCOLOR = u"HeaderTextColor"; -inline constexpr OUStringLiteral PROPERTY_ACTIVESELECTIONBACKGROUNDCOLOR = u"ActiveSelectionBackgroundColor"; -inline constexpr OUStringLiteral PROPERTY_ACTIVESELECTIONTEXTCOLOR = u"ActiveSelectionTextColor"; -inline constexpr OUStringLiteral PROPERTY_INACTIVESELECTIONBACKGROUNDCOLOR = u"InactiveSelectionBackgroundColor"; -inline constexpr OUStringLiteral PROPERTY_INACTIVESELECTIONTEXTCOLOR = u"InactiveSelectionTextColor"; +inline constexpr OUString PROPERTY_CELL_EXCHANGE_TYPE = u"ExchangeSelectionIndex"_ustr; +inline constexpr OUString PROPERTY_BOUND_CELL = u"BoundCell"_ustr; +inline constexpr OUString PROPERTY_LIST_CELL_RANGE = u"CellRange"_ustr; +inline constexpr OUString PROPERTY_TEXTTYPE = u"TextType"_ustr; +inline constexpr OUString PROPERTY_RICHTEXT = u"RichText"_ustr; +inline constexpr OUString PROPERTY_ROWSET = u"RowSet"_ustr; +inline constexpr OUString PROPERTY_SELECTIONMODEL = u"SelectionModel"_ustr; +inline constexpr OUString PROPERTY_USEGRIDLINE = u"UseGridLines"_ustr; +inline constexpr OUString PROPERTY_GRIDLINECOLOR = u"GridLineColor"_ustr; +inline constexpr OUString PROPERTY_SHOWCOLUMNHEADER = u"ShowColumnHeader"_ustr; +inline constexpr OUString PROPERTY_SHOWROWHEADER = u"ShowRowHeader"_ustr; +inline constexpr OUString PROPERTY_HEADERBACKGROUNDCOLOR = u"HeaderBackgroundColor"_ustr; +inline constexpr OUString PROPERTY_HEADERTEXTCOLOR = u"HeaderTextColor"_ustr; +inline constexpr OUString PROPERTY_ACTIVESELECTIONBACKGROUNDCOLOR = u"ActiveSelectionBackgroundColor"_ustr; +inline constexpr OUString PROPERTY_ACTIVESELECTIONTEXTCOLOR = u"ActiveSelectionTextColor"_ustr; +inline constexpr OUString PROPERTY_INACTIVESELECTIONBACKGROUNDCOLOR = u"InactiveSelectionBackgroundColor"_ustr; +inline constexpr OUString PROPERTY_INACTIVESELECTIONTEXTCOLOR = u"InactiveSelectionTextColor"_ustr; // services -inline constexpr OUStringLiteral SERVICE_COMPONENT_GROUPBOX = u"com.sun.star.form.component.GroupBox"; -inline constexpr OUStringLiteral SERVICE_COMPONENT_FIXEDTEXT = u"com.sun.star.form.component.FixedText"; -inline constexpr OUStringLiteral SERVICE_COMPONENT_FORMATTEDFIELD = u"com.sun.star.form.component.FormattedField"; +inline constexpr OUString SERVICE_COMPONENT_GROUPBOX = u"com.sun.star.form.component.GroupBox"_ustr; +inline constexpr OUString SERVICE_COMPONENT_FIXEDTEXT = u"com.sun.star.form.component.FixedText"_ustr; +inline constexpr OUString SERVICE_COMPONENT_FORMATTEDFIELD = u"com.sun.star.form.component.FormattedField"_ustr; -inline constexpr OUStringLiteral SERVICE_TEXT_DOCUMENT = u"com.sun.star.text.TextDocument"; -inline constexpr OUStringLiteral SERVICE_WEB_DOCUMENT = u"com.sun.star.text.WebDocument"; -inline constexpr OUStringLiteral SERVICE_SPREADSHEET_DOCUMENT = u"com.sun.star.sheet.SpreadsheetDocument"; -inline constexpr OUStringLiteral SERVICE_DRAWING_DOCUMENT = u"com.sun.star.drawing.DrawingDocument"; -inline constexpr OUStringLiteral SERVICE_PRESENTATION_DOCUMENT = u"com.sun.star.presentation.PresentationDocument"; +inline constexpr OUString SERVICE_TEXT_DOCUMENT = u"com.sun.star.text.TextDocument"_ustr; +inline constexpr OUString SERVICE_WEB_DOCUMENT = u"com.sun.star.text.WebDocument"_ustr; +inline constexpr OUString SERVICE_SPREADSHEET_DOCUMENT = u"com.sun.star.sheet.SpreadsheetDocument"_ustr; +inline constexpr OUString SERVICE_DRAWING_DOCUMENT = u"com.sun.star.drawing.DrawingDocument"_ustr; +inline constexpr OUString SERVICE_PRESENTATION_DOCUMENT = u"com.sun.star.presentation.PresentationDocument"_ustr; -inline constexpr OUStringLiteral SERVICE_SHEET_CELL_BINDING = u"com.sun.star.table.CellValueBinding"; -inline constexpr OUStringLiteral SERVICE_SHEET_CELL_INT_BINDING = u"com.sun.star.table.ListPositionCellBinding"; -inline constexpr OUStringLiteral SERVICE_SHEET_CELLRANGE_LISTSOURCE = u"com.sun.star.table.CellRangeListSource"; -inline constexpr OUStringLiteral SERVICE_ADDRESS_CONVERSION = u"com.sun.star.table.CellAddressConversion"; -inline constexpr OUStringLiteral SERVICE_RANGEADDRESS_CONVERSION = u"com.sun.star.table.CellRangeAddressConversion"; +inline constexpr OUString SERVICE_SHEET_CELL_BINDING = u"com.sun.star.table.CellValueBinding"_ustr; +inline constexpr OUString SERVICE_SHEET_CELL_INT_BINDING = u"com.sun.star.table.ListPositionCellBinding"_ustr; +inline constexpr OUString SERVICE_SHEET_CELLRANGE_LISTSOURCE = u"com.sun.star.table.CellRangeListSource"_ustr; +inline constexpr OUString SERVICE_ADDRESS_CONVERSION = u"com.sun.star.table.CellAddressConversion"_ustr; +inline constexpr OUString SERVICE_RANGEADDRESS_CONVERSION = u"com.sun.star.table.CellRangeAddressConversion"_ustr; diff --git a/extensions/source/propctrlr/genericpropertyhandler.cxx b/extensions/source/propctrlr/genericpropertyhandler.cxx index 014b4cf55f0f..322bc3405143 100644 --- a/extensions/source/propctrlr/genericpropertyhandler.cxx +++ b/extensions/source/propctrlr/genericpropertyhandler.cxx @@ -39,8 +39,9 @@ #include <comphelper/propertyvalue.hxx> #include <comphelper/sequence.hxx> #include <comphelper/types.hxx> +#include <o3tl/safeint.hxx> #include <tools/debug.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <algorithm> @@ -166,7 +167,7 @@ namespace pcr sal_Int32 index = std::find( std::cbegin(aValues), std::cend(aValues), nAsInt ) - std::cbegin(aValues); std::vector< OUString > aDescriptions( getDescriptions() ); - if ( ( index >= 0 ) && ( index < static_cast<sal_Int32>(aDescriptions.size()) ) ) + if ( ( index >= 0 ) && ( o3tl::make_unsigned(index) < aDescriptions.size() ) ) sDescription = aDescriptions[ index ]; else { @@ -303,7 +304,7 @@ namespace pcr // create an introspection adapter for the component Reference< XIntrospection > xIntrospection = theIntrospection::get( m_xContext ); - Reference< XIntrospectionAccess > xIntrospectionAccess( xIntrospection->inspect( makeAny( _rxIntrospectee ) ) ); + Reference< XIntrospectionAccess > xIntrospectionAccess( xIntrospection->inspect( Any( _rxIntrospectee ) ) ); if ( !xIntrospectionAccess.is() ) throw RuntimeException("The introspection service could not handle the given component.", *this ); @@ -457,7 +458,7 @@ namespace pcr aProperties = xPSI->getProperties(); DBG_ASSERT( aProperties.hasElements(), "GenericPropertyHandler::getSupportedProperties: no properties!" ); - for ( auto const & property : std::as_const(aProperties) ) + for (auto const& property : aProperties) { switch ( property.Type.getTypeClass() ) { @@ -604,7 +605,22 @@ namespace pcr // at this handler instance } - IMPLEMENT_FORWARD_XCOMPONENT( GenericPropertyHandler, GenericPropertyHandler_Base ); + void SAL_CALL GenericPropertyHandler::dispose( ) + { + GenericPropertyHandler_Base::WeakComponentImplHelperBase::dispose(); + m_xComponentIntrospectionAccess.clear(); + m_xComponent.clear(); + m_xTypeConverter.clear(); + m_xPropertyState.clear(); + } + void SAL_CALL GenericPropertyHandler::addEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) + { + GenericPropertyHandler_Base::WeakComponentImplHelperBase::addEventListener( Listener ); + } + void SAL_CALL GenericPropertyHandler::removeEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) + { + GenericPropertyHandler_Base::WeakComponentImplHelperBase::removeEventListener( Listener ); + } } // namespace pcr diff --git a/extensions/source/propctrlr/handlerhelper.cxx b/extensions/source/propctrlr/handlerhelper.cxx index 1f274def355f..77743c622ad7 100644 --- a/extensions/source/propctrlr/handlerhelper.cxx +++ b/extensions/source/propctrlr/handlerhelper.cxx @@ -29,7 +29,7 @@ #include <com/sun/star/inspection/PropertyControlType.hpp> #include <com/sun/star/inspection/XStringListControl.hpp> #include <com/sun/star/inspection/XNumericControl.hpp> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <vcl/svapp.hxx> #include <vcl/weld.hxx> #include <vcl/weldutils.hxx> @@ -299,7 +299,7 @@ namespace pcr { Reference<css::container::XNameContainer> xName(rContext, UNO_QUERY_THROW); Reference<XWindow> xWindow(new weld::TransportAsXWindow(pParent)); - xName->insertByName("BuilderParent", makeAny(xWindow)); + xName->insertByName("BuilderParent", Any(xWindow)); } void PropertyHandlerHelper::clearBuilderParent(const css::uno::Reference<css::uno::XComponentContext>& rContext) diff --git a/extensions/source/propctrlr/inspectormodelbase.cxx b/extensions/source/propctrlr/inspectormodelbase.cxx index 1fdc8a0b5dfc..aaa994e94abd 100644 --- a/extensions/source/propctrlr/inspectormodelbase.cxx +++ b/extensions/source/propctrlr/inspectormodelbase.cxx @@ -28,18 +28,20 @@ namespace pcr { - - -#define MODEL_PROPERTY_ID_HAS_HELP_SECTION 2000 -#define MODEL_PROPERTY_ID_MIN_HELP_TEXT_LINES 2001 -#define MODEL_PROPERTY_ID_MAX_HELP_TEXT_LINES 2002 -#define MODEL_PROPERTY_ID_IS_READ_ONLY 2003 - + namespace + { + enum class ModelPropertyId + { + HAS_HELP_SECTION = 2000, + MIN_HELP_TEXT_LINES = 2001, + MAX_HELP_TEXT_LINES = 2002, + IS_READ_ONLY = 2003 + }; + }; using ::com::sun::star::uno::Reference; using ::com::sun::star::beans::XPropertySetInfo; using ::com::sun::star::uno::Any; using ::com::sun::star::uno::Sequence; - using ::com::sun::star::uno::makeAny; using ::com::sun::star::beans::Property; namespace PropertyAttribute = ::com::sun::star::beans::PropertyAttribute; @@ -95,25 +97,25 @@ namespace pcr { registerProperty( "HasHelpSection", - MODEL_PROPERTY_ID_HAS_HELP_SECTION, + static_cast<sal_Int32>(ModelPropertyId::HAS_HELP_SECTION), PropertyAttribute::READONLY, &m_bHasHelpSection, cppu::UnoType<decltype(m_bHasHelpSection)>::get() ); registerProperty( "MinHelpTextLines", - MODEL_PROPERTY_ID_MIN_HELP_TEXT_LINES, + static_cast<sal_Int32>(ModelPropertyId::MIN_HELP_TEXT_LINES), PropertyAttribute::READONLY, &m_nMinHelpTextLines, cppu::UnoType<decltype(m_nMinHelpTextLines)>::get() ); registerProperty( "MaxHelpTextLines", - MODEL_PROPERTY_ID_MAX_HELP_TEXT_LINES, + static_cast<sal_Int32>(ModelPropertyId::MAX_HELP_TEXT_LINES), PropertyAttribute::READONLY, &m_nMaxHelpTextLines, cppu::UnoType<decltype(m_nMaxHelpTextLines)>::get() ); registerProperty( "IsReadOnly", - MODEL_PROPERTY_ID_IS_READ_ONLY, + static_cast<sal_Int32>(ModelPropertyId::IS_READ_ONLY), PropertyAttribute::BOUND, &m_bIsReadOnly, cppu::UnoType<decltype(m_bIsReadOnly)>::get() ); @@ -226,7 +228,7 @@ namespace pcr void SAL_CALL ImplInspectorModel::setIsReadOnly( sal_Bool IsReadOnly ) { - setFastPropertyValue( MODEL_PROPERTY_ID_IS_READ_ONLY, makeAny( IsReadOnly ) ); + setFastPropertyValue( static_cast<sal_Int32>(ModelPropertyId::IS_READ_ONLY), Any( IsReadOnly ) ); } sal_Bool SAL_CALL ImplInspectorModel::supportsService( const OUString& ServiceName ) diff --git a/extensions/source/propctrlr/listselectiondlg.cxx b/extensions/source/propctrlr/listselectiondlg.cxx index 3dec4d7a79d3..521afdf449fa 100644 --- a/extensions/source/propctrlr/listselectiondlg.cxx +++ b/extensions/source/propctrlr/listselectiondlg.cxx @@ -21,7 +21,8 @@ #include "formstrings.hxx" #include <comphelper/sequence.hxx> -#include <tools/diagnose_ex.h> +#include <utility> +#include <comphelper/diagnose_ex.hxx> namespace pcr { @@ -29,10 +30,10 @@ namespace pcr using namespace ::com::sun::star::beans; ListSelectionDialog::ListSelectionDialog(weld::Window* pParent, const Reference< XPropertySet >& _rxListBox, - const OUString& _rPropertyName, const OUString& _rPropertyUIName) + OUString _sPropertyName, const OUString& _rPropertyUIName) : GenericDialogController(pParent, "modules/spropctrlr/ui/listselectdialog.ui", "ListSelectDialog") , m_xListBox ( _rxListBox ) - , m_sPropertyName( _rPropertyName ) + , m_sPropertyName(std::move( _sPropertyName )) , m_xFrame(m_xBuilder->weld_frame("frame")) , m_xEntries(m_xBuilder->weld_tree_view("treeview")) { @@ -99,7 +100,7 @@ namespace pcr try { - m_xListBox->setPropertyValue( m_sPropertyName, makeAny( comphelper::containerToSequence(aSelection) ) ); + m_xListBox->setPropertyValue( m_sPropertyName, Any( comphelper::containerToSequence(aSelection) ) ); } catch( const Exception& ) { diff --git a/extensions/source/propctrlr/listselectiondlg.hxx b/extensions/source/propctrlr/listselectiondlg.hxx index 51469c091856..368e9e9aac94 100644 --- a/extensions/source/propctrlr/listselectiondlg.hxx +++ b/extensions/source/propctrlr/listselectiondlg.hxx @@ -37,7 +37,7 @@ namespace pcr ListSelectionDialog( weld::Window* _pParent, const css::uno::Reference< css::beans::XPropertySet >& _rxListBox, - const OUString& _rPropertyName, + OUString _sPropertyName, const OUString& _rPropertyUIName ); virtual ~ListSelectionDialog() override; diff --git a/extensions/source/propctrlr/newdatatype.cxx b/extensions/source/propctrlr/newdatatype.cxx index 09c774d3aa42..b2399d680668 100644 --- a/extensions/source/propctrlr/newdatatype.cxx +++ b/extensions/source/propctrlr/newdatatype.cxx @@ -26,7 +26,7 @@ namespace pcr //= NewDataTypeDialog - NewDataTypeDialog::NewDataTypeDialog(weld::Window* pParent, const OUString& _rNameBase, const std::vector< OUString >& _rProhibitedNames) + NewDataTypeDialog::NewDataTypeDialog(weld::Window* pParent, std::u16string_view _rNameBase, const std::vector< OUString >& _rProhibitedNames) : GenericDialogController(pParent, "modules/spropctrlr/ui/datatypedialog.ui", "DataTypeDialog") , m_aProhibitedNames( _rProhibitedNames.begin(), _rProhibitedNames.end() ) , m_xName(m_xBuilder->weld_entry("entry")) @@ -36,7 +36,7 @@ namespace pcr // find an initial name // for this, first remove trailing digits - sal_Int32 nStripUntil = _rNameBase.getLength(); + sal_Int32 nStripUntil = _rNameBase.size(); while ( nStripUntil > 0 ) { sal_Unicode nChar = _rNameBase[ --nStripUntil ]; @@ -48,7 +48,7 @@ namespace pcr } } - OUString sNameBase = OUString::Concat(_rNameBase.subView( 0, nStripUntil ? nStripUntil + 1 : 0 )) + " "; + OUString sNameBase = OUString::Concat(_rNameBase.substr( 0, nStripUntil ? nStripUntil + 1 : 0 )) + " "; OUString sInitialName; sal_Int32 nPostfixNumber = 1; do diff --git a/extensions/source/propctrlr/newdatatype.hxx b/extensions/source/propctrlr/newdatatype.hxx index e6d46f1af329..ba4b6fa38269 100644 --- a/extensions/source/propctrlr/newdatatype.hxx +++ b/extensions/source/propctrlr/newdatatype.hxx @@ -36,7 +36,7 @@ namespace pcr std::unique_ptr<weld::Entry> m_xName; std::unique_ptr<weld::Button> m_xOK; public: - NewDataTypeDialog(weld::Window* _pParent, const OUString& _rNameBase, + NewDataTypeDialog(weld::Window* _pParent, std::u16string_view _rNameBase, const std::vector< OUString >& _rProhibitedNames ); virtual ~NewDataTypeDialog() override; diff --git a/extensions/source/propctrlr/objectinspectormodel.cxx b/extensions/source/propctrlr/objectinspectormodel.cxx index adad6e66f27b..a05d9347f979 100644 --- a/extensions/source/propctrlr/objectinspectormodel.cxx +++ b/extensions/source/propctrlr/objectinspectormodel.cxx @@ -29,7 +29,6 @@ namespace pcr { - using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::XComponentContext; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Any; diff --git a/extensions/source/propctrlr/pcrcommon.cxx b/extensions/source/propctrlr/pcrcommon.cxx index b980731380a2..6b0cee5c7ca8 100644 --- a/extensions/source/propctrlr/pcrcommon.cxx +++ b/extensions/source/propctrlr/pcrcommon.cxx @@ -28,23 +28,20 @@ namespace pcr { - using namespace ::com::sun::star::util; - - //= HelpIdUrl - OString HelpIdUrl::getHelpId( const OUString& _rHelpURL ) + OUString HelpIdUrl::getHelpId( std::u16string_view _rHelpURL ) { INetURLObject aHID( _rHelpURL ); if ( aHID.GetProtocol() == INetProtocol::Hid ) - return OUStringToOString( aHID.GetURLPath(), RTL_TEXTENCODING_UTF8 ); + return aHID.GetURLPath(); else - return OUStringToOString( _rHelpURL, RTL_TEXTENCODING_UTF8 ); + return OUString(_rHelpURL); } - OUString HelpIdUrl::getHelpURL( const OUString & sHelpId ) + OUString HelpIdUrl::getHelpURL( std::u16string_view sHelpId ) { OUStringBuffer aBuffer; INetURLObject aHID( sHelpId ); diff --git a/extensions/source/propctrlr/pcrcommon.hxx b/extensions/source/propctrlr/pcrcommon.hxx index 4d9b68d8e974..f2a8b847c000 100644 --- a/extensions/source/propctrlr/pcrcommon.hxx +++ b/extensions/source/propctrlr/pcrcommon.hxx @@ -31,11 +31,13 @@ namespace pcr { - - #define OWN_PROPERTY_ID_INTROSPECTEDOBJECT 0x0010 - #define OWN_PROPERTY_ID_CURRENTPAGE 0x0011 - #define OWN_PROPERTY_ID_CONTROLCONTEXT 0x0012 - #define OWN_PROPERTY_ID_TABBINGMODEL 0x0013 + enum class OwnPropertyId + { + INTROSPECTEDOBJECT = 0x0010, + CURRENTPAGE = 0x0011, + CONTROLCONTEXT = 0x0012, + TABBINGMODEL = 0x0013 + }; //= types @@ -61,8 +63,8 @@ namespace pcr class HelpIdUrl { public: - static OString getHelpId( const OUString& _rHelpURL ); - static OUString getHelpURL( const OUString& ); + static OUString getHelpId( std::u16string_view _rHelpURL ); + static OUString getHelpURL( std::u16string_view ); }; diff --git a/extensions/source/propctrlr/pcrstrings.hxx b/extensions/source/propctrlr/pcrstrings.hxx index 3bb0a888c954..3e9ac3ea55e6 100644 --- a/extensions/source/propctrlr/pcrstrings.hxx +++ b/extensions/source/propctrlr/pcrstrings.hxx @@ -26,7 +26,7 @@ namespace pcr // properties - constexpr OUStringLiteral PROPERTY_TABBINGMODEL = u"TabbingModel"; + constexpr OUString PROPERTY_TABBINGMODEL = u"TabbingModel"_ustr; } // namespace pcr diff --git a/extensions/source/propctrlr/pcrunodialogs.cxx b/extensions/source/propctrlr/pcrunodialogs.cxx index d3f1e81190d3..f36aedf39d76 100644 --- a/extensions/source/propctrlr/pcrunodialogs.cxx +++ b/extensions/source/propctrlr/pcrunodialogs.cxx @@ -35,7 +35,6 @@ namespace pcr using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; @@ -45,11 +44,11 @@ namespace pcr OTabOrderDialog::OTabOrderDialog( const Reference< XComponentContext >& _rxContext ) :OGenericUnoDialog( _rxContext ) { - registerProperty( PROPERTY_CONTROLCONTEXT, OWN_PROPERTY_ID_CONTROLCONTEXT, + registerProperty( PROPERTY_CONTROLCONTEXT, static_cast<sal_Int32>(OwnPropertyId::CONTROLCONTEXT), PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT, &m_xControlContext, cppu::UnoType<decltype(m_xControlContext)>::get() ); - registerProperty( PROPERTY_TABBINGMODEL, OWN_PROPERTY_ID_TABBINGMODEL, + registerProperty( PROPERTY_TABBINGMODEL, static_cast<sal_Int32>(OwnPropertyId::TABBINGMODEL), PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT, &m_xTabbingModel, cppu::UnoType<decltype(m_xTabbingModel)>::get() ); } @@ -114,15 +113,15 @@ namespace pcr Sequence< Any > aNewArguments{ Any(NamedValue( "TabbingModel", - makeAny( xTabbingModel ) + Any( xTabbingModel ) )), Any(NamedValue( "ControlContext", - makeAny( xControlContext ) + Any( xControlContext ) )), Any(NamedValue( "ParentWindow", - makeAny( xParentWindow ) + Any( xParentWindow ) )) }; OTabOrderDialog_DBase::initialize(aNewArguments); diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx index 4fd878441f90..f6a37893a11b 100644 --- a/extensions/source/propctrlr/propcontroller.cxx +++ b/extensions/source/propctrlr/propcontroller.cxx @@ -37,7 +37,7 @@ #include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <com/sun/star/util/VetoException.hpp> #include <tools/debug.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <vcl/svapp.hxx> #include <vcl/weld.hxx> @@ -55,9 +55,7 @@ namespace pcr using namespace ::com::sun::star::uno; using namespace ::com::sun::star::awt; using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::script; using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::container; using namespace ::com::sun::star::frame; using namespace ::com::sun::star::util; using namespace ::com::sun::star::inspection; @@ -443,7 +441,7 @@ namespace pcr Any SAL_CALL OPropertyBrowserController::getViewData( ) { - return makeAny( m_sPageSelection ); + return Any( m_sPageSelection ); } @@ -490,6 +488,9 @@ namespace pcr m_aInspectedObjects.clear(); impl_bindToNewModel_nothrow( nullptr ); + m_xModel.clear(); + m_xInteractiveHandler.clear(); + m_xFrame.clear(); } void SAL_CALL OPropertyBrowserController::addEventListener( const Reference< XEventListener >& _rxListener ) @@ -956,7 +957,7 @@ namespace pcr } // append these properties to our "all properties" array - aProperties.reserve( aProperties.size() + aThisHandlersProperties.size() ); + aProperties.reserve( std::max<size_t>(aProperties.size() + aThisHandlersProperties.size(), aProperties.size() * 2) ); for (const auto & aThisHandlersProperty : aThisHandlersProperties) { auto noPrevious = std::none_of( @@ -1111,7 +1112,7 @@ namespace pcr { weld::Widget* m_pControlWindow = pTunnel->getWidget(); if (m_pControlWindow) - m_pControlWindow->set_buildable_name(m_pControlWindow->get_buildable_name() + "-" + _rDescriptor.DisplayName.toUtf8()); + m_pControlWindow->set_buildable_name(m_pControlWindow->get_buildable_name() + "-" + _rDescriptor.DisplayName); } } @@ -1178,7 +1179,7 @@ namespace pcr // this category does not yet exist. This is allowed, as an inspector model might be lazy, and not provide // any category information of its own. In this case, we have a fallback ... m_aPageIds[ aDescriptor.Category ] = - getPropertyBox().AppendPage( aDescriptor.Category, OString() ); + getPropertyBox().AppendPage(aDescriptor.Category, {}); nTargetPageId = impl_getPageIdForCategory_nothrow( aDescriptor.Category ); } @@ -1398,7 +1399,7 @@ namespace pcr if ( m_xModel.is() ) aHandlerFactories = m_xModel->getHandlerFactories(); - for ( auto const & handlerFactory : std::as_const(aHandlerFactories) ) + for (auto const& handlerFactory : aHandlerFactories) { if ( _rObjects.size() == 1 ) { // we're inspecting only one object -> one handler diff --git a/extensions/source/propctrlr/propcontroller.hxx b/extensions/source/propctrlr/propcontroller.hxx index a56a839796f4..a149d7ff2338 100644 --- a/extensions/source/propctrlr/propcontroller.hxx +++ b/extensions/source/propctrlr/propcontroller.hxx @@ -76,10 +76,7 @@ namespace pcr typedef std::vector< css::uno::Reference< css::uno::XInterface > > InterfaceArray; - protected: css::uno::Reference< css::uno::XComponentContext > m_xContext; - - private: css::uno::Reference< css::frame::XFrame > m_xFrame; css::uno::Reference< css::awt::XWindow > m_xView; diff --git a/extensions/source/propctrlr/propertycomposer.cxx b/extensions/source/propctrlr/propertycomposer.cxx index d77280d9fa18..869cba77c7fe 100644 --- a/extensions/source/propctrlr/propertycomposer.cxx +++ b/extensions/source/propctrlr/propertycomposer.cxx @@ -23,10 +23,11 @@ #include <com/sun/star/lang/IllegalArgumentException.hpp> #include <comphelper/sequence.hxx> #include <osl/diagnose.h> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <algorithm> #include <iterator> +#include <utility> namespace pcr @@ -48,7 +49,7 @@ namespace pcr { OUString sPropertyName; const Any& rValue; - SetPropertyValue( const OUString& _rPropertyName, const Any& _rValue ) : sPropertyName( _rPropertyName ), rValue( _rValue ) { } + SetPropertyValue( OUString _aPropertyName, const Any& _rValue ) : sPropertyName(std::move( _aPropertyName )), rValue( _rValue ) { } void operator()( const Reference< XPropertyHandler >& _rHandler ) { _rHandler->setPropertyValue( sPropertyName, rValue ); diff --git a/extensions/source/propctrlr/propertycontrolextender.cxx b/extensions/source/propctrlr/propertycontrolextender.cxx index 142e288ddeb9..f2854f447a17 100644 --- a/extensions/source/propctrlr/propertycontrolextender.cxx +++ b/extensions/source/propctrlr/propertycontrolextender.cxx @@ -22,7 +22,7 @@ #include <com/sun/star/awt/KeyFunction.hpp> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> namespace pcr @@ -33,7 +33,6 @@ namespace pcr using ::com::sun::star::uno::UNO_SET_THROW; using ::com::sun::star::uno::Exception; using ::com::sun::star::uno::Any; - using ::com::sun::star::awt::XWindow; using ::com::sun::star::awt::KeyEvent; using ::com::sun::star::inspection::XPropertyControl; using ::com::sun::star::lang::EventObject; @@ -42,26 +41,16 @@ namespace pcr namespace KeyFunction = ::com::sun::star::awt::KeyFunction; - //= PropertyControlExtender_Data - - struct PropertyControlExtender_Data - { - Reference< XPropertyControl > xControl; - Reference< XWindow > xControlWindow; - }; - - //= PropertyControlExtender PropertyControlExtender::PropertyControlExtender( const Reference< XPropertyControl >& _rxObservedControl ) - :m_pData( new PropertyControlExtender_Data ) { try { - m_pData->xControl.set( _rxObservedControl, UNO_SET_THROW ); - m_pData->xControlWindow.set( m_pData->xControl->getControlWindow(), UNO_SET_THROW ); - m_pData->xControlWindow->addKeyListener( this ); + mxControl.set( _rxObservedControl, UNO_SET_THROW ); + mxControlWindow.set( mxControl->getControlWindow(), UNO_SET_THROW ); + mxControlWindow->addKeyListener( this ); } catch( const Exception& ) { @@ -77,7 +66,7 @@ namespace pcr void SAL_CALL PropertyControlExtender::keyPressed( const KeyEvent& _event ) { - OSL_ENSURE( _event.Source == m_pData->xControlWindow, "PropertyControlExtender::keyPressed: where does this come from?" ); + OSL_ENSURE( _event.Source == mxControlWindow, "PropertyControlExtender::keyPressed: where does this come from?" ); if ( ( _event.KeyFunc != KeyFunction::DELETE ) || ( _event.Modifiers != 0 ) ) @@ -85,7 +74,7 @@ namespace pcr try { - Reference< XPropertyControl > xControl( m_pData->xControl, UNO_SET_THROW ); + Reference< XPropertyControl > xControl( mxControl, UNO_SET_THROW ); // reset the value xControl->setValue( Any() ); @@ -112,10 +101,10 @@ namespace pcr void SAL_CALL PropertyControlExtender::disposing( const EventObject& Source ) { - OSL_ENSURE( Source.Source == m_pData->xControlWindow, "PropertyControlExtender::disposing: where does this come from?" ); + OSL_ENSURE( Source.Source == mxControlWindow, "PropertyControlExtender::disposing: where does this come from?" ); (void)Source.Source; - m_pData->xControlWindow.clear(); - m_pData->xControl.clear(); + mxControlWindow.clear(); + mxControl.clear(); } diff --git a/extensions/source/propctrlr/propertycontrolextender.hxx b/extensions/source/propctrlr/propertycontrolextender.hxx index ed7c4a06c448..e376223ebf35 100644 --- a/extensions/source/propctrlr/propertycontrolextender.hxx +++ b/extensions/source/propctrlr/propertycontrolextender.hxx @@ -53,7 +53,8 @@ namespace pcr virtual ~PropertyControlExtender() override; private: - std::unique_ptr< PropertyControlExtender_Data > m_pData; + css::uno::Reference< css::inspection::XPropertyControl > mxControl; + css::uno::Reference< css::awt::XWindow > mxControlWindow; }; diff --git a/extensions/source/propctrlr/propertyeditor.cxx b/extensions/source/propctrlr/propertyeditor.cxx index 3c94a3a24bf3..1e026c5b5bb4 100644 --- a/extensions/source/propctrlr/propertyeditor.cxx +++ b/extensions/source/propctrlr/propertyeditor.cxx @@ -23,6 +23,7 @@ #include "linedescriptor.hxx" #include <tools/debug.hxx> +#include <utility> #include <osl/diagnose.h> namespace pcr @@ -64,7 +65,7 @@ namespace pcr int nCount = m_xTabControl->get_n_pages(); for (int i = nCount - 1; i >= 0; --i) { - OString sID = m_xTabControl->get_page_ident(i); + OUString sID = m_xTabControl->get_page_ident(i); m_xTabControl->remove_page(sID); } @@ -115,12 +116,12 @@ namespace pcr return const_cast<OPropertyEditor*>(this)->getPage(rPageId); } - sal_uInt16 OPropertyEditor::AppendPage(const OUString& rText, const OString& rHelpId) + sal_uInt16 OPropertyEditor::AppendPage(const OUString& rText, const OUString& rHelpId) { // obtain a new id sal_uInt16 nId = m_nNextId++; // insert the id - OString sIdent = OString::number(nId); + OUString sIdent = OUString::number(nId); m_xTabControl->append_page(sIdent, rText); // create a new page @@ -139,7 +140,7 @@ namespace pcr return nId; } - void OPropertyEditor::SetHelpId( const OString& rHelpId ) + void OPropertyEditor::SetHelpId( const OUString& rHelpId ) { m_xTabControl->set_help_id(rHelpId); } @@ -151,13 +152,13 @@ namespace pcr return; m_aShownPages.erase(aPagePos); - OString sIdent(OString::number(nID)); + OUString sIdent(OUString::number(nID)); m_xTabControl->remove_page(sIdent); } void OPropertyEditor::SetPage(sal_uInt16 nId) { - m_xTabControl->set_current_page(OString::number(nId)); + m_xTabControl->set_current_page(OUString::number(nId)); } sal_uInt16 OPropertyEditor::GetCurPage() const @@ -289,7 +290,7 @@ namespace pcr { assert((m_aHiddenPages.find(nPageId) != m_aHiddenPages.end() || m_aShownPages.find(nPageId) != m_aShownPages.end()) && "page doesn't exist"); - OString sIdent(OString::number(nPageId)); + OUString sIdent(OUString::number(nPageId)); if (!bShow) { auto aPagePos = m_aShownPages.find(nPageId); @@ -346,12 +347,12 @@ namespace pcr return xControl; } - IMPL_LINK_NOARG(OPropertyEditor, OnPageActivate, const OString&, void) + IMPL_LINK(OPropertyEditor, OnPageActivate, const OUString&, rNewPage, void) { - m_aPageActivationHandler.Call(nullptr); + m_aPageActivationHandler.Call(rNewPage); } - IMPL_LINK(OPropertyEditor, OnPageDeactivate, const OString&, rIdent, bool) + IMPL_LINK(OPropertyEditor, OnPageDeactivate, const OUString&, rIdent, bool) { // commit the data on the current (to-be-deactivated) tab page // (79404) @@ -370,8 +371,8 @@ namespace pcr { } - OPropertyEditor::PropertyPage::PropertyPage(sal_uInt16 nPagePos, const OUString& rLabel, std::unique_ptr<OBrowserPage> pPage) - : nPos(nPagePos), sLabel(rLabel), xPage(std::move(pPage)) + OPropertyEditor::PropertyPage::PropertyPage(sal_uInt16 nPagePos, OUString aLabel, std::unique_ptr<OBrowserPage> pPage) + : nPos(nPagePos), sLabel(std::move(aLabel)), xPage(std::move(pPage)) { } diff --git a/extensions/source/propctrlr/propertyeditor.hxx b/extensions/source/propctrlr/propertyeditor.hxx index 5ca271d0d14a..96199b31af4c 100644 --- a/extensions/source/propctrlr/propertyeditor.hxx +++ b/extensions/source/propctrlr/propertyeditor.hxx @@ -46,7 +46,7 @@ namespace pcr OUString sLabel; std::unique_ptr<OBrowserPage> xPage; PropertyPage(); - PropertyPage(sal_uInt16 nPagePos, const OUString& rLabel, std::unique_ptr<OBrowserPage> pPage); + PropertyPage(sal_uInt16 nPagePos, OUString aLabel, std::unique_ptr<OBrowserPage> pPage); }; std::unique_ptr<weld::Container> m_xContainer; @@ -57,7 +57,7 @@ namespace pcr IPropertyLineListener* m_pListener; IPropertyControlObserver* m_pObserver; sal_uInt16 m_nNextId; - Link<LinkParamNone*,void> m_aPageActivationHandler; + Link<const OUString&,void> m_aPageActivationHandler; bool m_bHasHelpSection; MapStringToPageId m_aPropertyPageIds; @@ -75,8 +75,8 @@ namespace pcr bool HasHelpSection() const { return m_bHasHelpSection; } void SetHelpText( const OUString& _rHelpText ); - void SetHelpId( const OString& sHelpId ); - sal_uInt16 AppendPage( const OUString& r, const OString& _rHelpId ); + void SetHelpId( const OUString& sHelpId ); + sal_uInt16 AppendPage( const OUString& r, const OUString& _rHelpId ); void SetPage( sal_uInt16 ); void RemovePage(sal_uInt16 nID); sal_uInt16 GetCurPage() const; @@ -95,7 +95,7 @@ namespace pcr void RemoveEntry( const OUString& _rName ); void ChangeEntry( const OLineDescriptor& ); - void setPageActivationHandler(const Link<LinkParamNone*,void>& _rHdl) { m_aPageActivationHandler = _rHdl; } + void setPageActivationHandler(const Link<const OUString&,void>& _rHdl) { m_aPageActivationHandler = _rHdl; } Size get_preferred_size() const; @@ -122,8 +122,8 @@ namespace pcr void enableHelpSection( OBrowserPage& _rPage, const void* ); static void setHelpSectionText( OBrowserPage& _rPage, const void* _pPointerToOUString ); - DECL_LINK(OnPageDeactivate, const OString&, bool); - DECL_LINK(OnPageActivate, const OString&, void); + DECL_LINK(OnPageDeactivate, const OUString&, bool); + DECL_LINK(OnPageActivate, const OUString&, void); }; diff --git a/extensions/source/propctrlr/propertyhandler.cxx b/extensions/source/propctrlr/propertyhandler.cxx index 6c1215524fd2..bd6ba2af7407 100644 --- a/extensions/source/propctrlr/propertyhandler.cxx +++ b/extensions/source/propctrlr/propertyhandler.cxx @@ -42,7 +42,6 @@ namespace pcr { using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::awt; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::script; using namespace ::com::sun::star::lang; @@ -164,7 +163,7 @@ namespace pcr ::rtl::Reference< IPropertyEnumRepresentation > aEnumConversion( new DefaultEnumRepresentation( *m_pInfoService, _rPropertyValue.getValueType(), nPropId ) ); // TODO/UNOize: cache those converters? - return makeAny( aEnumConversion->getDescriptionForValue( _rPropertyValue ) ); + return Any( aEnumConversion->getDescriptionForValue( _rPropertyValue ) ); } return PropertyHandlerHelper::convertToControlValue( @@ -242,7 +241,22 @@ namespace pcr return true; } - IMPLEMENT_FORWARD_XCOMPONENT( PropertyHandler, PropertyHandler_Base ) + void SAL_CALL PropertyHandler::dispose( ) + { + PropertyHandler_Base::WeakComponentImplHelperBase::dispose(); + m_xComponent.clear(); + m_xComponentPropertyInfo.clear(); + m_xTypeConverter.clear(); + } + void SAL_CALL PropertyHandler::addEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) + { + PropertyHandler_Base::WeakComponentImplHelperBase::addEventListener( Listener ); + } + void SAL_CALL PropertyHandler::removeEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) + { + PropertyHandler_Base::WeakComponentImplHelperBase::removeEventListener( Listener ); + } + void SAL_CALL PropertyHandler::disposing() { diff --git a/extensions/source/propctrlr/pushbuttonnavigation.cxx b/extensions/source/propctrlr/pushbuttonnavigation.cxx index 3d1bf748c712..130cf322d15d 100644 --- a/extensions/source/propctrlr/pushbuttonnavigation.cxx +++ b/extensions/source/propctrlr/pushbuttonnavigation.cxx @@ -22,8 +22,9 @@ #include "formstrings.hxx" #include <comphelper/extract.hxx> #include <comphelper/property.hxx> +#include <o3tl/string_view.hxx> #include <osl/diagnose.h> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> namespace pcr @@ -53,12 +54,12 @@ namespace pcr nullptr }; - sal_Int32 lcl_getNavigationURLIndex( const OUString& _rNavURL ) + sal_Int32 lcl_getNavigationURLIndex( std::u16string_view _rNavURL ) { const char** pLookup = pNavigationURLs; while ( *pLookup ) { - if ( _rNavURL.equalsAscii( *pLookup ) ) + if ( o3tl::equalsAscii( _rNavURL, *pLookup ) ) return pLookup - pNavigationURLs; ++pLookup; } @@ -157,8 +158,8 @@ namespace pcr nButtonType = sal_Int32(FormButtonType_URL); } - m_xControlModel->setPropertyValue( PROPERTY_BUTTONTYPE, makeAny( static_cast< FormButtonType >( nButtonType ) ) ); - m_xControlModel->setPropertyValue( PROPERTY_TARGET_URL, makeAny( sTargetURL ) ); + m_xControlModel->setPropertyValue( PROPERTY_BUTTONTYPE, Any( static_cast< FormButtonType >( nButtonType ) ) ); + m_xControlModel->setPropertyValue( PROPERTY_TARGET_URL, Any( sTargetURL ) ); } catch( const Exception& ) { diff --git a/extensions/source/propctrlr/selectlabeldialog.cxx b/extensions/source/propctrlr/selectlabeldialog.cxx index fabef68abf43..706e6eb3c807 100644 --- a/extensions/source/propctrlr/selectlabeldialog.cxx +++ b/extensions/source/propctrlr/selectlabeldialog.cxx @@ -70,7 +70,7 @@ namespace pcr nClassID = ::comphelper::getINT16(m_xControlModel->getPropertyValue(PROPERTY_CLASSID)); sDescription = sDescription.replaceAll("$controlclass$", - GetUIHeadlineName(nClassID, makeAny(m_xControlModel))); + GetUIHeadlineName(nClassID, Any(m_xControlModel))); OUString sName = ::comphelper::getString(m_xControlModel->getPropertyValue(PROPERTY_NAME)); sDescription = sDescription.replaceAll("$controlname$", sName); m_xMainDesc->set_label(sDescription); @@ -92,8 +92,8 @@ namespace pcr // check which service the allowed components must support sal_Int16 nClassId = 0; try { nClassId = ::comphelper::getINT16(m_xControlModel->getPropertyValue(PROPERTY_CLASSID)); } catch(...) { } - m_sRequiredService = (FormComponentType::RADIOBUTTON == nClassId) ? OUString(SERVICE_COMPONENT_GROUPBOX) : OUString(SERVICE_COMPONENT_FIXEDTEXT); - m_aRequiredControlImage = (FormComponentType::RADIOBUTTON == nClassId) ? OUString(RID_EXTBMP_GROUPBOX) : OUString(RID_EXTBMP_FIXEDTEXT); + m_sRequiredService = (FormComponentType::RADIOBUTTON == nClassId) ? SERVICE_COMPONENT_GROUPBOX : SERVICE_COMPONENT_FIXEDTEXT; + m_aRequiredControlImage = (FormComponentType::RADIOBUTTON == nClassId) ? RID_EXTBMP_GROUPBOX : RID_EXTBMP_FIXEDTEXT; // calc the currently set label control (so InsertEntries can calc m_xInitialSelection) Any aCurrentLabelControl( m_xControlModel->getPropertyValue(PROPERTY_CONTROLLABEL) ); @@ -208,7 +208,7 @@ namespace pcr // all requirements met -> insert m_xUserData.emplace_back(new Reference<XPropertySet>(xAsSet)); - OUString sId(OUString::number(reinterpret_cast<sal_Int64>(m_xUserData.back().get()))); + OUString sId(weld::toId(m_xUserData.back().get())); m_xControlTree->insert(&rContainerEntry, -1, &sDisplayName, &sId, nullptr, nullptr, false, m_xScratchIter.get()); m_xControlTree->set_image(*m_xScratchIter, m_aRequiredControlImage); @@ -232,7 +232,7 @@ namespace pcr bool bSelected = m_xControlTree->get_selected(xIter.get()); OUString sData = bSelected ? m_xControlTree->get_id(*xIter) : OUString(); if (!sData.isEmpty()) - m_xSelectedControl.set(*reinterpret_cast<Reference<XPropertySet>*>(sData.toInt64())); + m_xSelectedControl.set(*weld::fromId<Reference<XPropertySet>*>(sData)); m_xNoAssignment->set_active(sData.isEmpty()); } diff --git a/extensions/source/propctrlr/sqlcommanddesign.cxx b/extensions/source/propctrlr/sqlcommanddesign.cxx index 73e205be4ed0..d98b2a569234 100644 --- a/extensions/source/propctrlr/sqlcommanddesign.cxx +++ b/extensions/source/propctrlr/sqlcommanddesign.cxx @@ -38,7 +38,8 @@ #include <com/sun/star/sdb/CommandType.hpp> #include <comphelper/propertyvalue.hxx> -#include <tools/diagnose_ex.h> +#include <utility> +#include <comphelper/diagnose_ex.hxx> #include <osl/diagnose.h> @@ -90,9 +91,9 @@ namespace pcr SQLCommandDesigner::SQLCommandDesigner( const Reference< XComponentContext >& _rxContext, const ::rtl::Reference< ISQLCommandAdapter >& _rxPropertyAdapter, - const ::dbtools::SharedConnection& _rConnection, const Link<SQLCommandDesigner&,void>& _rCloseLink ) + ::dbtools::SharedConnection _aConnection, const Link<SQLCommandDesigner&,void>& _rCloseLink ) :m_xContext( _rxContext ) - ,m_xConnection( _rConnection ) + ,m_xConnection(std::move( _aConnection )) ,m_xObjectAdapter( _rxPropertyAdapter ) ,m_aCloseLink( _rCloseLink ) { @@ -162,6 +163,8 @@ namespace pcr m_xConnection.clear(); m_xContext.clear(); m_xORB.clear(); + m_xDesigner.clear(); + m_xObjectAdapter.clear(); } diff --git a/extensions/source/propctrlr/sqlcommanddesign.hxx b/extensions/source/propctrlr/sqlcommanddesign.hxx index a72ba11b0571..767506eca7bf 100644 --- a/extensions/source/propctrlr/sqlcommanddesign.hxx +++ b/extensions/source/propctrlr/sqlcommanddesign.hxx @@ -72,7 +72,7 @@ namespace pcr SQLCommandDesigner( const css::uno::Reference< css::uno::XComponentContext >& _rxContext, const ::rtl::Reference< ISQLCommandAdapter >& _rxPropertyAdapter, - const ::dbtools::SharedConnection& _rConnection, + ::dbtools::SharedConnection _aConnection, const Link<SQLCommandDesigner&,void>& _rCloseLink ); diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx index 8c33d0598711..ad978253b076 100644 --- a/extensions/source/propctrlr/standardcontrol.cxx +++ b/extensions/source/propctrlr/standardcontrol.cxx @@ -38,6 +38,7 @@ #include <tools/datetime.hxx> #include <unotools/datetime.hxx> +#include <o3tl/string_view.hxx> #include <limits> #include <memory> @@ -229,16 +230,16 @@ namespace pcr notifyModifiedValue(); } - static int ImplCalcLongValue( double nValue, sal_uInt16 nDigits ) + static sal_Int64 ImplCalcLongValue( double nValue, sal_uInt16 nDigits ) { double n = nValue; for ( sal_uInt16 d = 0; d < nDigits; ++d ) n *= 10; - return o3tl::saturating_cast<int>(n); + return o3tl::saturating_cast<sal_Int64>(n); } - static double ImplCalcDoubleValue( int nValue, sal_uInt16 nDigits ) + static double ImplCalcDoubleValue(sal_Int64 nValue, sal_uInt16 nDigits ) { double n = nValue; for ( sal_uInt16 d = 0; d < nDigits; ++d ) @@ -313,7 +314,7 @@ namespace pcr Any SAL_CALL OHyperlinkControl::getValue() { OUString sText = m_xEntry->get_text(); - return makeAny( sText ); + return Any( sText ); } void SAL_CALL OHyperlinkControl::setValue( const Any& _value ) @@ -376,7 +377,7 @@ namespace pcr void SAL_CALL ONumericControl::setDecimalDigits( ::sal_Int16 decimaldigits ) { weld::MetricSpinButton* pControlWindow = getTypedControlWindow(); - int min, max; + sal_Int64 min, max; pControlWindow->get_range(min, max, FieldUnit::NONE); pControlWindow->set_digits(decimaldigits); pControlWindow->set_range(min, max, FieldUnit::NONE); @@ -386,8 +387,8 @@ namespace pcr { Optional< double > aReturn( true, 0 ); - int minValue = getTypedControlWindow()->get_min(FieldUnit::NONE); - if ( minValue == std::numeric_limits<int>::min() ) + sal_Int64 minValue = getTypedControlWindow()->get_min(FieldUnit::NONE); + if ( minValue == std::numeric_limits<sal_Int64>::min() ) aReturn.IsPresent = false; else aReturn.Value = static_cast<double>(minValue); @@ -398,7 +399,7 @@ namespace pcr void SAL_CALL ONumericControl::setMinValue( const Optional< double >& _minvalue ) { if ( !_minvalue.IsPresent ) - getTypedControlWindow()->set_min( std::numeric_limits<int>::min(), FieldUnit::NONE ); + getTypedControlWindow()->set_min( std::numeric_limits<sal_Int64>::min(), FieldUnit::NONE ); else getTypedControlWindow()->set_min( impl_apiValueToFieldValue_nothrow( _minvalue.Value ) , m_eValueUnit); } @@ -407,8 +408,8 @@ namespace pcr { Optional< double > aReturn( true, 0 ); - int maxValue = getTypedControlWindow()->get_max(FieldUnit::NONE); - if ( maxValue == std::numeric_limits<int>::max() ) + sal_Int64 maxValue = getTypedControlWindow()->get_max(FieldUnit::NONE); + if ( maxValue == std::numeric_limits<sal_Int64>::max() ) aReturn.IsPresent = false; else aReturn.Value = static_cast<double>(maxValue); @@ -419,7 +420,7 @@ namespace pcr void SAL_CALL ONumericControl::setMaxValue( const Optional< double >& _maxvalue ) { if ( !_maxvalue.IsPresent ) - getTypedControlWindow()->set_max( std::numeric_limits<int>::max(), FieldUnit::NONE ); + getTypedControlWindow()->set_max( std::numeric_limits<sal_Int64>::max(), FieldUnit::NONE ); else getTypedControlWindow()->set_max( impl_apiValueToFieldValue_nothrow( _maxvalue.Value ), m_eValueUnit ); } @@ -478,14 +479,14 @@ namespace pcr } } - int ONumericControl::impl_apiValueToFieldValue_nothrow( double _nApiValue ) const + sal_Int64 ONumericControl::impl_apiValueToFieldValue_nothrow( double _nApiValue ) const { - int nControlValue = ImplCalcLongValue( _nApiValue, getTypedControlWindow()->get_digits() ); + sal_Int64 nControlValue = ImplCalcLongValue( _nApiValue, getTypedControlWindow()->get_digits() ); nControlValue /= m_nFieldToUNOValueFactor; return nControlValue; } - double ONumericControl::impl_fieldValueToApiValue_nothrow( int nFieldValue ) const + double ONumericControl::impl_fieldValueToApiValue_nothrow(sal_Int64 nFieldValue) const { double nApiValue = ImplCalcDoubleValue( nFieldValue, getTypedControlWindow()->get_digits() ); nApiValue *= m_nFieldToUNOValueFactor; @@ -498,7 +499,8 @@ namespace pcr if ( !getTypedControlWindow()->get_text().isEmpty() ) { double nValue = impl_fieldValueToApiValue_nothrow( getTypedControlWindow()->get_value( m_eValueUnit ) ); - aPropValue <<= nValue; + if (nValue) + aPropValue <<= nValue; } return aPropValue; } @@ -637,7 +639,7 @@ namespace pcr Any SAL_CALL OComboboxControl::getValue() { - return makeAny( getTypedControlWindow()->get_active_text() ); + return Any( getTypedControlWindow()->get_active_text() ); } Type SAL_CALL OComboboxControl::getValueType() @@ -680,7 +682,7 @@ namespace pcr namespace { - StlSyntaxSequence< OUString > lcl_convertMultiLineToList( const OUString& _rCompsedTextWithLineBreaks ) + StlSyntaxSequence< OUString > lcl_convertMultiLineToList( std::u16string_view _rCompsedTextWithLineBreaks ) { sal_Int32 nLines = comphelper::string::getTokenCount(_rCompsedTextWithLineBreaks, '\n'); StlSyntaxSequence< OUString > aStrings( nLines ); @@ -690,7 +692,7 @@ namespace pcr sal_Int32 nIdx {0}; do { - *stringItem = _rCompsedTextWithLineBreaks.getToken( 0, '\n', nIdx ); + *stringItem = o3tl::getToken(_rCompsedTextWithLineBreaks, 0, '\n', nIdx ); ++stringItem; } while (nIdx>0); @@ -723,9 +725,7 @@ namespace pcr { if ( strings != _rStrings.begin() ) aComposed.append( ';' ); - aComposed.append( '\"' ); - aComposed.append( *strings ); - aComposed.append( '\"' ); + aComposed.append( "\"" + *strings + "\"" ); } return aComposed.makeStringAndClear(); } diff --git a/extensions/source/propctrlr/standardcontrol.hxx b/extensions/source/propctrlr/standardcontrol.hxx index 7a0c585b775c..fcd194886a1a 100644 --- a/extensions/source/propctrlr/standardcontrol.hxx +++ b/extensions/source/propctrlr/standardcontrol.hxx @@ -246,12 +246,12 @@ namespace pcr The conversion respects our decimal digits as well as our value factor (<member>m_nFieldToUNOValueFactor</member>). */ - int impl_apiValueToFieldValue_nothrow( double nApiValue ) const; + sal_Int64 impl_apiValueToFieldValue_nothrow( double nApiValue ) const; /** converts a control value, as obtained from our Numeric field, into a value which can passed to outer callers via our UNO API. */ - double impl_fieldValueToApiValue_nothrow( int nFieldValue ) const; + double impl_fieldValueToApiValue_nothrow(sal_Int64 nFieldValue) const; }; //= OColorControl diff --git a/extensions/source/propctrlr/stringrepresentation.cxx b/extensions/source/propctrlr/stringrepresentation.cxx index 83befe2039d3..6f40c09c9d84 100644 --- a/extensions/source/propctrlr/stringrepresentation.cxx +++ b/extensions/source/propctrlr/stringrepresentation.cxx @@ -37,8 +37,10 @@ #include <osl/diagnose.h> #include <rtl/ustrbuf.hxx> #include <sal/log.hxx> +#include <utility> #include <yesno.hrc> #include <comphelper/types.hxx> +#include <o3tl/string_view.hxx> #include "modulepcr.hxx" #include <algorithm> @@ -57,7 +59,7 @@ class StringRepresentation: lang::XInitialization> { public: - explicit StringRepresentation(uno::Reference< uno::XComponentContext > const & context); + explicit StringRepresentation(uno::Reference< uno::XComponentContext > context); StringRepresentation (const StringRepresentation&) = delete; StringRepresentation& operator=(const StringRepresentation&) = delete; @@ -127,8 +129,8 @@ private: } -StringRepresentation::StringRepresentation(uno::Reference< uno::XComponentContext > const & context) : - m_xContext(context) +StringRepresentation::StringRepresentation(uno::Reference< uno::XComponentContext > context) : + m_xContext(std::move(context)) {} // com.sun.star.uno.XServiceInfo: @@ -304,9 +306,9 @@ namespace { return OUString::number( _rIntValue ); } - sal_Int32 operator()( const OUString& _rStringValue ) const + sal_Int32 operator()( std::u16string_view _rStringValue ) const { - return _rStringValue.toInt32(); + return o3tl::toInt32(_rStringValue); } }; @@ -327,8 +329,7 @@ namespace // (separated by a line break) for (const auto& rElement : _rElements) { - sCompose.append(OUString(_rTransformer(rElement))); - sCompose.append("\n"); + sCompose.append(OUString(_rTransformer(rElement)) + "\n"); } sCompose.stripEnd('\n'); @@ -336,16 +337,16 @@ namespace } template < class ElementType, class Transformer > - void splitComposedStringToSequence( const OUString& _rComposed, Sequence< ElementType >& _out_SplitUp, const Transformer& _rTransformer ) + void splitComposedStringToSequence( std::u16string_view _rComposed, Sequence< ElementType >& _out_SplitUp, const Transformer& _rTransformer ) { _out_SplitUp.realloc( 0 ); - if ( _rComposed.isEmpty() ) + if ( _rComposed.empty() ) return; sal_Int32 tokenPos = 0; do { _out_SplitUp.realloc( _out_SplitUp.getLength() + 1 ); - _out_SplitUp.getArray()[ _out_SplitUp.getLength() - 1 ] = static_cast<ElementType>(_rTransformer( _rComposed.getToken( 0, '\n', tokenPos ) )); + _out_SplitUp.getArray()[ _out_SplitUp.getLength() - 1 ] = static_cast<ElementType>(_rTransformer( OUString(o3tl::getToken(_rComposed, 0, '\n', tokenPos )) )); } while ( tokenPos != -1 ); } @@ -416,10 +417,6 @@ bool StringRepresentation::convertGenericValueToString( const uno::Any& _rValue, } break; case uno::TypeClass_CONSTANT: - { - int i = 0; - ++i; - } break; // some structs @@ -482,7 +479,7 @@ uno::Any StringRepresentation::convertStringToSimple( const OUString& _rValue,co } if ( !aReturn.hasValue() ) - aReturn = m_xTypeConverter->convertToSimpleType( makeAny( _rValue ), _ePropertyType ); + aReturn = m_xTypeConverter->convertToSimpleType( Any( _rValue ), _ePropertyType ); } catch( const script::CannotConvertException& ) { } catch( const lang::IllegalArgumentException& ) { } diff --git a/extensions/source/propctrlr/submissionhandler.cxx b/extensions/source/propctrlr/submissionhandler.cxx index 87609e905e74..05e25e4d71a8 100644 --- a/extensions/source/propctrlr/submissionhandler.cxx +++ b/extensions/source/propctrlr/submissionhandler.cxx @@ -29,7 +29,7 @@ #include <com/sun/star/inspection/XObjectInspectorUI.hpp> #include <com/sun/star/lang/NullPointerException.hpp> #include <tools/debug.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> namespace pcr @@ -41,10 +41,8 @@ namespace pcr using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::script; using namespace ::com::sun::star::form; using namespace ::com::sun::star::xforms; - using namespace ::com::sun::star::container; using namespace ::com::sun::star::inspection; diff --git a/extensions/source/propctrlr/taborder.cxx b/extensions/source/propctrlr/taborder.cxx index d41018a833b3..af7b9ced7480 100644 --- a/extensions/source/propctrlr/taborder.cxx +++ b/extensions/source/propctrlr/taborder.cxx @@ -29,7 +29,7 @@ #include <com/sun/star/form/runtime/FormController.hpp> #include <osl/diagnose.h> #include <tools/debug.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> namespace pcr { @@ -180,7 +180,7 @@ namespace pcr aName = ::comphelper::getString( xControl->getPropertyValue( PROPERTY_NAME ) ); // TODO: do Basic controls have a name? aImage = GetImage( xControl ); - OUString sId(OUString::number(reinterpret_cast<sal_Int64>(xControl.get()))); + OUString sId(weld::toId(xControl.get())); m_xLB_Controls->append(sId, aName, aImage); } } @@ -243,7 +243,7 @@ namespace pcr for (int i = 0; i < nEntryCount; ++i) { - XPropertySet* pEntry = reinterpret_cast<XPropertySet*>(m_xLB_Controls->get_id(i).toInt64()); + XPropertySet* pEntry = weld::fromId<XPropertySet*>(m_xLB_Controls->get_id(i)); for( auto const& rControlModel : aControlModels ) { Reference< XPropertySet > xSet(rControlModel, UNO_QUERY); diff --git a/extensions/source/propctrlr/unourl.cxx b/extensions/source/propctrlr/unourl.cxx index 88c9630129e4..dba37915e647 100644 --- a/extensions/source/propctrlr/unourl.cxx +++ b/extensions/source/propctrlr/unourl.cxx @@ -22,7 +22,7 @@ #include <com/sun/star/util/XURLTransformer.hpp> #include <comphelper/processfactory.hxx> #include <osl/diagnose.h> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> namespace pcr diff --git a/extensions/source/propctrlr/xsddatatypes.cxx b/extensions/source/propctrlr/xsddatatypes.cxx index fdaea8e21fc8..25af46895adb 100644 --- a/extensions/source/propctrlr/xsddatatypes.cxx +++ b/extensions/source/propctrlr/xsddatatypes.cxx @@ -24,7 +24,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <tools/debug.hxx> #include <osl/diagnose.h> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> namespace pcr diff --git a/extensions/source/propctrlr/xsdvalidationhelper.cxx b/extensions/source/propctrlr/xsdvalidationhelper.cxx index 390993de6aca..5580a8ec3a4f 100644 --- a/extensions/source/propctrlr/xsdvalidationhelper.cxx +++ b/extensions/source/propctrlr/xsdvalidationhelper.cxx @@ -29,7 +29,7 @@ #include <com/sun/star/xforms/XDataTypeRepository.hpp> #include <unotools/syslocale.hxx> #include <i18nlangtag/languagetag.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> namespace pcr @@ -257,7 +257,7 @@ namespace pcr } catch( const Exception& ) { } // set the new data type name - xBinding->setPropertyValue( PROPERTY_XSD_DATA_TYPE, makeAny( _rName ) ); + xBinding->setPropertyValue( PROPERTY_XSD_DATA_TYPE, Any( _rName ) ); // retrieve the new data type object Reference< XPropertySet > xNewType = getDataType( _rName ); @@ -269,7 +269,7 @@ namespace pcr // fire the change in the Data Type property OUString sNewDataTypeName; OSL_VERIFY( xBinding->getPropertyValue( PROPERTY_XSD_DATA_TYPE ) >>= sNewDataTypeName ); - firePropertyChange( PROPERTY_XSD_DATA_TYPE, makeAny( sOldDataTypeName ), makeAny( sNewDataTypeName ) ); + firePropertyChange( PROPERTY_XSD_DATA_TYPE, Any( sOldDataTypeName ), Any( sNewDataTypeName ) ); } } catch( const Exception& ) @@ -361,7 +361,7 @@ namespace pcr sal_Int32 nDesiredFormat = xFormatTypes->getStandardFormat( nNumberFormatType, SvtSysLocale().GetLanguageTag().getLocale() ); // set this at the introspectee - m_xControlModel->setPropertyValue( PROPERTY_FORMATKEY, makeAny( nDesiredFormat ) ); + m_xControlModel->setPropertyValue( PROPERTY_FORMATKEY, Any( nDesiredFormat ) ); } } catch( const Exception& ) diff --git a/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx b/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx index 3f61549b62d0..29bc09a65a7f 100644 --- a/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx +++ b/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx @@ -56,9 +56,7 @@ namespace pcr using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::xforms; using namespace ::com::sun::star::xsd; - using namespace ::com::sun::star::script; using namespace ::com::sun::star::inspection; using ::com::sun::star::beans::PropertyAttribute::MAYBEVOID; @@ -102,9 +100,9 @@ namespace pcr switch ( nPropId ) { // common facets - case PROPERTY_ID_XSD_DATA_TYPE: aReturn = pType.is() ? pType->getFacet( PROPERTY_NAME ) : makeAny( OUString() ); break; - case PROPERTY_ID_XSD_WHITESPACES:aReturn = pType.is() ? pType->getFacet( PROPERTY_XSD_WHITESPACES ) : makeAny( WhiteSpaceTreatment::Preserve ); break; - case PROPERTY_ID_XSD_PATTERN: aReturn = pType.is() ? pType->getFacet( PROPERTY_XSD_PATTERN ) : makeAny( OUString() ); break; + case PROPERTY_ID_XSD_DATA_TYPE: aReturn = pType.is() ? pType->getFacet( PROPERTY_NAME ) : Any( OUString() ); break; + case PROPERTY_ID_XSD_WHITESPACES:aReturn = pType.is() ? pType->getFacet( PROPERTY_XSD_WHITESPACES ) : Any( WhiteSpaceTreatment::Preserve ); break; + case PROPERTY_ID_XSD_PATTERN: aReturn = pType.is() ? pType->getFacet( PROPERTY_XSD_PATTERN ) : Any( OUString() ); break; // all other properties are simply forwarded, if they exist at the given type default: @@ -171,7 +169,7 @@ namespace pcr if ( bAllowBinding ) { - aProperties.reserve( 12 ); + aProperties.reserve( 28 ); addStringPropertyDescription( aProperties, PROPERTY_XSD_DATA_TYPE ); addInt16PropertyDescription ( aProperties, PROPERTY_XSD_WHITESPACES ); @@ -221,27 +219,27 @@ namespace pcr std::vector< OUString > aSuperfluous; if (m_pHelper) { - aSuperfluous.push_back( OUString(PROPERTY_CONTROLSOURCE) ); - aSuperfluous.push_back( OUString(PROPERTY_EMPTY_IS_NULL) ); - aSuperfluous.push_back( OUString(PROPERTY_FILTERPROPOSAL) ); - aSuperfluous.push_back( OUString(PROPERTY_LISTSOURCETYPE) ); - aSuperfluous.push_back( OUString(PROPERTY_LISTSOURCE) ); - aSuperfluous.push_back( OUString(PROPERTY_BOUNDCOLUMN) ); + aSuperfluous.push_back( PROPERTY_CONTROLSOURCE ); + aSuperfluous.push_back( PROPERTY_EMPTY_IS_NULL ); + aSuperfluous.push_back( PROPERTY_FILTERPROPOSAL ); + aSuperfluous.push_back( PROPERTY_LISTSOURCETYPE ); + aSuperfluous.push_back( PROPERTY_LISTSOURCE ); + aSuperfluous.push_back( PROPERTY_BOUNDCOLUMN ); bool bAllowBinding = m_pHelper->canBindToAnyDataType(); if ( bAllowBinding ) { - aSuperfluous.push_back( OUString(PROPERTY_MAXTEXTLEN) ); - aSuperfluous.push_back( OUString(PROPERTY_VALUEMIN) ); - aSuperfluous.push_back( OUString(PROPERTY_VALUEMAX) ); - aSuperfluous.push_back( OUString(PROPERTY_DECIMAL_ACCURACY) ); - aSuperfluous.push_back( OUString(PROPERTY_TIMEMIN) ); - aSuperfluous.push_back( OUString(PROPERTY_TIMEMAX) ); - aSuperfluous.push_back( OUString(PROPERTY_DATEMIN) ); - aSuperfluous.push_back( OUString(PROPERTY_DATEMAX) ); - aSuperfluous.push_back( OUString(PROPERTY_EFFECTIVE_MIN) ); - aSuperfluous.push_back( OUString(PROPERTY_EFFECTIVE_MAX) ); + aSuperfluous.push_back( PROPERTY_MAXTEXTLEN ); + aSuperfluous.push_back( PROPERTY_VALUEMIN ); + aSuperfluous.push_back( PROPERTY_VALUEMAX ); + aSuperfluous.push_back( PROPERTY_DECIMAL_ACCURACY ); + aSuperfluous.push_back( PROPERTY_TIMEMIN ); + aSuperfluous.push_back( PROPERTY_TIMEMAX ); + aSuperfluous.push_back( PROPERTY_DATEMIN ); + aSuperfluous.push_back( PROPERTY_DATEMAX ); + aSuperfluous.push_back( PROPERTY_EFFECTIVE_MIN ); + aSuperfluous.push_back( PROPERTY_EFFECTIVE_MAX ); } } @@ -255,8 +253,8 @@ namespace pcr std::vector< OUString > aInterestedInActuations; if (m_pHelper) { - aInterestedInActuations.push_back( OUString(PROPERTY_XSD_DATA_TYPE) ); - aInterestedInActuations.push_back( OUString(PROPERTY_XML_DATA_MODEL) ); + aInterestedInActuations.push_back( PROPERTY_XSD_DATA_TYPE ); + aInterestedInActuations.push_back( PROPERTY_XML_DATA_MODEL ); } return comphelper::containerToSequence( aInterestedInActuations ); } @@ -575,29 +573,29 @@ namespace pcr // show the facets which are available at the data type OUString aFacets[] = { - OUString(PROPERTY_XSD_WHITESPACES), OUString(PROPERTY_XSD_PATTERN), - OUString(PROPERTY_XSD_LENGTH), OUString(PROPERTY_XSD_MIN_LENGTH), OUString(PROPERTY_XSD_MAX_LENGTH), OUString(PROPERTY_XSD_TOTAL_DIGITS), - OUString(PROPERTY_XSD_FRACTION_DIGITS), - OUString(PROPERTY_XSD_MAX_INCLUSIVE_INT), - OUString(PROPERTY_XSD_MAX_EXCLUSIVE_INT), - OUString(PROPERTY_XSD_MIN_INCLUSIVE_INT), - OUString(PROPERTY_XSD_MIN_EXCLUSIVE_INT), - OUString(PROPERTY_XSD_MAX_INCLUSIVE_DOUBLE), - OUString(PROPERTY_XSD_MAX_EXCLUSIVE_DOUBLE), - OUString(PROPERTY_XSD_MIN_INCLUSIVE_DOUBLE), - OUString(PROPERTY_XSD_MIN_EXCLUSIVE_DOUBLE), - OUString(PROPERTY_XSD_MAX_INCLUSIVE_DATE), - OUString(PROPERTY_XSD_MAX_EXCLUSIVE_DATE), - OUString(PROPERTY_XSD_MIN_INCLUSIVE_DATE), - OUString(PROPERTY_XSD_MIN_EXCLUSIVE_DATE), - OUString(PROPERTY_XSD_MAX_INCLUSIVE_TIME), - OUString(PROPERTY_XSD_MAX_EXCLUSIVE_TIME), - OUString(PROPERTY_XSD_MIN_INCLUSIVE_TIME), - OUString(PROPERTY_XSD_MIN_EXCLUSIVE_TIME), - OUString(PROPERTY_XSD_MAX_INCLUSIVE_DATE_TIME), - OUString(PROPERTY_XSD_MAX_EXCLUSIVE_DATE_TIME), - OUString(PROPERTY_XSD_MIN_INCLUSIVE_DATE_TIME), - OUString(PROPERTY_XSD_MIN_EXCLUSIVE_DATE_TIME) + PROPERTY_XSD_WHITESPACES, PROPERTY_XSD_PATTERN, + PROPERTY_XSD_LENGTH, PROPERTY_XSD_MIN_LENGTH, PROPERTY_XSD_MAX_LENGTH, PROPERTY_XSD_TOTAL_DIGITS, + PROPERTY_XSD_FRACTION_DIGITS, + PROPERTY_XSD_MAX_INCLUSIVE_INT, + PROPERTY_XSD_MAX_EXCLUSIVE_INT, + PROPERTY_XSD_MIN_INCLUSIVE_INT, + PROPERTY_XSD_MIN_EXCLUSIVE_INT, + PROPERTY_XSD_MAX_INCLUSIVE_DOUBLE, + PROPERTY_XSD_MAX_EXCLUSIVE_DOUBLE, + PROPERTY_XSD_MIN_INCLUSIVE_DOUBLE, + PROPERTY_XSD_MIN_EXCLUSIVE_DOUBLE, + PROPERTY_XSD_MAX_INCLUSIVE_DATE, + PROPERTY_XSD_MAX_EXCLUSIVE_DATE, + PROPERTY_XSD_MIN_INCLUSIVE_DATE, + PROPERTY_XSD_MIN_EXCLUSIVE_DATE, + PROPERTY_XSD_MAX_INCLUSIVE_TIME, + PROPERTY_XSD_MAX_EXCLUSIVE_TIME, + PROPERTY_XSD_MIN_INCLUSIVE_TIME, + PROPERTY_XSD_MIN_EXCLUSIVE_TIME, + PROPERTY_XSD_MAX_INCLUSIVE_DATE_TIME, + PROPERTY_XSD_MAX_EXCLUSIVE_DATE_TIME, + PROPERTY_XSD_MIN_INCLUSIVE_DATE_TIME, + PROPERTY_XSD_MIN_EXCLUSIVE_DATE_TIME }; size_t i=0; diff --git a/extensions/source/scanner/grid.cxx b/extensions/source/scanner/grid.cxx index 110779c55080..7d87010ea152 100644 --- a/extensions/source/scanner/grid.cxx +++ b/extensions/source/scanner/grid.cxx @@ -18,9 +18,9 @@ */ #include <sal/config.h> +#include <o3tl/sprintf.hxx> #include <osl/thread.h> #include <rtl/math.hxx> -#include <cstdio> #include <bitmaps.hlst> #include <cmath> @@ -206,7 +206,6 @@ void GridWindow::SetDrawingArea(weld::DrawingArea* pDrawingArea) GridDialog::GridDialog(weld::Window* pParent, double* pXValues, double* pYValues, int nValues) : GenericDialogController(pParent, "modules/scanner/ui/griddialog.ui", "GridDialog") - , m_xOKButton(m_xBuilder->weld_button("ok")) , m_xResetTypeBox(m_xBuilder->weld_combo_box("resetTypeCombobox")) , m_xResetButton(m_xBuilder->weld_button("resetButton")) , m_xGridWindow(new GridWindow) @@ -446,7 +445,7 @@ void GridWindow::drawGrid(vcl::RenderContext& rRenderContext) drawLine(rRenderContext, fX, m_fMinY, fX, m_fMaxY); // draw tickmarks Point aPt = transform(fX, m_fMinY); - std::sprintf(pBuf, "%g", fX); + o3tl::sprintf(pBuf, "%g", fX); OUString aMark(pBuf, strlen(pBuf), osl_getThreadTextEncoding()); Size aTextSize(rRenderContext.GetTextWidth(aMark), rRenderContext.GetTextHeight()); aPt.AdjustX( -(aTextSize.Width() / 2) ); @@ -459,7 +458,7 @@ void GridWindow::drawGrid(vcl::RenderContext& rRenderContext) drawLine(rRenderContext, m_fMinX, fY, m_fMaxX, fY); // draw tickmarks Point aPt = transform(m_fMinX, fY); - std::sprintf(pBuf, "%g", fY); + o3tl::sprintf(pBuf, "%g", fY); OUString aMark(pBuf, strlen(pBuf), osl_getThreadTextEncoding()); Size aTextSize(rRenderContext.GetTextWidth(aMark), rRenderContext.GetTextHeight()); aPt.AdjustX( -(aTextSize.Width() + 2) ); @@ -648,7 +647,7 @@ void GridWindow::ChangeMode(ResetType nType) { for( int i = 0; i < m_nValues; i++ ) { - m_pNewYValues[ i ] = m_fMinY + (m_fMaxY-m_fMinY)*(rtl::math::expm1((m_pXValues[i]-m_fMinX)/(m_fMaxX-m_fMinX)))/(M_E-1.0); + m_pNewYValues[ i ] = m_fMinY + (m_fMaxY-m_fMinY)*(std::expm1((m_pXValues[i]-m_fMinX)/(m_fMaxX-m_fMinX)))/(M_E-1.0); } } break; diff --git a/extensions/source/scanner/grid.hxx b/extensions/source/scanner/grid.hxx index 86f1a521c6e1..319de77129d7 100644 --- a/extensions/source/scanner/grid.hxx +++ b/extensions/source/scanner/grid.hxx @@ -33,7 +33,6 @@ enum class ResetType class GridDialog : public weld::GenericDialogController { - std::unique_ptr<weld::Button> m_xOKButton; std::unique_ptr<weld::ComboBox> m_xResetTypeBox; std::unique_ptr<weld::Button> m_xResetButton; std::unique_ptr<GridWindow> m_xGridWindow; diff --git a/extensions/source/scanner/sane.cxx b/extensions/source/scanner/sane.cxx index de03e1158775..0e92a8796433 100644 --- a/extensions/source/scanner/sane.cxx +++ b/extensions/source/scanner/sane.cxx @@ -698,7 +698,7 @@ bool Sane::Start( BitmapTransporter& rBitmap ) if( nStatus != SANE_STATUS_GOOD ) bSynchronousRead = true; } - utl::TempFile aFrame; + utl::TempFileNamed aFrame; aFrame.EnableKillingFile(); FILE* pFrame = fopen(OUStringToOString(aFrame.GetFileName(), osl_getThreadTextEncoding()).getStr(), "w+b"); if( ! pFrame ) diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx index 8486195c93e6..b4f5e9a36cb7 100644 --- a/extensions/source/scanner/sanedlg.cxx +++ b/extensions/source/scanner/sanedlg.cxx @@ -17,13 +17,14 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <stdio.h> #include <stdlib.h> +#include <o3tl/sprintf.hxx> #include <tools/config.hxx> #include <unotools/resmgr.hxx> #include <vcl/bitmapex.hxx> #include <vcl/customweld.hxx> #include <vcl/dibtools.hxx> +#include <vcl/lineinfo.hxx> #include <vcl/weld.hxx> #include <vcl/svapp.hxx> #include <vcl/event.hxx> @@ -43,28 +44,52 @@ namespace { -void DrawRectangles(vcl::RenderContext& rRenderContext, Point const & rUL, Point const & rBR) +void DrawRect(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) { - int nMiddleX, nMiddleY; - Point aBL, aUR; + tools::Rectangle aRect(rRect); + rRenderContext.SetFillColor(COL_BLACK); + rRenderContext.SetLineColor(); + rRenderContext.DrawRect(aRect); + aRect.Move(1, 1); + aRect.AdjustRight(-2); + aRect.AdjustBottom(-2); + rRenderContext.SetFillColor(); + rRenderContext.SetLineColor(COL_WHITE); + rRenderContext.DrawRect(aRect); +} - aUR = Point(rBR.X(), rUL.Y()); - aBL = Point(rUL.X(), rBR.Y()); - nMiddleX = (rBR.X() - rUL.X()) / 2 + rUL.X(); - nMiddleY = (rBR.Y() - rUL.Y()) / 2 + rUL.Y(); +void DrawRectangles(vcl::RenderContext& rRenderContext, Point const & rUL, Point const & rBR) +{ + Point aUR(rBR.X(), rUL.Y()); + Point aBL(rUL.X(), rBR.Y()); + int nMiddleX = (rBR.X() - rUL.X()) / 2 + rUL.X(); + int nMiddleY = (rBR.Y() - rUL.Y()) / 2 + rUL.Y(); + rRenderContext.SetLineColor(COL_WHITE); rRenderContext.DrawLine(rUL, aBL); rRenderContext.DrawLine(aBL, rBR); rRenderContext.DrawLine(rBR, aUR); rRenderContext.DrawLine(aUR, rUL); - rRenderContext.DrawRect(tools::Rectangle(rUL, Size(RECT_SIZE_PIX,RECT_SIZE_PIX))); - rRenderContext.DrawRect(tools::Rectangle(aBL, Size(RECT_SIZE_PIX, -RECT_SIZE_PIX))); - rRenderContext.DrawRect(tools::Rectangle(rBR, Size(-RECT_SIZE_PIX, -RECT_SIZE_PIX))); - rRenderContext.DrawRect(tools::Rectangle(aUR, Size(-RECT_SIZE_PIX, RECT_SIZE_PIX ))); - rRenderContext.DrawRect(tools::Rectangle(Point(nMiddleX - RECT_SIZE_PIX / 2, rUL.Y()), Size(RECT_SIZE_PIX, RECT_SIZE_PIX))); - rRenderContext.DrawRect(tools::Rectangle(Point(nMiddleX - RECT_SIZE_PIX / 2, rBR.Y()), Size(RECT_SIZE_PIX, -RECT_SIZE_PIX))); - rRenderContext.DrawRect(tools::Rectangle(Point(rUL.X(), nMiddleY - RECT_SIZE_PIX / 2), Size(RECT_SIZE_PIX, RECT_SIZE_PIX))); - rRenderContext.DrawRect(tools::Rectangle(Point(rBR.X(), nMiddleY - RECT_SIZE_PIX / 2), Size(-RECT_SIZE_PIX, RECT_SIZE_PIX))); + + rRenderContext.SetLineColor(COL_BLACK); + LineInfo aInfo(LineStyle::Dash, 1); + aInfo.SetDistance(8); + aInfo.SetDotLen(4); + aInfo.SetDotCount(1); + rRenderContext.DrawLine(rUL, aBL, aInfo); + rRenderContext.DrawLine(aBL, rBR, aInfo); + rRenderContext.DrawLine(rBR, aUR, aInfo); + rRenderContext.DrawLine(aUR, rUL, aInfo); + + Size aSize(RECT_SIZE_PIX, RECT_SIZE_PIX); + DrawRect(rRenderContext, tools::Rectangle(rUL, aSize)); + DrawRect(rRenderContext, tools::Rectangle(Point(aBL.X(), aBL.Y() - RECT_SIZE_PIX), aSize)); + DrawRect(rRenderContext, tools::Rectangle(Point(rBR.X() - RECT_SIZE_PIX, rBR.Y() - RECT_SIZE_PIX), aSize)); + DrawRect(rRenderContext, tools::Rectangle(Point(aUR.X() - RECT_SIZE_PIX, aUR.Y()), aSize)); + DrawRect(rRenderContext, tools::Rectangle(Point(nMiddleX - RECT_SIZE_PIX / 2, rUL.Y()), aSize)); + DrawRect(rRenderContext, tools::Rectangle(Point(nMiddleX - RECT_SIZE_PIX / 2, rBR.Y() - RECT_SIZE_PIX), aSize)); + DrawRect(rRenderContext, tools::Rectangle(Point(rUL.X(), nMiddleY - RECT_SIZE_PIX / 2), aSize)); + DrawRect(rRenderContext, tools::Rectangle(Point(rBR.X() - RECT_SIZE_PIX, nMiddleY - RECT_SIZE_PIX / 2), aSize)); } } @@ -77,13 +102,11 @@ private: BitmapEx maPreviewBitmapEx; tools::Rectangle maPreviewRect; - Point maLastUL, maLastBR; Point maTopLeft, maBottomRight; Point maMinTopLeft, maMaxBottomRight; SaneDlg* mpParentDialog; DragDirection meDragDirection; bool mbDragEnable; - bool mbDragDrawn; bool mbIsDragging; public: @@ -92,7 +115,6 @@ public: , mpParentDialog(nullptr) , meDragDirection(TopLeft) , mbDragEnable(false) - , mbDragDrawn(false) , mbIsDragging(false) { } @@ -745,7 +767,7 @@ IMPL_LINK(SaneDlg, ModifyHdl, weld::Entry&, rEdit, void) fValue = mfMin; else if( fValue > mfMax ) fValue = mfMax; - sprintf( pBuf, "%g", fValue ); + o3tl::sprintf( pBuf, "%g", fValue ); mxNumericEdit->set_text( OUString( pBuf, strlen(pBuf), osl_getThreadTextEncoding() ) ); } mrSane.SetOptionValue( mnCurrentOption, fValue, mnCurrentElement ); @@ -757,7 +779,7 @@ IMPL_LINK(SaneDlg, ModifyHdl, weld::Entry&, rEdit, void) if( mrSane.GetOptionValue( mnCurrentOption, fValue, mnCurrentElement )) { char pBuf[256]; - sprintf( pBuf, "%g", fValue ); + o3tl::sprintf( pBuf, "%g", fValue ); OUString aValue( pBuf, strlen(pBuf), osl_getThreadTextEncoding() ); mxNumericEdit->set_text( aValue ); mxQuantumRangeBox->set_active_text( aValue ); @@ -924,7 +946,6 @@ void ScanPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectang // check for sane values rRenderContext.DrawBitmapEx(maPreviewRect.TopLeft(), maPreviewRect.GetSize(), maPreviewBitmapEx); - mbDragDrawn = false; DrawDrag(rRenderContext); } @@ -1002,18 +1023,18 @@ void SaneDlg::EstablishQuantumRange() mfMax = mpRange[ nValues-1 ]; for( int i = 0; i < nValues; i++ ) { - sprintf( pBuf, "%g", mpRange[ i ] ); + o3tl::sprintf( pBuf, "%g", mpRange[ i ] ); mxQuantumRangeBox->append_text( OUString( pBuf, strlen(pBuf), osl_getThreadTextEncoding() ) ); } double fValue; if( mrSane.GetOptionValue( mnCurrentOption, fValue, mnCurrentElement ) ) { - sprintf( pBuf, "%g", fValue ); + o3tl::sprintf( pBuf, "%g", fValue ); mxQuantumRangeBox->set_active_text( OUString( pBuf, strlen(pBuf), osl_getThreadTextEncoding() ) ); } mxQuantumRangeBox->show(); - OUString aText( mrSane.GetOptionName( mnCurrentOption ) + " " ); - aText += mrSane.GetOptionUnitName( mnCurrentOption ); + OUString aText = mrSane.GetOptionName( mnCurrentOption ) + " " + + mrSane.GetOptionUnitName( mnCurrentOption ); mxOptionDescTxt->set_label(aText); mxOptionDescTxt->show(); } @@ -1029,16 +1050,16 @@ void SaneDlg::EstablishNumericOption() return; char pBuf[256]; - OUString aText( mrSane.GetOptionName( mnCurrentOption ) + " " ); - aText += mrSane.GetOptionUnitName( mnCurrentOption ); + OUString aText = mrSane.GetOptionName( mnCurrentOption ) + " " + + mrSane.GetOptionUnitName( mnCurrentOption ); if( mfMin != mfMax ) { - sprintf( pBuf, " < %g ; %g >", mfMin, mfMax ); + o3tl::sprintf( pBuf, " < %g ; %g >", mfMin, mfMax ); aText += OUString( pBuf, strlen(pBuf), osl_getThreadTextEncoding() ); } mxOptionDescTxt->set_label( aText ); mxOptionDescTxt->show(); - sprintf( pBuf, "%g", fValue ); + o3tl::sprintf( pBuf, "%g", fValue ); mxNumericEdit->set_text( OUString( pBuf, strlen(pBuf), osl_getThreadTextEncoding() ) ); mxNumericEdit->show(); } @@ -1185,19 +1206,10 @@ void ScanPreview::DrawDrag(vcl::RenderContext& rRenderContext) if (!mbDragEnable) return; - RasterOp eROP = rRenderContext.GetRasterOp(); - rRenderContext.SetRasterOp(RasterOp::Invert); rRenderContext.SetMapMode(MapMode(MapUnit::MapPixel)); - if (mbDragDrawn) - DrawRectangles(rRenderContext, maLastUL, maLastBR); - - maLastUL = maTopLeft; - maLastBR = maBottomRight; DrawRectangles(rRenderContext, maTopLeft, maBottomRight); - mbDragDrawn = true; - rRenderContext.SetRasterOp(eROP); rRenderContext.SetMapMode(MapMode(MapUnit::MapAppFont)); } @@ -1271,8 +1283,8 @@ bool SaneDlg::LoadState() if( ! aConfig.HasGroup( "SANE" ) ) return false; - aConfig.SetGroup( "SANE" ); - OString aString = aConfig.ReadKey( "SO_LastSaneDevice" ); + aConfig.SetGroup( "SANE"_ostr ); + OString aString = aConfig.ReadKey( "SO_LastSaneDevice"_ostr ); for( i = 0; i < Sane::CountDevices() && aString != OUStringToOString(Sane::GetName(i), osl_getThreadTextEncoding()); i++ ) ; if( i == Sane::CountDevices() ) return false; @@ -1344,8 +1356,8 @@ void SaneDlg::SaveState() Config aConfig( aFileName ); aConfig.DeleteGroup( "SANE" ); - aConfig.SetGroup( "SANE" ); - aConfig.WriteKey( "SO_LastSANEDevice", + aConfig.SetGroup( "SANE"_ostr ); + aConfig.WriteKey( "SO_LastSANEDevice"_ostr, OUStringToOString(mxDeviceBox->get_active_text(), RTL_TEXTENCODING_UTF8) ); static char const* pSaveOptions[] = { @@ -1398,7 +1410,7 @@ void SaneDlg::SaveState() break; if( n > 0 ) aString.append(':'); - sprintf( buf, "%lg", fValue ); + o3tl::sprintf( buf, "%lg", fValue ); aString.append(buf); } if( n >= mrSane.GetOptionElements( nOption ) ) diff --git a/extensions/source/scanner/scanunx.cxx b/extensions/source/scanner/scanunx.cxx index b06e30a2794a..0db920c4c951 100644 --- a/extensions/source/scanner/scanunx.cxx +++ b/extensions/source/scanner/scanunx.cxx @@ -22,6 +22,7 @@ #include <o3tl/safeint.hxx> #include <osl/thread.hxx> #include <sal/log.hxx> +#include <utility> #include <vcl/svapp.hxx> #include <memory> @@ -129,7 +130,7 @@ public: virtual void SAL_CALL run() override; virtual void SAL_CALL onTerminated() override { delete this; } public: - ScannerThread( const std::shared_ptr<SaneHolder>& pHolder, + ScannerThread( std::shared_ptr<SaneHolder> pHolder, const Reference< css::lang::XEventListener >& listener, ScannerManager* pManager ); virtual ~ScannerThread() override; @@ -137,10 +138,10 @@ public: } -ScannerThread::ScannerThread(const std::shared_ptr<SaneHolder>& pHolder, +ScannerThread::ScannerThread(std::shared_ptr<SaneHolder> pHolder, const Reference< css::lang::XEventListener >& listener, ScannerManager* pManager) - : m_pHolder( pHolder ), m_xListener( listener ), m_pManager( pManager ) + : m_pHolder(std::move( pHolder )), m_xListener( listener ), m_pManager( pManager ) { SAL_INFO("extensions.scanner", "ScannerThread"); } diff --git a/extensions/source/scanner/scanwin.cxx b/extensions/source/scanner/scanwin.cxx index 109f2944a3b5..198b092846cd 100644 --- a/extensions/source/scanner/scanwin.cxx +++ b/extensions/source/scanner/scanwin.cxx @@ -253,9 +253,10 @@ void Twain::ShimListenerThread::execute() ThrowLastError("DuplicateHandle"); // we will not need our copy as soon as shim has its own inherited one ScopedHANDLE hScopedDup(hDup); - DWORD nDup = static_cast<DWORD>(reinterpret_cast<sal_uIntPtr>(hDup)); - if (reinterpret_cast<HANDLE>(nDup) != hDup) - throw std::exception("HANDLE does not fit to 32 bit - cannot pass to shim!"); + sal_uIntPtr nDup = reinterpret_cast<sal_uIntPtr>(hDup); + if constexpr (sizeof(sal_uIntPtr) > 4) + if (nDup > 0xFFFFFFFF) + throw std::exception("HANDLE does not fit to 32 bit - cannot pass to shim!"); // Send this thread handle as the first parameter sCmdLine = "\"" + sCmdLine + "\" " + OUString::number(nDup); diff --git a/extensions/source/scanner/twain32shim.cxx b/extensions/source/scanner/twain32shim.cxx index beca35f4f26b..6e0be8149471 100644 --- a/extensions/source/scanner/twain32shim.cxx +++ b/extensions/source/scanner/twain32shim.cxx @@ -28,6 +28,7 @@ */ #include "twain32shim.hxx" +#include <systools/win32/comtools.hxx> #include <tools/helpers.hxx> #include <twain/twain.h> #include <o3tl/unit_conversion.hxx> @@ -251,11 +252,10 @@ void ImpTwain::ImplOpenSourceManager() if (!m_hMod) { // Windows directory might not be in DLL search path sometimes, so try the full path - PWSTR sPath; + sal::systools::CoTaskMemAllocated<wchar_t> sPath; if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_Windows, 0, nullptr, &sPath))) { - std::wstring sPathAndFile = sPath; - CoTaskMemFree(sPath); + std::wstring sPathAndFile(sPath); sPathAndFile += L"\\TWAIN_32.DLL"; m_hMod = LoadLibraryW(sPathAndFile.c_str()); } diff --git a/extensions/source/update/check/actionlistener.hxx b/extensions/source/update/check/actionlistener.hxx index 8fdfd1565da6..63c5ac1cb019 100644 --- a/extensions/source/update/check/actionlistener.hxx +++ b/extensions/source/update/check/actionlistener.hxx @@ -27,7 +27,6 @@ class IActionListener : public virtual salhelper::SimpleReferenceObject virtual void cancel() = 0; virtual void download() = 0; - virtual void install() = 0; virtual void pause() = 0; virtual void resume() = 0; virtual void closeAfterFailure() = 0; diff --git a/extensions/source/update/check/download.cxx b/extensions/source/update/check/download.cxx index 387c1efd7a4f..f96d6ecd495e 100644 --- a/extensions/source/update/check/download.cxx +++ b/extensions/source/update/check/download.cxx @@ -23,6 +23,8 @@ #include <curl/curl.h> +#include <systools/curlinit.hxx> + #include <o3tl/string_view.hxx> #include <osl/diagnose.h> #include <osl/file.h> @@ -60,8 +62,8 @@ static void openFile( OutData& out ) char * effective_url; curl_easy_getinfo(out.curl, CURLINFO_EFFECTIVE_URL, &effective_url); - double fDownloadSize; - curl_easy_getinfo(out.curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &fDownloadSize); + curl_off_t nDownloadSize; + curl_easy_getinfo(out.curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &nDownloadSize); OString aURL(effective_url); @@ -94,7 +96,7 @@ static void openFile( OutData& out ) } while( osl_File_E_EXIST == rc ); if( osl_File_E_None == rc ) - out.Handler->downloadStarted(out.File, static_cast<sal_Int64>(fDownloadSize)); + out.Handler->downloadStarted(out.File, static_cast<sal_Int64>(nDownloadSize)); } } @@ -140,7 +142,7 @@ write_function( void *ptr, size_t size, size_t nmemb, void *stream ) static int -progress_callback( void *clientp, double dltotal, double dlnow, SAL_UNUSED_PARAMETER double, SAL_UNUSED_PARAMETER double ) +progress_callback( void *clientp, curl_off_t dltotal, curl_off_t dlnow, SAL_UNUSED_PARAMETER curl_off_t, SAL_UNUSED_PARAMETER curl_off_t) { OutData *out = static_cast < OutData * > (clientp); @@ -148,7 +150,7 @@ progress_callback( void *clientp, double dltotal, double dlnow, SAL_UNUSED_PARAM if (out && !out->StopCondition.check()) { - double fPercent = 0; + float fPercent = 0; if ( dltotal + out->Offset ) fPercent = (dlnow + out->Offset) * 100 / (dltotal + out->Offset); if( fPercent < 0 ) @@ -201,11 +203,6 @@ Download::getProxyForURL(std::u16string_view rURL, OString& rHost, sal_Int32& rP rHost = getStringValue(xNameAccess, "ooInetHTTPSProxyName"); rPort = getInt32Value(xNameAccess, "ooInetHTTPSProxyPort"); } - else if( o3tl::starts_with(rURL, u"ftp:") ) - { - rHost = getStringValue(xNameAccess, "ooInetFTPProxyName"); - rPort = getInt32Value(xNameAccess, "ooInetFTPProxyPort"); - } } } @@ -222,6 +219,8 @@ static bool curl_run(std::u16string_view rURL, OutData& out, const OString& aPro if( nullptr != pCURL ) { + ::InitCurl_easy(pCURL); + out.curl = pCURL; OString aURL(OUStringToOString(rURL, RTL_TEXTENCODING_UTF8)); @@ -232,8 +231,12 @@ static bool curl_run(std::u16string_view rURL, OutData& out, const OString& aPro // enable redirection (void)curl_easy_setopt(pCURL, CURLOPT_FOLLOWLOCATION, 1); - // only allow redirect to http:// and https:// - (void)curl_easy_setopt(pCURL, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); + // only allow redirect to https:// +#if (LIBCURL_VERSION_MAJOR > 7) || (LIBCURL_VERSION_MAJOR == 7 && LIBCURL_VERSION_MINOR >= 85) + (void)curl_easy_setopt(pCURL, CURLOPT_REDIR_PROTOCOLS_STR, "https"); +#else + (void)curl_easy_setopt(pCURL, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTPS); +#endif // write function (void)curl_easy_setopt(pCURL, CURLOPT_WRITEDATA, &out); @@ -241,7 +244,7 @@ static bool curl_run(std::u16string_view rURL, OutData& out, const OString& aPro // progress handler - Condition::check unfortunately is not defined const (void)curl_easy_setopt(pCURL, CURLOPT_NOPROGRESS, 0); - (void)curl_easy_setopt(pCURL, CURLOPT_PROGRESSFUNCTION, &progress_callback); + (void)curl_easy_setopt(pCURL, CURLOPT_XFERINFOFUNCTION, &progress_callback); (void)curl_easy_setopt(pCURL, CURLOPT_PROGRESSDATA, &out); // proxy @@ -274,9 +277,9 @@ static bool curl_run(std::u16string_view rURL, OutData& out, const OString& aPro { // this sometimes happens, when a user throws away his user data, but has already // completed the download of an update. - double fDownloadSize; - curl_easy_getinfo( pCURL, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &fDownloadSize ); - if ( -1 == fDownloadSize ) + curl_off_t nDownloadSize; + curl_easy_getinfo( pCURL, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &nDownloadSize ); + if ( -1 == nDownloadSize ) { out.Handler->downloadFinished(out.File); ret = true; @@ -290,7 +293,7 @@ static bool curl_run(std::u16string_view rURL, OutData& out, const OString& aPro // Only report errors when not stopped else { - OString aMessage("Unknown error"); + OString aMessage("Unknown error"_ostr); const char * error_message = curl_easy_strerror(cc); if( nullptr != error_message ) diff --git a/extensions/source/update/check/updatecheck.cxx b/extensions/source/update/check/updatecheck.cxx index b9b64a4dfb9c..66409b32f8b3 100644 --- a/extensions/source/update/check/updatecheck.cxx +++ b/extensions/source/update/check/updatecheck.cxx @@ -42,7 +42,7 @@ #include <osl/file.hxx> #include <sal/macros.h> #include <sal/log.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #ifdef _WIN32 #include <o3tl/safeCoInitUninit.hxx> @@ -55,7 +55,6 @@ namespace beans = com::sun::star::beans ; namespace deployment = com::sun::star::deployment ; -namespace frame = com::sun::star::frame ; namespace lang = com::sun::star::lang ; namespace c3s = com::sun::star::system ; namespace task = com::sun::star::task ; @@ -65,7 +64,7 @@ constexpr OUStringLiteral PROPERTY_TITLE = u"BubbleHeading"; constexpr OUStringLiteral PROPERTY_TEXT = u"BubbleText"; constexpr OUStringLiteral PROPERTY_SHOW_BUBBLE = u"BubbleVisible"; constexpr OUStringLiteral PROPERTY_CLICK_HDL = u"MenuClickHDL"; -constexpr OUStringLiteral PROPERTY_SHOW_MENUICON = u"MenuIconVisible"; +constexpr OUString PROPERTY_SHOW_MENUICON = u"MenuIconVisible"_ustr; // Returns the URL of the release note for the given position OUString getReleaseNote(const UpdateInfo& rInfo, sal_uInt8 pos, bool autoDownloadEnabled) @@ -96,16 +95,6 @@ OUString getBuildId() } -#if (defined LINUX || defined __sun) -OUString getBaseInstallation() -{ - OUString aPathVal("$BRAND_BASE_DIR"); - rtl::Bootstrap::expandMacros(aPathVal); - return aPathVal; -} -#endif - - bool isObsoleteUpdateInfo(std::u16string_view rBuildId) { return rBuildId != getBuildId() && !rBuildId.empty(); @@ -206,7 +195,7 @@ uno::Reference< beans::XPropertySet > createMenuBarUI( xServiceManager->createInstanceWithContext( "com.sun.star.setup.UpdateCheckUI", xContext ), uno::UNO_QUERY_THROW); - xMenuBarUI->setPropertyValue( PROPERTY_CLICK_HDL, uno::makeAny( xJob ) ); + xMenuBarUI->setPropertyValue( PROPERTY_CLICK_HDL, uno::Any( xJob ) ); return xMenuBarUI; } @@ -325,22 +314,6 @@ private: }; -class ShutdownThread : public osl::Thread -{ -public: - explicit ShutdownThread(const uno::Reference<uno::XComponentContext>& xContext); - - virtual void SAL_CALL run() override; - virtual void SAL_CALL onTerminated() override; - -protected: - virtual ~ShutdownThread() override; - -private: - osl::Condition m_aCondition; - const uno::Reference<uno::XComponentContext> m_xContext; -}; - UpdateCheckThread::UpdateCheckThread( osl::Condition& rCondition, const uno::Reference<uno::XComponentContext>& xContext, @@ -542,7 +515,7 @@ UpdateCheckThread::run() // Increase next by 15, 60, .. minutes static const sal_Int32 nRetryInterval[] = { 900, 3600, 14400, 86400 }; - if( n < SAL_N_ELEMENTS(nRetryInterval) ) + if( n < std::size(nRetryInterval) ) ++n; tv.Seconds = nRetryInterval[n-1]; @@ -650,15 +623,14 @@ DownloadThread::run() if( ! m_aDownload.start(m_aURL, aLocalFile, aDownloadDest ) ) { // retry every 15s unless the dialog is not visible - TimeValue tv; - tv.Seconds = 15; + TimeValue tv(15, 0); if( ! UpdateCheck::get()->isDialogShowing() ) { // Increase next by 1, 5, 15, 60, .. minutes static const sal_Int16 nRetryInterval[] = { 60, 300, 900, 3600 }; - if( n < SAL_N_ELEMENTS(nRetryInterval) ) + if( n < std::size(nRetryInterval) ) ++n; tv.Seconds = nRetryInterval[n-1]; @@ -700,45 +672,6 @@ void SAL_CALL DownloadThread::onTerminated() } -ShutdownThread::ShutdownThread( const uno::Reference<uno::XComponentContext>& xContext) : - m_xContext( xContext ) -{ - create(); -} - - -ShutdownThread::~ShutdownThread() -{ -} - - -void SAL_CALL -ShutdownThread::run() -{ - osl_setThreadName("ShutdownThread"); - - TimeValue tv = { 0, 250 }; - - m_aCondition.wait(&tv); - - // Tell QuickStarter not to veto .. - uno::Reference< css::beans::XFastPropertySet > xQuickStarter = css::office::Quickstart::createDefault(m_xContext); - - xQuickStarter->setFastPropertyValue(0, uno::makeAny(false)); - - // Shutdown the office - uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(m_xContext); - - xDesktop->terminate(); -} - - -void SAL_CALL ShutdownThread::onTerminated() -{ - delete this; -} - - } // anonymous namespace UpdateCheck::UpdateCheck() @@ -909,50 +842,6 @@ UpdateCheck::download() void -UpdateCheck::install() -{ - std::scoped_lock aGuard(m_aMutex); - - const uno::Reference< c3s::XSystemShellExecute > xShellExecute = c3s::SystemShellExecute::create( m_xContext ); - - try { - // Construct install command ?? - - // Store release note for position 3 and 4 - OUString aURL(getReleaseNote(m_aUpdateInfo, 3)); - storeReleaseNote(1, aURL); - - aURL = getReleaseNote(m_aUpdateInfo, 4); - storeReleaseNote(2, aURL); - - OUString aInstallImage(m_aImageName); - osl::FileBase::getSystemPathFromFileURL(aInstallImage, aInstallImage); - - sal_Int32 nFlags; -#if (defined LINUX || defined __sun) - nFlags = 42; - OUString aParameter = getBaseInstallation(); - if( !aParameter.isEmpty() ) - osl::FileBase::getSystemPathFromFileURL(aParameter, aParameter); - - aParameter += " &"; -#else - nFlags = c3s::SystemShellExecuteFlags::DEFAULTS; - OUString const aParameter; -#endif - - rtl::Reference< UpdateCheckConfig > rModel = UpdateCheckConfig::get( m_xContext ); - rModel->clearLocalFileName(); - - xShellExecute->execute(aInstallImage, aParameter, nFlags); - new ShutdownThread( m_xContext ); - } catch(const uno::Exception&) { - m_aUpdateHandler->setErrorMessage( m_aUpdateHandler->getDefaultInstErrMsg() ); - } -} - - -void UpdateCheck::pause() { std::unique_lock aGuard(m_aMutex); @@ -1390,18 +1279,18 @@ void UpdateCheck::handleMenuBarUI( const rtl::Reference< UpdateHandler >& rUpdat { if( UPDATESTATE_NO_UPDATE_AVAIL == eState ) { - xMenuBarUI->setPropertyValue( PROPERTY_SHOW_MENUICON, uno::makeAny(false) ); + xMenuBarUI->setPropertyValue( PROPERTY_SHOW_MENUICON, uno::Any(false) ); } else { - xMenuBarUI->setPropertyValue( PROPERTY_TITLE, uno::makeAny(rUpdateHandler->getBubbleTitle(eState)) ); - xMenuBarUI->setPropertyValue( PROPERTY_TEXT, uno::makeAny(rUpdateHandler->getBubbleText(eState)) ); + xMenuBarUI->setPropertyValue( PROPERTY_TITLE, uno::Any(rUpdateHandler->getBubbleTitle(eState)) ); + xMenuBarUI->setPropertyValue( PROPERTY_TEXT, uno::Any(rUpdateHandler->getBubbleText(eState)) ); if( ! suppressBubble && ( ! rUpdateHandler->isVisible() || rUpdateHandler->isMinimized() ) ) - xMenuBarUI->setPropertyValue( PROPERTY_SHOW_BUBBLE, uno::makeAny( true ) ); + xMenuBarUI->setPropertyValue( PROPERTY_SHOW_BUBBLE, uno::Any( true ) ); if( UPDATESTATE_CHECKING != eState ) - xMenuBarUI->setPropertyValue( PROPERTY_SHOW_MENUICON, uno::makeAny(true) ); + xMenuBarUI->setPropertyValue( PROPERTY_SHOW_MENUICON, uno::Any(true) ); } } } @@ -1517,7 +1406,7 @@ UpdateCheck::storeReleaseNote(sal_Int8 nNum, const OUString &rURL) rc = aFile.open( osl_File_OpenFlag_Write | osl_File_OpenFlag_Create ); if ( rc != osl::FileBase::E_None ) return false; - OString aLineBuf("[InternetShortcut]\r\n"); + OString aLineBuf("[InternetShortcut]\r\n"_ostr); sal_uInt64 nWritten = 0; OUString aURL( rURL ); diff --git a/extensions/source/update/check/updatecheck.hxx b/extensions/source/update/check/updatecheck.hxx index 546616f574dd..7af355bc41ea 100644 --- a/extensions/source/update/check/updatecheck.hxx +++ b/extensions/source/update/check/updatecheck.hxx @@ -117,7 +117,6 @@ public: // IActionListener void cancel() override; void download() override; - void install() override; void pause() override; void resume() override; void closeAfterFailure() override; diff --git a/extensions/source/update/check/updatecheckconfig.cxx b/extensions/source/update/check/updatecheckconfig.cxx index 30e444051e3f..52deb59528fb 100644 --- a/extensions/source/update/check/updatecheckconfig.cxx +++ b/extensions/source/update/check/updatecheckconfig.cxx @@ -75,10 +75,6 @@ const char * const aUpdateEntryProperties[] = { const sal_uInt32 nUpdateEntryProperties = SAL_N_ELEMENTS(aUpdateEntryProperties); -NamedValueByNameAccess::~NamedValueByNameAccess() -{ -} - css::uno::Any NamedValueByNameAccess::getValue(const char * pName) { const sal_Int32 nLen = m_rValues.getLength(); @@ -143,14 +139,14 @@ UpdateCheckROModel::getUpdateEntry(UpdateInfo& rInfo) const bool isDirectDownload = false; m_aNameAccess.getValue(IS_DIRECT_DOWNLOAD) >>= isDirectDownload; - rInfo.Sources.push_back( DownloadSource( isDirectDownload, getStringValue(DOWNLOAD_URL) ) ); + rInfo.Sources.emplace_back(isDirectDownload, getStringValue(DOWNLOAD_URL)); for(sal_Int32 n=1; n < 6; ++n ) { OUString aUStr = getStringValue( OString(OString::Concat(RELEASE_NOTE) + OString::number(n)).getStr()); if( !aUStr.isEmpty() ) - rInfo.ReleaseNotes.push_back(ReleaseNote(static_cast<sal_Int8>(n), aUStr)); + rInfo.ReleaseNotes.emplace_back(static_cast<sal_Int8>(n), aUStr); } } @@ -187,13 +183,13 @@ OUString UpdateCheckConfig::getAllUsersDirectory() OUString aRet; #ifdef _WIN32 - WCHAR szPath[MAX_PATH]; - - if (TRUE == SHGetSpecialFolderPathW(nullptr, szPath, CSIDL_COMMON_DOCUMENTS, true)) + PWSTR szPath = nullptr; + if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_PublicDocuments, KF_FLAG_CREATE, nullptr, &szPath))) { aRet = o3tl::toU(szPath); osl::FileBase::getFileURLFromSystemPath( aRet, aRet ); } + CoTaskMemFree(szPath); #else osl::FileBase::getTempDirURL(aRet); #endif @@ -320,7 +316,7 @@ UpdateCheckConfig::storeLocalFileName(const OUString& rLocalFileName, sal_Int64 { const sal_uInt8 nItems = 2; const OUString aNameList[nItems] = { OUString(LOCAL_FILE), OUString(DOWNLOAD_SIZE) }; - const uno::Any aValueList[nItems] = { uno::makeAny(rLocalFileName), uno::makeAny(nFileSize) }; + const uno::Any aValueList[nItems] = { uno::Any(rLocalFileName), uno::Any(nFileSize) }; for( sal_uInt8 i=0; i < nItems; ++i ) { @@ -351,7 +347,7 @@ UpdateCheckConfig::clearLocalFileName() void UpdateCheckConfig::storeDownloadPaused(bool paused) { - replaceByName(DOWNLOAD_PAUSED , uno::makeAny(paused)); + replaceByName(DOWNLOAD_PAUSED , uno::Any(paused)); commitChanges(); } @@ -363,7 +359,7 @@ UpdateCheckConfig::updateLastChecked() sal_Int64 lastCheck = systime.Seconds; - replaceByName(LAST_CHECK, uno::makeAny(lastCheck)); + replaceByName(LAST_CHECK, uno::Any(lastCheck)); } void @@ -374,17 +370,17 @@ UpdateCheckConfig::storeUpdateFound( const UpdateInfo& rInfo, const OUString& aC uno::Any aValues[nUpdateEntryProperties] = { - uno::makeAny(rInfo.Version), - uno::makeAny(rInfo.BuildId), - uno::makeAny(rInfo.Description), - uno::makeAny(rInfo.Sources[0].URL), - uno::makeAny(rInfo.Sources[0].IsDirect), - uno::makeAny(getReleaseNote(rInfo, 1, autoDownloadEnabled) ), - uno::makeAny(getReleaseNote(rInfo, 2, autoDownloadEnabled) ), - uno::makeAny(getReleaseNote(rInfo, 3, autoDownloadEnabled) ), - uno::makeAny(getReleaseNote(rInfo, 4, autoDownloadEnabled) ), - uno::makeAny(getReleaseNote(rInfo, 5, autoDownloadEnabled) ), - uno::makeAny(aCurrentBuild) + uno::Any(rInfo.Version), + uno::Any(rInfo.BuildId), + uno::Any(rInfo.Description), + uno::Any(rInfo.Sources[0].URL), + uno::Any(rInfo.Sources[0].IsDirect), + uno::Any(getReleaseNote(rInfo, 1, autoDownloadEnabled) ), + uno::Any(getReleaseNote(rInfo, 2, autoDownloadEnabled) ), + uno::Any(getReleaseNote(rInfo, 3, autoDownloadEnabled) ), + uno::Any(getReleaseNote(rInfo, 4, autoDownloadEnabled) ), + uno::Any(getReleaseNote(rInfo, 5, autoDownloadEnabled) ), + uno::Any(aCurrentBuild) }; OUString aName; @@ -416,7 +412,7 @@ UpdateCheckConfig::clearUpdateFound() } catch(const lang::WrappedTargetException& ) { // Can not remove value, probably in share layer OSL_ASSERT(false); - m_xContainer->replaceByName(aName, uno::makeAny(OUString())); + m_xContainer->replaceByName(aName, uno::Any(OUString())); } } diff --git a/extensions/source/update/check/updatecheckconfig.hxx b/extensions/source/update/check/updatecheckconfig.hxx index 75e65e6e8be0..a9836c624822 100644 --- a/extensions/source/update/check/updatecheckconfig.hxx +++ b/extensions/source/update/check/updatecheckconfig.hxx @@ -40,8 +40,6 @@ public: const css::uno::Sequence< css::beans::NamedValue >& rValues) : m_rValues(rValues) {} ; - ~NamedValueByNameAccess(); - css::uno::Any getValue(const char * pName); }; diff --git a/extensions/source/update/check/updatecheckjob.cxx b/extensions/source/update/check/updatecheckjob.cxx index 82d2f7439ba2..b79c438108ee 100644 --- a/extensions/source/update/check/updatecheckjob.cxx +++ b/extensions/source/update/check/updatecheckjob.cxx @@ -30,7 +30,7 @@ #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XTerminateListener.hpp> @@ -97,6 +97,8 @@ public: private: uno::Reference<uno::XComponentContext> m_xContext; + + std::mutex m_mutex; uno::Reference< frame::XDesktop2 > m_xDesktop; std::unique_ptr< InitUpdateCheckJobThread > m_pInitThread; @@ -205,10 +207,13 @@ UpdateCheckJob::execute(const uno::Sequence<beans::NamedValue>& namedValues) OUString aEventName = getValue< OUString > (aEnvironment, "EventName"); - m_pInitThread.reset( - new InitUpdateCheckJobThread( - m_xContext, aConfig, - aEventName != "onFirstVisibleTask")); + auto thread = std::make_unique<InitUpdateCheckJobThread >( + m_xContext, aConfig, + aEventName != "onFirstVisibleTask"); + { + std::scoped_lock l(m_mutex); + m_pInitThread = std::move(thread); + } return uno::Any(); } @@ -274,13 +279,18 @@ UpdateCheckJob::supportsService( OUString const & serviceName ) // XEventListener void SAL_CALL UpdateCheckJob::disposing( lang::EventObject const & rEvt ) { - bool shutDown = ( rEvt.Source == m_xDesktop ); + css::uno::Reference<css::frame::XDesktop2> desktop; + { + std::scoped_lock l(m_mutex); + if ( rEvt.Source == m_xDesktop ) { + std::swap(m_xDesktop, desktop); + } + } - if ( shutDown && m_xDesktop.is() ) + if ( desktop.is() ) { terminateAndJoinThread(); - m_xDesktop->removeTerminateListener( this ); - m_xDesktop.clear(); + desktop->removeTerminateListener( this ); } } @@ -292,11 +302,15 @@ void SAL_CALL UpdateCheckJob::queryTermination( lang::EventObject const & ) void UpdateCheckJob::terminateAndJoinThread() { - if (m_pInitThread != nullptr) + std::unique_ptr<InitUpdateCheckJobThread> thread; + { + std::scoped_lock l(m_mutex); + std::swap(m_pInitThread, thread); + } + if (thread != nullptr) { - m_pInitThread->setTerminating(); - m_pInitThread->join(); - m_pInitThread.reset(); + thread->setTerminating(); + thread->join(); } } diff --git a/extensions/source/update/check/updatehdl.cxx b/extensions/source/update/check/updatehdl.cxx index b0ecb69e37f9..a5c6429aee69 100644 --- a/extensions/source/update/check/updatehdl.cxx +++ b/extensions/source/update/check/updatehdl.cxx @@ -17,6 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <cstddef> #include "updatehdl.hxx" #include <helpids.h> @@ -59,22 +62,22 @@ #include <strings.hrc> #include <unotools/resmgr.hxx> #include <tools/urlobj.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> -constexpr OUStringLiteral COMMAND_CLOSE = u"close"; +constexpr OUString COMMAND_CLOSE = u"close"_ustr; -constexpr OUStringLiteral CTRL_THROBBER = u"throbber"; -constexpr OUStringLiteral CTRL_PROGRESS = u"progress"; +constexpr OUString CTRL_THROBBER = u"throbber"_ustr; +constexpr OUString CTRL_PROGRESS = u"progress"_ustr; -constexpr OUStringLiteral TEXT_STATUS = u"text_status"; -constexpr OUStringLiteral TEXT_PERCENT = u"text_percent"; -constexpr OUStringLiteral TEXT_DESCRIPTION = u"text_description"; +constexpr OUString TEXT_STATUS = u"text_status"_ustr; +constexpr OUString TEXT_PERCENT = u"text_percent"_ustr; +constexpr OUString TEXT_DESCRIPTION = u"text_description"_ustr; constexpr OUStringLiteral FIXED_LINE_MODEL = u"com.sun.star.awt.UnoControlFixedLineModel"; -constexpr OUStringLiteral FIXED_TEXT_MODEL = u"com.sun.star.awt.UnoControlFixedTextModel"; -constexpr OUStringLiteral EDIT_FIELD_MODEL = u"com.sun.star.awt.UnoControlEditModel"; -constexpr OUStringLiteral BUTTON_MODEL = u"com.sun.star.awt.UnoControlButtonModel"; -constexpr OUStringLiteral GROUP_BOX_MODEL = u"com.sun.star.awt.UnoControlGroupBoxModel"; +constexpr OUString FIXED_TEXT_MODEL = u"com.sun.star.awt.UnoControlFixedTextModel"_ustr; +constexpr OUString EDIT_FIELD_MODEL = u"com.sun.star.awt.UnoControlEditModel"_ustr; +constexpr OUString BUTTON_MODEL = u"com.sun.star.awt.UnoControlButtonModel"_ustr; +constexpr OUString GROUP_BOX_MODEL = u"com.sun.star.awt.UnoControlGroupBoxModel"_ustr; using namespace com::sun::star; @@ -142,7 +145,7 @@ void UpdateHandler::setDownloadBtnLabel( bool bAppendDots ) aLabel += "..."; setControlProperty( msButtonIDs[DOWNLOAD_BUTTON], "Label", uno::Any( aLabel ) ); - setControlProperty( msButtonIDs[DOWNLOAD_BUTTON], "HelpURL", uno::makeAny<OUString>( INET_HID_SCHEME + HID_CHECK_FOR_UPD_DOWNLOAD2 ) ); + setControlProperty( msButtonIDs[DOWNLOAD_BUTTON], "HelpURL", uno::Any(OUString( INET_HID_SCHEME + HID_CHECK_FOR_UPD_DOWNLOAD2 )) ); mbDownloadBtnHasDots = bAppendDots; } @@ -240,13 +243,13 @@ void UpdateHandler::setErrorMessage( const OUString& rErrorMsg ) } -void UpdateHandler::setDownloadFile( const OUString& rFilePath ) +void UpdateHandler::setDownloadFile( std::u16string_view rFilePath ) { - sal_Int32 nLast = rFilePath.lastIndexOf( '/' ); - if ( nLast != -1 ) + std::size_t nLast = rFilePath.rfind( '/' ); + if ( nLast != std::u16string_view::npos ) { - msDownloadFile = rFilePath.copy( nLast+1 ); - const OUString aDownloadURL = rFilePath.copy( 0, nLast ); + msDownloadFile = rFilePath.substr( nLast+1 ); + const OUString aDownloadURL(rFilePath.substr( 0, nLast )); osl::FileBase::getSystemPathFromFileURL( aDownloadURL, msDownloadPath ); } } @@ -284,15 +287,6 @@ OUString UpdateHandler::getBubbleTitle( UpdateState eState ) } -OUString UpdateHandler::getDefaultInstErrMsg() -{ - osl::MutexGuard aGuard( maMutex ); - - loadStrings(); - - return substVariables( msInstallError ); -} - // XActionListener void SAL_CALL UpdateHandler::disposing( const lang::EventObject& rEvt ) @@ -347,10 +341,6 @@ void SAL_CALL UpdateHandler::actionPerformed( awt::ActionEvent const & rEvent ) case DOWNLOAD_BUTTON: mxActionListener->download(); break; - case INSTALL_BUTTON: - if ( showWarning( msInstallMessage ) ) - mxActionListener->install(); - break; case PAUSE_BUTTON: mxActionListener->pause(); break; @@ -570,10 +560,8 @@ void UpdateHandler::updateState( UpdateState eState ) break; case UPDATESTATE_DOWNLOAD_AVAIL: showControls( 0 ); - enableControls( (1<<CLOSE_BUTTON) + (1<<INSTALL_BUTTON) ); setControlProperty( TEXT_STATUS, "Text", uno::Any( substVariables(msReady2Install) ) ); setControlProperty( TEXT_DESCRIPTION, "Text", uno::Any( substVariables(msDownloadDescr) ) ); - focusControl( INSTALL_BUTTON ); break; case UPDATESTATE_AUTO_START: case UPDATESTATES_COUNT: @@ -624,8 +612,6 @@ void UpdateHandler::loadStrings() msDownloading = loadString( loc, RID_UPDATE_STR_DOWNLOADING ); msReady2Install = loadString( loc, RID_UPDATE_STR_READY_INSTALL ); msCancelMessage = loadString( loc, RID_UPDATE_STR_CANCEL_DOWNLOAD ); - msInstallMessage = loadString( loc, RID_UPDATE_STR_BEGIN_INSTALL ); - msInstallError = loadString( loc, RID_UPDATE_STR_INSTALL_ERROR ); msOverwriteWarning = loadString( loc, RID_UPDATE_STR_OVERWRITE_WARNING ); msPercent = loadString( loc, RID_UPDATE_STR_PERCENT ); msReloadWarning = loadString( loc, RID_UPDATE_STR_RELOAD_WARNING ); @@ -637,7 +623,6 @@ void UpdateHandler::loadStrings() msClose = loadString( loc, RID_UPDATE_BTN_CLOSE ); msDownload = loadString( loc, RID_UPDATE_BTN_DOWNLOAD ); - msInstall = loadString( loc, RID_UPDATE_BTN_INSTALL ); msPauseBtn = loadString( loc, RID_UPDATE_BTN_PAUSE ); msResumeBtn = loadString( loc, RID_UPDATE_BTN_RESUME ); msCancelBtn = loadString( loc, RID_UPDATE_BTN_CANCEL ); @@ -880,7 +865,7 @@ bool UpdateHandler::showWarning( const OUString &rWarningText, { uno::Sequence< uno::Reference< awt::XWindow > > xChildren = xMsgBoxCtrls->getWindows(); - for ( uno::Reference< awt::XWindow > const & child : std::as_const(xChildren) ) + for (uno::Reference<awt::XWindow> const& child : xChildren) { uno::Reference< awt::XVclWindowPeer > xMsgBoxCtrl( child, uno::UNO_QUERY ); if ( xMsgBoxCtrl.is() ) @@ -1032,7 +1017,7 @@ void UpdateHandler::createDialog() xPropSet->setPropertyValue( "PositionY", uno::Any(sal_Int32( 100 )) ); xPropSet->setPropertyValue( "Width", uno::Any(sal_Int32( DIALOG_WIDTH )) ); xPropSet->setPropertyValue( "Height", uno::Any(sal_Int32( DIALOG_HEIGHT )) ); - xPropSet->setPropertyValue( "HelpURL", uno::makeAny<OUString>( INET_HID_SCHEME + HID_CHECK_FOR_UPD_DLG ) ); + xPropSet->setPropertyValue( "HelpURL", uno::Any(OUString( INET_HID_SCHEME + HID_CHECK_FOR_UPD_DLG )) ); } { // Label (fixed text) <status> uno::Sequence< beans::NamedValue > aProps { { "Label", uno::Any( msStatusFL ) } }; @@ -1057,7 +1042,7 @@ void UpdateHandler::createDialog() { "MultiLine", uno::Any( true ) }, { "ReadOnly", uno::Any( true ) }, { "AutoVScroll", uno::Any( true ) }, - { "HelpURL", uno::makeAny<OUString>( INET_HID_SCHEME + HID_CHECK_FOR_UPD_STATUS ) } + { "HelpURL", uno::Any(OUString( INET_HID_SCHEME + HID_CHECK_FOR_UPD_STATUS )) } }; insertControlModel( xControlModel, EDIT_FIELD_MODEL, TEXT_STATUS, @@ -1090,7 +1075,7 @@ void UpdateHandler::createDialog() { "Enabled", uno::Any( true ) }, { "PushButtonType", uno::Any( sal_Int16(awt::PushButtonType_STANDARD) ) }, { "Label", uno::Any( msPauseBtn ) }, - { "HelpURL", uno::makeAny<OUString>( INET_HID_SCHEME + HID_CHECK_FOR_UPD_PAUSE ) } + { "HelpURL", uno::Any(OUString( INET_HID_SCHEME + HID_CHECK_FOR_UPD_PAUSE )) } }; insertControlModel ( xControlModel, BUTTON_MODEL, msButtonIDs[PAUSE_BUTTON], @@ -1104,7 +1089,7 @@ void UpdateHandler::createDialog() { "Enabled", uno::Any( true ) }, { "PushButtonType", uno::Any( sal_Int16(awt::PushButtonType_STANDARD) ) }, { "Label", uno::Any( msResumeBtn ) }, - { "HelpURL", uno::makeAny<OUString>( INET_HID_SCHEME + HID_CHECK_FOR_UPD_RESUME ) } + { "HelpURL", uno::Any(OUString( INET_HID_SCHEME + HID_CHECK_FOR_UPD_RESUME )) } }; insertControlModel ( xControlModel, BUTTON_MODEL, msButtonIDs[RESUME_BUTTON], @@ -1121,7 +1106,7 @@ void UpdateHandler::createDialog() { "Enabled", uno::Any( true ) }, { "PushButtonType", uno::Any( sal_Int16(awt::PushButtonType_STANDARD) ) }, { "Label", uno::Any( msCancelBtn ) }, - { "HelpURL", uno::makeAny<OUString>( INET_HID_SCHEME + HID_CHECK_FOR_UPD_CANCEL ) } + { "HelpURL", uno::Any(OUString( INET_HID_SCHEME + HID_CHECK_FOR_UPD_CANCEL )) } }; insertControlModel ( xControlModel, BUTTON_MODEL, msButtonIDs[CANCEL_BUTTON], @@ -1154,7 +1139,7 @@ void UpdateHandler::createDialog() { "MultiLine", uno::Any( true ) }, { "ReadOnly", uno::Any( true ) }, { "AutoVScroll", uno::Any( true ) }, - { "HelpURL", uno::makeAny<OUString>( INET_HID_SCHEME + HID_CHECK_FOR_UPD_DESCRIPTION ) } + { "HelpURL", uno::Any(OUString( INET_HID_SCHEME + HID_CHECK_FOR_UPD_DESCRIPTION )) } }; insertControlModel( xControlModel, EDIT_FIELD_MODEL, TEXT_DESCRIPTION, @@ -1183,27 +1168,13 @@ void UpdateHandler::createDialog() // setProperty( aProps, 2, "PushButtonType", uno::Any( sal_Int16(awt::PushButtonType_CANCEL) ) ); // [property] string Label // only if PushButtonType_STANDARD { "Label", uno::Any( msClose ) }, - { "HelpURL", uno::makeAny<OUString>( INET_HID_SCHEME + HID_CHECK_FOR_UPD_CLOSE ) } + { "HelpURL", uno::Any(OUString( INET_HID_SCHEME + HID_CHECK_FOR_UPD_CLOSE )) } }; insertControlModel ( xControlModel, BUTTON_MODEL, msButtonIDs[ CLOSE_BUTTON ], awt::Rectangle( CLOSE_BTN_X, BUTTON_Y_POS, BUTTON_WIDTH, BUTTON_HEIGHT ), aProps ); } - { // install button - uno::Sequence< beans::NamedValue > aProps - { - { "DefaultButton", uno::Any( false ) }, - { "Enabled", uno::Any( true ) }, - { "PushButtonType", uno::Any( sal_Int16(awt::PushButtonType_STANDARD) ) }, - { "Label", uno::Any( msInstall ) }, - { "HelpURL", uno::makeAny<OUString>( INET_HID_SCHEME + HID_CHECK_FOR_UPD_INSTALL ) } - }; - - insertControlModel ( xControlModel, BUTTON_MODEL, msButtonIDs[INSTALL_BUTTON], - awt::Rectangle( INSTALL_BTN_X, BUTTON_Y_POS, BUTTON_WIDTH, BUTTON_HEIGHT ), - aProps ); - } { // download button uno::Sequence< beans::NamedValue > aProps { @@ -1211,7 +1182,7 @@ void UpdateHandler::createDialog() { "Enabled", uno::Any( true ) }, { "PushButtonType", uno::Any( sal_Int16(awt::PushButtonType_STANDARD) ) }, { "Label", uno::Any( msDownload ) }, - { "HelpURL", uno::makeAny<OUString>( INET_HID_SCHEME + HID_CHECK_FOR_UPD_DOWNLOAD ) } + { "HelpURL", uno::Any(OUString( INET_HID_SCHEME + HID_CHECK_FOR_UPD_DOWNLOAD )) } }; insertControlModel ( xControlModel, BUTTON_MODEL, msButtonIDs[DOWNLOAD_BUTTON], diff --git a/extensions/source/update/check/updatehdl.hxx b/extensions/source/update/check/updatehdl.hxx index 6597176468bd..aa4e16fc765b 100644 --- a/extensions/source/update/check/updatehdl.hxx +++ b/extensions/source/update/check/updatehdl.hxx @@ -46,7 +46,6 @@ enum DialogControls CANCEL_BUTTON = 0, PAUSE_BUTTON, RESUME_BUTTON, - INSTALL_BUTTON, DOWNLOAD_BUTTON, CLOSE_BUTTON, HELP_BUTTON, @@ -111,8 +110,6 @@ private: OUString msDownloading; // RID_UPDATE_STR_DOWNLOADING OUString msReady2Install; // RID_UPDATE_STR_READY_INSTALL OUString msCancelMessage; // RID_UPDATE_STR_CANCEL_DOWNLOAD - OUString msInstallMessage; // RID_UPDATE_STR_BEGIN_INSTALL - OUString msInstallError; // RID_UPDATE_STR_INSTALL_ERROR OUString msOverwriteWarning; // RID_UPDATE_STR_OVERWRITE_WARNING OUString msPercent; // RID_UPDATE_STR_PERCENT OUString msReloadWarning; // RID_UPDATE_STR_OVERWRITE_WARNING @@ -122,7 +119,6 @@ private: OUString msDescription; // RID_UPDATE_FT_DESCRIPTION OUString msClose; // RID_UPDATE_BTN_CLOSE OUString msDownload; // RID_UPDATE_BTN_DOWNLOAD - OUString msInstall; // RID_UPDATE_BTN_INSTALL OUString msPauseBtn; // RID_UPDATE_BTN_PAUSE OUString msResumeBtn; // RID_UPDATE_BTN_RESUME OUString msCancelBtn; // RID_UPDATE_BTN_CANCEL @@ -166,14 +162,13 @@ public: void setProgress( sal_Int32 nPercent ); void setNextVersion( const OUString &rNextVersion ) { msNextVersion = rNextVersion; } void setDownloadPath( const OUString &rPath ) { msDownloadPath = rPath; } - void setDownloadFile( const OUString &rPath ); + void setDownloadFile( std::u16string_view rPath ); void setErrorMessage( const OUString &rErrorMsg ); void setDescription( const OUString &rDescription ){ msDescriptionMsg = rDescription; } void setState( UpdateState eState ); OUString getBubbleText( UpdateState eState ); OUString getBubbleTitle( UpdateState eState ); - OUString getDefaultInstErrMsg(); bool showWarning( const OUString &rWarning ) const; bool showWarning( const OUString &rWarning, const OUString& rBtnText_1, const OUString& rBtnText_2 ) const; bool showOverwriteWarning( std::u16string_view rFileName ) const; diff --git a/extensions/source/update/check/updateprotocol.cxx b/extensions/source/update/check/updateprotocol.cxx index db8319c799df..2fb6be85286a 100644 --- a/extensions/source/update/check/updateprotocol.cxx +++ b/extensions/source/update/check/updateprotocol.cxx @@ -163,7 +163,7 @@ checkForUpdates( OUString aType = xParent->getAttribute("type"); bool bIsDirect = !aType.equalsIgnoreAsciiCase("text/html"); - o_rUpdateInfo.Sources.push_back( DownloadSource(bIsDirect, xNode2->getNodeValue()) ); + o_rUpdateInfo.Sources.emplace_back(bIsDirect, xNode2->getNodeValue()); } } diff --git a/extensions/source/update/feed/updatefeed.cxx b/extensions/source/update/feed/updatefeed.cxx index c06328da7f79..556955b7123c 100644 --- a/extensions/source/update/feed/updatefeed.cxx +++ b/extensions/source/update/feed/updatefeed.cxx @@ -53,6 +53,7 @@ #include <sal/log.hxx> #include <osl/diagnose.h> #include <osl/conditn.hxx> +#include <utility> #include <vcl/svapp.hxx> namespace beans = com::sun::star::beans ; @@ -69,7 +70,7 @@ namespace xml = com::sun::star::xml ; namespace { -#ifdef DEBUG +#if OSL_DEBUG_LEVEL >= 2 class InputStreamWrapper : public ::cppu::WeakImplHelper< io::XInputStream > { @@ -159,10 +160,10 @@ public: virtual sal_Bool SAL_CALL supportsService(OUString const & serviceName) override; virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; - UpdateInformationProvider(const uno::Reference<uno::XComponentContext>& xContext, - const uno::Reference< ucb::XUniversalContentBroker >& xUniversalContentBroker, - const uno::Reference< xml::dom::XDocumentBuilder >& xDocumentBuilder, - const uno::Reference< xml::xpath::XXPathAPI >& xXPathAPI); + UpdateInformationProvider(uno::Reference<uno::XComponentContext> xContext, + uno::Reference< ucb::XUniversalContentBroker > xUniversalContentBroker, + uno::Reference< xml::dom::XDocumentBuilder > xDocumentBuilder, + uno::Reference< xml::xpath::XXPathAPI > xXPathAPI); protected: @@ -199,8 +200,8 @@ class UpdateInformationEnumeration : public ::cppu::WeakImplHelper< container::X { public: UpdateInformationEnumeration(const uno::Reference< xml::dom::XNodeList >& xNodeList, - const rtl::Reference< UpdateInformationProvider >& xUpdateInformationProvider) : - m_xUpdateInformationProvider(xUpdateInformationProvider), + rtl::Reference< UpdateInformationProvider > xUpdateInformationProvider) : + m_xUpdateInformationProvider(std::move(xUpdateInformationProvider)), m_xNodeList(xNodeList), m_nNodes(xNodeList.is() ? xNodeList->getLength() : 0), m_nCount(0) @@ -236,7 +237,7 @@ public: if( xContentNode.is() ) aEntry.UpdateDocument = m_xUpdateInformationProvider->getDocumentRoot(xContentNode); - return uno::makeAny(aEntry); + return uno::Any(aEntry); } catch( ucb::CommandAbortedException const &) { @@ -279,7 +280,7 @@ public: throw container::NoSuchElementException(OUString::number(m_nCount), *this); ++m_nCount; - return uno::makeAny(m_aEntry); + return uno::Any(m_aEntry); }; private: @@ -288,14 +289,14 @@ private: }; UpdateInformationProvider::UpdateInformationProvider( - const uno::Reference<uno::XComponentContext>& xContext, - const uno::Reference< ucb::XUniversalContentBroker >& xUniversalContentBroker, - const uno::Reference< xml::dom::XDocumentBuilder >& xDocumentBuilder, - const uno::Reference< xml::xpath::XXPathAPI >& xXPathAPI) - : m_xContext(xContext) - , m_xUniversalContentBroker(xUniversalContentBroker) - , m_xDocumentBuilder(xDocumentBuilder) - , m_xXPathAPI(xXPathAPI) + uno::Reference<uno::XComponentContext> xContext, + uno::Reference< ucb::XUniversalContentBroker > xUniversalContentBroker, + uno::Reference< xml::dom::XDocumentBuilder > xDocumentBuilder, + uno::Reference< xml::xpath::XXPathAPI > xXPathAPI) + : m_xContext(std::move(xContext)) + , m_xUniversalContentBroker(std::move(xUniversalContentBroker)) + , m_xDocumentBuilder(std::move(xDocumentBuilder)) + , m_xXPathAPI(std::move(xXPathAPI)) , m_aRequestHeaderList(2) , m_nCommandId(0) { @@ -364,7 +365,9 @@ OUString UpdateInformationProvider::getUserAgent(bool bExtended) aUserAgent = aUserAgent.replaceAll("<PRODUCT>", product); aUserAgent = aUserAgent.replaceAll("<OPTIONAL_OS_HW_DATA>", aExtended); SAL_INFO("extensions.update", "UpdateUserAgent: " << aUserAgent); - + // if you want to debug online updates from a dev version, then uncommenting this (adjust for platform) + // might be helpful + // return "LibreOffice 7.3.5.2 (184fe81b8c8c30d8b5082578aee2fed2ea847c01; Linux; X86_64; )"; return aUserAgent; } @@ -446,15 +449,13 @@ UpdateInformationProvider::load(const OUString& rURL) uno::Reference< ucb::XCommandProcessor > xCommandProcessor(m_xUniversalContentBroker->queryContent(xId), uno::UNO_QUERY_THROW); rtl::Reference< ActiveDataSink > aSink(new ActiveDataSink()); - // Disable KeepAlive in webdav - don't want millions of office - // instances phone home & clog up servers - uno::Sequence< beans::NamedValue > aProps { { "KeepAlive", uno::makeAny(false) } }; - ucb::OpenCommandArgument3 aOpenArgument; aOpenArgument.Mode = ucb::OpenMode::DOCUMENT; aOpenArgument.Priority = 32768; aOpenArgument.Sink = *aSink; - aOpenArgument.OpeningFlags = aProps; + // Disable KeepAlive in webdav - don't want millions of office + // instances phone home & clog up servers + aOpenArgument.OpeningFlags = { { "KeepAlive", uno::Any(false) } }; ucb::Command aCommand; aCommand.Name = "open"; diff --git a/extensions/source/update/ui/updatecheckui.cxx b/extensions/source/update/ui/updatecheckui.cxx index 6a4462669090..492cb92669ab 100644 --- a/extensions/source/update/ui/updatecheckui.cxx +++ b/extensions/source/update/ui/updatecheckui.cxx @@ -39,12 +39,12 @@ #include <bitmaps.hlst> -constexpr OUStringLiteral PROPERTY_TITLE = u"BubbleHeading"; -constexpr OUStringLiteral PROPERTY_TEXT = u"BubbleText"; -constexpr OUStringLiteral PROPERTY_IMAGE = u"BubbleImageURL"; -constexpr OUStringLiteral PROPERTY_SHOW_BUBBLE = u"BubbleVisible"; -constexpr OUStringLiteral PROPERTY_CLICK_HDL = u"MenuClickHDL"; -constexpr OUStringLiteral PROPERTY_SHOW_MENUICON = u"MenuIconVisible"; +constexpr OUString PROPERTY_TITLE = u"BubbleHeading"_ustr; +constexpr OUString PROPERTY_TEXT = u"BubbleText"_ustr; +constexpr OUString PROPERTY_IMAGE = u"BubbleImageURL"_ustr; +constexpr OUString PROPERTY_SHOW_BUBBLE = u"BubbleVisible"_ustr; +constexpr OUString PROPERTY_CLICK_HDL = u"MenuClickHDL"_ustr; +constexpr OUString PROPERTY_SHOW_MENUICON = u"MenuIconVisible"_ustr; using namespace ::com::sun::star; @@ -163,9 +163,7 @@ void SAL_CALL UpdateCheckUI::documentEventOccured(const document::DocumentEvent& SolarMutexGuard aGuard; if( rEvent.EventName == "OnPrepareViewClosing" ) - { - maBubbleManager.RemoveBubbleWindow(true); - } + maBubbleManager.RemoveBubbleWindow(); } void SAL_CALL UpdateCheckUI::disposing(const lang::EventObject&) |