mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 10:18:50 +00:00
Kill indexing into the list of layouts.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23505 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
ac89b178de
commit
592f951ba0
@ -230,9 +230,10 @@ bool Layout::read(Lexer & lexrc, TextClass const & tclass)
|
||||
<< to_utf8(style) << "'\n"
|
||||
<< "All layouts so far:"
|
||||
<< endl;
|
||||
for (size_t i = 0; i != tclass.layoutCount(); ++i)
|
||||
lyxerr << to_utf8(tclass.layout(i)->name())
|
||||
<< endl;
|
||||
DocumentClass::const_iterator lit = tclass.begin();
|
||||
DocumentClass::const_iterator len = tclass.end();
|
||||
for (; lit != len; ++lit)
|
||||
lyxerr << to_utf8((*lit)->name()) << endl;
|
||||
|
||||
//lexrc.printError("Cannot copy known "
|
||||
// "style `$$Token'");
|
||||
|
@ -327,8 +327,10 @@ static void outline(OutlineOp mode, Cursor & cur)
|
||||
toclevel = start->layout()->toclevel;
|
||||
if (toclevel == Layout::NOT_IN_TOC)
|
||||
continue;
|
||||
for (size_t i = 0; i != tc.layoutCount(); ++i) {
|
||||
LayoutPtr const & lt = tc.layout(i);
|
||||
DocumentClass::const_iterator lit = tc.begin();
|
||||
DocumentClass::const_iterator len = tc.end();
|
||||
for (; lit != len; ++lit) {
|
||||
LayoutPtr const & lt = *lit;
|
||||
if (lt->toclevel == toclevel + 1 &&
|
||||
start->layout()->labeltype == lt->labeltype) {
|
||||
start->setLayout(lt);
|
||||
@ -345,8 +347,10 @@ static void outline(OutlineOp mode, Cursor & cur)
|
||||
toclevel = start->layout()->toclevel;
|
||||
if (toclevel == Layout::NOT_IN_TOC)
|
||||
continue;
|
||||
for (size_t i = 0; i != tc.layoutCount(); ++i) {
|
||||
LayoutPtr const & lt = tc.layout(i);
|
||||
DocumentClass::const_iterator lit = tc.begin();
|
||||
DocumentClass::const_iterator len = tc.end();
|
||||
for (; lit != len; ++lit) {
|
||||
LayoutPtr const & lt = *lit;
|
||||
if (lt->toclevel == toclevel - 1 &&
|
||||
start->layout()->labeltype == lt->labeltype) {
|
||||
start->setLayout(lt);
|
||||
|
@ -531,8 +531,11 @@ bool TextClass::read(FileName const & filename, ReadType rt)
|
||||
|
||||
min_toclevel_ = Layout::NOT_IN_TOC;
|
||||
max_toclevel_ = Layout::NOT_IN_TOC;
|
||||
for (size_t i = 0; i != layoutCount(); ++i) {
|
||||
int const toclevel = layout(i)->toclevel;
|
||||
DocumentClass::const_iterator lit = begin();
|
||||
DocumentClass::const_iterator len = end();
|
||||
for (; lit != len; ++lit) {
|
||||
Layout const & lt = **lit;
|
||||
int const toclevel = lt.toclevel;
|
||||
if (toclevel != Layout::NOT_IN_TOC) {
|
||||
if (min_toclevel_ == Layout::NOT_IN_TOC)
|
||||
min_toclevel_ = toclevel;
|
||||
|
@ -57,6 +57,18 @@ public:
|
||||
typedef std::vector<LayoutPtr> LayoutList;
|
||||
/// The inset layouts available to this class
|
||||
typedef std::map<docstring, InsetLayout> InsetLayouts;
|
||||
///
|
||||
typedef LayoutList::const_iterator const_iterator;
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Iterators
|
||||
///////////////////////////////////////////////////////////////////
|
||||
/// Note that this returns a (LayoutPtr *). We really need a custom
|
||||
/// iterator here.
|
||||
const_iterator begin() const { return layoutlist_.begin(); }
|
||||
///
|
||||
const_iterator end() const { return layoutlist_.end(); }
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Layout Info
|
||||
@ -74,8 +86,6 @@ public:
|
||||
{ return emptylayout_; }
|
||||
/// Enumerate the paragraph styles.
|
||||
size_t layoutCount() const { return layoutlist_.size(); }
|
||||
/// Access the paragraph styles.
|
||||
LayoutPtr const & layout(size_t index) const { return layoutlist_[index]; }
|
||||
///
|
||||
bool hasLayout(docstring const & name) const;
|
||||
///
|
||||
|
@ -1410,8 +1410,11 @@ void GuiDocument::updateNumbering()
|
||||
QString const no = qt_("No");
|
||||
QString const yes = qt_("Yes");
|
||||
QTreeWidgetItem * item = 0;
|
||||
for (size_t i = 0; i != tclass.layoutCount(); ++i) {
|
||||
Layout const & lt = *tclass.layout(i);
|
||||
|
||||
DocumentClass::const_iterator lit = tclass.begin();
|
||||
DocumentClass::const_iterator len = tclass.end();
|
||||
for (; lit != len; ++lit) {
|
||||
Layout const & lt = **lit;
|
||||
int const toclevel = lt.toclevel;
|
||||
if (toclevel != Layout::NOT_IN_TOC && lt.labeltype == LABEL_COUNTER) {
|
||||
item = new QTreeWidgetItem(numberingModule->tocTW);
|
||||
|
@ -628,8 +628,10 @@ void GuiLayoutBox::updateContents(bool reset)
|
||||
text_class_ = text_class;
|
||||
|
||||
model_->clear();
|
||||
for (size_t i = 0; i != text_class_->layoutCount(); ++i) {
|
||||
Layout const & lt = *text_class_->layout(i);
|
||||
DocumentClass::const_iterator lit = text_class_->begin();
|
||||
DocumentClass::const_iterator len = text_class_->end();
|
||||
for (; lit != len; ++lit) {
|
||||
Layout const & lt = **lit;
|
||||
docstring const & name = lt.name();
|
||||
// if this inset requires the empty layout, we skip the default
|
||||
// layout
|
||||
|
Loading…
Reference in New Issue
Block a user