commit e266410190e77980157cebc7bb87dc3c12139a11
Author: Juergen Spitzmueller <[email protected]>
Date:   Sat Jul 26 14:18:59 2025 +0200

    add Counters::currentParentCounter()
---
 src/Counters.cpp | 14 ++++++++++++++
 src/Counters.h   |  2 ++
 2 files changed, 16 insertions(+)

diff --git a/src/Counters.cpp b/src/Counters.cpp
index 16bf76cda3..e29a2253da 100644
--- a/src/Counters.cpp
+++ b/src/Counters.cpp
@@ -689,6 +689,20 @@ docstring Counters::currentCounter() const
 }
 
 
+docstring Counters::currentParentCounter() const
+{
+       docstring const cc = currentCounter();
+       CounterList::const_iterator const cit = counterList_.find(cc);
+       if (cit == counterList_.end()) {
+               lyxerr << "value: Counter does not exist: "
+                      << to_utf8(cc) << endl;
+               return docstring();
+       }
+       Counter const & cnt = cit->second;
+       return cnt.parent();
+}
+
+
 void Counters::setActiveLayout(Layout const & lay)
 {
        LASSERT(!layout_stack_.empty(), return);
diff --git a/src/Counters.h b/src/Counters.h
index 8a12a3bb07..fadc0b0dbc 100644
--- a/src/Counters.h
+++ b/src/Counters.h
@@ -224,6 +224,8 @@ public:
        /// We're trying to track \refstepcounter in LaTeX, more or less.
        /// Note that this may be empty.
        docstring currentCounter() const;
+       ///
+       docstring currentParentCounter() const;
        /// Called during updateBuffer() as we go through various paragraphs,
        /// to track the layouts as we go through.
        void setActiveLayout(Layout const & lay);
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to