2001-03-06 14:07:14 +00:00
|
|
|
|
// -*- C++ -*-
|
2003-08-23 00:17:00 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file ParagraphParameters.h
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
* \author Angus Leeming
|
|
|
|
|
* \author John Levon
|
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
2001-03-06 14:07:14 +00:00
|
|
|
|
|
|
|
|
|
#ifndef PARAGRAPHPARAMETERS_H
|
|
|
|
|
#define PARAGRAPHPARAMETERS_H
|
|
|
|
|
|
2007-09-29 20:02:32 +00:00
|
|
|
|
#include "LayoutEnums.h"
|
2007-04-28 12:58:49 +00:00
|
|
|
|
#include "Length.h"
|
2004-03-25 09:16:36 +00:00
|
|
|
|
#include "Spacing.h"
|
2001-08-03 18:28:11 +00:00
|
|
|
|
|
2003-09-06 20:32:37 +00:00
|
|
|
|
#include "support/types.h"
|
2006-10-20 19:26:23 +00:00
|
|
|
|
#include "support/docstring.h"
|
2001-03-06 14:07:14 +00:00
|
|
|
|
|
2003-03-12 06:53:49 +00:00
|
|
|
|
#include <iosfwd>
|
2003-10-07 06:45:25 +00:00
|
|
|
|
#include <string>
|
2003-03-12 06:53:49 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
|
2003-09-06 20:32:37 +00:00
|
|
|
|
class BufferView;
|
2007-09-29 20:02:32 +00:00
|
|
|
|
class Layout;
|
2007-04-28 12:58:49 +00:00
|
|
|
|
class Length;
|
2007-04-26 11:30:54 +00:00
|
|
|
|
class Lexer;
|
2003-03-13 13:56:25 +00:00
|
|
|
|
class Paragraph;
|
2003-09-06 20:32:37 +00:00
|
|
|
|
class Spacing;
|
2001-03-06 14:07:14 +00:00
|
|
|
|
|
2004-02-13 11:05:29 +00:00
|
|
|
|
|
2001-03-06 14:07:14 +00:00
|
|
|
|
///
|
|
|
|
|
class ParagraphParameters {
|
|
|
|
|
public:
|
|
|
|
|
///
|
|
|
|
|
ParagraphParameters();
|
|
|
|
|
///
|
|
|
|
|
void clear();
|
|
|
|
|
///
|
|
|
|
|
bool sameLayout(ParagraphParameters const &) const;
|
|
|
|
|
///
|
|
|
|
|
Spacing const & spacing() const;
|
|
|
|
|
///
|
|
|
|
|
void spacing(Spacing const &);
|
|
|
|
|
///
|
|
|
|
|
bool noindent() const;
|
|
|
|
|
///
|
|
|
|
|
void noindent(bool);
|
|
|
|
|
///
|
|
|
|
|
LyXAlignment align() const;
|
|
|
|
|
///
|
|
|
|
|
void align(LyXAlignment);
|
|
|
|
|
///
|
2001-06-25 00:06:33 +00:00
|
|
|
|
depth_type depth() const;
|
|
|
|
|
///
|
|
|
|
|
void depth(depth_type);
|
2001-03-06 14:07:14 +00:00
|
|
|
|
///
|
|
|
|
|
bool startOfAppendix() const;
|
|
|
|
|
///
|
|
|
|
|
void startOfAppendix(bool);
|
|
|
|
|
///
|
|
|
|
|
bool appendix() const;
|
|
|
|
|
///
|
|
|
|
|
void appendix(bool);
|
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
|
docstring const & labelString() const;
|
2001-03-06 14:07:14 +00:00
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
|
void labelString(docstring const &);
|
2001-03-06 14:07:14 +00:00
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
|
docstring const & labelWidthString() const;
|
2001-03-06 14:07:14 +00:00
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
|
void labelWidthString(docstring const &);
|
2002-05-08 12:58:16 +00:00
|
|
|
|
///
|
2007-04-28 12:58:49 +00:00
|
|
|
|
Length const & leftIndent() const;
|
2002-05-08 12:58:16 +00:00
|
|
|
|
///
|
2007-04-28 12:58:49 +00:00
|
|
|
|
void leftIndent(Length const &);
|
2003-03-12 06:53:49 +00:00
|
|
|
|
|
Add LFUN_PARAGRAPH_PARAMS (= paragraph-params), used for changing a paragraph's alignment, spacing, etc. This is complementary to LFUN_PARAGRAPH_PARAMS_APPLY, which sets the parameters. The difference is that APPLY over-rides all existing parameters, setting any not given to the default, whereas this one simply changes those that are given. So
paragraph-params \align right
will align the paragraph right, leaving spacing, etc, as they were, whereas
paragraph-params-apply \align right
will align the paragraph right but also reset all other parameters to defaults. Note, by the way, that this means that
paragraph-params-apply
sets everything to default.
Some new arguments have also been introduced. These are:
\indent
\indent-toggle
\spacing default
Of course, none of these are found in valid LyX files, but they are useful in menu bindings, etc.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19581 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-15 02:21:09 +00:00
|
|
|
|
/// read the parameters from a string
|
|
|
|
|
void read (std::string str, bool merge = true);
|
|
|
|
|
|
2003-03-12 06:53:49 +00:00
|
|
|
|
/// read the parameters from a lex
|
Add LFUN_PARAGRAPH_PARAMS (= paragraph-params), used for changing a paragraph's alignment, spacing, etc. This is complementary to LFUN_PARAGRAPH_PARAMS_APPLY, which sets the parameters. The difference is that APPLY over-rides all existing parameters, setting any not given to the default, whereas this one simply changes those that are given. So
paragraph-params \align right
will align the paragraph right, leaving spacing, etc, as they were, whereas
paragraph-params-apply \align right
will align the paragraph right but also reset all other parameters to defaults. Note, by the way, that this means that
paragraph-params-apply
sets everything to default.
Some new arguments have also been introduced. These are:
\indent
\indent-toggle
\spacing default
Of course, none of these are found in valid LyX files, but they are useful in menu bindings, etc.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19581 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-15 02:21:09 +00:00
|
|
|
|
void read(Lexer & lex, bool merge = true);
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
void apply(ParagraphParameters const & params, Layout const & layout);
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
bool canApply(ParagraphParameters const & params, Layout const & layout);
|
2003-03-12 06:53:49 +00:00
|
|
|
|
|
|
|
|
|
/// write out the parameters to a stream
|
|
|
|
|
void write(std::ostream & os) const;
|
|
|
|
|
|
2004-03-25 09:16:36 +00:00
|
|
|
|
//friend bool operator==(ParameterStruct const & ps1,
|
|
|
|
|
//ParameterStruct const & ps2);
|
|
|
|
|
|
2001-03-06 14:07:14 +00:00
|
|
|
|
private:
|
|
|
|
|
///
|
2004-03-25 09:16:36 +00:00
|
|
|
|
Spacing spacing_;
|
|
|
|
|
///
|
|
|
|
|
bool noindent_;
|
|
|
|
|
///
|
|
|
|
|
bool start_of_appendix_;
|
|
|
|
|
///
|
|
|
|
|
bool appendix_;
|
2001-03-06 14:07:14 +00:00
|
|
|
|
///
|
2004-03-25 09:16:36 +00:00
|
|
|
|
LyXAlignment align_;
|
2001-03-06 14:07:14 +00:00
|
|
|
|
///
|
2004-03-25 09:16:36 +00:00
|
|
|
|
depth_type depth_;
|
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
|
docstring labelstring_;
|
2004-03-25 09:16:36 +00:00
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
|
docstring labelwidthstring_;
|
2004-03-25 09:16:36 +00:00
|
|
|
|
///
|
2007-04-28 12:58:49 +00:00
|
|
|
|
Length leftindent_;
|
2001-03-06 14:07:14 +00:00
|
|
|
|
};
|
2001-04-17 15:15:59 +00:00
|
|
|
|
|
|
|
|
|
|
2004-03-25 09:16:36 +00:00
|
|
|
|
|
2003-03-13 13:56:25 +00:00
|
|
|
|
/** Generate a string \param data from \param par's ParagraphParameters.
|
|
|
|
|
The function also generates some additional info needed by the
|
|
|
|
|
Paragraph dialog.
|
|
|
|
|
*/
|
2003-10-06 15:43:21 +00:00
|
|
|
|
void params2string(Paragraph const & par, std::string & data);
|
2003-03-13 13:56:25 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
2001-03-06 14:07:14 +00:00
|
|
|
|
#endif
|