reportdesign/inc/ReportDefinition.hxx    |    1 
 reportdesign/source/core/api/Group.cxx   |   10 +++++++--
 reportdesign/source/core/api/Groups.cxx  |    5 ++--
 reportdesign/source/core/api/Section.cxx |   33 ++++++++++++++++---------------
 reportdesign/source/core/inc/Group.hxx   |    7 ++++--
 reportdesign/source/core/inc/Groups.hxx  |    7 ++++--
 reportdesign/source/core/inc/Section.hxx |   16 +++++++++------
 7 files changed, 49 insertions(+), 30 deletions(-)

New commits:
commit 9939f5cbf044c7d671e7c9f55fa489e3e479f921
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue Oct 1 12:37:49 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Oct 1 15:17:51 2024 +0200

    use more concrete UNO types in reportdesign
    
    Change-Id: I29b3b85f8ff71d66ca874434d5412145e5cfb731
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174316
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/reportdesign/source/core/api/Groups.cxx 
b/reportdesign/source/core/api/Groups.cxx
index 375b8b0f545b..4a1170e4c6b8 100644
--- a/reportdesign/source/core/api/Groups.cxx
+++ b/reportdesign/source/core/api/Groups.cxx
@@ -18,6 +18,7 @@
  */
 #include <Groups.hxx>
 #include <Group.hxx>
+#include <ReportDefinition.hxx>
 #include <com/sun/star/lang/NoSupportException.hpp>
 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
 #include <o3tl/safeint.hxx>
@@ -30,7 +31,7 @@ namespace reportdesign
 
     using namespace com::sun::star;
 
-OGroups::OGroups(const uno::Reference< report::XReportDefinition >& 
_xParent,uno::Reference< uno::XComponentContext > context)
+OGroups::OGroups(const rtl::Reference< OReportDefinition >& 
_xParent,uno::Reference< uno::XComponentContext > context)
 :GroupsBase(m_aMutex)
 ,m_aContainerListeners(m_aMutex)
 ,m_xContext(std::move(context))
@@ -64,7 +65,7 @@ void SAL_CALL OGroups::disposing()
 // XGroups
 uno::Reference< report::XReportDefinition > SAL_CALL 
OGroups::getReportDefinition()
 {
-    return m_xParent;
+    return m_xParent.get();
 }
 
 uno::Reference< report::XGroup > SAL_CALL OGroups::createGroup(  )
diff --git a/reportdesign/source/core/inc/Groups.hxx 
b/reportdesign/source/core/inc/Groups.hxx
index c8d93189b2e9..d02524888580 100644
--- a/reportdesign/source/core/inc/Groups.hxx
+++ b/reportdesign/source/core/inc/Groups.hxx
@@ -23,12 +23,15 @@
 #include <cppuhelper/compbase.hxx>
 #include <cppuhelper/basemutex.hxx>
 #include <comphelper/interfacecontainer3.hxx>
+#include <unotools/weakref.hxx>
 #include <com/sun/star/uno/XComponentContext.hpp>
 #include <vector>
 
 
 namespace reportdesign
 {
+    class OReportDefinition;
+
     typedef ::cppu::WeakComponentImplHelper< css::report::XGroups> GroupsBase;
     /**       * \ingroup reportdesign_api
@@ -40,7 +43,7 @@ namespace reportdesign
         typedef ::std::vector< css::uno::Reference< css::report::XGroup > > 
TGroups;
         
::comphelper::OInterfaceContainerHelper3<css::container::XContainerListener> 
m_aContainerListeners;
         css::uno::Reference< css::uno::XComponentContext >            
m_xContext;
-        css::uno::WeakReference< css::report::XReportDefinition >     
m_xParent;
+        unotools::WeakReference< OReportDefinition >                  
m_xParent;
         TGroups                                                       
m_aGroups;
     private:
         OGroups& operator=(const OGroups&) = delete;
@@ -57,7 +60,7 @@ namespace reportdesign
 
         virtual void SAL_CALL disposing() override;
     public:
-        OGroups( const css::uno::Reference< css::report::XReportDefinition >& 
_xParent
+        OGroups( const rtl::Reference< OReportDefinition >& _xParent
                 ,css::uno::Reference< css::uno::XComponentContext > context);
 
     // XGroups
commit a9dcb13707a0dea6d04d55d66383078128cfe232
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue Oct 1 12:17:35 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Oct 1 15:17:42 2024 +0200

    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.gran...@collabora.co.uk>

diff --git a/reportdesign/inc/ReportDefinition.hxx 
b/reportdesign/inc/ReportDefinition.hxx
index 1d56882b5c36..f2f3fb18577c 100644
--- a/reportdesign/inc/ReportDefinition.hxx
+++ b/reportdesign/inc/ReportDefinition.hxx
@@ -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
diff --git a/reportdesign/source/core/api/Group.cxx 
b/reportdesign/source/core/api/Group.cxx
index ab368dda5940..d7fe730184a4 100644
--- a/reportdesign/source/core/api/Group.cxx
+++ b/reportdesign/source/core/api/Group.cxx
@@ -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()
diff --git a/reportdesign/source/core/api/Section.cxx 
b/reportdesign/source/core/api/Section.cxx
index 45cdb8b35110..59ea0280956b 100644
--- a/reportdesign/source/core/api/Section.cxx
+++ b/reportdesign/source/core/api/Section.cxx
@@ -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() )
+    rtl::Reference< OReportDefinition > xRet = m_xReportDefinition;
+    if (xRet.is())
+        return xRet;
+    rtl::Reference< OGroup > xGroup = m_xGroup;
+    if ( xGroup.is() )
     {
-        uno::Reference< report::XGroups> xGroups(xGroup->getGroups());
+        rtl::Reference< OGroups> xGroups(xGroup->getOGroups());
         if ( xGroups.is() )
-            xRet = xGroups->getReportDefinition();
+            return xGroups->getReportDefinition();
     }
-
-    return xRet;
+    return {};
 }
 
 // XChild
diff --git a/reportdesign/source/core/inc/Group.hxx 
b/reportdesign/source/core/inc/Group.hxx
index 681e24a0f459..67a4b5b5ebd1 100644
--- a/reportdesign/source/core/inc/Group.hxx
+++ b/reportdesign/source/core/inc/Group.hxx
@@ -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
diff --git a/reportdesign/source/core/inc/Section.hxx 
b/reportdesign/source/core/inc/Section.hxx
index 7fd9ccffd9f5..595cc9596e8c 100644
--- a/reportdesign/source/core/inc/Section.hxx
+++ b/reportdesign/source/core/inc/Section.hxx
@@ -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( )

Reply via email to