sw/inc/unocoll.hxx                                   |    4 
 sw/inc/unosett.hxx                                   |    9 
 sw/inc/unotext.hxx                                   |    4 
 sw/inc/unotxdoc.hxx                                  |    2 
 sw/source/core/unocore/unocoll.cxx                   |   11 
 sw/source/core/unocore/unosett.cxx                   |  263 +++++++++++++++++++
 sw/source/uibase/uno/unotxdoc.cxx                    |   10 
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx |   71 ++---
 sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx |    4 
 sw/source/writerfilter/dmapper/PropertyMap.hxx       |    7 
 10 files changed, 333 insertions(+), 52 deletions(-)

New commits:
commit 1c4c9bc01572956b7c3cf16e260aed231c8ff510
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Tue Aug 6 19:51:41 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Aug 8 15:51:31 2024 +0200

    use more concrete UNO type in writerfilter
    
    Change-Id: Ib2c6277f8398e223060440a3844b6d322572d11a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171602
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/inc/unosett.hxx b/sw/inc/unosett.hxx
index 7cc4794e8dff..f280e78c5a6d 100644
--- a/sw/inc/unosett.hxx
+++ b/sw/inc/unosett.hxx
@@ -130,7 +130,7 @@ public:
     void            Invalidate() {m_pDoc = nullptr;}
 };
 
-class SwXNumberingRules : public cppu::WeakImplHelper
+class SAL_DLLPUBLIC_RTTI SwXNumberingRules : public cppu::WeakImplHelper
 <
     css::container::XIndexReplace,
     css::beans::XPropertySet,
@@ -202,6 +202,8 @@ public:
     void    Invalidate()    {m_pDocShell = nullptr;}
     const OUString&   GetCreatedNumRuleName() const {return 
m_sCreatedNumRuleName;}
 
+    SW_DLLPUBLIC css::uno::Any getPropertyByIndex(sal_Int32 nIndex, const 
OUString& rPropName);
+
     static css::uno::Sequence<css::beans::PropertyValue> 
GetPropertiesForNumFormat(
             const SwNumFormat& rFormat, OUString const& rCharFormatName,
             OUString const* pHeadingStyleName, OUString const & referer);
@@ -215,6 +217,11 @@ public:
             SwDocShell *const pDocShell,
             css::uno::Sequence<css::beans::PropertyValue> const& rProperties);
 
+private:
+    css::uno::Any GetNumberingRuleByIndex(const SwNumRule& rNumRule, sal_Int32 
nIndex, const OUString& rPropName) const;
+    static css::uno::Any GetPropertyForNumFormat(
+            const SwNumFormat& rFormat, OUString const& rCharFormatName,
+            OUString const* pHeadingStyleName, OUString const & referer, 
OUString const & rPropName);
 };
 
 class SwXChapterNumbering final : public SwXNumberingRules
diff --git a/sw/source/core/unocore/unosett.cxx 
b/sw/source/core/unocore/unosett.cxx
index 2ad966a57b78..0df88955250e 100644
--- a/sw/source/core/unocore/unosett.cxx
+++ b/sw/source/core/unocore/unosett.cxx
@@ -1151,6 +1151,31 @@ sal_Int32 SwXNumberingRules::getCount()
     return MAXLEVEL;
 }
 
+uno::Any SwXNumberingRules::getPropertyByIndex(sal_Int32 nIndex, const 
OUString& rPropName)
+{
+    SolarMutexGuard aGuard;
+    if(nIndex < 0 || MAXLEVEL <= nIndex)
+        throw lang::IndexOutOfBoundsException();
+
+    uno::Any aVal;
+    const SwNumRule* pRule = m_pNumRule;
+    if(!pRule && m_pDoc && !m_sCreatedNumRuleName.isEmpty())
+        pRule = m_pDoc->FindNumRulePtr( m_sCreatedNumRuleName );
+    if(pRule)
+    {
+        aVal = GetNumberingRuleByIndex( *pRule, nIndex, rPropName);
+
+    }
+    else if(m_pDocShell)
+    {
+        aVal = GetNumberingRuleByIndex(
+                *m_pDocShell->GetDoc()->GetOutlineNumRule(), nIndex, 
rPropName);
+    }
+    else
+        throw uno::RuntimeException();
+    return aVal;
+}
+
 uno::Any SwXNumberingRules::getByIndex(sal_Int32 nIndex)
 {
     SolarMutexGuard aGuard;
@@ -1266,6 +1291,69 @@ uno::Sequence<beans::PropertyValue> 
SwXNumberingRules::GetNumberingRuleByIndex(
 
 }
 
+uno::Any SwXNumberingRules::GetNumberingRuleByIndex(
+                const SwNumRule& rNumRule, sal_Int32 nIndex, const OUString& 
rPropName) const
+{
+    SolarMutexGuard aGuard;
+    OSL_ENSURE( 0 <= nIndex && nIndex < MAXLEVEL, "index out of range" );
+
+    const SwNumFormat& rFormat = rNumRule.Get( 
o3tl::narrowing<sal_uInt16>(nIndex) );
+
+    SwCharFormat* pCharFormat = rFormat.GetCharFormat();
+    OUString CharStyleName;
+    if (pCharFormat)
+        CharStyleName = pCharFormat->GetName();
+
+    // Whether or not a style is present: the array entry overwrites this 
string
+    if (!m_sNewCharStyleNames[nIndex].isEmpty() &&
+        !SwXNumberingRules::isInvalidStyle(m_sNewCharStyleNames[nIndex]))
+    {
+        CharStyleName = m_sNewCharStyleNames[nIndex];
+    }
+
+    OUString aUString;
+    if (m_pDocShell) // -> Chapter Numbering
+    {
+        // template name
+        OUString sValue(SwResId(STR_POOLCOLL_HEADLINE_ARY[nIndex]));
+        const SwTextFormatColls* pColls = 
m_pDocShell->GetDoc()->GetTextFormatColls();
+        const size_t nCount = pColls->size();
+        for(size_t i = 0; i < nCount; ++i)
+        {
+            SwTextFormatColl &rTextColl = *pColls->operator[](i);
+            if(rTextColl.IsDefault())
+                continue;
+
+            const sal_Int16 nOutLevel = 
rTextColl.IsAssignedToListLevelOfOutlineStyle()
+                                        ? 
static_cast<sal_Int16>(rTextColl.GetAssignedOutlineStyleLevel())
+                                        : MAXLEVEL;
+            if ( nOutLevel == nIndex )
+            {
+                sValue = rTextColl.GetName();
+                break; // the style for the level in question has been found
+            }
+            else if( sValue==rTextColl.GetName() )
+            {
+                // if the default for the level is existing, but its
+                // level is different, then it cannot be the default.
+                sValue.clear();
+            }
+        }
+        SwStyleNameMapper::FillProgName(sValue, aUString, 
SwGetPoolIdFromName::TxtColl);
+    }
+
+    OUString referer;
+    if (m_pDoc != nullptr) {
+        auto const sh = m_pDoc->GetPersist();
+        if (sh != nullptr && sh->HasName()) {
+            referer = sh->GetMedium()->GetName();
+        }
+    }
+    return GetPropertyForNumFormat(
+        rFormat, CharStyleName, m_pDocShell ? & aUString : nullptr, referer, 
rPropName);
+
+}
+
 uno::Sequence<beans::PropertyValue> 
SwXNumberingRules::GetPropertiesForNumFormat(
         const SwNumFormat& rFormat, OUString const& rCharFormatName,
         OUString const*const pHeadingStyleName, OUString const & referer)
@@ -1433,6 +1521,181 @@ uno::Sequence<beans::PropertyValue> 
SwXNumberingRules::GetPropertiesForNumFormat
     return ::comphelper::containerToSequence(aPropertyValues);
 }
 
+uno::Any SwXNumberingRules::GetPropertyForNumFormat(
+        const SwNumFormat& rFormat, OUString const& rCharFormatName,
+        OUString const*const pHeadingStyleName, OUString const & referer, 
OUString const & rPropName)
+{
+    bool bChapterNum = pHeadingStyleName != nullptr;
+
+
+    //adjust
+    if (rPropName == u"Adjust"_ustr)
+    {
+        SvxAdjust eAdj = rFormat.GetNumAdjust();
+        return uno::Any(sal_Int16(aSvxToUnoAdjust[eAdj]));
+    }
+    if (rPropName == u"ParentNumbering"_ustr)
+        return uno::Any(sal_Int16(rFormat.GetIncludeUpperLevels()));
+    if (rPropName == u"Prefix"_ustr)
+        return uno::Any(rFormat.GetPrefix());
+    if (rPropName == u"Suffix"_ustr)
+        return uno::Any(rFormat.GetSuffix());
+    if (rPropName == u"ListFormat"_ustr)
+    {
+        if (rFormat.HasListFormat())
+            return uno::Any(rFormat.GetListFormat());
+        else
+            return uno::Any();
+    }
+    if (rPropName == UNO_NAME_LEVEL_IS_LEGAL)
+        return uno::Any(rFormat.GetIsLegal());
+    if (rPropName == u"CharStyleName"_ustr)
+    {
+        OUString aUString;
+        SwStyleNameMapper::FillProgName( rCharFormatName, aUString, 
SwGetPoolIdFromName::ChrFmt);
+        return uno::Any(aUString);
+    }
+    if (rPropName == u"StartWith"_ustr)
+        return uno::Any(sal_Int16(rFormat.GetStart()));
+    if ( rFormat.GetPositionAndSpaceMode() == 
SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+    {
+        //leftmargin
+        if (rPropName == UNO_NAME_LEFT_MARGIN)
+            return 
uno::Any(sal_Int32(convertTwipToMm100(rFormat.GetAbsLSpace())));
+
+        //chartextoffset
+        if (rPropName == UNO_NAME_SYMBOL_TEXT_DISTANCE)
+            return 
uno::Any(sal_Int32(convertTwipToMm100(rFormat.GetCharTextDistance())));
+
+        //firstlineoffset
+        if (rPropName == UNO_NAME_FIRST_LINE_OFFSET)
+            return 
uno::Any(sal_Int32(convertTwipToMm100(rFormat.GetFirstLineOffset())));
+    }
+
+    // PositionAndSpaceMode
+    if (rPropName == UNO_NAME_POSITION_AND_SPACE_MODE)
+    {
+        sal_Int16 nINT16 = PositionAndSpaceMode::LABEL_WIDTH_AND_POSITION;
+        if ( rFormat.GetPositionAndSpaceMode() == 
SvxNumberFormat::LABEL_ALIGNMENT )
+        {
+            nINT16 = PositionAndSpaceMode::LABEL_ALIGNMENT;
+        }
+        return uno::Any(nINT16);
+    }
+
+    if ( rFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT 
)
+    {
+        // LabelFollowedBy
+        if (rPropName == UNO_NAME_LABEL_FOLLOWED_BY)
+        {
+            sal_Int16 nINT16 = LabelFollow::LISTTAB;
+            if ( rFormat.GetLabelFollowedBy() == SvxNumberFormat::SPACE )
+            {
+                nINT16 = LabelFollow::SPACE;
+            }
+            else if ( rFormat.GetLabelFollowedBy() == SvxNumberFormat::NOTHING 
)
+            {
+                nINT16 = LabelFollow::NOTHING;
+            }
+            else if ( rFormat.GetLabelFollowedBy() == SvxNumberFormat::NEWLINE 
)
+            {
+                nINT16 = LabelFollow::NEWLINE;
+            }
+            return uno::Any(nINT16);
+        }
+
+        // ListtabStopPosition
+        if (rPropName == UNO_NAME_LISTTAB_STOP_POSITION)
+            return 
uno::Any(sal_Int32(convertTwipToMm100(rFormat.GetListtabPos())));
+
+        // FirstLineIndent
+        if (rPropName == UNO_NAME_FIRST_LINE_INDENT)
+            return 
uno::Any(sal_Int32(convertTwipToMm100(rFormat.GetFirstLineIndent())));
+
+        // IndentAt
+        if (rPropName == UNO_NAME_INDENT_AT)
+            return 
uno::Any(sal_Int32(convertTwipToMm100(rFormat.GetIndentAt())));
+    }
+
+    //numberingtype
+    if (rPropName == u"NumberingType"_ustr)
+        return uno::Any(sal_Int16(rFormat.GetNumberingType()));
+
+    if(!bChapterNum)
+    {
+        if(SVX_NUM_CHAR_SPECIAL == rFormat.GetNumberingType())
+        {
+            //BulletId
+            if (rPropName == u"BulletId"_ustr)
+                return uno::Any(sal_Int16(rFormat.GetBulletChar()));
+
+            //BulletChar
+            if (rPropName == u"BulletChar"_ustr)
+            {
+                sal_UCS4 cBullet = rFormat.GetBulletChar();
+                return uno::Any(OUString(&cBullet, 1));
+            }
+
+            //BulletFontName
+            if (rPropName == u"BulletFontName"_ustr)
+            {
+                std::optional<vcl::Font> pFont = rFormat.GetBulletFont();
+                return uno::Any(pFont ? pFont->GetStyleName() : OUString());
+            }
+
+            //BulletFont
+            if (rPropName == UNO_NAME_BULLET_FONT)
+            {
+                if (std::optional<vcl::Font> pFont = rFormat.GetBulletFont())
+                {
+                    awt::FontDescriptor aDesc;
+                    SvxUnoFontDescriptor::ConvertFromFont( *pFont, aDesc );
+                    return uno::Any(aDesc);
+                }
+            }
+        }
+        if (SVX_NUM_BITMAP == rFormat.GetNumberingType())
+        {
+            //GraphicBitmap
+            if (rPropName == UNO_NAME_GRAPHIC_BITMAP)
+            {
+                const SvxBrushItem* pBrush = rFormat.GetBrush();
+                const Graphic* pGraphic = pBrush ? pBrush->GetGraphic(referer) 
: nullptr;
+                if (pGraphic)
+                {
+                    return 
uno::Any(uno::Reference<awt::XBitmap>(pGraphic->GetXGraphic(), uno::UNO_QUERY));
+                }
+            }
+
+            if (rPropName == UNO_NAME_GRAPHIC_SIZE)
+            {
+                Size aSize = rFormat.GetGraphicSize();
+                // #i101131#
+                // adjust conversion due to type mismatch between <Size> and 
<awt::Size>
+                return uno::Any(awt::Size(convertTwipToMm100(aSize.Width()), 
convertTwipToMm100(aSize.Height())));
+            }
+
+            if (rPropName == UNO_NAME_VERT_ORIENT)
+            {
+                const SwFormatVertOrient* pOrient = 
rFormat.GetGraphicOrientation();
+                if(pOrient)
+                {
+                    uno::Any any;
+                    pOrient->QueryValue(any);
+                    return any;
+                }
+            }
+        }
+    }
+    else
+    {
+        if (rPropName == UNO_NAME_HEADING_STYLE_NAME)
+            return uno::Any(*pHeadingStyleName);
+    }
+
+    throw UnknownPropertyException(rPropName);
+}
+
 void SwXNumberingRules::SetNumberingRuleByIndex(
             SwNumRule& rNumRule,
             const uno::Sequence<beans::PropertyValue>& rProperties, sal_Int32 
nIndex)
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index a00466a10e0b..c7453308ed50 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -151,6 +151,7 @@
 #include <unofootnote.hxx>
 #include <unoport.hxx>
 #include <unotextbodyhf.hxx>
+#include <unosett.hxx>
 
 using namespace ::com::sun::star;
 using namespace oox;
@@ -9888,15 +9889,11 @@ sal_Int32 DomainMapper_Impl::getNumberingProperty(const 
sal_Int32 nListId, sal_I
         const rtl::Reference< SwXStyleFamilies > xStyleFamilies = 
m_xTextDocument->getSwStyleFamilies();
         rtl::Reference<SwXStyleFamily> xNumberingStyles = 
xStyleFamilies->GetNumberingStyles();
         const rtl::Reference<SwXBaseStyle> xStyle = 
xNumberingStyles->getStyleByName(aListName);
-        const uno::Reference<container::XIndexAccess> 
xNumberingRules(xStyle->getPropertyValue(u"NumberingRules"_ustr), 
uno::UNO_QUERY);
+        const rtl::Reference<SwXNumberingRules> xNumberingRules =
+            
dynamic_cast<SwXNumberingRules*>(xStyle->getPropertyValue(u"NumberingRules"_ustr).get<uno::Reference<uno::XInterface>>().get());
         if (xNumberingRules.is())
         {
-            uno::Sequence<beans::PropertyValue> aProps;
-            xNumberingRules->getByIndex(nNumberingLevel) >>= aProps;
-            auto pProp = std::find_if(std::cbegin(aProps), std::cend(aProps),
-                [&aProp](const beans::PropertyValue& rProp) { return 
rProp.Name == aProp; });
-            if (pProp != std::cend(aProps))
-                pProp->Value >>= nRet;
+            xNumberingRules->getPropertyByIndex(nNumberingLevel, aProp) >>= 
nRet;
         }
     }
     catch( const uno::Exception& )
commit 5b1bf578fb23ab929602715077138a5362dcb5ce
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Tue Aug 6 16:19:01 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Aug 8 15:51:19 2024 +0200

    use more concrete UNO type in writerfilter
    
    Change-Id: I25af4b33b1a1a98e93ff9564175ec4d067b0aae0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171601
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/inc/unocoll.hxx b/sw/inc/unocoll.hxx
index 0ecca6fb45c2..365336ad61f3 100644
--- a/sw/inc/unocoll.hxx
+++ b/sw/inc/unocoll.hxx
@@ -463,7 +463,7 @@ public:
     SwXFootnotes(bool bEnd, SwDoc* pDoc);
 
     //XIndexAccess
-    virtual sal_Int32 SAL_CALL getCount() override;
+    SW_DLLPUBLIC virtual sal_Int32 SAL_CALL getCount() override;
     virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override;
 
     //XElementAccess
@@ -475,6 +475,8 @@ public:
     virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) 
override;
     virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() 
override;
 
+    SW_DLLPUBLIC rtl::Reference<SwXFootnote> getFootnoteByIndex(sal_Int32 
nIndex) ;
+
     static rtl::Reference<SwXFootnote> GetObject( SwDoc& rDoc, const 
SwFormatFootnote& rFormat );
 };
 
diff --git a/sw/inc/unotext.hxx b/sw/inc/unotext.hxx
index 751a1a213070..237a1e4b31f5 100644
--- a/sw/inc/unotext.hxx
+++ b/sw/inc/unotext.hxx
@@ -135,7 +135,7 @@ public:
     SW_DLLPUBLIC virtual css::uno::Reference< css::text::XTextRange > SAL_CALL 
getStart() override;
     virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() 
override;
     virtual OUString SAL_CALL getString() override;
-    virtual void SAL_CALL setString(const OUString& rString) override;
+    SW_DLLPUBLIC virtual void SAL_CALL setString(const OUString& rString) 
override;
 
     // XSimpleText
     virtual void SAL_CALL insertString(
@@ -220,7 +220,7 @@ public:
                 rTableProperties) override;
 
     // XTextCopy
-    virtual void SAL_CALL copyText(
+    SW_DLLPUBLIC virtual void SAL_CALL copyText(
             const css::uno::Reference< css::text::XTextCopy >& xSource ) 
override;
 
     // XTextRangeCompare
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index b7494d2f0c98..9b2824700fa4 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -522,6 +522,8 @@ public:
 
     SwDocShell*                 GetDocShell() {return m_pDocShell;}
 
+    rtl::Reference<SwXFootnotes> getSwXFootnotes();
+    rtl::Reference<SwXFootnotes> getSwXEndnotes();
     rtl::Reference<SwXTextFieldMasters> getSwXTextFieldMasters();
     rtl::Reference<SwXFieldMaster> createFieldMaster(std::u16string_view 
sServiceName);
     rtl::Reference<SwXTextField> createTextField(std::u16string_view 
sServiceName);
diff --git a/sw/source/core/unocore/unocoll.cxx 
b/sw/source/core/unocore/unocoll.cxx
index 7bd99220f931..0a6c269e3eee 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -1703,16 +1703,20 @@ sal_Int32 SwXFootnotes::getCount()
 }
 
 uno::Any SwXFootnotes::getByIndex(sal_Int32 nIndex)
+{
+    return uno::Any(uno::Reference< XFootnote >(getFootnoteByIndex(nIndex)));
+}
+
+rtl::Reference<SwXFootnote> SwXFootnotes::getFootnoteByIndex(sal_Int32 nIndex)
 {
     SolarMutexGuard aGuard;
-    uno::Any aRet;
+    rtl::Reference<SwXFootnote> xRef;
     sal_Int32 nCount = 0;
 
     auto& rDoc = GetDoc();
     auto& rIdxs = rDoc.GetFootnoteIdxs();
     const size_t nFootnoteCnt = rIdxs.size();
     SwTextFootnote* pTextFootnote;
-    uno::Reference< XFootnote >  xRef;
     for( size_t n = 0; n < nFootnoteCnt; ++n )
     {
         pTextFootnote = rIdxs[n];
@@ -1724,7 +1728,6 @@ uno::Any SwXFootnotes::getByIndex(sal_Int32 nIndex)
         {
             xRef = SwXFootnote::CreateXFootnote(rDoc,
                     &const_cast<SwFormatFootnote&>(rFootnote));
-            aRet <<= xRef;
             break;
         }
         nCount++;
@@ -1732,7 +1735,7 @@ uno::Any SwXFootnotes::getByIndex(sal_Int32 nIndex)
     if(!xRef.is())
         throw IndexOutOfBoundsException();
 
-    return aRet;
+    return xRef;
 }
 
 uno::Type SAL_CALL SwXFootnotes::getElementType()
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index 300f7b81bb61..23d4d3974c79 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -619,6 +619,11 @@ Reference< XIndexAccess >  
SwXTextDocument::getNumberingRules()
 }
 
 Reference< XIndexAccess >  SwXTextDocument::getFootnotes()
+{
+    return getSwXFootnotes();
+}
+
+rtl::Reference< SwXFootnotes >  SwXTextDocument::getSwXFootnotes()
 {
     SolarMutexGuard aGuard;
     ThrowIfInvalid();
@@ -642,6 +647,11 @@ Reference< XPropertySet >  SAL_CALL
 }
 
 Reference< XIndexAccess >  SwXTextDocument::getEndnotes()
+{
+    return getSwXEndnotes();
+}
+
+rtl::Reference< SwXFootnotes >  SwXTextDocument::getSwXEndnotes()
 {
     SolarMutexGuard aGuard;
     ThrowIfInvalid();
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index 9f4920657a03..a00466a10e0b 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -4370,24 +4370,24 @@ static void lcl_PasteRedlines(
 }
 
 bool DomainMapper_Impl::CopyTemporaryNotes(
-        uno::Reference< text::XFootnote > xNoteSrc,
-        uno::Reference< text::XFootnote > xNoteDest )
+        rtl::Reference< SwXFootnote > xNoteSrc,
+        rtl::Reference< SwXFootnote > xNoteDest )
 {
     if (!m_bSaxError && xNoteSrc != xNoteDest)
     {
-        uno::Reference< text::XText > xSrc( xNoteSrc, uno::UNO_QUERY_THROW );
-        uno::Reference< text::XText > xDest( xNoteDest, uno::UNO_QUERY_THROW );
-        uno::Reference< text::XTextCopy > xTxt, xTxt2;
-        xTxt.set(  xSrc, uno::UNO_QUERY_THROW );
-        xTxt2.set( xDest, uno::UNO_QUERY_THROW );
-        xTxt2->copyText( xTxt );
+//        uno::Reference< text::XText > xSrc( xNoteSrc, uno::UNO_QUERY_THROW );
+//        uno::Reference< text::XText > xDest( xNoteDest, uno::UNO_QUERY_THROW 
);
+//        uno::Reference< text::XTextCopy > xTxt, xTxt2;
+//        xTxt.set(  xSrc, uno::UNO_QUERY_THROW );
+//        xTxt2.set( xDest, uno::UNO_QUERY_THROW );
+        xNoteDest->copyText( xNoteSrc );
 
         // copy its redlines
         std::vector<sal_Int32> redPos, redLen;
         sal_Int32 redIdx;
         enum StoredRedlines eType = IsInFootnote() ? StoredRedlines::FOOTNOTE 
: StoredRedlines::ENDNOTE;
-        lcl_CopyRedlines(xSrc, m_aStoredRedlines[eType], redPos, redLen, 
redIdx);
-        lcl_PasteRedlines(xDest, m_aStoredRedlines[eType], redPos, redLen, 
redIdx);
+        lcl_CopyRedlines(xNoteSrc, m_aStoredRedlines[eType], redPos, redLen, 
redIdx);
+        lcl_PasteRedlines(xNoteDest, m_aStoredRedlines[eType], redPos, redLen, 
redIdx);
 
         // remove processed redlines
         for( size_t i = 0; redIdx > -1 && i <= 
sal::static_int_cast<size_t>(redIdx) + 2; i++)
@@ -4402,40 +4402,36 @@ bool DomainMapper_Impl::CopyTemporaryNotes(
 void DomainMapper_Impl::RemoveTemporaryFootOrEndnotes()
 {
     rtl::Reference< SwXTextDocument> xTextDoc( GetTextDocument() );
-    uno::Reference< text::XFootnote > xNote;
+    rtl::Reference< SwXFootnote > xNote;
     if  (GetFootnoteCount() > 0)
     {
-        auto xFootnotes = xTextDoc->getFootnotes();
+        rtl::Reference<SwXFootnotes> xFootnotes = xTextDoc->getSwXFootnotes();
         if ( m_nFirstFootnoteIndex > 0 )
         {
-            uno::Reference< text::XFootnote > xFirstNote;
-            xFootnotes->getByIndex(0) >>= xFirstNote;
-            uno::Reference< text::XText > xText( xFirstNote, 
uno::UNO_QUERY_THROW );
-            xText->setString(u""_ustr);
-            xFootnotes->getByIndex(m_nFirstFootnoteIndex) >>= xNote;
+            rtl::Reference< SwXFootnote > xFirstNote = 
xFootnotes->getFootnoteByIndex(0);
+            xFirstNote->setString(u""_ustr);
+            xNote = xFootnotes->getFootnoteByIndex(m_nFirstFootnoteIndex);
             CopyTemporaryNotes(xNote, xFirstNote);
         }
         for (sal_Int32 i = GetFootnoteCount(); i > 0; --i)
         {
-            xFootnotes->getByIndex(i) >>= xNote;
+            xNote = xFootnotes->getFootnoteByIndex(i);
             xNote->getAnchor()->setString(u""_ustr);
         }
     }
     if  (GetEndnoteCount() > 0)
     {
-        auto xEndnotes = xTextDoc->getEndnotes();
+        rtl::Reference<SwXFootnotes> xEndnotes = xTextDoc->getSwXEndnotes();
         if ( m_nFirstEndnoteIndex > 0 )
         {
-            uno::Reference< text::XFootnote > xFirstNote;
-            xEndnotes->getByIndex(0) >>= xFirstNote;
-            uno::Reference< text::XText > xText( xFirstNote, 
uno::UNO_QUERY_THROW );
-            xText->setString(u""_ustr);
-            xEndnotes->getByIndex(m_nFirstEndnoteIndex) >>= xNote;
+            rtl::Reference< SwXFootnote > xFirstNote = 
xEndnotes->getFootnoteByIndex(0);
+            xFirstNote->setString(u""_ustr);
+            xNote = xEndnotes->getFootnoteByIndex(m_nFirstEndnoteIndex);
             CopyTemporaryNotes(xNote, xFirstNote);
         }
         for (sal_Int32 i = GetEndnoteCount(); i > 0; --i)
         {
-            xEndnotes->getByIndex(i) >>= xNote;
+            xNote = xEndnotes->getFootnoteByIndex(i);
             xNote->getAnchor()->setString(u""_ustr);
         }
     }
@@ -4473,13 +4469,13 @@ void DomainMapper_Impl::PopFootOrEndnote()
     if ( m_xTextDocument && IsInFootOrEndnote() && ( ( IsInFootnote() && 
GetFootnoteCount() > -1 ) ||
          ( !IsInFootnote() && GetEndnoteCount() > -1 ) ) )
     {
-        uno::Reference< text::XFootnote > xNoteFirst, xNoteLast;
-        auto xFootnotes = m_xTextDocument->getFootnotes();
-        auto xEndnotes = m_xTextDocument->getEndnotes();
+        rtl::Reference< SwXFootnote > xNoteFirst, xNoteLast;
+        rtl::Reference<SwXFootnotes> xFootnotes = 
m_xTextDocument->getSwXFootnotes();
+        rtl::Reference<SwXFootnotes> xEndnotes = 
m_xTextDocument->getSwXEndnotes();
         if ( ( ( IsInFootnote() && xFootnotes->getCount() > 1 &&
-                       ( xFootnotes->getByIndex(xFootnotes->getCount()-1) >>= 
xNoteLast ) ) ||
+                       ( xNoteLast = 
xFootnotes->getFootnoteByIndex(xFootnotes->getCount()-1) ) ) ||
                ( !IsInFootnote() && xEndnotes->getCount() > 1 &&
-                       ( xEndnotes->getByIndex(xEndnotes->getCount()-1) >>= 
xNoteLast ) )
+                       ( xNoteLast = 
xEndnotes->getFootnoteByIndex(xEndnotes->getCount()-1) ) )
              ) && xNoteLast->getLabel().isEmpty() )
         {
             // copy content of the next temporary footnote
@@ -4493,7 +4489,7 @@ void DomainMapper_Impl::PopFootOrEndnote()
                         m_bSaxError = true;
                     else
                     {
-                        xFootnotes->getByIndex(m_aFootnoteIds.front()) >>= 
xNoteFirst;
+                        xNoteFirst = 
xFootnotes->getFootnoteByIndex(m_aFootnoteIds.front());
                         m_aFootnoteIds.pop_front();
                     }
                 }
@@ -4505,7 +4501,7 @@ void DomainMapper_Impl::PopFootOrEndnote()
                         m_bSaxError = true;
                     else
                     {
-                        xEndnotes->getByIndex(m_aEndnoteIds.front()) >>= 
xNoteFirst;
+                        xNoteFirst = 
xEndnotes->getFootnoteByIndex(m_aEndnoteIds.front());
                         m_aEndnoteIds.pop_front();
                     }
                 }
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx
index 6c2123b743c7..af3f7bd419a1 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx
@@ -956,8 +956,8 @@ public:
     sal_Int32 GetEndnoteCount() const { return m_nEndnotes; }
     void IncrementEndnoteCount() { ++m_nEndnotes; }
     bool CopyTemporaryNotes(
-        css::uno::Reference< css::text::XFootnote > xNoteSrc,
-        css::uno::Reference< css::text::XFootnote > xNoteDest );
+        rtl::Reference< SwXFootnote > xNoteSrc,
+        rtl::Reference< SwXFootnote > xNoteDest );
     void RemoveTemporaryFootOrEndnotes();
 
     void PushAnnotation();
diff --git a/sw/source/writerfilter/dmapper/PropertyMap.hxx 
b/sw/source/writerfilter/dmapper/PropertyMap.hxx
index 565b42c020e4..e03224125859 100644
--- a/sw/source/writerfilter/dmapper/PropertyMap.hxx
+++ b/sw/source/writerfilter/dmapper/PropertyMap.hxx
@@ -30,6 +30,7 @@
 #include <com/sun/star/uno/Any.h>
 #include <com/sun/star/drawing/XShape.hpp>
 #include "PropertyIds.hxx"
+#include <unofootnote.hxx>
 #include <memory>
 #include <optional>
 #include <map>
@@ -142,7 +143,7 @@ private:
 
     // marks context as footnote context - ::text( ) events contain either the 
footnote character or can be ignored
     // depending on sprmCSymbol
-    css::uno::Reference< css::text::XFootnote > m_xFootnote;
+    rtl::Reference< SwXFootnote >               m_xFootnote;
     OUString m_sFootnoteCharStyleName;
     std::map< PropertyIds, PropValue >          m_vMap;
     std::vector< RedlineParamsPtr >             m_aRedlines;
@@ -174,10 +175,10 @@ public:
     bool isSet( PropertyIds eId ) const;
     bool isDocDefault( PropertyIds eId ) const;
 
-    const css::uno::Reference< css::text::XFootnote >& GetFootnote() const { 
return m_xFootnote; }
+    const rtl::Reference< SwXFootnote >& GetFootnote() const { return 
m_xFootnote; }
     const OUString& GetFootnoteStyle() const { return 
m_sFootnoteCharStyleName; }
 
-    void SetFootnote(const css::uno::Reference< css::text::XFootnote >& 
xFootnote, const OUString& sStyleName)
+    void SetFootnote(const rtl::Reference< SwXFootnote >& xFootnote, const 
OUString& sStyleName)
     {
         m_xFootnote = xFootnote;
         m_sFootnoteCharStyleName = sStyleName;

Reply via email to