diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-05-20 12:55:15 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-05-20 19:14:14 +0200 |
commit | 41c04ceb3b1b14c3c99ede86524df8f3de4f5daa (patch) | |
tree | a46451f859f4d8ca3f75670dfa71e56dc79998a1 | |
parent | 6b9ff63cf448da9b49ca9485b276c7ecc1023a23 (diff) |
use more concrete UNO types in sw
Change-Id: I3cf017e74e7cc9902486d6dba1d89f70c47c978a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167864
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | sw/inc/unocoll.hxx | 3 | ||||
-rw-r--r-- | sw/source/core/unocore/unocoll.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/unocore/unoredline.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/unocore/unotext.cxx | 11 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxtableexport.cxx | 4 |
5 files changed, 11 insertions, 12 deletions
diff --git a/sw/inc/unocoll.hxx b/sw/inc/unocoll.hxx index 6254801bf8a7..0ecca6fb45c2 100644 --- a/sw/inc/unocoll.hxx +++ b/sw/inc/unocoll.hxx @@ -40,6 +40,7 @@ class SwSectionFormat; struct SvEventDescription; class SwXFootnote; class SwXTextSection; +class SwXTextTable; const SvEventDescription* sw_GetSupportedMacroItems(); @@ -287,7 +288,7 @@ public: virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; - SW_DLLPUBLIC static css::uno::Reference<css::text::XTextTable> GetObject(SwFrameFormat& rFormat); + SW_DLLPUBLIC static rtl::Reference<SwXTextTable> GetObject(SwFrameFormat& rFormat); }; typedef diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx index 24016c53350f..e00fa835f16a 100644 --- a/sw/source/core/unocore/unocoll.cxx +++ b/sw/source/core/unocore/unocoll.cxx @@ -973,7 +973,7 @@ uno::Sequence< OUString > SwXTextTables::getSupportedServiceNames() return { u"com.sun.star.text.TextTables"_ustr }; } -uno::Reference<text::XTextTable> SwXTextTables::GetObject(SwFrameFormat& rFormat) +rtl::Reference<SwXTextTable> SwXTextTables::GetObject(SwFrameFormat& rFormat) { return SwXTextTable::CreateXTextTable(& rFormat); } diff --git a/sw/source/core/unocore/unoredline.cxx b/sw/source/core/unocore/unoredline.cxx index 27fd9aa7f555..b97cc20028b2 100644 --- a/sw/source/core/unocore/unoredline.cxx +++ b/sw/source/core/unocore/unoredline.cxx @@ -42,6 +42,7 @@ #include <IDocumentRedlineAccess.hxx> #include <IDocumentStylePoolAccess.hxx> #include <docary.hxx> +#include <unotbl.hxx> using namespace ::com::sun::star; @@ -422,7 +423,7 @@ uno::Any SwXRedline::getPropertyValue( const OUString& rPropertyName ) OSL_ENSURE(pTableNode, "No table node!"); SwTable& rTable = pTableNode->GetTable(); SwFrameFormat* pTableFormat = rTable.GetFrameFormat(); - xRet = SwXTextTables::GetObject( *pTableFormat ); + xRet = cppu::getXWeak(SwXTextTables::GetObject( *pTableFormat ).get()); } break; case SwNodeType::Text : diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 730e24ca6718..50d9f75db63f 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -2214,9 +2214,8 @@ SwXText::convertToTable( if (!pTable) return uno::Reference< text::XTextTable >(); - uno::Reference<text::XTextTable> const xRet = + rtl::Reference<SwXTextTable> const xRet = SwXTextTable::CreateXTextTable(pTable->GetFrameFormat()); - uno::Reference<beans::XPropertySet> const xPrSet(xRet, uno::UNO_QUERY); // set properties to the table // catch lang::WrappedTargetException and lang::IndexOutOfBoundsException try @@ -2254,7 +2253,7 @@ SwXText::convertToTable( }; if (std::find(vDenylist.begin(), vDenylist.end(), rTableProperty.Name) == vDenylist.end()) { - xPrSet->setPropertyValue(rTableProperty.Name, rTableProperty.Value); + xRet->setPropertyValue(rTableProperty.Name, rTableProperty.Value); } } catch (const uno::Exception&) @@ -2270,7 +2269,6 @@ SwXText::convertToTable( for(sal_Int32 nCnt = 0; nCnt < nLast; ++nCnt) lcl_ApplyRowProperties(rRowProperties[nCnt], xRows->getByIndex(nCnt), aRowSeparators[nCnt]); - uno::Reference<table::XCellRange> const xCR(xRet, uno::UNO_QUERY_THROW); //apply cell properties sal_Int32 nRow = 0; for(const auto& rCellPropertiesForRow : rCellProperties) @@ -2280,7 +2278,7 @@ SwXText::convertToTable( { lcl_ApplyCellProperties(lcl_GetLeftPos(nCell, aRowSeparators[nRow]), rCellProps, - xCR->getCellByPosition(nCell, nRow), + xRet->getCellByPosition(nCell, nRow), aMergedCells); ++nCell; } @@ -2299,8 +2297,7 @@ SwXText::convertToTable( } assert(SwTable::FindTable(pTable->GetFrameFormat()) == pTable); - assert(pTable->GetFrameFormat() == - dynamic_cast<SwXTextTable&>(*xRet).GetFrameFormat()); + assert(pTable->GetFrameFormat() == xRet->GetFrameFormat()); return xRet; } diff --git a/sw/source/filter/ww8/docxtableexport.cxx b/sw/source/filter/ww8/docxtableexport.cxx index f6bbef34dddc..ba89f5695d04 100644 --- a/sw/source/filter/ww8/docxtableexport.cxx +++ b/sw/source/filter/ww8/docxtableexport.cxx @@ -38,6 +38,7 @@ #include <swmodule.hxx> #include <fmtrowsplt.hxx> #include <fmtwrapinfluenceonobjpos.hxx> +#include <unotbl.hxx> #include "docxexportfilter.hxx" #include "docxhelper.hxx" @@ -218,8 +219,7 @@ void DocxAttributeOutput::TableDefinition( nWidthPercent = rFrameSize.GetWidthPercent(); } - uno::Reference<beans::XPropertySet> xPropertySet( - SwXTextTables::GetObject(*pTable->GetFrameFormat()), uno::UNO_QUERY); + rtl::Reference<SwXTextTable> xPropertySet = SwXTextTables::GetObject(*pTable->GetFrameFormat()); bool isWidthRelative = false; xPropertySet->getPropertyValue("IsWidthRelative") >>= isWidthRelative; if (!isWidthRelative && !nWidthPercent) |