... after changes that introduced and used OPropertyContainerHelper.
In file included from /home/mk/core/include/comphelper/propcontainerimplhelper.hxx:18,
from /home/mk/core/sc/inc/chartuno.hxx:34,
from /home/mk/core/sc/source/ui/unoobj/cellsuno.cxx:83:
/home/mk/core/include/comphelper/propcontainerimplhelper.hxx: In instantiation of ‘class comphelper::OPropertyContainerImplHelper<comphelper::WeakComponentImplHelper<com::sun::star::table::XTableChart, com::sun::star::document::XEmbeddedObjectSupplier, com::sun::star::container::XNamed, com::sun::star::lang::XServiceInfo>, ScChartObj>’:
/home/mk/core/sc/inc/chartuno.hxx:98:14: required from here
98 | public SfxListener
| ^~~~~~~~~~~
/home/mk/core/include/comphelper/propimplhelper.hxx:499:1: error: ‘com::sun::star::uno::Any comphelper::OPropertyImplHelper<BaseClass, Ifc>::getFastPropertyValue(sal_Int32) [with BaseClass = comphelper::WeakComponentImplHelper<com::sun::star::table::XTableChart, com::sun::star::document::XEmbeddedObjectSupplier, com::sun::star::container::XNamed, com::sun::star::lang::XServiceInfo>; Ifc = {}; sal_Int32 = int]’ was hidden [-Werror=overloaded-virtual=]
499 | OPropertyImplHelper<BaseClass, Ifc...>::getFastPropertyValue(sal_Int32 nHandle)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mk/core/include/comphelper/propcontainerimplhelper.hxx:66:10: note: by ‘void comphelper::OPropertyContainerImplHelper<BaseClass, Derived, Ifc>::getFastPropertyValue(std::unique_lock<std::mutex>&, com::sun::star::uno::Any&, sal_Int32) const [with BaseClass = comphelper::WeakComponentImplHelper<com::sun::star::table::XTableChart, com::sun::star::document::XEmbeddedObjectSupplier, com::sun::star::container::XNamed, com::sun::star::lang::XServiceInfo>; Derived = ScChartObj; Ifc = {}; sal_Int32 = int]’
66 | void getFastPropertyValue(std::unique_lock<std::mutex>&, css::uno::Any& rValue,
| ^~~~~~~~~~~~~~~~~~~~
and
/home/mk/core/chart2/source/tools/CachedDataSequence.cxx: In copy constructor ‘chart::CachedDataSequence::CachedDataSequence(const chart::CachedDataSequence&)’:
/home/mk/core/chart2/source/tools/CachedDataSequence.cxx:70:51: error: expected class-name before ‘(’ token
70 | : comphelper::OPropertyContainerImplHelper(),
| ^
/home/mk/core/chart2/source/tools/CachedDataSequence.cxx:69:1: error: base class ‘class comphelper::OPropertyContainerImplHelper<comphelper::WeakComponentImplHelper<com::sun::star::chart2::data::XDataSequence, com::sun::star::chart2::data::XNumericalDataSequence, com::sun::star::chart2::data::XTextualDataSequence, com::sun::star::util::XCloneable, com::sun::star::util::XModifyBroadcaster, com::sun::star::lang::XInitialization, com::sun::star::lang::XServiceInfo>, chart::CachedDataSequence>’ should be explicitly initialized in the copy constructor [-Werror=extra]
69 | CachedDataSequence::CachedDataSequence( const CachedDataSequence & rSource )
| ^~~~~~~~~~~~~~~~~~
and similar.
Change-Id: I913e139744a452ea992d9f574997353a760f4722
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/642
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit 3917b082b9f4530d305cd947ab47658f6883c4f1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205669
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
265 lines
8.2 KiB
C++
265 lines
8.2 KiB
C++
/* -*- 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 .
|
|
*/
|
|
|
|
#include <CachedDataSequence.hxx>
|
|
#include <CommonFunctors.hxx>
|
|
#include <ModifyListenerHelper.hxx>
|
|
|
|
#include <comphelper/sequenceashashmap.hxx>
|
|
#include <cppuhelper/supportsservice.hxx>
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
using ::com::sun::star::uno::Sequence;
|
|
using ::com::sun::star::uno::Reference;
|
|
using ::com::sun::star::uno::Any;
|
|
|
|
namespace
|
|
{
|
|
constexpr OUString lcl_aServiceName = u"com.sun.star.comp.chart.CachedDataSequence"_ustr;
|
|
|
|
enum
|
|
{
|
|
// PROP_SOURCE_IDENTIFIER,
|
|
PROP_NUMBERFORMAT_KEY,
|
|
PROP_PROPOSED_ROLE
|
|
};
|
|
} // anonymous namespace
|
|
|
|
namespace chart
|
|
{
|
|
|
|
CachedDataSequence::CachedDataSequence()
|
|
: m_eCurrentDataType( NUMERICAL ),
|
|
m_xModifyEventForwarder( new ModifyEventForwarder() )
|
|
{
|
|
registerProperties();
|
|
}
|
|
CachedDataSequence::CachedDataSequence( const Reference< uno::XComponentContext > & /*xContext*/ )
|
|
: m_eCurrentDataType( MIXED ),
|
|
m_xModifyEventForwarder( new ModifyEventForwarder() )
|
|
{
|
|
registerProperties();
|
|
}
|
|
|
|
CachedDataSequence::CachedDataSequence( const OUString & rSingleText )
|
|
: m_eCurrentDataType( TEXTUAL ),
|
|
m_aTextualSequence({rSingleText}),
|
|
m_xModifyEventForwarder( new ModifyEventForwarder() )
|
|
{
|
|
registerProperties();
|
|
}
|
|
|
|
CachedDataSequence::CachedDataSequence( const CachedDataSequence & rSource )
|
|
: CachedDataSequence_Base(),
|
|
m_nNumberFormatKey( rSource.m_nNumberFormatKey ),
|
|
m_sRole( rSource.m_sRole ),
|
|
m_eCurrentDataType( rSource.m_eCurrentDataType ),
|
|
m_xModifyEventForwarder( new ModifyEventForwarder() )
|
|
{
|
|
switch( m_eCurrentDataType )
|
|
{
|
|
case TEXTUAL:
|
|
m_aTextualSequence = rSource.m_aTextualSequence;
|
|
break;
|
|
case NUMERICAL:
|
|
m_aNumericalSequence = rSource.m_aNumericalSequence;
|
|
break;
|
|
case MIXED:
|
|
m_aMixedSequence = rSource.m_aMixedSequence;
|
|
break;
|
|
}
|
|
|
|
registerProperties();
|
|
}
|
|
|
|
CachedDataSequence::~CachedDataSequence()
|
|
{}
|
|
|
|
void CachedDataSequence::registerProperties()
|
|
{
|
|
registerProperty( u"NumberFormatKey"_ustr,
|
|
PROP_NUMBERFORMAT_KEY,
|
|
0, // PropertyAttributes
|
|
& m_nNumberFormatKey,
|
|
cppu::UnoType<decltype(m_nNumberFormatKey)>::get() );
|
|
|
|
registerProperty( u"Role"_ustr,
|
|
PROP_PROPOSED_ROLE,
|
|
0, // PropertyAttributes
|
|
& m_sRole,
|
|
cppu::UnoType<decltype(m_sRole)>::get() );
|
|
}
|
|
|
|
Sequence< double > CachedDataSequence::Impl_getNumericalData() const
|
|
{
|
|
if( m_eCurrentDataType == NUMERICAL )
|
|
return m_aNumericalSequence;
|
|
|
|
if( m_eCurrentDataType == TEXTUAL )
|
|
return CommonFunctors::convertToSequence(m_aTextualSequence, CommonFunctors::ToDouble());
|
|
|
|
OSL_ASSERT(m_eCurrentDataType == MIXED);
|
|
return CommonFunctors::convertToSequence(m_aMixedSequence, CommonFunctors::ToDouble());
|
|
}
|
|
|
|
Sequence< OUString > CachedDataSequence::Impl_getTextualData() const
|
|
{
|
|
if( m_eCurrentDataType == TEXTUAL )
|
|
return m_aTextualSequence;
|
|
|
|
if( m_eCurrentDataType == NUMERICAL )
|
|
return CommonFunctors::convertToSequence(m_aNumericalSequence, CommonFunctors::ToString());
|
|
|
|
OSL_ASSERT(m_eCurrentDataType == MIXED);
|
|
return CommonFunctors::convertToSequence(m_aMixedSequence, CommonFunctors::ToString());
|
|
}
|
|
|
|
Sequence< Any > CachedDataSequence::Impl_getMixedData() const
|
|
{
|
|
if( m_eCurrentDataType == MIXED )
|
|
return m_aMixedSequence;
|
|
|
|
if( m_eCurrentDataType == NUMERICAL )
|
|
return CommonFunctors::convertToSequence(m_aNumericalSequence, CommonFunctors::makeAny());
|
|
|
|
OSL_ASSERT(m_eCurrentDataType == TEXTUAL);
|
|
return CommonFunctors::convertToSequence(m_aTextualSequence, CommonFunctors::makeAny());
|
|
}
|
|
|
|
::cppu::IPropertyArrayHelper* CachedDataSequence::createArrayHelper() const
|
|
{
|
|
Sequence< beans::Property > aProps;
|
|
// describes all properties which have been registered in the ctor
|
|
describeProperties( aProps );
|
|
|
|
return new ::cppu::OPropertyArrayHelper( aProps );
|
|
}
|
|
|
|
OUString SAL_CALL CachedDataSequence::getImplementationName()
|
|
{
|
|
return lcl_aServiceName;
|
|
}
|
|
|
|
sal_Bool SAL_CALL CachedDataSequence::supportsService( const OUString& rServiceName )
|
|
{
|
|
return cppu::supportsService(this, rServiceName);
|
|
}
|
|
|
|
css::uno::Sequence< OUString > SAL_CALL CachedDataSequence::getSupportedServiceNames()
|
|
{
|
|
return {
|
|
lcl_aServiceName,
|
|
u"com.sun.star.chart2.data.DataSequence"_ustr,
|
|
u"com.sun.star.chart2.data.NumericalDataSequence"_ustr,
|
|
u"com.sun.star.chart2.data.TextualDataSequence"_ustr
|
|
};
|
|
}
|
|
|
|
// ________ XNumericalDataSequence ________
|
|
Sequence< double > SAL_CALL CachedDataSequence::getNumericalData()
|
|
{
|
|
std::unique_lock aGuard( m_aMutex );
|
|
|
|
if( m_eCurrentDataType == NUMERICAL )
|
|
return m_aNumericalSequence;
|
|
else
|
|
return Impl_getNumericalData();
|
|
}
|
|
|
|
// ________ XTextualDataSequence ________
|
|
Sequence< OUString > SAL_CALL CachedDataSequence::getTextualData()
|
|
{
|
|
std::unique_lock aGuard( m_aMutex );
|
|
|
|
if( m_eCurrentDataType == TEXTUAL )
|
|
return m_aTextualSequence;
|
|
else
|
|
return Impl_getTextualData();
|
|
}
|
|
|
|
// ________ XDataSequence ________
|
|
Sequence< Any > SAL_CALL CachedDataSequence::getData()
|
|
{
|
|
std::unique_lock aGuard( m_aMutex );
|
|
return Impl_getMixedData();
|
|
}
|
|
|
|
OUString SAL_CALL CachedDataSequence::getSourceRangeRepresentation()
|
|
{
|
|
return m_sRole;
|
|
}
|
|
|
|
Sequence< OUString > SAL_CALL CachedDataSequence::generateLabel( chart2::data::LabelOrigin /*eLabelOrigin*/ )
|
|
{
|
|
// return empty label, as we have no range representations to determine something useful
|
|
return Sequence< OUString >();
|
|
}
|
|
|
|
::sal_Int32 SAL_CALL CachedDataSequence::getNumberFormatKeyByIndex( ::sal_Int32 /*nIndex*/ )
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
Reference< util::XCloneable > SAL_CALL CachedDataSequence::createClone()
|
|
{
|
|
return new CachedDataSequence( *this );
|
|
}
|
|
|
|
void SAL_CALL CachedDataSequence::addModifyListener( const Reference< util::XModifyListener >& aListener )
|
|
{
|
|
m_xModifyEventForwarder->addModifyListener( aListener );
|
|
}
|
|
|
|
void SAL_CALL CachedDataSequence::removeModifyListener( const Reference< util::XModifyListener >& aListener )
|
|
{
|
|
m_xModifyEventForwarder->removeModifyListener( aListener );
|
|
}
|
|
|
|
// lang::XInitialization:
|
|
void SAL_CALL CachedDataSequence::initialize(const uno::Sequence< uno::Any > & _aArguments)
|
|
{
|
|
::comphelper::SequenceAsHashMap aMap(_aArguments);
|
|
m_aNumericalSequence = aMap.getUnpackedValueOrDefault( u"DataSequence"_ustr ,m_aNumericalSequence);
|
|
if ( m_aNumericalSequence.hasElements() )
|
|
m_eCurrentDataType = NUMERICAL;
|
|
else
|
|
{
|
|
m_aTextualSequence = aMap.getUnpackedValueOrDefault( u"DataSequence"_ustr ,m_aTextualSequence);
|
|
if ( m_aTextualSequence.hasElements() )
|
|
m_eCurrentDataType = TEXTUAL;
|
|
else
|
|
{
|
|
m_aMixedSequence = aMap.getUnpackedValueOrDefault( u"DataSequence"_ustr ,m_aMixedSequence);
|
|
if ( m_aMixedSequence.hasElements() )
|
|
m_eCurrentDataType = MIXED;
|
|
}
|
|
}
|
|
}
|
|
} // namespace chart
|
|
|
|
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
|
|
com_sun_star_comp_chart_CachedDataSequence_get_implementation(css::uno::XComponentContext *context,
|
|
css::uno::Sequence<css::uno::Any> const &)
|
|
{
|
|
return cppu::acquire(new ::chart::CachedDataSequence(context));
|
|
}
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|