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 "lyxtextclasslist.h"
26 #include "support/LAssert.h"
28 using Liason::setMinibuffer;
31 ControlParagraph::ControlParagraph(LyXView & lv, Dialogs & d)
32 : ControlDialogBD(lv, d), pp_(0), ininset_(false)
36 ControlParagraph::~ControlParagraph()
40 ParagraphParameters & ControlParagraph::params()
42 lyx::Assert(pp_.get());
47 bool ControlParagraph::inInset() const
53 LyXAlignment ControlParagraph::alignPossible() const
59 void ControlParagraph::apply()
61 if (!lv_.view()->available())
66 LyXText * text(lv_.view()->getLyXText());
67 text->setParagraph(lv_.view(),
71 pp_->pagebreakBottom(),
76 pp_->labelWidthString(),
79 // Actually apply these settings
80 lv_.view()->update(text,
85 lv_.buffer()->markDirty();
87 setMinibuffer(&lv_, _("Paragraph layout set"));
91 void ControlParagraph::setParams()
94 pp_.reset(new ParagraphParameters());
97 Paragraph const * par_ = lv_.view()->getLyXText()->cursor.par();
99 /// Set the paragraph parameters
100 *pp_ = par_->params();
102 /// this needs to be done separately
103 pp_->labelWidthString(par_->getLabelWidthString());
106 LyXTextClass const & tclass =
107 textclasslist[lv_.view()->buffer()->params.textclass];
108 if (pp_->align() == LYX_ALIGN_LAYOUT)
109 pp_->align(tclass[par_->layout()].align);
111 /// is alignment possible
112 alignpos_ = tclass[par_->layout()].alignpossible;
114 /// is paragraph in inset
115 ininset_ = par_->inInset();