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

matteocam matteo.campanelli at gmail.com
Mon Jul 14 05:23:49 PDT 2014


 include/svx/svdotext.hxx                    |    4 +
 svx/source/svdraw/svdotext.cxx              |    5 --
 svx/source/svdraw/svdotextdecomposition.cxx |   57 +++++++++++++++++++++++++++-
 3 files changed, 58 insertions(+), 8 deletions(-)

New commits:
commit 643d9cf5e73e523c88d1b545dd27d98feb1bf088
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Mon Jul 14 14:22:43 2014 +0200

    Copying text from one box to another
    
    Change-Id: I0465b22d3e7746c3b778c148eccc8bc08dc3c2ae

diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index 7a7226a..44c652a 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -586,6 +586,7 @@ public:
         const drawinglayer::primitive2d::SdrStretchTextPrimitive2D& rSdrStretchTextPrimitive,
         const drawinglayer::geometry::ViewInformation2D& aViewInformation) const;
 
+    void impCopyTextInTextObj(SdrTextObj *pNextTextObj) const;
 
     // timing generators
     void impGetBlinkTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList) const;
@@ -596,6 +597,7 @@ public:
         Also checks for one empty paragraph.
     */
     static bool HasTextImpl( SdrOutliner* pOutliner );
+
 };
 
 
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index 0c53ea3..f44499c 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -103,6 +103,7 @@ namespace
         void impFlushLinePrimitivesToParagraphPrimitives();
         void impHandleDrawPortionInfo(const DrawPortionInfo& rInfo);
         void impHandleDrawBulletInfo(const DrawBulletInfo& rInfo);
+        void impHandleTruncatedPortion(const DrawPortionInfo& rInfo);
 
     public:
         impTextBreakupHandler(SdrOutliner& rOutliner)
@@ -525,7 +526,7 @@ namespace
 
 
         if ( bTruncateText ) // truncate text
-            impHandleTruncatedPortion(rInfo)
+            impHandleTruncatedPortion(rInfo);
         else // no chaining or truncating
             impCreateTextPortionPrimitive(rInfo);
 
@@ -553,10 +554,33 @@ namespace
         // make text portion primitive with the first part of the portion
         impCreateTextPortionPrimitive(rTruncatedPortionInfo);
 
-        // if text is left in original portion send it back to editeng
+        /* Some Experiments */
+
+        const SdrTextObj *pCurTextObj = mrOutliner.GetTextObj();
+        // page for list of objects
+        SdrPage *pPage = pCurTextObj->GetPage();
+
+        // 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) {
+            pNextTextObj =  dynamic_cast< SdrTextObj * >(
+                                                pPage->GetObj(1) );
+        } else {
+            fprintf(stderr, "Make New Object please\n");
+            return;
+        }
+
+        pCurTextObj->impCopyTextInTextObj(pNextTextObj);
+
+        /* End Experiments */
+
+        // if text is left in original portion, send it back to editeng
         // FIXME(matteocam)
     }
 
+
     void impTextBreakupHandler::impHandleDrawBulletInfo(const DrawBulletInfo& rInfo)
     {
         basegfx::B2DHomMatrix aNewTransform;
@@ -760,6 +784,35 @@ void SdrTextObj::impDecomposeContourTextPrimitive(
     rTarget = aConverter.getPrimitive2DSequence();
 }
 
+void SdrTextObj::impCopyTextInTextObj(SdrTextObj *pNextTextObj) const
+{
+    // Code from FitFrameToTextSize
+
+    // trying to copy text in obj 1
+    SdrText* pText = getActiveText();
+
+    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()));
+        rOutliner.SetUpdateMode(true);
+        rOutliner.SetText(*pText->GetOutlinerParaObject());
+        Size aNewSize(rOutliner.CalcTextSize());
+        rOutliner.Clear();
+        aNewSize.Width()++; // because of possible rounding errors
+        aNewSize.Width()+=GetTextLeftDistance()+GetTextRightDistance();
+        aNewSize.Height()+=GetTextUpperDistance()+GetTextLowerDistance();
+
+        Rectangle aNewRect(aNextRect);
+        aNewRect.SetSize(aNewSize);
+        pNextTextObj->ImpJustifyRect(aNewRect);
+        if (aNewRect!=aNextRect) {
+            pNextTextObj->SetLogicRect(aNewRect);
+        }
+    }
+}
+
 void SdrTextObj::impDecomposeAutoFitTextPrimitive(
     drawinglayer::primitive2d::Primitive2DSequence& rTarget,
     const drawinglayer::primitive2d::SdrAutoFitTextPrimitive2D& rSdrAutofitTextPrimitive,
commit 569ee644106aaf90895c2a4abd01ce19cfa4bbc2
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Mon Jul 14 12:42:46 2014 +0200

    Removed mbChained
    
    Change-Id: I8e6b313433ddc2827aa2c744dd8519da5838bc40

diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index ce46947..7a7226a 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -217,7 +217,7 @@ protected:
 
     //FIXME(matteocam)
     // the successor in a chain
-    SdrTextObj *pNextInChain = NULL;
+    SdrTextObj *mpNextInChain = NULL;
 
     // Fuer beschriftete Zeichenobjekte ist bTextFrame=FALSE. Der Textblock
     // wird dann hoizontal und vertikal an aRect zentriert. Bei bTextFrame=
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index d845525..5d113a9 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -97,7 +97,6 @@ SdrTextObj::SdrTextObj()
     bNoMirror=false;
     bDisableAutoWidthOnDragging=false;
 
-    mbChained = false;
     mbInEditMode = false;
     mbTextHidden = false;
     mbTextAnimationAllowed = true;
@@ -125,8 +124,6 @@ SdrTextObj::SdrTextObj(const Rectangle& rNewRect)
     bDisableAutoWidthOnDragging=false;
     ImpJustifyRect(aRect);
 
-    mbChained = false;
-    mbInEditMode = false;
     mbTextHidden = false;
     mbTextAnimationAllowed = true;
     mbInDownScale = false;
@@ -151,7 +148,6 @@ SdrTextObj::SdrTextObj(SdrObjKind eNewTextKind)
     bNoMirror=true;
     bDisableAutoWidthOnDragging=false;
 
-    mbChained = false;
     mbInEditMode = false;
     mbTextHidden = false;
     mbTextAnimationAllowed = true;
@@ -179,7 +175,6 @@ SdrTextObj::SdrTextObj(SdrObjKind eNewTextKind, const Rectangle& rNewRect)
     bDisableAutoWidthOnDragging=false;
     ImpJustifyRect(aRect);
 
-    mbChained = false;
     mbInEditMode = false;
     mbTextHidden = false;
     mbTextAnimationAllowed = true;


More information about the Libreoffice-commits mailing list