propctrlr: Make last OPropertyInfoService member static
As described for OPropertyInfoService::getPropertyId
in earlier commit
Change-Id: I849cfa251b8be73b9541ad154527fa47c75c26ae
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Thu Apr 2 14:16:23 2026 +0200
propctrlr: Make OPropertyInfoService::getPropertyId static, drop from iface
, also do for this OPropertyInfoService::getPropertyEnumRepresentations:
Drop the method from the abstract base class and make it static in
OPropertyInfoService.
This means that all OPropertyInfoService members are
static now, so there all instances of this class
can be dropped as well. Do so.
Also drop IPropertyInfoService that used to be the
abstract base class previously altogether.
Change-Id: Ic61ed216fff226faa46383d05cb095ebbd156fee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/203165
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
@@ -43,8 +43,8 @@ using namespace ::comphelper;
|
||||
CellBindingPropertyHandler::CellBindingPropertyHandler(
|
||||
const Reference<XComponentContext>& _rxContext)
|
||||
: PropertyHandlerComponent(_rxContext)
|
||||
, m_pCellExchangeConverter(new DefaultEnumRepresentation(
|
||||
*m_pInfoService, ::cppu::UnoType<sal_Int16>::get(), PROPERTY_ID_CELL_EXCHANGE_TYPE))
|
||||
, m_pCellExchangeConverter(new DefaultEnumRepresentation(::cppu::UnoType<sal_Int16>::get(),
|
||||
PROPERTY_ID_CELL_EXCHANGE_TYPE))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -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<OUString> 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();
|
||||
|
||||
@@ -511,7 +511,7 @@ sal_uInt32 OPropertyInfoService::getPropertyUIFlags(sal_Int32 _nId)
|
||||
return pInfo ? pInfo->nUIFlags : 0;
|
||||
}
|
||||
|
||||
std::vector<OUString> OPropertyInfoService::getPropertyEnumRepresentations(sal_Int32 _nId) const
|
||||
std::vector<OUString> 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<OUString> 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<OUString> aEnumStrings = m_rMetaData.getPropertyEnumRepresentations(m_nPropertyId);
|
||||
std::vector<OUString> aEnumStrings
|
||||
= OPropertyInfoService::getPropertyEnumRepresentations(m_nPropertyId);
|
||||
std::vector<OUString>::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<OUString> aEnumStrings = m_rMetaData.getPropertyEnumRepresentations(m_nPropertyId);
|
||||
std::vector<OUString> aEnumStrings
|
||||
= OPropertyInfoService::getPropertyEnumRepresentations(m_nPropertyId);
|
||||
if ((nIntValue >= 0) && (o3tl::make_unsigned(nIntValue) < aEnumStrings.size()))
|
||||
{
|
||||
sReturn = aEnumStrings[nIntValue];
|
||||
|
||||
@@ -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<OUString> getPropertyEnumRepresentations(sal_Int32 _nId) const override;
|
||||
static std::vector<OUString> 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;
|
||||
|
||||
@@ -55,7 +55,6 @@ PropertyHandler::PropertyHandler(const Reference<XComponentContext>& _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<IPropertyEnumRepresentation> 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<IPropertyEnumRepresentation> aEnumConversion(new DefaultEnumRepresentation(
|
||||
*m_pInfoService, _rPropertyValue.getValueType(), nPropId));
|
||||
::rtl::Reference<IPropertyEnumRepresentation> 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
|
||||
|
||||
@@ -75,8 +75,6 @@ protected:
|
||||
css::uno::Reference<css::beans::XPropertySetInfo> m_xComponentPropertyInfo;
|
||||
/// type converter, needed on various occasions
|
||||
css::uno::Reference<css::script::XTypeConverter> m_xTypeConverter;
|
||||
/// access to property meta data
|
||||
std::unique_ptr<OPropertyInfoService> m_pInfoService;
|
||||
|
||||
protected:
|
||||
explicit PropertyHandler(const css::uno::Reference<css::uno::XComponentContext>& _rxContext);
|
||||
|
||||
@@ -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 <sal/types.h>
|
||||
#include <rtl/ustring.hxx>
|
||||
#include <vector>
|
||||
|
||||
|
||||
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: */
|
||||
@@ -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<FormButtonType>::get(), PROPERTY_ID_BUTTONTYPE ) );
|
||||
new DefaultEnumRepresentation(::cppu::UnoType<FormButtonType>::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 );
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user