Introducing TextClassPtr.h to minimize header dependencies.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21506 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-11-07 23:25:08 +00:00
parent a4d2ae771a
commit cdf1378200
40 changed files with 92 additions and 39 deletions

View File

@ -195,13 +195,13 @@ PaperOrientationTranslator const & paperorientationtranslator()
// Page sides
typedef Translator<int, TextClass::PageSides> SidesTranslator;
typedef Translator<int, PageSides> SidesTranslator;
SidesTranslator const init_sidestranslator()
{
SidesTranslator translator(1, TextClass::OneSide);
translator.addPair(2, TextClass::TwoSides);
SidesTranslator translator(1, OneSide);
translator.addPair(2, TwoSides);
return translator;
}
@ -352,7 +352,7 @@ BufferParams::BufferParams()
fontsTypewriterScale = 100;
inputenc = "auto";
graphicsDriver = "default";
sides = TextClass::OneSide;
sides = OneSide;
columns = 1;
listings_params = string();
pagestyle = "default";
@ -863,10 +863,10 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
// if needed
if (sides != tclass.sides()) {
switch (sides) {
case TextClass::OneSide:
case OneSide:
clsoptions << "oneside,";
break;
case TextClass::TwoSides:
case TwoSides:
clsoptions << "twoside,";
break;
}

View File

@ -18,7 +18,7 @@
#include "Font.h"
#include "BiblioInfo.h"
#include "paper.h"
#include "TextClass.h"
#include "TextClassPtr.h"
#include "insets/InsetQuotes.h"
@ -34,13 +34,14 @@ class AuthorList;
class BranchList;
class Bullet;
class Encoding;
class Language;
class Lexer;
class LatexFeatures;
class PDFOptions;
class Spacing;
class TextClass;
class TexRow;
class VSpace;
class Language;
class PDFOptions;
/** Buffer parameters.
* This class contains all the parameters for this buffer's use. Some
@ -222,7 +223,7 @@ public:
/// parameters for the listings package
std::string listings_params;
///
TextClass::PageSides sides;
PageSides sides;
///
std::string pagestyle;
/// \param index should lie in the range 0 <= \c index <= 3.

View File

@ -14,7 +14,7 @@
#ifndef CUTANDPASTE_H
#define CUTANDPASTE_H
#include "TextClass.h"
#include "TextClassPtr.h"
#include "support/types.h"
#include "support/docstring.h"
@ -26,7 +26,6 @@ namespace lyx {
class Buffer;
class ErrorList;
class InsetText;
class TextClass;
class Cursor;
class ParagraphList;

View File

@ -26,6 +26,7 @@
#include "Layout.h"
#include "Lexer.h"
#include "LyXRC.h"
#include "TextClass.h"
#include "support/docstream.h"
#include "support/filetools.h"

View File

@ -17,7 +17,7 @@
#include "KeySequence.h"
#include "lfuns.h"
#include "TextClass.h"
#include "TextClassPtr.h"
#include "support/docstring.h"

View File

@ -259,6 +259,7 @@ liblyxcore_la_SOURCES = \
TextClass.h \
TextClassList.cpp \
TextClassList.h \
TextClassPtr.h \
TextMetrics.cpp \
TextMetrics.h \
TocBackend.cpp \

View File

@ -35,6 +35,7 @@
#include "LyXFunc.h"
#include "Lexer.h"
#include "Paragraph.h"
#include "TextClass.h"
#include "TocBackend.h"
#include "ToolbarBackend.h"

View File

@ -40,6 +40,7 @@
#include "paragraph_funcs.h"
#include "ParagraphParameters.h"
#include "sgml.h"
#include "TextClass.h"
#include "TexRow.h"
#include "VSpace.h"

View File

@ -35,6 +35,7 @@
#include "OutputParams.h"
#include "paragraph_funcs.h"
#include "sgml.h"
#include "TextClass.h"
#include "TexRow.h"
#include "VSpace.h"

View File

@ -47,6 +47,7 @@
#include "ParIterator.h"
#include "Server.h"
#include "ServerSocket.h"
#include "TextClass.h"
#include "TextMetrics.h"
#include "VSpace.h"

View File

@ -44,9 +44,10 @@
#include "Paragraph.h"
#include "paragraph_funcs.h"
#include "ParagraphParameters.h"
#include "ParIterator.h"
#include "TextClass.h"
#include "TextMetrics.h"
#include "VSpace.h"
#include "ParIterator.h"
#include "frontends/Clipboard.h"
#include "frontends/Selection.h"

View File

@ -1181,7 +1181,7 @@ docstring const & TextClass::preamble() const
}
TextClass::PageSides TextClass::sides() const
PageSides TextClass::sides() const
{
return sides_;
}
@ -1253,13 +1253,13 @@ bool TextClass::hasTocLevels() const
}
ostream & operator<<(ostream & os, TextClass::PageSides p)
ostream & operator<<(ostream & os, PageSides p)
{
switch (p) {
case TextClass::OneSide:
case OneSide:
os << '1';
break;
case TextClass::TwoSides:
case TwoSides:
os << '2';
break;
}

View File

@ -18,6 +18,7 @@
#include "insets/InsetLayout.h"
#include "support/docstring.h"
#include "support/types.h"
#include <boost/shared_ptr.hpp>
@ -140,13 +141,6 @@ public:
///
unsigned int columns() const;
///
enum PageSides {
///
OneSide,
///
TwoSides
};
///
PageSides sides() const;
///
int secnumdepth() const;
@ -261,14 +255,7 @@ private:
/// convert page sides option to text 1 or 2
std::ostream & operator<<(std::ostream & os, TextClass::PageSides p);
/** Shared pointer for possibly modular layout. Needed so that paste,
* for example, will still be able to retain the pointer, even when
* the buffer itself is closed.
*/
typedef boost::shared_ptr<TextClass> TextClassPtr;
std::ostream & operator<<(std::ostream & os, PageSides p);
} // namespace lyx

28
src/TextClassPtr.h Normal file
View File

@ -0,0 +1,28 @@
// -*- C++ -*-
/**
* \file TextClassPtr.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* Full author contact details are available in file CREDITS.
*/
#ifndef TEXTCLASS_PTR_H
#define TEXTCLASS_PTR_H
#include <boost/shared_ptr.hpp>
namespace lyx {
class TextClass;
/// Global typedef
/** Shared pointer for possibly modular layout. Needed so that paste,
* for example, will still be able to retain the pointer, even when
* the buffer itself is closed.
*/
typedef boost::shared_ptr<TextClass> TextClassPtr;
} // namespace lyx
#endif

View File

@ -40,6 +40,7 @@
#include "ParIterator.h"
#include "rowpainter.h"
#include "Text.h"
#include "TextClass.h"
#include "VSpace.h"
#include "mathed/MacroTable.h"

View File

@ -23,6 +23,7 @@
#include "Layout.h"
#include "LyXAction.h"
#include "Paragraph.h"
#include "TextClass.h"
#include "insets/InsetOptArg.h"

View File

@ -1244,9 +1244,9 @@ void GuiDocument::apply(BufferParams & params)
pageLayoutModule->paperheightUnitCO);
if (pageLayoutModule->facingPagesCB->isChecked())
params.sides = TextClass::TwoSides;
params.sides = TwoSides;
else
params.sides = TextClass::OneSide;
params.sides = OneSide;
if (pageLayoutModule->landscapeRB->isChecked())
params.orientation = ORIENTATION_LANDSCAPE;
@ -1541,7 +1541,7 @@ void GuiDocument::updateParams(BufferParams const & params)
pageLayoutModule->portraitRB->setChecked(!landscape);
pageLayoutModule->facingPagesCB->setChecked(
params.sides == TextClass::TwoSides);
params.sides == TwoSides);
lengthToWidgets(pageLayoutModule->paperwidthLE,

View File

@ -29,6 +29,7 @@
#include "FloatList.h"
#include "FuncRequest.h"
#include "gettext.h"
#include "TextClass.h"
#include "frontends/LyXView.h"

View File

@ -23,6 +23,7 @@
#include "IconPalette.h"
#include "Layout.h"
#include "LyXFunc.h"
#include "TextClass.h"
#include "ToolbarBackend.h"
#include "GuiView.h"

View File

@ -14,7 +14,9 @@
#ifndef GUI_TOOLBARS_H
#define GUI_TOOLBARS_H
#include "TextClass.h"
#include "TextClassPtr.h"
#include "support/docstring.h"
#include <map>

View File

@ -47,6 +47,7 @@
#include "MenuBackend.h"
#include "Paragraph.h"
#include "Session.h"
#include "TextClass.h"
#include "ToolbarBackend.h"
#include "version.h"

View File

@ -23,6 +23,7 @@
#include "Lexer.h"
#include "Paragraph.h"
#include "ParagraphList.h"
#include "TextClass.h"
#include "support/lstrings.h"
#include "support/docstream.h"

View File

@ -23,6 +23,7 @@
#include "LaTeXFeatures.h"
#include "MetricsInfo.h"
#include "OutputParams.h"
#include "TextClass.h"
#include "frontends/alert.h"
@ -306,7 +307,7 @@ int InsetBibtex::latex(Buffer const & buffer, odocstream & os,
// all well
if (!contains(buffer.params().getTextClass().name(),
"art")) {
if (buffer.params().sides == TextClass::OneSide) {
if (buffer.params().sides == OneSide) {
// oneside
os << "\\clearpage";
} else {

View File

@ -24,6 +24,7 @@
#include "gettext.h"
#include "Lexer.h"
#include "OutputParams.h"
#include "TextClass.h"
#include <sstream>

View File

@ -30,6 +30,7 @@
#include "FuncRequest.h"
#include "MetricsInfo.h"
#include "ParagraphParameters.h"
#include "TextClass.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"

View File

@ -18,6 +18,7 @@
#include "OutputParams.h"
#include "output_latex.h"
#include "TexRow.h"
#include "TextClass.h"
namespace lyx {

View File

@ -14,7 +14,6 @@
#define INSETFLEX_H
#include "InsetCollapsable.h"
#include "TextClass.h"
namespace lyx {

View File

@ -28,6 +28,7 @@
#include "LaTeXFeatures.h"
#include "Lexer.h"
#include "OutputParams.h"
#include "TextClass.h"
#include "support/lstrings.h"
#include "support/docstream.h"

View File

@ -24,6 +24,7 @@
#include "Lexer.h"
#include "MetricsInfo.h"
#include "TocBackend.h"
#include "TextClass.h"
#include "support/lstrings.h"

View File

@ -23,6 +23,7 @@
// paragraph. This seems a bit too much to me (JMarc)
#include "OutputParams.h"
#include "ParIterator.h"
#include "TextClass.h"
#include "support/lstrings.h"

View File

@ -32,6 +32,7 @@
#include "MetricsInfo.h"
#include "OutputParams.h"
#include "TocBackend.h"
#include "TextClass.h"
#include "frontends/alert.h"
#include "frontends/Painter.h"

View File

@ -30,6 +30,7 @@
#include "Lexer.h"
#include "MetricsInfo.h"
#include "OutputParams.h"
#include "TextClass.h"
#include "support/docstream.h"
#include "support/Translator.h"

View File

@ -43,6 +43,7 @@
#include "Paragraph.h"
#include "ParagraphParameters.h"
#include "ParIterator.h"
#include "TextClass.h"
#include "TextMetrics.h"
#include "support/convert.h"

View File

@ -42,6 +42,7 @@
#include "ParIterator.h"
#include "Row.h"
#include "sgml.h"
#include "TextClass.h"
#include "TextMetrics.h"
#include "TexRow.h"

View File

@ -28,6 +28,7 @@
#include "LaTeXFeatures.h"
#include "Lexer.h"
#include "OutputParams.h"
#include "TextClass.h"
#include "TocBackend.h"
#include "support/convert.h"

View File

@ -25,6 +25,7 @@
#include "ParagraphList.h"
#include "ParagraphParameters.h"
#include "sgml.h"
#include "TextClass.h"
#include "support/lstrings.h"
#include "support/lyxlib.h"

View File

@ -24,6 +24,7 @@
#include "Paragraph.h"
#include "paragraph_funcs.h"
#include "ParagraphParameters.h"
#include "TextClass.h"
#include "TexRow.h"
#include "VSpace.h"

View File

@ -20,6 +20,7 @@
#include "Paragraph.h"
#include "ParagraphParameters.h"
#include "Text.h"
#include "TextClass.h"
#include <boost/next_prior.hpp>

View File

@ -20,6 +20,7 @@
#include "OutputParams.h"
#include "Paragraph.h"
#include "Text.h"
#include "TextClass.h"
#include "support/convert.h"
#include "support/docstream.h"

View File

@ -90,6 +90,14 @@ namespace lyx {
NEXT_WORD
};
///
enum PageSides {
///
OneSide,
///
TwoSides
};
} // namespace lyx
#endif // LYX_TYPES_H