[Libreoffice-commits] core.git: Branch 'feature/gsoc14-draw-chained-text-boxes' - editeng/source include/editeng

matteocam matteo.campanelli at gmail.com
Sun Aug 3 11:11:53 PDT 2014


 editeng/source/editeng/editeng.cxx   |    5 +++++
 editeng/source/editeng/impedit.hxx   |    6 ++++++
 editeng/source/editeng/impedit3.cxx  |    6 ++++++
 editeng/source/outliner/outliner.cxx |   12 +++++++++++-
 include/editeng/editeng.hxx          |    3 ++-
 5 files changed, 30 insertions(+), 2 deletions(-)

New commits:
commit 8dbcf9c50f2f7093e7864d94a736efa9388d806b
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Sun Aug 3 19:04:36 2014 +0300

    Overflowing paragraph number depends on breakup point.
    
    Change-Id: I2bcc12b69a7d6729ad69760191ef76cd1f097768

diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 7b4d94a..6cbac8d 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -2771,6 +2771,11 @@ EditPaM EditEngine::InsertLineBreak(const EditSelection& rEditSelection)
     return pImpEditEngine->InsertLineBreak(rEditSelection);
 }
 
+sal_Int32 EditEngine::GetOverflowingParaNum() const {
+    return pImpEditEngine->GetOverflowingParaNum();
+}
+
+
 EFieldInfo::EFieldInfo()
 {
     pFieldItem = NULL;
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 506d597..a1ddccc 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -464,6 +464,9 @@ private:
     sal_uInt32          nCurTextHeightNTP;  // without trailing empty paragraphs
     sal_uInt16          nOnePixelInRef;
 
+    // For Chaining
+    sal_Int32 mnOverflowingPara = -1;
+
     IdleFormattter      aIdleFormatter;
 
     Timer               aOnlineSpellTimer;
@@ -1016,6 +1019,9 @@ public:
     /// specifies if auto-correction should capitalize the first word or not (default is on)
     void            SetFirstWordCapitalization( bool bCapitalize )  { bFirstWordCapitalization = bCapitalize; }
     bool            IsFirstWordCapitalization() const   { return bFirstWordCapitalization; }
+
+    sal_Int32 GetOverflowingParaNum() const { return mnOverflowingPara; }
+    void SetOverflowingParaNum(sal_Int32 nPara) { mnOverflowingPara = nPara; }
 };
 
 inline EPaM ImpEditEngine::CreateEPaM( const EditPaM& rPaM )
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 77264b4..db1aad8 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -363,6 +363,8 @@ bool ImpEditEngine::IsPageOverflow( const Size aCurPaperSize, const Size aPrevPa
     const bool bPageExpansionY = ( aPrevPaperSize.Height() != 0 ) && // XXX
                             ( aCurPaperSize.Height() > aPrevPaperSize.Height() );
 
+    // Has text size changed (in the right vertical direction) AND
+    //      is this change an expansion?
     return ( bTextGrowY && !IsVertical() && bPageExpansionY ) ||
            ( bTextGrowX && IsVertical() &&  bPageExpansionX );
 
@@ -423,6 +425,10 @@ void ImpEditEngine::FormatDoc()
                 if ( IsCallParaInsertedOrDeleted() )
                     GetEditEnginePtr()->ParagraphHeightChanged( nPara );
                 pParaPortion->SetMustRepaint( false );
+
+                // FIXME(matteocam)
+                // set possible point for chainging
+                mnOverflowingPara = nPara;
             }
 
             // InvalidRect set only once...
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index f196875..e4c2614 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -2100,7 +2100,13 @@ OutlinerParaObject *Outliner::GetNonOverflowingParaObject() const
 
     // XXX: returns first paragraph
     sal_Int32 nStartPara = 0;
-    sal_Int32 nCount = 1;
+    sal_Int32 nCount = pEditEngine->GetOverflowingParaNum()-1;
+    //sal_Int32 nCount = 1;
+
+    if ( nCount == 0 ) // Only overflowing text
+        return NULL;
+    else if (nCount < 0) // No overflowing Text
+        nCount = GetParagraphCount();
 
     // code inspired from Outliner::CreateParaObject
 
@@ -2124,11 +2130,15 @@ OutlinerParaObject *Outliner::GetNonOverflowingParaObject() const
 }
 OutlinerParaObject *Outliner::GetOverflowingParaObject() const
 {
+    if ( pEditEngine->GetOverflowingParaNum() )
+    return CreateParaObject( pEditEngine->GetOverflowingParaNum() );
+    /*
     // XXX: returns second paragraph if there is one, first otherwise
     if ( GetParagraphCount() >= 2 )
         return CreateParaObject(1, 1);
     else
         return CreateParaObject(0, 1);
+    */
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx
index bb5efa3..a66c6d1 100644
--- a/include/editeng/editeng.hxx
+++ b/include/editeng/editeng.hxx
@@ -186,7 +186,6 @@ private:
 
 protected:
 
-
 public:
                     EditEngine( SfxItemPool* pItemPool );
     virtual         ~EditEngine();
@@ -595,6 +594,8 @@ public:
 
     bool Undo(EditView* pView);
     bool Redo(EditView* pView);
+
+    sal_Int32 GetOverflowingParaNum() const;
 };
 
 #endif // INCLUDED_EDITENG_EDITENG_HXX


More information about the Libreoffice-commits mailing list