remove unnneded #include

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20233 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2007-09-11 22:31:24 +00:00
parent dd19767b0d
commit 887bd847c6
9 changed files with 88 additions and 117 deletions

View File

@ -12,6 +12,7 @@
#include "ControlTexinfo.h"
#include "FuncRequest.h"
#include "debug.h"
#include "support/filetools.h"
#include "support/FileName.h"
@ -21,6 +22,7 @@
using std::string;
using std::vector;
using std::endl;
namespace lyx {
namespace frontend {
@ -29,6 +31,9 @@ using support::FileName;
using support::contains;
using support::split;
using support::token;
using support::getExtension;
using support::libFileSearch;
using support::onlyFilename;
ControlTexinfo::ControlTexinfo(Dialog & parent)
@ -43,6 +48,47 @@ void ControlTexinfo::viewFile(string const & filename) const
}
/// get a class with full path from the list
string const getTexFileFromList(string const & file, string const & type)
{
string file_ = file;
// do we need to add the suffix?
if (!(getExtension(file) == type))
file_ += '.' + type;
lyxerr << "Searching for file " << file_ << endl;
string lstfile = type + "Files.lst";
if (type == "cls")
lstfile = "clsFiles.lst";
else if (type == "sty")
lstfile = "styFiles.lst";
else if (type == "bst")
lstfile = "bstFiles.lst";
else if (type == "bib")
lstfile = "bibFiles.lst";
FileName const abslstfile = libFileSearch(string(), lstfile);
if (abslstfile.empty()) {
lyxerr << "File `'" << lstfile << "' not found." << endl;
return string();
}
string const allClasses = getFileContents(abslstfile);
int entries = 0;
string classfile = token(allClasses, '\n', entries);
int count = 0;
while ((!contains(classfile, file) ||
(onlyFilename(classfile) != file)) &&
(++count < 1000)) {
classfile = token(allClasses, '\n', ++entries);
}
// now we have filename with full path
lyxerr << "with full path: " << classfile << endl;
return classfile;
}
string const ControlTexinfo::getClassOptions(string const & classname) const
{
FileName const filename(getTexFileFromList(classname, "cls"));

View File

@ -19,8 +19,10 @@
namespace lyx {
namespace frontend {
/** A controller for Texinfo dialogs. */
std::string const getTexFileFromList(std::string const & file,
std::string const & type);
/** A controller for Texinfo dialogs. */
class ControlTexinfo : public Controller {
public:
///

View File

@ -13,28 +13,20 @@
#include "frontend_helpers.h"
#include "Buffer.h"
#include "BufferParams.h"
#include "Color.h"
#include "debug.h"
#include "gettext.h"
#include "Language.h"
#include "Length.h"
#include "frontends/FileDialog.h"
#include "frontends/alert.h"
#include "support/filetools.h"
#include "support/lstrings.h"
#include "support/Package.h"
#include "support/lstrings.h"
#include "support/lyxalgo.h"
#include "support/os.h"
#include "support/Package.h"
#include "support/Path.h"
#include "support/Systemcall.h"
#include <boost/cregex.hpp>
#include <boost/regex.hpp>
#include <algorithm>
@ -50,7 +42,6 @@ namespace frontend {
using support::addName;
using support::bformat;
using support::contains;
using support::FileFilterList;
using support::FileName;
using support::getExtension;
@ -212,18 +203,6 @@ docstring const browseDir(docstring const & pathname,
}
vector<docstring> const getLatexUnits()
{
vector<docstring> units;
int i = 0;
char const * str = stringFromUnit(i);
for (; str != 0; ++i, str = stringFromUnit(i))
units.push_back(from_ascii(str));
return units;
}
void rescanTexStyles()
{
// Run rescan in user lyx directory
@ -254,55 +233,13 @@ void getTexFileList(string const & filename, std::vector<string> & list)
boost::RegEx regex("/{2,}");
std::vector<string>::iterator it = list.begin();
std::vector<string>::iterator end = list.end();
for (; it != end; ++it) {
for (; it != end; ++it)
*it = regex.Merge((*it), "/");
}
// remove empty items and duplicates
list.erase(std::remove(list.begin(), list.end(), ""), list.end());
eliminate_duplicates(list);
}
string const getTexFileFromList(string const & file,
string const & type)
{
string file_ = file;
// do we need to add the suffix?
if (!(getExtension(file) == type))
file_ += '.' + type;
lyxerr << "Searching for file " << file_ << endl;
string lstfile;
if (type == "cls")
lstfile = "clsFiles.lst";
else if (type == "sty")
lstfile = "styFiles.lst";
else if (type == "bst")
lstfile = "bstFiles.lst";
else if (type == "bib")
lstfile = "bibFiles.lst";
FileName const abslstfile = libFileSearch(string(), lstfile);
if (abslstfile.empty()) {
lyxerr << "File `'" << lstfile << "' not found." << endl;
return string();
}
string const allClasses = getFileContents(abslstfile);
int entries = 0;
string classfile = token(allClasses, '\n', entries);
int count = 0;
while ((!contains(classfile, file) ||
(onlyFilename(classfile) != file)) &&
(++count < 1000)) {
classfile = token(allClasses, '\n', ++entries);
}
// now we have filename with full path
lyxerr << "with full path: " << classfile << endl;
return classfile;
}
} // namespace frontend
} // namespace lyx

View File

@ -19,25 +19,12 @@
#include <vector>
#include <string>
#include <boost/bind.hpp>
namespace lyx {
namespace support { class FileFilterList; }
namespace frontend {
///
template<class Pair>
std::vector<typename Pair::second_type> const
getSecond(std::vector<Pair> const & pr)
{
std::vector<typename Pair::second_type> tmp(pr.size());
std::transform(pr.begin(), pr.end(), tmp.begin(),
boost::bind(&Pair::second, _1));
return tmp;
}
///
typedef std::pair<docstring, std::string> LanguagePair;
@ -108,10 +95,6 @@ browseDir(docstring const & pathname,
std::make_pair(docstring(), docstring()));
/// Returns a vector of units that can be used to create a valid LaTeX length.
std::vector<docstring> const getLatexUnits();
/** Build filelists of all availabe bst/cls/sty-files. Done through
* kpsewhich and an external script, saved in *Files.lst.
*/
@ -122,9 +105,6 @@ void rescanTexStyles();
*/
void getTexFileList(std::string const & filename, std::vector<std::string> & contents);
/// get a class with full path from the list
std::string const getTexFileFromList(std::string const & classname, std::string const & type);
} // namespace frontend
} // namespace lyx

View File

@ -14,17 +14,12 @@
#include "GuiBox.h"
#include "ControlBox.h"
#include "LengthCombo.h"
#include "qt_helpers.h"
#include "lengthcommon.h"
#include "LyXRC.h" // to set the default length values
#include "Validator.h"
#include "controllers/ControlBox.h"
#include "controllers/frontend_helpers.h"
#include "insets/InsetBox.h"
#include "support/lstrings.h"
@ -34,16 +29,11 @@
#include <QCloseEvent>
using lyx::support::getStringFromVector;
using lyx::support::isStrDbl;
using lyx::support::subst;
using std::string;
namespace lyx {
namespace frontend {
GuiBoxDialog::GuiBoxDialog(LyXView & lv)
: GuiDialog(lv, "box")
{
@ -210,7 +200,7 @@ void GuiBoxDialog::updateContents()
lengthToWidgets(widthED, widthUnitsLC,
(controller().params().width).asString(), default_unit);
string const special(controller().params().special);
string const special = controller().params().special;
if (!special.empty() && special != "none") {
QString spc;
for (unsigned int i = 0; i < gui_names_spec_.size(); i++) {
@ -226,7 +216,7 @@ void GuiBoxDialog::updateContents()
lengthToWidgets(heightED, heightUnitsLC,
(controller().params().height).asString(), default_unit);
string const height_special(controller().params().height_special);
string const height_special = controller().params().height_special;
if (!height_special.empty() && height_special != "none") {
QString hspc;
for (unsigned int i = 0; i < gui_names_spec_.size(); i++) {
@ -366,7 +356,7 @@ void GuiBoxDialog::setInnerType(bool frameless, int i)
innerBoxCO->setCurrentIndex(i - 1);
} else {
if (innerBoxCO->count() == 2)
i += 1;
++i;
innerBoxCO->clear();
innerBoxCO->addItem(qt_("None"));
innerBoxCO->addItem(qt_("Parbox"));

View File

@ -23,10 +23,10 @@
#include "GuiViewSource.h" // For latexHighlighter use in the preamble.
#include "frontend_helpers.h"
#include "BufferParams.h"
#include "Encoding.h"
#include "gettext.h"
#include "frontend_helpers.h" // getSecond()
#include "Language.h"
#include "LyXRC.h" // defaultUnit
#include "TextClassList.h"
@ -36,6 +36,8 @@
#include "support/lstrings.h"
#include <boost/bind.hpp>
#include <QCloseEvent>
#include <QScrollBar>
#include <QTextCursor>
@ -54,6 +56,17 @@ using std::vector;
using std::string;
///
template<class Pair>
std::vector<typename Pair::second_type> const
getSecond(std::vector<Pair> const & pr)
{
std::vector<typename Pair::second_type> tmp(pr.size());
std::transform(pr.begin(), pr.end(), tmp.begin(),
boost::bind(&Pair::second, _1));
return tmp;
}
char const * const tex_graphics[] =
{
"default", "dvips", "dvitops", "emtex",

View File

@ -23,8 +23,6 @@
#include "qt_helpers.h"
#include "Validator.h"
#include "controllers/frontend_helpers.h"
#include "insets/InsetGraphicsParams.h"
#include "support/convert.h"
@ -32,6 +30,8 @@
#include "support/lyxlib.h"
#include "support/os.h"
#include <boost/bind.hpp>
#include <QCheckBox>
#include <QCloseEvent>
#include <QLabel>
@ -69,6 +69,17 @@ getFirst(std::vector<Pair> const & pr)
return tmp;
}
///
template<class Pair>
std::vector<typename Pair::second_type> const
getSecond(std::vector<Pair> const & pr)
{
std::vector<typename Pair::second_type> tmp(pr.size());
std::transform(pr.begin(), pr.end(), tmp.begin(),
boost::bind(&Pair::second, _1));
return tmp;
}
GuiGraphicsDialog::GuiGraphicsDialog(LyXView & lv)
: GuiDialog(lv, "graphics")
{

View File

@ -70,8 +70,6 @@ namespace frontend {
//
/////////////////////////////////////////////////////////////////////
// FIXME: move to frontend_helpers.h
template<class A>
static size_t findPos_helper(std::vector<A> const & vec, A const & val)
{
@ -1609,12 +1607,12 @@ PrefLanguage::PrefLanguage(QWidget * parent)
// store the lang identifiers for later
std::vector<LanguagePair> const langs = frontend::getLanguageData(false);
lang_ = getSecond(langs);
std::vector<LanguagePair>::const_iterator lit = langs.begin();
std::vector<LanguagePair>::const_iterator lend = langs.end();
lang_.clear();
for (; lit != lend; ++lit) {
defaultLanguageCO->addItem(toqstr(lit->first));
lang_.push_back(lit->second);
}
}

View File

@ -20,8 +20,6 @@
#include "FuncRequest.h"
#include "LaTeXFeatures.h"
#include "frontends/controllers/frontend_helpers.h"
#include "support/fs_extras.h"
#include "support/lstrings.h"
@ -53,7 +51,7 @@ namespace {
vector<string> const init_possible_cite_commands()
{
char const * const pos[] = {
char const * const possible[] = {
"cite", "citet", "citep", "citealt", "citealp",
"citeauthor", "citeyear", "citeyearpar",
"citet*", "citep*", "citealt*", "citealp*", "citeauthor*",
@ -64,16 +62,16 @@ vector<string> const init_possible_cite_commands()
"footcitealp", "footciteauthor", "footciteyear", "footciteyearpar",
"citefield", "citetitle", "cite*"
};
size_t const size_pos = sizeof(pos) / sizeof(pos[0]);
size_t const size_possible = sizeof(possible) / sizeof(possible[0]);
return vector<string>(pos, pos + size_pos);
return vector<string>(possible, possible + size_possible);
}
vector<string> const & possible_cite_commands()
{
static vector<string> const pos = init_possible_cite_commands();
return pos;
static vector<string> const possible = init_possible_cite_commands();
return possible;
}
@ -459,9 +457,7 @@ int InsetCitation::plaintext(Buffer const & buffer, odocstream & os,
}
namespace {
docstring const cleanupWhitespace(docstring const & citelist)
static docstring const cleanupWhitespace(docstring const & citelist)
{
docstring::const_iterator it = citelist.begin();
docstring::const_iterator end = citelist.end();
@ -478,8 +474,6 @@ docstring const cleanupWhitespace(docstring const & citelist)
return result;
}
// end anon namyspace
}
int InsetCitation::docbook(Buffer const &, odocstream & os,
OutputParams const &) const