* src/bufferparams.C
(bool BufferParams::writeLaTeX):
(void BufferParams::useClassDefaults): only take action when there is
a ToC structure
* src/frontends/qt2/QDocument.C
(void QDocument::apply):
(void QDocument::update_contents): only take action when there is
a ToC structure
* src/frontends/xforms/FormDocument.C
(bool FormDocument::language_apply):
(bool FormDocument::options_apply):
(void FormDocument::options_update): only take action when there is
a ToC structure; disable
(void FormDocument::UpdateClassParams): disable the secnumdepth and
tocdepth widgets when there is no ToC structure
* src/frontends/xforms/FormDocument.h
(options_apply): do not return a bool (was not used)
* src/lyxtextclass.C
(hasTocLevels): new method.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13471
a592a061-630c-0410-9148-
cb99ea01b6c8
texrow.newline();
}
- if (secnumdepth != tclass.secnumdepth()) {
- os << "\\setcounter{secnumdepth}{"
- << secnumdepth
- << "}\n";
- texrow.newline();
- }
- if (tocdepth != tclass.tocdepth()) {
- os << "\\setcounter{tocdepth}{"
- << tocdepth
- << "}\n";
- texrow.newline();
+ // Only if class has a ToC hierarchy
+ if (tclass.hasTocLevels()) {
+ if (secnumdepth != tclass.secnumdepth()) {
+ os << "\\setcounter{secnumdepth}{"
+ << secnumdepth
+ << "}\n";
+ texrow.newline();
+ }
+ if (tocdepth != tclass.tocdepth()) {
+ os << "\\setcounter{tocdepth}{"
+ << tocdepth
+ << "}\n";
+ texrow.newline();
+ }
}
if (paragraph_separation) {
columns = tclass.columns();
pagestyle = tclass.pagestyle();
options = tclass.options();
- secnumdepth = tclass.secnumdepth();
- tocdepth = tclass.tocdepth();
+ // Only if class has a ToC hierarchy
+ if (tclass.hasTocLevels()) {
+ secnumdepth = tclass.secnumdepth();
+ tocdepth = tclass.tocdepth();
+ }
}
params.language = languages.getLanguage(lang_[pos]);
// numbering
- params.tocdepth = dialog_->numberingModule->tocSL->value();
- params.secnumdepth = dialog_->numberingModule->depthSL->value();
+ if (params.getLyXTextClass().hasTocLevels()) {
+ params.tocdepth = dialog_->numberingModule->tocSL->value();
+ params.secnumdepth = dialog_->numberingModule->depthSL->value();
+ }
// bullets
params.user_defined_bullet(0) = dialog_->bulletsModule->getBullet(0);
// numbering
int const min_toclevel = controller().textClass().min_toclevel();
int const max_toclevel = controller().textClass().max_toclevel();
- if (min_toclevel != LyXLayout::NOT_IN_TOC)
+ if (controller().textClass().hasTocLevels()) {
dialog_->numberingModule->setEnabled(true);
- else {
+ dialog_->numberingModule->depthSL->setMinValue(min_toclevel - 1);
+ dialog_->numberingModule->depthSL->setMaxValue(max_toclevel);
+ dialog_->numberingModule->depthSL->setValue(params.secnumdepth);
+ dialog_->numberingModule->tocSL->setMinValue(min_toclevel - 1);
+ dialog_->numberingModule->tocSL->setMaxValue(max_toclevel);
+ dialog_->numberingModule->tocSL->setValue(params.tocdepth);
+ dialog_->updateNumbering();
+ } else {
dialog_->numberingModule->setEnabled(false);
dialog_->numberingModule->tocLV->clear();
}
- dialog_->numberingModule->depthSL->setMinValue(min_toclevel - 1);
- dialog_->numberingModule->depthSL->setMaxValue(max_toclevel);
- dialog_->numberingModule->depthSL->setValue(params.secnumdepth);
- dialog_->numberingModule->tocSL->setMinValue(min_toclevel - 1);
- dialog_->numberingModule->tocSL->setMaxValue(max_toclevel);
- dialog_->numberingModule->tocSL->setValue(params.tocdepth);
- dialog_->updateNumbering();
// bullets
dialog_->bulletsModule->setBullet(0,params.user_defined_bullet(0));
}
-bool FormDocument::options_apply(BufferParams & params)
+void FormDocument::options_apply(BufferParams & params)
{
- bool redo = false;
-
params.graphicsDriver = getString(options_->choice_postscript_driver);
params.use_amsmath = static_cast<BufferParams::AMS>(
fl_get_choice(options_->choice_ams_math) - 1);
params.use_bibtopic = fl_get_button(options_->check_bibtopic);
- int tmpchar = int(fl_get_counter_value(options_->counter_secnumdepth));
- if (params.secnumdepth != tmpchar)
- redo = true;
- params.secnumdepth = tmpchar;
-
- params.tocdepth = int(fl_get_counter_value(options_->counter_tocdepth));
+ if (params.getLyXTextClass().hasTocLevels()) {
+ params.secnumdepth = int(fl_get_counter_value(options_->counter_secnumdepth));
+ params.tocdepth = int(fl_get_counter_value(options_->counter_tocdepth));
+ }
params.float_placement =
getString(options_->input_float_placement);
- return redo;
}
// These are the params that have to be updated on any class change
// (even if the class defaults are not used) (JSpitzm 2002-04-08)
- LyXTextClass const & tclass = textclasslist[params.textclass];
+ LyXTextClass const & tclass = params.getLyXTextClass();
fl_set_combox(class_->combox_class, params.textclass + 1);
fl_clear_choice(class_->choice_fontsize);
params.pagestyle.c_str());
fl_set_input(class_->input_extra, tclass.options().c_str());
+ setEnabled(options_->counter_secnumdepth, tclass.hasTocLevels());
+ setEnabled(options_->counter_tocdepth, tclass.hasTocLevels());
}
void FormDocument::class_update(BufferParams const & params)
fl_set_choice(options_->choice_cite_engine, cite_choice);
fl_set_button(options_->check_bibtopic, params.use_bibtopic);
- fl_set_counter_value(options_->counter_secnumdepth, params.secnumdepth);
- fl_set_counter_value(options_->counter_tocdepth, params.tocdepth);
+
+ if (params.getLyXTextClass().hasTocLevels()) {
+ fl_set_counter_value(options_->counter_secnumdepth, params.secnumdepth);
+ fl_set_counter_value(options_->counter_tocdepth, params.tocdepth);
+ }
+
if (!params.float_placement.empty())
fl_set_input(options_->input_float_placement,
params.float_placement.c_str());
///
bool language_apply(BufferParams &);
///
- bool options_apply(BufferParams &);
+ void options_apply(BufferParams &);
///
void bullets_apply(BufferParams &);
///
}
+bool LyXTextClass::hasTocLevels() const
+{
+ return min_toclevel_ != LyXLayout::NOT_IN_TOC;
+}
+
+
ostream & operator<<(ostream & os, LyXTextClass::PageSides p)
{
switch (p) {
int min_toclevel() const;
/// The maximal TocLevel of sectioning layouts
int max_toclevel() const;
+ /// returns true if the class has a ToC structure
+ bool hasTocLevels() const;
private:
///
bool delete_layout(std::string const &);