diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2024-08-04 21:51:21 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-08-06 12:40:15 +0200 |
commit | 6addfadec1794679fc44613fd8067914a4685560 (patch) | |
tree | c7a2c2edd990fcd5f5b5de3ecf6f0e8515823877 | |
parent | 1bc52b8ae3b7913eef449ecfa5b807784fb760f3 (diff) |
use more concrete UNO type in writerfilter
Change-Id: I468f3b4b6e3ccf2221ad1f5088f2b4a009966c0d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171469
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | sw/inc/unotxdoc.hxx | 3 | ||||
-rw-r--r-- | sw/source/core/inc/unobookmark.hxx | 8 | ||||
-rw-r--r-- | sw/source/core/unocore/unobkm.cxx | 8 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 2 | ||||
-rw-r--r-- | sw/source/writerfilter/dmapper/SdtHelper.cxx | 10 | ||||
-rw-r--r-- | sw/source/writerfilter/dmapper/StyleSheetTable.cxx | 8 |
6 files changed, 22 insertions, 17 deletions
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index b3a308f37761..10a499adf149 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -119,6 +119,7 @@ class SwXPageStyle; class SwXContentControl; class SwXTextEmbeddedObject; class SvXMLEmbeddedObjectHelper; +class SwXFieldmark; namespace com::sun::star::container { class XNameContainer; } namespace com::sun::star::frame { class XController; } namespace com::sun::star::lang { struct Locale; } @@ -523,7 +524,7 @@ public: rtl::Reference<SwXDocumentSettings> createDocumentSettings(); rtl::Reference<SwXTextDefaults> createTextDefaults(); rtl::Reference<SwXBookmark> createBookmark(); - rtl::Reference<SwXBookmark> createFieldmark(); + rtl::Reference<SwXFieldmark> createFieldmark(); rtl::Reference<SwXTextSection> createTextSection(); rtl::Reference<SwXTextField> createFieldAnnotation(); rtl::Reference<SwXLineBreak> createLineBreak(); diff --git a/sw/source/core/inc/unobookmark.hxx b/sw/source/core/inc/unobookmark.hxx index 292645fd8f85..448abf15ce51 100644 --- a/sw/source/core/inc/unobookmark.hxx +++ b/sw/source/core/inc/unobookmark.hxx @@ -179,7 +179,7 @@ typedef cppu::ImplInheritanceHelper< SwXBookmark, > SwXFieldmark_Base; /// UNO wrapper around an sw::mark::Fieldmark. -class SwXFieldmark final +class SW_DLLPUBLIC SwXFieldmark final : public SwXFieldmark_Base { ::sw::mark::CheckboxFieldmark* getCheckboxFieldmark(); @@ -193,8 +193,12 @@ class SwXFieldmark final SwXFieldmark(bool isReplacementObject, SwDoc* pDoc); + // workaround MSVC compiler + SwXFieldmark(const SwXFieldmark&) = delete; + SwXFieldmark(SwXFieldmark&&) = delete; + public: - static rtl::Reference<SwXBookmark> + static rtl::Reference<SwXFieldmark> CreateXFieldmark(SwDoc & rDoc, ::sw::mark::MarkBase * pMark, bool isReplacementObject = false); diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx index 0420d50e2925..6df22258bfa9 100644 --- a/sw/source/core/unocore/unobkm.cxx +++ b/sw/source/core/unocore/unobkm.cxx @@ -664,15 +664,17 @@ uno::Reference<container::XNameContainer> SwXFieldmark::getParameters() return uno::Reference<container::XNameContainer>(new SwXFieldmarkParameters(pBkm)); } -rtl::Reference<SwXBookmark> +rtl::Reference<SwXFieldmark> SwXFieldmark::CreateXFieldmark(SwDoc & rDoc, ::sw::mark::MarkBase *const pMark, bool const isReplacementObject) { // #i105557#: do not iterate over the registered clients: race condition - rtl::Reference<SwXBookmark> xMark; + rtl::Reference<SwXFieldmark> xMark; if (pMark) { - xMark = pMark->GetXBookmark(); + rtl::Reference<SwXBookmark> xTmp = pMark->GetXBookmark(); + assert(!xTmp || dynamic_cast<SwXFieldmark*>(xTmp.get())); + xMark = static_cast<SwXFieldmark*>(xTmp.get()); } if (!xMark.is()) { diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index cb082be78b82..5aaf568a8e3a 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -1646,7 +1646,7 @@ rtl::Reference< SwXBookmark > SwXTextDocument::createBookmark() return SwXBookmark::CreateXBookmark(GetDocOrThrow(), nullptr); } -rtl::Reference< SwXBookmark > SwXTextDocument::createFieldmark() +rtl::Reference< SwXFieldmark > SwXTextDocument::createFieldmark() { SolarMutexGuard aGuard; ThrowIfInvalid(); diff --git a/sw/source/writerfilter/dmapper/SdtHelper.cxx b/sw/source/writerfilter/dmapper/SdtHelper.cxx index 6f72f3cbab9c..3107508ec126 100644 --- a/sw/source/writerfilter/dmapper/SdtHelper.cxx +++ b/sw/source/writerfilter/dmapper/SdtHelper.cxx @@ -472,15 +472,13 @@ void SdtHelper::createDateContentControl() return; } - rtl::Reference<SwXBookmark> xFieldmark = m_rDM_Impl.GetTextDocument()->createFieldmark(); - uno::Reference<text::XFormField> xFormField(static_cast<cppu::OWeakObject*>(xFieldmark.get()), - uno::UNO_QUERY); - if (!xFormField) + rtl::Reference<SwXFieldmark> xFieldmark = m_rDM_Impl.GetTextDocument()->createFieldmark(); + if (!xFieldmark) return; xFieldmark->attach(uno::Reference<text::XTextRange>(xCrsr, uno::UNO_QUERY_THROW)); - xFormField->setFieldType(ODF_FORMDATE); - uno::Reference<container::XNameContainer> xNameCont = xFormField->getParameters(); + xFieldmark->setFieldType(ODF_FORMDATE); + uno::Reference<container::XNameContainer> xNameCont = xFieldmark->getParameters(); if (xNameCont.is()) { OUString sDateFormat = m_sDateFormat.makeStringAndClear(); diff --git a/sw/source/writerfilter/dmapper/StyleSheetTable.cxx b/sw/source/writerfilter/dmapper/StyleSheetTable.cxx index 6e892cf4574c..03e2de0eda80 100644 --- a/sw/source/writerfilter/dmapper/StyleSheetTable.cxx +++ b/sw/source/writerfilter/dmapper/StyleSheetTable.cxx @@ -1377,13 +1377,13 @@ void StyleSheetTable::ApplyStyleSheetsImpl(const FontTablePtr& rFontTable, std:: if( pEntry->m_sStyleName.equalsIgnoreAsciiCase("footnote reference") || pEntry->m_sStyleName.equalsIgnoreAsciiCase("endnote reference") ) { - uno::Reference< style::XStyle > xCopyStyle; + rtl::Reference< SwXBaseStyle > xCopyStyle; if( pEntry->m_sStyleName.equalsIgnoreAsciiCase("footnote reference") ) - xStyles->getByName( u"Footnote anchor"_ustr ) >>= xCopyStyle; + xCopyStyle = xStyles->getStyleByName( u"Footnote anchor"_ustr ); else - xStyles->getByName( u"Endnote anchor"_ustr ) >>= xCopyStyle; + xCopyStyle = xStyles->getStyleByName( u"Endnote anchor"_ustr ); - xMultiPropertySet.set( xCopyStyle, uno::UNO_QUERY_THROW); + xMultiPropertySet.set( static_cast<cppu::OWeakObject*>(xCopyStyle.get()), uno::UNO_QUERY_THROW); xMultiPropertySet->setPropertyValues( aSortedPropVals.getNames(), aSortedPropVals.getValues() ); } } |