mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
Create ParagraphParameters::write() and use it
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6462 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
bfb9c3955f
commit
c070ede805
@ -1,3 +1,10 @@
|
||||
2003-03-12 John Levon <levon@movementarian.org>
|
||||
|
||||
* paragraph.C:
|
||||
* ParagraphParameters.h:
|
||||
* ParagraphParameters.C: move output code to a
|
||||
::write() method
|
||||
|
||||
2003-03-12 John Levon <levon@movementarian.org>
|
||||
|
||||
* BufferView.C (insertLyXFile):
|
||||
|
@ -2,6 +2,12 @@
|
||||
|
||||
#include "ParagraphParameters.h"
|
||||
#include "ParameterStruct.h"
|
||||
#include "tex-strings.h"
|
||||
#include "lyxlex.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using std::ostream;
|
||||
|
||||
// Initialize static member var.
|
||||
ShareContainer<ParameterStruct> ParagraphParameters::container;
|
||||
@ -246,7 +252,6 @@ void ParagraphParameters::labelWidthString(string const & lws)
|
||||
}
|
||||
|
||||
|
||||
|
||||
LyXLength const & ParagraphParameters::leftIndent() const
|
||||
{
|
||||
return param->leftindent;
|
||||
@ -259,3 +264,65 @@ void ParagraphParameters::leftIndent(LyXLength const & li)
|
||||
tmp.leftindent = li;
|
||||
set_from_struct(tmp);
|
||||
}
|
||||
|
||||
|
||||
void ParagraphParameters::read(LyXLex & lex)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void ParagraphParameters::write(ostream & os) const
|
||||
{
|
||||
// Maybe some vertical spaces.
|
||||
if (spaceTop().kind() != VSpace::NONE)
|
||||
os << "\\added_space_top "
|
||||
<< spaceTop().asLyXCommand() << ' ';
|
||||
if (spaceBottom().kind() != VSpace::NONE)
|
||||
os << "\\added_space_bottom "
|
||||
<< spaceBottom().asLyXCommand() << ' ';
|
||||
|
||||
// Maybe the paragraph has special spacing
|
||||
spacing().writeFile(os, true);
|
||||
|
||||
// The labelwidth string used in lists.
|
||||
if (!labelWidthString().empty())
|
||||
os << "\\labelwidthstring "
|
||||
<< labelWidthString() << '\n';
|
||||
|
||||
// Lines above or below?
|
||||
if (lineTop())
|
||||
os << "\\line_top ";
|
||||
if (lineBottom())
|
||||
os << "\\line_bottom ";
|
||||
|
||||
// Pagebreaks above or below?
|
||||
if (pagebreakTop())
|
||||
os << "\\pagebreak_top ";
|
||||
if (pagebreakBottom())
|
||||
os << "\\pagebreak_bottom ";
|
||||
|
||||
// Start of appendix?
|
||||
if (startOfAppendix())
|
||||
os << "\\start_of_appendix ";
|
||||
|
||||
// Noindent?
|
||||
if (noindent())
|
||||
os << "\\noindent ";
|
||||
|
||||
// Do we have a manual left indent?
|
||||
if (!leftIndent().zero())
|
||||
os << "\\leftindent " << leftIndent().asString()
|
||||
<< ' ';
|
||||
|
||||
// Alignment?
|
||||
if (align() != LYX_ALIGN_LAYOUT) {
|
||||
int h = 0;
|
||||
switch (align()) {
|
||||
case LYX_ALIGN_LEFT: h = 1; break;
|
||||
case LYX_ALIGN_RIGHT: h = 2; break;
|
||||
case LYX_ALIGN_CENTER: h = 3; break;
|
||||
default: h = 0; break;
|
||||
}
|
||||
os << "\\align " << string_align[h] << ' ';
|
||||
}
|
||||
}
|
||||
|
@ -9,8 +9,11 @@
|
||||
|
||||
#include "ParameterStruct.h"
|
||||
|
||||
#include <iosfwd>
|
||||
|
||||
class VSpace;
|
||||
class Spacing;
|
||||
class LyXLex;
|
||||
|
||||
|
||||
///
|
||||
@ -84,6 +87,13 @@ public:
|
||||
LyXLength const & leftIndent() const;
|
||||
///
|
||||
void leftIndent(LyXLength const &);
|
||||
|
||||
/// read the parameters from a lex
|
||||
void read(LyXLex & lex);
|
||||
|
||||
/// write out the parameters to a stream
|
||||
void write(std::ostream & os) const;
|
||||
|
||||
private:
|
||||
///
|
||||
void set_from_struct(ParameterStruct const &);
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "lyxrc.h"
|
||||
#include "layout.h"
|
||||
#include "language.h"
|
||||
#include "tex-strings.h"
|
||||
#include "buffer.h"
|
||||
#include "bufferparams.h"
|
||||
#include "debug.h"
|
||||
@ -165,58 +164,7 @@ void Paragraph::write(Buffer const * buf, ostream & os,
|
||||
// First write the layout
|
||||
os << "\n\\layout " << layout()->name() << '\n';
|
||||
|
||||
// Maybe some vertical spaces.
|
||||
if (params().spaceTop().kind() != VSpace::NONE)
|
||||
os << "\\added_space_top "
|
||||
<< params().spaceTop().asLyXCommand() << ' ';
|
||||
if (params().spaceBottom().kind() != VSpace::NONE)
|
||||
os << "\\added_space_bottom "
|
||||
<< params().spaceBottom().asLyXCommand() << ' ';
|
||||
|
||||
// Maybe the paragraph has special spacing
|
||||
params().spacing().writeFile(os, true);
|
||||
|
||||
// The labelwidth string used in lists.
|
||||
if (!params().labelWidthString().empty())
|
||||
os << "\\labelwidthstring "
|
||||
<< params().labelWidthString() << '\n';
|
||||
|
||||
// Lines above or below?
|
||||
if (params().lineTop())
|
||||
os << "\\line_top ";
|
||||
if (params().lineBottom())
|
||||
os << "\\line_bottom ";
|
||||
|
||||
// Pagebreaks above or below?
|
||||
if (params().pagebreakTop())
|
||||
os << "\\pagebreak_top ";
|
||||
if (params().pagebreakBottom())
|
||||
os << "\\pagebreak_bottom ";
|
||||
|
||||
// Start of appendix?
|
||||
if (params().startOfAppendix())
|
||||
os << "\\start_of_appendix ";
|
||||
|
||||
// Noindent?
|
||||
if (params().noindent())
|
||||
os << "\\noindent ";
|
||||
|
||||
// Do we have a manual left indent?
|
||||
if (!params().leftIndent().zero())
|
||||
os << "\\leftindent " << params().leftIndent().asString()
|
||||
<< ' ';
|
||||
|
||||
// Alignment?
|
||||
if (params().align() != LYX_ALIGN_LAYOUT) {
|
||||
int h = 0;
|
||||
switch (params().align()) {
|
||||
case LYX_ALIGN_LEFT: h = 1; break;
|
||||
case LYX_ALIGN_RIGHT: h = 2; break;
|
||||
case LYX_ALIGN_CENTER: h = 3; break;
|
||||
default: h = 0; break;
|
||||
}
|
||||
os << "\\align " << string_align[h] << ' ';
|
||||
}
|
||||
params().write(os);
|
||||
|
||||
LyXFont font1(LyXFont::ALL_INHERIT, bparams.language);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user