]> git.lyx.org Git - lyx.git/commitdiff
add support for tables and figures (linuxdoc).
authorJosé Matox <jamatos@lyx.org>
Sat, 26 Jul 2003 21:53:54 +0000 (21:53 +0000)
committerJosé Matox <jamatos@lyx.org>
Sat, 26 Jul 2003 21:53:54 +0000 (21:53 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7371 a592a061-630c-0410-9148-cb99ea01b6c8

12 files changed:
lib/ChangeLog
lib/layouts/linuxdoc.layout
src/ChangeLog
src/insets/ChangeLog
src/insets/insetfloat.C
src/insets/insetfloat.h
src/insets/insetgraphics.C
src/insets/insettabular.C
src/insets/insettext.C
src/insets/insettext.h
src/tabular.C
src/tabular.h

index b7557aa57b1bcc80b1a4f37a19aa7a54ea4d4620..ac5d602982c0ccd5b4be0a82a54994fb8cfb6438 100644 (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>
 
        * ui/stdmenu.ui: fix up mnemonics to not clash, standardise
index 9112be9382aca78803c4865f2d6266346fc701aa..e5a1c3c876f0fbcbe9defe34e7245f9e36a5da62 100644 (file)
@@ -12,6 +12,7 @@ OutputType              linuxdoc
 DefaultStyle            Standard
 
 Input stdcounters.inc
+Input stdfloats.inc
 
 # Standard style definition
 Style Standard
@@ -383,3 +384,24 @@ Style SGML
        FreeSpacing           1
        PassThru              1
 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
index 28a046a5852515ac6636705cbede134dfaaa7e2d..49ef22ee51f70a9f7620e9842b11c4e0f225d3ae 100644 (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>
 
        * buffer.[Ch] (makeLaTeXFile): changed name of arguments for
index d15514656227cea8e807873a78183987c7545cfd..9355d078a9817e33bf1c97d6ed02aa1d5f09ac24 100644 (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>
 
        * insetinclude (latex): comply with makeLaTeXFile argument change.
index c482c46df393201be274eab1611272a69ea09b10..31c34d926b5099c739fdd557d65abc02f7a0bb1d 100644 (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
 {
        os << '<' << params_.type << '>';
index 3485672a7db5cff75a6da1af9126d0813dca7a83..36c63c2c1aeb9a8e8e35903579d36e3da3394b42 100644 (file)
@@ -60,6 +60,8 @@ public:
        int latex(Buffer const *, std::ostream &,
                  LatexRunParams const &) const;
        ///
+       int linuxdoc(Buffer const *, std::ostream &) const;
+       ///
        int docbook(Buffer const *, std::ostream &, bool mixcont) const;
        ///
        string const editMessage() const;
index dcf759e98293ef54079db6e85f45fce3827eb864..afdaa35a9e14e9e0a9345b7f94127bf1bc9d4437 100644 (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;
 }
 
index af8799e15f1a7a7c544759df9a6c8d691bec1276..b78885e2b049c900ec1ae23a37568d1904c37ceb 100644 (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
 {
-       os << "<![CDATA[";
-       int const ret = tabular.ascii(buf,os,
-                                      (int)parOwner()->params().depth(),
-                                      false, 0);
-       os << "]]>";
-       return ret;
+       return tabular.linuxdoc(buf,os);
 }
 
 
index bc94cbd49864e70232f6b8670bf8820a51332560..deff133a0b822aa397e94e1d74003118440824d6 100644 (file)
@@ -1312,6 +1312,25 @@ int InsetText::ascii(Buffer const * buf, ostream & os, int linelen) const
        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
 {
index 9554f88b514f1315af54736be730bb13fb52014b..6716217082f3e6df560430b9ef8ea24528b1195c 100644 (file)
@@ -114,7 +114,7 @@ public:
        ///
        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 ;
        ///
index 263b9ac22f64e0f6a9dab0f2d1d8f0373e8aa0a4..19804ffc790891b1d90c2a0bf74258dc339fb271 100644 (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 ret = 0;
index 45fcf0804f1b6a1ebfeaedf2d889a34f9a485702..2486a71e2ddeb2b10f5f11534860d952f6858ac2 100644 (file)
@@ -280,6 +280,8 @@ public:
        ///
        int latex(Buffer const *, std::ostream &,
                  LatexRunParams const &) const;
+       //
+       int linuxdoc(Buffer const * buf, std::ostream & os) const;
        ///
        int docbook(Buffer const * buf, std::ostream & os, bool mixcont) const;
        ///