]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetText.cpp
Remove all BufferParam arguments in InsetXXX methods (since insets know about their...
[lyx.git] / src / insets / InsetText.cpp
index 9676e459821d94ca81a5aa62ae1262d74b478ddb..a396041a30bbb453b7725cf64aa325835495df3e 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"
@@ -315,15 +316,15 @@ void InsetText::setChange(Change const & change)
 }
 
 
-void InsetText::acceptChanges(BufferParams const & bparams)
+void InsetText::acceptChanges()
 {
-       text_.acceptChanges(bparams);
+       text_.acceptChanges(buffer().params());
 }
 
 
-void InsetText::rejectChanges(BufferParams const & bparams)
+void InsetText::rejectChanges()
 {
-       text_.rejectChanges(bparams);
+       text_.rejectChanges(buffer().params());
 }
 
 
@@ -368,9 +369,10 @@ int InsetText::docbook(odocstream & os, OutputParams const & runparams) const
 }
 
 
-void InsetText::xhtml(odocstream & os, OutputParams const & runparams) const
+docstring InsetText::xhtml(odocstream & os, OutputParams const & runparams) const
 {
        xhtmlParagraphs(paragraphs(), buffer(), os, runparams);
+       return docstring();
 }
 
 
@@ -650,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