some compile fixes, more to be expected

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15465 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2006-10-22 11:00:04 +00:00
parent 98a81507ad
commit eaa81aa13e
10 changed files with 36 additions and 34 deletions

View File

@ -1562,7 +1562,8 @@ void Buffer::saveCursor(StableDocIterator cur, StableDocIterator anc)
}
void Buffer::changeRefsIfUnique(string const & from, string const & to, InsetBase::Code code)
void Buffer::changeRefsIfUnique(docstring const & from, docstring const & to,
InsetBase::Code code)
{
//FIXME: This does not work for child documents yet.
BOOST_ASSERT(code == InsetBase::CITE_CODE || code == InsetBase::REF_CODE);
@ -1582,19 +1583,20 @@ void Buffer::changeRefsIfUnique(string const & from, string const & to, InsetBas
getLabelList(labels);
// FIXME UNICODE
if (lyx::count(labels.begin(), labels.end(), from_utf8(from)) > 1)
if (lyx::count(labels.begin(), labels.end(), from) > 1)
return;
for (InsetIterator it = inset_iterator_begin(inset()); it; ++it) {
if (it->lyxCode() == code) {
InsetCommand & inset = dynamic_cast<InsetCommand &>(*it);
inset.replaceContents(from, to);
inset.replaceContents(to_utf8(from), to_utf8(to));
}
}
}
void Buffer::getSourceCode(odocstream & os, pit_type par_begin, pit_type par_end, bool full_source)
void Buffer::getSourceCode(odocstream & os, pit_type par_begin,
pit_type par_end, bool full_source)
{
OutputParams runparams;
runparams.nice = true;
@ -1617,7 +1619,8 @@ void Buffer::getSourceCode(odocstream & os, pit_type par_begin, pit_type par_end
if (par_begin + 1 == par_end)
os << "% Preview source code for paragraph " << par_begin << "\n\n";
else
os << "% Preview source code from paragraph " << par_begin << " to " << par_end - 1 << "\n\n";
os << "% Preview source code from paragraph " << par_begin
<< " to " << par_end - 1 << "\n\n";
// output paragraphs
if (isLatex()) {
texrow().reset();

View File

@ -343,9 +343,10 @@ public:
///
StableDocIterator getAnchor() const { return anchor_; }
///
void changeRefsIfUnique(std::string const & from, std::string const & to, InsetBase::Code code);
/// get source code (latex/docbook) for some paragraphs, or all paragraphs
/// including preamble
void changeRefsIfUnique(docstring const & from, docstring const & to,
InsetBase::Code code);
/// get source code (latex/docbook) for some paragraphs, or all paragraphs
/// including preamble
void getSourceCode(odocstream & os, pit_type par_begin, pit_type par_end, bool full_source);
/// errorLists_ accessors.

View File

@ -66,9 +66,8 @@ void InsetBibitem::doDispatch(LCursor & cur, FuncRequest & cmd)
break;
}
if (p["key"] != params()["key"])
// FIXME UNICODE
cur.bv().buffer()->changeRefsIfUnique(to_utf8(params()["key"]),
to_utf8(p["key"]), InsetBase::CITE_CODE);
cur.bv().buffer()->changeRefsIfUnique(params()["key"],
p["key"], InsetBase::CITE_CODE);
setParams(p);
}
@ -99,7 +98,7 @@ void InsetBibitem::read(Buffer const & buf, LyXLex & lex)
docstring const InsetBibitem::getBibLabel() const
{
docstring const & label = getParam("label");
return label.empty() ? convert<docstring>(counter) : label;
return label.empty() ? convert<docstring>(counter) : label;
}

View File

@ -148,7 +148,7 @@ string findTargetFormat(string const & format, OutputParams const & runparams)
InsetGraphics::InsetGraphics()
: graphic_label(sgml::uniqueID("graph")),
: graphic_label(sgml::uniqueID(from_ascii("graph"))),
graphic_(new RenderGraphic(this))
{}
@ -156,7 +156,7 @@ InsetGraphics::InsetGraphics()
InsetGraphics::InsetGraphics(InsetGraphics const & ig)
: InsetOld(ig),
boost::signals::trackable(),
graphic_label(sgml::uniqueID("graph")),
graphic_label(sgml::uniqueID(from_ascii("graph"))),
graphic_(new RenderGraphic(*ig.graphic_, this))
{
setParams(ig.params());

View File

@ -72,8 +72,8 @@ void InsetLabel::doDispatch(LCursor & cur, FuncRequest & cmd)
}
if (p["name"] != params()["name"])
// FIXME UNICODE
cur.bv().buffer()->changeRefsIfUnique(to_utf8(params()["name"]),
to_utf8(p["name"]), InsetBase::REF_CODE);
cur.bv().buffer()->changeRefsIfUnique(params()["name"],
p["name"], InsetBase::REF_CODE);
setParams(p);
break;
}
@ -106,7 +106,7 @@ int InsetLabel::docbook(Buffer const & buf, odocstream & os,
{
// FIXME UNICODE
os << "<!-- anchor id=\""
<< from_ascii(sgml::cleanID(buf, runparams, lyx::to_ascii(getParam("name"))))
<< sgml::cleanID(buf, runparams, getParam("name"))
<< "\" -->";
return 0;
}

View File

@ -109,16 +109,16 @@ int InsetRef::docbook(Buffer const & buf, odocstream & os,
if (name.empty()) {
if (runparams.flavor == OutputParams::XML) {
os << "<xref linkend=\""
<< from_ascii(sgml::cleanID(buf, runparams, lyx::to_ascii(getParam("reference"))))
<< sgml::cleanID(buf, runparams, getParam("reference"))
<< "\" />";
} else {
os << "<xref linkend=\""
<< from_ascii(sgml::cleanID(buf, runparams, lyx::to_ascii(getParam("reference"))))
<< sgml::cleanID(buf, runparams, getParam("reference"))
<< "\">";
}
} else {
os << "<link linkend=\""
<< from_ascii(sgml::cleanID(buf, runparams, lyx::to_ascii(getParam("reference"))))
<< sgml::cleanID(buf, runparams, getParam("reference"))
<< "\">"
<< getParam("name")
<< "</link>";

View File

@ -1122,7 +1122,7 @@ void InsetMathHull::doDispatch(LCursor & cur, FuncRequest & cmd)
numbered(r, true);
docstring old = label(r);
if (str != old) {
cur.bv().buffer()->changeRefsIfUnique(to_utf8(old), to_utf8(str),
cur.bv().buffer()->changeRefsIfUnique(old, str,
InsetBase::REF_CODE);
label(r, str);
}
@ -1462,7 +1462,7 @@ int InsetMathHull::docbook(Buffer const & buf, odocstream & os,
docstring bname = name;
if (!label(0).empty())
bname += from_ascii(" id='" + sgml::cleanID(buf, runparams, to_utf8(label(0))) + "'");
bname += " id='" + sgml::cleanID(buf, runparams, label(0)) + "'";
ms << MTag(bname);
odocstringstream ls;
@ -1476,6 +1476,8 @@ int InsetMathHull::docbook(Buffer const & buf, odocstream & os,
ms << from_utf8(subst(subst(to_utf8(ls.str()), "&", "&amp;"), "<", "&lt;"));
ms << ETag(from_ascii("alt"));
ms << MTag(from_ascii("math"));
ms << ETag(from_ascii("alt"));
ms << MTag(from_ascii("math"));
InsetMathGrid::mathmlize(ms);
ms << ETag(from_ascii("math"));
} else {
@ -1487,9 +1489,9 @@ int InsetMathHull::docbook(Buffer const & buf, odocstream & os,
ms << from_ascii("<graphic fileref=\"eqn/");
if (!label(0).empty())
ms << from_utf8(sgml::cleanID(buf, runparams, to_utf8(label(0))));
ms << sgml::cleanID(buf, runparams, label(0));
else
ms << from_utf8(sgml::uniqueID("anon"));
ms << sgml::uniqueID(from_ascii("anon"));
if (runparams.flavor == OutputParams::XML)
ms << from_ascii("\"/>");

View File

@ -157,20 +157,19 @@ int RefInset::plaintext(odocstream & os, OutputParams const &) const
}
int RefInset::docbook(Buffer const & buf, odocstream & os, OutputParams const & runparams) const
int RefInset::docbook(Buffer const & buf, odocstream & os,
OutputParams const & runparams) const
{
if (cell(1).empty()) {
// FIXME UNICODE
os << "<xref linkend=\""
<< from_utf8(sgml::cleanID(buf, runparams, to_utf8(asString(cell(0)))));
<< sgml::cleanID(buf, runparams, asString(cell(0)));
if (runparams.flavor == OutputParams::XML)
os << "\"/>";
else
os << "\">";
} else {
// FIXME UNICODE
os << "<link linkend=\""
<< from_ascii(sgml::cleanID(buf, runparams, to_utf8(asString(cell(0)))))
<< sgml::cleanID(buf, runparams, asString(cell(0)))
<< "\">"
<< asString(cell(1))
<< "</link>";

View File

@ -144,8 +144,6 @@ libmathed_la_SOURCES = \
MathMacroTable.h \
MathMacroTemplate.C \
MathMacroTemplate.h \
MathMLStream.C \
MathMLStream.h \
MathParser.C \
MathParser.h \
MathReplace.h \

View File

@ -39,11 +39,11 @@ docstring escapeChar(char_type c);
docstring escapeString(docstring const & raw);
/// replaces illegal characters from SGML/XML ID attributes
std::string cleanID(Buffer const & buf, OutputParams const & runparams,
std::string const & orig);
docstring cleanID(Buffer const & buf, OutputParams const & runparams,
docstring const & orig);
/// returns a unique numeric id
docstring const uniqueID(std::string const label);
docstring const uniqueID(docstring const label);
/// Opens tag
void openTag(odocstream & os, std::string const & name,