]> git.lyx.org Git - lyx.git/blob - src/insets/InsetBox.cpp
cf3d791d4106e58795b6a56c95176dde87486d5d
[lyx.git] / src / insets / InsetBox.cpp
1 /**
2  * \file InsetBox.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Angus Leeming
7  * \author Martin Vermeer
8  * \author Jürgen Spitzmüller
9  * \author Uwe Stöhr
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #include <config.h>
15
16 #include "InsetBox.h"
17
18 #include "Buffer.h"
19 #include "BufferParams.h"
20 #include "BufferView.h"
21 #include "ColorSet.h"
22 #include "Cursor.h"
23 #include "DispatchResult.h"
24 #include "FuncStatus.h"
25 #include "FuncRequest.h"
26 #include "LaTeXFeatures.h"
27 #include "Lexer.h"
28 #include "MetricsInfo.h"
29 #include "output_xhtml.h"
30 #include "TextClass.h"
31
32 #include "support/debug.h"
33 #include "support/docstream.h"
34 #include "support/gettext.h"
35 #include "support/lstrings.h"
36 #include "support/Translator.h"
37
38 #include "frontends/Application.h"
39
40 #include <sstream>
41
42 using namespace std;
43 using namespace lyx::support;
44
45 namespace lyx {
46
47 namespace {
48
49 typedef Translator<string, InsetBox::BoxType> BoxTranslator;
50 typedef Translator<docstring, InsetBox::BoxType> BoxTranslatorLoc;
51
52 BoxTranslator initBoxtranslator()
53 {
54         BoxTranslator translator("Boxed", InsetBox::Boxed);
55         translator.addPair("Frameless", InsetBox::Frameless);
56         translator.addPair("Framed", InsetBox::Framed);
57         translator.addPair("ovalbox", InsetBox::ovalbox);
58         translator.addPair("Ovalbox", InsetBox::Ovalbox);
59         translator.addPair("Shadowbox", InsetBox::Shadowbox);
60         translator.addPair("Shaded", InsetBox::Shaded);
61         translator.addPair("Doublebox",InsetBox::Doublebox);
62         return translator;
63 }
64
65
66 BoxTranslatorLoc initBoxtranslatorLoc()
67 {
68         BoxTranslatorLoc translator(_("simple frame"), InsetBox::Boxed);
69         translator.addPair(_("frameless"), InsetBox::Frameless);
70         translator.addPair(_("simple frame, page breaks"), InsetBox::Framed);
71         translator.addPair(_("oval, thin"), InsetBox::ovalbox);
72         translator.addPair(_("oval, thick"), InsetBox::Ovalbox);
73         translator.addPair(_("drop shadow"), InsetBox::Shadowbox);
74         translator.addPair(_("shaded background"), InsetBox::Shaded);
75         translator.addPair(_("double frame"), InsetBox::Doublebox);
76         return translator;
77 }
78
79
80 BoxTranslator const & boxtranslator()
81 {
82         static BoxTranslator const translator = initBoxtranslator();
83         return translator;
84 }
85
86
87 BoxTranslatorLoc const & boxtranslator_loc()
88 {
89         static BoxTranslatorLoc const translator = initBoxtranslatorLoc();
90         return translator;
91 }
92
93 } // namespace anon
94
95
96 /////////////////////////////////////////////////////////////////////////
97 //
98 // InsetBox
99 //
100 /////////////////////////////////////////////////////////////////////////
101
102 InsetBox::InsetBox(Buffer * buffer, string const & label)
103         : InsetCollapsable(buffer), params_(label)
104 {}
105
106
107 docstring InsetBox::layoutName() const
108 {
109         // FIXME: UNICODE
110         return from_ascii("Box:" + params_.type);
111 }
112
113
114 void InsetBox::write(ostream & os) const
115 {
116         params_.write(os);
117         InsetCollapsable::write(os);
118 }
119
120
121 void InsetBox::read(Lexer & lex)
122 {
123         params_.read(lex);
124         InsetCollapsable::read(lex);
125 }
126
127
128 void InsetBox::setButtonLabel()
129 {
130         BoxType const btype = boxtranslator().find(params_.type);
131
132         docstring const type = _("Box");
133
134         docstring inner;
135         if (params_.inner_box) {
136                 if (params_.use_parbox)
137                         inner = _("Parbox");
138                 else if (params_.use_makebox)
139                         inner = _("Makebox");
140                 else
141                         inner = _("Minipage");
142         }
143
144         docstring frame;
145         if (btype != Frameless)
146                 frame = boxtranslator_loc().find(btype);
147
148         docstring label;
149         if (inner.empty() && frame.empty())
150                 label = type;
151         else if (inner.empty())
152                 label = bformat(_("%1$s (%2$s)"),
153                         type, frame);
154         else if (frame.empty())
155                 label = bformat(_("%1$s (%2$s)"),
156                         type, inner);
157         else
158                 label = bformat(_("%1$s (%2$s, %3$s)"),
159                         type, inner, frame);
160         setLabel(label);
161 }
162
163
164 bool InsetBox::hasFixedWidth() const
165 {
166         return !params_.width.empty();
167 }
168
169
170 bool InsetBox::allowMultiPar() const
171 {
172         return (params_.inner_box && !params_.use_makebox)
173                 || params_.type == "Shaded" || params_.type == "Framed";
174 }
175
176
177 void InsetBox::metrics(MetricsInfo & m, Dimension & dim) const
178 {
179         // back up textwidth.
180         int textwidth_backup = m.base.textwidth;
181         if (hasFixedWidth())
182                 m.base.textwidth = params_.width.inPixels(m.base);
183         InsetCollapsable::metrics(m, dim);
184         // retore textwidth.
185         m.base.textwidth = textwidth_backup;
186 }
187
188
189 bool InsetBox::forcePlainLayout(idx_type) const
190 {
191         return (!params_.inner_box || params_.use_makebox)
192                 && params_.type != "Shaded" && params_.type != "Framed";
193 }
194
195
196 ColorCode InsetBox::backgroundColor(PainterInfo const &) const
197 {
198         if (params_.type != "Shaded")
199                 return getLayout().bgcolor();
200         // FIXME: This hardcoded color is a hack!
201         if (buffer().params().boxbgcolor == lyx::rgbFromHexName("#ff0000"))
202                 return getLayout().bgcolor();
203         ColorCode c = lcolor.getFromLyXName("boxbgcolor");
204         if (c == Color_none)
205                 return getLayout().bgcolor();
206         return c;
207 }
208
209
210 void InsetBox::doDispatch(Cursor & cur, FuncRequest & cmd)
211 {
212         switch (cmd.action()) {
213
214         case LFUN_INSET_MODIFY: {
215                 //lyxerr << "InsetBox::dispatch MODIFY" << endl;
216                 string const first_arg = cmd.getArg(0);
217                 bool const change_type = first_arg == "changetype";
218                 bool const for_box = first_arg == "box";
219                 if (!change_type && !for_box) {
220                         // not for us
221                         // this will not be handled higher up
222                         cur.undispatched();
223                         return;
224                 }
225                 cur.recordUndoInset(this);
226                 if (change_type)
227                         params_.type = cmd.getArg(1);
228                 else // if (for_box)
229                         string2params(to_utf8(cmd.argument()), params_);
230                 setButtonLabel();
231                 break;
232         }
233
234         default:
235                 InsetCollapsable::doDispatch(cur, cmd);
236                 break;
237         }
238 }
239
240
241 bool InsetBox::getStatus(Cursor & cur, FuncRequest const & cmd,
242                 FuncStatus & flag) const
243 {
244         switch (cmd.action()) {
245
246         case LFUN_INSET_MODIFY: {
247                 string const first_arg = cmd.getArg(0);
248                 if (first_arg == "changetype") {
249                         string const type = cmd.getArg(1);
250                         flag.setOnOff(type == params_.type);
251                         flag.setEnabled(!params_.inner_box || type != "Framed");
252                         return true;
253                 }
254                 if (first_arg == "box") {
255                         flag.setEnabled(true);
256                         return true;
257                 }
258                 return InsetCollapsable::getStatus(cur, cmd, flag);
259         }
260
261         case LFUN_INSET_DIALOG_UPDATE:
262                 flag.setEnabled(true);
263                 return true;
264
265         default:
266                 return InsetCollapsable::getStatus(cur, cmd, flag);
267         }
268 }
269
270
271 const string defaultThick = "0.4pt";
272 const string defaultSep = "3pt";
273 const string defaultShadow = "4pt";
274
275 void InsetBox::latex(otexstream & os, OutputParams const & runparams) const
276 {
277         BoxType btype = boxtranslator().find(params_.type);
278
279         string width_string = params_.width.asLatexString();
280         string thickness_string = params_.thickness.asLatexString();
281         string separation_string = params_.separation.asLatexString();
282         string shadowsize_string = params_.shadowsize.asLatexString();
283         bool stdwidth = false;
284         // in general the overall width of some decorated boxes is wider thean the inner box
285         // we could therefore calculate the real width for all sizes so that if the user wants
286         // e.g. 0.1\columnwidth or 2cm he gets exactly this size
287         // however this makes problems when importing TeX code
288         // therefore only recalculate for the most common case that the box should not protrude
289         // the page margins
290         if (params_.inner_box
291                 && ((width_string.find("1\\columnwidth") != string::npos
292                         || width_string.find("1\\textwidth") != string::npos)
293                         || width_string.find("1\\paperwidth") != string::npos
294                         || width_string.find("1\\linewidth") != string::npos)) {
295                 stdwidth = true;
296                 switch (btype) {
297                 case Frameless:
298                         break;
299                 case Framed:
300                         width_string += " - 2\\FrameSep - 2\\FrameRule";
301                         break;
302                 case Boxed:
303                         width_string += " - 2\\fboxsep - 2\\fboxrule";
304                         break;
305                 case Shaded:
306                         break;
307                 case ovalbox:
308                         width_string += " - 2\\fboxsep - 0.8pt";
309                         break;
310                 case Ovalbox:
311                         width_string += " - 2\\fboxsep - 1.6pt";
312                         break;
313                 case Shadowbox:
314                         width_string += " - 2\\fboxsep - 2\\fboxrule - \\shadowsize";
315                         break;
316                 case Doublebox:
317                         width_string += " - 2\\fboxsep - 7.5\\fboxrule - 1pt";
318                         break;
319                 }
320         }
321
322         os << safebreakln;
323         if (runparams.lastid != -1)
324                 os.texrow().start(runparams.lastid, runparams.lastpos);
325
326         // adapt column/text width correctly also if paragraphs indented
327         if (stdwidth && !(buffer().params().paragraph_separation))
328                 os << "\\noindent";
329
330         switch (btype) {
331         case Frameless:
332                 break;
333         case Framed:
334                 if (!(thickness_string.find(defaultThick) != string::npos)) {
335                         os << "{\\FrameRule " << from_ascii(thickness_string);
336                         if (!(separation_string.find(defaultSep) != string::npos))
337                                 os << "\\FrameSep " << from_ascii(separation_string);
338                 }
339                 if (!(separation_string.find(defaultSep) != string::npos)
340                         && (thickness_string.find(defaultThick) != string::npos))
341                         os << "{\\FrameSep " << from_ascii(separation_string);
342
343                 os << "\\begin{framed}%\n";
344                 break;
345         case Boxed:
346                 if (!(thickness_string.find(defaultThick) != string::npos)) {
347                         os << "{\\fboxrule " << from_ascii(thickness_string);
348                         if (!(separation_string.find(defaultSep) != string::npos))
349                                 os << "\\fboxsep " << from_ascii(separation_string);
350                 }
351                 if (!(separation_string.find(defaultSep) != string::npos)
352                         && (thickness_string.find(defaultThick) != string::npos))
353                         os << "{\\fboxsep " << from_ascii(separation_string);
354                 if (!params_.inner_box && !width_string.empty()) {
355                         os << "\\framebox";
356                         // Special widths, see usrguide sec. 3.5
357                         // FIXME UNICODE
358                         if (params_.special != "none") {
359                                 os << "[" << params_.width.value()
360                                    << '\\' << from_utf8(params_.special)
361                                    << ']';
362                         } else
363                                 os << '[' << from_ascii(width_string)
364                                    << ']';
365                         if (params_.hor_pos != 'c')
366                                 os << "[" << params_.hor_pos << "]";
367                 } else
368                         os << "\\fbox";
369                 os << "{";
370                 break;
371         case ovalbox:
372                 if (!separation_string.empty() && separation_string.find(defaultSep) == string::npos)
373                         os << "{\\fboxsep " << from_ascii(separation_string);
374                 os << "\\ovalbox{";
375                 break;
376         case Ovalbox:
377                 if (!separation_string.empty() && separation_string.find(defaultSep) == string::npos)
378                         os << "{\\fboxsep " << from_ascii(separation_string);
379                 os << "\\Ovalbox{";
380                 break;
381         case Shadowbox:
382                 if (!(thickness_string.find(defaultThick) != string::npos)) {
383                         os << "{\\fboxrule " << from_ascii(thickness_string);
384                         if (!(separation_string.find(defaultSep) != string::npos)) {
385                                 os << "\\fboxsep " << from_ascii(separation_string);
386                                 if (!(shadowsize_string.find(defaultShadow) != string::npos))
387                                         os << "\\shadowsize " << from_ascii(shadowsize_string);
388                         }
389                         if (!(shadowsize_string.find(defaultShadow) != string::npos)
390                                 && (separation_string.find(defaultSep) != string::npos))
391                                 os << "\\shadowsize " << from_ascii(shadowsize_string);
392                 }
393                 if (!(separation_string.find(defaultSep) != string::npos)
394                         && (thickness_string.find(defaultThick) != string::npos)) {
395                                 os << "{\\fboxsep " << from_ascii(separation_string);
396                                 if (!(shadowsize_string.find(defaultShadow) != string::npos))
397                                         os << "\\shadowsize " << from_ascii(shadowsize_string);
398                 }
399                 if (!(shadowsize_string.find(defaultShadow) != string::npos)
400                                 && (separation_string.find(defaultSep) != string::npos)
401                                 && (thickness_string.find(defaultThick) != string::npos))
402                                 os << "{\\shadowsize " << from_ascii(shadowsize_string);
403                 os << "\\shadowbox{";
404                 break;
405         case Shaded:
406                 // must be set later because e.g. the width settings only work when
407                 // it is inside a minipage or parbox
408                 break;
409         case Doublebox:
410                 if (!(thickness_string.find(defaultThick) != string::npos)) {
411                         os << "{\\fboxrule " << from_ascii(thickness_string);
412                         if (!(separation_string.find(defaultSep) != string::npos))
413                                 os << "\\fboxsep " << from_ascii(separation_string);
414                 }
415                 if (!(separation_string.find(defaultSep) != string::npos)
416                         && (thickness_string.find(defaultThick) != string::npos))
417                         os << "{\\fboxsep " << from_ascii(separation_string);
418                 os << "\\doublebox{";
419                 break;
420         }
421
422         if (params_.inner_box) {
423                 if (params_.use_parbox)
424                         os << "\\parbox";
425                 else if (params_.use_makebox) {
426                         if (!width_string.empty()) {
427                                 os << "\\makebox";
428                                 // FIXME UNICODE
429                                 // output the width and horizontal position
430                                 if (params_.special != "none") {
431                                         os << "[" << params_.width.value()
432                                            << '\\' << from_utf8(params_.special)
433                                            << ']';
434                                 } else
435                                         os << '[' << from_ascii(width_string)
436                                            << ']';
437                                 if (params_.hor_pos != 'c')
438                                         os << "[" << params_.hor_pos << "]";
439                         } else
440                                 os << "\\mbox";
441                         os << "{";
442                 }
443                 else
444                         os << "\\begin{minipage}";
445
446                 // output parameters for parbox and minipage
447                 if (!params_.use_makebox) {
448                         os << "[" << params_.pos << "]";
449                         if (params_.height_special == "none") {
450                                 // FIXME UNICODE
451                                 os << "[" << from_ascii(params_.height.asLatexString()) << "]";
452                         } else {
453                                 // Special heights
454                                 // set no optional argument when the value is the default "1\height"
455                                 // (special units like \height are handled as "in")
456                                 // but when the user has chosen a non-default inner_pos, the height
457                                 // must be given: \minipage[pos][height][inner-pos]{width}
458                                 if ((params_.height != Length("1in") ||
459                                         params_.height_special != "totalheight") ||
460                                         params_.inner_pos != params_.pos) {
461                                                 // FIXME UNICODE
462                                                 os << "[" << params_.height.value()
463                                                         << "\\" << from_utf8(params_.height_special) << "]";
464                                 }
465                         }
466                         if (params_.inner_pos != params_.pos)
467                                 os << "[" << params_.inner_pos << "]";
468                         // FIXME UNICODE
469                         os << '{' << from_ascii(width_string) << '}';
470                         if (params_.use_parbox)
471                                 os << "{";
472                 }
473
474                 os << "%\n";
475         } // end if inner_box
476
477         if (btype == Shaded) {
478                 os << "\\begin{shaded}%\n";
479         }
480
481         // \framebox and \makebox handle hor_pos their own way
482         // hor_pos is senseless for \mbox and \fbox
483         if (!(params_.use_makebox)
484                 && !(btype == Boxed && !params_.inner_box)) {
485                         switch (params_.hor_pos) {
486                         case 'l':
487                                 // do nothing because this is LaTeX's default
488                                 break;
489                         case 'c':
490                                 os << "\\centering ";
491                                 break;
492                         case 'r':
493                                 os << "\\raggedleft ";
494                                 break;
495                         }
496         }
497
498         InsetText::latex(os, runparams);
499
500         if (btype == Shaded)
501                 os << "\\end{shaded}";
502
503         if (params_.inner_box) {
504                 if (params_.use_parbox || params_.use_makebox)
505                         os << "%\n}";
506                 else
507                         os << "%\n\\end{minipage}";
508         }
509
510         switch (btype) {
511         case Frameless:
512                 break;
513         case Framed:
514                 os << "\\end{framed}";
515                 if (!(separation_string.find(defaultSep) != string::npos)
516                         || !(thickness_string.find(defaultThick) != string::npos))
517                         os << "}";
518                 break;
519         case Boxed:
520                 os << "}";
521                 if (!(separation_string.find(defaultSep) != string::npos)
522                         || !(thickness_string.find(defaultThick) != string::npos))
523                         os << "}";
524                 break;
525         case ovalbox:
526                 os << "}";
527                 if (!(separation_string.find(defaultSep) != string::npos))
528                         os << "}";
529                 break;
530         case Ovalbox:
531                 os << "}";
532                 if (!(separation_string.find(defaultSep) != string::npos))
533                         os << "}";
534                 break;
535         case Doublebox:
536                 os << "}";
537                 if (!(separation_string.find(defaultSep) != string::npos)
538                         || !(thickness_string.find(defaultThick) != string::npos))
539                         os << "}";
540                 break;
541         case Shadowbox:
542                 os << "}";
543                 if (!(separation_string.find(defaultSep) != string::npos)
544                         || !(thickness_string.find(defaultThick) != string::npos)
545                         || !(shadowsize_string.find(defaultShadow) != string::npos))
546                         os << "}";
547                 break;
548         case Shaded:
549                 // already done
550                 break;
551         }
552 }
553
554
555 int InsetBox::plaintext(odocstringstream & os,
556        OutputParams const & runparams, size_t max_length) const
557 {
558         BoxType const btype = boxtranslator().find(params_.type);
559
560         switch (btype) {
561                 case Frameless:
562                         break;
563                 case Framed:
564                 case Boxed:
565                         os << "[\n";
566                         break;
567                 case ovalbox:
568                         os << "(\n";
569                         break;
570                 case Ovalbox:
571                         os << "((\n";
572                         break;
573                 case Shadowbox:
574                 case Shaded:
575                         os << "[/\n";
576                         break;
577                 case Doublebox:
578                         os << "[[\n";
579                         break;
580         }
581
582         InsetText::plaintext(os, runparams, max_length);
583
584         int len = 0;
585         switch (btype) {
586                 case Frameless:
587                         os << "\n";
588                         break;
589                 case Framed:
590                 case Boxed:
591                         os << "\n]";
592                         len = 1;
593                         break;
594                 case ovalbox:
595                         os << "\n)";
596                         len = 1;
597                         break;
598                 case Ovalbox:
599                         os << "\n))";
600                         len = 2;
601                         break;
602                 case Shadowbox:
603                 case Shaded:
604                         os << "\n/]";
605                         len = 2;
606                         break;
607                 case Doublebox:
608                         os << "\n]]";
609                         len = 2;
610                         break;
611         }
612
613         return PLAINTEXT_NEWLINE + len; // len chars on a separate line
614 }
615
616
617 int InsetBox::docbook(odocstream & os, OutputParams const & runparams) const
618 {
619         return InsetText::docbook(os, runparams);
620 }
621
622
623 docstring InsetBox::xhtml(XHTMLStream & xs, OutputParams const & runparams) const
624 {
625         // construct attributes
626         string attrs = "class='" + params_.type + "'";
627         string style;
628         if (!params_.width.empty()) {
629                 string w = params_.width.asHTMLString();
630                 if (w != "100%")
631                         style += ("width: " + params_.width.asHTMLString() + "; ");
632         }
633         // The special heights don't really mean anything for us.
634         if (!params_.height.empty() && params_.height_special == "none")
635                 style += ("height: " + params_.height.asHTMLString() + "; ");
636         if (!style.empty())
637                 attrs += " style='" + style + "'";
638
639         xs << html::StartTag("div", attrs);
640         XHTMLOptions const opts = InsetText::WriteLabel | InsetText::WriteInnerTag;
641         docstring defer = InsetText::insetAsXHTML(xs, runparams, opts);
642         xs << html::EndTag("div");
643         xs << defer;
644         return docstring();
645 }
646
647
648 void InsetBox::validate(LaTeXFeatures & features) const
649 {
650         BoxType btype = boxtranslator().find(params_.type);
651         switch (btype) {
652         case Frameless:
653                 break;
654         case Framed:
655                 features.require("calc");
656                 features.require("framed");
657                 break;
658         case Boxed:
659                 features.require("calc");
660                 break;
661         case ovalbox:
662         case Ovalbox:
663         case Shadowbox:
664         case Doublebox:
665                 features.require("calc");
666                 features.require("fancybox");
667                 break;
668         case Shaded:
669                 features.require("color");
670                 features.require("framed");
671                 break;
672         }
673         InsetCollapsable::validate(features);
674 }
675
676
677 string InsetBox::contextMenuName() const
678 {
679         return "context-box";
680 }
681
682
683 string InsetBox::params2string(InsetBoxParams const & params)
684 {
685         ostringstream data;
686         data << "box" << ' ';
687         params.write(data);
688         return data.str();
689 }
690
691
692 void InsetBox::string2params(string const & in, InsetBoxParams & params)
693 {
694         if (in.empty())
695                 return;
696
697         istringstream data(in);
698         Lexer lex;
699         lex.setStream(data);
700
701         string name;
702         lex >> name;
703         if (!lex || name != "box") {
704                 LYXERR0("InsetBox::string2params(" << in << ")\n"
705                                           "Expected arg 1 to be \"box\"\n");
706                 return;
707         }
708
709         // This is part of the inset proper that is usually swallowed
710         // by Text::readInset
711         string id;
712         lex >> id;
713         if (!lex || id != "Box") {
714                 LYXERR0("InsetBox::string2params(" << in << ")\n"
715                                           "Expected arg 2 to be \"Box\"\n");
716         }
717
718         params = InsetBoxParams(string());
719         params.read(lex);
720 }
721
722
723 /////////////////////////////////////////////////////////////////////////
724 //
725 // InsetBoxParams
726 //
727 /////////////////////////////////////////////////////////////////////////
728
729 InsetBoxParams::InsetBoxParams(string const & label)
730         : type(label),
731           use_parbox(false),
732           use_makebox(false),
733           inner_box(true),
734           width(Length("100col%")),
735           special("none"),
736           pos('t'),
737           hor_pos('c'),
738           inner_pos('t'),
739           height(Length("1in")),
740           height_special("totalheight"), // default is 1\\totalheight
741           thickness(Length(defaultThick)),
742           separation(Length(defaultSep)),
743           shadowsize(Length(defaultShadow))
744 {}
745
746
747 void InsetBoxParams::write(ostream & os) const
748 {
749         os << "Box " << type << "\n";
750         os << "position \"" << pos << "\"\n";
751         os << "hor_pos \"" << hor_pos << "\"\n";
752         os << "has_inner_box " << inner_box << "\n";
753         os << "inner_pos \"" << inner_pos << "\"\n";
754         os << "use_parbox " << use_parbox << "\n";
755         os << "use_makebox " << use_makebox << "\n";
756         os << "width \"" << width.asString() << "\"\n";
757         os << "special \"" << special << "\"\n";
758         os << "height \"" << height.asString() << "\"\n";
759         os << "height_special \"" << height_special << "\"\n";
760         os << "thickness \"" << thickness.asString() << "\"\n";
761         os << "separation \"" << separation.asString() << "\"\n";
762         os << "shadowsize \"" << shadowsize.asString() << "\"\n";
763 }
764
765
766 void InsetBoxParams::read(Lexer & lex)
767 {
768         lex.setContext("InsetBoxParams::read");
769         lex >> type;
770         lex >> "position" >> pos;
771         lex >> "hor_pos" >> hor_pos;
772         lex >> "has_inner_box" >> inner_box;
773         if (type == "Framed")
774                 inner_box = false;
775         lex >> "inner_pos" >> inner_pos;
776         lex >> "use_parbox" >> use_parbox;
777         lex >> "use_makebox" >> use_makebox;
778         lex >> "width" >> width;
779         lex >> "special" >> special;
780         lex >> "height" >> height;
781         lex >> "height_special" >> height_special;
782         lex >> "thickness" >> thickness;
783         lex >> "separation" >> separation;
784         lex >> "shadowsize" >> shadowsize;
785 }
786
787
788 } // namespace lyx