reportdesign/inc/ReportDefinition.hxx             |    5 ++
 reportdesign/inc/xmlExport.hxx                    |    8 ++--
 reportdesign/source/core/api/ReportDefinition.cxx |    1 
 reportdesign/source/filter/xml/xmlExport.cxx      |   39 +++++++++-------------
 4 files changed, 25 insertions(+), 28 deletions(-)

New commits:
commit dd5f380a784c5262fd43b425ab5d9925f2fe209d
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Jul 16 11:38:45 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Jul 16 15:46:23 2025 +0200

    reportdesign: Drop unnecessary mutable keyword
    
    There's no need for `m_xCellStylesPropertySetMapper`
    to be mutable, it's only set in the ctor.
    
    Change-Id: I383b80ebf293a129bdd006df2c3af44239c49064
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187949
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/reportdesign/inc/xmlExport.hxx b/reportdesign/inc/xmlExport.hxx
index 78d2851355c0..29b1403aaa6b 100644
--- a/reportdesign/inc/xmlExport.hxx
+++ b/reportdesign/inc/xmlExport.hxx
@@ -96,7 +96,7 @@ private:
     rtl::Reference < SvXMLExportPropertyMapper >      m_xParaPropMapper;
     rtl::Reference < XMLPropertyHandlerFactory >      m_xPropHdlFactory;
 
-    mutable rtl::Reference < XMLPropertySetMapper >   
m_xCellStylesPropertySetMapper;
+    rtl::Reference<XMLPropertySetMapper> m_xCellStylesPropertySetMapper;
     rtl::Reference<reportdesign::OReportDefinition> m_pReportDefinition;
     bool                                        m_bAllreadyFilled;
 
commit 3f615a8bcc594bdf61a9e617652424a9493dd55c
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Jul 16 11:22:10 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Jul 16 15:46:18 2025 +0200

    reportdesign: Use ref to concrete OReportDefinition
    
    The XReportDefinition used in ORptExport
    (set by calling ORptExport::setSourceDocument
    from OReportDefinition::WriteThroughComponent)
    is always an OReportDefinition.
    
    Use an rtl::Reference to that class instead
    of a reference to the abstract XReportDefinition.
    
    Background is to allow extending OReportDefinition
    as needed without having to adjust the XReportDefinition
    interface in the context of the
    "Implement ReportBuilder in C++" GSoC project [1]
    in the future.
    
    [1] https://lists.freedesktop.org/archives/libreoffice/2025-May/093278.html
    
    Change-Id: I5780fe7d7a809183d4dfb0018b37d6f2ed2ee36b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187948
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/reportdesign/inc/ReportDefinition.hxx 
b/reportdesign/inc/ReportDefinition.hxx
index ff80cc485636..a8cd809c3282 100644
--- a/reportdesign/inc/ReportDefinition.hxx
+++ b/reportdesign/inc/ReportDefinition.hxx
@@ -24,7 +24,6 @@
 #include "dllapi.h"
 
 #include "ReportHelperDefines.hxx"
-#include "xmlExport.hxx"
 
 #include <com/sun/star/datatransfer/XTransferable.hpp>
 #include <com/sun/star/document/XDocumentEventBroadcaster.hpp>
@@ -55,6 +54,10 @@ namespace rptui
 {
     class OReportModel;
 }
+namespace rptxml
+{
+    class ORptExport;
+}
 namespace utl
 {
     class MediaDescriptor;
diff --git a/reportdesign/inc/xmlExport.hxx b/reportdesign/inc/xmlExport.hxx
index b022fe29ab49..78d2851355c0 100644
--- a/reportdesign/inc/xmlExport.hxx
+++ b/reportdesign/inc/xmlExport.hxx
@@ -20,6 +20,8 @@
 #ifndef INCLUDED_REPORTDESIGN_SOURCE_FILTER_XML_XMLEXPORT_HXX
 #define INCLUDED_REPORTDESIGN_SOURCE_FILTER_XML_XMLEXPORT_HXX
 
+#include "ReportDefinition.hxx"
+
 #include <com/sun/star/container/XNamed.hpp>
 #include <com/sun/star/document/XFilter.hpp>
 #include <com/sun/star/document/XImporter.hpp>
@@ -95,7 +97,7 @@ private:
     rtl::Reference < XMLPropertyHandlerFactory >      m_xPropHdlFactory;
 
     mutable rtl::Reference < XMLPropertySetMapper >   
m_xCellStylesPropertySetMapper;
-    Reference<XReportDefinition>                    m_xReportDefinition;
+    rtl::Reference<reportdesign::OReportDefinition> m_pReportDefinition;
     bool                                        m_bAllreadyFilled;
 
     void                    exportReport(const Reference<XReportDefinition>& 
_xReportDefinition); /// <element name="office:report">
diff --git a/reportdesign/source/core/api/ReportDefinition.cxx 
b/reportdesign/source/core/api/ReportDefinition.cxx
index f68d7d34de17..a492cf5598f7 100644
--- a/reportdesign/source/core/api/ReportDefinition.cxx
+++ b/reportdesign/source/core/api/ReportDefinition.cxx
@@ -37,6 +37,7 @@
 #include <strings.hrc>
 #include <core_resource.hxx>
 #include <strings.hxx>
+#include <xmlExport.hxx>
 
 #include <com/sun/star/beans/PropertyAttribute.hpp>
 #include <com/sun/star/beans/XMultiPropertyStates.hpp>
diff --git a/reportdesign/source/filter/xml/xmlExport.cxx 
b/reportdesign/source/filter/xml/xmlExport.cxx
index 57a5d04bc666..4c2f6f247f94 100644
--- a/reportdesign/source/filter/xml/xmlExport.cxx
+++ b/reportdesign/source/filter/xml/xmlExport.cxx
@@ -1144,7 +1144,7 @@ void ORptExport::exportAutoStyle(const 
Reference<XSection>& _xProp)
         m_aAutoStyleNames.emplace( _xProp.get(),GetAutoStylePool()->Add( 
XmlStyleFamily::TABLE_TABLE, std::move(aPropertyStates) ));
 }
 
-void ORptExport::SetBodyAttributes() { 
exportReportAttributes(m_xReportDefinition); }
+void ORptExport::SetBodyAttributes() { 
exportReportAttributes(m_pReportDefinition); }
 
 void ORptExport::exportReportAttributes(const Reference<XReportDefinition>& 
_xReport)
 {
@@ -1178,7 +1178,7 @@ void ORptExport::exportReportAttributes(const 
Reference<XReportDefinition>& _xRe
         AddAttribute(XML_NAMESPACE_DRAW, XML_NAME,sName);
 }
 
-void ORptExport::ExportContent_() { exportReport(m_xReportDefinition); }
+void ORptExport::ExportContent_() { exportReport(m_pReportDefinition); }
 
 void ORptExport::ExportMasterStyles_()
 {
@@ -1191,24 +1191,24 @@ void ORptExport::collectComponentStyles()
         return;
 
     m_bAllreadyFilled = true;
-    if (!m_xReportDefinition.is())
+    if (!m_pReportDefinition.is())
         return;
 
-    uno::Reference<report::XSection> xParent(m_xReportDefinition->getParent(), 
uno::UNO_QUERY);
+    uno::Reference<report::XSection> xParent(m_pReportDefinition->getParent(), 
uno::UNO_QUERY);
     if ( xParent.is() )
-        exportAutoStyle(m_xReportDefinition.get());
+        
exportAutoStyle(css::uno::Reference<XReportDefinition>(m_pReportDefinition).get());
 
-    if (m_xReportDefinition->getReportHeaderOn())
-        exportSectionAutoStyle(m_xReportDefinition->getReportHeader());
-    if (m_xReportDefinition->getPageHeaderOn())
-        exportSectionAutoStyle(m_xReportDefinition->getPageHeader());
+    if (m_pReportDefinition->getReportHeaderOn())
+        exportSectionAutoStyle(m_pReportDefinition->getReportHeader());
+    if (m_pReportDefinition->getPageHeaderOn())
+        exportSectionAutoStyle(m_pReportDefinition->getPageHeader());
 
-    exportGroup(m_xReportDefinition, 0, true);
+    exportGroup(m_pReportDefinition, 0, true);
 
-    if (m_xReportDefinition->getPageFooterOn())
-        exportSectionAutoStyle(m_xReportDefinition->getPageFooter());
-    if (m_xReportDefinition->getReportFooterOn())
-        exportSectionAutoStyle(m_xReportDefinition->getReportFooter());
+    if (m_pReportDefinition->getPageFooterOn())
+        exportSectionAutoStyle(m_pReportDefinition->getPageFooter());
+    if (m_pReportDefinition->getReportFooterOn())
+        exportSectionAutoStyle(m_pReportDefinition->getReportFooter());
 }
 
 void ORptExport::ExportAutoStyles_()
@@ -1246,7 +1246,8 @@ SvXMLAutoStylePoolP* ORptExport::CreateAutoStylePool()
 
 void SAL_CALL ORptExport::setSourceDocument( const Reference< XComponent >& 
xDoc )
 {
-    m_xReportDefinition.set(xDoc,UNO_QUERY_THROW);
+    m_pReportDefinition = 
dynamic_cast<reportdesign::OReportDefinition*>(xDoc.get());
+    assert(m_pReportDefinition.is() && "document is not an OReportDefinition");
     SvXMLExport::setSourceDocument(xDoc);
 }
 
commit 5353b5bc38d7705de94e9ba35e8925c86962b635
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Jul 16 11:14:02 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Jul 16 15:46:11 2025 +0200

    reportdesign: Drop ORptExport::getReportDefinition
    
    There's no need for this public getter, as it's
    only used internally.
    Use the `m_xReportDefinition` member directly
    instead.
    
    Change-Id: I9d44d8776f3363aea8303da9c429ca44e791d919
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187947
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/reportdesign/inc/xmlExport.hxx b/reportdesign/inc/xmlExport.hxx
index 37425ed843fc..b022fe29ab49 100644
--- a/reportdesign/inc/xmlExport.hxx
+++ b/reportdesign/inc/xmlExport.hxx
@@ -144,8 +144,6 @@ public:
     // XExporter
     virtual void SAL_CALL setSourceDocument( const css::uno::Reference< 
css::lang::XComponent >& xDoc ) override;
 
-    const Reference<XReportDefinition>& getReportDefinition() const { return 
m_xReportDefinition; }
-
     const rtl::Reference < XMLPropertySetMapper >& 
GetCellStylePropertyMapper() const { return m_xCellStylesPropertySetMapper;}
 
     // Helper methods to create exporters
diff --git a/reportdesign/source/filter/xml/xmlExport.cxx 
b/reportdesign/source/filter/xml/xmlExport.cxx
index 3cddcab63761..57a5d04bc666 100644
--- a/reportdesign/source/filter/xml/xmlExport.cxx
+++ b/reportdesign/source/filter/xml/xmlExport.cxx
@@ -1144,11 +1144,7 @@ void ORptExport::exportAutoStyle(const 
Reference<XSection>& _xProp)
         m_aAutoStyleNames.emplace( _xProp.get(),GetAutoStylePool()->Add( 
XmlStyleFamily::TABLE_TABLE, std::move(aPropertyStates) ));
 }
 
-void ORptExport::SetBodyAttributes()
-{
-    Reference<XReportDefinition> xProp(getReportDefinition());
-    exportReportAttributes(xProp);
-}
+void ORptExport::SetBodyAttributes() { 
exportReportAttributes(m_xReportDefinition); }
 
 void ORptExport::exportReportAttributes(const Reference<XReportDefinition>& 
_xReport)
 {
@@ -1182,10 +1178,7 @@ void ORptExport::exportReportAttributes(const 
Reference<XReportDefinition>& _xRe
         AddAttribute(XML_NAMESPACE_DRAW, XML_NAME,sName);
 }
 
-void ORptExport::ExportContent_()
-{
-    exportReport(getReportDefinition());
-}
+void ORptExport::ExportContent_() { exportReport(m_xReportDefinition); }
 
 void ORptExport::ExportMasterStyles_()
 {
@@ -1198,25 +1191,24 @@ void ORptExport::collectComponentStyles()
         return;
 
     m_bAllreadyFilled = true;
-    Reference<XReportDefinition> xProp(getReportDefinition());
-    if ( !xProp.is() )
+    if (!m_xReportDefinition.is())
         return;
 
-    uno::Reference< report::XSection> 
xParent(xProp->getParent(),uno::UNO_QUERY);
+    uno::Reference<report::XSection> xParent(m_xReportDefinition->getParent(), 
uno::UNO_QUERY);
     if ( xParent.is() )
-        exportAutoStyle(xProp.get());
+        exportAutoStyle(m_xReportDefinition.get());
 
-    if ( xProp->getReportHeaderOn() )
-        exportSectionAutoStyle(xProp->getReportHeader());
-    if ( xProp->getPageHeaderOn() )
-        exportSectionAutoStyle(xProp->getPageHeader());
+    if (m_xReportDefinition->getReportHeaderOn())
+        exportSectionAutoStyle(m_xReportDefinition->getReportHeader());
+    if (m_xReportDefinition->getPageHeaderOn())
+        exportSectionAutoStyle(m_xReportDefinition->getPageHeader());
 
-    exportGroup(xProp,0,true);
+    exportGroup(m_xReportDefinition, 0, true);
 
-    if ( xProp->getPageFooterOn() )
-        exportSectionAutoStyle(xProp->getPageFooter());
-    if ( xProp->getReportFooterOn() )
-        exportSectionAutoStyle(xProp->getReportFooter());
+    if (m_xReportDefinition->getPageFooterOn())
+        exportSectionAutoStyle(m_xReportDefinition->getPageFooter());
+    if (m_xReportDefinition->getReportFooterOn())
+        exportSectionAutoStyle(m_xReportDefinition->getReportFooter());
 }
 
 void ORptExport::ExportAutoStyles_()

Reply via email to