mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 10:58:52 +00:00
change to use ostreams instead of string when writing files. fiddling with insettext. font fix in formula.C.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@584 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
02e72741bf
commit
def72111a5
44
ChangeLog
44
ChangeLog
@ -1,3 +1,47 @@
|
||||
2000-03-06 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||
|
||||
* lib/layouts/seminar.layout: feeble attempt at a layout for
|
||||
seminar.cls, far from completet and could really use some looking
|
||||
at from people used to write layout files.
|
||||
|
||||
* src/support/lyxmanip.h (newlineAndDepth): ostream manipulator to
|
||||
use instead of the AddNewlineAndDepth funtion in lyx_cb.C. This is
|
||||
a lot nicer and works nicely with ostreams.
|
||||
|
||||
* src/mathed/formula.C (draw): a slightly different solution that
|
||||
the one posted to the list, but I think this one works too. (font
|
||||
size wrong in headers.)
|
||||
|
||||
* src/insets/insettext.C (computeTextRows): some fiddling on
|
||||
Jürgens turf, added some comments that he should read.
|
||||
|
||||
* src/lyxrc.C: remove all traces of RC_NOMENUACCELERATORS, never
|
||||
used and it gave compiler warnings.
|
||||
RC_SHOW_BANNER + "\\show_banner" added, also to reading and
|
||||
writing of lyxrc.
|
||||
|
||||
* src/lyx_gui.C (create_forms): do the right thing when
|
||||
show_banner is true/false.
|
||||
|
||||
* src/lyx_cb.C (TimerCB): no need to close or do anything if
|
||||
show_banner is false.
|
||||
|
||||
* most file writing files: Now use iostreams to do almost all of
|
||||
the writing. Also instead of passing string &, we now use
|
||||
stringstreams. mathed output is still not adapted to iostreams.
|
||||
This change can be turned off by commenting out all the occurences
|
||||
of the "#define USE_OSTREAM_ONLY 1" lines.
|
||||
|
||||
* src/WorkArea.C (createPixmap): don't output debug messages.
|
||||
(WorkArea): don't output debug messages.
|
||||
|
||||
* lib/lyxrc.example: added a comment about the new variable
|
||||
\show_banner
|
||||
|
||||
* development/Code_rules/Rules: Added some more commente about how
|
||||
to build class interfaces and on how better encapsulation can be
|
||||
achieved.
|
||||
|
||||
2000-03-03 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* src/insets/insetert.C (InsetERT): Now ERT-insets break row
|
||||
|
@ -167,3 +167,42 @@ and enums.
|
||||
own. In case you have to change the generated files for any of the
|
||||
reasons above, you should provide a patch against the clean generated
|
||||
file. Your callbacks must be in a separate file.
|
||||
|
||||
*************************************************************
|
||||
|
||||
How to create class interfaces.
|
||||
(a.k.a How Non-Member Functions Improve Encapsulation)
|
||||
======================================================
|
||||
|
||||
I recently read an article by Scott Meyers in C/C++ Users
|
||||
Journal (Vol.18,No.2), where he makes a strong case on how non-member
|
||||
functions makes classes more encapsulated, not less. Just to skipping
|
||||
to the core of this provides us with the following algorithm for
|
||||
deciding what kind of function to add to a class interface:
|
||||
|
||||
- We need to add a function f to the class C's API.
|
||||
|
||||
if (f needs to be virtual)
|
||||
make f a member function of C;
|
||||
else if (f is operator>> or operator<<) {
|
||||
make f a non-member funtion;
|
||||
if (f needs access to non-public members of C)
|
||||
make f a friend of C;
|
||||
} else if (f needs type conversions on its left-most argument) {
|
||||
make f a non-member function;
|
||||
if (f needs access to non-public members of C)
|
||||
make f a friend of C;
|
||||
} else if (f can be implemented via C's public interface)
|
||||
make f a non-member function;
|
||||
else
|
||||
make f a member function of C;
|
||||
|
||||
Unfortunately, to make the best use of this kind of Class API's we
|
||||
need namespaces. As soon as Jean-Marc stop using gcc 2.8 and other
|
||||
compilers seem more or less up to date on namespaces we will begin to
|
||||
use them. _BUT_ we should begin to use the above algoritm ASAP. We
|
||||
should also go through old code and apply this algorithm to the
|
||||
existing member functions. That will help maintainability in the
|
||||
future.
|
||||
|
||||
(I'll feel in more from Scott Meyers article when time allows.)
|
||||
|
112
lib/layouts/seminar.layout
Normal file
112
lib/layouts/seminar.layout
Normal file
@ -0,0 +1,112 @@
|
||||
#% Do not delete the line below; configure depends on this
|
||||
# \DeclareLaTeXClass{seminar}
|
||||
# Initial attemt at makeing a LyX layout file for the seminar class.
|
||||
# Author : Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||
|
||||
# Input general definitions
|
||||
Input stdclass.inc
|
||||
|
||||
Sides 1
|
||||
Columns 1
|
||||
|
||||
ClassOptions
|
||||
FontSize 8|9|10|11|12|14|17
|
||||
Other slidesec
|
||||
End
|
||||
|
||||
# There are no chapters in an article.
|
||||
NoStyle Chapter
|
||||
NoStyle Chapter*
|
||||
|
||||
MaxCounter Counter_Section
|
||||
SecNumDepth 3
|
||||
TocDepth 3
|
||||
|
||||
# Change a bit Part and Part*
|
||||
Style Part
|
||||
Align Left
|
||||
AlignPossible Left
|
||||
TopSep 2
|
||||
BottomSep 1.5
|
||||
|
||||
Font
|
||||
Size Larger
|
||||
EndFont
|
||||
End
|
||||
|
||||
Style Part*
|
||||
Align Left
|
||||
AlignPossible Left
|
||||
TopSep 2
|
||||
BottomSep 1.5
|
||||
|
||||
Font
|
||||
Size Larger
|
||||
EndFont
|
||||
End
|
||||
|
||||
|
||||
Style LandscapeSlide
|
||||
CopyStyle Standard
|
||||
LatexType Environment
|
||||
LatexName slide
|
||||
KeepEmpty 1
|
||||
Labeltype Static
|
||||
LabelString "Landscape Slide"
|
||||
LabelSep "MMMMMMM"
|
||||
End
|
||||
|
||||
Style PortraitSlide
|
||||
CopyStyle Standard
|
||||
LatexType Environment
|
||||
LatexName slide*
|
||||
KeepEmpty 1
|
||||
Labeltype Static
|
||||
LabelString "Portrait Slide"
|
||||
End
|
||||
|
||||
Style Slide
|
||||
Obsoletedby LandscapeSlide
|
||||
End
|
||||
|
||||
Style Slide*
|
||||
Obsoletedby PortraitSlide
|
||||
End
|
||||
|
||||
Style SlideHeading
|
||||
CopyStyle Section
|
||||
LatexName slideheading
|
||||
End
|
||||
|
||||
Style SlideSubHeading
|
||||
CopyStyle Subsection
|
||||
LatexName slidesubheading
|
||||
End
|
||||
|
||||
Style ListOfSlides
|
||||
KeepEmpty 1
|
||||
Align Center
|
||||
LatexType Command
|
||||
LatexName listofslides
|
||||
Labeltype Static
|
||||
LabelString "List Of Slides"
|
||||
End
|
||||
|
||||
Style SlideContents
|
||||
KeepEmpty 1
|
||||
Align Center
|
||||
LatexType Command
|
||||
LatexName slidecontents
|
||||
Labeltype Static
|
||||
LabelString "Slidecontents"
|
||||
End
|
||||
|
||||
Style ProgressContents
|
||||
KeepEmpty 1
|
||||
Align Center
|
||||
LatexType Command
|
||||
LatexName Slidecontents
|
||||
Labeltype Static
|
||||
LabelString "Progress Contents"
|
||||
End
|
||||
|
@ -58,6 +58,10 @@
|
||||
# MISC SECTION ###########################################################
|
||||
#
|
||||
|
||||
# Set this to false if you don't want the startup banner.
|
||||
# Default is true.
|
||||
#\show_banner true
|
||||
|
||||
# Set to false if you don't want the current selection to be replaced
|
||||
# automatically by what you type. Default is true.
|
||||
#\auto_region_delete false
|
||||
|
@ -497,9 +497,10 @@ int LyXAction::LookupFunc(string const & func) const
|
||||
}
|
||||
|
||||
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning Not working as it should.
|
||||
#endif
|
||||
//#ifdef WITH_WARNINGS
|
||||
//#warning Not working as it should.
|
||||
//#endif
|
||||
// I have no clue what is wrong with it... (Lgb)
|
||||
int LyXAction::getApproxFunc(string const & func) const
|
||||
// This func should perhaps also be able to return a list of all
|
||||
// actions that has func as a prefix. That should actually be quite
|
||||
|
@ -65,6 +65,7 @@ WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height)
|
||||
|
||||
figinset_canvas = 0;
|
||||
|
||||
if (lyxerr.debugging())
|
||||
lyxerr << "Creating work area: +"
|
||||
<< xpos << '+' << ypos << ' '
|
||||
<< width << 'x' << height << endl;
|
||||
@ -81,6 +82,7 @@ WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height)
|
||||
fl_set_object_gravity(obj, NorthWestGravity, NorthWestGravity);
|
||||
|
||||
// a box
|
||||
if (lyxerr.debugging())
|
||||
lyxerr << "\tbackground box: +"
|
||||
<< xpos << '+' << ypos << ' '
|
||||
<< width - 15 << 'x' << height << endl;
|
||||
@ -98,6 +100,7 @@ WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height)
|
||||
// up - scrollbar button
|
||||
fl_set_border_width(-1);
|
||||
|
||||
if (lyxerr.debugging())
|
||||
lyxerr << "\tup button: +"
|
||||
<< xpos + width - 15 << '+' << ypos << ' '
|
||||
<< 15 << 'x' << 15 << endl;
|
||||
@ -118,6 +121,8 @@ WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height)
|
||||
|
||||
// the scrollbar slider
|
||||
fl_set_border_width(-bw);
|
||||
|
||||
if (lyxerr.debugging())
|
||||
lyxerr << "\tscrollbar slider: +"
|
||||
<< xpos + width - 15 << '+' << ypos + 15 << ' '
|
||||
<< 15 << 'x' << height - 30 << endl;
|
||||
@ -136,8 +141,10 @@ WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height)
|
||||
// down - scrollbar button
|
||||
fl_set_border_width(-1);
|
||||
|
||||
if (lyxerr.debugging())
|
||||
lyxerr << "\tdown button: +"
|
||||
<< xpos + width - 15 << '+' << ypos + height - 15 << ' '
|
||||
<< xpos + width - 15 << '+'
|
||||
<< ypos + height - 15 << ' '
|
||||
<< 15 << 'x' << 15 << endl;
|
||||
button_down = obj = fl_add_pixmapbutton(FL_TOUCH_BUTTON,
|
||||
xpos + width - 15,
|
||||
@ -167,9 +174,12 @@ WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height)
|
||||
|
||||
// We add this object as late as possible to avoit problems
|
||||
// with drawing.
|
||||
if (lyxerr.debugging())
|
||||
lyxerr << "\tfree object: +"
|
||||
<< xpos + bw << '+' << ypos + bw << ' '
|
||||
<< width - 15 - 2 * bw << 'x' << height - 2 * bw << endl;
|
||||
<< width - 15 - 2 * bw << 'x'
|
||||
<< height - 2 * bw << endl;
|
||||
|
||||
work_area = obj = fl_add_free(FL_INPUT_FREE,
|
||||
xpos + bw, ypos + bw,
|
||||
width - 15 - 2 * bw, // scrollbarwidth
|
||||
@ -246,13 +256,16 @@ void WorkArea::createPixmap(int width, int height)
|
||||
if (workareapixmap)
|
||||
XFreePixmap(fl_display, workareapixmap);
|
||||
|
||||
lyxerr << "Creating pixmap (" << width << 'x' << height << ")" << endl;
|
||||
if (lyxerr.debugging())
|
||||
lyxerr << "Creating pixmap ("
|
||||
<< width << 'x' << height << ")" << endl;
|
||||
|
||||
workareapixmap = XCreatePixmap(fl_display,
|
||||
RootWindow(fl_display, 0),
|
||||
width,
|
||||
height,
|
||||
fl_get_visual_depth());
|
||||
if (lyxerr.debugging())
|
||||
lyxerr << "\tpixmap=" << workareapixmap << endl;
|
||||
}
|
||||
|
||||
@ -381,16 +394,16 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
|
||||
// Done by the raw callback:
|
||||
// case FL_KEYBOARD: WorkAreaKeyPress(ob, 0,0,0,ev,0); break;
|
||||
case FL_FOCUS:
|
||||
lyxerr << "Workarea event: FOCUS" << endl;
|
||||
lyxerr.debug() << "Workarea event: FOCUS" << endl;
|
||||
break;
|
||||
case FL_UNFOCUS:
|
||||
lyxerr << "Workarea event: UNFOCUS" << endl;
|
||||
lyxerr.debug() << "Workarea event: UNFOCUS" << endl;
|
||||
break;
|
||||
case FL_ENTER:
|
||||
lyxerr << "Workarea event: ENTER" << endl;
|
||||
lyxerr.debug() << "Workarea event: ENTER" << endl;
|
||||
break;
|
||||
case FL_LEAVE:
|
||||
lyxerr << "Workarea event: LEAVE" << endl;
|
||||
lyxerr.debug() << "Workarea event: LEAVE" << endl;
|
||||
break;
|
||||
case FL_DBLCLICK:
|
||||
if (!ev) break;
|
||||
|
732
src/buffer.C
732
src/buffer.C
@ -1525,6 +1525,537 @@ void Buffer::writeFileAscii(string const & fname, int linelen)
|
||||
}
|
||||
|
||||
|
||||
#ifdef USE_OSTREAM_ONLY
|
||||
void Buffer::makeLaTeXFile(string const & fname,
|
||||
string const & original_path,
|
||||
bool nice, bool only_body)
|
||||
{
|
||||
lyxerr[Debug::LATEX] << "makeLaTeXFile..." << endl;
|
||||
|
||||
niceFile = nice; // this will be used by Insetincludes.
|
||||
|
||||
tex_code_break_column = lyxrc->ascii_linelen;
|
||||
|
||||
LyXTextClass const & tclass =
|
||||
textclasslist.TextClass(params.textclass);
|
||||
|
||||
ofstream ofs(fname.c_str());
|
||||
if (!ofs) {
|
||||
WriteFSAlert(_("Error: Cannot open file: "), fname);
|
||||
return;
|
||||
}
|
||||
|
||||
// validate the buffer.
|
||||
lyxerr[Debug::LATEX] << " Validating buffer..." << endl;
|
||||
LaTeXFeatures features(tclass.numLayouts());
|
||||
validate(features);
|
||||
lyxerr[Debug::LATEX] << " Buffer validation done." << endl;
|
||||
|
||||
texrow.reset();
|
||||
// The starting paragraph of the coming rows is the
|
||||
// first paragraph of the document. (Asger)
|
||||
texrow.start(paragraph, 0);
|
||||
|
||||
if (!only_body && nice) {
|
||||
ofs << "%% " LYX_DOCVERSION " created this file. "
|
||||
"For more info, see http://www.lyx.org/.\n"
|
||||
"%% Do not edit unless you really know what "
|
||||
"you are doing.\n";
|
||||
texrow.newline();
|
||||
texrow.newline();
|
||||
}
|
||||
lyxerr.debug() << "lyx header finished" << endl;
|
||||
// There are a few differences between nice LaTeX and usual files:
|
||||
// usual is \batchmode and has a
|
||||
// special input@path to allow the including of figures
|
||||
// with either \input or \includegraphics (what figinsets do).
|
||||
// batchmode is not set if there is a tex_code_break_column.
|
||||
// In this case somebody is interested in the generated LaTeX,
|
||||
// so this is OK. input@path is set when the actual parameter
|
||||
// original_path is set. This is done for usual tex-file, but not
|
||||
// for nice-latex-file. (Matthias 250696)
|
||||
if (!only_body) {
|
||||
if (!nice){
|
||||
// code for usual, NOT nice-latex-file
|
||||
ofs << "\\batchmode\n"; // changed
|
||||
// from \nonstopmode
|
||||
texrow.newline();
|
||||
}
|
||||
if (!original_path.empty()) {
|
||||
ofs << "\\makeatletter\n"
|
||||
<< "\\def\\input@path{{"
|
||||
<< original_path << "/}}\n"
|
||||
<< "\\makeatother\n";
|
||||
texrow.newline();
|
||||
texrow.newline();
|
||||
texrow.newline();
|
||||
}
|
||||
|
||||
ofs << "\\documentclass";
|
||||
|
||||
string options; // the document class options.
|
||||
|
||||
if (tokenPos(tclass.opt_fontsize(), '|', params.fontsize) >= 0) {
|
||||
// only write if existing in list (and not default)
|
||||
options += params.fontsize;
|
||||
options += "pt,";
|
||||
}
|
||||
|
||||
|
||||
if (!params.use_geometry &&
|
||||
(params.paperpackage == BufferParams::PACKAGE_NONE)) {
|
||||
switch (params.papersize) {
|
||||
case BufferParams::PAPER_A4PAPER:
|
||||
options += "a4paper,";
|
||||
break;
|
||||
case BufferParams::PAPER_USLETTER:
|
||||
options += "letterpaper,";
|
||||
break;
|
||||
case BufferParams::PAPER_A5PAPER:
|
||||
options += "a5paper,";
|
||||
break;
|
||||
case BufferParams::PAPER_B5PAPER:
|
||||
options += "b5paper,";
|
||||
break;
|
||||
case BufferParams::PAPER_EXECUTIVEPAPER:
|
||||
options += "executivepaper,";
|
||||
break;
|
||||
case BufferParams::PAPER_LEGALPAPER:
|
||||
options += "legalpaper,";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// if needed
|
||||
if (params.sides != tclass.sides()) {
|
||||
switch (params.sides) {
|
||||
case LyXTextClass::OneSide:
|
||||
options += "oneside,";
|
||||
break;
|
||||
case LyXTextClass::TwoSides:
|
||||
options += "twoside,";
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// if needed
|
||||
if (params.columns != tclass.columns()) {
|
||||
if (params.columns == 2)
|
||||
options += "twocolumn,";
|
||||
else
|
||||
options += "onecolumn,";
|
||||
}
|
||||
|
||||
if (!params.use_geometry
|
||||
&& params.orientation == BufferParams::ORIENTATION_LANDSCAPE)
|
||||
options += "landscape,";
|
||||
|
||||
// language should be a parameter to \documentclass
|
||||
if (params.language != "default") {
|
||||
if (params.language == "hebrew")
|
||||
options += "english,";
|
||||
else if (lyxrc->rtl_support)
|
||||
options += "hebrew,";
|
||||
options += params.language + ',';
|
||||
} else if (lyxrc->rtl_support)
|
||||
options += "hebrew,english,";
|
||||
|
||||
// the user-defined options
|
||||
if (!params.options.empty()) {
|
||||
options += params.options + ',';
|
||||
}
|
||||
|
||||
if (!options.empty()){
|
||||
options = strip(options, ',');
|
||||
ofs << '[' << options << ']';
|
||||
}
|
||||
|
||||
ofs << '{'
|
||||
<< textclasslist.LatexnameOfClass(params.textclass)
|
||||
<< "}\n";
|
||||
texrow.newline();
|
||||
// end of \documentclass defs
|
||||
|
||||
// font selection must be done before loading fontenc.sty
|
||||
if (params.fonts != "default") {
|
||||
ofs << "\\usepackage{" << params.fonts << "}\n";
|
||||
texrow.newline();
|
||||
}
|
||||
// this one is not per buffer
|
||||
if (lyxrc->fontenc != "default") {
|
||||
ofs << "\\usepackage[" << lyxrc->fontenc
|
||||
<< "]{fontenc}\n";
|
||||
texrow.newline();
|
||||
}
|
||||
if (params.inputenc != "default") {
|
||||
ofs << "\\usepackage[" << params.inputenc
|
||||
<< "]{inputenc}\n";
|
||||
texrow.newline();
|
||||
}
|
||||
|
||||
/* at the very beginning the text parameters */
|
||||
if (params.paperpackage != BufferParams::PACKAGE_NONE) {
|
||||
switch (params.paperpackage) {
|
||||
case BufferParams::PACKAGE_A4:
|
||||
ofs << "\\usepackage{a4}\n";
|
||||
texrow.newline();
|
||||
break;
|
||||
case BufferParams::PACKAGE_A4WIDE:
|
||||
ofs << "\\usepackage{a4wide}\n";
|
||||
texrow.newline();
|
||||
break;
|
||||
case BufferParams::PACKAGE_WIDEMARGINSA4:
|
||||
ofs << "\\usepackage[widemargins]{a4}\n";
|
||||
texrow.newline();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (params.use_geometry) {
|
||||
ofs << "\\usepackage{geometry}\n";
|
||||
texrow.newline();
|
||||
ofs << "\\geometry{verbose";
|
||||
if (params.orientation == BufferParams::ORIENTATION_LANDSCAPE)
|
||||
ofs << ",landscape";
|
||||
switch (params.papersize2) {
|
||||
case BufferParams::VM_PAPER_CUSTOM:
|
||||
if (!params.paperwidth.empty())
|
||||
ofs << ",paperwidth="
|
||||
<< params.paperwidth;
|
||||
if (!params.paperheight.empty())
|
||||
ofs << ",paperheight="
|
||||
<< params.paperheight;
|
||||
break;
|
||||
case BufferParams::VM_PAPER_USLETTER:
|
||||
ofs << ",letterpaper";
|
||||
break;
|
||||
case BufferParams::VM_PAPER_USLEGAL:
|
||||
ofs << ",legalpaper";
|
||||
break;
|
||||
case BufferParams::VM_PAPER_USEXECUTIVE:
|
||||
ofs << ",executivepaper";
|
||||
break;
|
||||
case BufferParams::VM_PAPER_A3:
|
||||
ofs << ",a3paper";
|
||||
break;
|
||||
case BufferParams::VM_PAPER_A4:
|
||||
ofs << ",a4paper";
|
||||
break;
|
||||
case BufferParams::VM_PAPER_A5:
|
||||
ofs << ",a5paper";
|
||||
break;
|
||||
case BufferParams::VM_PAPER_B3:
|
||||
ofs << ",b3paper";
|
||||
break;
|
||||
case BufferParams::VM_PAPER_B4:
|
||||
ofs << ",b4paper";
|
||||
break;
|
||||
case BufferParams::VM_PAPER_B5:
|
||||
ofs << ",b5paper";
|
||||
break;
|
||||
default:
|
||||
// default papersize ie BufferParams::VM_PAPER_DEFAULT
|
||||
switch (lyxrc->default_papersize) {
|
||||
case BufferParams::PAPER_DEFAULT: // keep compiler happy
|
||||
case BufferParams::PAPER_USLETTER:
|
||||
ofs << ",letterpaper";
|
||||
break;
|
||||
case BufferParams::PAPER_LEGALPAPER:
|
||||
ofs << ",legalpaper";
|
||||
break;
|
||||
case BufferParams::PAPER_EXECUTIVEPAPER:
|
||||
ofs << ",executivepaper";
|
||||
break;
|
||||
case BufferParams::PAPER_A3PAPER:
|
||||
ofs << ",a3paper";
|
||||
break;
|
||||
case BufferParams::PAPER_A4PAPER:
|
||||
ofs << ",a4paper";
|
||||
break;
|
||||
case BufferParams::PAPER_A5PAPER:
|
||||
ofs << ",a5paper";
|
||||
break;
|
||||
case BufferParams::PAPER_B5PAPER:
|
||||
ofs << ",b5paper";
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!params.topmargin.empty())
|
||||
ofs << ",tmargin=" << params.topmargin;
|
||||
if (!params.bottommargin.empty())
|
||||
ofs << ",bmargin=" << params.bottommargin;
|
||||
if (!params.leftmargin.empty())
|
||||
ofs << ",lmargin=" << params.leftmargin;
|
||||
if (!params.rightmargin.empty())
|
||||
ofs << ",rmargin=" << params.rightmargin;
|
||||
if (!params.headheight.empty())
|
||||
ofs << ",headheight=" << params.headheight;
|
||||
if (!params.headsep.empty())
|
||||
ofs << ",headsep=" << params.headsep;
|
||||
if (!params.footskip.empty())
|
||||
ofs << ",footskip=" << params.footskip;
|
||||
ofs << "}\n";
|
||||
texrow.newline();
|
||||
}
|
||||
if (params.use_amsmath
|
||||
&& !prefixIs(textclasslist.LatexnameOfClass(params.textclass), "ams")) {
|
||||
ofs << "\\usepackage{amsmath}\n";
|
||||
texrow.newline();
|
||||
}
|
||||
|
||||
if (tokenPos(tclass.opt_pagestyle(), '|', params.pagestyle) >= 0) {
|
||||
if (params.pagestyle == "fancy") {
|
||||
ofs << "\\usepackage{fancyhdr}\n";
|
||||
texrow.newline();
|
||||
}
|
||||
ofs << "\\pagestyle{" << params.pagestyle << "}\n";
|
||||
texrow.newline();
|
||||
}
|
||||
|
||||
// We try to load babel late, in case it interferes
|
||||
// with other packages.
|
||||
if (params.language != "default" || lyxrc->rtl_support ) {
|
||||
ofs << "\\usepackage{babel}\n";
|
||||
texrow.newline();
|
||||
}
|
||||
|
||||
if (params.secnumdepth != tclass.secnumdepth()) {
|
||||
ofs << "\\setcounter{secnumdepth}{"
|
||||
<< params.secnumdepth
|
||||
<< "}\n";
|
||||
texrow.newline();
|
||||
}
|
||||
if (params.tocdepth != tclass.tocdepth()) {
|
||||
ofs << "\\setcounter{tocdepth}{"
|
||||
<< params.tocdepth
|
||||
<< "}\n";
|
||||
texrow.newline();
|
||||
}
|
||||
|
||||
if (params.paragraph_separation) {
|
||||
switch (params.defskip.kind()) {
|
||||
case VSpace::SMALLSKIP:
|
||||
ofs << "\\setlength\\parskip{\\smallskipamount}\n";
|
||||
break;
|
||||
case VSpace::MEDSKIP:
|
||||
ofs << "\\setlength\\parskip{\\medskipamount}\n";
|
||||
break;
|
||||
case VSpace::BIGSKIP:
|
||||
ofs << "\\setlength\\parskip{\\bigskipamount}\n";
|
||||
break;
|
||||
case VSpace::LENGTH:
|
||||
ofs << "\\setlength\\parskip{"
|
||||
<< params.defskip.length().asLatexString()
|
||||
<< "}\n";
|
||||
break;
|
||||
default: // should never happen // Then delete it.
|
||||
ofs << "\\setlength\\parskip{\\medskipamount}\n";
|
||||
break;
|
||||
}
|
||||
texrow.newline();
|
||||
|
||||
ofs << "\\setlength\\parindent{0pt}\n";
|
||||
texrow.newline();
|
||||
}
|
||||
|
||||
// Now insert the LyX specific LaTeX commands...
|
||||
string preamble, tmppreamble;
|
||||
|
||||
// The optional packages;
|
||||
preamble = features.getPackages(params);
|
||||
|
||||
// this might be useful...
|
||||
preamble += "\n\\makeatletter\n\n";
|
||||
|
||||
// Some macros LyX will need
|
||||
tmppreamble = features.getMacros(params);
|
||||
|
||||
if (!tmppreamble.empty()) {
|
||||
preamble += "\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% "
|
||||
"LyX specific LaTeX commands.\n"
|
||||
+ tmppreamble + '\n';
|
||||
}
|
||||
|
||||
// the text class specific preamble
|
||||
tmppreamble = features.getTClassPreamble(params);
|
||||
if (!tmppreamble.empty()) {
|
||||
preamble += "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% "
|
||||
"Textclass specific LaTeX commands.\n"
|
||||
+ tmppreamble + '\n';
|
||||
}
|
||||
|
||||
/* the user-defined preamble */
|
||||
if (!params.preamble.empty()) {
|
||||
preamble += "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% "
|
||||
"User specified LaTeX commands.\n"
|
||||
+ params.preamble + '\n';
|
||||
}
|
||||
|
||||
preamble += "\\makeatother\n\n";
|
||||
|
||||
// Itemize bullet settings need to be last in case the user
|
||||
// defines their own bullets that use a package included
|
||||
// in the user-defined preamble -- ARRae
|
||||
// Actually it has to be done much later than that
|
||||
// since some packages like frenchb make modifications
|
||||
// at \begin{document} time -- JMarc
|
||||
string bullets_def;
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
if (params.user_defined_bullets[i] != ITEMIZE_DEFAULTS[i]) {
|
||||
if (bullets_def.empty())
|
||||
bullets_def="\\AtBeginDocument{\n";
|
||||
bullets_def += " \\renewcommand{\\labelitemi";
|
||||
switch (i) {
|
||||
// `i' is one less than the item to modify
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
bullets_def += 'i';
|
||||
break;
|
||||
case 2:
|
||||
bullets_def += "ii";
|
||||
break;
|
||||
case 3:
|
||||
bullets_def += 'v';
|
||||
break;
|
||||
}
|
||||
bullets_def += "}{" +
|
||||
params.user_defined_bullets[i].getText()
|
||||
+ "}\n";
|
||||
}
|
||||
}
|
||||
|
||||
if (!bullets_def.empty())
|
||||
preamble += bullets_def + "}\n\n";
|
||||
|
||||
for (int j = countChar(preamble, '\n'); j-- ;) {
|
||||
texrow.newline();
|
||||
}
|
||||
|
||||
ofs << preamble;
|
||||
|
||||
// make the body.
|
||||
ofs << "\\begin{document}\n\n";
|
||||
texrow.newline();
|
||||
texrow.newline();
|
||||
} // only_body
|
||||
lyxerr.debug() << "preamble finished, now the body." << endl;
|
||||
|
||||
bool was_title = false;
|
||||
bool already_title = false;
|
||||
#ifdef HAVE_SSTREAM
|
||||
ostringstream ftnote;
|
||||
#else
|
||||
char * tmpholder = 0;
|
||||
#endif
|
||||
TexRow ft_texrow;
|
||||
int ftcount = 0;
|
||||
|
||||
LyXParagraph * par = paragraph;
|
||||
|
||||
// if only_body
|
||||
while (par) {
|
||||
#ifndef HAVE_SSTREAM
|
||||
ostrstream ftnote;
|
||||
if (tmpholder) {
|
||||
ftnote << tmpholder;
|
||||
delete [] tmpholder;
|
||||
tmpholder = 0;
|
||||
}
|
||||
#endif
|
||||
if (par->IsDummy())
|
||||
lyxerr[Debug::LATEX] << "Error in MakeLateXFile."
|
||||
<< endl;
|
||||
LyXLayout const & layout =
|
||||
textclasslist.Style(params.textclass,
|
||||
par->layout);
|
||||
|
||||
if (layout.intitle) {
|
||||
if (already_title) {
|
||||
lyxerr <<"Error in MakeLatexFile: You"
|
||||
" should not mix title layouts"
|
||||
" with normal ones." << endl;
|
||||
} else
|
||||
was_title = true;
|
||||
} else if (was_title && !already_title) {
|
||||
ofs << "\\maketitle\n";
|
||||
texrow.newline();
|
||||
already_title = true;
|
||||
was_title = false;
|
||||
}
|
||||
// We are at depth 0 so we can just use
|
||||
// ordinary \footnote{} generation
|
||||
// flag this with ftcount
|
||||
ftcount = -1;
|
||||
if (layout.isEnvironment()
|
||||
|| par->pextra_type != LyXParagraph::PEXTRA_NONE) {
|
||||
par = par->TeXEnvironment(ofs, texrow,
|
||||
ftnote, ft_texrow, ftcount);
|
||||
} else {
|
||||
par = par->TeXOnePar(ofs, texrow,
|
||||
ftnote, ft_texrow, ftcount);
|
||||
}
|
||||
|
||||
// Write out what we've generated...
|
||||
if (ftcount >= 1) {
|
||||
if (ftcount > 1) {
|
||||
ofs << "\\addtocounter{footnote}{-"
|
||||
<< ftcount - 1
|
||||
<< '}';
|
||||
}
|
||||
ofs << ftnote.str();
|
||||
texrow += ft_texrow;
|
||||
#ifdef HAVE_SSTREAM
|
||||
ftnote.str(string());
|
||||
#else
|
||||
delete [] ftnote.str();
|
||||
#endif
|
||||
ft_texrow.reset();
|
||||
ftcount = 0;
|
||||
}
|
||||
#ifndef HAVE_SSTREAM
|
||||
else {
|
||||
// I hate strstreams
|
||||
tmpholder = ftnote.str();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#ifndef HAVE_SSTREAM
|
||||
delete [] tmpholder;
|
||||
#endif
|
||||
// It might be that we only have a title in this document
|
||||
if (was_title && !already_title) {
|
||||
ofs << "\\maketitle\n";
|
||||
texrow.newline();
|
||||
}
|
||||
|
||||
if (!only_body) {
|
||||
ofs << "\\end{document}\n";
|
||||
texrow.newline();
|
||||
|
||||
lyxerr[Debug::LATEX] << "makeLaTeXFile...done" << endl;
|
||||
} else {
|
||||
lyxerr[Debug::LATEX] << "LaTeXFile for inclusion made."
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// Just to be sure. (Asger)
|
||||
texrow.newline();
|
||||
|
||||
// tex_code_break_column's value is used to decide
|
||||
// if we are in batchmode or not (within mathed_write()
|
||||
// in math_write.C) so we must set it to a non-zero
|
||||
// value when we leave otherwise we save incorrect .lyx files.
|
||||
tex_code_break_column = lyxrc->ascii_linelen;
|
||||
|
||||
ofs.close();
|
||||
if (ofs.fail()) {
|
||||
lyxerr << "File was not closed properly." << endl;
|
||||
}
|
||||
|
||||
lyxerr.debug() << "Finished making latex file." << endl;
|
||||
}
|
||||
#else
|
||||
void Buffer::makeLaTeXFile(string const & fname,
|
||||
string const & original_path,
|
||||
bool nice, bool only_body)
|
||||
@ -2048,6 +2579,7 @@ void Buffer::makeLaTeXFile(string const & fname,
|
||||
ofs.close();
|
||||
lyxerr.debug() << "Finished making latex file." << endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
bool Buffer::isLatex() const
|
||||
@ -2285,7 +2817,6 @@ void Buffer::DocBookHandleCaption(ostream & os, string & inner_tag,
|
||||
LyXParagraph * & par)
|
||||
{
|
||||
LyXParagraph * tpar = par;
|
||||
string tmp_par, extra_par;
|
||||
while (tpar && (tpar->footnoteflag != LyXParagraph::NO_FOOTNOTE) &&
|
||||
(tpar->layout != textclasslist.NumberOfLayout(params.textclass,
|
||||
"Caption").second))
|
||||
@ -2294,11 +2825,18 @@ void Buffer::DocBookHandleCaption(ostream & os, string & inner_tag,
|
||||
tpar->layout == textclasslist.NumberOfLayout(params.textclass,
|
||||
"Caption").second) {
|
||||
sgmlOpenTag(os, depth + 1, inner_tag);
|
||||
#ifdef USE_OSTREAM_ONLY
|
||||
string extra_par;
|
||||
SimpleDocBookOnePar(os, extra_par, tpar,
|
||||
desc_on, depth + 2);
|
||||
#else
|
||||
string tmp_par, extra_par;
|
||||
SimpleDocBookOnePar(tmp_par, extra_par, tpar,
|
||||
desc_on, depth + 2);
|
||||
tmp_par = strip(tmp_par);
|
||||
tmp_par = frontStrip(tmp_par);
|
||||
os << tmp_par;
|
||||
#endif
|
||||
sgmlCloseTag(os, depth+1, inner_tag);
|
||||
if(!extra_par.empty())
|
||||
os << extra_par;
|
||||
@ -2317,13 +2855,15 @@ void Buffer::DocBookHandleFootnote(ostream & os, LyXParagraph * & par,
|
||||
// This is not how I like to see enums. They should not be anonymous
|
||||
// and variables of its type should not be declared right after the
|
||||
// last brace. (Lgb)
|
||||
enum {
|
||||
enum SOME_ENUM {
|
||||
NO_ONE,
|
||||
FOOTNOTE_LIKE,
|
||||
MARGIN_LIKE,
|
||||
FIG_LIKE,
|
||||
TAB_LIKE
|
||||
} last = NO_ONE, present = FOOTNOTE_LIKE;
|
||||
};
|
||||
SOME_ENUM last = NO_ONE;
|
||||
SOME_ENUM present = FOOTNOTE_LIKE;
|
||||
|
||||
while (par && par->footnoteflag != LyXParagraph::NO_FOOTNOTE) {
|
||||
if(last == present) {
|
||||
@ -2339,7 +2879,8 @@ void Buffer::DocBookHandleFootnote(ostream & os, LyXParagraph * & par,
|
||||
os << "\n";
|
||||
} else {
|
||||
os << tmp_par;
|
||||
if(!inner_tag.empty()) sgmlCloseTag(os, depth+1, inner_tag);
|
||||
if(!inner_tag.empty()) sgmlCloseTag(os, depth + 1,
|
||||
inner_tag);
|
||||
if(!extra_par.empty()) os << extra_par;
|
||||
if(!tag.empty()) sgmlCloseTag(os, depth, tag);
|
||||
extra_par.clear();
|
||||
@ -2385,8 +2926,24 @@ void Buffer::DocBookHandleFootnote(ostream & os, LyXParagraph * & par,
|
||||
// ignore all caption here, we processed them above!!!
|
||||
if (par->layout != textclasslist.NumberOfLayout(params.textclass,
|
||||
"Caption").second) {
|
||||
SimpleDocBookOnePar(tmp_par, extra_par, par,
|
||||
#ifdef USE_OSTREAM_ONLY
|
||||
#ifdef HAVE_SSTREAM
|
||||
ostringstream ost;
|
||||
#else
|
||||
ostrstream ost;
|
||||
#endif
|
||||
SimpleDocBookOnePar(ost, extra_par, par,
|
||||
desc_on, depth + 2);
|
||||
#ifdef HAVE_SSTREAM
|
||||
tmp_par += ost.str().c_str();
|
||||
#else
|
||||
ost << '\0';
|
||||
char * ctmp = ost.str();
|
||||
tmp_par += ctmp;
|
||||
delete [] ctmp;
|
||||
#endif
|
||||
#else
|
||||
#endif
|
||||
}
|
||||
tmp_par = frontStrip(strip(tmp_par));
|
||||
|
||||
@ -2597,9 +3154,13 @@ void Buffer::SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par,
|
||||
++char_line_count;
|
||||
} else if (c == LyXParagraph::META_INSET) {
|
||||
inset = par->GetInset(i);
|
||||
#ifdef USE_OSTREAM_ONLY
|
||||
inset->Linuxdoc(os);
|
||||
#else
|
||||
string tmp_out;
|
||||
inset->Linuxdoc(tmp_out);
|
||||
os << tmp_out;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
string sgml_string;
|
||||
@ -2887,6 +3448,14 @@ void Buffer::makeDocBookFile(string const & fname, int column)
|
||||
}
|
||||
|
||||
do {
|
||||
#ifdef USE_OSTREAM_ONLY
|
||||
string extra_par;
|
||||
SimpleDocBookOnePar(ofs, extra_par, par, desc_on,
|
||||
depth + 1 + command_depth);
|
||||
par = par->next;
|
||||
DocBookHandleFootnote(ofs, par,
|
||||
depth + 1 + command_depth);
|
||||
#else
|
||||
string tmp_par, extra_par;
|
||||
|
||||
SimpleDocBookOnePar(tmp_par, extra_par, par, desc_on,
|
||||
@ -2896,6 +3465,7 @@ void Buffer::makeDocBookFile(string const & fname, int column)
|
||||
par = par->next;
|
||||
DocBookHandleFootnote(ofs, par,
|
||||
depth + 1 + command_depth);
|
||||
#endif
|
||||
}
|
||||
while(par && par->IsDummy());
|
||||
|
||||
@ -2957,6 +3527,142 @@ void Buffer::makeDocBookFile(string const & fname, int column)
|
||||
}
|
||||
|
||||
|
||||
#ifdef USE_OSTREAM_ONLY
|
||||
void Buffer::SimpleDocBookOnePar(ostream & os, string & extra,
|
||||
LyXParagraph * par, int & desc_on,
|
||||
int const depth)
|
||||
{
|
||||
if (par->table) {
|
||||
par->SimpleDocBookOneTablePar(os, extra, desc_on, depth);
|
||||
return;
|
||||
}
|
||||
LyXFont font1, font2;
|
||||
char c;
|
||||
Inset * inset;
|
||||
LyXParagraph::size_type main_body;
|
||||
int j;
|
||||
//string emph = "emphasis";
|
||||
bool emph_flag = false;
|
||||
int char_line_count = 0;
|
||||
|
||||
LyXLayout const & style = textclasslist.Style(params.textclass,
|
||||
par->GetLayout());
|
||||
|
||||
if (style.labeltype != LABEL_MANUAL)
|
||||
main_body = 0;
|
||||
else
|
||||
main_body = par->BeginningOfMainBody();
|
||||
|
||||
// gets paragraph main font
|
||||
if (main_body > 0)
|
||||
font1 = style.labelfont;
|
||||
else
|
||||
font1 = style.font;
|
||||
|
||||
char_line_count = depth;
|
||||
if(!style.free_spacing)
|
||||
for (j = 0; j < depth; ++j)
|
||||
os << ' ';
|
||||
|
||||
// parsing main loop
|
||||
for (LyXParagraph::size_type i = 0;
|
||||
i < par->size(); ++i) {
|
||||
font2 = par->getFont(i);
|
||||
|
||||
// handle <emphasis> tag
|
||||
if (font1.emph() != font2.emph() && i) {
|
||||
if (font2.emph() == LyXFont::ON) {
|
||||
os << "<emphasis>";
|
||||
emph_flag= true;
|
||||
}else {
|
||||
os << "</emphasis>";
|
||||
emph_flag= false;
|
||||
}
|
||||
}
|
||||
|
||||
c = par->GetChar(i);
|
||||
|
||||
if (c == LyXParagraph::META_INSET) {
|
||||
inset = par->GetInset(i);
|
||||
#ifdef HAVE_SSTREAM
|
||||
ostringstream ost;
|
||||
inset->DocBook(ost);
|
||||
string tmp_out = ost.str().c_str();
|
||||
#else
|
||||
ostrstream ost;
|
||||
inset->DocBook(ost);
|
||||
ost << '\0';
|
||||
char * ctmp = ost.str();
|
||||
string tmp_out(ctmp);
|
||||
delete [] ctmp;
|
||||
#endif
|
||||
//
|
||||
// This code needs some explanation:
|
||||
// Two insets are treated specially
|
||||
// label if it is the first element in a command paragraph
|
||||
// desc_on == 3
|
||||
// graphics inside tables or figure floats can't go on
|
||||
// title (the equivalente in latex for this case is caption
|
||||
// and title should come first
|
||||
// desc_on == 4
|
||||
//
|
||||
if(desc_on!= 3 || i!= 0) {
|
||||
if(!tmp_out.empty() && tmp_out[0] == '@') {
|
||||
if(desc_on == 4)
|
||||
extra += frontStrip(tmp_out, '@');
|
||||
else
|
||||
os << frontStrip(tmp_out, '@');
|
||||
}
|
||||
else
|
||||
os << tmp_out;
|
||||
}
|
||||
} else if (font2.latex() == LyXFont::ON) {
|
||||
// "TeX"-Mode on ==> SGML-Mode on.
|
||||
if (c!= '\0')
|
||||
os << c;
|
||||
++char_line_count;
|
||||
}
|
||||
else {
|
||||
string sgml_string;
|
||||
if (par->linuxDocConvertChar(c, sgml_string)
|
||||
&& !style.free_spacing) { // in freespacing
|
||||
// mode, spaces are
|
||||
// non-breaking characters
|
||||
// char is ' '
|
||||
if (desc_on == 1) {
|
||||
++char_line_count;
|
||||
os << "\n</term><listitem><para>";
|
||||
desc_on = 2;
|
||||
}
|
||||
else {
|
||||
os << c;
|
||||
}
|
||||
}
|
||||
else {
|
||||
os << sgml_string;
|
||||
}
|
||||
}
|
||||
font1 = font2;
|
||||
}
|
||||
|
||||
/* needed if there is an optional argument but no contents */
|
||||
if (main_body > 0 && main_body == par->size()) {
|
||||
font1 = style.font;
|
||||
}
|
||||
if (emph_flag) {
|
||||
os << "</emphasis>";
|
||||
}
|
||||
|
||||
/* resets description flag correctly */
|
||||
switch(desc_on){
|
||||
case 1:
|
||||
/* <term> not closed... */
|
||||
os << "</term>";
|
||||
break;
|
||||
}
|
||||
os << '\n';
|
||||
}
|
||||
#else
|
||||
void Buffer::SimpleDocBookOnePar(string & file, string & extra,
|
||||
LyXParagraph * par, int & desc_on,
|
||||
int const depth)
|
||||
@ -3013,8 +3719,23 @@ void Buffer::SimpleDocBookOnePar(string & file, string & extra,
|
||||
|
||||
if (c == LyXParagraph::META_INSET) {
|
||||
inset = par->GetInset(i);
|
||||
#ifdef USE_OSTREAM_ONLY
|
||||
#ifdef HAVE_SSTREAM
|
||||
ostringstream ost;
|
||||
inset->DocBook(ost);
|
||||
string tmp_out = ost.str().c_str();
|
||||
#else
|
||||
ostrstream ost;
|
||||
inset->DocBook(ost);
|
||||
ost << '\0';
|
||||
char * ctmp = ost.str();
|
||||
string tmp_out(ctmp);
|
||||
delete [] ctmp;
|
||||
#endif
|
||||
#else
|
||||
string tmp_out;
|
||||
inset->DocBook(tmp_out);
|
||||
#endif
|
||||
//
|
||||
// This code needs some explanation:
|
||||
// Two insets are treated specially
|
||||
@ -3082,6 +3803,7 @@ void Buffer::SimpleDocBookOnePar(string & file, string & extra,
|
||||
}
|
||||
file += '\n';
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int Buffer::runLaTeX()
|
||||
|
@ -357,10 +357,17 @@ private:
|
||||
///
|
||||
void SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par,
|
||||
int desc_on, int const depth);
|
||||
#ifdef USE_OSTREAM_ONLY
|
||||
///
|
||||
void SimpleDocBookOnePar(ostream &, string & extra,
|
||||
LyXParagraph * par, int & desc_on,
|
||||
int const depth);
|
||||
#else
|
||||
///
|
||||
void SimpleDocBookOnePar(string & file, string & extra,
|
||||
LyXParagraph * par, int & desc_on,
|
||||
int const depth);
|
||||
#endif
|
||||
|
||||
/// LinuxDoc.
|
||||
void push_tag(ostream & os, char const * tag,
|
||||
|
@ -1209,7 +1209,6 @@ int InsetFig::Latex(string & file, signed char /* fragile*/ ) const
|
||||
file += cmd + ' ';
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int InsetFig::Linuxdoc(string &/*file*/) const
|
||||
@ -1229,6 +1228,26 @@ int InsetFig::DocBook(string & file) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int InsetFig::Linuxdoc(ostream &) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetFig::DocBook(ostream & os) const
|
||||
{
|
||||
string figurename = fname;
|
||||
|
||||
if(suffixIs(figurename, ".eps"))
|
||||
figurename.erase(fname.length() - 5);
|
||||
|
||||
os << "@<graphic fileref=\"" << figurename << "\"></graphic>";
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void InsetFig::Validate(LaTeXFeatures & features) const
|
||||
{
|
||||
|
@ -42,11 +42,16 @@ public:
|
||||
#ifndef USE_OSTREAM_ONLY
|
||||
///
|
||||
int Latex(string & file, signed char fragile) const;
|
||||
#endif
|
||||
///
|
||||
int Linuxdoc(string & file) const;
|
||||
///
|
||||
int DocBook(string & file) const;
|
||||
#else
|
||||
///
|
||||
int Linuxdoc(ostream &) const;
|
||||
///
|
||||
int DocBook(ostream &) const;
|
||||
#endif
|
||||
/// Updates needed features for this inset.
|
||||
void Validate(LaTeXFeatures & features) const;
|
||||
|
||||
|
@ -110,8 +110,7 @@ void UpdatableInset::ToggleInsetCursor(BufferView *)
|
||||
|
||||
void UpdatableInset::Edit(BufferView * bv, int, int, unsigned int)
|
||||
{
|
||||
LyXFont
|
||||
font;
|
||||
LyXFont font;
|
||||
|
||||
scx = 0;
|
||||
|
||||
@ -132,6 +131,7 @@ void UpdatableInset::SetFont(BufferView *, LyXFont const &, bool )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// An updatable inset could handle lyx editing commands
|
||||
#ifdef SCROLL_INSET
|
||||
UpdatableInset::RESULT
|
||||
|
@ -239,6 +239,15 @@ void InsetBibKey::setCounter(int c)
|
||||
// of time cause LyX3 won't use lyxlex anyway. (ale)
|
||||
void InsetBibKey::Write(ostream & os) const
|
||||
{
|
||||
#ifdef USE_OSTREAM_ONLY
|
||||
os << "\\bibitem ";
|
||||
if (!options.empty()) {
|
||||
os << '['
|
||||
<< options << ']';
|
||||
}
|
||||
os << '{'
|
||||
<< contents << "}\n";
|
||||
#else
|
||||
string s;
|
||||
if (!options.empty()) {
|
||||
s += '[';
|
||||
@ -247,6 +256,7 @@ void InsetBibKey::Write(ostream & os) const
|
||||
s += '{';
|
||||
s += contents + '}';
|
||||
os << "\\bibitem " << s << "\n";
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -257,7 +257,6 @@ int InsetCommand::Latex(string & file, signed char /*fragile*/) const
|
||||
file += getCommand();
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int InsetCommand::Linuxdoc(string &/*file*/) const
|
||||
@ -271,6 +270,20 @@ int InsetCommand::DocBook(string &/*file*/) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int InsetCommand::Linuxdoc(ostream &) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetCommand::DocBook(ostream &) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Inset * InsetCommand::Clone() const
|
||||
{
|
||||
|
@ -51,11 +51,16 @@ public:
|
||||
#ifndef USE_OSTREAM_ONLY
|
||||
///
|
||||
virtual int Latex(string & file, signed char fragile) const;
|
||||
#endif
|
||||
///
|
||||
virtual int Linuxdoc(string & file) const;
|
||||
///
|
||||
virtual int DocBook(string & file) const;
|
||||
#else
|
||||
///
|
||||
virtual int Linuxdoc(ostream &) const;
|
||||
///
|
||||
virtual int DocBook(ostream &) const;
|
||||
#endif
|
||||
///
|
||||
Inset * Clone() const;
|
||||
///
|
||||
|
@ -112,7 +112,6 @@ int InsetError::Latex(string &, signed char /*fragile*/) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int InsetError::Linuxdoc(string &) const
|
||||
@ -126,6 +125,20 @@ int InsetError::DocBook(string &) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int InsetError::Linuxdoc(ostream &) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetError::DocBook(ostream &) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
bool InsetError::AutoDelete() const
|
||||
{
|
||||
|
@ -51,11 +51,16 @@ public:
|
||||
#ifndef USE_OSTREAM_ONLY
|
||||
///
|
||||
int Latex(string & file, signed char fragile) const;
|
||||
#endif
|
||||
///
|
||||
int Linuxdoc(string & file) const;
|
||||
///
|
||||
int DocBook(string & file) const;
|
||||
#else
|
||||
///
|
||||
int Linuxdoc(ostream &) const;
|
||||
///
|
||||
int DocBook(ostream &) const;
|
||||
#endif
|
||||
///
|
||||
bool AutoDelete() const;
|
||||
/// what appears in the minibuffer when opening
|
||||
|
@ -230,7 +230,6 @@ int InsetGraphics::Latex(string & /*file*/, signed char /*fragile*/) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int InsetGraphics::Linuxdoc(string & /*file*/) const
|
||||
@ -244,6 +243,20 @@ int InsetGraphics::DocBook(string & /*file*/) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int InsetGraphics::Linuxdoc(ostream &) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetGraphics::DocBook(ostream &) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void InsetGraphics::Validate(LaTeXFeatures & /*features*/) const
|
||||
{
|
||||
|
@ -49,11 +49,16 @@ public:
|
||||
#ifndef USE_OSTREAM_ONLY
|
||||
///
|
||||
int Latex(string & file, signed char fragile) const;
|
||||
#endif
|
||||
///
|
||||
int Linuxdoc(string & /*file*/) const;
|
||||
///
|
||||
int DocBook(string & /*file*/) const;
|
||||
#else
|
||||
///
|
||||
int Linuxdoc(ostream &) const;
|
||||
///
|
||||
int DocBook(ostream &) const;
|
||||
#endif
|
||||
/// Updates needed features for this inset.
|
||||
void Validate(LaTeXFeatures & features) const;
|
||||
|
||||
|
@ -137,7 +137,6 @@ int InsetInfo::Latex(string &, signed char /*fragile*/) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int InsetInfo::Linuxdoc(string &) const
|
||||
@ -151,6 +150,20 @@ int InsetInfo::DocBook(string &) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int InsetInfo::Linuxdoc(ostream &) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetInfo::DocBook(ostream &) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
unsigned char InsetInfo::Editable() const
|
||||
{
|
||||
|
@ -53,11 +53,16 @@ public:
|
||||
#ifndef USE_OSTREAM_ONLY
|
||||
///
|
||||
int Latex(string & file, signed char fragile) const;
|
||||
#endif
|
||||
///
|
||||
int Linuxdoc(string & file) const;
|
||||
///
|
||||
int DocBook(string & file) const;
|
||||
#else
|
||||
///
|
||||
int Linuxdoc(ostream &) const;
|
||||
///
|
||||
int DocBook(ostream &) const;
|
||||
#endif
|
||||
/// what appears in the minibuffer when opening
|
||||
const char * EditMessage() const {return _("Opened note");}
|
||||
///
|
||||
|
@ -56,7 +56,6 @@ int InsetLabel::Latex(string & file, signed char /*fragile*/) const
|
||||
file += escape(getCommand());
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int InsetLabel::Linuxdoc(string & file) const
|
||||
@ -72,6 +71,24 @@ int InsetLabel::DocBook(string & file) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int InsetLabel::Linuxdoc(ostream & os) const
|
||||
{
|
||||
os << "<label id=\"" << getContents() << "\" >";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetLabel::DocBook(ostream & os) const
|
||||
{
|
||||
os << "<anchor id=\"" << getContents() << "\" >";
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
// This function escapes 8-bit characters and other problematic characters
|
||||
// It's exactly the same code as in insetref.C.
|
||||
|
@ -43,11 +43,16 @@ public:
|
||||
#ifndef USE_OSTREAM_ONLY
|
||||
///
|
||||
int Latex(string & file, signed char fragile) const;
|
||||
#endif
|
||||
///
|
||||
int Linuxdoc(string & file) const;
|
||||
///
|
||||
int DocBook(string & file) const;
|
||||
#else
|
||||
///
|
||||
int Linuxdoc(ostream &) const;
|
||||
///
|
||||
int DocBook(ostream &) const;
|
||||
#endif
|
||||
private:
|
||||
/// This function escapes 8-bit characters
|
||||
string escape(string const &) const;
|
||||
|
@ -758,7 +758,6 @@ int InsetLatexAccent::Latex(string & file, signed char /*fragile*/) const
|
||||
file += contents;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int InsetLatexAccent::Linuxdoc(string & file) const
|
||||
@ -774,6 +773,22 @@ int InsetLatexAccent::DocBook(string & file) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int InsetLatexAccent::Linuxdoc(ostream & os) const
|
||||
{
|
||||
os << contents;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetLatexAccent::DocBook(ostream & os) const
|
||||
{
|
||||
os << contents;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
bool InsetLatexAccent::Deletable() const
|
||||
{
|
||||
|
@ -57,11 +57,16 @@ public:
|
||||
#ifndef USE_OSTREAM_ONLY
|
||||
///
|
||||
int Latex(string & file, signed char fragile) const;
|
||||
#endif
|
||||
///
|
||||
int Linuxdoc(string & file) const;
|
||||
///
|
||||
int DocBook(string & file) const;
|
||||
#else
|
||||
///
|
||||
int Linuxdoc(ostream &) const;
|
||||
///
|
||||
int DocBook(ostream &) const;
|
||||
#endif
|
||||
///
|
||||
bool Deletable() const;
|
||||
///
|
||||
|
@ -304,7 +304,6 @@ int InsetQuotes::Latex(string & file, signed char /*fragile*/) const
|
||||
file += qstr;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int InsetQuotes::Linuxdoc(string & file) const
|
||||
@ -331,6 +330,32 @@ int InsetQuotes::DocBook(string & file) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int InsetQuotes::Linuxdoc(ostream & os) const
|
||||
{
|
||||
os << "\"";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetQuotes::DocBook(ostream & os) const
|
||||
{
|
||||
if(times == InsetQuotes::DoubleQ) {
|
||||
if (side == InsetQuotes::LeftQ)
|
||||
os << "“";
|
||||
else
|
||||
os << "”";
|
||||
} else {
|
||||
if (side == InsetQuotes::LeftQ)
|
||||
os << "‘";
|
||||
else
|
||||
os << "’";
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void InsetQuotes::Validate(LaTeXFeatures & features) const
|
||||
{
|
||||
|
@ -89,11 +89,16 @@ public:
|
||||
#ifndef USE_OSTREAM_ONLY
|
||||
///
|
||||
int Latex(string & file, signed char fragile) const;
|
||||
#endif
|
||||
///
|
||||
int Linuxdoc(string & file) const;
|
||||
///
|
||||
int DocBook(string & file) const;
|
||||
#else
|
||||
///
|
||||
int Linuxdoc(ostream &) const;
|
||||
///
|
||||
int DocBook(ostream &) const;
|
||||
#endif
|
||||
///
|
||||
void Validate(LaTeXFeatures &) const;
|
||||
///
|
||||
|
@ -94,7 +94,6 @@ int InsetRef::Latex(string & file, signed char /*fragile*/) const
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int InsetRef::Linuxdoc(string & file) const
|
||||
@ -114,6 +113,24 @@ int InsetRef::DocBook(string & file) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int InsetRef::Linuxdoc(ostream & os) const
|
||||
{
|
||||
os << "<ref id=\"" << getContents()
|
||||
<< "\" name=\"" << getOptions() << "\" >";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetRef::DocBook(ostream & os) const
|
||||
{
|
||||
os << "<link linkend=\"" << getContents()
|
||||
<< "\">" << getOptions() << "</link>";
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// This function escapes 8-bit characters and other problematic characters
|
||||
// It's exactly the same code as in insetlabel.C.
|
||||
|
@ -65,11 +65,16 @@ public:
|
||||
#ifndef USE_OSTREAM_ONLY
|
||||
///
|
||||
int Latex(string & file, signed char fragile) const;
|
||||
#endif
|
||||
///
|
||||
int Linuxdoc(string & file) const;
|
||||
///
|
||||
int DocBook(string & file) const;
|
||||
#else
|
||||
///
|
||||
int Linuxdoc(ostream &) const;
|
||||
///
|
||||
int DocBook(ostream &) const;
|
||||
#endif
|
||||
private:
|
||||
/// This function escapes 8-bit characters
|
||||
string escape(string const &) const;
|
||||
|
@ -220,7 +220,6 @@ int InsetSpecialChar::Latex(string & file, signed char /*fragile*/) const
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int InsetSpecialChar::Linuxdoc(string & file) const
|
||||
@ -248,6 +247,34 @@ int InsetSpecialChar::DocBook(string & file) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int InsetSpecialChar::Linuxdoc(ostream & os) const
|
||||
{
|
||||
switch (kind) {
|
||||
case HYPHENATION: os << ""; break;
|
||||
case END_OF_SENTENCE: os << ""; break;
|
||||
case LDOTS: os << "..."; break;
|
||||
case MENU_SEPARATOR: os << "->"; break;
|
||||
case PROTECTED_SEPARATOR: os << " "; break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetSpecialChar::DocBook(ostream & os) const
|
||||
{
|
||||
switch (kind) {
|
||||
case HYPHENATION: os << ""; break;
|
||||
case END_OF_SENTENCE: os << ""; break;
|
||||
case LDOTS: os << "..."; break;
|
||||
case MENU_SEPARATOR: os << "->"; break;
|
||||
case PROTECTED_SEPARATOR: os << " "; break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Inset * InsetSpecialChar::Clone() const
|
||||
{
|
||||
|
@ -63,11 +63,16 @@ public:
|
||||
#ifndef USE_OSTREAM_ONLY
|
||||
///
|
||||
int Latex(string & file, signed char fragile) const;
|
||||
#endif
|
||||
///
|
||||
int Linuxdoc(string & file) const;
|
||||
///
|
||||
int DocBook(string & file) const;
|
||||
#else
|
||||
///
|
||||
int Linuxdoc(ostream &) const;
|
||||
///
|
||||
int DocBook(ostream &) const;
|
||||
#endif
|
||||
///
|
||||
Inset * Clone() const;
|
||||
///
|
||||
|
@ -199,7 +199,7 @@ void InsetText::draw(Painter & pain, LyXFont const & f,
|
||||
int baseline, float & x) const
|
||||
{
|
||||
// if (init_inset) {
|
||||
computeTextRows(pain);
|
||||
computeTextRows(pain, x);
|
||||
// init_inset = false;
|
||||
// }
|
||||
UpdatableInset::draw(pain, f, baseline, x);
|
||||
@ -208,7 +208,7 @@ void InsetText::draw(Painter & pain, LyXFont const & f,
|
||||
top_x = int(x);
|
||||
top_baseline = baseline;
|
||||
computeBaselines(baseline);
|
||||
for(unsigned int r = 0; r < rows.size() - 1; ++r) {
|
||||
for(RowList::size_type r = 0; r < rows.size() - 1; ++r) {
|
||||
drawRowSelection(pain, rows[r].pos, rows[r + 1].pos, r,
|
||||
rows[r].baseline, x);
|
||||
drawRowText(pain, rows[r].pos, rows[r + 1].pos, rows[r].baseline, x);
|
||||
@ -600,10 +600,8 @@ InsetText::LocalDispatch(BufferView * bv,
|
||||
int InsetText::Latex(ostream & os, signed char /*fragile*/) const
|
||||
{
|
||||
#ifdef USE_OSTREAM_ONLY
|
||||
string fstr;
|
||||
TexRow texrow;
|
||||
int ret = par->SimpleTeXOnePar(fstr, texrow);
|
||||
os << fstr;
|
||||
int ret = par->SimpleTeXOnePar(os, texrow);
|
||||
return ret;
|
||||
#else
|
||||
string fstr;
|
||||
@ -1050,7 +1048,29 @@ void InsetText::SetCharFont(int pos, LyXFont const & f)
|
||||
}
|
||||
|
||||
|
||||
void InsetText::computeTextRows(Painter & pain) const
|
||||
// Ok, Jürgen. Here is my small secret message to you. As you can see I
|
||||
// played a bit witht he Textinset. (But only through the InsetERT so far).
|
||||
// As you can see below I have changed the code to use max/min instead of
|
||||
// the if < construct, imo this makes it faster and easier to read. I have
|
||||
// also changed rows[rows.size() - 1] to rows.back() makes it clearer that
|
||||
// we speak about the last element in the vector. I added a second arg to
|
||||
// to this func as well. This makes it possible to take the position of the
|
||||
// inset into account when drawing the inset, this is especially needed when
|
||||
// the ERT inset is first in a paragraph. I am not sure, but this might have
|
||||
// made short ERT (less than one line, just a couple of words) draw
|
||||
// incorrectly. You should perhaps have a look yourselves at this.
|
||||
// Also (phu...) I use pain to get at paperWidth().
|
||||
// This is beginning to look like a very nice Inset (speaking of the ERT
|
||||
// inset that is), but in afterthought, do we really need it? Wouldn't a
|
||||
// non dynamic inset working in the same way as the floats be more usefull
|
||||
// and easier to work with? Jean-Marc has already aired this thought.
|
||||
// I tested also a bit on the raw insettext, it seems that it can't break
|
||||
// over several lines properly. Other than that it seems to create the basis
|
||||
// for insetfloat, insetmarginal and insetfoot just fine. How about a
|
||||
// updatable inset that does not open, unless you click on it? uff... I just
|
||||
// ramble on. Feel free to remove my comments after you have read them.
|
||||
// Lgb
|
||||
void InsetText::computeTextRows(Painter & pain, float x) const
|
||||
{
|
||||
int p,
|
||||
nwp = 0,
|
||||
@ -1064,7 +1084,8 @@ void InsetText::computeTextRows(Painter & pain) const
|
||||
row_struct row;
|
||||
|
||||
if (rows.size())
|
||||
rows.erase(rows.begin(),rows.end());
|
||||
rows.clear();
|
||||
//rows.erase(rows.begin(),rows.end());
|
||||
int width = wordAscent = wordDescent = 0;
|
||||
insetWidth = maxAscent = maxDescent = 0;
|
||||
row.asc = 0;
|
||||
@ -1076,10 +1097,12 @@ void InsetText::computeTextRows(Painter & pain) const
|
||||
for(p = 0; p < par->Last(); ++p) {
|
||||
insetWidth += SingleWidth(pain, par, p);
|
||||
SingleHeight(pain, par, p, asc, desc);
|
||||
if (asc > maxAscent)
|
||||
maxAscent = asc;
|
||||
if (desc > maxDescent)
|
||||
maxDescent = desc;
|
||||
maxAscent = max(maxAscent, asc);
|
||||
//if (asc > maxAscent)
|
||||
//maxAscent = asc;
|
||||
maxDescent = max(maxDescent, desc);
|
||||
//if (desc > maxDescent)
|
||||
//maxDescent = desc;
|
||||
}
|
||||
rows[0].asc = maxAscent;
|
||||
rows[0].desc = maxDescent;
|
||||
@ -1091,112 +1114,127 @@ void InsetText::computeTextRows(Painter & pain) const
|
||||
|
||||
bool is_first_word_in_row = true;
|
||||
|
||||
int cw,
|
||||
lastWordWidth = 0;
|
||||
int cw, lastWordWidth = 0;
|
||||
|
||||
maxWidth = buffer->getUser()->paperWidth();
|
||||
//maxWidth = buffer->getUser()->paperWidth();
|
||||
maxWidth = pain.paperWidth();
|
||||
for(p = 0; p < par->Last(); ++p) {
|
||||
cw = SingleWidth(pain, par, p);
|
||||
width += cw;
|
||||
lastWordWidth += cw;
|
||||
SingleHeight(pain, par, p, asc, desc);
|
||||
if (asc > wordAscent)
|
||||
wordAscent = asc;
|
||||
if (desc > wordDescent)
|
||||
wordDescent = desc;
|
||||
wordAscent = max(wordAscent, asc);
|
||||
//if (asc > wordAscent)
|
||||
// wordAscent = asc;
|
||||
wordDescent = max(wordDescent, desc);
|
||||
//if (desc > wordDescent)
|
||||
// wordDescent = desc;
|
||||
Inset const * inset = 0;
|
||||
if (((p + 1) < par->Last()) &&
|
||||
(par->GetChar(p + 1)==LyXParagraph::META_INSET))
|
||||
inset = par->GetInset(p + 1);
|
||||
if (inset && inset->display()) {
|
||||
if (!is_first_word_in_row && (width >= maxWidth)) {
|
||||
if (!is_first_word_in_row && (width >= maxWidth - x)) {
|
||||
// we have to split also the row above
|
||||
rows[rows.size() - 1].asc = oasc;
|
||||
rows[rows.size() - 1].desc = odesc;
|
||||
rows.back().asc = oasc;
|
||||
rows.back().desc = odesc;
|
||||
row.pos = nwp;
|
||||
rows.push_back(row);
|
||||
oasc = wordAscent;
|
||||
odesc = wordDescent;
|
||||
if (insetWidth < owidth)
|
||||
insetWidth = owidth;
|
||||
insetWidth = max(insetWidth, owidth);
|
||||
//if (insetWidth < owidth)
|
||||
// insetWidth = owidth;
|
||||
width = lastWordWidth;
|
||||
lastWordWidth = 0;
|
||||
} else {
|
||||
if (oasc < wordAscent)
|
||||
oasc = wordAscent;
|
||||
if (odesc < wordDescent)
|
||||
odesc = wordDescent;
|
||||
oasc = max(oasc, wordAscent);
|
||||
//if (oasc < wordAscent)
|
||||
//oasc = wordAscent;
|
||||
odesc = max(odesc, wordDescent);
|
||||
//if (odesc < wordDescent)
|
||||
//odesc = wordDescent;
|
||||
}
|
||||
rows[rows.size() - 1].asc = oasc;
|
||||
rows[rows.size() - 1].desc = odesc;
|
||||
rows.back().asc = oasc;
|
||||
rows.back().desc = odesc;
|
||||
row.pos = ++p;
|
||||
rows.push_back(row);
|
||||
SingleHeight(pain, par, p, asc, desc);
|
||||
rows[rows.size() - 1].asc = asc;
|
||||
rows[rows.size() - 1].desc = desc;
|
||||
rows.back().asc = asc;
|
||||
rows.back().desc = desc;
|
||||
row.pos = nwp = p + 1;
|
||||
rows.push_back(row);
|
||||
oasc = odesc = width = lastWordWidth = 0;
|
||||
is_first_word_in_row = true;
|
||||
wordAscent = wordDescent = 0;
|
||||
x = 0.0;
|
||||
continue;
|
||||
} else if (par->IsSeparator(p)) {
|
||||
if (width >= maxWidth) {
|
||||
if (width >= maxWidth - x) {
|
||||
if (is_first_word_in_row) {
|
||||
rows[rows.size() - 1].asc = wordAscent;
|
||||
rows[rows.size() - 1].desc = wordDescent;
|
||||
rows.back().asc = wordAscent;
|
||||
rows.back().desc = wordDescent;
|
||||
row.pos = p + 1;
|
||||
rows.push_back(row);
|
||||
oasc = odesc = width = 0;
|
||||
} else {
|
||||
rows[rows.size() - 1].asc = oasc;
|
||||
rows[rows.size() - 1].desc = odesc;
|
||||
rows.back().asc = oasc;
|
||||
rows.back().desc = odesc;
|
||||
row.pos = nwp;
|
||||
rows.push_back(row);
|
||||
oasc = wordAscent;
|
||||
odesc = wordDescent;
|
||||
if (insetWidth < owidth)
|
||||
insetWidth = owidth;
|
||||
insetWidth = max(insetWidth, owidth);
|
||||
//if (insetWidth < owidth)
|
||||
//insetWidth = owidth;
|
||||
width = lastWordWidth;
|
||||
}
|
||||
wordAscent = wordDescent = lastWordWidth = 0;
|
||||
nwp = p + 1;
|
||||
x = 0.0;
|
||||
continue;
|
||||
}
|
||||
owidth = width;
|
||||
if (oasc < wordAscent)
|
||||
oasc = wordAscent;
|
||||
if (odesc < wordDescent)
|
||||
odesc = wordDescent;
|
||||
oasc = max(oasc, wordAscent);
|
||||
//if (oasc < wordAscent)
|
||||
//oasc = wordAscent;
|
||||
odesc = max(odesc, wordDescent);
|
||||
//if (odesc < wordDescent)
|
||||
//odesc = wordDescent;
|
||||
wordAscent = wordDescent = lastWordWidth = 0;
|
||||
nwp = p + 1;
|
||||
is_first_word_in_row = false;
|
||||
}
|
||||
x = 0.0;
|
||||
}
|
||||
// if we have some data in the paragraph we have ascent/descent
|
||||
if (p) {
|
||||
if (width >= maxWidth) {
|
||||
// assign upper row
|
||||
rows[rows.size() - 1].asc = oasc;
|
||||
rows[rows.size() - 1].desc = odesc;
|
||||
rows.back().asc = oasc;
|
||||
rows.back().desc = odesc;
|
||||
// assign and allocate lower row
|
||||
row.pos = nwp;
|
||||
rows.push_back(row);
|
||||
rows[rows.size() - 1].asc = wordAscent;
|
||||
rows[rows.size() - 1].desc = wordDescent;
|
||||
if (insetWidth < owidth)
|
||||
insetWidth = owidth;
|
||||
rows.back().asc = wordAscent;
|
||||
rows.back().desc = wordDescent;
|
||||
insetWidth = max(insetWidth, owidth);
|
||||
//if (insetWidth < owidth)
|
||||
//insetWidth = owidth;
|
||||
width -= owidth;
|
||||
if (insetWidth < width)
|
||||
insetWidth = width;
|
||||
insetWidth = max(insetWidth, width);
|
||||
//if (insetWidth < width)
|
||||
//insetWidth = width;
|
||||
} else {
|
||||
// assign last row data
|
||||
if (oasc < wordAscent)
|
||||
oasc = wordAscent;
|
||||
if (odesc < wordDescent)
|
||||
odesc = wordDescent;
|
||||
rows[rows.size() - 1].asc = oasc;
|
||||
rows[rows.size() - 1].desc = odesc;
|
||||
oasc = max(oasc, wordAscent);
|
||||
//if (oasc < wordAscent)
|
||||
//oasc = wordAscent;
|
||||
odesc = min(odesc, wordDescent);
|
||||
//if (odesc < wordDescent)
|
||||
//odesc = wordDescent;
|
||||
rows.back().asc = oasc;
|
||||
rows.back().desc = odesc;
|
||||
}
|
||||
}
|
||||
// alocate a dummy row for the endpos
|
||||
@ -1205,9 +1243,10 @@ void InsetText::computeTextRows(Painter & pain) const
|
||||
// calculate maxAscent/Descent
|
||||
maxAscent = rows[0].asc;
|
||||
maxDescent = rows[0].desc;
|
||||
for (unsigned int i = 1; i < rows.size() - 1; ++i) {
|
||||
for (RowList::size_type i = 1; i < rows.size() - 1; ++i) {
|
||||
maxDescent += rows[i].asc + rows[i].desc + interline_space;
|
||||
}
|
||||
lyxerr << "Rows: " << rows.size() << endl;
|
||||
#if 0
|
||||
if (the_locking_inset) {
|
||||
computeBaselines(top_baseline);
|
||||
|
@ -84,11 +84,16 @@ public:
|
||||
#ifndef USE_OSTREAM_ONLY
|
||||
///
|
||||
int Latex(string &, signed char) const;
|
||||
#endif
|
||||
///
|
||||
int Linuxdoc(string &) const { return 0; }
|
||||
///
|
||||
int DocBook(string &) const { return 0; }
|
||||
#else
|
||||
///
|
||||
int Linuxdoc(ostream &) const { return 0; }
|
||||
///
|
||||
int DocBook(ostream &) const { return 0; }
|
||||
#endif
|
||||
///
|
||||
void Validate(LaTeXFeatures & features) const;
|
||||
///
|
||||
@ -147,7 +152,7 @@ private:
|
||||
void drawRowText(Painter &, int startpos, int endpos, int baseline,
|
||||
float x) const;
|
||||
///
|
||||
void computeTextRows(Painter &) const;
|
||||
void computeTextRows(Painter &, float x = 0.0) const;
|
||||
///
|
||||
void computeBaselines(int) const;
|
||||
///
|
||||
|
@ -17,6 +17,7 @@ void InsetTOC::Edit(BufferView * bv, int, int, unsigned int)
|
||||
bv->owner()->getLyXFunc()->Dispatch(LFUN_TOCVIEW);
|
||||
}
|
||||
|
||||
#ifndef USE_OSTREAM_ONLY
|
||||
int InsetTOC::Linuxdoc(string & file) const
|
||||
{
|
||||
file += "<toc>";
|
||||
@ -29,3 +30,19 @@ int InsetTOC::DocBook(string & file) const
|
||||
file += "<toc></toc>";
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int InsetTOC::Linuxdoc(ostream & os) const
|
||||
{
|
||||
os << "<toc>";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetTOC::DocBook(ostream & os) const
|
||||
{
|
||||
os << "<toc></toc>";
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -43,10 +43,17 @@ public:
|
||||
bool display() const { return true; }
|
||||
///
|
||||
Inset::Code LyxCode() const { return Inset::TOC_CODE; }
|
||||
#ifdef USE_OSTREAM_ONLY
|
||||
///
|
||||
int Linuxdoc(ostream &) const;
|
||||
///
|
||||
int DocBook(ostream &) const;
|
||||
#else
|
||||
///
|
||||
int Linuxdoc(string & file) const;
|
||||
///
|
||||
int DocBook(string & file) const;
|
||||
#endif
|
||||
private:
|
||||
///
|
||||
Buffer * owner;
|
||||
|
@ -197,7 +197,6 @@ int InsetUrl::Latex(string & file, signed char fragile) const
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int InsetUrl::Linuxdoc(string & file) const
|
||||
@ -218,6 +217,26 @@ int InsetUrl::DocBook(string & file) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int InsetUrl::Linuxdoc(ostream & os) const
|
||||
{
|
||||
os << "<" << getCmdName()
|
||||
<< " url=\"" << getContents() << "\""
|
||||
<< " name=\"" << getOptions() << "\">";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetUrl::DocBook(ostream & os) const
|
||||
{
|
||||
os << "<ulink url=\"" << getContents() << "\">"
|
||||
<< getOptions() << "</ulink>";
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void InsetUrl::Validate(LaTeXFeatures & features) const
|
||||
{
|
||||
|
@ -74,11 +74,16 @@ public:
|
||||
#ifndef USE_OSTREAM_ONLY
|
||||
///
|
||||
int Latex(string & file, signed char fragile) const;
|
||||
#endif
|
||||
///
|
||||
int Linuxdoc(string & file) const;
|
||||
///
|
||||
int DocBook(string & file) const;
|
||||
#else
|
||||
///
|
||||
int Linuxdoc(ostream &) const;
|
||||
///
|
||||
int DocBook(ostream &) const;
|
||||
#endif
|
||||
///
|
||||
static void CloseUrlCB(FL_OBJECT *, long data);
|
||||
private:
|
||||
|
@ -118,11 +118,16 @@ public:
|
||||
#ifndef USE_OSTREAM_ONLY
|
||||
///
|
||||
virtual int Latex(string & file, signed char fragile) const = 0;
|
||||
#endif
|
||||
///
|
||||
virtual int Linuxdoc(string & /*file*/) const = 0;
|
||||
///
|
||||
virtual int DocBook(string & /*file*/) const = 0;
|
||||
#else
|
||||
///
|
||||
virtual int Linuxdoc(ostream &) const = 0;
|
||||
///
|
||||
virtual int DocBook(ostream &) const = 0;
|
||||
#endif
|
||||
/// Updates needed features for this inset.
|
||||
virtual void Validate(LaTeXFeatures & features) const;
|
||||
///
|
||||
@ -203,7 +208,7 @@ public:
|
||||
|
||||
/// To convert old binary dispatch results
|
||||
RESULT DISPATCH_RESULT(bool b) {
|
||||
return (b) ? DISPATCHED: FINISHED;
|
||||
return b ? DISPATCHED : FINISHED;
|
||||
}
|
||||
|
||||
///
|
||||
@ -234,7 +239,8 @@ public:
|
||||
virtual void draw(Painter &, LyXFont const &,
|
||||
int baseline, float & x) const;
|
||||
///
|
||||
virtual void SetFont(BufferView *, LyXFont const &, bool toggleall=false);
|
||||
virtual void SetFont(BufferView *, LyXFont const &,
|
||||
bool toggleall = false);
|
||||
///
|
||||
virtual bool InsertInset(BufferView *, Inset *) { return false; }
|
||||
///
|
||||
|
@ -2313,7 +2313,7 @@ void Free()
|
||||
extern "C" void TimerCB(FL_OBJECT *, long)
|
||||
{
|
||||
// only if the form still exists
|
||||
if (fd_form_title->form_title != 0) {
|
||||
if (lyxrc->show_banner && fd_form_title->form_title != 0) {
|
||||
if (fd_form_title->form_title->visible) {
|
||||
fl_hide_form(fd_form_title->form_title);
|
||||
}
|
||||
@ -3542,6 +3542,7 @@ extern "C" void RefHideCB(FL_OBJECT *, long)
|
||||
fl_hide_form(fd_form_ref->form_ref);
|
||||
}
|
||||
|
||||
#ifndef USE_OSTREAM_ONLY
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning UGLY!!
|
||||
#endif
|
||||
@ -3554,3 +3555,4 @@ void addNewlineAndDepth(string & file, int depth)
|
||||
file += '\n';
|
||||
file.append(depth, ' ');
|
||||
}
|
||||
#endif
|
||||
|
@ -300,6 +300,7 @@ void LyXGUI::create_forms()
|
||||
//
|
||||
|
||||
// the title form
|
||||
if (lyxrc->show_banner) {
|
||||
fd_form_title = create_form_form_title();
|
||||
fl_set_form_dblbuffer(fd_form_title->form_title, 1); // use dbl buffer
|
||||
fl_set_form_atclose(fd_form_title->form_title, CancelCloseBoxCB, 0);
|
||||
@ -335,6 +336,7 @@ void LyXGUI::create_forms()
|
||||
fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
|
||||
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
|
||||
fl_end_form();
|
||||
}
|
||||
|
||||
// the paragraph form
|
||||
fd_form_paragraph = create_form_form_paragraph();
|
||||
@ -558,15 +560,19 @@ void LyXGUI::create_forms()
|
||||
// Did we get a valid position?
|
||||
if (xpos>= 0 && ypos>= 0) {
|
||||
lyxViews->setPosition(xpos, ypos);
|
||||
if (lyxrc->show_banner) {
|
||||
// show the title form in the middle of the main form
|
||||
fl_set_form_position(fd_form_title->form_title,
|
||||
abs(xpos + (width/2) - (370 / 2)),
|
||||
abs(ypos + (height/2) - (290 / 2)));
|
||||
// The use of abs() above is a trick to ensure valid positions
|
||||
main_placement = FL_PLACE_POSITION;
|
||||
title_placement = FL_PLACE_GEOMETRY;
|
||||
// The use of abs() above is a trick to ensure
|
||||
// valid positions
|
||||
}
|
||||
main_placement = FL_PLACE_POSITION;
|
||||
}
|
||||
lyxViews->show(main_placement, FL_FULLBORDER, "LyX");
|
||||
if (lyxrc->show_banner) {
|
||||
fl_show_form(fd_form_title->form_title,
|
||||
title_placement, FL_NOBORDER,
|
||||
_("LyX Banner"));
|
||||
@ -576,6 +582,7 @@ void LyXGUI::create_forms()
|
||||
// Show the title form at most 7 secs (lowered from 10 secs)
|
||||
fl_set_timer(fd_form_title->timer_title, 7);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LyXGUI::runTime()
|
||||
|
160
src/lyxfont.C
160
src/lyxfont.C
@ -663,6 +663,91 @@ void LyXFont::lyxWriteChanges(LyXFont const & orgfont, ostream & os) const
|
||||
|
||||
/// Writes the head of the LaTeX needed to impose this font
|
||||
// Returns number of chars written.
|
||||
#ifdef USE_OSTREAM_ONLY
|
||||
int LyXFont::latexWriteStartChanges(ostream & os, LyXFont const & base,
|
||||
LyXFont const & prev) const
|
||||
{
|
||||
LyXFont f = *this;
|
||||
f.reduce(base);
|
||||
|
||||
if (f.bits == inherit)
|
||||
return 0;
|
||||
|
||||
int count = 0;
|
||||
bool env = false;
|
||||
|
||||
FONT_DIRECTION direction = f.direction();
|
||||
if (direction != prev.direction()) {
|
||||
if (direction == LTR_DIR) {
|
||||
os << "\\L{";
|
||||
count += 3;
|
||||
env = true; //We have opened a new environment
|
||||
}
|
||||
if (direction == RTL_DIR) {
|
||||
os << "\\R{";
|
||||
count += 3;
|
||||
env = true; //We have opened a new environment
|
||||
}
|
||||
}
|
||||
|
||||
if (f.family() != INHERIT_FAMILY) {
|
||||
os << '\\'
|
||||
<< LaTeXFamilyNames[f.family()]
|
||||
<< '{'
|
||||
<< LaTeXFamilyNames[f.family()].length() + 2;
|
||||
env = true; //We have opened a new environment
|
||||
}
|
||||
if (f.series() != INHERIT_SERIES) {
|
||||
os << '\\'
|
||||
<< LaTeXSeriesNames[f.series()]
|
||||
<< '{';
|
||||
count += LaTeXSeriesNames[f.series()].length() + 2;
|
||||
env = true; //We have opened a new environment
|
||||
}
|
||||
if (f.shape() != INHERIT_SHAPE) {
|
||||
os << '\\'
|
||||
<< LaTeXShapeNames[f.shape()]
|
||||
<< '{';
|
||||
count += LaTeXShapeNames[f.shape()].length() + 2;
|
||||
env = true; //We have opened a new environment
|
||||
}
|
||||
if (f.color() != LColor::inherit) {
|
||||
os << "\\textcolor{"
|
||||
<< lcolor.getLaTeXName(f.color())
|
||||
<< "}{";
|
||||
count += lcolor.getLaTeXName(f.color()).length() + 13;
|
||||
env = true; //We have opened a new environment
|
||||
}
|
||||
if (f.emph() == ON) {
|
||||
os << "\\emph{";
|
||||
count += 6;
|
||||
env = true; //We have opened a new environment
|
||||
}
|
||||
if (f.underbar() == ON) {
|
||||
os << "\\underbar{";
|
||||
count += 10;
|
||||
env = true; //We have opened a new environment
|
||||
}
|
||||
// \noun{} is a LyX special macro
|
||||
if (f.noun() == ON) {
|
||||
os << "\\noun{";
|
||||
count += 8;
|
||||
env = true; //We have opened a new environment
|
||||
}
|
||||
if (f.size() != INHERIT_SIZE) {
|
||||
// If we didn't open an environment above, we open one here
|
||||
if (!env) {
|
||||
os << '{';
|
||||
++count;
|
||||
}
|
||||
os << '\\'
|
||||
<< LaTeXSizeNames[f.size()]
|
||||
<< ' ';
|
||||
count += LaTeXSizeNames[f.size()].length() + 2;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
#else
|
||||
int LyXFont::latexWriteStartChanges(string & file, LyXFont const & base,
|
||||
LyXFont const & prev) const
|
||||
{
|
||||
@ -746,8 +831,10 @@ int LyXFont::latexWriteStartChanges(string & file, LyXFont const & base,
|
||||
}
|
||||
return count;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef USE_OSTREAM_ONLY
|
||||
/// Writes ending block of LaTeX needed to close use of this font
|
||||
// Returns number of chars written
|
||||
// This one corresponds to latexWriteStartChanges(). (Asger)
|
||||
@ -816,9 +903,80 @@ int LyXFont::latexWriteEndChanges(string & file, LyXFont const & base,
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
#else
|
||||
/// Writes ending block of LaTeX needed to close use of this font
|
||||
// Returns number of chars written
|
||||
// This one corresponds to latexWriteStartChanges(). (Asger)
|
||||
int LyXFont::latexWriteEndChanges(ostream & os, LyXFont const & base,
|
||||
LyXFont const & next) const
|
||||
{
|
||||
LyXFont f = *this; // why do you need this?
|
||||
f.reduce(base); // why isn't this just "reduce(base);" (Lgb)
|
||||
// Because this function is const. Everything breaks if this
|
||||
// method changes the font it represents. There is no speed penalty
|
||||
// by using the temporary. (Asger)
|
||||
|
||||
if (f.bits == inherit)
|
||||
return 0;
|
||||
|
||||
int count = 0;
|
||||
bool env = false;
|
||||
|
||||
FONT_DIRECTION direction = f.direction();
|
||||
if ( direction != next.direction()
|
||||
&& (direction == RTL_DIR || direction == LTR_DIR) ) {
|
||||
os << '}';
|
||||
++count;
|
||||
env = true; // Size change need not bother about closing env.
|
||||
}
|
||||
|
||||
if (f.family() != INHERIT_FAMILY) {
|
||||
os << '}';
|
||||
++count;
|
||||
env = true; // Size change need not bother about closing env.
|
||||
}
|
||||
if (f.series() != INHERIT_SERIES) {
|
||||
os << '}';
|
||||
++count;
|
||||
env = true; // Size change need not bother about closing env.
|
||||
}
|
||||
if (f.shape() != INHERIT_SHAPE) {
|
||||
os << '}';
|
||||
++count;
|
||||
env = true; // Size change need not bother about closing env.
|
||||
}
|
||||
if (f.color() != LColor::inherit) {
|
||||
os << '}';
|
||||
++count;
|
||||
env = true; // Size change need not bother about closing env.
|
||||
}
|
||||
if (f.emph() == ON) {
|
||||
os << '}';
|
||||
++count;
|
||||
env = true; // Size change need not bother about closing env.
|
||||
}
|
||||
if (f.underbar() == ON) {
|
||||
os << '}';
|
||||
++count;
|
||||
env = true; // Size change need not bother about closing env.
|
||||
}
|
||||
if (f.noun() == ON) {
|
||||
os << '}';
|
||||
++count;
|
||||
env = true; // Size change need not bother about closing env.
|
||||
}
|
||||
if (f.size() != INHERIT_SIZE) {
|
||||
// We only have to close if only size changed
|
||||
if (!env) {
|
||||
os << '}';
|
||||
++count;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
LColor::color LyXFont::realColor() const
|
||||
|
@ -35,6 +35,8 @@
|
||||
#undef OFF
|
||||
#endif
|
||||
|
||||
#define USE_OSTREAM_ONLY 1
|
||||
|
||||
class LyXLex;
|
||||
|
||||
///
|
||||
@ -292,6 +294,22 @@ public:
|
||||
/// Writes the changes from this font to orgfont in .lyx format in file
|
||||
void lyxWriteChanges(LyXFont const & orgfont, ostream &) const;
|
||||
|
||||
|
||||
#ifdef USE_OSTREAM_ONLY
|
||||
/** Writes the head of the LaTeX needed to change to this font.
|
||||
Writes to string, the head of the LaTeX needed to change
|
||||
to this font. Returns number of chars written. Base is the
|
||||
font state active now.
|
||||
*/
|
||||
int latexWriteStartChanges(ostream &, LyXFont const & base,
|
||||
LyXFont const & prev) const;
|
||||
/** Writes tha tail of the LaTeX needed to chagne to this font.
|
||||
Returns number of chars written. Base is the font state we want
|
||||
to achieve.
|
||||
*/
|
||||
int latexWriteEndChanges(ostream &, LyXFont const & base,
|
||||
LyXFont const & next) const;
|
||||
#else
|
||||
/** Writes the head of the LaTeX needed to change to this font.
|
||||
Writes to string, the head of the LaTeX needed to change
|
||||
to this font. Returns number of chars written. Base is the
|
||||
@ -299,14 +317,13 @@ public:
|
||||
*/
|
||||
int latexWriteStartChanges(string &, LyXFont const & base,
|
||||
LyXFont const & prev) const;
|
||||
|
||||
/** Writes tha tail of the LaTeX needed to chagne to this font.
|
||||
Returns number of chars written. Base is the font state we want
|
||||
to achieve.
|
||||
*/
|
||||
int latexWriteEndChanges(string &, LyXFont const & base,
|
||||
LyXFont const & next) const;
|
||||
|
||||
#endif
|
||||
/// Build GUI description of font state
|
||||
string stateText() const;
|
||||
|
||||
|
@ -150,6 +150,19 @@ public:
|
||||
///
|
||||
void readSimpleWholeFile(istream &);
|
||||
|
||||
#ifdef USE_OSTREAM_ONLY
|
||||
///
|
||||
LyXParagraph * TeXOnePar(ostream &, TexRow & texrow,
|
||||
ostream & foot, TexRow & foot_texrow,
|
||||
int & foot_count);
|
||||
///
|
||||
bool SimpleTeXOnePar(ostream &, TexRow & texrow);
|
||||
|
||||
///
|
||||
LyXParagraph * TeXEnvironment(ostream &, TexRow & texrow,
|
||||
ostream & foot, TexRow & foot_texrow,
|
||||
int & foot_count);
|
||||
#else
|
||||
///
|
||||
LyXParagraph * TeXOnePar(string & file, TexRow & texrow,
|
||||
string & foot, TexRow & foot_texrow,
|
||||
@ -161,7 +174,7 @@ public:
|
||||
LyXParagraph * TeXEnvironment(string & file, TexRow & texrow,
|
||||
string & foot, TexRow & foot_texrow,
|
||||
int & foot_count);
|
||||
|
||||
#endif
|
||||
///
|
||||
LyXParagraph * Clone() const;
|
||||
|
||||
@ -469,15 +482,25 @@ public:
|
||||
///
|
||||
bool RoffContTableRows(ostream &, size_type i, int actcell);
|
||||
#endif
|
||||
///
|
||||
bool linuxDocConvertChar(char c, string & sgml_string);
|
||||
#ifdef USE_OSTREAM_ONLY
|
||||
///
|
||||
void DocBookContTableRows(ostream &, string & extra, int & desc_on,
|
||||
size_type i,
|
||||
int current_cell_number, int & column);
|
||||
///
|
||||
void SimpleDocBookOneTablePar(ostream &, string & extra,
|
||||
int & desc_on, int depth);
|
||||
#else
|
||||
///
|
||||
void DocBookContTableRows(string & file, string & extra, int & desc_on,
|
||||
size_type i,
|
||||
int current_cell_number, int & column);
|
||||
///
|
||||
bool linuxDocConvertChar(char c, string & sgml_string);
|
||||
///
|
||||
void SimpleDocBookOneTablePar(string & file, string & extra,
|
||||
int & desc_on, int depth);
|
||||
#endif
|
||||
private:
|
||||
/** A font entry covers a range of positions. Notice that the
|
||||
entries in the list are inserted in random order.
|
||||
@ -516,6 +539,35 @@ private:
|
||||
typedef list<InsetTable> InsetList;
|
||||
///
|
||||
InsetList insetlist;
|
||||
#ifdef USE_OSTREAM_ONLY
|
||||
///
|
||||
LyXParagraph * TeXDeeper(ostream &, TexRow & texrow,
|
||||
ostream & foot, TexRow & foot_texrow,
|
||||
int & foot_count);
|
||||
///
|
||||
LyXParagraph * TeXFootnote(ostream &, TexRow & texrow,
|
||||
ostream & foot, TexRow & foot_texrow,
|
||||
int & foot_count,
|
||||
LyXDirection par_direction);
|
||||
///
|
||||
bool SimpleTeXOneTablePar(ostream &, TexRow & texrow);
|
||||
///
|
||||
bool TeXContTableRows(ostream &, size_type i,
|
||||
int current_cell_number,
|
||||
int & column, TexRow & texrow);
|
||||
///
|
||||
void SimpleTeXBlanks(ostream &, TexRow & texrow,
|
||||
size_type const i,
|
||||
int & column, LyXFont const & font,
|
||||
LyXLayout const & style);
|
||||
///
|
||||
void SimpleTeXSpecialChars(ostream &, TexRow & texrow,
|
||||
LyXFont & font, LyXFont & running_font,
|
||||
LyXFont & basefont, bool & open_font,
|
||||
LyXLayout const & style,
|
||||
size_type & i,
|
||||
int & column, char const c);
|
||||
#else
|
||||
///
|
||||
LyXParagraph * TeXDeeper(string & file, TexRow & texrow,
|
||||
string & foot, TexRow & foot_texrow,
|
||||
@ -543,6 +595,7 @@ private:
|
||||
LyXLayout const & style,
|
||||
size_type & i,
|
||||
int & column, char const c);
|
||||
#endif
|
||||
///
|
||||
unsigned int id_;
|
||||
///
|
||||
|
14
src/lyxrc.C
14
src/lyxrc.C
@ -91,7 +91,6 @@ enum LyXRCTags {
|
||||
RC_AUTOREGIONDELETE,
|
||||
RC_BIND,
|
||||
RC_SERVERPIPE,
|
||||
RC_NOMENUACCELERATORS,
|
||||
RC_INPUT,
|
||||
RC_BINDFILE,
|
||||
RC_KBMAP,
|
||||
@ -136,6 +135,7 @@ enum LyXRCTags {
|
||||
RC_PDF_TO_PS_COMMAND,
|
||||
RC_DVI_TO_PS_COMMAND,
|
||||
RC_DATE_INSERT_FORMAT,
|
||||
RC_SHOW_BANNER,
|
||||
RC_LAST
|
||||
};
|
||||
|
||||
@ -219,6 +219,7 @@ static keyword_item lyxrcTags[] = {
|
||||
{ "\\selection_color", RC_SELECTION_COLOR },
|
||||
{ "\\serverpipe", RC_SERVERPIPE },
|
||||
{ "\\sgml_extra_options", RC_SGML_EXTRA_OPTIONS },
|
||||
{ "\\show_banner", RC_SHOW_BANNER },
|
||||
{ "\\spell_command", RC_SPELL_COMMAND },
|
||||
{ "\\tempdir_path", RC_TEMPDIRPATH },
|
||||
{ "\\template_path", RC_TEMPLATEPATH },
|
||||
@ -328,9 +329,10 @@ LyXRC::LyXRC()
|
||||
use_kbmap = false;
|
||||
hasBindFile = false;
|
||||
rtl_support = false;
|
||||
defaultKeyBindings();
|
||||
///
|
||||
date_insert_format = "%A, %e %B %Y";
|
||||
show_banner = true;
|
||||
//
|
||||
defaultKeyBindings();
|
||||
}
|
||||
|
||||
|
||||
@ -922,6 +924,10 @@ int LyXRC::read(string const & filename)
|
||||
if (lexrc.next())
|
||||
rtl_support = lexrc.GetBool();
|
||||
break;
|
||||
case RC_SHOW_BANNER:
|
||||
if (lexrc.next())
|
||||
show_banner = lexrc.GetBool();
|
||||
break;
|
||||
case RC_LAST: break; // this is just a dummy
|
||||
}
|
||||
}
|
||||
@ -1216,6 +1222,8 @@ void LyXRC::output(ostream & os) const
|
||||
case RC_DATE_INSERT_FORMAT:
|
||||
os << "\\date_insert_format \"" << date_insert_format
|
||||
<< "\"\n";
|
||||
case RC_SHOW_BANNER:
|
||||
os << "\\show_banner " << tostr(show_banner) << "\n";
|
||||
}
|
||||
os.flush();
|
||||
}
|
||||
|
@ -203,6 +203,8 @@ public:
|
||||
string date_insert_format;
|
||||
///
|
||||
bool rtl_support;
|
||||
///
|
||||
bool show_banner;
|
||||
private:
|
||||
///
|
||||
void defaultKeyBindings();
|
||||
|
@ -334,7 +334,6 @@ int InsetFormula::Latex(string & file, signed char fragile) const
|
||||
mathed_write(par, file, &ret, fragile, label.c_str());
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int InsetFormula::Linuxdoc(string &/*file*/) const
|
||||
@ -348,6 +347,20 @@ int InsetFormula::DocBook(string &/*file*/) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int InsetFormula::Linuxdoc(ostream &) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetFormula::DocBook(ostream&) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// Check if uses AMS macros
|
||||
void InsetFormula::Validate(LaTeXFeatures & features) const
|
||||
@ -404,11 +417,12 @@ int InsetFormula::width(Painter &, LyXFont const & f) const
|
||||
}
|
||||
|
||||
|
||||
void InsetFormula::draw(Painter & pain, LyXFont const &,
|
||||
void InsetFormula::draw(Painter & pain, LyXFont const & f,
|
||||
int baseline, float & x) const
|
||||
{
|
||||
// Seems commenting out solves a problem.
|
||||
LyXFont font = mathed_get_font(LM_TC_TEXTRM, LM_ST_TEXT);
|
||||
|
||||
font.setSize(f.size());
|
||||
lfont_size = font.size();
|
||||
/// Let's try to wait a bit with this... (Lgb)
|
||||
//UpdatableInset::draw(pain, font, baseline, x);
|
||||
|
@ -53,11 +53,16 @@ public:
|
||||
#ifndef USE_OSTREAM_ONLY
|
||||
///
|
||||
int Latex(string & file, signed char fragile) const;
|
||||
#endif
|
||||
///
|
||||
int Linuxdoc(string & file) const;
|
||||
///
|
||||
int DocBook(string & file) const;
|
||||
#else
|
||||
///
|
||||
int Linuxdoc(ostream &) const;
|
||||
///
|
||||
int DocBook(ostream &) const;
|
||||
#endif
|
||||
///
|
||||
void Validate(LaTeXFeatures &) const;
|
||||
///
|
||||
|
@ -85,7 +85,6 @@ int InsetFormulaMacro::Latex(string &file, signed char /*fragile*/) const
|
||||
tmacro->WriteDef(file);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int InsetFormulaMacro::Linuxdoc(string &/*file*/) const
|
||||
@ -99,6 +98,20 @@ int InsetFormulaMacro::DocBook(string &/*file*/) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int InsetFormulaMacro::Linuxdoc(ostream &) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int InsetFormulaMacro::DocBook(ostream &) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void InsetFormulaMacro::Read(LyXLex & lex)
|
||||
{
|
||||
|
@ -52,11 +52,16 @@ public:
|
||||
#ifndef USE_OSTREAM_ONLY
|
||||
///
|
||||
int Latex(string & file, signed char fragile) const;
|
||||
#endif
|
||||
///
|
||||
int Linuxdoc(string & file) const;
|
||||
///
|
||||
int DocBook(string & file) const;
|
||||
#else
|
||||
///
|
||||
int Linuxdoc(ostream &) const;
|
||||
///
|
||||
int DocBook(ostream &) const;
|
||||
#endif
|
||||
///
|
||||
Inset * Clone() const;
|
||||
|
||||
|
1889
src/paragraph.C
1889
src/paragraph.C
File diff suppressed because it is too large
Load Diff
@ -767,8 +767,7 @@ bool RunSpellChecker(BufferView * bv)
|
||||
|
||||
if(isp_pid!= -1) {
|
||||
ispell_terminate();
|
||||
string word_msg;
|
||||
word_msg += tostr(word_count);
|
||||
string word_msg(tostr(word_count));
|
||||
if (word_count != 1) {
|
||||
word_msg += _(" words checked.");
|
||||
} else {
|
||||
|
@ -63,7 +63,7 @@ inline string tostr(T const & t)
|
||||
return ostr.str().c_str();
|
||||
// We need to use the .c_str since we sometimes are using
|
||||
// our own string class and that is not compatible with
|
||||
// basic_string<char>.
|
||||
// basic_string<char>. (of course we don't want this later)
|
||||
#else
|
||||
// The buf is probably a bit large, but if we want to be safer
|
||||
// we should leave it this big. As compiler/libs gets updated
|
||||
|
20
src/support/lyxmanip.h
Normal file
20
src/support/lyxmanip.h
Normal file
@ -0,0 +1,20 @@
|
||||
// -*- C++ -*-
|
||||
#ifndef LYX_MANIP_H
|
||||
#define LYX_MANIP_H
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
///
|
||||
inline
|
||||
ostream & newlineAndDepth_helper(ostream & s, int n)
|
||||
{
|
||||
return s << '\n' << string(n, ' ');
|
||||
}
|
||||
///
|
||||
inline
|
||||
omanip<int> newlineAndDepth(int n)
|
||||
{
|
||||
return omanip<int>(newlineAndDepth_helper, n);
|
||||
}
|
||||
|
||||
#endif
|
473
src/table.C
473
src/table.C
@ -3,8 +3,8 @@
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright (C) 1995 Matthias Ettrich
|
||||
* Copyright (C) 1995-1998 The LyX Team.
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-2000 The LyX Team.
|
||||
*
|
||||
* ======================================================
|
||||
*/
|
||||
@ -16,7 +16,6 @@
|
||||
#include "vspace.h"
|
||||
#include "layout.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include <algorithm>
|
||||
using std::max;
|
||||
|
||||
@ -24,7 +23,11 @@ using std::max;
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#ifdef USE_OSTREAM_ONLY
|
||||
#include "support/lyxmanip.h"
|
||||
#else
|
||||
extern void addNewlineAndDepth(string & file, int depth); // Jug 990923
|
||||
#endif
|
||||
|
||||
static int const WIDTH_OF_LINE = 5;
|
||||
|
||||
@ -953,6 +956,344 @@ void LyXTable::Read(istream & is)
|
||||
}
|
||||
|
||||
|
||||
#ifdef USE_OSTREAM_ONLY
|
||||
// cell <0 will tex the preamble
|
||||
// returns the number of printed newlines
|
||||
int LyXTable::TexEndOfCell(ostream & os, int cell)
|
||||
{
|
||||
int i;
|
||||
int ret = 0;
|
||||
int tmp; // tmp2;
|
||||
int fcell, nvcell;
|
||||
if (ShouldBeVeryLastCell(cell)) {
|
||||
// the very end at the very beginning
|
||||
if (Linebreaks(cell))
|
||||
os << "\\smallskip{}}";
|
||||
if (IsMultiColumn(cell))
|
||||
os << '}';
|
||||
if (RotateCell(cell)) {
|
||||
os << "\n\\end{sideways}";
|
||||
++ret;
|
||||
}
|
||||
os << "\\\\\n";
|
||||
++ret;
|
||||
|
||||
tmp = 0;
|
||||
fcell = cell;
|
||||
while (!IsFirstCell(fcell)) --fcell;
|
||||
for (i = 0; i < NumberOfCellsInRow(fcell); ++i) {
|
||||
if (BottomLine(fcell + i))
|
||||
++tmp;
|
||||
}
|
||||
if (tmp == NumberOfCellsInRow(fcell)) {
|
||||
os << "\\hline ";
|
||||
} else {
|
||||
tmp = 0;
|
||||
for (i = 0; i < NumberOfCellsInRow(fcell); ++i) {
|
||||
if (BottomLine(fcell + i)) {
|
||||
os << "\\cline{"
|
||||
<< column_of_cell(fcell + i) + 1
|
||||
<< '-'
|
||||
<< right_column_of_cell(fcell + i) + 1
|
||||
<< "} ";
|
||||
tmp = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tmp){
|
||||
os << '\n';
|
||||
++ret;
|
||||
}
|
||||
if (is_long_table)
|
||||
os << "\\end{longtable}";
|
||||
else
|
||||
os << "\\end{tabular}";
|
||||
if (rotate) {
|
||||
os << "\n\\end{sideways}";
|
||||
++ret;
|
||||
}
|
||||
} else {
|
||||
nvcell = NextVirtualCell(cell + 1);
|
||||
if (cell < 0){
|
||||
// preamble
|
||||
if (rotate) {
|
||||
os << "\\begin{sideways}\n";
|
||||
++ret;
|
||||
}
|
||||
if (is_long_table)
|
||||
os << "\\begin{longtable}{";
|
||||
else
|
||||
os << "\\begin{tabular}{";
|
||||
for (i = 0; i < columns; ++i) {
|
||||
if (column_info[i].left_line)
|
||||
os << '|';
|
||||
if (!column_info[i].align_special.empty()) {
|
||||
os << column_info[i].align_special;
|
||||
} else if (!column_info[i].p_width.empty()) {
|
||||
os << "p{"
|
||||
<< column_info[i].p_width
|
||||
<< '}';
|
||||
} else {
|
||||
switch (column_info[i].alignment) {
|
||||
case LYX_ALIGN_LEFT:
|
||||
os << 'l';
|
||||
break;
|
||||
case LYX_ALIGN_RIGHT:
|
||||
os << 'r';
|
||||
break;
|
||||
default:
|
||||
os << 'c';
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (column_info[i].right_line)
|
||||
os << '|';
|
||||
}
|
||||
os << "}\n";
|
||||
++ret;
|
||||
tmp = 0;
|
||||
if (GetNumberOfCells()) {
|
||||
fcell = 0;
|
||||
for (i = 0; i < NumberOfCellsInRow(fcell); ++i) {
|
||||
if (TopLine(fcell + i))
|
||||
++tmp;
|
||||
}
|
||||
if (tmp == NumberOfCellsInRow(fcell)){
|
||||
os << "\\hline ";
|
||||
} else {
|
||||
tmp = 0;
|
||||
for (i = 0; i < NumberOfCellsInRow(fcell); ++i) {
|
||||
if (TopLine(fcell + i)) {
|
||||
os << "\\cline{"
|
||||
<< column_of_cell(fcell + i) + 1
|
||||
<< '-'
|
||||
<< right_column_of_cell(fcell + i) + 1
|
||||
<< "} ";
|
||||
tmp = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tmp){
|
||||
os << '\n';
|
||||
++ret;
|
||||
}
|
||||
}
|
||||
if (RotateCell(0)) {
|
||||
os << "\\begin{sideways}\n";
|
||||
++ret;
|
||||
}
|
||||
} else {
|
||||
// usual cells
|
||||
if (Linebreaks(cell))
|
||||
os << "\\smallskip{}}";
|
||||
if (IsMultiColumn(cell)){
|
||||
os << '}';
|
||||
}
|
||||
if (RotateCell(cell)) {
|
||||
os << "\n\\end{sideways}";
|
||||
++ret;
|
||||
}
|
||||
if (IsLastCell(cell)) {
|
||||
int row = row_of_cell(cell);
|
||||
string hline1, hline2;
|
||||
bool print_hline = true;
|
||||
bool flag1 = IsLongTable() &&
|
||||
((row == endhead) || (row == endfirsthead) ||
|
||||
(row == endfoot) || (row == endlastfoot));
|
||||
++row;
|
||||
bool flag2 = IsLongTable() &&
|
||||
((row <= endhead) || (row <= endfirsthead) ||
|
||||
(row <= endfoot) || (row <= endlastfoot));
|
||||
--row;
|
||||
// print the bottom hline only if (otherwise it is doubled):
|
||||
// - is no LongTable
|
||||
// - there IS a first-header
|
||||
// - the next row is no special header/footer
|
||||
// & this row is no special header/footer
|
||||
// - the next row is a special header/footer
|
||||
// & this row is a special header/footer
|
||||
bool pr_top_hline = (flag1 && flag2) || (!flag1 && !flag2) ||
|
||||
(endfirsthead == endhead);
|
||||
os << "\\\\\n";
|
||||
++ret;
|
||||
tmp = 0;
|
||||
fcell = cell;
|
||||
while (!IsFirstCell(fcell))
|
||||
--fcell;
|
||||
for (i = 0; i < NumberOfCellsInRow(cell); ++i) {
|
||||
if (BottomLine(fcell + i))
|
||||
++tmp;
|
||||
}
|
||||
if (tmp == NumberOfCellsInRow(cell)){
|
||||
os << "\\hline ";
|
||||
hline1 = "\\hline ";
|
||||
} else {
|
||||
tmp = 0;
|
||||
for (i = 0; i < NumberOfCellsInRow(fcell); ++i) {
|
||||
if (BottomLine(fcell + i)){
|
||||
os << "\\cline{"
|
||||
<< column_of_cell(fcell + i) + 1
|
||||
<< '-'
|
||||
<< right_column_of_cell(fcell + i) + 1
|
||||
<< "} ";
|
||||
hline1 += "\\cline{";
|
||||
hline1 += tostr(column_of_cell(fcell + i) + 1);
|
||||
hline1 += '-';
|
||||
hline1 += tostr(right_column_of_cell(fcell + i) + 1);
|
||||
hline1 += "} ";
|
||||
tmp = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tmp){
|
||||
os << '\n';
|
||||
++ret;
|
||||
}
|
||||
if (IsLongTable() && (row == endfoot)) {
|
||||
os << "\\endfoot\n";
|
||||
++ret;
|
||||
print_hline = false; // no double line below footer
|
||||
}
|
||||
if (IsLongTable() && (row == endlastfoot)) {
|
||||
os << "\\endlastfoot\n";
|
||||
++ret;
|
||||
print_hline = false; // no double line below footer
|
||||
}
|
||||
if (IsLongTable() && row_info[row].newpage) {
|
||||
os << "\\newpage\n";
|
||||
++ret;
|
||||
print_hline = false; // no line below a \\newpage-command
|
||||
}
|
||||
tmp = 0;
|
||||
if (nvcell < numberofcells
|
||||
&& (cell < GetNumberOfCells() - 1)
|
||||
&& !ShouldBeVeryLastCell(cell)) {
|
||||
fcell = nvcell;
|
||||
for (i = 0; i < NumberOfCellsInRow(fcell); ++i) {
|
||||
if (TopLine(fcell + i))
|
||||
++tmp;
|
||||
}
|
||||
if (tmp == NumberOfCellsInRow(fcell)) {
|
||||
if (print_hline)
|
||||
os << "\\hline ";
|
||||
hline2 = "\\hline ";
|
||||
} else {
|
||||
tmp = 0;
|
||||
for (i = 0; i < NumberOfCellsInRow(fcell); ++i) {
|
||||
if (TopLine(fcell + i)) {
|
||||
if (print_hline) {
|
||||
os << "\\cline{"
|
||||
<< column_of_cell(fcell + i) + 1
|
||||
<< '-'
|
||||
<< right_column_of_cell(fcell + i) + 1
|
||||
<< "} ";
|
||||
}
|
||||
hline2 += "\\cline{";
|
||||
hline2 += tostr(column_of_cell(fcell+i)+1);
|
||||
hline2 += '-';
|
||||
hline2 += tostr(right_column_of_cell(fcell+i)+1);
|
||||
hline2 += "} ";
|
||||
tmp = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tmp && print_hline){
|
||||
os << '\n';
|
||||
++ret;
|
||||
}
|
||||
}
|
||||
// the order here is important as if one defines two
|
||||
// or more things in one line only the first entry is
|
||||
// displayed the other are set to an empty-row. This
|
||||
// is important if I have a footer and want that the
|
||||
// lastfooter is NOT displayed!!!
|
||||
bool sflag2 = (row == endhead) || (row == endfirsthead) ||
|
||||
(row == endfoot) || (row == endlastfoot);
|
||||
--row;
|
||||
// sflag2 = IsLongTable() && (row >= 0) &&
|
||||
// (sflag2 || (row == endhead) || (row == endfirsthead));
|
||||
row += 2;
|
||||
bool sflag1 = IsLongTable() && (row != endhead) &&
|
||||
(row != endfirsthead) &&
|
||||
((row == endfoot) || (row == endlastfoot));
|
||||
--row;
|
||||
if (IsLongTable() && (row == endhead)) {
|
||||
os << "\\endhead\n";
|
||||
++ret;
|
||||
}
|
||||
if (IsLongTable() && (row == endfirsthead)) {
|
||||
os << "\\endfirsthead\n";
|
||||
++ret;
|
||||
}
|
||||
if (sflag1) { // add the \hline for next foot row
|
||||
if (!hline1.empty()) {
|
||||
os << hline1 + '\n';
|
||||
++ret;
|
||||
}
|
||||
}
|
||||
// add the \hline for the first row
|
||||
if (pr_top_hline && sflag2) {
|
||||
if (!hline2.empty()) {
|
||||
os << hline2 + '\n';
|
||||
++ret;
|
||||
}
|
||||
}
|
||||
if (nvcell < numberofcells && RotateCell(nvcell)) {
|
||||
os << "\\begin{sideways}\n";
|
||||
++ret;
|
||||
}
|
||||
} else {
|
||||
os << "&\n";
|
||||
++ret;
|
||||
if (nvcell < numberofcells && RotateCell(nvcell)) {
|
||||
os << "\\begin{sideways}\n";
|
||||
++ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (nvcell < numberofcells && IsMultiColumn(nvcell)) {
|
||||
os << "\\multicolumn{"
|
||||
<< cells_in_multicolumn(nvcell)
|
||||
<< "}{";
|
||||
if (!cellinfo_of_cell(cell+1)->align_special.empty()) {
|
||||
os << cellinfo_of_cell(cell+1)->align_special
|
||||
<< "}{";
|
||||
} else {
|
||||
if (LeftLine(nvcell))
|
||||
os << '|';
|
||||
if (!GetPWidth(nvcell).empty()) {
|
||||
os << "p{"
|
||||
<< GetPWidth(nvcell)
|
||||
<< '}';
|
||||
} else {
|
||||
switch (GetAlignment(nvcell)) {
|
||||
case LYX_ALIGN_LEFT: os << 'l'; break;
|
||||
case LYX_ALIGN_RIGHT: os << 'r'; break;
|
||||
default: os << 'c'; break;
|
||||
}
|
||||
}
|
||||
if (RightLine(nvcell))
|
||||
os << '|';
|
||||
//if (column_of_cell(cell+2)!= 0 && LeftLine(cell+2))
|
||||
if (((nvcell + 1) < numberofcells) &&
|
||||
(NextVirtualCell(nvcell+1) < numberofcells) &&
|
||||
(column_of_cell(NextVirtualCell(nvcell+1))!= 0) &&
|
||||
LeftLine(NextVirtualCell(nvcell+1)))
|
||||
os << '|';
|
||||
|
||||
os << "}{";
|
||||
}
|
||||
}
|
||||
if (nvcell < numberofcells && Linebreaks(nvcell)) {
|
||||
// !column_info[column_of_cell(nvcell)].p_width.empty()) {
|
||||
os << "\\parbox{"
|
||||
<< GetPWidth(nvcell)
|
||||
<< "}{\\smallskip{}";
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
// cell <0 will tex the preamble
|
||||
// returns the number of printed newlines
|
||||
int LyXTable::TexEndOfCell(string & file, int cell)
|
||||
@ -1287,6 +1628,7 @@ int LyXTable::TexEndOfCell(string & file, int cell)
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if 0
|
||||
@ -1429,6 +1771,130 @@ char const *LyXTable::getDocBookAlign(int cell, bool isColumn)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef USE_OSTREAM_ONLY
|
||||
// cell <0 will tex the preamble
|
||||
// returns the number of printed newlines
|
||||
int LyXTable::DocBookEndOfCell(ostream & os, int cell, int &depth)
|
||||
{
|
||||
int i;
|
||||
int ret = 0;
|
||||
//int tmp; // tmp2; // unused
|
||||
int nvcell; // fcell; // unused
|
||||
if (ShouldBeVeryLastCell(cell)) {
|
||||
os << newlineAndDepth(--depth)
|
||||
<< "</ENTRY>"
|
||||
<< newlineAndDepth(--depth)
|
||||
<< "</ROW>"
|
||||
<< newlineAndDepth(--depth)
|
||||
<< "</TBODY>"
|
||||
<< newlineAndDepth(--depth);
|
||||
if (is_long_table)
|
||||
os << "</TGROUP>";
|
||||
else
|
||||
os << "</TGROUP>"
|
||||
<< newlineAndDepth(--depth);
|
||||
ret += 4;
|
||||
} else {
|
||||
nvcell = NextVirtualCell(cell + 1);
|
||||
if (cell < 0) {
|
||||
// preamble
|
||||
if (is_long_table)
|
||||
os << "<TGROUP ";
|
||||
else
|
||||
os << "<TGROUP ";
|
||||
os << "COLS='"
|
||||
<< columns
|
||||
<< "' COLSEP='1' ROWSEP='1'>"
|
||||
<< newlineAndDepth(++depth);
|
||||
++ret;
|
||||
for (i = 0; i < columns; ++i) {
|
||||
os << "<COLSPEC ALIGN='"
|
||||
<< getDocBookAlign(i, true)
|
||||
<< "' COLNAME='col"
|
||||
<< i + 1
|
||||
<< "' COLNUM='"
|
||||
<< i + 1
|
||||
<< "' COLSEP='";
|
||||
if (i == (columns-1)) {
|
||||
os << '1';
|
||||
} else {
|
||||
if (column_info[i].right_line ||
|
||||
column_info[i+1].left_line)
|
||||
os << '1';
|
||||
else
|
||||
os << '0';
|
||||
}
|
||||
os << "'>"
|
||||
<< newlineAndDepth(depth);
|
||||
++ret;
|
||||
#ifdef NOT_HANDLED_YET_AS_I_DONT_KNOW_HOW
|
||||
if (column_info[i].left_line)
|
||||
os << '|';
|
||||
#endif
|
||||
}
|
||||
os << "<TBODY>"
|
||||
<< newlineAndDepth(++depth)
|
||||
<< "<ROW>"
|
||||
<< newlineAndDepth(++depth)
|
||||
<< "<ENTRY ALIGN='"
|
||||
<< getDocBookAlign(0)
|
||||
<< "'";
|
||||
if (IsMultiColumn(0)) {
|
||||
os << " NAMEST='col1' NAMEEND='col"
|
||||
<< cells_in_multicolumn(0)
|
||||
<< "'";
|
||||
}
|
||||
os << ">"
|
||||
<< newlineAndDepth(++depth);
|
||||
ret += 3;
|
||||
} else {
|
||||
if (IsLastCell(cell)) {
|
||||
os << newlineAndDepth(--depth)
|
||||
<< "</ENTRY>"
|
||||
<< newlineAndDepth(--depth)
|
||||
<< "</ROW>"
|
||||
<< newlineAndDepth(depth)
|
||||
<< "<ROW>"
|
||||
<< newlineAndDepth(++depth)
|
||||
<< "<ENTRY ALIGN='"
|
||||
<< getDocBookAlign(cell + 1)
|
||||
<< "' VALIGN='middle'";
|
||||
if (IsMultiColumn(cell + 1)) {
|
||||
os << " NAMEST='col"
|
||||
<< column_of_cell(cell+1) + 1
|
||||
<< "' NAMEEND='col"
|
||||
<< column_of_cell(cell + 1) +
|
||||
cells_in_multicolumn(cell + 1)
|
||||
<< "'";
|
||||
}
|
||||
os << ">"
|
||||
<< newlineAndDepth(++depth);
|
||||
ret += 4;
|
||||
} else {
|
||||
os << newlineAndDepth(--depth)
|
||||
<< "</ENTRY>"
|
||||
<< newlineAndDepth(depth)
|
||||
<< "<ENTRY ALIGN='"
|
||||
<< getDocBookAlign(cell + 1)
|
||||
<< "' VALIGN='middle'";
|
||||
if (IsMultiColumn(cell + 1)) {
|
||||
os << " NAMEST='col"
|
||||
<< column_of_cell(cell+1) + 1
|
||||
<< "' NAMEEND='col"
|
||||
<< column_of_cell(cell+1) +
|
||||
cells_in_multicolumn(cell+1)
|
||||
<< "'";
|
||||
}
|
||||
os << ">"
|
||||
<< newlineAndDepth(++depth);
|
||||
ret += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
// cell <0 will tex the preamble
|
||||
// returns the number of printed newlines
|
||||
int LyXTable::DocBookEndOfCell(string & file, int cell, int &depth)
|
||||
@ -1550,6 +2016,7 @@ int LyXTable::DocBookEndOfCell(string & file, int cell, int &depth)
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
bool LyXTable::IsMultiColumn(int cell)
|
||||
|
13
src/table.h
13
src/table.h
@ -18,6 +18,8 @@
|
||||
#include "LString.h"
|
||||
#include "support/LOstream.h"
|
||||
|
||||
#define USE_OSTREAM_ONLY 1
|
||||
|
||||
/* The features the text class offers for tables */
|
||||
|
||||
///
|
||||
@ -164,16 +166,23 @@ public:
|
||||
|
||||
// cell <0 will tex the preamble
|
||||
// returns the number of printed newlines
|
||||
#ifdef USE_OSTREAM_ONLY
|
||||
///
|
||||
int TexEndOfCell(ostream &, int cell);
|
||||
///
|
||||
int DocBookEndOfCell(ostream &, int cell, int & depth);
|
||||
#else
|
||||
///
|
||||
int TexEndOfCell(string & file, int cell);
|
||||
///
|
||||
int DocBookEndOfCell(string & file, int cell, int & depth);
|
||||
#endif
|
||||
#if 0
|
||||
///
|
||||
int RoffEndOfCell(ostream &, int cell);
|
||||
#endif
|
||||
///
|
||||
char const * getDocBookAlign(int cell, bool isColumn = false);
|
||||
///
|
||||
int DocBookEndOfCell(string & file, int cell, int & depth);
|
||||
|
||||
///
|
||||
bool IsMultiColumn(int cell);
|
||||
|
@ -2391,12 +2391,17 @@ void LyXText::InsertChar(char c)
|
||||
|
||||
/* When the free-spacing option is set for the current layout,
|
||||
* all spaces are converted to protected spaces. */
|
||||
// Thinko!
|
||||
#warning think about this
|
||||
#if 0
|
||||
bool freeSpacingBo =
|
||||
textclasslist.Style(parameters->textclass,
|
||||
cursor.row->par->GetLayout()).free_spacing;
|
||||
|
||||
// Thinkee: (not done)
|
||||
// It seems that we should insert a InsetSpecialChar, do we really
|
||||
// have to? I don't know the free spacing politics too deeply.
|
||||
// Some others should have a look at this.
|
||||
if (freeSpacingBo && IsLineSeparatorChar(c)
|
||||
&& (!cursor.pos || cursor.par->IsLineSeparator(cursor.pos - 1))) {
|
||||
c = LyXParagraph::META_PROTECTED_SEPARATOR;
|
||||
|
Loading…
Reference in New Issue
Block a user