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

matteocam matteo.campanelli at gmail.com
Thu Jun 11 14:31:56 PDT 2015


 include/svx/svdmodel.hxx                    |    3 +++
 svx/source/svdraw/svdmodel.cxx              |   10 ++++++++++
 svx/source/svdraw/svdotext.cxx              |    2 +-
 svx/source/svdraw/svdotextdecomposition.cxx |   12 ++++++++++++
 4 files changed, 26 insertions(+), 1 deletion(-)

New commits:
commit bb57f6094d6172cd936e862f96128cd95ac65b81
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Thu Jun 11 17:30:00 2015 -0400

    Using a second outliner to transfer text
    
    Change-Id: Ia11a2befc1ebdb73247ecac1bb7646cf91cdb13c

diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx
index e982cb5..bdc992d 100644
--- a/include/svx/svdmodel.hxx
+++ b/include/svx/svdmodel.hxx
@@ -170,6 +170,7 @@ protected:
                     m_pEmbeddedHelper; // helper for embedded objects to get rid of the SfxObjectShell
     SdrOutliner*    pDrawOutliner;  // an Outliner for outputting text
     SdrOutliner*    pHitTestOutliner;// an Outliner for the HitTest
+    SdrOutliner*    pChainingOutliner; // an Outliner for chaining overflowing text
     sal_uIntPtr           nDefTextHgt;    // Default text heigth in logical units
     OutputDevice*   pRefOutDev;     // ReferenceDevice for the EditEngine
     sal_uIntPtr           nProgressAkt;   // for the
@@ -326,6 +327,8 @@ public:
 
     SdrOutliner&         GetDrawOutliner(const SdrTextObj* pObj=NULL) const;
 
+    SdrOutliner&         GetChainingOutliner(const SdrTextObj* pObj=NULL) const;
+
     SdrOutliner&         GetHitTestOutliner() const { return *pHitTestOutliner; }
     const SdrTextObj*    GetFormattingTextObj() const;
     // put the TextDefaults (Font,Height,Color) in a Set
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index f3fc337..ce0ff7a 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -212,6 +212,10 @@ void SdrModel::ImpCtor(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* _pEmbe
     pHitTestOutliner = SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, this );
     ImpSetOutlinerDefaults(pHitTestOutliner, true);
 
+    pChainingOutliner = SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, this );
+    ImpSetOutlinerDefaults(pChainingOutliner, true);
+
+
     ImpCreateTables();
 }
 
@@ -770,6 +774,12 @@ SdrOutliner& SdrModel::GetDrawOutliner(const SdrTextObj* pObj) const
     return *pDrawOutliner;
 }
 
+SdrOutliner& SdrModel::GetChainingOutliner(const SdrTextObj* pObj) const
+{
+    pChainingOutliner->SetTextObj(pObj);
+    return *pChainingOutliner;
+}
+
 const SdrTextObj* SdrModel::GetFormattingTextObj() const
 {
     if (pDrawOutliner!=NULL) {
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 82b883f..4dbc2ea 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -2043,7 +2043,7 @@ SdrTextObj* SdrTextObj::GetNextLinkInChain() const
     if ( pPage && pPage->GetObjCount() > 1) {
         sal_uInt32 nextIndex = (GetOrdNum()+1);
         // FIXME
-        if (nextIndex >= 3 || nextIndex >= pPage->GetObjCount()) {
+        if (!GetName().startsWith("Chainable")) {
             fprintf(stderr, "[CHAINABLE?] %p is _not_ chainable\n", this);
             return NULL;
         }
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index e7ada87..abc01dd 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -22,6 +22,7 @@
 #include <svx/svdoutl.hxx>
 #include <svx/svdpage.hxx>
 #include <svx/svdotext.hxx>
+#include <svx/svdmodel.hxx>
 #include <basegfx/vector/b2dvector.hxx>
 #include <sdr/primitive2d/sdrtextprimitive2d.hxx>
 #include <drawinglayer/primitive2d/textprimitive2d.hxx>
@@ -1658,6 +1659,17 @@ void SdrTextObj::impDecomposeChainedTextPrimitive(
         impLeaveOnlyNonOverflowingText(&rOutliner);
 
         // XXX: Order transfer of stuff in next link here
+        /* Get chaining outliner  here */
+        // Code adapted from ImpGetDrawOutliner
+        SdrOutliner &rChainingOutl = pModel->GetChainingOutliner(this);
+        ImpInitDrawOutliner( rChainingOutl );
+        rOutliner.SetUpdateMode(true);
+
+        /* Actual transfer of text */
+        const_cast<SdrTextObj*>(this)->mpOverflowingText = rOutliner.GetOverflowingText();
+        if (GetNextLinkInChain())
+            impMoveChainedTextToNextLink(&rChainingOutl, GetNextLinkInChain());
+
     }
     /* End overflow handling */
 


More information about the Libreoffice-commits mailing list