3 * \file ControlParagraph.C
4 * Copyright 2002 The LyX Team.
5 * See the file COPYING.
7 * \author Edwin Leuven <leuven@fee.uva.nl>
13 #pragma implementation
17 #include "ButtonControllerBase.h"
18 #include "ControlParagraph.h"
22 #include "BufferView.h"
26 #include "lyxtextclasslist.h"
27 #include "support/LAssert.h"
29 #include <boost/bind.hpp>
31 using Liason::setMinibuffer;
34 ControlParagraph::ControlParagraph(LyXView & lv, Dialogs & d)
35 : ControlDialogBD(lv, d), pp_(0), ininset_(false)
37 d_.showParagraph = boost::bind(&ControlParagraph::show, this);
40 ParagraphParameters & ControlParagraph::params()
42 lyx::Assert(pp_.get());
46 bool ControlParagraph::inInset() const
51 LyXAlignment ControlParagraph::alignPossible() const
56 void ControlParagraph::apply()
58 if (!lv_.view()->available())
63 LyXText * text(lv_.view()->getLyXText());
64 text->setParagraph(lv_.view(),
68 pp_->pagebreakBottom(),
73 pp_->labelWidthString(),
76 // Actually apply these settings
77 lv_.view()->update(text,
82 lv_.buffer()->markDirty();
84 setMinibuffer(&lv_, _("Paragraph layout set"));
87 void ControlParagraph::setParams()
90 pp_.reset(new ParagraphParameters());
93 Paragraph const * par_ = lv_.view()->getLyXText()->cursor.par();
95 /// Set the paragraph parameters
96 *pp_ = par_->params();
98 /// this needs to be done separately
99 pp_->labelWidthString(par_->getLabelWidthString());
102 LyXTextClass const & tclass =
103 textclasslist[lv_.view()->buffer()->params.textclass];
104 if (pp_->align() == LYX_ALIGN_LAYOUT)
105 pp_->align(tclass[par_->layout()].align);
107 /// is alignment possible
108 alignpos_ = tclass[par_->layout()].alignpossible;
110 /// is paragraph in inset
111 ininset_ = par_->inInset();