use more concrete UNO types in reportdesign

Change-Id: I30e391c1d5166ad24e129a20db1d7403644f8791
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174315
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2024-10-01 12:17:35 +02:00
parent d5c0b3f93d
commit a9dcb13707
5 changed files with 41 additions and 26 deletions

View file

@ -192,7 +192,6 @@ namespace reportdesign
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
UNLESS_MERGELIBS_MORE(REPORTDESIGN_DLLPUBLIC) static std::shared_ptr<rptui::OReportModel> getSdrModel(const css::uno::Reference< css::report::XReportDefinition >& _xReportDefinition);
private:
DECLARE_XINTERFACE( )
DECLARE_XTYPEPROVIDER( )
// css::lang::XServiceInfo

View file

@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <Group.hxx>
#include <Groups.hxx>
#include <Section.hxx>
#include <com/sun/star/lang/NoSupportException.hpp>
#include <com/sun/star/report/GroupOn.hpp>
@ -35,7 +36,7 @@ namespace reportdesign
using namespace com::sun::star;
OGroup::OGroup(const uno::Reference< report::XGroups >& _xParent
OGroup::OGroup(const rtl::Reference< OGroups >& _xParent
,const uno::Reference< uno::XComponentContext >& _xContext)
:GroupBase(m_aMutex)
,GroupPropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,uno::Sequence< OUString >())
@ -205,7 +206,12 @@ void SAL_CALL OGroup::setKeepTogether( ::sal_Int16 _keeptogether )
uno::Reference< report::XGroups > SAL_CALL OGroup::getGroups()
{
return m_xParent;
return m_xParent.get();
}
rtl::Reference< OGroups > OGroup::getOGroups() const
{
return m_xParent.get();
}
OUString SAL_CALL OGroup::getExpression()

View file

@ -17,6 +17,8 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <Section.hxx>
#include <Group.hxx>
#include <Groups.hxx>
#include <comphelper/enumhelper.hxx>
#include <comphelper/servicehelper.hxx>
#include <cppuhelper/supportsservice.hxx>
@ -74,7 +76,7 @@ static uno::Sequence< OUString> lcl_getAbsent(bool _bPageSection)
}
uno::Reference<report::XSection> OSection::createOSection(
const uno::Reference< report::XReportDefinition >& xParentDef,
const rtl::Reference< OReportDefinition >& xParentDef,
const uno::Reference< uno::XComponentContext >& context,
bool const bPageSection)
{
@ -85,7 +87,7 @@ uno::Reference<report::XSection> OSection::createOSection(
}
uno::Reference<report::XSection> OSection::createOSection(
const uno::Reference< report::XGroup >& xParentGroup,
const rtl::Reference< OGroup >& xParentGroup,
const uno::Reference< uno::XComponentContext >& context)
{
rtl::Reference<OSection> pNew =
@ -95,8 +97,8 @@ uno::Reference<report::XSection> OSection::createOSection(
}
OSection::OSection(const uno::Reference< report::XReportDefinition >& xParentDef
,const uno::Reference< report::XGroup >& xParentGroup
OSection::OSection(const rtl::Reference< OReportDefinition >& xParentDef
,const rtl::Reference< OGroup >& xParentGroup
,const uno::Reference< uno::XComponentContext >& context
,uno::Sequence< OUString> const& rStrings)
:SectionBase(m_aMutex)
@ -282,7 +284,7 @@ void SAL_CALL OSection::setConditionalPrintExpression( const OUString& _conditio
void OSection::checkNotPageHeaderFooter()
{
::osl::MutexGuard aGuard(m_aMutex);
uno::Reference< report::XReportDefinition > xRet = m_xReportDefinition;
rtl::Reference< OReportDefinition > xRet = m_xReportDefinition;
if ( xRet.is() )
{
if ( xRet->getPageHeaderOn() && xRet->getPageHeader() == *this )
@ -368,7 +370,7 @@ void SAL_CALL OSection::setCanShrink( sal_Bool /*_canshrink*/ )
sal_Bool SAL_CALL OSection::getRepeatSection()
{
::osl::MutexGuard aGuard(m_aMutex);
uno::Reference< report::XGroup > xGroup = m_xGroup;
rtl::Reference< OGroup > xGroup = m_xGroup;
if ( !xGroup.is() )
throw beans::UnknownPropertyException();
return m_bRepeatSection;
@ -378,7 +380,7 @@ void SAL_CALL OSection::setRepeatSection( sal_Bool _repeatsection )
{
{
::osl::MutexGuard aGuard(m_aMutex);
uno::Reference< report::XGroup > xGroup = m_xGroup;
rtl::Reference< OGroup > xGroup = m_xGroup;
if ( !xGroup.is() )
throw beans::UnknownPropertyException();
}
@ -388,22 +390,23 @@ void SAL_CALL OSection::setRepeatSection( sal_Bool _repeatsection )
uno::Reference< report::XGroup > SAL_CALL OSection::getGroup()
{
::osl::MutexGuard aGuard(m_aMutex);
return m_xGroup;
return m_xGroup.get();
}
uno::Reference< report::XReportDefinition > SAL_CALL OSection::getReportDefinition()
{
::osl::MutexGuard aGuard(m_aMutex);
uno::Reference< report::XReportDefinition > xRet = m_xReportDefinition;
uno::Reference< report::XGroup > xGroup = m_xGroup;
if ( !xRet.is() && xGroup.is() )
{
uno::Reference< report::XGroups> xGroups(xGroup->getGroups());
if ( xGroups.is() )
xRet = xGroups->getReportDefinition();
}
rtl::Reference< OReportDefinition > xRet = m_xReportDefinition;
if (xRet.is())
return xRet;
rtl::Reference< OGroup > xGroup = m_xGroup;
if ( xGroup.is() )
{
rtl::Reference< OGroups> xGroups(xGroup->getOGroups());
if ( xGroups.is() )
return xGroups->getReportDefinition();
}
return {};
}
// XChild

View file

@ -28,10 +28,12 @@
#include <comphelper/uno3.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <rtl/ref.hxx>
#include <unotools/weakref.hxx>
namespace reportdesign
{
class OFunctions;
class OGroups;
typedef ::cppu::WeakComponentImplHelper< css::report::XGroup
, css::lang::XServiceInfo> GroupBase;
typedef ::cppu::PropertySetMixin< css::report::XGroup> GroupPropertySet;
@ -45,7 +47,7 @@ namespace reportdesign
,public GroupPropertySet
{
css::uno::Reference< css::uno::XComponentContext > m_xContext;
css::uno::WeakReference< css::report::XGroups > m_xParent;
unotools::WeakReference< OGroups > m_xParent;
css::uno::Reference< css::report::XSection> m_xHeader;
css::uno::Reference< css::report::XSection> m_xFooter;
rtl::Reference< OFunctions > m_xFunctions;
@ -100,7 +102,7 @@ namespace reportdesign
virtual void SAL_CALL disposing() override;
public:
OGroup(const css::uno::Reference< css::report::XGroups >& _xParent
OGroup(const rtl::Reference< OGroups >& _xParent
,const css::uno::Reference< css::uno::XComponentContext >& context);
DECLARE_XINTERFACE( )
@ -161,6 +163,7 @@ namespace reportdesign
{
cppu::WeakComponentImplHelperBase::removeEventListener(aListener);
}
rtl::Reference< OGroups > getOGroups() const;
};
} // namespace reportdesign

View file

@ -25,6 +25,7 @@
#include <comphelper/uno3.hxx>
#include <cppuhelper/propertysetmixin.hxx>
#include <comphelper/interfacecontainer3.hxx>
#include <unotools/weakref.hxx>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/drawing/XDrawPage.hpp>
#include <com/sun/star/drawing/XShapeGrouper.hpp>
@ -35,6 +36,9 @@
namespace reportdesign
{
class OGroup;
class OReportDefinition;
typedef ::cppu::WeakComponentImplHelper
< css::report::XSection
, css::lang::XServiceInfo
@ -55,8 +59,8 @@ namespace reportdesign
css::uno::Reference< css::drawing::XShapeGrouper > m_xDrawPage_ShapeGrouper;
css::uno::Reference< css::form::XFormsSupplier2 > m_xDrawPage_FormSupplier;
css::uno::Reference< css::lang::XUnoTunnel > m_xDrawPage_Tunnel;
css::uno::WeakReference< css::report::XGroup > m_xGroup;
css::uno::WeakReference< css::report::XReportDefinition > m_xReportDefinition;
unotools::WeakReference< OGroup > m_xGroup;
unotools::WeakReference< OReportDefinition > m_xReportDefinition;
OUString m_sName;
OUString m_sConditionalPrintExpression;
::sal_uInt32 m_nHeight;
@ -122,16 +126,16 @@ namespace reportdesign
virtual void SAL_CALL disposing() override;
private:
OSection(const css::uno::Reference< css::report::XReportDefinition >& xParentDef
,const css::uno::Reference< css::report::XGroup >& xParentGroup
OSection(const rtl::Reference< OReportDefinition >& xParentDef
,const rtl::Reference< OGroup >& xParentGroup
,const css::uno::Reference< css::uno::XComponentContext >& context,
css::uno::Sequence< OUString> const&);
public:
static css::uno::Reference< css::report::XSection>
createOSection(const css::uno::Reference< css::report::XReportDefinition >& _xParent
createOSection(const rtl::Reference< OReportDefinition >& _xParent
,const css::uno::Reference< css::uno::XComponentContext >& context,bool _bPageSection=false);
static css::uno::Reference< css::report::XSection>
createOSection(const css::uno::Reference< css::report::XGroup >& _xParent
createOSection(const rtl::Reference< OGroup >& _xParent
,const css::uno::Reference< css::uno::XComponentContext >& context);
DECLARE_XINTERFACE( )