mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 21:40:19 +00:00
Don't #include "counters.h" in paragraph.h.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4892 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
509ed151ac
commit
22909c4ae1
@ -2197,3 +2197,10 @@ bool Paragraph::isFreeSpacing() const
|
||||
return (pimpl_->inset_owner->owner()->lyxCode() == Inset::ERT_CODE);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Counters & Paragraph::counters()
|
||||
{
|
||||
return pimpl_->ctrs;
|
||||
}
|
||||
|
||||
|
@ -13,21 +13,23 @@
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "lyxlayout_ptr_fwd.h"
|
||||
#include "lyxfont.h" // Just for LyXFont::FONT_SIZE
|
||||
|
||||
#include "insets/inset.h" // Just for Inset::Code
|
||||
|
||||
#include "support/types.h"
|
||||
|
||||
#include "LString.h"
|
||||
|
||||
#include "lyxlayout_ptr_fwd.h"
|
||||
#include "insets/inset.h" // Just for Inset::Code
|
||||
#include "lyxfont.h" // Just for LyXFont::FONT_SIZE
|
||||
#include "support/types.h"
|
||||
#include "counters.h"
|
||||
|
||||
class ParagraphParameters;
|
||||
class BufferParams;
|
||||
class TexRow;
|
||||
class LaTeXFeatures;
|
||||
class InsetBibKey;
|
||||
class BufferView;
|
||||
class Counters;
|
||||
class InsetBibKey;
|
||||
class Language;
|
||||
class LaTeXFeatures;
|
||||
class ParagraphParameters;
|
||||
class TexRow;
|
||||
|
||||
// After 1.2.0 is released, during 1.3.0cvs, we enable this. And after
|
||||
// a while we verify that reading of 1.2.x files work perfectly we remove
|
||||
@ -396,7 +398,7 @@ public:
|
||||
inset_iterator InsetIterator(lyx::pos_type pos);
|
||||
|
||||
///
|
||||
Counters ctrs;
|
||||
Counters & counters();
|
||||
|
||||
private:
|
||||
/// if anything uses this we don't want it to.
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include "paragraph.h"
|
||||
#include "ParagraphParameters.h"
|
||||
#include "counters.h"
|
||||
|
||||
#include <boost/array.hpp>
|
||||
|
||||
@ -154,6 +155,9 @@ struct Paragraph::Pimpl {
|
||||
static unsigned int paragraph_id;
|
||||
///
|
||||
ParagraphParameters params;
|
||||
///
|
||||
Counters ctrs;
|
||||
|
||||
private:
|
||||
/// match a string against a particular point in the paragraph
|
||||
bool isTextAt(string const & str, lyx::pos_type pos) const;
|
||||
|
32
src/text2.C
32
src/text2.C
@ -1222,17 +1222,17 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const
|
||||
// unless this is the first paragraph
|
||||
if (par->previous()) {
|
||||
|
||||
par->ctrs.copy(par->previous()->ctrs, par->ctrs, "");
|
||||
par->counters().copy(par->previous()->counters(), par->counters(), "");
|
||||
|
||||
par->params().appendix(par->previous()->params().appendix());
|
||||
if (!par->params().appendix() && par->params().startOfAppendix()) {
|
||||
par->params().appendix(true);
|
||||
par->ctrs.reset("");
|
||||
par->counters().reset("");
|
||||
}
|
||||
par->enumdepth = par->previous()->enumdepth;
|
||||
par->itemdepth = par->previous()->itemdepth;
|
||||
} else {
|
||||
par->ctrs.reset("");
|
||||
par->counters().reset("");
|
||||
par->params().appendix(par->params().startOfAppendix());
|
||||
par->enumdepth = 0;
|
||||
par->itemdepth = 0;
|
||||
@ -1258,8 +1258,8 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const
|
||||
&& par->previous()->getDepth() > par->getDepth()
|
||||
&& layout->labeltype != LABEL_BIBLIO) {
|
||||
par->enumdepth = par->depthHook(par->getDepth())->enumdepth;
|
||||
par->ctrs.set(par->ctrs.enums[par->enumdepth],
|
||||
par->depthHook(par->getDepth())->ctrs.value(par->ctrs.enums[par->enumdepth]));
|
||||
par->counters().set(par->counters().enums[par->enumdepth],
|
||||
par->depthHook(par->getDepth())->counters().value(par->counters().enums[par->enumdepth]));
|
||||
}
|
||||
|
||||
if (!par->params().labelString().empty()) {
|
||||
@ -1283,7 +1283,7 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const
|
||||
|
||||
if (i >= 0 && i<= buf->params.secnumdepth) {
|
||||
|
||||
par->ctrs.step(par->ctrs.sects[i]);
|
||||
par->counters().step(par->counters().sects[i]);
|
||||
|
||||
// Is there a label? Useful for Chapter layout
|
||||
if (!par->params().appendix()) {
|
||||
@ -1310,7 +1310,7 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const
|
||||
langtype = "latin";
|
||||
}
|
||||
|
||||
s << par->ctrs.numberLabel(par->ctrs.sects[i],
|
||||
s << par->counters().numberLabel(par->counters().sects[i],
|
||||
numbertype, langtype, head);
|
||||
|
||||
par->params().labelString(par->params().labelString() +s.str().c_str());
|
||||
@ -1318,20 +1318,20 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const
|
||||
// possible...
|
||||
|
||||
// reset enum counters
|
||||
par->ctrs.reset("enum");
|
||||
par->counters().reset("enum");
|
||||
} else if (layout->labeltype < LABEL_COUNTER_ENUMI) {
|
||||
par->ctrs.reset("enum");
|
||||
par->counters().reset("enum");
|
||||
} else if (layout->labeltype == LABEL_COUNTER_ENUMI) {
|
||||
par->ctrs.step(par->ctrs.enums[par->enumdepth]);
|
||||
par->counters().step(par->counters().enums[par->enumdepth]);
|
||||
|
||||
s << par->ctrs.numberLabel(par->ctrs.enums[par->enumdepth],
|
||||
s << par->counters().numberLabel(par->counters().enums[par->enumdepth],
|
||||
"enumeration", langtype);
|
||||
par->params().labelString(s.str().c_str());
|
||||
|
||||
}
|
||||
} else if (layout->labeltype == LABEL_BIBLIO) {// ale970302
|
||||
par->ctrs.step("bibitem");
|
||||
int number = par->ctrs.value("bibitem");
|
||||
par->counters().step("bibitem");
|
||||
int number = par->counters().value("bibitem");
|
||||
if (!par->bibkey) {
|
||||
InsetCommandParams p("bibitem" );
|
||||
par->bibkey = new InsetBibKey(p);
|
||||
@ -1354,10 +1354,10 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const
|
||||
= floatList.getType(tmp->type());
|
||||
|
||||
// Why doesn't it work? -- MV
|
||||
par->ctrs.step(fl.name());
|
||||
par->counters().step(fl.name());
|
||||
// We should get the correct number here too.
|
||||
ostringstream o;
|
||||
o << fl.name() << " " << par->ctrs.value(fl.name()) << ":";
|
||||
o << fl.name() << " " << par->counters().value(fl.name()) << ":";
|
||||
s = o.str();
|
||||
} else {
|
||||
/* par->SetLayout(0);
|
||||
@ -1371,7 +1371,7 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const
|
||||
/* reset the enumeration counter. They are always resetted
|
||||
* when there is any other layout between */
|
||||
for (int i = par->enumdepth + 1; i < 4; i++) {
|
||||
par->ctrs.set(par->ctrs.enums[i], 0);
|
||||
par->counters().set(par->counters().enums[i], 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user