add support for tables and figures (linuxdoc).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7371 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
José Matox 2003-07-26 21:53:54 +00:00
parent 00a58355dd
commit 6a2f81278d
12 changed files with 147 additions and 9 deletions

View File

@ -1,3 +1,7 @@
2003-07-27 José Matos <jamatos@fep.up.pt>
* layouts/linuxdoc.layout: add support for tables and figures (linuxdoc).
2003-07-22 John Levon <levon@movementarian.org> 2003-07-22 John Levon <levon@movementarian.org>
* ui/stdmenu.ui: fix up mnemonics to not clash, standardise * ui/stdmenu.ui: fix up mnemonics to not clash, standardise

View File

@ -12,6 +12,7 @@ OutputType linuxdoc
DefaultStyle Standard DefaultStyle Standard
Input stdcounters.inc Input stdcounters.inc
Input stdfloats.inc
# Standard style definition # Standard style definition
Style Standard Style Standard
@ -383,3 +384,24 @@ Style SGML
FreeSpacing 1 FreeSpacing 1
PassThru 1 PassThru 1
End End
# Caption style definition
Style Caption
Margin First_Dynamic
LatexType Paragraph
LatexName caption
NeedProtect 1
LabelSep xx
ParSkip 0.4
TopSep 0.5
Align Center
AlignPossible Center
LabelType Sensitive
LabelString Caption
OptionalArgs 1
# label font definition
LabelFont
Series Bold
EndFont
End

View File

@ -1,3 +1,7 @@
2003-07-27 José Matos <jamatos@fep.up.pt>
* tabular.[Ch] (linuxdoc): add support for tables and figures (linuxdoc).
2003-07-27 José Matos <jamatos@fep.up.pt> 2003-07-27 José Matos <jamatos@fep.up.pt>
* buffer.[Ch] (makeLaTeXFile): changed name of arguments for * buffer.[Ch] (makeLaTeXFile): changed name of arguments for

View File

@ -1,3 +1,10 @@
2003-07-27 José Matos <jamatos@fep.up.pt>
* insetfloat.[Ch] (linuxdoc):
* insetgraphics.C (linuxdoc):
* insettabular.C (linuxdoc):
* insettext.[Ch] (linuxdoc): add support for tables and figures (linuxdoc).
2003-07-27 José Matos <jamatos@fep.up.pt> 2003-07-27 José Matos <jamatos@fep.up.pt>
* insetinclude (latex): comply with makeLaTeXFile argument change. * insetinclude (latex): comply with makeLaTeXFile argument change.

View File

@ -316,6 +316,43 @@ int InsetFloat::latex(Buffer const * buf, ostream & os,
} }
int InsetFloat::linuxdoc(Buffer const * buf, ostream & os) const
{
FloatList const & floats = buf->params.getLyXTextClass().floats();
string const tmptype = params_.type;
// Figure out the float placement to use.
// From lowest to highest:
// - float default placement
// - document wide default placement
// - specific float placement
// This is the same as latex, as linuxdoc is modeled after latex.
string placement;
string const buf_placement = buf->params.float_placement;
string const def_placement = floats.defaultPlacement(params_.type);
if (!params_.placement.empty()
&& params_.placement != def_placement) {
placement = params_.placement;
} else if (params_.placement.empty()
&& !buf_placement.empty()
&& buf_placement != def_placement) {
placement = buf_placement;
}
os << "\n<" << tmptype ;
// We only output placement if different from the def_placement.
if (!placement.empty()) {
os << " loc=\"" << placement << '"';
}
os << ">";
int const i = inset.linuxdoc(buf, os);
os << "</" << tmptype << ">\n";
return i;
}
int InsetFloat::docbook(Buffer const * buf, ostream & os, bool mixcont) const int InsetFloat::docbook(Buffer const * buf, ostream & os, bool mixcont) const
{ {
os << '<' << params_.type << '>'; os << '<' << params_.type << '>';

View File

@ -60,6 +60,8 @@ public:
int latex(Buffer const *, std::ostream &, int latex(Buffer const *, std::ostream &,
LatexRunParams const &) const; LatexRunParams const &) const;
/// ///
int linuxdoc(Buffer const *, std::ostream &) const;
///
int docbook(Buffer const *, std::ostream &, bool mixcont) const; int docbook(Buffer const *, std::ostream &, bool mixcont) const;
/// ///
string const editMessage() const; string const editMessage() const;

View File

@ -550,9 +550,14 @@ int InsetGraphics::ascii(Buffer const *, ostream & os, int) const
} }
int InsetGraphics::linuxdoc(Buffer const *, ostream &) const int InsetGraphics::linuxdoc(Buffer const * buf, ostream & os) const
{ {
// No graphics in LinuxDoc output. Should check how/what to add. string const file_name = buf->niceFile ?
params().filename.relFilename(buf->filePath()):
params().filename.absFilename();
os << "<eps file=\"" << file_name << "\">\n";
os << "<img src=\"" << file_name << "\">";
return 0; return 0;
} }

View File

@ -1179,12 +1179,7 @@ int InsetTabular::ascii(Buffer const * buf, ostream & os, int ll) const
int InsetTabular::linuxdoc(Buffer const * buf, ostream & os) const int InsetTabular::linuxdoc(Buffer const * buf, ostream & os) const
{ {
os << "<![CDATA["; return tabular.linuxdoc(buf,os);
int const ret = tabular.ascii(buf,os,
(int)parOwner()->params().depth(),
false, 0);
os << "]]>";
return ret;
} }

View File

@ -1312,6 +1312,25 @@ int InsetText::ascii(Buffer const * buf, ostream & os, int linelen) const
return lines; return lines;
} }
int InsetText::linuxdoc(Buffer const * buf, ostream & os) const
{
ParagraphList::iterator pit = const_cast<ParagraphList&>(paragraphs).begin();
ParagraphList::iterator pend = const_cast<ParagraphList&>(paragraphs).end();
// There is a confusion between the empty paragraph and the default paragraph
// The default paragraph is <p></p>, the empty paragraph is *empty*
// Since none of the floats of linuxdoc accepts standard paragraphs
// I disable them. I don't expect problems. (jamatos 2003/07/27)
for (; pit != pend; ++pit) {
const string name = pit->layout()->latexname();
if (name != "p")
sgml::openTag(os, 1, 0, name);
buf->simpleLinuxDocOnePar(os, pit, 0);
if (name != "p")
sgml::closeTag(os, 1, 0, name);
}
return 0;
}
int InsetText::docbook(Buffer const * buf, ostream & os, bool mixcont) const int InsetText::docbook(Buffer const * buf, ostream & os, bool mixcont) const
{ {

View File

@ -114,7 +114,7 @@ public:
/// ///
int ascii(Buffer const *, std::ostream &, int linelen) const; int ascii(Buffer const *, std::ostream &, int linelen) const;
/// ///
int linuxdoc(Buffer const *, std::ostream &) const { return 0; } int linuxdoc(Buffer const *, std::ostream &) const ;
/// ///
int docbook(Buffer const *, std::ostream &, bool mixcont) const ; int docbook(Buffer const *, std::ostream &, bool mixcont) const ;
/// ///

View File

@ -2201,6 +2201,47 @@ int LyXTabular::latex(Buffer const * buf, ostream & os,
} }
int LyXTabular::linuxdoc(Buffer const * buf, ostream & os) const
{
os << "<tabular ca=\"";
for (int i = 0; i < columns_; ++i) {
switch (column_info[i].alignment) {
case LYX_ALIGN_LEFT:
os << 'l';
break;
case LYX_ALIGN_RIGHT:
os << 'r';
break;
default:
os << 'c';
break;
}
}
os << "\">\n";
int cell = 0;
int ret = 0;
for (int i = 0; i < rows_; ++i) {
for (int j = 0; j < columns_; ++j) {
if (isPartOfMultiColumn(i, j))
continue;
InsetText & inset = getCellInset(cell);
ret += inset.linuxdoc(buf, os);
if (isLastCellInRow(cell)) {
os << "@\n";
++ret;
} else {
os << "|";
}
++cell;
}
}
os << "</tabular>\n";
return ret;
}
int LyXTabular::docbookRow(Buffer const * buf, ostream & os, int row) const int LyXTabular::docbookRow(Buffer const * buf, ostream & os, int row) const
{ {
int ret = 0; int ret = 0;

View File

@ -280,6 +280,8 @@ public:
/// ///
int latex(Buffer const *, std::ostream &, int latex(Buffer const *, std::ostream &,
LatexRunParams const &) const; LatexRunParams const &) const;
//
int linuxdoc(Buffer const * buf, std::ostream & os) const;
/// ///
int docbook(Buffer const * buf, std::ostream & os, bool mixcont) const; int docbook(Buffer const * buf, std::ostream & os, bool mixcont) const;
/// ///