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
16 #include "ControlParagraph.h"
18 #include "ParagraphParameters.h"
21 #include "BufferView.h"
25 #include "support/LAssert.h"
27 using Liason::setMinibuffer;
30 ControlParagraph::ControlParagraph(LyXView & lv, Dialogs & d)
31 : ControlDialogBD(lv, d), pp_(0), ininset_(false)
35 ControlParagraph::~ControlParagraph()
39 ParagraphParameters & ControlParagraph::params()
41 lyx::Assert(pp_.get());
46 bool ControlParagraph::inInset() const
52 LyXAlignment ControlParagraph::alignPossible() const
58 void ControlParagraph::apply()
60 if (!lv_.view()->available())
65 LyXText * text(lv_.view()->getLyXText());
66 text->setParagraph(lv_.view(),
70 pp_->pagebreakBottom(),
75 pp_->labelWidthString(),
78 // Actually apply these settings
79 lv_.view()->update(text,
84 lv_.buffer()->markDirty();
86 setMinibuffer(&lv_, _("Paragraph layout set"));
90 void ControlParagraph::setParams()
93 pp_.reset(new ParagraphParameters());
96 Paragraph const * par_ = lv_.view()->getLyXText()->cursor.par();
98 /// Set the paragraph parameters
99 *pp_ = par_->params();
101 /// this needs to be done separately
102 pp_->labelWidthString(par_->getLabelWidthString());
105 LyXLayout_ptr const & layout = par_->layout();
106 if (pp_->align() == LYX_ALIGN_LAYOUT)
107 pp_->align(layout->align);
109 /// is alignment possible
110 alignpos_ = layout->alignpossible;
112 /// is paragraph in inset
113 ininset_ = par_->inInset();