xmloff/source/text/txtparae.cxx |  200 ++++++++++++++++++++--------------------
 1 file changed, 100 insertions(+), 100 deletions(-)

New commits:
commit 12364a7d4ca2f74f57d9a4f3a63ad4dfe8205bb6
Author:     Stephan Bergmann <[email protected]>
AuthorDate: Tue Jun 20 09:20:12 2023 +0200
Commit:     Stephan Bergmann <[email protected]>
CommitDate: Tue Jun 20 12:57:37 2023 +0200

    XMLTextParagraphExport::DocumentListNodes must be a complete type
    
    ...at least when building with --with-latest-c++ against recent LLVM 17 
trunk
    libc++,
    
    > In file included from xmloff/source/text/txtparae.cxx:22:
    > In file included from include/o3tl/any.hxx:21:
    > In file included from include/com/sun/star/uno/Any.hxx:28:
    > In file included from ~/llvm/inst/bin/../include/c++/v1/algorithm:1779:
    > In file included from 
~/llvm/inst/bin/../include/c++/v1/__algorithm/inplace_merge.h:27:
    > In file included from 
~/llvm/inst/bin/../include/c++/v1/__memory/uninitialized_buffer.h:14:
    > ~/llvm/inst/bin/../include/c++/v1/__memory/unique_ptr.h:63:19: error: 
invalid application of 'sizeof' to an incomplete type 
'XMLTextParagraphExport::DocumentListNodes'
    >    63 |     static_assert(sizeof(_Tp) >= 0, "cannot delete an incomplete 
type");
    >       |                   ^~~~~~~~~~~
    > ~/llvm/inst/bin/../include/c++/v1/__memory/unique_ptr.h:297:7: note: in 
instantiation of member function 
'std::default_delete<XMLTextParagraphExport::DocumentListNodes>::operator()' 
requested here
    >   297 |       __ptr_.second()(__tmp);
    >       |       ^
    > ~/llvm/inst/bin/../include/c++/v1/__memory/unique_ptr.h:263:75: note: in 
instantiation of member function 
'std::unique_ptr<XMLTextParagraphExport::DocumentListNodes>::reset' requested 
here
    >   263 |   _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 
~unique_ptr() { reset(); }
    >       |                                                                   
        ^
    > xmloff/source/text/txtparae.cxx:1333:25: note: in instantiation of member 
function 
'std::unique_ptr<XMLTextParagraphExport::DocumentListNodes>::~unique_ptr' 
requested here
    >  1333 | XMLTextParagraphExport::XMLTextParagraphExport(
    >       |                         ^
    > include/xmloff/txtparae.hxx:115:12: note: forward declaration of 
'XMLTextParagraphExport::DocumentListNodes'
    >   115 |     struct DocumentListNodes;
    >       |            ^
    
    Change-Id: I319c1f682258950caf3571f51e5443d6753bcccd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153312
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <[email protected]>

diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index 34e12aec02b2..6407e0248626 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -1330,6 +1330,106 @@ struct XMLTextParagraphExport::Impl
     }
 };
 
+struct XMLTextParagraphExport::DocumentListNodes
+{
+    struct NodeData
+    {
+        sal_Int32 index; // see SwNode::GetIndex and SwNodeOffset
+        sal_uInt64 style_id; // actually a pointer to NumRule
+        OUString list_id;
+    };
+    std::vector<NodeData> docListNodes;
+    DocumentListNodes(const css::uno::Reference<css::frame::XModel>& xModel)
+    {
+        // Sequence of nodes, each of them represented by three-element 
sequence,
+        // corresponding to NodeData members
+        css::uno::Sequence<css::uno::Sequence<css::uno::Any>> nodes;
+        if (auto xPropSet = xModel.query<css::beans::XPropertySet>())
+        {
+            try
+            {
+                // See SwXTextDocument::getPropertyValue
+                xPropSet->getPropertyValue("ODFExport_ListNodes") >>= nodes;
+            }
+            catch (css::beans::UnknownPropertyException&)
+            {
+                // That's absolutely fine!
+            }
+        }
+
+        docListNodes.reserve(nodes.getLength());
+        for (const auto& node : nodes)
+        {
+            assert(node.getLength() == 3);
+            docListNodes.push_back({ node[0].get<sal_Int32>(), 
node[1].get<sal_uInt64>(),
+                                     node[2].get<OUString>() });
+        }
+
+        std::sort(docListNodes.begin(), docListNodes.end(),
+                  [](const NodeData& lhs, const NodeData& rhs) { return 
lhs.index < rhs.index; });
+    }
+    bool ShouldSkipListId(const Reference<XTextContent>& xTextContent) const
+    {
+        if (docListNodes.empty())
+            return false;
+
+        if (auto xPropSet = xTextContent.query<css::beans::XPropertySet>())
+        {
+            sal_Int32 index = 0;
+            try
+            {
+                // See SwXParagraph::Impl::GetPropertyValues_Impl
+                xPropSet->getPropertyValue("ODFExport_NodeIndex") >>= index;
+            }
+            catch (css::beans::UnknownPropertyException&)
+            {
+                // That's absolutely fine!
+                return false;
+            }
+
+            auto it = std::lower_bound(docListNodes.begin(), 
docListNodes.end(), index,
+                                       [](const NodeData& lhs, sal_Int32 rhs)
+                                       { return lhs.index < rhs; });
+            if (it == docListNodes.end() || it->index != index)
+                return false;
+
+            // We need to write the id, when there will be continuation of the 
list either with
+            // a different list style, or after another list.
+
+            for (auto next = it + 1; next != docListNodes.end(); ++next)
+            {
+                if (it->list_id != next->list_id)
+                {
+                    // List changed. We will have to refer to this id, only if 
there will
+                    // appear a continuation of this list
+                    return std::find_if(next + 1, docListNodes.end(),
+                                        [list_id = it->list_id](const 
NodeData& data)
+                                        { return data.list_id == list_id; })
+                           == docListNodes.end();
+                }
+
+                if (it->style_id != next->style_id)
+                {
+                    // Same list, new style -> this "next" will refer to the 
id, no skipping
+                    return false;
+                }
+                if (it->index + 1 != next->index)
+                {
+                    // we have a gap before the next node with the same list 
and style,
+                    // with no other lists in between. There will be a 
continuation with a
+                    // simple 'text:continue-numbering="true"'.
+                    return true;
+                }
+                it = next; // walk through adjacent nodes of the same list
+            }
+            // all nodes were adjacent and of the same list and style -> no 
continuation, skip id
+            return true;
+        }
+
+        return false;
+    }
+};
+
 XMLTextParagraphExport::XMLTextParagraphExport(
         SvXMLExport& rExp,
         SvXMLAutoStylePoolP & rASP
@@ -1796,106 +1896,6 @@ bool XMLTextParagraphExport::ExportListId() const
            && GetExport().getSaneDefaultVersion() >= 
SvtSaveOptions::ODFSVER_012;
 }
 
-struct XMLTextParagraphExport::DocumentListNodes
-{
-    struct NodeData
-    {
-        sal_Int32 index; // see SwNode::GetIndex and SwNodeOffset
-        sal_uInt64 style_id; // actually a pointer to NumRule
-        OUString list_id;
-    };
-    std::vector<NodeData> docListNodes;
-    DocumentListNodes(const css::uno::Reference<css::frame::XModel>& xModel)
-    {
-        // Sequence of nodes, each of them represented by three-element 
sequence,
-        // corresponding to NodeData members
-        css::uno::Sequence<css::uno::Sequence<css::uno::Any>> nodes;
-        if (auto xPropSet = xModel.query<css::beans::XPropertySet>())
-        {
-            try
-            {
-                // See SwXTextDocument::getPropertyValue
-                xPropSet->getPropertyValue("ODFExport_ListNodes") >>= nodes;
-            }
-            catch (css::beans::UnknownPropertyException&)
-            {
-                // That's absolutely fine!
-            }
-        }
-
-        docListNodes.reserve(nodes.getLength());
-        for (const auto& node : nodes)
-        {
-            assert(node.getLength() == 3);
-            docListNodes.push_back({ node[0].get<sal_Int32>(), 
node[1].get<sal_uInt64>(),
-                                     node[2].get<OUString>() });
-        }
-
-        std::sort(docListNodes.begin(), docListNodes.end(),
-                  [](const NodeData& lhs, const NodeData& rhs) { return 
lhs.index < rhs.index; });
-    }
-    bool ShouldSkipListId(const Reference<XTextContent>& xTextContent) const
-    {
-        if (docListNodes.empty())
-            return false;
-
-        if (auto xPropSet = xTextContent.query<css::beans::XPropertySet>())
-        {
-            sal_Int32 index = 0;
-            try
-            {
-                // See SwXParagraph::Impl::GetPropertyValues_Impl
-                xPropSet->getPropertyValue("ODFExport_NodeIndex") >>= index;
-            }
-            catch (css::beans::UnknownPropertyException&)
-            {
-                // That's absolutely fine!
-                return false;
-            }
-
-            auto it = std::lower_bound(docListNodes.begin(), 
docListNodes.end(), index,
-                                       [](const NodeData& lhs, sal_Int32 rhs)
-                                       { return lhs.index < rhs; });
-            if (it == docListNodes.end() || it->index != index)
-                return false;
-
-            // We need to write the id, when there will be continuation of the 
list either with
-            // a different list style, or after another list.
-
-            for (auto next = it + 1; next != docListNodes.end(); ++next)
-            {
-                if (it->list_id != next->list_id)
-                {
-                    // List changed. We will have to refer to this id, only if 
there will
-                    // appear a continuation of this list
-                    return std::find_if(next + 1, docListNodes.end(),
-                                        [list_id = it->list_id](const 
NodeData& data)
-                                        { return data.list_id == list_id; })
-                           == docListNodes.end();
-                }
-
-                if (it->style_id != next->style_id)
-                {
-                    // Same list, new style -> this "next" will refer to the 
id, no skipping
-                    return false;
-                }
-                if (it->index + 1 != next->index)
-                {
-                    // we have a gap before the next node with the same list 
and style,
-                    // with no other lists in between. There will be a 
continuation with a
-                    // simple 'text:continue-numbering="true"'.
-                    return true;
-                }
-                it = next; // walk through adjacent nodes of the same list
-            }
-            // all nodes were adjacent and of the same list and style -> no 
continuation, skip id
-            return true;
-        }
-
-        return false;
-    }
-};
-
 bool XMLTextParagraphExport::ShouldSkipListId(const Reference<XTextContent>& 
xTextContent)
 {
     if (!mpDocumentListNodes)

Reply via email to