]> git.lyx.org Git - features.git/commitdiff
InsetIndex: add a method hasSubentries.
authorThibaut Cuvelier <tcuvelier@lyx.org>
Mon, 25 Apr 2022 01:34:29 +0000 (03:34 +0200)
committerThibaut Cuvelier <tcuvelier@lyx.org>
Sat, 30 Apr 2022 01:23:59 +0000 (03:23 +0200)
src/insets/InsetIndex.cpp
src/insets/InsetIndex.h

index afa25f10fcc53f47806f176fce61c55f32d23956..8a75622c45f60b1c10ea06e5e327d5fefc85a85b 100644 (file)
@@ -769,6 +769,23 @@ std::vector<docstring> InsetIndex::getSeeAlsoesAsText(OutputParams const & runpa
 }
 
 
+bool InsetIndex::hasSubentries() const
+{
+       Paragraph const & par = paragraphs().front();
+       InsetList::const_iterator it = par.insetList().begin();
+       for (; it != par.insetList().end(); ++it) {
+               Inset & inset = *it->inset;
+               if (inset.lyxCode() == INDEXMACRO_CODE) {
+                       InsetIndexMacro const & iim =
+                               static_cast<InsetIndexMacro const &>(inset);
+                       if (iim.params().type == InsetIndexMacroParams::Subindex)
+                               return true;
+               }
+       }
+       return false;
+}
+
+
 bool InsetIndex::hasSeeRef() const
 {
        Paragraph const & par = paragraphs().front();
index 3a22b3b772e75e66a4465743ad96827d692a9d47..ccf214b2e1ca1ac3e5da4ac20738fe976e60c253 100644 (file)
@@ -106,6 +106,8 @@ private:
        ///
        std::vector<docstring> getSeeAlsoesAsText(OutputParams const & runparams) const;
        ///
+       bool hasSubentries() const;
+       ///
        bool hasSeeRef() const;
        ///
        bool hasSortKey() const;