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

matteocam matteo.campanelli at gmail.com
Mon Jul 28 17:10:43 PDT 2014


 include/svx/sdr/attribute/sdrtextattribute.hxx       |    4 +-
 include/svx/svdotext.hxx                             |    6 +++
 svx/source/sdr/attribute/sdrtextattribute.cxx        |   25 ++++++++++++---
 svx/source/sdr/primitive2d/sdrattributecreator.cxx   |   12 ++++++-
 svx/source/sdr/primitive2d/sdrdecompositiontools.cxx |    5 ---
 svx/source/svdraw/svdotext.cxx                       |   30 ++++++++++++++++++-
 svx/source/svdraw/svdotextdecomposition.cxx          |    4 +-
 7 files changed, 70 insertions(+), 16 deletions(-)

New commits:
commit b77be468428db23301b14a091bfa758f17789934
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Tue Jul 29 03:04:15 2014 +0300

    ToBeChained status added to SdrTextObj
    
    Change-Id: If7c7bd4384aeb705ba52eee5465c2b5aee78b1d9

diff --git a/include/svx/sdr/attribute/sdrtextattribute.hxx b/include/svx/sdr/attribute/sdrtextattribute.hxx
index 637b769..6d3b738 100644
--- a/include/svx/sdr/attribute/sdrtextattribute.hxx
+++ b/include/svx/sdr/attribute/sdrtextattribute.hxx
@@ -73,7 +73,8 @@ namespace drawinglayer
                 bool bScroll,
                 bool bInEditMode,
                 bool bFixedCellHeight,
-                bool bWrongSpell);
+                bool bWrongSpell,
+                bool bToBeChained);
             SdrTextAttribute();
             SdrTextAttribute(const SdrTextAttribute& rCandidate);
             SdrTextAttribute& operator=(const SdrTextAttribute& rCandidate);
@@ -96,6 +97,7 @@ namespace drawinglayer
             bool isScroll() const;
             bool isInEditMode() const;
             bool isFixedCellHeight() const;
+            bool isToBeChained() const;
             const SdrFormTextAttribute& getSdrFormTextAttribute() const;
             sal_Int32 getTextLeftDistance() const;
             sal_Int32 getTextUpperDistance() const;
diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index 01c14ac..f0f917d 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -220,6 +220,9 @@ protected:
     // the successor in a chain
     SdrTextObj *mpNextInChain = NULL;
 
+    // indicating the for its text to be chained to another text box
+    bool mbToBeChained : 1;
+
     // Fuer beschriftete Zeichenobjekte ist bTextFrame=FALSE. Der Textblock
     // wird dann hoizontal und vertikal an aRect zentriert. Bei bTextFrame=
     // sal_True wird der Text in aRect hineinformatiert. Der eigentliche Textrahmen
@@ -343,6 +346,7 @@ public:
     bool IsAutoFit() const;
     /// returns true if the old feature for fitting shape content should into shape is enabled. implies IsAutoFit()==false!
     bool IsFitToSize() const;
+    bool IsToBeChained() const;
     SdrObjKind GetTextKind() const { return eTextKind; }
 
     // #i121917#
@@ -524,6 +528,8 @@ public:
     virtual bool IsVerticalWriting() const;
     virtual void SetVerticalWriting(bool bVertical);
 
+    void SetToBeChained(bool bToBeChained);
+
     /** called from the SdrObjEditView during text edit when the status of the edit outliner changes */
     virtual void onEditOutlinerStatusEvent( EditStatus* pEditStatus );
 
diff --git a/svx/source/sdr/attribute/sdrtextattribute.cxx b/svx/source/sdr/attribute/sdrtextattribute.cxx
index 0f29f07..de9a61f 100644
--- a/svx/source/sdr/attribute/sdrtextattribute.cxx
+++ b/svx/source/sdr/attribute/sdrtextattribute.cxx
@@ -90,7 +90,8 @@ namespace drawinglayer
                 bool bScroll,
                 bool bInEditMode,
                 bool bFixedCellHeight,
-                bool bWrongSpell)
+                bool bWrongSpell,
+                bool bToBeChained)
             :   mnRefCount(0),
                 mpSdrText(pSdrText),
                 mpOutlinerParaObject(new OutlinerParaObject(rOutlinerParaObject)),
diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
index 4b3315b..2d135bc 100644
--- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx
+++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
@@ -521,6 +521,15 @@ namespace drawinglayer
         {
             const SdrTextObj& rTextObj = rText.GetObject();
 
+            // FIXME(matteocam)
+            bool bToBeChained = rTextObj.IsToBeChained();
+            // for resetting status
+            // XXX
+            if ( rTextObj.IsToBeChained() )
+            {
+                    rTextObj.SetToBeChained( false );
+            }
+
             if(rText.GetOutlinerParaObject() && rText.GetModel())
             {
                 // added TextEdit text suppression
@@ -579,7 +588,8 @@ namespace drawinglayer
                     SDRTEXTANI_SCROLL == eAniKind || SDRTEXTANI_ALTERNATE == eAniKind || SDRTEXTANI_SLIDE == eAniKind,
                     bInEditMode,
                     ((const SdrTextFixedCellHeightItem&)rSet.Get(SDRATTR_TEXT_USEFIXEDCELLHEIGHT)).GetValue(),
-                    bWrongSpell);
+                    bWrongSpell,
+                    bToBeChained);
             }
 
             return attribute::SdrTextAttribute();
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index f727d8d..09b8b8e 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -129,6 +129,9 @@ SdrTextObj::SdrTextObj(const Rectangle& rNewRect)
     mbInDownScale = false;
     maTextEditOffset = Point(0, 0);
 
+    // chaining
+    mbToBeChained = false;
+
     // #i25616#
     mbSupportTextIndentingOnLineWidthChange = true;
 }
@@ -154,6 +157,9 @@ SdrTextObj::SdrTextObj(SdrObjKind eNewTextKind)
     mbInDownScale = false;
     maTextEditOffset = Point(0, 0);
 
+    // chaining
+    mbToBeChained = false;
+
     // #i25616#
     mbSupportTextIndentingOnLineWidthChange = true;
 }
@@ -181,6 +187,9 @@ SdrTextObj::SdrTextObj(SdrObjKind eNewTextKind, const Rectangle& rNewRect)
     mbInDownScale = false;
     maTextEditOffset = Point(0, 0);
 
+    // chaining
+    mbToBeChained = false;
+
     // #i25616#
     mbSupportTextIndentingOnLineWidthChange = true;
 }
@@ -1515,6 +1524,17 @@ bool SdrTextObj::IsVerticalWriting() const
     return false;
 }
 
+// chaining
+bool SdrTextObj::IsToBeChained() const
+{
+    return mbToBeChained;
+}
+
+void SdrTextObj::SetToBeChained(bool bToBeChained)
+{
+    mbToBeChained = bToBeChained;
+}
+
 void SdrTextObj::SetVerticalWriting(bool bVertical)
 {
     OutlinerParaObject* pOutlinerParaObject = GetOutlinerParaObject();
commit f1fb415ab99a2161d6c51edb549a8ea4f4f9925c
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Tue Jul 29 02:11:36 2014 +0300

    Added isToBeChained()  method to  SdrTextAttribute
    
    Change-Id: Ifcfacdf006270e9782afaacc2eeafe2269ec7f9a

diff --git a/svx/source/sdr/attribute/sdrtextattribute.cxx b/svx/source/sdr/attribute/sdrtextattribute.cxx
index 6b3fd30..0f29f07 100644
--- a/svx/source/sdr/attribute/sdrtextattribute.cxx
+++ b/svx/source/sdr/attribute/sdrtextattribute.cxx
@@ -69,6 +69,7 @@ namespace drawinglayer
             bool                                mbInEditMode : 1;
             bool                                mbFixedCellHeight : 1;
             bool                                mbWrongSpell : 1;
+            bool                                mbToBeChained : 1;
 
         public:
             ImpSdrTextAttribute(
@@ -109,7 +110,8 @@ namespace drawinglayer
                 mbScroll(bScroll),
                 mbInEditMode(bInEditMode),
                 mbFixedCellHeight(bFixedCellHeight),
-                mbWrongSpell(bWrongSpell)
+                mbWrongSpell(bWrongSpell),
+                mbToBeChained(bToBeChained)
             {
                 if(pSdrText)
                 {
@@ -147,7 +149,8 @@ namespace drawinglayer
                 mbScroll(false),
                 mbInEditMode(false),
                 mbFixedCellHeight(false),
-                mbWrongSpell(false)
+                mbWrongSpell(false),
+                mbToBeChained(false)
             {
             }
 
@@ -179,6 +182,7 @@ namespace drawinglayer
             bool isInEditMode() const { return mbInEditMode; }
             bool isFixedCellHeight() const { return mbFixedCellHeight; }
             bool isWrongSpell() const { return mbWrongSpell; }
+            bool isToBeChained() const { return mbToBeChained; }
             const SdrFormTextAttribute& getSdrFormTextAttribute() const { return maSdrFormTextAttribute; }
             sal_Int32 getTextLeftDistance() const { return maTextLeftDistance; }
             sal_Int32 getTextUpperDistance() const { return maTextUpperDistance; }
@@ -237,7 +241,8 @@ namespace drawinglayer
                     && isScroll() == rCandidate.isScroll()
                     && isInEditMode() == rCandidate.isInEditMode()
                     && isFixedCellHeight() == rCandidate.isFixedCellHeight()
-                    && isWrongSpell() == rCandidate.isWrongSpell());
+                    && isWrongSpell() == rCandidate.isWrongSpell()
+                    && isToBeChained() == rCandidate.isToBeChained() );
             }
 
             static ImpSdrTextAttribute* get_global_default()
@@ -275,11 +280,13 @@ namespace drawinglayer
             bool bScroll,
             bool bInEditMode,
             bool bFixedCellHeight,
-            bool bWrongSpell)
+            bool bWrongSpell,
+            bool bIsToBeChained)
         :   mpSdrTextAttribute(new ImpSdrTextAttribute(
                 &rSdrText, rOutlinerParaObject, eFormTextStyle, aTextLeftDistance, aTextUpperDistance,
                 aTextRightDistance, aTextLowerDistance, aSdrTextHorzAdjust, aSdrTextVertAdjust, bContour,
-                bFitToSize, bAutoFit, bHideContour, bBlink, bScroll, bInEditMode, bFixedCellHeight, bWrongSpell))
+                bFitToSize, bAutoFit, bHideContour, bBlink, bScroll, bInEditMode, bFixedCellHeight, bWrongSpell,
+                bIsToBeChained))
         {
         }
 
@@ -397,6 +404,11 @@ namespace drawinglayer
             return mpSdrTextAttribute->isFixedCellHeight();
         }
 
+        bool SdrTextAttribute::isToBeChained() const
+        {
+            return mpSdrTextAttribute->isToBeChained();
+        }
+
         const SdrFormTextAttribute& SdrTextAttribute::getSdrFormTextAttribute() const
         {
             return mpSdrTextAttribute->getSdrFormTextAttribute();
commit 00a76aedfb7626e18ae9dfa70c2fb9d1b31a6937
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Tue Jul 29 02:00:58 2014 +0300

    Added comments. Removed debugging output.
    
    Change-Id: I875439b7221f48990eff607eef4d8f2038539f27

diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
index a910c50..f75354d 100644
--- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
+++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
@@ -302,11 +302,6 @@ namespace drawinglayer
                 }
                 else if(rText.isAutoFit())
                 {
-                    // FIXME(matteocam)
-                    bool b = false;
-                    if (b)
-                        pNew = new SdrChainedTextPrimitive2D( &rText.getSdrText(), rText.getOutlinerParaObject() );
-                    else // end FIXME
                     // isotrophically scaled text in range
                     pNew = new SdrAutoFitTextPrimitive2D(&rText.getSdrText(), rText.getOutlinerParaObject(), aAnchorTransform, bWordWrap);
                 }
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 31dddbf..f727d8d 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1927,8 +1927,16 @@ void SdrTextObj::onEditOutlinerStatusEvent( EditStatus* pEditStatus )
         }
         else if (/* TODO: IsChained() && */ pEditStatus->IsPageOverflow())
         {
-            // XXX: Do nothing for now, later here we'll set the need for chaining
+
             //impDecomposeChainedTextPrimitive();
+            /*
+             * XXX: Do nothing for now, later here we'll set the need for chaining
+             * How do you do such a thing?
+             * TODO: Look at where text primitive creation methods are called.
+             * Then what?
+             * Store the state in SdrTextObj with something like needsChaingin?
+             *
+            */
         }
     }
 }
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index 7d313e79..67a3fde7 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -1529,8 +1529,8 @@ void SdrTextObj::impDecomposeChainedTextPrimitive(
     // carry out experiments only when setting b=false from gdb
     //bool b = true;
     //if (!b) {
-    fprintf(stderr, "Object #0 = %p, Object #1 = %p\n",
-                    pPage->GetObj(0), pPage->GetObj(1));
+    /* fprintf(stderr, "Object #0 = %p, Object #1 = %p\n",
+                    pPage->GetObj(0), pPage->GetObj(1)); */
     impCopyTextInTextObj(pNextTextObj); // just do it
     //    return;
     //}


More information about the Libreoffice-commits mailing list