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

matteocam matteo.campanelli at gmail.com
Tue Jul 15 07:36:11 PDT 2014


 include/svx/svdotext.hxx                    |    1 
 svx/source/svdraw/svdotext.cxx              |    1 
 svx/source/svdraw/svdotextdecomposition.cxx |   38 ++++++++++++++++++++++------
 3 files changed, 33 insertions(+), 7 deletions(-)

New commits:
commit c41e88995b832eae48b615f0e933a48fd5aa71c2
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Tue Jul 15 16:35:22 2014 +0200

    Added pointer check. Minor changes.
    
    Change-Id: I2127d927372c85d51254191ebc383849dfe5ac09

diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 5d113a9..d867537 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1230,6 +1230,7 @@ void SdrTextObj::ImpInitDrawOutliner( SdrOutliner& rOutl ) const
 
 SdrOutliner& SdrTextObj::ImpGetDrawOutliner() const
 {
+    fprintf(stderr, "pModel=%p \t this=%p\n", pModel, this);
     SdrOutliner& rOutl=pModel->GetDrawOutliner(this);
 
     // Code extracted to ImpInitDrawOutliner()
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index cf4eb9b..ed87bde 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -554,10 +554,11 @@ namespace
         // make text portion primitive with the first part of the portion
         impCreateTextPortionPrimitive(rTruncatedPortionInfo);
 
-        // for debugging purposes (skip experiments)
-        /* bool b = true;
+        // for debugging purposes:
+        // carry out experiments only when setting b=false from gdb
+        bool b = true;
         if (b)
-            return; */
+            return;
 
         /* Some Experiments */
 
@@ -579,6 +580,8 @@ namespace
         if ( pPage && pPage->GetObjCount() > 1) {
             pNextTextObj =  dynamic_cast< SdrTextObj * >(
                                                 pPage->GetObj(1) );
+            if ( pNextTextObj == NULL)
+                return;
         } else {
             fprintf(stderr, "Make New Object please\n");
             return;
@@ -589,7 +592,7 @@ namespace
         /* End Experiments */
 
         // if text is left in original portion, send it back to editeng
-        // FIXME(matteocam)
+        // TODO(matteocam)
     }
 
 
@@ -803,7 +806,7 @@ void SdrTextObj::embedText() const
 
 void SdrTextObj::impCopyTextInTextObj(SdrTextObj *pNextTextObj) const
 {
-    // Code from FitFrameToTextSize
+    // Code inspired from SdrTextObj::FitFrameToTextSize
 
     // avoid copying text in same box
     if ( this ==  pNextTextObj )
@@ -815,8 +818,13 @@ void SdrTextObj::impCopyTextInTextObj(SdrTextObj *pNextTextObj) const
     if( pText!=NULL && pText->GetOutlinerParaObject() && pModel!=NULL)
     {
         Rectangle &aNextRect = pNextTextObj->aRect;
-        SdrOutliner& rOutliner = pNextTextObj->ImpGetDrawOutliner();
-        rOutliner.SetPaperSize(Size(aNextRect.Right()-aNextRect.Left(),aNextRect.Bottom()-aNextRect.Top()));
+        SdrOutliner& rOutliner = pNextTextObj->ImpGetDrawOutliner(); // XXX: shit seems to happen in here
+        rOutliner.SetPaperSize(
+            Size(
+                aNextRect.Right()-aNextRect.Left(),
+                aNextRect.Bottom()-aNextRect.Top()
+                )
+         );
         rOutliner.SetUpdateMode(true);
         rOutliner.SetText(*pText->GetOutlinerParaObject());
         Size aNewSize(rOutliner.CalcTextSize());
commit 26c4db9c6170d2733662c99b78d154d504999a6a
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Tue Jul 15 14:55:05 2014 +0200

    Added embedText
    
    Change-Id: I408bb20ba225f42bd142848a280dcd31a1a0c01d

diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index 44c652a..22fced9 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -587,6 +587,7 @@ public:
         const drawinglayer::geometry::ViewInformation2D& aViewInformation) const;
 
     void impCopyTextInTextObj(SdrTextObj *pNextTextObj) const;
+    void embedText() const;
 
     // timing generators
     void impGetBlinkTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList) const;
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index 57a3d6d..cf4eb9b 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -555,21 +555,28 @@ namespace
         impCreateTextPortionPrimitive(rTruncatedPortionInfo);
 
         // for debugging purposes (skip experiments)
-        bool b = true;
+        /* bool b = true;
         if (b)
-            return;
+            return; */
 
         /* Some Experiments */
 
         const SdrTextObj *pCurTextObj = mrOutliner.GetTextObj();
+        SdrPage *pPage = NULL;
+
         // page for list of objects
-        SdrPage *pPage = pCurTextObj->GetPage();
+        if ( pCurTextObj ) {
+            pPage = pCurTextObj->GetPage();
+        } else {
+            fprintf(stderr, "Some errors\n" );
+            return;
+        }
 
         // we use (text) object 0 and 1 for these experiments
         // we can try to set text of obj 0 to obj 1 or something
 
         SdrTextObj *pNextTextObj;
-        if ( pPage->GetObjCount() > 1) {
+        if ( pPage && pPage->GetObjCount() > 1) {
             pNextTextObj =  dynamic_cast< SdrTextObj * >(
                                                 pPage->GetObj(1) );
         } else {
@@ -789,10 +796,19 @@ void SdrTextObj::impDecomposeContourTextPrimitive(
     rTarget = aConverter.getPrimitive2DSequence();
 }
 
+void SdrTextObj::embedText() const
+{
+
+}
+
 void SdrTextObj::impCopyTextInTextObj(SdrTextObj *pNextTextObj) const
 {
     // Code from FitFrameToTextSize
 
+    // avoid copying text in same box
+    if ( this ==  pNextTextObj )
+        return;
+
     // trying to copy text in obj 1
     SdrText* pText = getActiveText();
 


More information about the Libreoffice-commits mailing list