ownerPar for gerParentLanguage

fixed formatting


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7618 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2003-08-27 15:38:23 +00:00
parent 8f2e2d474b
commit 59336f855b
8 changed files with 24 additions and 21 deletions

View File

@ -641,25 +641,11 @@ LyXText * BufferView::getLyXText() const
}
LyXText * BufferView::getParentText(InsetOld * inset) const
{
if (inset->owner()) {
LyXText * txt = inset->getLyXText(this);
inset = inset->owner();
while (inset && inset->getLyXText(this) == txt)
inset = inset->owner();
if (inset)
return inset->getLyXText(this);
}
return text;
}
Language const * BufferView::getParentLanguage(InsetOld * inset) const
{
LyXText * text = getParentText(inset);
return text->cursor.par()->getFontSettings(buffer()->params,
text->cursor.pos()).language();
Paragraph const & par = ownerPar(*buffer(), inset);
return par.getFontSettings(buffer()->params,
par.getPositionOfInset(inset)).language();
}

View File

@ -205,9 +205,6 @@ private:
/// Set the current locking inset
void theLockingInset(UpdatableInset * inset);
/// return the lyxtext containing this inset
LyXText * getParentText(InsetOld * inset) const;
/**
* Change all insets with the given code's contents to a new
* string. May only be used with InsetCommand-derived insets

View File

@ -1,3 +1,8 @@
2003-08-27 André Pönitz <poenitz@gmx.net>
* BufferView.[Ch]: remove getParentText, implement getParentLanguage
on top of ownerPar().
2003-08-27 John Levon <levon@movementarian.org>
* funcrequest.C: properly initialise POD members

View File

@ -24,6 +24,7 @@
#include "lyx_forms.h"
#include "support/tostr.h"
#include "support/lstrings.h"
using namespace lyx::support;

View File

@ -288,6 +288,12 @@ ParagraphList::const_iterator ParConstIterator::operator->() const
}
ParagraphList const & ParConstIterator::plist() const
{
return *pimpl_->positions.back().plist;
}
size_t ParConstIterator::size() const
{
return pimpl_->positions.size();

View File

@ -71,6 +71,8 @@ public:
Paragraph const & operator*() const;
///
ParagraphList::const_iterator operator->() const;
///
ParagraphList const & plist() const;
/// depth of nesting
size_t size() const;

View File

@ -1076,6 +1076,12 @@ Paragraph const & ownerPar(Buffer const & buf, InsetOld const * inset)
ParConstIterator pit = buf.par_iterator_begin();
ParConstIterator end = buf.par_iterator_end();
for ( ; pit != end; ++pit) {
ParagraphList * plist;
// the second '=' below is intentional
for (int i = 0; (plist = inset->getParagraphs(i)); ++i)
if (plist == &pit.plist())
return *pit.pit();
InsetList::const_iterator ii = pit->insetlist.begin();
InsetList::const_iterator iend = pit->insetlist.end();
for ( ; ii != iend; ++ii)

View File

@ -1935,7 +1935,7 @@ void LyXText::backspace()
// Pasting is not allowed, if the paragraphs have different
// layout. I think it is a real bug of all other
// word processors to allow it. It confuses the user.
//Correction: Pasting is always allowed with standard-layout
// Correction: Pasting is always allowed with standard-layout
LyXTextClass const & tclass =
bv()->buffer()->params.getLyXTextClass();