core.git: sw/inc sw/Library_sw_writerfilter.mk sw/source

2024-04-27 Thread Noel Grandin (via logerrit)
 sw/Library_sw_writerfilter.mk|1 +
 sw/inc/unotxdoc.hxx  |2 ++
 sw/source/core/inc/SwXTextDefaults.hxx   |3 ++-
 sw/source/uibase/uno/unotxdoc.cxx|8 
 sw/source/writerfilter/dmapper/DomainMapper.cxx  |4 ++--
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx |3 ++-
 sw/source/writerfilter/dmapper/StyleSheetTable.cxx   |7 +++
 7 files changed, 20 insertions(+), 8 deletions(-)

New commits:
commit a77caf28bac50fe8e3592416d5dedf894a02cbbb
Author: Noel Grandin 
AuthorDate: Wed Apr 24 12:26:00 2024 +0200
Commit: Noel Grandin 
CommitDate: Sat Apr 27 15:56:28 2024 +0200

use more concrete UNO classes in writerfilter (SwXTextDefaults)

Change-Id: I44eb8d4561798980ff7008d843bf076fc29582c6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166769
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sw/Library_sw_writerfilter.mk b/sw/Library_sw_writerfilter.mk
index 3be1a2d937c6..c48e727a5b85 100644
--- a/sw/Library_sw_writerfilter.mk
+++ b/sw/Library_sw_writerfilter.mk
@@ -20,6 +20,7 @@ $(eval $(call 
gb_Library_set_precompiled_header,sw_writerfilter,sw/inc/pch/preco
 $(eval $(call gb_Library_set_include,sw_writerfilter,\
 $$(INCLUDE) \
 -I$(SRCDIR)/sw/inc \
+-I$(SRCDIR)/sw/source/core/inc \
 -I$(SRCDIR)/sw/source/uibase/uno/ \
 -I$(SRCDIR)/sw/source/writerfilter/inc \
 -I$(SRCDIR)/sw/source/writerfilter \
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index ab655c6019c4..30edc2fb7c84 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -106,6 +106,7 @@ class SwXReferenceMarks;
 class SwXLinkTargetSupplier;
 class SwXRedlines;
 class SwXDocumentSettings;
+class SwXTextDefaults;
 namespace com::sun::star::container { class XNameContainer; }
 namespace com::sun::star::frame { class XController; }
 namespace com::sun::star::lang { struct Locale; }
@@ -509,6 +510,7 @@ public:
 SwDocShell* GetDocShell() {return m_pDocShell;}
 
 SW_DLLPUBLIC rtl::Reference createDocumentSettings();
+SW_DLLPUBLIC rtl::Reference createTextDefaults();
 };
 
 class SwXLinkTargetSupplier final : public cppu::WeakImplHelper
diff --git a/sw/source/core/inc/SwXTextDefaults.hxx 
b/sw/source/core/inc/SwXTextDefaults.hxx
index 0acab2a7d257..87743eb0cee7 100644
--- a/sw/source/core/inc/SwXTextDefaults.hxx
+++ b/sw/source/core/inc/SwXTextDefaults.hxx
@@ -19,6 +19,7 @@
 
 #pragma once
 
+#include 
 #include 
 #include 
 #include 
@@ -27,7 +28,7 @@
 class SwDoc;
 class SfxItemPropertySet;
 
-class SwXTextDefaults final :  public cppu::WeakImplHelper
+class SW_DLLPUBLIC SwXTextDefaults final :  public cppu::WeakImplHelper
 <
 css::beans::XPropertyState,
 css::beans::XPropertySet,
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index f93d7438f363..3bbaa1014aff 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -175,6 +175,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::text;
@@ -1659,6 +1660,13 @@ rtl::Reference< SwXDocumentSettings > 
SwXTextDocument::createDocumentSettings()
 return new SwXDocumentSettings(this);
 }
 
+rtl::Reference< SwXTextDefaults > SwXTextDocument::createTextDefaults()
+{
+SolarMutexGuard aGuard;
+ThrowIfInvalid();
+return new SwXTextDefaults(());
+}
+
 Reference< XInterface >  SwXTextDocument::createInstance(const OUString& 
rServiceName)
 {
 return create(rServiceName, nullptr);
diff --git a/sw/source/writerfilter/dmapper/DomainMapper.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper.cxx
index 5a9f84aa3b0d..7d48b265f079 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper.cxx
@@ -92,6 +92,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star;
 using namespace oox;
@@ -172,8 +173,7 @@ DomainMapper::DomainMapper( const uno::Reference< 
uno::XComponentContext >& xCon
 // the intended font to provide best layout match.
 try
 {
-uno::Reference< beans::XPropertySet > 
xDefProps(GetTextDocument()->createInstance("com.sun.star.text.Defaults"),
-uno::UNO_QUERY_THROW);
+rtl::Reference 
xDefProps(GetTextDocument()->createTextDefaults());
 xDefProps->setPropertyValue(getPropertyName(PROP_CHAR_FONT_NAME), 
css::uno::Any(OUString("Calibri")));
 xDefProps->setPropertyValue(getPropertyName(PROP_CHAR_HEIGHT), 
css::uno::Any(double(11)));
 }
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index c9f8e4d2b077..db22d7f25fe6 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ 

core.git: sw/inc sw/Library_sw_writerfilter.mk sw/source

2024-04-27 Thread Noel Grandin (via logerrit)
 sw/Library_sw_writerfilter.mk|1 
 sw/inc/unotxdoc.hxx  |3 +
 sw/source/uibase/uno/SwXDocumentSettings.hxx |4 +
 sw/source/uibase/uno/unotxdoc.cxx|7 ++
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx |7 +-
 sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx |6 +-
 sw/source/writerfilter/dmapper/SettingsTable.cxx |   49 +++
 sw/source/writerfilter/dmapper/SettingsTable.hxx |4 +
 sw/source/writerfilter/filter/WriterFilter.cxx   |4 -
 9 files changed, 46 insertions(+), 39 deletions(-)

New commits:
commit 87e0feafd3690a9b58890cc28f8ba0c521bfb557
Author: Noel Grandin 
AuthorDate: Wed Apr 24 12:11:46 2024 +0200
Commit: Noel Grandin 
CommitDate: Sat Apr 27 12:47:57 2024 +0200

use more concrete UNO classes in writerfilter (SwXDocumentSettings)

Change-Id: Id668946233d55d641199634d7ceda2607107e76b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166694
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sw/Library_sw_writerfilter.mk b/sw/Library_sw_writerfilter.mk
index 447752dabd43..3be1a2d937c6 100644
--- a/sw/Library_sw_writerfilter.mk
+++ b/sw/Library_sw_writerfilter.mk
@@ -20,6 +20,7 @@ $(eval $(call 
gb_Library_set_precompiled_header,sw_writerfilter,sw/inc/pch/preco
 $(eval $(call gb_Library_set_include,sw_writerfilter,\
 $$(INCLUDE) \
 -I$(SRCDIR)/sw/inc \
+-I$(SRCDIR)/sw/source/uibase/uno/ \
 -I$(SRCDIR)/sw/source/writerfilter/inc \
 -I$(SRCDIR)/sw/source/writerfilter \
 ))
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index 018784174cbb..ab655c6019c4 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -105,6 +105,7 @@ class SwXLineNumberingProperties;
 class SwXReferenceMarks;
 class SwXLinkTargetSupplier;
 class SwXRedlines;
+class SwXDocumentSettings;
 namespace com::sun::star::container { class XNameContainer; }
 namespace com::sun::star::frame { class XController; }
 namespace com::sun::star::lang { struct Locale; }
@@ -506,6 +507,8 @@ public:
 css::uno::Reference< 
css::uno::XInterface > const & xLastResult);
 
 SwDocShell* GetDocShell() {return m_pDocShell;}
+
+SW_DLLPUBLIC rtl::Reference createDocumentSettings();
 };
 
 class SwXLinkTargetSupplier final : public cppu::WeakImplHelper
diff --git a/sw/source/uibase/uno/SwXDocumentSettings.hxx 
b/sw/source/uibase/uno/SwXDocumentSettings.hxx
index 3d722e40ba80..067e2e8fbc1b 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.hxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.hxx
@@ -19,7 +19,9 @@
 
 #pragma once
 
+#include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -30,7 +32,7 @@ class SwDocShell;
 class SwDoc;
 class SfxPrinter;
 
-class SwXDocumentSettings final :
+class SW_DLLPUBLIC SwXDocumentSettings final :
 public comphelper::MasterPropertySet,
 public css::lang::XServiceInfo,
 public css::lang::XTypeProvider,
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index d2641b6c4db4..f93d7438f363 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -1652,6 +1652,13 @@ css::uno::Reference 
SwXTextDocument::create(
 return xTmp;
 }
 
+rtl::Reference< SwXDocumentSettings > SwXTextDocument::createDocumentSettings()
+{
+SolarMutexGuard aGuard;
+ThrowIfInvalid();
+return new SwXDocumentSettings(this);
+}
+
 Reference< XInterface >  SwXTextDocument::createInstance(const OUString& 
rServiceName)
 {
 return create(rServiceName, nullptr);
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index aab27ef1a4bc..c9f8e4d2b077 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -132,6 +132,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define REFFLDFLAG_STYLE_FROM_BOTTOM 0xc100
 #define REFFLDFLAG_STYLE_HIDE_NON_NUMERICAL 0xc200
@@ -523,11 +524,11 @@ uno::Reference< text::XText > const & 
DomainMapper_Impl::GetBodyText()
 }
 
 
-uno::Reference< beans::XPropertySet > const & 
DomainMapper_Impl::GetDocumentSettings()
+rtl::Reference const & 
DomainMapper_Impl::GetDocumentSettings()
 {
 if( !m_xDocumentSettings.is() && m_xTextDocument.is())
 {
-m_xDocumentSettings.set( 
m_xTextDocument->createInstance("com.sun.star.document.Settings"), 
uno::UNO_QUERY );
+m_xDocumentSettings = m_xTextDocument->createDocumentSettings();
 }
 return m_xDocumentSettings;
 }
@@ -9592,7 +9593,7 @@ void DomainMapper_Impl::ApplySettingsTable()
 m_xTextDocument->setViewData(xBox);
 }
 
-uno::Reference< beans::XPropertySet > 
xSettings(m_xTextDocument->createInstance("com.sun.star.document.Settings"), 
uno::UNO_QUERY);
+rtl::Reference 

core.git: sw/inc sw/Library_sw_writerfilter.mk sw/source

2024-04-25 Thread Noel Grandin (via logerrit)
 sw/Library_sw_writerfilter.mk  |2 
 sw/inc/unotxdoc.hxx|   30 +--
 sw/source/writerfilter/dmapper/DomainMapper.cxx|   90 --
 sw/source/writerfilter/dmapper/DomainMapper.hxx|4 
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx   |  112 +
 sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx   |8 
 sw/source/writerfilter/dmapper/PropertyMap.cxx |   46 ++---
 sw/source/writerfilter/dmapper/SdtHelper.cxx   |5 
 sw/source/writerfilter/dmapper/SmartTagHandler.cxx |5 
 sw/source/writerfilter/dmapper/SmartTagHandler.hxx |4 
 sw/source/writerfilter/dmapper/StyleSheetTable.cxx |   52 +++---
 sw/source/writerfilter/dmapper/StyleSheetTable.hxx |4 
 sw/source/writerfilter/dmapper/domainmapperfactory.cxx |2 
 sw/source/writerfilter/filter/RtfFilter.cxx|   10 -
 sw/source/writerfilter/filter/WriterFilter.cxx |   22 +-
 sw/source/writerfilter/inc/dmapper/DomainMapperFactory.hxx |4 
 sw/source/writerfilter/inc/rtftok/RTFDocument.hxx  |4 
 sw/source/writerfilter/rtftok/rtfdispatchdestination.cxx   |7 
 sw/source/writerfilter/rtftok/rtfdispatchflag.cxx  |6 
 sw/source/writerfilter/rtftok/rtfdocumentfactory.cxx   |2 
 sw/source/writerfilter/rtftok/rtfdocumentimpl.cxx  |   22 +-
 sw/source/writerfilter/rtftok/rtfdocumentimpl.hxx  |4 
 sw/source/writerfilter/rtftok/rtfsdrimport.cxx |8 
 sw/source/writerfilter/rtftok/rtfsdrimport.hxx |5 
 24 files changed, 217 insertions(+), 241 deletions(-)

New commits:
commit d8d2a68271b5263777d3be8afd0bd39bd076bb87
Author: Noel Grandin 
AuthorDate: Tue Apr 23 21:33:19 2024 +0200
Commit: Noel Grandin 
CommitDate: Thu Apr 25 18:50:09 2024 +0200

use more concrete UNO classes in writerfilter

starting with SwXTextDocument.

Replace some UNO_QUERY_THROW with
   if (!foo)
   throw uno::RuntimeException()
because rtl::Reference does not have UNO_QUERY_THROW
constructors

Change-Id: I98e34f2faa6e94d0afbdfbd4e9e92a43b0a921f7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166565
Reviewed-by: Noel Grandin 
Tested-by: Jenkins

diff --git a/sw/Library_sw_writerfilter.mk b/sw/Library_sw_writerfilter.mk
index deebdf1439e1..447752dabd43 100644
--- a/sw/Library_sw_writerfilter.mk
+++ b/sw/Library_sw_writerfilter.mk
@@ -19,6 +19,7 @@ $(eval $(call 
gb_Library_set_precompiled_header,sw_writerfilter,sw/inc/pch/preco
 
 $(eval $(call gb_Library_set_include,sw_writerfilter,\
 $$(INCLUDE) \
+-I$(SRCDIR)/sw/inc \
 -I$(SRCDIR)/sw/source/writerfilter/inc \
 -I$(SRCDIR)/sw/source/writerfilter \
 ))
@@ -45,6 +46,7 @@ $(eval $(call gb_Library_use_libraries,sw_writerfilter,\
 sot \
 svt \
svxcore \
+sw \
 tl \
 utl \
 vcl \
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index 9b7b6f16e4d4..018784174cbb 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -224,9 +224,6 @@ private:
 // is implemented.
 bool m_bApplyPagePrintSettingsFromXPagePrintable;
 
-using SfxBaseModel::addEventListener;
-using SfxBaseModel::removeEventListener;
-
 /** abstract SdrModel provider */
 virtual SdrModel& getSdrModelFromUnoModel() const override;
 
@@ -256,6 +253,9 @@ public:
 rtl::Reference< SwXBodyText > getBodyText();
 virtual void SAL_CALL reformat() override;
 
+using SfxBaseModel::addEventListener;
+using SfxBaseModel::removeEventListener;
+
 //XModel
 virtual sal_Bool SAL_CALL attachResource( const OUString& aURL, const 
css::uno::Sequence< css::beans::PropertyValue >& aArgs ) override;
 virtual OUString SAL_CALL getURL(  ) override;
@@ -278,21 +278,21 @@ public:
 virtual void SAL_CALL close( sal_Bool bDeliverOwnership ) override;
 
 //XLineNumberingProperties
-virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL 
getLineNumberingProperties() override;
+SW_DLLPUBLIC virtual css::uno::Reference< css::beans::XPropertySet > 
SAL_CALL getLineNumberingProperties() override;
 
 //XChapterNumberingSupplier
-virtual css::uno::Reference< css::container::XIndexReplace >  SAL_CALL 
getChapterNumberingRules() override;
+SW_DLLPUBLIC virtual css::uno::Reference< css::container::XIndexReplace >  
SAL_CALL getChapterNumberingRules() override;
 
 //XNumberingRulesSupplier
 virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL 
getNumberingRules() override;
 
 //XFootnotesSupplier
 SW_DLLPUBLIC virtual css::uno::Reference< css::container::XIndexAccess >  
SAL_CALL getFootnotes() override;
-virtual css::uno::Reference< css::beans::XPropertySet >  SAL_CALL 
getFootnoteSettings() override;
+SW_DLLPUBLIC virtual css::uno::Reference< css::beans::XPropertySet