mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Introduce wide streams. This fixes the remaining problems of plain text
export (e.g. the ToC) and the navigate menu. * src/insets/insetbase.h (InsetBase::plaintext): output to a docstream (InsetBase::textString): ditto * src/mathed/TextPainter.h (TextPainter::show): ditto * src/support/docstream.[Ch] New file and string streams for docstring. The file streams convert to UTF8 on the fly. * many more files: Adjust to the changes above git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15301 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
86c320d9ba
commit
34b7650cbb
@ -96,6 +96,7 @@ src_support_header_files = Split('''
|
||||
copied_ptr.h
|
||||
cow_ptr.h
|
||||
debugstream.h
|
||||
docstream.h
|
||||
docstring.h
|
||||
environment.h
|
||||
filefilterlist.h
|
||||
@ -134,6 +135,7 @@ src_support_files = Split('''
|
||||
chdir.C
|
||||
convert.C
|
||||
copy.C
|
||||
docstream.C
|
||||
docstring.C
|
||||
environment.C
|
||||
filefilterlist.C
|
||||
|
@ -48,6 +48,7 @@
|
||||
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
|
||||
using lyx::docstring;
|
||||
using lyx::pos_type;
|
||||
using lyx::pit_type;
|
||||
using lyx::textclass_type;
|
||||
@ -456,9 +457,9 @@ void switchBetweenClasses(textclass_type c1, textclass_type c2,
|
||||
}
|
||||
|
||||
|
||||
std::vector<string> const availableSelections(Buffer const & buffer)
|
||||
std::vector<docstring> const availableSelections(Buffer const & buffer)
|
||||
{
|
||||
vector<string> selList;
|
||||
vector<docstring> selList;
|
||||
|
||||
CutStack::const_iterator cit = theCuts.begin();
|
||||
CutStack::const_iterator end = theCuts.end();
|
||||
@ -466,13 +467,14 @@ std::vector<string> const availableSelections(Buffer const & buffer)
|
||||
// we do not use cit-> here because gcc 2.9x does not
|
||||
// like it (JMarc)
|
||||
ParagraphList const & pars = (*cit).first;
|
||||
string asciiSel;
|
||||
docstring asciiSel;
|
||||
ParagraphList::const_iterator pit = pars.begin();
|
||||
ParagraphList::const_iterator pend = pars.end();
|
||||
for (; pit != pend; ++pit) {
|
||||
asciiSel += pit->asString(buffer, false);
|
||||
if (asciiSel.size() > 25) {
|
||||
asciiSel.replace(22, string::npos, "...");
|
||||
asciiSel.replace(22, docstring::npos,
|
||||
lyx::from_ascii("..."));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -614,11 +616,11 @@ void copySelection(LCursor & cur)
|
||||
}
|
||||
|
||||
|
||||
std::string getSelection(Buffer const & buf, size_t sel_index)
|
||||
docstring getSelection(Buffer const & buf, size_t sel_index)
|
||||
{
|
||||
return sel_index < theCuts.size()
|
||||
? theCuts[sel_index].first.back().asString(buf, false)
|
||||
: string();
|
||||
: docstring();
|
||||
}
|
||||
|
||||
|
||||
|
@ -16,9 +16,8 @@
|
||||
|
||||
#include "ParagraphList_fwd.h"
|
||||
|
||||
#include "support/types.h"
|
||||
#include "support/docstring.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class Buffer;
|
||||
@ -32,11 +31,11 @@ namespace lyx {
|
||||
namespace cap {
|
||||
|
||||
///
|
||||
std::vector<std::string> const availableSelections(Buffer const & buffer);
|
||||
std::vector<lyx::docstring> const availableSelections(Buffer const & buffer);
|
||||
///
|
||||
lyx::size_type numberOfSelections();
|
||||
///
|
||||
std::string getSelection(Buffer const & buffer, size_t sel_index);
|
||||
lyx::docstring getSelection(Buffer const & buffer, size_t sel_index);
|
||||
|
||||
///
|
||||
void cutSelection(LCursor & cur, bool doclear, bool realcut);
|
||||
|
@ -417,9 +417,9 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
string const limit_string_length(string const & str)
|
||||
docstring const limit_string_length(docstring const & str)
|
||||
{
|
||||
string::size_type const max_item_length = 45;
|
||||
docstring::size_type const max_item_length = 45;
|
||||
|
||||
if (str.size() > max_item_length)
|
||||
return str.substr(0, max_item_length - 3) + "...";
|
||||
@ -436,7 +436,7 @@ void expandLastfiles(Menu & tomenu)
|
||||
int ii = 1;
|
||||
|
||||
for (; lfit != lf.end() && ii < 10; ++lfit, ++ii) {
|
||||
docstring const label = convert<docstring>(ii) + lyx::from_ascii(". ")
|
||||
docstring const label = convert<docstring>(ii) + ". "
|
||||
+ makeDisplayPath((*lfit), 30)
|
||||
+ char_type('|') + convert<docstring>(ii);
|
||||
tomenu.add(MenuItem(MenuItem::Command, label, FuncRequest(LFUN_FILE_OPEN, (*lfit))));
|
||||
@ -461,7 +461,7 @@ void expandDocuments(Menu & tomenu)
|
||||
for (; docit != end; ++docit, ++ii) {
|
||||
docstring label = makeDisplayPath(*docit, 20);
|
||||
if (ii < 10)
|
||||
label = convert<docstring>(ii) + lyx::from_ascii(". ") + label + char_type('|') + convert<docstring>(ii);
|
||||
label = convert<docstring>(ii) + ". " + label + char_type('|') + convert<docstring>(ii);
|
||||
tomenu.add(MenuItem(MenuItem::Command, label, FuncRequest(LFUN_BUFFER_SWITCH, *docit)));
|
||||
}
|
||||
}
|
||||
@ -512,7 +512,7 @@ void expandFormats(MenuItem::Kind kind, Menu & tomenu, Buffer const * buf)
|
||||
label = _("Plain Text as Lines");
|
||||
else if ((*fit)->name() == "textparagraph")
|
||||
label = _("Plain Text as Paragraphs");
|
||||
label += lyx::from_ascii("...");
|
||||
label += "...";
|
||||
break;
|
||||
case MenuItem::ViewFormats:
|
||||
case MenuItem::ExportFormats:
|
||||
@ -623,7 +623,7 @@ void expandToc2(Menu & tomenu,
|
||||
if (to - from <= max_number_of_items) {
|
||||
for (lyx::toc::Toc::size_type i = from; i < to; ++i) {
|
||||
docstring label(4 * max(0, toc_list[i].depth() - depth), char_type(' '));
|
||||
label += lyx::from_utf8(limit_string_length(toc_list[i].str()));
|
||||
label += limit_string_length(toc_list[i].str());
|
||||
if (toc_list[i].depth() == depth
|
||||
&& shortcut_count < 9) {
|
||||
if (label.find(convert<docstring>(shortcut_count + 1)) != docstring::npos)
|
||||
@ -641,12 +641,12 @@ void expandToc2(Menu & tomenu,
|
||||
++new_pos;
|
||||
|
||||
docstring label(4 * max(0, toc_list[pos].depth() - depth), ' ');
|
||||
label += lyx::from_utf8(limit_string_length(toc_list[pos].str()));
|
||||
label += limit_string_length(toc_list[pos].str());
|
||||
if (toc_list[pos].depth() == depth &&
|
||||
shortcut_count < 9) {
|
||||
if (label.find(convert<docstring>(shortcut_count + 1)) != docstring::npos)
|
||||
label += char_type('|') + convert<docstring>(++shortcut_count);
|
||||
}
|
||||
}
|
||||
if (new_pos == pos + 1) {
|
||||
tomenu.add(MenuItem(MenuItem::Command,
|
||||
label, FuncRequest(toc_list[pos].action())));
|
||||
@ -691,7 +691,7 @@ void expandToc(Menu & tomenu, Buffer const * buf)
|
||||
lyx::toc::Toc::const_iterator ccit = cit->second.begin();
|
||||
lyx::toc::Toc::const_iterator eend = cit->second.end();
|
||||
for (; ccit != eend; ++ccit) {
|
||||
docstring const label = lyx::from_utf8(limit_string_length(ccit->str()));
|
||||
docstring const label = limit_string_length(ccit->str());
|
||||
menu->add(MenuItem(MenuItem::Command,
|
||||
label,
|
||||
FuncRequest(ccit->action())));
|
||||
@ -719,14 +719,14 @@ void expandPasteRecent(Menu & tomenu, Buffer const * buf)
|
||||
if (!buf)
|
||||
return;
|
||||
|
||||
vector<string> const sel =
|
||||
vector<docstring> const sel =
|
||||
lyx::cap::availableSelections(*buf);
|
||||
|
||||
vector<string>::const_iterator cit = sel.begin();
|
||||
vector<string>::const_iterator end = sel.end();
|
||||
vector<docstring>::const_iterator cit = sel.begin();
|
||||
vector<docstring>::const_iterator end = sel.end();
|
||||
|
||||
for (unsigned int index = 0; cit != end; ++cit, ++index) {
|
||||
tomenu.add(MenuItem(MenuItem::Command, lyx::from_utf8(*cit),
|
||||
tomenu.add(MenuItem(MenuItem::Command, *cit,
|
||||
FuncRequest(LFUN_PASTE, convert<string>(index))));
|
||||
}
|
||||
}
|
||||
@ -745,7 +745,7 @@ void expandBranches(Menu & tomenu, Buffer const * buf)
|
||||
for (int ii = 1; cit != end; ++cit, ++ii) {
|
||||
docstring label = lyx::from_utf8(cit->getBranch());
|
||||
if (ii < 10)
|
||||
label = convert<docstring>(ii) + lyx::from_ascii(". ") + label + char_type('|') + convert<docstring>(ii);
|
||||
label = convert<docstring>(ii) + ". " + label + char_type('|') + convert<docstring>(ii);
|
||||
tomenu.addWithStatusCheck(MenuItem(MenuItem::Command, label,
|
||||
FuncRequest(LFUN_BRANCH_INSERT,
|
||||
cit->getBranch())));
|
||||
|
@ -33,6 +33,8 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using lyx::docstring;
|
||||
|
||||
using std::vector;
|
||||
using std::max;
|
||||
using std::ostream;
|
||||
@ -46,7 +48,7 @@ namespace lyx {
|
||||
// TocBackend::Item implementation
|
||||
|
||||
TocBackend::Item::Item(ParConstIterator const & par_it, int d,
|
||||
std::string const & s)
|
||||
docstring const & s)
|
||||
: par_it_(par_it), depth_(d), str_(s)
|
||||
{
|
||||
/*
|
||||
@ -96,15 +98,15 @@ int const TocBackend::Item::depth() const
|
||||
}
|
||||
|
||||
|
||||
std::string const & TocBackend::Item::str() const
|
||||
docstring const & TocBackend::Item::str() const
|
||||
{
|
||||
return str_;
|
||||
}
|
||||
|
||||
|
||||
string const TocBackend::Item::asString() const
|
||||
docstring const TocBackend::Item::asString() const
|
||||
{
|
||||
return string(4 * depth_, ' ') + str_;
|
||||
return docstring(4 * depth_, ' ') + str_;
|
||||
}
|
||||
|
||||
|
||||
@ -163,7 +165,7 @@ void TocBackend::update()
|
||||
for (; pit != end; ++pit) {
|
||||
|
||||
// the string that goes to the toc (could be the optarg)
|
||||
string tocstring;
|
||||
docstring tocstring;
|
||||
|
||||
// For each paragraph, traverse its insets and look for
|
||||
// FLOAT_CODE or WRAP_CODE
|
||||
@ -184,8 +186,9 @@ void TocBackend::update()
|
||||
break;
|
||||
Paragraph const & par = *static_cast<InsetOptArg*>(it->inset)->paragraphs().begin();
|
||||
if (!pit->getLabelstring().empty())
|
||||
tocstring = pit->getLabelstring()
|
||||
+ ' ';
|
||||
// FIXME UNICODE
|
||||
tocstring = lyx::from_utf8(
|
||||
pit->getLabelstring() + ' ');
|
||||
tocstring += par.asString(*buffer_, false);
|
||||
break;
|
||||
}
|
||||
@ -245,7 +248,7 @@ TocBackend::TocIterator const TocBackend::item(std::string const & type, ParCons
|
||||
}
|
||||
|
||||
|
||||
void TocBackend::asciiTocList(string const & type, ostream & os) const
|
||||
void TocBackend::asciiTocList(string const & type, lyx::odocstream & os) const
|
||||
{
|
||||
TocList::const_iterator cit = tocs_.find(type);
|
||||
if (cit != tocs_.end()) {
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
Item(
|
||||
ParConstIterator const & par_it = ParConstIterator(),
|
||||
int d = -1,
|
||||
std::string const & s = std::string());
|
||||
lyx::docstring const & s = lyx::docstring());
|
||||
///
|
||||
~Item() {}
|
||||
///
|
||||
@ -61,9 +61,9 @@ public:
|
||||
///
|
||||
int const depth() const;
|
||||
///
|
||||
std::string const & str() const;
|
||||
lyx::docstring const & str() const;
|
||||
///
|
||||
std::string const asString() const;
|
||||
lyx::docstring const asString() const;
|
||||
/// set cursor in LyXView to this Item
|
||||
void goTo(LyXView & lv_) const;
|
||||
/// the action corresponding to the goTo above
|
||||
@ -77,7 +77,7 @@ public:
|
||||
int depth_;
|
||||
|
||||
/// Full item string
|
||||
std::string str_;
|
||||
lyx::docstring str_;
|
||||
};
|
||||
|
||||
///
|
||||
@ -109,7 +109,7 @@ public:
|
||||
/// Return the first Toc Item before the cursor
|
||||
TocIterator const item(std::string const & type, ParConstIterator const &);
|
||||
|
||||
void asciiTocList(std::string const & type, std::ostream & os) const;
|
||||
void asciiTocList(std::string const & type, lyx::odocstream & os) const;
|
||||
|
||||
private:
|
||||
///
|
||||
|
@ -1129,10 +1129,10 @@ docstring LCursor::selectionAsString(bool label) const
|
||||
size_t const endpos = selEnd().pos();
|
||||
|
||||
if (startpit == endpit)
|
||||
return lyx::from_utf8(pars[startpit].asString(buffer, startpos, endpos, label));
|
||||
return pars[startpit].asString(buffer, startpos, endpos, label);
|
||||
|
||||
// First paragraph in selection
|
||||
string result = pars[startpit].
|
||||
docstring result = pars[startpit].
|
||||
asString(buffer, startpos, pars[startpit].size(), label) + "\n\n";
|
||||
|
||||
// The paragraphs in between (if any)
|
||||
@ -1144,7 +1144,7 @@ docstring LCursor::selectionAsString(bool label) const
|
||||
// Last paragraph in selection
|
||||
result += pars[endpit].asString(buffer, 0, endpos, label);
|
||||
|
||||
return lyx::from_utf8(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
if (inMathed())
|
||||
|
@ -347,7 +347,7 @@ void LyXView::updateWindowTitle()
|
||||
if (view()->buffer()) {
|
||||
string const cur_title = buffer()->fileName();
|
||||
if (!cur_title.empty()) {
|
||||
maximize_title += lyx::from_ascii(": ") + makeDisplayPath(cur_title, 30);
|
||||
maximize_title += ": " + makeDisplayPath(cur_title, 30);
|
||||
minimize_title = lyx::from_utf8(onlyFilename(cur_title));
|
||||
if (!buffer()->isClean()) {
|
||||
maximize_title += _(" (changed)");
|
||||
|
@ -157,7 +157,7 @@ void GToc::updateContents()
|
||||
|
||||
for (int rowindex = 0; cit != end; ++cit, ++rowindex) {
|
||||
Gtk::ListStore::iterator row = tocstore_->append();
|
||||
(*row)[listCol_] = cit->asString();
|
||||
(*row)[listCol_] = lyx::to_utf8(cit->asString());
|
||||
(*row)[listColIndex_] = rowindex;
|
||||
}
|
||||
changing_views_ = false;
|
||||
|
@ -154,7 +154,7 @@ void QToc::updateToc(int newdepth)
|
||||
|
||||
lyxerr[Debug::GUI]
|
||||
<< "Table of contents\n"
|
||||
<< "Added item " << iter->str()
|
||||
<< "Added item " << lyx::to_utf8(iter->str())
|
||||
<< " at depth " << iter->depth()
|
||||
<< ", previous sibling \""
|
||||
<< (last ? fromqstr(last->text(0)) : "0")
|
||||
@ -193,8 +193,10 @@ bool QToc::canOutline()
|
||||
}
|
||||
|
||||
|
||||
void QToc::select(string const & text)
|
||||
void QToc::select(string const & t)
|
||||
{
|
||||
// FIXME UNICODE
|
||||
docstring const text = lyx::from_utf8(t);
|
||||
toc::Toc::const_iterator iter = toclist.begin();
|
||||
|
||||
for (; iter != toclist.end(); ++iter) {
|
||||
@ -204,7 +206,7 @@ void QToc::select(string const & text)
|
||||
|
||||
if (iter == toclist.end()) {
|
||||
lyxerr[Debug::GUI] << "Couldn't find highlighted TOC entry: "
|
||||
<< text << endl;
|
||||
<< t << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ private:
|
||||
int depth_;
|
||||
|
||||
/// Store selected item's string
|
||||
std::string text_;
|
||||
lyx::docstring text_;
|
||||
|
||||
/// Store ToC list type
|
||||
std::string type_;
|
||||
|
@ -99,7 +99,7 @@ void QToc::goTo(QModelIndex const & index)
|
||||
TocIterator const it = toc_models_[type_]->tocIterator(index);
|
||||
|
||||
lyxerr[Debug::GUI]
|
||||
<< "QToc::goTo " << it->str()
|
||||
<< "QToc::goTo " << lyx::to_utf8(it->str())
|
||||
<< endl;
|
||||
|
||||
it->goTo(kernel().lyxview());
|
||||
|
@ -101,7 +101,7 @@ void TocModel::populate(TocBackend::Toc const & toc)
|
||||
|
||||
lyxerr[Debug::GUI]
|
||||
<< "Toc: at depth " << iter->depth()
|
||||
<< ", added item " << iter->str()
|
||||
<< ", added item " << lyx::to_utf8(iter->str())
|
||||
<< endl;
|
||||
|
||||
populate(iter, end, top_level_item);
|
||||
|
@ -221,7 +221,7 @@ bool InsetBase::idxUpDown(LCursor &, bool) const
|
||||
|
||||
|
||||
int InsetBase::plaintext(Buffer const &,
|
||||
std::ostream &, OutputParams const &) const
|
||||
lyx::odocstream &, OutputParams const &) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -12,10 +12,9 @@
|
||||
#ifndef INSETBASE_H
|
||||
#define INSETBASE_H
|
||||
|
||||
#include "support/docstring.h"
|
||||
#include "support/docstream.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class Buffer;
|
||||
@ -186,14 +185,14 @@ public:
|
||||
/// describe content if cursor behind
|
||||
virtual void infoize2(std::ostream &) const {}
|
||||
|
||||
/// plain ascii output
|
||||
virtual int plaintext(Buffer const &, std::ostream & os,
|
||||
/// plain text output in ucs4 encoding
|
||||
virtual int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
/// docbook output
|
||||
virtual int docbook(Buffer const &, std::ostream & os,
|
||||
OutputParams const &) const;
|
||||
/// the string that is passed to the TOC
|
||||
virtual int textString(Buffer const &, std::ostream &,
|
||||
virtual int textString(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const { return 0; };
|
||||
|
||||
/** This enum indicates by which means the inset can be modified:
|
||||
|
@ -114,18 +114,23 @@ void InsetBibitem::read(Buffer const &, LyXLex & lex)
|
||||
}
|
||||
|
||||
|
||||
string const InsetBibitem::getBibLabel() const
|
||||
docstring const InsetBibitem::getBibLabel() const
|
||||
{
|
||||
return getOptions().empty() ? convert<string>(counter) : getOptions();
|
||||
// FIXME UNICODE
|
||||
return getOptions().empty() ?
|
||||
convert<docstring>(counter) :
|
||||
lyx::from_utf8(getOptions());
|
||||
}
|
||||
|
||||
|
||||
string const InsetBibitem::getScreenLabel(Buffer const &) const
|
||||
docstring const InsetBibitem::getScreenLabel(Buffer const &) const
|
||||
{
|
||||
return getContents() + " [" + getBibLabel() + ']';
|
||||
// FIXME UNICODE
|
||||
return lyx::from_utf8(getContents()) + " [" + getBibLabel() + ']';
|
||||
}
|
||||
|
||||
int InsetBibitem::plaintext(Buffer const &, ostream & os,
|
||||
|
||||
int InsetBibitem::plaintext(Buffer const &, lyx::odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
os << '[' << getCounter() << "] ";
|
||||
@ -134,7 +139,7 @@ int InsetBibitem::plaintext(Buffer const &, ostream & os,
|
||||
|
||||
|
||||
// ale070405
|
||||
string const bibitemWidest(Buffer const & buffer)
|
||||
docstring const bibitemWidest(Buffer const & buffer)
|
||||
{
|
||||
int w = 0;
|
||||
// Does look like a hack? It is! (but will change at 0.13)
|
||||
@ -149,11 +154,10 @@ string const bibitemWidest(Buffer const & buffer)
|
||||
|
||||
for (; it != end; ++it) {
|
||||
if (it->bibitem()) {
|
||||
string const label = it->bibitem()->getBibLabel();
|
||||
docstring const dlab(label.begin(), label.end());
|
||||
docstring const label = it->bibitem()->getBibLabel();
|
||||
|
||||
int const wx =
|
||||
fm.width(dlab);
|
||||
fm.width(label);
|
||||
if (wx > w) {
|
||||
w = wx;
|
||||
bitem = it->bibitem();
|
||||
@ -164,5 +168,5 @@ string const bibitemWidest(Buffer const & buffer)
|
||||
if (bitem && !bitem->getBibLabel().empty())
|
||||
return bitem->getBibLabel();
|
||||
|
||||
return "99";
|
||||
return lyx::from_ascii("99");
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
///
|
||||
void read(Buffer const &, LyXLex & lex);
|
||||
///
|
||||
virtual std::string const getScreenLabel(Buffer const &) const;
|
||||
lyx::docstring const getScreenLabel(Buffer const &) const;
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
@ -43,9 +43,9 @@ public:
|
||||
///
|
||||
int getCounter() const { return counter; }
|
||||
///
|
||||
std::string const getBibLabel() const;
|
||||
lyx::docstring const getBibLabel() const;
|
||||
///
|
||||
int plaintext(Buffer const &, std::ostream &,
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
protected:
|
||||
///
|
||||
@ -61,6 +61,6 @@ private:
|
||||
|
||||
|
||||
/// Return the widest label in the Bibliography.
|
||||
std::string const bibitemWidest(Buffer const &);
|
||||
lyx::docstring const bibitemWidest(Buffer const &);
|
||||
|
||||
#endif // INSET_BIBITEM_H
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
using lyx::docstring;
|
||||
using lyx::support::absolutePath;
|
||||
using lyx::support::ascii_lowercase;
|
||||
using lyx::support::changeExtension;
|
||||
@ -102,10 +103,9 @@ void InsetBibtex::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
}
|
||||
|
||||
|
||||
string const InsetBibtex::getScreenLabel(Buffer const &) const
|
||||
docstring const InsetBibtex::getScreenLabel(Buffer const &) const
|
||||
{
|
||||
// FIXME UNICODE
|
||||
return lyx::to_utf8(_("BibTeX Generated Bibliography"));
|
||||
return _("BibTeX Generated Bibliography");
|
||||
}
|
||||
|
||||
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
///
|
||||
InsetBibtex(InsetCommandParams const &);
|
||||
///
|
||||
std::string const getScreenLabel(Buffer const &) const;
|
||||
lyx::docstring const getScreenLabel(Buffer const &) const;
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
|
@ -381,7 +381,7 @@ int InsetBox::docbook(Buffer const & buf, std::ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetBox::plaintext(Buffer const & buf, std::ostream & os,
|
||||
int InsetBox::plaintext(Buffer const & buf, lyx::odocstream & os,
|
||||
OutputParams const & runparams) const
|
||||
{
|
||||
BoxType const btype = boxtranslator().find(params_.type);
|
||||
|
@ -88,7 +88,7 @@ public:
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int plaintext(Buffer const &, std::ostream &,
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const & runparams) const;
|
||||
///
|
||||
void validate(LaTeXFeatures &) const;
|
||||
|
@ -236,7 +236,7 @@ int InsetBranch::docbook(Buffer const & buf, std::ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetBranch::plaintext(Buffer const & buf, std::ostream & os,
|
||||
int InsetBranch::plaintext(Buffer const & buf, lyx::odocstream & os,
|
||||
OutputParams const & runparams) const
|
||||
{
|
||||
return isBranchSelected(buf) ?
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
OutputParams const & runparams) const;
|
||||
///
|
||||
int plaintext(Buffer const &, std::ostream &,
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const & runparams) const;
|
||||
///
|
||||
void validate(LaTeXFeatures &) const;
|
||||
|
@ -191,7 +191,7 @@ int InsetCaption::latex(Buffer const & buf, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetCaption::plaintext(Buffer const & /*buf*/,ostream & /*os*/,
|
||||
int InsetCaption::plaintext(Buffer const & /*buf*/, lyx::odocstream & /*os*/,
|
||||
OutputParams const & /*runparams*/) const
|
||||
{
|
||||
// FIXME: Implement me!
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
virtual int latex(Buffer const & buf, std::ostream & os,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int plaintext(Buffer const & buf, std::ostream & os,
|
||||
int plaintext(Buffer const & buf, lyx::odocstream & os,
|
||||
OutputParams const & runparams) const;
|
||||
///
|
||||
int docbook(Buffer const & buf, std::ostream & os,
|
||||
|
@ -306,14 +306,14 @@ int InsetCharStyle::docbook(Buffer const & buf, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetCharStyle::plaintext(Buffer const & buf, ostream & os,
|
||||
int InsetCharStyle::plaintext(Buffer const & buf, lyx::odocstream & os,
|
||||
OutputParams const & runparams) const
|
||||
{
|
||||
return InsetText::plaintext(buf, os, runparams);
|
||||
}
|
||||
|
||||
|
||||
int InsetCharStyle::textString(Buffer const & buf, ostream & os,
|
||||
int InsetCharStyle::textString(Buffer const & buf, lyx::odocstream & os,
|
||||
OutputParams const & op) const
|
||||
{
|
||||
return plaintext(buf, os, op);
|
||||
|
@ -77,10 +77,10 @@ public:
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int plaintext(Buffer const &, std::ostream &,
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
/// the string that is passed to the TOC
|
||||
virtual int textString(Buffer const &, std::ostream & os,
|
||||
virtual int textString(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
void validate(LaTeXFeatures &) const;
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/filesystem/exception.hpp>
|
||||
|
||||
using lyx::docstring;
|
||||
using lyx::support::ascii_lowercase;
|
||||
using lyx::support::contains;
|
||||
using lyx::support::getStringFromVector;
|
||||
@ -305,7 +306,7 @@ InsetCitation::InsetCitation(InsetCommandParams const & p)
|
||||
{}
|
||||
|
||||
|
||||
string const InsetCitation::generateLabel(Buffer const & buffer) const
|
||||
docstring const InsetCitation::generateLabel(Buffer const & buffer) const
|
||||
{
|
||||
string const before = getSecOptions();
|
||||
string const after = getOptions();
|
||||
@ -322,11 +323,12 @@ string const InsetCitation::generateLabel(Buffer const & buffer) const
|
||||
label = getBasicLabel(getContents(), after);
|
||||
}
|
||||
|
||||
return label;
|
||||
// FIXME UNICODE
|
||||
return lyx::from_utf8(label);
|
||||
}
|
||||
|
||||
|
||||
string const InsetCitation::getScreenLabel(Buffer const & buffer) const
|
||||
docstring const InsetCitation::getScreenLabel(Buffer const & buffer) const
|
||||
{
|
||||
biblio::CiteEngine const engine = biblio::getEngine(buffer);
|
||||
if (cache.params == params() && cache.engine == engine)
|
||||
@ -336,11 +338,11 @@ string const InsetCitation::getScreenLabel(Buffer const & buffer) const
|
||||
string const before = getSecOptions();
|
||||
string const after = getOptions();
|
||||
|
||||
string const glabel = generateLabel(buffer);
|
||||
docstring const glabel = generateLabel(buffer);
|
||||
|
||||
unsigned int const maxLabelChars = 45;
|
||||
|
||||
string label = glabel;
|
||||
docstring label = glabel;
|
||||
if (label.size() > maxLabelChars) {
|
||||
label.erase(maxLabelChars-3);
|
||||
label += "...";
|
||||
@ -355,7 +357,8 @@ string const InsetCitation::getScreenLabel(Buffer const & buffer) const
|
||||
}
|
||||
|
||||
|
||||
int InsetCitation::plaintext(Buffer const & buffer, ostream & os, OutputParams const &) const
|
||||
int InsetCitation::plaintext(Buffer const & buffer, lyx::odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
if (cache.params == params() &&
|
||||
cache.engine == biblio::getEngine(buffer))
|
||||
@ -395,7 +398,7 @@ int InsetCitation::docbook(Buffer const &, ostream & os, OutputParams const &) c
|
||||
}
|
||||
|
||||
|
||||
int InsetCitation::textString(Buffer const & buf, ostream & os,
|
||||
int InsetCitation::textString(Buffer const & buf, lyx::odocstream & os,
|
||||
OutputParams const & op) const
|
||||
{
|
||||
return plaintext(buf, os, op);
|
||||
|
@ -25,13 +25,13 @@ public:
|
||||
///
|
||||
InsetCitation(InsetCommandParams const &);
|
||||
///
|
||||
std::string const getScreenLabel(Buffer const &) const;
|
||||
lyx::docstring const getScreenLabel(Buffer const &) const;
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
InsetBase::Code lyxCode() const { return InsetBase::CITE_CODE; }
|
||||
///
|
||||
int plaintext(Buffer const &, std::ostream &, OutputParams const &) const;
|
||||
int plaintext(Buffer const &, lyx::odocstream &, OutputParams const &) const;
|
||||
///
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
@ -39,7 +39,7 @@ public:
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
/// the string that is passed to the TOC
|
||||
virtual int textString(Buffer const &, std::ostream & os,
|
||||
virtual int textString(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
void validate(LaTeXFeatures &) const;
|
||||
@ -53,7 +53,7 @@ private:
|
||||
}
|
||||
|
||||
/// This function does the donkey work of creating the pretty label
|
||||
std::string const generateLabel(Buffer const &) const;
|
||||
lyx::docstring const generateLabel(Buffer const &) const;
|
||||
|
||||
class Cache {
|
||||
public:
|
||||
@ -64,9 +64,9 @@ private:
|
||||
///
|
||||
InsetCommandParams params;
|
||||
///
|
||||
std::string generated_label;
|
||||
lyx::docstring generated_label;
|
||||
///
|
||||
std::string screen_label;
|
||||
lyx::docstring screen_label;
|
||||
};
|
||||
///
|
||||
mutable Cache cache;
|
||||
|
@ -78,7 +78,7 @@ int InsetCommand::latex(Buffer const &, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetCommand::plaintext(Buffer const &, ostream &,
|
||||
int InsetCommand::plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const
|
||||
{
|
||||
return 0;
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
virtual int latex(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int plaintext(Buffer const &, std::ostream &,
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
virtual int docbook(Buffer const &, std::ostream &,
|
||||
@ -107,7 +107,7 @@ protected:
|
||||
///
|
||||
void setParams(InsetCommandParams const &);
|
||||
/// This should provide the text for the button
|
||||
virtual std::string const getScreenLabel(Buffer const &) const = 0;
|
||||
virtual lyx::docstring const getScreenLabel(Buffer const &) const = 0;
|
||||
|
||||
private:
|
||||
///
|
||||
|
@ -170,7 +170,7 @@ int InsetERT::latex(Buffer const &, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetERT::plaintext(Buffer const &, ostream &,
|
||||
int InsetERT::plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const & /*runparams*/) const
|
||||
{
|
||||
return 0;
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int plaintext(Buffer const &, std::ostream &,
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const & runparams) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
|
@ -49,6 +49,7 @@ namespace support = lyx::support;
|
||||
namespace external = lyx::external;
|
||||
namespace graphics = lyx::graphics;
|
||||
|
||||
using lyx::docstring;
|
||||
using std::endl;
|
||||
using std::string;
|
||||
using std::auto_ptr;
|
||||
@ -569,16 +570,18 @@ graphics::Params get_grfx_params(InsetExternalParams const & eparams)
|
||||
}
|
||||
|
||||
|
||||
string const getScreenLabel(InsetExternalParams const & params,
|
||||
docstring const getScreenLabel(InsetExternalParams const & params,
|
||||
Buffer const & buffer)
|
||||
{
|
||||
external::Template const * const ptr =
|
||||
external::getTemplatePtr(params);
|
||||
if (!ptr)
|
||||
// FIXME UNICODE
|
||||
return lyx::to_utf8(support::bformat(_("External template %1$s is not installed"),
|
||||
lyx::from_utf8(params.templatename())));
|
||||
return external::doSubstitution(params, buffer, ptr->guiName, false);
|
||||
return support::bformat((_("External template %1$s is not installed")),
|
||||
lyx::from_utf8(params.templatename()));
|
||||
// FIXME UNICODE
|
||||
return lyx::from_utf8(external::doSubstitution(params, buffer,
|
||||
ptr->guiName, false));
|
||||
}
|
||||
|
||||
void add_preview_and_start_loading(RenderMonitoredPreview &,
|
||||
@ -715,12 +718,16 @@ int InsetExternal::latex(Buffer const & buf, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetExternal::plaintext(Buffer const & buf, ostream & os,
|
||||
int InsetExternal::plaintext(Buffer const & buf, lyx::odocstream & os,
|
||||
OutputParams const & runparams) const
|
||||
{
|
||||
return external::writeExternal(params_, "Ascii", buf, os,
|
||||
std::ostringstream oss;
|
||||
int const retval = external::writeExternal(params_, "Ascii", buf, oss,
|
||||
*(runparams.exportdata), false,
|
||||
runparams.inComment);
|
||||
// FIXME UNICODE
|
||||
os << lyx::from_utf8(oss.str());
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
|
@ -126,7 +126,7 @@ public:
|
||||
virtual int latex(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
virtual int plaintext(Buffer const &, std::ostream &,
|
||||
virtual int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
virtual int docbook(Buffer const &, std::ostream &,
|
||||
|
@ -384,10 +384,10 @@ void InsetFloat::addToToc(lyx::toc::TocList & toclist, Buffer const & buf) const
|
||||
for (; pit != end; ++pit) {
|
||||
if (pit->layout()->labeltype == LABEL_SENSITIVE) {
|
||||
string const type = params_.type;
|
||||
string const str =
|
||||
convert<string>(toclist[type].size() + 1)
|
||||
docstring const str =
|
||||
convert<docstring>(toclist[type].size() + 1)
|
||||
+ ". " + pit->asString(buf, false);
|
||||
lyx::toc::TocItem const item(pit, 0 , str);
|
||||
lyx::toc::TocItem const item(pit, 0, str);
|
||||
toclist[type].push_back(item);
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include "support/lstrings.h"
|
||||
|
||||
using lyx::docstring;
|
||||
using lyx::support::bformat;
|
||||
|
||||
using std::endl;
|
||||
@ -46,16 +47,14 @@ InsetFloatList::InsetFloatList(string const & type)
|
||||
}
|
||||
|
||||
|
||||
string const InsetFloatList::getScreenLabel(Buffer const & buf) const
|
||||
docstring const InsetFloatList::getScreenLabel(Buffer const & buf) const
|
||||
{
|
||||
FloatList const & floats = buf.params().getLyXTextClass().floats();
|
||||
FloatList::const_iterator it = floats[getCmdName()];
|
||||
if (it != floats.end())
|
||||
// FIXME UNICODE
|
||||
return lyx::to_utf8(buf.B_(it->second.listName()));
|
||||
return buf.B_(it->second.listName());
|
||||
else
|
||||
// FIXME UNICODE
|
||||
return lyx::to_utf8(_("ERROR: Nonexistent float type!"));
|
||||
return _("ERROR: Nonexistent float type!");
|
||||
}
|
||||
|
||||
|
||||
@ -128,7 +127,8 @@ int InsetFloatList::latex(Buffer const & buf, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetFloatList::plaintext(Buffer const & buffer, ostream & os, OutputParams const &) const
|
||||
int InsetFloatList::plaintext(Buffer const & buffer, lyx::odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
os << getScreenLabel(buffer) << "\n\n";
|
||||
|
||||
|
@ -24,7 +24,7 @@ public:
|
||||
///
|
||||
InsetFloatList(std::string const & type);
|
||||
///
|
||||
std::string const getScreenLabel(Buffer const &) const;
|
||||
lyx::docstring const getScreenLabel(Buffer const &) const;
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
@ -42,7 +42,7 @@ public:
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const { return 0; }
|
||||
///
|
||||
int plaintext(Buffer const &, std::ostream &,
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const & runparams) const;
|
||||
///
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
|
@ -804,7 +804,7 @@ int InsetGraphics::latex(Buffer const & buf, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetGraphics::plaintext(Buffer const &, ostream & os,
|
||||
int InsetGraphics::plaintext(Buffer const &, lyx::odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
// No graphics in ascii output. Possible to use gifscii to convert
|
||||
@ -813,8 +813,10 @@ int InsetGraphics::plaintext(Buffer const &, ostream & os,
|
||||
// 2. Read ascii output file and add it to the output stream.
|
||||
// at least we send the filename
|
||||
// FIXME UNICODE
|
||||
os << '<' << lyx::to_utf8(bformat(_("Graphics file: %1$s"),
|
||||
lyx::from_utf8(params().filename.absFilename()))) << ">\n";
|
||||
// FIXME: We have no idea what the encoding of the filename is
|
||||
os << '<' << bformat(_("Graphics file: %1$s"),
|
||||
lyx::from_utf8(params().filename.absFilename()))
|
||||
<< ">\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int plaintext(Buffer const &, std::ostream &,
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
|
@ -14,6 +14,8 @@
|
||||
|
||||
#include "support/std_ostream.h"
|
||||
|
||||
using lyx::docstring;
|
||||
|
||||
using std::ostream;
|
||||
|
||||
|
||||
@ -37,9 +39,9 @@ void InsetHFill::metrics(MetricsInfo &, Dimension & dim) const
|
||||
}
|
||||
|
||||
|
||||
std::string const InsetHFill::getScreenLabel(Buffer const &) const
|
||||
docstring const InsetHFill::getScreenLabel(Buffer const &) const
|
||||
{
|
||||
return getContents();
|
||||
return lyx::from_ascii(getContents());
|
||||
}
|
||||
|
||||
|
||||
@ -51,7 +53,7 @@ int InsetHFill::latex(Buffer const &, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetHFill::plaintext(Buffer const &, ostream & os,
|
||||
int InsetHFill::plaintext(Buffer const &, lyx::odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
os << '\t';
|
||||
|
@ -22,14 +22,14 @@ public:
|
||||
///
|
||||
void metrics(MetricsInfo &, Dimension &) const;
|
||||
///
|
||||
std::string const getScreenLabel(Buffer const &) const;
|
||||
lyx::docstring const getScreenLabel(Buffer const &) const;
|
||||
///
|
||||
InsetBase::Code lyxCode() const { return InsetBase::HFILL_CODE; }
|
||||
///
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int plaintext(Buffer const &, std::ostream &,
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const & runparams) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
|
@ -39,10 +39,10 @@
|
||||
|
||||
#include "insets/render_preview.h"
|
||||
|
||||
#include "support/lyxalgo.h"
|
||||
#include "support/filename.h"
|
||||
#include "support/filetools.h"
|
||||
#include "support/lstrings.h" // contains
|
||||
#include "support/lyxalgo.h"
|
||||
#include "support/lyxlib.h"
|
||||
#include "support/convert.h"
|
||||
|
||||
@ -275,7 +275,7 @@ void InsetInclude::read(LyXLex & lex)
|
||||
}
|
||||
|
||||
|
||||
string const InsetInclude::getScreenLabel(Buffer const &) const
|
||||
docstring const InsetInclude::getScreenLabel(Buffer const &) const
|
||||
{
|
||||
docstring temp;
|
||||
|
||||
@ -294,15 +294,15 @@ string const InsetInclude::getScreenLabel(Buffer const &) const
|
||||
break;
|
||||
}
|
||||
|
||||
temp += lyx::from_ascii(": ");
|
||||
temp += ": ";
|
||||
|
||||
if (params_.getContents().empty())
|
||||
temp += lyx::from_ascii("???");
|
||||
temp += "???";
|
||||
else
|
||||
// FIXME: We don't know the encoding of the filename
|
||||
temp += lyx::from_ascii(onlyFilename(params_.getContents()));
|
||||
|
||||
// FIXME UNICODE
|
||||
return lyx::to_utf8(temp);
|
||||
return temp;
|
||||
}
|
||||
|
||||
|
||||
@ -468,12 +468,13 @@ int InsetInclude::latex(Buffer const & buffer, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetInclude::plaintext(Buffer const & buffer, ostream & os,
|
||||
int InsetInclude::plaintext(Buffer const & buffer, lyx::odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
if (isVerbatim(params_)) {
|
||||
string const str =
|
||||
getFileContents(includedFilename(buffer, params_));
|
||||
// FIXME: We don't know the encoding of the file
|
||||
docstring const str = lyx::from_utf8(
|
||||
getFileContents(includedFilename(buffer, params_)));
|
||||
os << str;
|
||||
// Return how many newlines we issued.
|
||||
return int(lyx::count(str.begin(), str.end(), '\n'));
|
||||
|
@ -78,7 +78,7 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int plaintext(Buffer const &, std::ostream &,
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
@ -106,7 +106,7 @@ private:
|
||||
/// set the parameters
|
||||
void set(InsetCommandParams const & params, Buffer const &);
|
||||
/// get the text displayed on the button
|
||||
std::string const getScreenLabel(Buffer const &) const;
|
||||
lyx::docstring const getScreenLabel(Buffer const &) const;
|
||||
///
|
||||
void write(std::ostream &) const;
|
||||
///
|
||||
|
@ -20,6 +20,8 @@
|
||||
|
||||
#include "support/std_ostream.h"
|
||||
|
||||
using lyx::docstring;
|
||||
|
||||
using std::string;
|
||||
using std::ostream;
|
||||
|
||||
@ -34,10 +36,9 @@ InsetIndex::InsetIndex(InsetCommandParams const & p)
|
||||
// {}
|
||||
|
||||
|
||||
string const InsetIndex::getScreenLabel(Buffer const &) const
|
||||
docstring const InsetIndex::getScreenLabel(Buffer const &) const
|
||||
{
|
||||
// FIXME UNICODE
|
||||
return lyx::to_utf8(_("Idx"));
|
||||
return _("Idx");
|
||||
}
|
||||
|
||||
|
||||
@ -67,10 +68,9 @@ InsetPrintIndex::InsetPrintIndex(InsetCommandParams const & p)
|
||||
// {}
|
||||
|
||||
|
||||
string const InsetPrintIndex::getScreenLabel(Buffer const &) const
|
||||
docstring const InsetPrintIndex::getScreenLabel(Buffer const &) const
|
||||
{
|
||||
// FIXME UNICODE
|
||||
return lyx::to_utf8(_("Index"));
|
||||
return _("Index");
|
||||
}
|
||||
|
||||
|
||||
|
@ -24,7 +24,7 @@ public:
|
||||
///
|
||||
InsetIndex(InsetCommandParams const &);
|
||||
///
|
||||
std::string const getScreenLabel(Buffer const &) const;
|
||||
lyx::docstring const getScreenLabel(Buffer const &) const;
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
@ -52,7 +52,7 @@ public:
|
||||
///
|
||||
bool display() const { return true; }
|
||||
///
|
||||
std::string const getScreenLabel(Buffer const &) const;
|
||||
lyx::docstring const getScreenLabel(Buffer const &) const;
|
||||
private:
|
||||
virtual std::auto_ptr<InsetBase> doClone() const {
|
||||
return std::auto_ptr<InsetBase>(new InsetPrintIndex(params()));
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "support/lyxalgo.h"
|
||||
#include "support/std_ostream.h"
|
||||
|
||||
using lyx::docstring;
|
||||
using lyx::support::escape;
|
||||
|
||||
using std::string;
|
||||
@ -50,9 +51,10 @@ void InsetLabel::getLabelList(Buffer const &, std::vector<string> & list) const
|
||||
}
|
||||
|
||||
|
||||
string const InsetLabel::getScreenLabel(Buffer const &) const
|
||||
docstring const InsetLabel::getScreenLabel(Buffer const &) const
|
||||
{
|
||||
return getContents();
|
||||
// FIXME UNICODE
|
||||
return lyx::from_utf8(getContents());
|
||||
}
|
||||
|
||||
|
||||
@ -89,10 +91,11 @@ int InsetLabel::latex(Buffer const &, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetLabel::plaintext(Buffer const &, ostream & os,
|
||||
int InsetLabel::plaintext(Buffer const &, lyx::odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
os << '<' << getContents() << '>';
|
||||
// FIXME UNICODE
|
||||
os << '<' << lyx::from_utf8(getContents()) << '>';
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ public:
|
||||
///
|
||||
InsetLabel(InsetCommandParams const &);
|
||||
///
|
||||
std::string const getScreenLabel(Buffer const &) const;
|
||||
lyx::docstring const getScreenLabel(Buffer const &) const;
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
@ -30,7 +30,7 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int plaintext(Buffer const &, std::ostream &,
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
|
@ -579,10 +579,10 @@ int InsetLatexAccent::latex(Buffer const &, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetLatexAccent::plaintext(Buffer const &, ostream & os,
|
||||
int InsetLatexAccent::plaintext(Buffer const &, lyx::odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
os << contents;
|
||||
os << lyx::from_ascii(contents);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -595,7 +595,7 @@ int InsetLatexAccent::docbook(Buffer const &, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetLatexAccent::textString(Buffer const & buf, ostream & os,
|
||||
int InsetLatexAccent::textString(Buffer const & buf, lyx::odocstream & os,
|
||||
OutputParams const & op) const
|
||||
{
|
||||
return plaintext(buf, os, op);
|
||||
|
@ -46,13 +46,13 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int plaintext(Buffer const &, std::ostream &,
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
/// the string that is passed to the TOC
|
||||
virtual int textString(Buffer const &, std::ostream & os,
|
||||
virtual int textString(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
bool directWrite() const;
|
||||
|
@ -63,7 +63,7 @@ int InsetLine::latex(Buffer const &, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetLine::plaintext(Buffer const &, ostream & os,
|
||||
int InsetLine::plaintext(Buffer const &, lyx::odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
os << "-------------------------------------------";
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
|
||||
int plaintext(Buffer const &, std::ostream &,
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
|
@ -57,7 +57,7 @@ int InsetNewline::latex(Buffer const &, ostream &,
|
||||
}
|
||||
|
||||
|
||||
int InsetNewline::plaintext(Buffer const &, ostream & os,
|
||||
int InsetNewline::plaintext(Buffer const &, lyx::odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
os << '\n';
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
virtual int latex(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
|
||||
virtual int plaintext(Buffer const &, std::ostream &,
|
||||
virtual int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
|
||||
virtual int docbook(Buffer const &, std::ostream &,
|
||||
|
@ -322,7 +322,7 @@ int InsetNote::docbook(Buffer const & buf, std::ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetNote::plaintext(Buffer const & buf, std::ostream & os,
|
||||
int InsetNote::plaintext(Buffer const & buf, lyx::odocstream & os,
|
||||
OutputParams const & runparams_in) const
|
||||
{
|
||||
if (params_.type == InsetNoteParams::Note)
|
||||
|
@ -63,7 +63,7 @@ public:
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int plaintext(Buffer const &, std::ostream &,
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
void validate(LaTeXFeatures &) const;
|
||||
|
@ -79,7 +79,7 @@ int InsetOptArg::docbook(Buffer const &, ostream &,
|
||||
}
|
||||
|
||||
|
||||
int InsetOptArg::plaintext(Buffer const &, ostream &,
|
||||
int InsetOptArg::plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const
|
||||
{
|
||||
return 0;
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
OutputParams const &) const;
|
||||
|
||||
/// Standard plain text output -- short-circuited
|
||||
int plaintext(Buffer const &, std::ostream &,
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
|
||||
/// Outputting the optional parameter of a LaTeX command
|
||||
|
@ -83,7 +83,7 @@ int InsetPagebreak::latex(Buffer const &, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetPagebreak::plaintext(Buffer const &, ostream & os,
|
||||
int InsetPagebreak::plaintext(Buffer const &, lyx::odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
os << '\n';
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
|
||||
int plaintext(Buffer const &, std::ostream &,
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
|
@ -301,7 +301,7 @@ int InsetQuotes::latex(Buffer const &, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetQuotes::plaintext(Buffer const &, ostream & os,
|
||||
int InsetQuotes::plaintext(Buffer const &, lyx::odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
os << '"';
|
||||
@ -327,7 +327,7 @@ int InsetQuotes::docbook(Buffer const &, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetQuotes::textString(Buffer const & buf, ostream & os,
|
||||
int InsetQuotes::textString(Buffer const & buf, lyx::odocstream & os,
|
||||
OutputParams const & op) const
|
||||
{
|
||||
return plaintext(buf, os, op);
|
||||
|
@ -87,14 +87,14 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int plaintext(Buffer const &, std::ostream &,
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
|
||||
/// the string that is passed to the TOC
|
||||
virtual int textString(Buffer const &, std::ostream & os,
|
||||
virtual int textString(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
|
||||
///
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "support/lstrings.h"
|
||||
|
||||
|
||||
using lyx::docstring;
|
||||
using lyx::support::escape;
|
||||
|
||||
using std::string;
|
||||
@ -62,21 +63,22 @@ void InsetRef::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
}
|
||||
|
||||
|
||||
string const InsetRef::getScreenLabel(Buffer const &) const
|
||||
docstring const InsetRef::getScreenLabel(Buffer const &) const
|
||||
{
|
||||
string temp;
|
||||
docstring temp;
|
||||
for (int i = 0; !types[i].latex_name.empty(); ++i) {
|
||||
if (getCmdName() == types[i].latex_name) {
|
||||
// FIXME UNIOCDE
|
||||
temp = lyx::to_utf8(_(types[i].short_gui_name));
|
||||
temp = _(types[i].short_gui_name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
temp += getContents();
|
||||
// FIXME UNIOCDE
|
||||
temp += lyx::from_utf8(getContents());
|
||||
|
||||
if (!isLatex && !getOptions().empty()) {
|
||||
temp += "||";
|
||||
temp += getOptions();
|
||||
// FIXME UNIOCDE
|
||||
temp += lyx::from_utf8(getOptions());
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
@ -95,10 +97,11 @@ int InsetRef::latex(Buffer const &, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetRef::plaintext(Buffer const &, ostream & os,
|
||||
int InsetRef::plaintext(Buffer const &, lyx::odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
os << '[' << getContents() << ']';
|
||||
// FIXME UNIOCDE
|
||||
os << '[' << lyx::from_utf8(getContents()) << ']';
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -119,7 +122,7 @@ int InsetRef::docbook(Buffer const & buf, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetRef::textString(Buffer const & buf, ostream & os,
|
||||
int InsetRef::textString(Buffer const & buf, lyx::odocstream & os,
|
||||
OutputParams const & op) const
|
||||
{
|
||||
return plaintext(buf, os, op);
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
InsetRef(InsetCommandParams const &, Buffer const &);
|
||||
|
||||
///
|
||||
std::string const getScreenLabel(Buffer const &) const;
|
||||
lyx::docstring const getScreenLabel(Buffer const &) const;
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
@ -47,13 +47,13 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int plaintext(Buffer const &, std::ostream &,
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
/// the string that is passed to the TOC
|
||||
virtual int textString(Buffer const &, std::ostream & os,
|
||||
virtual int textString(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
|
@ -195,7 +195,7 @@ int InsetSpace::latex(Buffer const &, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetSpace::plaintext(Buffer const &, ostream & os,
|
||||
int InsetSpace::plaintext(Buffer const &, lyx::odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
switch (kind_) {
|
||||
@ -235,7 +235,7 @@ int InsetSpace::docbook(Buffer const &, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetSpace::textString(Buffer const & buf, ostream & os,
|
||||
int InsetSpace::textString(Buffer const & buf, lyx::odocstream & os,
|
||||
OutputParams const & op) const
|
||||
{
|
||||
return plaintext(buf, os, op);
|
||||
|
@ -64,13 +64,13 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int plaintext(Buffer const &, std::ostream &,
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
/// the string that is passed to the TOC
|
||||
virtual int textString(Buffer const &, std::ostream & os,
|
||||
virtual int textString(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
InsetBase::Code lyxCode() const { return InsetBase::SPACE_CODE; }
|
||||
|
@ -188,7 +188,7 @@ int InsetSpecialChar::latex(Buffer const &, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetSpecialChar::plaintext(Buffer const &, ostream & os,
|
||||
int InsetSpecialChar::plaintext(Buffer const &, lyx::odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
switch (kind_) {
|
||||
@ -230,7 +230,7 @@ int InsetSpecialChar::docbook(Buffer const &, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetSpecialChar::textString(Buffer const & buf, ostream & os,
|
||||
int InsetSpecialChar::textString(Buffer const & buf, lyx::odocstream & os,
|
||||
OutputParams const & op) const
|
||||
{
|
||||
return plaintext(buf, os, op);
|
||||
|
@ -56,13 +56,13 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int plaintext(Buffer const &, std::ostream &,
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
/// the string that is passed to the TOC
|
||||
virtual int textString(Buffer const &, std::ostream & os,
|
||||
virtual int textString(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
InsetBase::Code lyxCode() const { return InsetBase::SPECIALCHAR_CODE; }
|
||||
|
@ -1060,7 +1060,7 @@ int InsetTabular::latex(Buffer const & buf, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetTabular::plaintext(Buffer const & buf, ostream & os,
|
||||
int InsetTabular::plaintext(Buffer const & buf, lyx::odocstream & os,
|
||||
OutputParams const & runparams) const
|
||||
{
|
||||
int const dp = runparams.linelen ? runparams.depth : 0;
|
||||
@ -1788,10 +1788,10 @@ bool InsetTabular::copySelection(LCursor & cur)
|
||||
paste_tabular->setRightLine(paste_tabular->getLastCellInRow(0),
|
||||
true, true);
|
||||
|
||||
ostringstream os;
|
||||
lyx::odocstringstream os;
|
||||
OutputParams const runparams;
|
||||
paste_tabular->plaintext(cur.buffer(), os, runparams, 0, true, '\t');
|
||||
theClipboard().put(lyx::from_utf8(os.str()));
|
||||
theClipboard().put(os.str());
|
||||
// mark tabular stack dirty
|
||||
// FIXME: this is a workaround for bug 1919. Should be removed for 1.5,
|
||||
// when we (hopefully) have a one-for-all paste mechanism.
|
||||
|
@ -87,7 +87,7 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int plaintext(Buffer const &, std::ostream &,
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
|
@ -268,18 +268,18 @@ int InsetText::latex(Buffer const & buf, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetText::plaintext(Buffer const & buf, ostream & os,
|
||||
int InsetText::plaintext(Buffer const & buf, lyx::odocstream & os,
|
||||
OutputParams const & runparams) const
|
||||
{
|
||||
ParagraphList::const_iterator beg = paragraphs().begin();
|
||||
ParagraphList::const_iterator end = paragraphs().end();
|
||||
ParagraphList::const_iterator it = beg;
|
||||
bool ref_printed = false;
|
||||
std::ostringstream oss;
|
||||
lyx::odocstringstream oss;
|
||||
for (; it != end; ++it)
|
||||
asciiParagraph(buf, *it, oss, runparams, ref_printed);
|
||||
|
||||
string const str = oss.str();
|
||||
docstring const str = oss.str();
|
||||
os << str;
|
||||
// Return how many newlines we issued.
|
||||
return int(lyx::count(str.begin(), str.end(), '\n'));
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int plaintext(Buffer const &, std::ostream &,
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
|
@ -20,6 +20,8 @@
|
||||
|
||||
#include "support/std_ostream.h"
|
||||
|
||||
using lyx::docstring;
|
||||
|
||||
using std::string;
|
||||
using std::ostream;
|
||||
|
||||
@ -36,12 +38,11 @@ std::auto_ptr<InsetBase> InsetTOC::doClone() const
|
||||
}
|
||||
|
||||
|
||||
string const InsetTOC::getScreenLabel(Buffer const &) const
|
||||
docstring const InsetTOC::getScreenLabel(Buffer const &) const
|
||||
{
|
||||
// FIXME UNICODE
|
||||
if (getCmdName() == "tableofcontents")
|
||||
return lyx::to_utf8(_("Table of Contents"));
|
||||
return lyx::to_utf8(_("Unknown toc list"));
|
||||
return _("Table of Contents");
|
||||
return _("Unknown toc list");
|
||||
}
|
||||
|
||||
|
||||
@ -53,7 +54,7 @@ InsetBase::Code InsetTOC::lyxCode() const
|
||||
}
|
||||
|
||||
|
||||
int InsetTOC::plaintext(Buffer const & buffer, ostream & os,
|
||||
int InsetTOC::plaintext(Buffer const & buffer, lyx::odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
os << getScreenLabel(buffer) << "\n\n";
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
///
|
||||
explicit InsetTOC(InsetCommandParams const &);
|
||||
///
|
||||
std::string const getScreenLabel(Buffer const &) const;
|
||||
lyx::docstring const getScreenLabel(Buffer const &) const;
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
@ -29,7 +29,7 @@ public:
|
||||
///
|
||||
bool display() const { return true; }
|
||||
///
|
||||
int plaintext(Buffer const &, std::ostream &,
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "support/std_ostream.h"
|
||||
|
||||
using lyx::docstring;
|
||||
using lyx::support::subst;
|
||||
|
||||
using std::string;
|
||||
@ -33,14 +34,10 @@ InsetUrl::InsetUrl(InsetCommandParams const & p)
|
||||
{}
|
||||
|
||||
|
||||
string const InsetUrl::getScreenLabel(Buffer const &) const
|
||||
docstring const InsetUrl::getScreenLabel(Buffer const &) const
|
||||
{
|
||||
string temp;
|
||||
// FIXME UNICODE
|
||||
if (getCmdName() == "url")
|
||||
temp = lyx::to_utf8(_("Url: "));
|
||||
else
|
||||
temp = lyx::to_utf8(_("HtmlUrl: "));
|
||||
docstring const temp =
|
||||
(getCmdName() == "url") ? _("Url: ") : _("HtmlUrl: ");
|
||||
|
||||
string url;
|
||||
|
||||
@ -54,7 +51,8 @@ string const InsetUrl::getScreenLabel(Buffer const &) const
|
||||
url = url.substr(0, 10) + "..."
|
||||
+ url.substr(url.length() - 17, url.length());
|
||||
}
|
||||
return temp + url;
|
||||
// FIXME UNICODE
|
||||
return temp + lyx::from_utf8(url);
|
||||
}
|
||||
|
||||
|
||||
@ -70,13 +68,16 @@ int InsetUrl::latex(Buffer const &, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetUrl::plaintext(Buffer const &, ostream & os,
|
||||
int InsetUrl::plaintext(Buffer const &, lyx::odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
// FIXME UNICODE
|
||||
os << '[' << lyx::from_utf8(getContents());
|
||||
if (getOptions().empty())
|
||||
os << '[' << getContents() << ']';
|
||||
os << ']';
|
||||
else
|
||||
os << '[' << getContents() << "||" << getOptions() << ']';
|
||||
// FIXME UNICODE
|
||||
os << "||" << lyx::from_utf8(getOptions()) << ']';
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -90,7 +91,7 @@ int InsetUrl::docbook(Buffer const &, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetUrl::textString(Buffer const & buf, ostream & os,
|
||||
int InsetUrl::textString(Buffer const & buf, lyx::odocstream & os,
|
||||
OutputParams const & op) const
|
||||
{
|
||||
return plaintext(buf, os, op);
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
///
|
||||
void validate(LaTeXFeatures &) const;
|
||||
///
|
||||
std::string const getScreenLabel(Buffer const &) const;
|
||||
lyx::docstring const getScreenLabel(Buffer const &) const;
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
@ -38,13 +38,13 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int plaintext(Buffer const &, std::ostream &,
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
/// the string that is passed to the TOC
|
||||
virtual int textString(Buffer const &, std::ostream & os,
|
||||
virtual int textString(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
private:
|
||||
virtual std::auto_ptr<InsetBase> doClone() const {
|
||||
|
@ -210,7 +210,7 @@ int InsetVSpace::latex(Buffer const & buf, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetVSpace::plaintext(Buffer const &, ostream & os,
|
||||
int InsetVSpace::plaintext(Buffer const &, lyx::odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
os << "\n\n";
|
||||
|
@ -33,7 +33,7 @@ public:
|
||||
int latex(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int plaintext(Buffer const &, std::ostream &,
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
|
@ -233,10 +233,10 @@ void InsetWrap::addToToc(lyx::toc::TocList & toclist, Buffer const & buf) const
|
||||
for (; pit != end; ++pit) {
|
||||
if (pit->layout()->labeltype == LABEL_SENSITIVE) {
|
||||
string const type = params_.type;
|
||||
string const str =
|
||||
convert<string>(toclist[type].size() + 1)
|
||||
docstring const str =
|
||||
convert<docstring>(toclist[type].size() + 1)
|
||||
+ ". " + pit->asString(buf, false);
|
||||
lyx::toc::TocItem const item(pit, 0 , str);
|
||||
lyx::toc::TocItem const item(pit, 0, str);
|
||||
toclist[type].push_back(item);
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ auto_ptr<RenderBase> RenderButton::clone(InsetBase const *) const
|
||||
}
|
||||
|
||||
|
||||
void RenderButton::update(string const & text, bool editable)
|
||||
void RenderButton::update(docstring const & text, bool editable)
|
||||
{
|
||||
text_ = text;
|
||||
editable_ = editable;
|
||||
@ -49,12 +49,10 @@ void RenderButton::metrics(MetricsInfo &, Dimension & dim) const
|
||||
lyx::frontend::FontMetrics const & fm =
|
||||
theFontMetrics(font);
|
||||
|
||||
docstring dtext(text_.begin(), text_.end());
|
||||
|
||||
if (editable_)
|
||||
fm.buttonText(dtext, dim.wid, dim.asc, dim.des);
|
||||
fm.buttonText(text_, dim.wid, dim.asc, dim.des);
|
||||
else
|
||||
fm.rectText(dtext, dim.wid, dim.asc, dim.des);
|
||||
fm.rectText(text_, dim.wid, dim.asc, dim.des);
|
||||
|
||||
dim.wid += 4;
|
||||
}
|
||||
@ -67,12 +65,10 @@ void RenderButton::draw(PainterInfo & pi, int x, int y) const
|
||||
font.setColor(LColor::command);
|
||||
font.decSize();
|
||||
|
||||
docstring dtext(text_.begin(), text_.end());
|
||||
|
||||
if (editable_) {
|
||||
pi.pain.buttonText(x + 2, y, dtext, font);
|
||||
pi.pain.buttonText(x + 2, y, text_, font);
|
||||
} else {
|
||||
pi.pain.rectText(x + 2, y, dtext, font,
|
||||
pi.pain.rectText(x + 2, y, text_, font,
|
||||
LColor::commandbg, LColor::commandframe);
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#include "render_base.h"
|
||||
#include "box.h"
|
||||
#include <string>
|
||||
#include "support/docstring.h"
|
||||
|
||||
|
||||
class RenderButton : public RenderBase
|
||||
@ -30,7 +30,7 @@ public:
|
||||
virtual void draw(PainterInfo & pi, int x, int y) const;
|
||||
|
||||
/// Provide the text for the button
|
||||
void update(std::string const &, bool editable);
|
||||
void update(lyx::docstring const &, bool editable);
|
||||
|
||||
/// The "sensitive area" box, i.e., the button area
|
||||
Box box() const { return button_box_; }
|
||||
@ -42,7 +42,7 @@ public:
|
||||
|
||||
private:
|
||||
/// The stored data.
|
||||
std::string text_;
|
||||
lyx::docstring text_;
|
||||
bool editable_;
|
||||
Box button_box_;
|
||||
};
|
||||
|
@ -1281,7 +1281,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
makeAbsPath(argument, owner->buffer()->filePath());
|
||||
// FIXME Should use bformat
|
||||
setMessage(_("Opening child document ") +
|
||||
makeDisplayPath(filename) + lyx::from_ascii("..."));
|
||||
makeDisplayPath(filename) + "...");
|
||||
view()->savePosition(0);
|
||||
string const parentfilename = owner->buffer()->fileName();
|
||||
if (theBufferList().exists(filename))
|
||||
|
@ -85,7 +85,7 @@ int InsetFormulaMacro::latex(Buffer const &, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetFormulaMacro::plaintext(Buffer const &, ostream & os,
|
||||
int InsetFormulaMacro::plaintext(Buffer const &, lyx::odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
WriteStream wi(os, false, true);
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
///
|
||||
void write(Buffer const &, std::ostream & os) const;
|
||||
///
|
||||
int plaintext(Buffer const &, std::ostream &,
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int latex(Buffer const &, std::ostream & os,
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
#include <sstream>
|
||||
|
||||
using lyx::docstring;
|
||||
|
||||
using std::string;
|
||||
using std::auto_ptr;
|
||||
using std::ostringstream;
|
||||
@ -70,9 +72,9 @@ void CommandInset::write(WriteStream & os) const
|
||||
}
|
||||
|
||||
|
||||
string const CommandInset::screenLabel() const
|
||||
docstring const CommandInset::screenLabel() const
|
||||
{
|
||||
return name_;
|
||||
return lyx::from_ascii(name_);
|
||||
}
|
||||
|
||||
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
//
|
||||
// void infoize(std::ostream & os) const;
|
||||
///
|
||||
virtual std::string const screenLabel() const;
|
||||
virtual lyx::docstring const screenLabel() const;
|
||||
/// generate something that will be understood by the Dialogs.
|
||||
std::string const createDialogStr(std::string const & name) const;
|
||||
///
|
||||
|
@ -1210,7 +1210,9 @@ void InsetMathGrid::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
int n = 0;
|
||||
is >> n;
|
||||
InsetMathGrid grid(1, 1);
|
||||
mathed_parse_normal(grid, lyx::cap::getSelection(cur.buffer(), n));
|
||||
// FIXME UNICODE
|
||||
mathed_parse_normal(grid,
|
||||
lyx::to_utf8(lyx::cap::getSelection(cur.buffer(), n)));
|
||||
if (grid.nargs() == 1) {
|
||||
// single cell/part of cell
|
||||
recordUndo(cur);
|
||||
|
@ -1425,7 +1425,7 @@ void InsetMathHull::read(Buffer const &, LyXLex & lex)
|
||||
}
|
||||
|
||||
|
||||
int InsetMathHull::plaintext(Buffer const &, ostream & os,
|
||||
int InsetMathHull::plaintext(Buffer const &, lyx::odocstream & os,
|
||||
OutputParams const &) const
|
||||
{
|
||||
if (0 && display()) {
|
||||
@ -1439,8 +1439,11 @@ int InsetMathHull::plaintext(Buffer const &, ostream & os,
|
||||
//metrics();
|
||||
return tpain.textheight();
|
||||
} else {
|
||||
WriteStream wi(os, false, true);
|
||||
std::ostringstream oss;
|
||||
WriteStream wi(oss, false, true);
|
||||
wi << cell(0);
|
||||
// FIXME UNICODE
|
||||
os << lyx::from_utf8(oss.str());
|
||||
return wi.line();
|
||||
}
|
||||
}
|
||||
@ -1498,7 +1501,7 @@ int InsetMathHull::docbook(Buffer const & buf, ostream & os,
|
||||
}
|
||||
|
||||
|
||||
int InsetMathHull::textString(Buffer const & buf, ostream & os,
|
||||
int InsetMathHull::textString(Buffer const & buf, lyx::odocstream & os,
|
||||
OutputParams const & op) const
|
||||
{
|
||||
return plaintext(buf, os, op);
|
||||
|
@ -100,13 +100,13 @@ public:
|
||||
///
|
||||
void read(Buffer const &, LyXLex & lex);
|
||||
///
|
||||
int plaintext(Buffer const &, std::ostream &,
|
||||
int plaintext(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
///
|
||||
int docbook(Buffer const &, std::ostream &,
|
||||
OutputParams const &) const;
|
||||
/// the string that is passed to the TOC
|
||||
virtual int textString(Buffer const &, std::ostream & os,
|
||||
virtual int textString(Buffer const &, lyx::odocstream &,
|
||||
OutputParams const &) const;
|
||||
|
||||
/// get notification when the cursor leaves this inset
|
||||
|
@ -59,6 +59,7 @@
|
||||
|
||||
#include <sstream>
|
||||
|
||||
using lyx::docstring;
|
||||
using lyx::cap::copySelection;
|
||||
using lyx::cap::grabAndEraseSelection;
|
||||
using lyx::cap::cutSelection;
|
||||
@ -424,8 +425,9 @@ void InsetMathNest::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
size_t n = 0;
|
||||
istringstream is(lyx::to_utf8(cmd.argument()));
|
||||
is >> n;
|
||||
string const selection = lyx::cap::getSelection(cur.buffer(), n);
|
||||
cur.niceInsert(selection);
|
||||
docstring const selection = lyx::cap::getSelection(cur.buffer(), n);
|
||||
// FIXME UNICODE
|
||||
cur.niceInsert(lyx::to_utf8(selection));
|
||||
cur.clearSelection(); // bug 393
|
||||
cur.bv().switchKeyMap();
|
||||
finishUndo();
|
||||
|
@ -26,6 +26,8 @@
|
||||
#include "outputparams.h"
|
||||
#include "sgml.h"
|
||||
|
||||
using lyx::docstring;
|
||||
|
||||
using std::string;
|
||||
using std::auto_ptr;
|
||||
using std::endl;
|
||||
@ -118,16 +120,16 @@ bool RefInset::getStatus(LCursor & cur, FuncRequest const & cmd,
|
||||
}
|
||||
|
||||
|
||||
string const RefInset::screenLabel() const
|
||||
docstring const RefInset::screenLabel() const
|
||||
{
|
||||
string str;
|
||||
docstring str;
|
||||
for (int i = 0; !types[i].latex_name.empty(); ++i)
|
||||
if (commandname() == types[i].latex_name) {
|
||||
// FIXME UNICODE
|
||||
str = lyx::to_utf8(_(types[i].short_gui_name));
|
||||
str = _(types[i].short_gui_name);
|
||||
break;
|
||||
}
|
||||
str += asString(cell(0));
|
||||
// FIXME UNICODE
|
||||
str += lyx::from_utf8(asString(cell(0)));
|
||||
|
||||
//if (/* !isLatex && */ !cell(0).empty()) {
|
||||
// str += "||";
|
||||
@ -146,9 +148,10 @@ void RefInset::validate(LaTeXFeatures & features) const
|
||||
}
|
||||
|
||||
|
||||
int RefInset::plaintext(std::ostream & os, OutputParams const &) const
|
||||
int RefInset::plaintext(lyx::odocstream & os, OutputParams const &) const
|
||||
{
|
||||
os << '[' << asString(cell(0)) << ']';
|
||||
// FIXME UNICODE
|
||||
os << '[' << lyx::from_utf8(asString(cell(0))) << ']';
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -28,14 +28,14 @@ public:
|
||||
///
|
||||
void infoize(std::ostream & os) const;
|
||||
///
|
||||
std::string const screenLabel() const;
|
||||
lyx::docstring const screenLabel() const;
|
||||
///
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
///
|
||||
virtual RefInset * asRefInset() { return this; }
|
||||
|
||||
/// plain ascii output
|
||||
int plaintext(std::ostream & os, OutputParams const &) const;
|
||||
/// plain text output in ucs4 encoding
|
||||
int plaintext(lyx::odocstream &, OutputParams const &) const;
|
||||
/// docbook output
|
||||
int docbook(Buffer const & buf, std::ostream & os, OutputParams const &) const;
|
||||
|
||||
|
@ -62,7 +62,7 @@ void TextPainter::draw(int x, int y, char c)
|
||||
}
|
||||
|
||||
|
||||
void TextPainter::show(std::ostream & os, int offset) const
|
||||
void TextPainter::show(lyx::odocstream & os, int offset) const
|
||||
{
|
||||
os << '\n';
|
||||
for (int j = 0; j <= ymax_; ++j) {
|
||||
|
@ -13,8 +13,9 @@
|
||||
#define TEXTPAINTER_H
|
||||
|
||||
|
||||
#include "support/docstream.h"
|
||||
|
||||
#include <vector>
|
||||
#include <iosfwd>
|
||||
|
||||
class TextPainter {
|
||||
public:
|
||||
@ -25,7 +26,7 @@ class TextPainter {
|
||||
///
|
||||
void draw(int x, int y, char c);
|
||||
///
|
||||
void show(std::ostream & os, int offset = 0) const;
|
||||
void show(lyx::odocstream & os, int offset = 0) const;
|
||||
///
|
||||
int textheight() const { return ymax_; }
|
||||
///
|
||||
|
22
src/output.C
22
src/output.C
@ -18,8 +18,7 @@
|
||||
|
||||
#include "support/filetools.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
using lyx::odocfstream;
|
||||
using lyx::support::bformat;
|
||||
using lyx::support::makeDisplayPath;
|
||||
|
||||
@ -28,7 +27,10 @@ using lyx::docstring;
|
||||
using std::ofstream;
|
||||
using std::string;
|
||||
|
||||
bool openFileWrite(ofstream & ofs, string const & fname)
|
||||
namespace {
|
||||
|
||||
template<typename OFStream>
|
||||
bool doOpenFileWrite(OFStream & ofs, string const & fname)
|
||||
{
|
||||
ofs.open(fname.c_str());
|
||||
if (!ofs) {
|
||||
@ -40,3 +42,17 @@ bool openFileWrite(ofstream & ofs, string const & fname)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool openFileWrite(ofstream & ofs, string const & fname)
|
||||
{
|
||||
return doOpenFileWrite(ofs, fname);
|
||||
}
|
||||
|
||||
|
||||
bool openFileWrite(odocfstream & ofs, string const & fname)
|
||||
{
|
||||
return doOpenFileWrite(ofs, fname);
|
||||
}
|
||||
|
@ -12,9 +12,9 @@
|
||||
#ifndef OUTPUT_H
|
||||
#define OUTPUT_H
|
||||
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
#include "support/docstream.h"
|
||||
|
||||
bool openFileWrite(std::ofstream & ofs, std::string const & fname);
|
||||
bool openFileWrite(lyx::odocfstream & ofs, std::string const & fname);
|
||||
|
||||
#endif
|
||||
|
@ -133,7 +133,8 @@ TeXEnvironment(Buffer const & buf,
|
||||
os << "{" << pit->params().labelWidthString() << "}\n";
|
||||
} else if (style->labeltype == LABEL_BIBLIO) {
|
||||
// ale970405
|
||||
os << "{" << bibitemWidest(buf) << "}\n";
|
||||
// FIXME UNICODE
|
||||
os << '{' << lyx::to_utf8(bibitemWidest(buf)) << "}\n";
|
||||
} else
|
||||
os << style->latexparam() << '\n';
|
||||
texrow.newline();
|
||||
|
@ -23,15 +23,13 @@
|
||||
#include "ParagraphParameters.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
#include "support/unicode.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
using lyx::support::ascii_lowercase;
|
||||
using lyx::support::compare_ascii_no_case;
|
||||
using lyx::support::compare_no_case;
|
||||
using lyx::support::contains;
|
||||
|
||||
using lyx::docstring;
|
||||
using lyx::pos_type;
|
||||
using std::endl;
|
||||
using std::ostream;
|
||||
@ -44,14 +42,14 @@ void writeFileAscii(Buffer const & buf,
|
||||
string const & fname,
|
||||
OutputParams const & runparams)
|
||||
{
|
||||
ofstream ofs;
|
||||
lyx::odocfstream ofs;
|
||||
if (!::openFileWrite(ofs, fname))
|
||||
return;
|
||||
writeFileAscii(buf, ofs, runparams);
|
||||
}
|
||||
|
||||
|
||||
void writeFileAscii(Buffer const & buf, ostream & os,
|
||||
void writeFileAscii(Buffer const & buf, lyx::odocstream & os,
|
||||
OutputParams const & runparams)
|
||||
{
|
||||
bool ref_printed = false;
|
||||
@ -68,12 +66,12 @@ void writeFileAscii(Buffer const & buf, ostream & os,
|
||||
|
||||
namespace {
|
||||
|
||||
pair<int, string> const addDepth(int depth, int ldepth)
|
||||
pair<int, docstring> const addDepth(int depth, int ldepth)
|
||||
{
|
||||
int d = depth * 2;
|
||||
if (ldepth > depth)
|
||||
d += (ldepth - depth) * 2;
|
||||
return make_pair(d, string(d, ' '));
|
||||
return make_pair(d, docstring(d, ' '));
|
||||
}
|
||||
|
||||
}
|
||||
@ -81,7 +79,7 @@ pair<int, string> const addDepth(int depth, int ldepth)
|
||||
|
||||
void asciiParagraph(Buffer const & buf,
|
||||
Paragraph const & par,
|
||||
ostream & os,
|
||||
lyx::odocstream & os,
|
||||
OutputParams const & runparams,
|
||||
bool & ref_printed)
|
||||
{
|
||||
@ -136,7 +134,7 @@ void asciiParagraph(Buffer const & buf,
|
||||
if (runparams.linelen > 0)
|
||||
os << "\n\n";
|
||||
|
||||
os << string(depth * 2, ' ');
|
||||
os << docstring(depth * 2, ' ');
|
||||
currlinelen += depth * 2;
|
||||
|
||||
//--
|
||||
@ -152,10 +150,10 @@ void asciiParagraph(Buffer const & buf,
|
||||
|
||||
case 6: // Abstract
|
||||
if (runparams.linelen > 0) {
|
||||
os << lyx::to_utf8(_("Abstract")) << "\n\n";
|
||||
os << _("Abstract") << "\n\n";
|
||||
currlinelen = 0;
|
||||
} else {
|
||||
string const abst = lyx::to_utf8(_("Abstract: "));
|
||||
docstring const abst = _("Abstract: ");
|
||||
os << abst;
|
||||
currlinelen += abst.length();
|
||||
}
|
||||
@ -164,10 +162,10 @@ void asciiParagraph(Buffer const & buf,
|
||||
case 7: // Bibliography
|
||||
if (!ref_printed) {
|
||||
if (runparams.linelen > 0) {
|
||||
os << lyx::to_utf8(_("References")) << "\n\n";
|
||||
os << _("References") << "\n\n";
|
||||
currlinelen = 0;
|
||||
} else {
|
||||
string const refs = lyx::to_utf8(_("References: "));
|
||||
docstring const refs = _("References: ");
|
||||
os << refs;
|
||||
currlinelen += refs.length();
|
||||
}
|
||||
@ -176,7 +174,9 @@ void asciiParagraph(Buffer const & buf,
|
||||
break;
|
||||
|
||||
default: {
|
||||
string const label = par.params().labelString();
|
||||
// FIXME UNICODE
|
||||
docstring const label =
|
||||
lyx::from_utf8(par.params().labelString());
|
||||
os << label << ' ';
|
||||
currlinelen += label.length() + 1;
|
||||
break;
|
||||
@ -185,7 +185,7 @@ void asciiParagraph(Buffer const & buf,
|
||||
}
|
||||
|
||||
if (!currlinelen) {
|
||||
pair<int, string> p = addDepth(depth, ltype_depth);
|
||||
pair<int, docstring> p = addDepth(depth, ltype_depth);
|
||||
os << p.second;
|
||||
currlinelen += p.first;
|
||||
}
|
||||
@ -194,7 +194,7 @@ void asciiParagraph(Buffer const & buf,
|
||||
// intelligent hopefully! (only in the case where we have a
|
||||
// max runparams.linelength!) (Jug)
|
||||
|
||||
string word;
|
||||
docstring word;
|
||||
|
||||
for (pos_type i = 0; i < par.size(); ++i) {
|
||||
lyx::char_type c = par.getUChar(buf.params(), i);
|
||||
@ -218,8 +218,8 @@ void asciiParagraph(Buffer const & buf,
|
||||
case ' ':
|
||||
if (runparams.linelen > 0 &&
|
||||
currlinelen + word.length() > runparams.linelen - 10) {
|
||||
os << "\n";
|
||||
pair<int, string> p = addDepth(depth, ltype_depth);
|
||||
os << '\n';
|
||||
pair<int, docstring> p = addDepth(depth, ltype_depth);
|
||||
os << p.second;
|
||||
currlinelen = p.first;
|
||||
}
|
||||
@ -233,20 +233,18 @@ void asciiParagraph(Buffer const & buf,
|
||||
"writeAsciiFile: NULL char in structure." << endl;
|
||||
break;
|
||||
|
||||
default: {
|
||||
std::vector<char> const tmp = ucs4_to_utf8(c);
|
||||
word.append(tmp.begin(), tmp.end());
|
||||
default:
|
||||
word += c;
|
||||
if (runparams.linelen > 0 &&
|
||||
currlinelen + word.length() > runparams.linelen)
|
||||
{
|
||||
os << "\n";
|
||||
pair<int, string> p = addDepth(depth, ltype_depth);
|
||||
os << '\n';
|
||||
pair<int, docstring> p = addDepth(depth, ltype_depth);
|
||||
os << p.second;
|
||||
currlinelen = p.first;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
os << word;
|
||||
}
|
||||
|
@ -12,8 +12,7 @@
|
||||
#ifndef OUTPUT_PLAINTEXT_H
|
||||
#define OUTPUT_PLAINTEXT_H
|
||||
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
#include "support/docstream.h"
|
||||
|
||||
class Buffer;
|
||||
class OutputParams;
|
||||
@ -25,12 +24,12 @@ void writeFileAscii(Buffer const & buf, std::string const &,
|
||||
OutputParams const &);
|
||||
|
||||
///
|
||||
void writeFileAscii(Buffer const & buf, std::ostream &, OutputParams const &);
|
||||
void writeFileAscii(Buffer const & buf, lyx::odocstream &, OutputParams const &);
|
||||
|
||||
///
|
||||
void asciiParagraph(Buffer const & buf,
|
||||
Paragraph const & paragraphs,
|
||||
std::ostream & ofs,
|
||||
lyx::odocstream & ofs,
|
||||
OutputParams const &,
|
||||
bool & ref_printed);
|
||||
|
||||
|
@ -54,6 +54,7 @@
|
||||
#include <stack>
|
||||
#include <sstream>
|
||||
|
||||
using lyx::docstring;
|
||||
using lyx::pos_type;
|
||||
using lyx::char_type;
|
||||
|
||||
@ -1338,14 +1339,14 @@ bool Paragraph::isMultiLingual(BufferParams const & bparams) const
|
||||
|
||||
// Convert the paragraph to a string.
|
||||
// Used for building the table of contents
|
||||
string const Paragraph::asString(Buffer const & buffer, bool label) const
|
||||
docstring const Paragraph::asString(Buffer const & buffer, bool label) const
|
||||
{
|
||||
OutputParams runparams;
|
||||
return asString(buffer, runparams, label);
|
||||
}
|
||||
|
||||
|
||||
string const Paragraph::asString(Buffer const & buffer,
|
||||
docstring const Paragraph::asString(Buffer const & buffer,
|
||||
OutputParams const & runparams,
|
||||
bool label) const
|
||||
{
|
||||
@ -1369,13 +1370,13 @@ string const Paragraph::asString(Buffer const & buffer,
|
||||
return s;
|
||||
#else
|
||||
// This should really be done by the caller and not here.
|
||||
string ret = asString(buffer, runparams, 0, size(), label);
|
||||
docstring ret = asString(buffer, runparams, 0, size(), label);
|
||||
return subst(ret, '\n', ' ');
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
string const Paragraph::asString(Buffer const & buffer,
|
||||
docstring const Paragraph::asString(Buffer const & buffer,
|
||||
pos_type beg, pos_type end, bool label) const
|
||||
{
|
||||
|
||||
@ -1384,19 +1385,21 @@ string const Paragraph::asString(Buffer const & buffer,
|
||||
}
|
||||
|
||||
|
||||
string const Paragraph::asString(Buffer const & buffer,
|
||||
docstring const Paragraph::asString(Buffer const & buffer,
|
||||
OutputParams const & runparams,
|
||||
pos_type beg, pos_type end, bool label) const
|
||||
{
|
||||
ostringstream os;
|
||||
lyx::odocstringstream os;
|
||||
|
||||
if (beg == 0 && label && !params().labelString().empty())
|
||||
os << params().labelString() << ' ';
|
||||
// FIXME UNICODE
|
||||
os << lyx::from_utf8(params().labelString()) << ' ';
|
||||
|
||||
for (pos_type i = beg; i < end; ++i) {
|
||||
value_type const c = getUChar(buffer.params(), i);
|
||||
// FIXME: isPrintable does not work for lyx::char_type
|
||||
if (isPrintable(c))
|
||||
os << c;
|
||||
os.put(c);
|
||||
else if (c == META_INSET)
|
||||
getInset(i)->textString(buffer, os, runparams);
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user