De-serialization of the paragraph settings dialog step 3: fix the multi-paragraph selection case.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20512 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-09-26 08:40:16 +00:00
parent 67206b5d60
commit 960af372a8
3 changed files with 18 additions and 5 deletions

View File

@ -37,6 +37,13 @@ ControlParagraph::ControlParagraph(Dialog & parent)
ParagraphParameters & ControlParagraph::params()
{
if (haveMulitParSelection()) {
multiparsel_ = ParagraphParameters();
// FIXME: It would be nice to initialise the parameters that
// are common to all paragraphs.
return multiparsel_;
}
return bufferview()->cursor().paragraph().params();
}
@ -49,6 +56,14 @@ ParagraphParameters const & ControlParagraph::params() const
void ControlParagraph::dispatchParams()
{
if (haveMulitParSelection()) {
ostringstream data;
multiparsel_.write(data);
FuncRequest const fr(LFUN_PARAGRAPH_PARAMS_APPLY, data.str());
dispatch(fr);
return;
}
bufferview()->updateMetrics(false);
bufferview()->buffer().changed();
}

View File

@ -44,6 +44,9 @@ public:
LyXAlignment alignPossible() const;
///
LyXAlignment alignDefault() const;
private:
ParagraphParameters multiparsel_;
};
} // namespace frontend

View File

@ -166,11 +166,6 @@ LyXAlignment GuiParagraphDialog::getAlignmentFromDialog()
void GuiParagraphDialog::applyView()
{
// FIXME: We should not access params() at all!
// we should just pass the relevant GUI information
// and let the controller do the rest.
// With this architecture, only current parent paragraph will be
// modified when we have a multi-paragraph selection.
ParagraphParameters & params = controller().params();
params.align(getAlignmentFromDialog());