#include "BufferView.h"
#include "Cursor.h"
#include "Dimension.h"
-#include "DispatchResult.h"
#include "FloatList.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
#include "InsetLayout.h"
-#include "InsetList.h"
-#include "Language.h"
#include "Lexer.h"
#include "MetricsInfo.h"
-#include "output_xhtml.h"
#include "OutputParams.h"
-#include "paragraph_funcs.h"
-#include "ParagraphParameters.h"
-#include "sgml.h"
-#include "TextClass.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
namespace lyx {
-InsetCollapsable::InsetCollapsable(Buffer const & buf, InsetText::UsePlain ltype)
- : InsetText(buf, ltype), status_(Inset::Open),
+InsetCollapsable::InsetCollapsable(Buffer * buf, InsetText::UsePlain ltype)
+ : InsetText(buf, ltype), status_(Open),
openinlined_(false), mouse_hover_(false)
{
setAutoBreakRows(true);
break;
}
os << "\n";
- text().write(buffer(), os);
+ text().write(os);
}
// Draw button first -- top, left or only
Dimension dimc = dimensionCollapsed(bv);
- if (geometry(*pi.base.bv) == TopButton ||
- geometry(*pi.base.bv) == LeftButton ||
- geometry(*pi.base.bv) == ButtonOnly) {
+ if (geometry(bv) == TopButton ||
+ geometry(bv) == LeftButton ||
+ geometry(bv) == ButtonOnly) {
button_dim.x1 = x + 0;
button_dim.x2 = x + dimc.width();
button_dim.y1 = y - dimc.asc;
{
if (geometry(bv) == ButtonOnly)
status_ = Open;
- LASSERT(geometry(bv) != ButtonOnly, /**/);
InsetText::cursorPos(bv, sl, boundary, x, y);
Dimension const textdim = InsetText::dimension(bv);
}
-bool InsetCollapsable::descendable() const
+bool InsetCollapsable::descendable(BufferView const & bv) const
{
- return geometry() != ButtonOnly;
+ return geometry(bv) != ButtonOnly;
}
docstring const InsetCollapsable::buttonLabel(BufferView const &) const
{
- return labelstring_.empty() ? getLayout().labelstring() : labelstring_;
+ return labelstring_.empty() ?
+ translateIfPossible(getLayout().labelstring()) : labelstring_;
}
}
-docstring InsetCollapsable::xhtml(odocstream & os, OutputParams const & runparams) const
-{
- InsetLayout const & il = getLayout();
- if (undefined())
- return InsetText::xhtml(os, runparams);
-
- bool const opened = html::openTag(os, il.htmltag(), il.htmlattr());
- if (!il.counter().empty()) {
- BufferParams const & bp = buffer().masterBuffer()->params();
- Counters & cntrs = bp.documentClass().counters();
- cntrs.step(il.counter());
- // FIXME: translate to paragraph language
- if (!il.htmllabel().empty())
- os << cntrs.counterLabel(from_utf8(il.htmllabel()), bp.language->code());
- }
- bool innertag_opened = false;
- if (!il.htmlinnertag().empty())
- innertag_opened = html::openTag(os, il.htmlinnertag(), il.htmlinnerattr());
- docstring deferred = InsetText::xhtml(os, runparams);
- if (innertag_opened)
- html::closeTag(os, il.htmlinnertag());
- if (opened)
- html::closeTag(os, il.htmltag());
- return deferred;
-}
-
-
docstring InsetCollapsable::contextMenu(BufferView const & bv, int x,
int y) const
{
return InsetText::contextMenu(bv, x, y);
}
-void InsetCollapsable::tocString(odocstream & os) const
-{
- if (!getLayout().isInToc())
- return;
- os << text().asString(0, 1, AS_STR_LABEL | AS_STR_INSETS);
-}
-
-
} // namespace lyx