2 * \file ControlParagraph.cpp
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
7 * \author Angus Leeming
9 * Full author contact details are available in file CREDITS.
14 #include "ControlParagraph.h"
16 #include "BufferParams.h"
17 #include "BufferView.h"
19 #include "FuncRequest.h"
21 #include "Paragraph.h"
22 #include "ParagraphParameters.h"
26 using std::istringstream;
27 using std::ostringstream;
33 ControlParagraph::ControlParagraph(Dialog & parent)
38 ParagraphParameters & ControlParagraph::params()
40 if (haveMulitParSelection()) {
41 multiparsel_ = ParagraphParameters();
42 // FIXME: It would be nice to initialise the parameters that
43 // are common to all paragraphs.
47 return bufferview()->cursor().innerParagraph().params();
51 ParagraphParameters const & ControlParagraph::params() const
53 return bufferview()->cursor().innerParagraph().params();
57 void ControlParagraph::dispatchParams()
59 if (haveMulitParSelection()) {
61 multiparsel_.write(data);
62 FuncRequest const fr(LFUN_PARAGRAPH_PARAMS_APPLY, data.str());
67 bufferview()->updateMetrics(false);
68 bufferview()->buffer().changed();
72 bool ControlParagraph::haveMulitParSelection()
74 Cursor cur = bufferview()->cursor();
75 return cur.selection() && cur.selBegin().pit() != cur.selEnd().pit();
79 bool ControlParagraph::canIndent() const
81 return buffer().params().paragraph_separation ==
82 BufferParams::PARSEP_INDENT;
86 LyXAlignment ControlParagraph::alignPossible() const
88 return bufferview()->cursor().innerParagraph().layout()->alignpossible;
92 LyXAlignment ControlParagraph::alignDefault() const
94 return bufferview()->cursor().innerParagraph().layout()->align;
97 } // namespace frontend