lyx_mirror/src/insets/InsetWrap.h
Richard Heck ecef54500d Introduce max_length parameter for plaintext() output routines,
so we can write a limited amount when using this for TOC and
tooltip output.

This should solve the problem with slowness that Kornel noticed,
which was caused by our trying to write an entire plaintext
bibliography every time we updated the TOC. We did that because
he had a bibliography inside a branch, and we use plaintext for
creating the tooltip that goes with the branch list.

Other related bugs were fixed along the way. E.g., it turns out
that, if someone had an InsetInclude inside a branch, then we would
have been writing a *plaintext file* for that inset every time we
updated the TOC. I wonder if some of the other reports of slowness
we have received might be due to this kind of issue?
2013-03-08 15:12:58 -05:00

98 lines
1.9 KiB
C++

// -*- C++ -*-
/**
* \file InsetWrap.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Dekel Tsur
*
* Full author contact details are available in file CREDITS.
*/
#ifndef INSETWRAP_H
#define INSETWRAP_H
#include "InsetCollapsable.h"
#include "Length.h"
namespace lyx {
class InsetWrapParams {
public:
///
void write(std::ostream &) const;
///
void read(Lexer &);
///
std::string type;
///
int lines;
///
std::string placement;
///
Length overhang;
///
Length width;
};
/** The wrap inset
*/
class InsetWrap : public InsetCollapsable {
public:
///
InsetWrap(Buffer *, std::string const &);
///
~InsetWrap();
///
InsetWrapParams const & params() const { return params_; }
///
static void string2params(std::string const &, InsetWrapParams &);
///
static std::string params2string(InsetWrapParams const &);
private:
///
void write(std::ostream & os) const;
///
void read(Lexer & lex);
///
void validate(LaTeXFeatures & features) const;
///
InsetCode lyxCode() const { return WRAP_CODE; }
///
docstring toolTip(BufferView const & bv, int x, int y) const;
///
void latex(otexstream &, OutputParams const &) const;
///
int plaintext(odocstringstream & ods, OutputParams const & op,
size_t max_length = INT_MAX) const;
///
int docbook(odocstream &, OutputParams const &) const;
///
docstring xhtml(XHTMLStream &, OutputParams const &) const;
///
bool insetAllowed(InsetCode) const;
///
bool showInsetDialog(BufferView *) const;
///
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
/// Update the counters of this inset and of its contents
void updateBuffer(ParIterator const &, UpdateType);
///
void doDispatch(Cursor & cur, FuncRequest & cmd);
///
docstring layoutName() const;
///
Inset * clone() const { return new InsetWrap(*this); }
///
InsetWrapParams params_;
};
} // namespace lyx
#endif