diff --git a/extensions/source/propctrlr/cellbindinghandler.cxx b/extensions/source/propctrlr/cellbindinghandler.cxx index 8f190c50d0a2..252ad7009088 100644 --- a/extensions/source/propctrlr/cellbindinghandler.cxx +++ b/extensions/source/propctrlr/cellbindinghandler.cxx @@ -43,8 +43,8 @@ using namespace ::comphelper; CellBindingPropertyHandler::CellBindingPropertyHandler( const Reference& _rxContext) : PropertyHandlerComponent(_rxContext) - , m_pCellExchangeConverter(new DefaultEnumRepresentation( - *m_pInfoService, ::cppu::UnoType::get(), PROPERTY_ID_CELL_EXCHANGE_TYPE)) + , m_pCellExchangeConverter(new DefaultEnumRepresentation(::cppu::UnoType::get(), + PROPERTY_ID_CELL_EXCHANGE_TYPE)) { } diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index 2234c40959bf..b5d1c6a04ab8 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -1242,7 +1242,7 @@ namespace pcr bool bIsEnumProperty = ( nPropertyUIFlags & PROP_FLAG_ENUM ) != 0; if ( bIsEnumProperty || ( PROPERTY_ID_TARGET_FRAME == nPropId ) ) { - std::vector< OUString > aEnumValues = m_pInfoService->getPropertyEnumRepresentations( nPropId ); + std::vector aEnumValues = OPropertyInfoService::getPropertyEnumRepresentations(nPropId); std::vector< OUString >::const_iterator pStart = aEnumValues.begin(); std::vector< OUString >::const_iterator pEnd = aEnumValues.end(); @@ -2589,9 +2589,6 @@ namespace pcr bool FormComponentPropertyHandler::impl_dialogListSelection_nothrow( const OUString& _rProperty, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const { - OSL_PRECOND(m_pInfoService, "FormComponentPropertyHandler::impl_dialogListSelection_" - "nothrow: no property meta data!"); - OUString sPropertyUIName(OPropertyInfoService::getPropertyTranslation(OPropertyInfoService::getPropertyId(_rProperty))); ListSelectionDialog aDialog(impl_getDefaultDialogFrame_nothrow(), m_xComponent, _rProperty, sPropertyUIName); _rClearBeforeDialog.clear(); diff --git a/extensions/source/propctrlr/formmetadata.cxx b/extensions/source/propctrlr/formmetadata.cxx index 89aa853ee1d7..95da6495d5d8 100644 --- a/extensions/source/propctrlr/formmetadata.cxx +++ b/extensions/source/propctrlr/formmetadata.cxx @@ -511,7 +511,7 @@ sal_uInt32 OPropertyInfoService::getPropertyUIFlags(sal_Int32 _nId) return pInfo ? pInfo->nUIFlags : 0; } -std::vector OPropertyInfoService::getPropertyEnumRepresentations(sal_Int32 _nId) const +std::vector OPropertyInfoService::getPropertyEnumRepresentations(sal_Int32 _nId) { OSL_ENSURE(((getPropertyUIFlags(_nId) & PROP_FLAG_ENUM) != 0) || (_nId == PROPERTY_ID_TARGET_FRAME), @@ -708,10 +708,8 @@ const OPropertyInfoImpl* OPropertyInfoService::getPropertyInfo(sal_Int32 _nId) //= DefaultEnumRepresentation -DefaultEnumRepresentation::DefaultEnumRepresentation(const OPropertyInfoService& _rInfo, - const Type& _rType, sal_Int32 _nPropertyId) - : m_rMetaData(_rInfo) - , m_aType(_rType) +DefaultEnumRepresentation::DefaultEnumRepresentation(const Type& _rType, sal_Int32 _nPropertyId) + : m_aType(_rType) , m_nPropertyId(_nPropertyId) { } @@ -720,14 +718,15 @@ DefaultEnumRepresentation::~DefaultEnumRepresentation() {} std::vector DefaultEnumRepresentation::getDescriptions() const { - return m_rMetaData.getPropertyEnumRepresentations(m_nPropertyId); + return OPropertyInfoService::getPropertyEnumRepresentations(m_nPropertyId); } void DefaultEnumRepresentation::getValueFromDescription(const OUString& _rDescription, Any& _out_rValue) const { sal_uInt32 nPropertyUIFlags = OPropertyInfoService::getPropertyUIFlags(m_nPropertyId); - std::vector aEnumStrings = m_rMetaData.getPropertyEnumRepresentations(m_nPropertyId); + std::vector aEnumStrings + = OPropertyInfoService::getPropertyEnumRepresentations(m_nPropertyId); std::vector::const_iterator pos = std::find(aEnumStrings.begin(), aEnumStrings.end(), _rDescription); if (pos != aEnumStrings.end()) @@ -779,7 +778,8 @@ OUString DefaultEnumRepresentation::getDescriptionForValue(const Any& _rEnumValu // enum value starting with 1 --nIntValue; - std::vector aEnumStrings = m_rMetaData.getPropertyEnumRepresentations(m_nPropertyId); + std::vector aEnumStrings + = OPropertyInfoService::getPropertyEnumRepresentations(m_nPropertyId); 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 6693c329e876..14b9a05a846a 100644 --- a/extensions/source/propctrlr/formmetadata.hxx +++ b/extensions/source/propctrlr/formmetadata.hxx @@ -19,7 +19,6 @@ #pragma once -#include "propertyinfo.hxx" #include "enumrepresentation.hxx" namespace pcr @@ -28,7 +27,7 @@ struct OPropertyInfoImpl; //= OPropertyInfoService -class OPropertyInfoService final : public IPropertyInfoService +class OPropertyInfoService final { static std::size_t s_nCount; static OPropertyInfoImpl* s_pPropertyInfos; @@ -40,8 +39,7 @@ public: static OUString getPropertyHelpId(sal_Int32 _nId); static sal_Int16 getPropertyPos(sal_Int32 _nId); static sal_uInt32 getPropertyUIFlags(sal_Int32 _nId); - // IPropertyInfoService - virtual std::vector getPropertyEnumRepresentations(sal_Int32 _nId) const override; + static std::vector getPropertyEnumRepresentations(sal_Int32 _nId); static bool isComposeable(const OUString& _rPropertyName); @@ -61,19 +59,11 @@ private: class DefaultEnumRepresentation : public IPropertyEnumRepresentation { private: - const OPropertyInfoService& m_rMetaData; css::uno::Type m_aType; const sal_Int32 m_nPropertyId; public: - /** constructs an instance - - @param _rInfo - An instance implementing IPropertyInfoService. Must live at least as - long as the DefaultEnumRepresentation should live. - */ - DefaultEnumRepresentation(const OPropertyInfoService& _rInfo, const css::uno::Type& _rType, - sal_Int32 _nPropertyId); + DefaultEnumRepresentation(const css::uno::Type& _rType, sal_Int32 _nPropertyId); protected: virtual ~DefaultEnumRepresentation() override; diff --git a/extensions/source/propctrlr/propertyhandler.cxx b/extensions/source/propctrlr/propertyhandler.cxx index bef11bea8db7..723f217dd337 100644 --- a/extensions/source/propctrlr/propertyhandler.cxx +++ b/extensions/source/propctrlr/propertyhandler.cxx @@ -55,7 +55,6 @@ PropertyHandler::PropertyHandler(const Reference& _rxContext) , m_bSupportedPropertiesAreKnown(false) , m_aPropertyListeners(m_aMutex) , m_xContext(_rxContext) - , m_pInfoService(new OPropertyInfoService) { m_xTypeConverter = Converter::create(_rxContext); } @@ -141,7 +140,7 @@ Any SAL_CALL PropertyHandler::convertToPropertyValue(const OUString& _rPropertyN OUString sControlValue; OSL_VERIFY(_rControlValue >>= sControlValue); ::rtl::Reference aEnumConversion( - new DefaultEnumRepresentation(*m_pInfoService, aProperty.Type, nPropId)); + new DefaultEnumRepresentation(aProperty.Type, nPropId)); // TODO/UNOize: cache those converters? aEnumConversion->getValueFromDescription(sControlValue, aPropertyValue); } @@ -163,8 +162,8 @@ Any SAL_CALL PropertyHandler::convertToControlValue(const OUString& _rPropertyNa DBG_ASSERT(_rControlValueType.getTypeClass() == TypeClass_STRING, "PropertyHandler::convertToControlValue: ENUM, but not STRING?"); - ::rtl::Reference aEnumConversion(new DefaultEnumRepresentation( - *m_pInfoService, _rPropertyValue.getValueType(), nPropId)); + ::rtl::Reference aEnumConversion( + new DefaultEnumRepresentation(_rPropertyValue.getValueType(), nPropId)); // TODO/UNOize: cache those converters? return Any(aEnumConversion->getDescriptionForValue(_rPropertyValue)); } @@ -192,7 +191,7 @@ LineDescriptor SAL_CALL PropertyHandler::describePropertyLine( if ((OPropertyInfoService::getPropertyUIFlags(nPropId) & PROP_FLAG_ENUM) != 0) { aDescriptor.Control = PropertyHandlerHelper::createListBoxControl( - _rxControlFactory, m_pInfoService->getPropertyEnumRepresentations(nPropId), + _rxControlFactory, OPropertyInfoService::getPropertyEnumRepresentations(nPropId), PropertyHandlerHelper::requiresReadOnlyControl(rProperty.Attributes), false); } else diff --git a/extensions/source/propctrlr/propertyhandler.hxx b/extensions/source/propctrlr/propertyhandler.hxx index a4adbdeacf5e..b90e5ddc7533 100644 --- a/extensions/source/propctrlr/propertyhandler.hxx +++ b/extensions/source/propctrlr/propertyhandler.hxx @@ -75,8 +75,6 @@ protected: css::uno::Reference m_xComponentPropertyInfo; /// type converter, needed on various occasions css::uno::Reference m_xTypeConverter; - /// access to property meta data - std::unique_ptr m_pInfoService; protected: explicit PropertyHandler(const css::uno::Reference& _rxContext); diff --git a/extensions/source/propctrlr/propertyinfo.hxx b/extensions/source/propctrlr/propertyinfo.hxx deleted file mode 100644 index f9a51f8d9ff8..000000000000 --- a/extensions/source/propctrlr/propertyinfo.hxx +++ /dev/null @@ -1,45 +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 - -#include -#include -#include - - -namespace pcr -{ - - - //= IPropertyInfoService - - class SAL_NO_VTABLE IPropertyInfoService - { - public: - virtual std::vector< OUString > getPropertyEnumRepresentations(sal_Int32 _nId) const = 0; - - virtual ~IPropertyInfoService() { } - }; - - -} // namespace pcr - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/extensions/source/propctrlr/submissionhandler.cxx b/extensions/source/propctrlr/submissionhandler.cxx index ced1f86507e8..6a11da73fec8 100644 --- a/extensions/source/propctrlr/submissionhandler.cxx +++ b/extensions/source/propctrlr/submissionhandler.cxx @@ -281,7 +281,7 @@ namespace pcr { // available options are nearly the same as for the "normal" button type, but only the // first two options - aListEntries = m_pInfoService->getPropertyEnumRepresentations( PROPERTY_ID_BUTTONTYPE ); + aListEntries = OPropertyInfoService::getPropertyEnumRepresentations( PROPERTY_ID_BUTTONTYPE ); aListEntries.resize( 2 ); } break; @@ -354,7 +354,7 @@ namespace pcr case PROPERTY_ID_XFORMS_BUTTONTYPE: { ::rtl::Reference< IPropertyEnumRepresentation > aEnumConversion( - new DefaultEnumRepresentation( *m_pInfoService, ::cppu::UnoType::get(), PROPERTY_ID_BUTTONTYPE ) ); + new DefaultEnumRepresentation(::cppu::UnoType::get(), PROPERTY_ID_BUTTONTYPE ) ); // TODO/UNOize: make aEnumConversion a member? aEnumConversion->getValueFromDescription( sControlValue, aPropertyValue ); } @@ -396,7 +396,7 @@ namespace pcr case PROPERTY_ID_XFORMS_BUTTONTYPE: { ::rtl::Reference< IPropertyEnumRepresentation > aEnumConversion( - new DefaultEnumRepresentation( *m_pInfoService, _rPropertyValue.getValueType(), PROPERTY_ID_BUTTONTYPE ) ); + new DefaultEnumRepresentation(_rPropertyValue.getValueType(), PROPERTY_ID_BUTTONTYPE ) ); // TODO/UNOize: make aEnumConversion a member? aControlValue <<= aEnumConversion->getDescriptionForValue( _rPropertyValue ); } diff --git a/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx b/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx index 172af6135089..2296958293be 100644 --- a/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx +++ b/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx @@ -312,7 +312,7 @@ namespace pcr case PROPERTY_ID_XSD_WHITESPACES: { nControlType = PropertyControlType::ListBox; - aListEntries = m_pInfoService->getPropertyEnumRepresentations( PROPERTY_ID_XSD_WHITESPACES ); + aListEntries = OPropertyInfoService::getPropertyEnumRepresentations(PROPERTY_ID_XSD_WHITESPACES); } break; diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index f8886ffdcffb..3f35c8e92403 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -3536,7 +3536,6 @@ extensions/source/propctrlr/propertycontrolextender.cxx extensions/source/propctrlr/propertycontrolextender.hxx extensions/source/propctrlr/propertyeditor.cxx extensions/source/propctrlr/propertyeditor.hxx -extensions/source/propctrlr/propertyinfo.hxx extensions/source/propctrlr/propeventtranslation.cxx extensions/source/propctrlr/propeventtranslation.hxx extensions/source/propctrlr/pushbuttonnavigation.cxx