Prepare for longtable caption support.

* setCaptionLabels(): Pass type and label instead of Floating object.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17054 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-02-05 14:09:53 +00:00
parent 1c945497fb
commit e1caf60408

View File

@ -352,8 +352,8 @@ bool needEnumCounterReset(ParIterator const & it)
} }
void setCaptionLabels(InsetBase & inset, Floating const & fl, void setCaptionLabels(InsetBase & inset, string const & type,
Counters & counters) docstring const label, Counters & counters)
{ {
LyXText * text = inset.getText(0); LyXText * text = inset.getText(0);
if (!text) if (!text)
@ -363,10 +363,7 @@ void setCaptionLabels(InsetBase & inset, Floating const & fl,
if (pars.empty()) if (pars.empty())
return; return;
string const & type = fl.type(); docstring const counter = from_ascii(type);
docstring const counter = from_ascii(fl.type());
// FIXME UNICODE
docstring const label = from_utf8(fl.name());
ParagraphList::iterator p = pars.begin(); ParagraphList::iterator p = pars.begin();
for (; p != pars.end(); ++p) { for (; p != pars.end(); ++p) {
@ -377,7 +374,7 @@ void setCaptionLabels(InsetBase & inset, Floating const & fl,
for (; it2 != end2; ++it2) { for (; it2 != end2; ++it2) {
InsetBase & icap = *it2->inset; InsetBase & icap = *it2->inset;
// Look deeper just in case. // Look deeper just in case.
setCaptionLabels(icap, fl, counters); setCaptionLabels(icap, type, label, counters);
if (icap.lyxCode() == InsetBase::CAPTION_CODE) { if (icap.lyxCode() == InsetBase::CAPTION_CODE) {
// We found a caption! // We found a caption!
counters.step(counter); counters.step(counter);
@ -407,12 +404,15 @@ void setCaptions(Paragraph & par, LyXTextClass const & textclass)
&& inset.lyxCode() != InsetBase::WRAP_CODE) && inset.lyxCode() != InsetBase::WRAP_CODE)
continue; continue;
docstring const & type = inset.getInsetName(); docstring const & name = inset.getInsetName();
if (type.empty()) if (name.empty())
continue; continue;
Floating const & fl = textclass.floats().getType(to_ascii(type)); Floating const & fl = textclass.floats().getType(to_ascii(name));
setCaptionLabels(inset, fl, counters); // FIXME UNICODE
string const & type = fl.type();
docstring const label = from_utf8(fl.name());
setCaptionLabels(inset, type, label, counters);
} }
} }