More cleanup from Andre.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23194 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2008-02-24 15:44:11 +00:00
parent 317c76c0e9
commit c7afa2d658
13 changed files with 46 additions and 45 deletions

View File

@ -1361,12 +1361,12 @@ bool BufferParams::hasClassDefaults() const
{
TextClass const & tclass = textclasslist[baseClass_];
return (sides == tclass.sides()
return sides == tclass.sides()
&& columns == tclass.columns()
&& pagestyle == tclass.pagestyle()
&& options == tclass.options()
&& secnumdepth == tclass.secnumdepth()
&& tocdepth == tclass.tocdepth());
&& tocdepth == tclass.tocdepth();
}
@ -1448,13 +1448,15 @@ void BufferParams::makeTextClass()
}
vector<string> const & BufferParams::getModules() const {
vector<string> const & BufferParams::getModules() const
{
return layoutModules_;
}
bool BufferParams::addLayoutModule(string const & modName) {
bool BufferParams::addLayoutModule(string const & modName)
{
LayoutModuleList::const_iterator it = layoutModules_.begin();
LayoutModuleList::const_iterator end = layoutModules_.end();
for (; it != end; it++) {
@ -1468,7 +1470,8 @@ bool BufferParams::addLayoutModule(string const & modName) {
}
void BufferParams::clearLayoutModules() {
void BufferParams::clearLayoutModules()
{
layoutModules_.clear();
}
@ -1516,7 +1519,8 @@ void BufferParams::readLanguage(Lexer & lex)
void BufferParams::readGraphicsDriver(Lexer & lex)
{
if (!lex.next()) return;
if (!lex.next())
return;
string const tmptok = lex.getString();
// check if tmptok is part of tex_graphics in tex_defs.h
@ -1540,7 +1544,8 @@ void BufferParams::readGraphicsDriver(Lexer & lex)
void BufferParams::readBullets(Lexer & lex)
{
if (!lex.next()) return;
if (!lex.next())
return;
int const index = lex.getInteger();
lex.next();
@ -1559,7 +1564,8 @@ void BufferParams::readBullets(Lexer & lex)
void BufferParams::readBulletsLaTeX(Lexer & lex)
{
// The bullet class should be able to read this.
if (!lex.next()) return;
if (!lex.next())
return;
int const index = lex.getInteger();
lex.next(true);
docstring const temp_str = lex.getDocString();

View File

@ -702,8 +702,7 @@ void pasteParagraphList(Cursor & cur, ParagraphList const & parlist,
PitPosPair ppp;
boost::tie(ppp, endpit) =
pasteSelectionHelper(cur, parlist,
textclass, errorList);
pasteSelectionHelper(cur, parlist, textclass, errorList);
updateLabels(cur.buffer());
cur.clearSelection();
text->setCursor(cur, ppp.first, ppp.second);
@ -765,7 +764,7 @@ void pasteClipboardText(Cursor & cur, ErrorList & errorList, bool asParagraphs)
}
void pasteClipboardGraphics(Cursor & cur, ErrorList & errorList,
void pasteClipboardGraphics(Cursor & cur, ErrorList & /* errorList */,
Clipboard::GraphicsType preferedType)
{
BOOST_ASSERT(theClipboard().hasGraphicsContents(preferedType));

View File

@ -598,8 +598,7 @@ void expandFloatListInsert(Menu & tomenu, Buffer const * buf)
return;
}
FloatList const & floats =
buf->params().textClass().floats();
FloatList const & floats = buf->params().textClass().floats();
FloatList::const_iterator cit = floats.begin();
FloatList::const_iterator end = floats.end();
for (; cit != end; ++cit) {
@ -620,8 +619,7 @@ void expandFloatInsert(Menu & tomenu, Buffer const * buf)
return;
}
FloatList const & floats =
buf->params().textClass().floats();
FloatList const & floats = buf->params().textClass().floats();
FloatList::const_iterator cit = floats.begin();
FloatList::const_iterator end = floats.end();
for (; cit != end; ++cit) {

View File

@ -1817,11 +1817,10 @@ bool Paragraph::latex(Buffer const & buf,
// to be valid!
bool asdefault = forceEmptyLayout();
if (asdefault) {
if (asdefault)
style = bparams.textClass().defaultLayout();
} else {
else
style = d->layout_;
}
// Current base font for all inherited font changes, without any
// change caused by an individual character, except for the language:

View File

@ -62,9 +62,9 @@ using namespace lyx::support;
namespace lyx {
ParagraphMetrics::ParagraphMetrics(Paragraph const & par): position_(-1), par_(&par)
{
}
ParagraphMetrics::ParagraphMetrics(Paragraph const & par) :
position_(-1), par_(&par)
{}
ParagraphMetrics & ParagraphMetrics::operator=(

View File

@ -133,8 +133,7 @@ void TocBackend::updateItem(ParConstIterator const & par_it)
}
int const toclevel = toc_item->par_it_->layout()->toclevel;
if (toclevel != Layout::NOT_IN_TOC
&& toclevel >= min_toclevel
if (toclevel != Layout::NOT_IN_TOC && toclevel >= min_toclevel
&& tocstring.empty())
tocstring = toc_item->par_it_->asString(*buffer_, true);

View File

@ -25,6 +25,8 @@
#include <QSettings>
#include <QString>
#include <boost/assert.hpp>
#include <string>
using namespace std;

View File

@ -1230,8 +1230,8 @@ void GuiDocument::classChanged()
namespace {
//This is an insanely complicated attempt to make this sort of thing
//work with RTL languages.
// This is an insanely complicated attempt to make this sort of thing
// work with RTL languages.
docstring formatStrVec(vector<string> const & v, docstring const & s)
{
//this mess formats the list as "v[0], v[1], ..., [s] v[n]"

View File

@ -93,4 +93,4 @@ private:
} // namespace frontend
} // namespace lyx
#endif // NOT GUI_TOOLBARS_H
#endif // GUI_TOOLBARS_H

View File

@ -110,7 +110,7 @@ docstring InsetCollapsable::toolTip(BufferView const & bv, int x, int y) const
Dimension dim = dimensionCollapsed();
if (geometry() == NoButton)
return layout_->labelstring();
else if (x > xo(bv) + dim.wid || y > yo(bv) + dim.des)
if (x > xo(bv) + dim.wid || y > yo(bv) + dim.des)
return docstring();
switch (status_) {
@ -188,7 +188,7 @@ void InsetCollapsable::read(Buffer const & buf, Lexer & lex)
lex.pushToken(token);
}
}
//this must be set before we enter InsetText::read()
// this must be set before we enter InsetText::read()
setLayout(buf.params());
InsetText::read(buf, lex);
@ -254,8 +254,7 @@ void InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const
case LeftButton:
case ButtonOnly:
dim = dimensionCollapsed();
if (geometry() == TopButton
|| geometry() == LeftButton) {
if (geometry() == TopButton || geometry() == LeftButton) {
Dimension textdim;
InsetText::metrics(mi, textdim);
openinlined_ = (textdim.wid + dim.wid) < mi.base.textwidth;
@ -749,11 +748,11 @@ bool InsetCollapsable::getStatus(Cursor & cur, FuncRequest const & cmd,
case LFUN_TABULAR_INSERT:
case LFUN_TOC_INSERT:
case LFUN_WRAP_INSERT:
if (layout_->isPassThru()) {
flag.enabled(false);
return true;
} else
return InsetText::getStatus(cur, cmd, flag);
if (layout_->isPassThru()) {
flag.enabled(false);
return true;
} else
return InsetText::getStatus(cur, cmd, flag);
case LFUN_INSET_TOGGLE:
if (cmd.argument() == "open" || cmd.argument() == "close" ||

View File

@ -102,16 +102,17 @@ ParagraphList::const_iterator makeParagraph(Buffer const & buf,
ParagraphList::const_iterator const & pbegin,
ParagraphList::const_iterator const & pend)
{
LayoutPtr const & defaultstyle =
buf.params().textClass().defaultLayout();
LayoutPtr const & defaultstyle = buf.params().textClass().defaultLayout();
for (ParagraphList::const_iterator par = pbegin; par != pend; ++par) {
if (par != pbegin)
os << '\n';
if (par->layout() == defaultstyle && par->emptyTag()) {
par->simpleDocBookOnePar(buf, os, runparams, outerFont(distance(paragraphs.begin(), par), paragraphs));
par->simpleDocBookOnePar(buf, os, runparams,
outerFont(distance(paragraphs.begin(), par), paragraphs));
} else {
sgml::openTag(buf, os, runparams, *par);
par->simpleDocBookOnePar(buf, os, runparams, outerFont(distance(paragraphs.begin(), par), paragraphs));
par->simpleDocBookOnePar(buf, os, runparams,
outerFont(distance(paragraphs.begin(), par), paragraphs));
sgml::closeTag(os, *par);
}
}

View File

@ -109,8 +109,7 @@ TeXEnvironment(Buffer const & buf,
BufferParams const & bparams = buf.params();
LayoutPtr const & style = pit->forceEmptyLayout() ?
bparams.textClass().emptyLayout() :
pit->layout();
bparams.textClass().emptyLayout() : pit->layout();
ParagraphList const & paragraphs = text.paragraphs();
@ -310,8 +309,7 @@ TeXOnePar(Buffer const & buf,
// In an inset with unlimited length (all in one row),
// force layout to default
LayoutPtr const style = pit->forceEmptyLayout() ?
bparams.textClass().emptyLayout() :
pit->layout();
bparams.textClass().emptyLayout() : pit->layout();
OutputParams runparams = runparams_in;
runparams.moving_arg |= style->needprotect;

View File

@ -123,7 +123,7 @@ docstring sgml::cleanID(Buffer const & buf, OutputParams const & runparams,
// to disable this mangling.
TextClass const & tclass = buf.params().textClass();
docstring const allowed = from_ascii(
runparams.flavor == OutputParams::XML? ".-_:":tclass.options());
runparams.flavor == OutputParams::XML ? ".-_:" : tclass.options());
if (allowed.empty())
return orig;
@ -139,7 +139,7 @@ docstring sgml::cleanID(Buffer const & buf, OutputParams const & runparams,
MangledMap::const_iterator const known = mangledNames.find(orig);
if (known != mangledNames.end())
return (*known).second;
return known->second;
// make sure it starts with a letter
if (!isAlphaASCII(*it) && allowed.find(*it) >= allowed.size())