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>
This commit is contained in:
Noel Grandin 2024-05-20 12:55:15 +02:00
parent 6b9ff63cf4
commit 41c04ceb3b
5 changed files with 11 additions and 12 deletions

View file

@ -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

View file

@ -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);
}

View file

@ -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 :

View file

@ -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;
}

View file

@ -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)