]> git.lyx.org Git - features.git/commitdiff
Polish some of the recent changes in accord with suggestions
authorRichard Heck <rgheck@comcast.net>
Fri, 19 Jun 2009 13:50:19 +0000 (13:50 +0000)
committerRichard Heck <rgheck@comcast.net>
Fri, 19 Jun 2009 13:50:19 +0000 (13:50 +0000)
of JMarc's.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30186 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/InsetCaption.cpp
src/insets/InsetCaption.h
src/insets/InsetCollapsable.cpp
src/insets/InsetCollapsable.h
src/insets/InsetText.cpp
src/insets/InsetText.h
src/insets/InsetWrap.cpp
src/insets/InsetWrap.h

index c51efa9976b009ba38f114458fccbb6e661bbd68..55224d8abdf5a083a7ecfb70517e984faca253f9 100644 (file)
@@ -256,8 +256,8 @@ int InsetCaption::docbook(odocstream & os,
 }
 
 
-docstring InsetCaption::xhtml(odocstream & os,
-                         OutputParams const & runparams) const
+docstring InsetCaption::xhtml(odocstream &,
+                         OutputParams const &) const
 {
        return docstring();
 }
@@ -276,7 +276,7 @@ int InsetCaption::getOptArg(odocstream & os,
 }
 
 
-int InsetCaption::getCaptionText(odocstream & os,
+int InsetCaption::getCaptionAsPlaintext(odocstream & os,
                        OutputParams const & runparams) const
 {
        os << full_label_ << ' ';
@@ -284,7 +284,7 @@ int InsetCaption::getCaptionText(odocstream & os,
 }
 
 
-docstring InsetCaption::getCaptionHTML(odocstream & os,
+docstring InsetCaption::getCaptionAsHTML(odocstream & os,
                        OutputParams const & runparams) const
 {
        os << full_label_ << ' ';
index 83a3d61e79c95f2d2a3cddee1b3b81b1f1f3815c..a942752126ad194e95bbb70aa8e1699c8722881a 100644 (file)
@@ -29,9 +29,9 @@ public:
        /// return the optional argument(s) only
        int getOptArg(odocstream & os, OutputParams const &) const;
        /// return the caption text
-       int getCaptionText(odocstream & os, OutputParams const &) const;
+       int getCaptionAsPlaintext(odocstream & os, OutputParams const &) const;
        /// return the caption text as HTML
-       docstring getCaptionHTML(odocstream & os, OutputParams const &) const;
+       docstring getCaptionAsHTML(odocstream & os, OutputParams const &) const;
 private:
        ///
        void write(std::ostream & os) const;
index b12cb7025d7678057dc64ba52bca2503027091cc..b164d276693c09e848515484c834b907c2cc5b2d 100644 (file)
@@ -23,7 +23,6 @@
 #include "FloatList.h"
 #include "FuncRequest.h"
 #include "FuncStatus.h"
-#include "InsetCaption.h"
 #include "InsetLayout.h"
 #include "InsetList.h"
 #include "Language.h"
@@ -784,56 +783,6 @@ docstring InsetCollapsable::floatName(
 }
 
 
-InsetCaption const * InsetCollapsable::getCaptionInset() const
-{
-       ParagraphList::const_iterator pit = paragraphs().begin();
-       for (; pit != paragraphs().end(); ++pit) {
-               InsetList::const_iterator it = pit->insetList().begin();
-               for (; it != pit->insetList().end(); ++it) {
-                       Inset & inset = *it->inset;
-                       if (inset.lyxCode() == CAPTION_CODE) {
-                               InsetCaption const * ins =
-                                       static_cast<InsetCaption const *>(it->inset);
-                               return ins;
-                       }
-               }
-       }
-       return 0;
-}
-
-
-docstring InsetCollapsable::getCaptionText(OutputParams const & runparams) const
-{
-       if (paragraphs().empty())
-               return docstring();
-
-       InsetCaption const * ins = getCaptionInset();
-       if (ins == 0)
-               return docstring();
-
-       odocstringstream ods;
-       ins->getCaptionText(ods, runparams);
-       return ods.str();
-}
-
-
-docstring InsetCollapsable::getCaptionHTML(OutputParams const & runparams) const
-{
-       if (paragraphs().empty())
-               return docstring();
-
-       InsetCaption const * ins = getCaptionInset();
-       if (ins == 0)
-               return docstring();
-
-       odocstringstream ods;
-       docstring def = ins->getCaptionHTML(ods, runparams);
-       if (!def.empty())
-               ods << def << '\n';
-       return ods.str();
-}
-
-
 InsetLayout::InsetDecoration InsetCollapsable::decoration() const
 {
        if (!layout_)
index 730e4c6e37b9305f15f2ea1fa55f313ef420b272..de432aa8fa01447ad1d3ae3d9d82f2307fef6168 100644 (file)
@@ -23,7 +23,6 @@
 namespace lyx {
 
 class CursorSlice;
-class InsetCaption;
 class InsetLayout;
 
 namespace frontend { class Painter; }
@@ -181,12 +180,6 @@ protected:
        ///
        virtual void resetParagraphsFont();
        ///
-       InsetCaption const * getCaptionInset() const;
-       ///
-       docstring getCaptionText(OutputParams const &) const;
-       ///
-       docstring getCaptionHTML(OutputParams const &) const;
-       ///
        mutable CollapseStatus status_;
 private:
        /// cache for the layout_. Make sure it is in sync with the document class!
index ecf2b08b36ce673e752dc34dc241f41b5e5a4a45..22a95c03cc500b0e3e7245f91a8345a240255fd0 100644 (file)
@@ -26,6 +26,7 @@
 #include "ErrorList.h"
 #include "FuncRequest.h"
 #include "FuncStatus.h"
+#include "InsetCaption.h"
 #include "InsetList.h"
 #include "Intl.h"
 #include "Lexer.h"
@@ -651,4 +652,48 @@ docstring InsetText::contextMenu(BufferView const &, int, int) const
 }
 
 
+InsetCaption const * InsetText::getCaptionInset() const
+{
+       ParagraphList::const_iterator pit = paragraphs().begin();
+       for (; pit != paragraphs().end(); ++pit) {
+               InsetList::const_iterator it = pit->insetList().begin();
+               for (; it != pit->insetList().end(); ++it) {
+                       Inset & inset = *it->inset;
+                       if (inset.lyxCode() == CAPTION_CODE) {
+                               InsetCaption const * ins =
+                                       static_cast<InsetCaption const *>(it->inset);
+                               return ins;
+                       }
+               }
+       }
+       return 0;
+}
+
+
+docstring InsetText::getCaptionText(OutputParams const & runparams) const
+{
+       InsetCaption const * ins = getCaptionInset();
+       if (ins == 0)
+               return docstring();
+
+       odocstringstream ods;
+       ins->getCaptionAsPlaintext(ods, runparams);
+       return ods.str();
+}
+
+
+docstring InsetText::getCaptionHTML(OutputParams const & runparams) const
+{
+       InsetCaption const * ins = getCaptionInset();
+       if (ins == 0)
+               return docstring();
+
+       odocstringstream ods;
+       docstring def = ins->getCaptionAsHTML(ods, runparams);
+       if (!def.empty())
+               ods << def << '\n';
+       return ods.str();
+}
+
+
 } // namespace lyx
index 41ac4512a151ee07c98115730df0c8ff3507159a..ee3e4884b89443c12f4fae757c44f7b58ba1d655 100644 (file)
@@ -26,6 +26,7 @@ class CompletionList;
 class CursorSlice;
 class Dimension;
 class ParagraphList;
+class InsetCaption;
 class InsetTabular;
 
 /**
@@ -176,6 +177,13 @@ public:
        virtual docstring contextMenu(BufferView const & bv, int x, int y) const;
        ///
        void doDispatch(Cursor & cur, FuncRequest & cmd);
+protected:
+       ///
+       InsetCaption const * getCaptionInset() const;
+       ///
+       docstring getCaptionText(OutputParams const &) const;
+       ///
+       docstring getCaptionHTML(OutputParams const &) const;
 private:
        ///
        void initParagraphs(UsePlain type);
index 4e8750137fc2928d76bd47e0f0bf1f91076f959d..7d2168675d254c5bacad9ce98496b3a53063d92e 100644 (file)
@@ -259,29 +259,6 @@ bool InsetWrap::showInsetDialog(BufferView * bv) const
 }
 
 
-docstring InsetWrap::getCaptionText(OutputParams const & runparams) const
-{
-       if (paragraphs().empty())
-               return docstring();
-
-       ParagraphList::const_iterator pit = paragraphs().begin();
-       for (; pit != paragraphs().end(); ++pit) {
-               InsetList::const_iterator it = pit->insetList().begin();
-               for (; it != pit->insetList().end(); ++it) {
-                       Inset & inset = *it->inset;
-                       if (inset.lyxCode() == CAPTION_CODE) {
-                               odocstringstream ods;
-                               InsetCaption * ins =
-                                       static_cast<InsetCaption *>(it->inset);
-                               ins->getCaptionText(ods, runparams);
-                               return ods.str();
-                       }
-               }
-       }
-       return docstring();
-}
-
-
 void InsetWrap::string2params(string const & in, InsetWrapParams & params)
 {
        params = InsetWrapParams();
index aa21ebf4cf4592030e0e8fd23d975ad296e58ff7..e7c316c42a762fcce32fdd61e0c179022b2cb615 100644 (file)
@@ -85,8 +85,6 @@ private:
        ///
        void doDispatch(Cursor & cur, FuncRequest & cmd);
        ///
-       docstring getCaptionText(OutputParams const &) const;
-       ///
        docstring name() const;
        ///
        Inset * clone() const { return new InsetWrap(*this); }