]> git.lyx.org Git - features.git/commitdiff
Text::Inset(): now returns a reference in order to make clear that the owner is manda...
authorAbdelrazak Younes <younes@lyx.org>
Sun, 9 Aug 2009 16:19:43 +0000 (16:19 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Sun, 9 Aug 2009 16:19:43 +0000 (16:19 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30947 a592a061-630c-0410-9148-cb99ea01b6c8

src/Text.cpp
src/Text.h
src/TextMetrics.cpp
src/frontends/qt4/GuiToolbar.cpp
src/output_latex.cpp

index 3913feec99d13458348dc4b4283118d43f16deca..8edbe2f0a69815407583f37e24e9ea08d4793bc8 100644 (file)
@@ -79,6 +79,12 @@ namespace lyx {
 using cap::cutSelection;
 using cap::pasteParagraphList;
 
+InsetText const & Text::inset() const
+{
+       return *owner_;
+}
+
+
 void Text::readParToken(Paragraph & par, Lexer & lex,
        string const & token, Font & font, Change & change, ErrorList & errorList)
 {
index 06850e53503a278f25b4e8fb33d1b123d829ee1c..848f45b5ec1c13bd8c27013c166e9a35f49fa4dc 100644 (file)
@@ -47,8 +47,8 @@ public:
        /// \warning a non standard layout on an empty paragraph doesn't
        // count as empty.
        bool empty() const;
-
-       InsetText const * inset() const { return owner_; }
+       /// Access to owner InsetText.
+       InsetText const & inset() const;
 
        ///
        FontInfo layoutFont(pit_type pit) const;
@@ -315,11 +315,7 @@ public:
 private:
        /// The InsetText owner shall have access to everything.
        friend class InsetText;
-       ///
-       ParagraphList pars_;
 
-       ///
-       bool autoBreakRows_;
        /// return past-the-last paragraph influenced by a layout
        /// change on pit
        pit_type undoSpan(pit_type pit);
@@ -353,7 +349,10 @@ private:
 
        /// Owner Inset.
        InsetText * owner_;
-
+       ///
+       ParagraphList pars_;
+       ///
+       bool autoBreakRows_;
        /// position of the text in the buffer.
        DocIterator macrocontext_position_;
 };
index dcc9744f07ed2bf17b565ad2d8be049d4e70c4d4..20aa586a4424ccdf42246c9109de4dfcdce47cdd 100644 (file)
@@ -42,6 +42,8 @@
 #include "TextClass.h"
 #include "VSpace.h"
 
+#include "insets/InsetText.h"
+
 #include "mathed/MacroTable.h"
 #include "mathed/MathMacroTemplate.h"
 
@@ -1965,7 +1967,7 @@ int TextMetrics::leftMargin(int max_width,
            && align == LYX_ALIGN_BLOCK
            && !par.params().noindent()
            // in some insets, paragraphs are never indented
-           && !par.inInset().neverIndent()
+           && !text_->inset().neverIndent()
            // display style insets are always centered, omit indentation
            && !(!par.empty()
                    && par.isInset(pos)
index 7166dd4d58ae49206e271155b90c9f6f7a13f298..7b0c20213e2d26c84d9f7f3db7f17c6e79621b5f 100644 (file)
@@ -39,6 +39,8 @@
 #include "Paragraph.h"
 #include "TextClass.h"
 
+#include "insets/InsetText.h"
+
 #include "support/debug.h"
 #include "support/filetools.h"
 #include "support/gettext.h"
@@ -609,7 +611,7 @@ void GuiLayoutBox::updateContents(bool reset)
        // or we've moved from one inset to another
        DocumentClass const * text_class = &buffer->params().documentClass();
        Inset const * inset = 
-               &(owner_.view()->cursor().innerParagraph().inInset());
+               &(owner_.view()->cursor().innerText()->inset());
        if (!reset && text_class_ == text_class && inset_ == inset) {
                set(owner_.view()->cursor().innerParagraph().layout().name());
                return;
index cc551d8d1d65e49559a12d38c7d90adb74126ae2..59c114042337a39559cfd7dd34b5e1cb5139353f 100644 (file)
@@ -75,7 +75,7 @@ TeXDeeper(Buffer const & buf,
 
        ParagraphList const & paragraphs = text.paragraphs();
 
-       bool const force_plain_layout = text.inset()->forcePlainLayout();
+       bool const force_plain_layout = text.inset().forcePlainLayout();
        while (par != paragraphs.end() &&
                                        par->params().depth() == pit->params().depth()) {
                // FIXME This test should not be necessary.
@@ -109,7 +109,7 @@ TeXEnvironment(Buffer const & buf,
 
        // FIXME This test should not be necessary.
        // We should perhaps issue an error if it is.
-       Layout const & style = text.inset()->forcePlainLayout() ?
+       Layout const & style = text.inset().forcePlainLayout() ?
                bparams.documentClass().plainLayout() : pit->layout();
 
        ParagraphList const & paragraphs = text.paragraphs();
@@ -329,7 +329,7 @@ ParagraphList::const_iterator TeXOnePar(Buffer const & buf,
 
        // FIXME This check should not really be needed.
        // Perhaps we should issue an error if it is.
-       Layout const style = text.inset()->forcePlainLayout() ?
+       Layout const style = text.inset().forcePlainLayout() ?
                bparams.documentClass().plainLayout() : pit->layout();
 
        runparams.moving_arg |= style.needprotect;
@@ -830,7 +830,7 @@ void latexParagraphs(Buffer const & buf,
                lastpar = par;
                // FIXME This check should not be needed. We should
                // perhaps issue an error if it is.
-               Layout const & layout = text.inset()->forcePlainLayout() ?
+               Layout const & layout = text.inset().forcePlainLayout() ?
                                tclass.plainLayout() : par->layout();
 
                if (layout.intitle) {