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

matteocam matteo.campanelli at gmail.com
Wed Jul 8 07:55:38 PDT 2015


 include/svx/textchain.hxx       |    7 ++++++-
 svx/source/svdraw/svdedxv.cxx   |   19 +++++++++----------
 svx/source/svdraw/textchain.cxx |    1 +
 3 files changed, 16 insertions(+), 11 deletions(-)

New commits:
commit 849d8130c32ed8bd4016bd637eabaf8681615ee6
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Wed Jul 8 10:54:38 2015 -0400

    Reset chaining cursor event after handling it
    
    Change-Id: I6c03b4a4340e1ee0c7498dae78c8563b54ef191f

diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 2908ce7..3b5f021 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -553,6 +553,9 @@ void SdrObjEditView::ImpMoveCursorAfterChainingEvent()
                     break;
     }
 
+    // Reset event
+    pTextChain->SetCursorEvent(pTextObj, CursorChainingEvent::UNCHANGED);
+
 }
 
 IMPL_LINK(SdrObjEditView,ImpOutlinerCalcFieldValueHdl,EditFieldInfo*,pFI)
commit 82183e28056e2e661801c9f549f4be9dcf2d4249
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Wed Jul 8 10:46:13 2015 -0400

    Implemented PreChainingSel as a TextChain property
    
    Change-Id: Ifec26d8c49b1471f7ae25deca962516f1480e0dc

diff --git a/include/svx/textchain.hxx b/include/svx/textchain.hxx
index efd52ef..77e3b32 100644
--- a/include/svx/textchain.hxx
+++ b/include/svx/textchain.hxx
@@ -20,6 +20,9 @@
 #ifndef INCLUDED_SVX_TEXTCHAIN_HXX
 #define INCLUDED_SVX_TEXTCHAIN_HXX
 
+#include <editeng/editdata.hxx>
+#include <map>
+
 /*
  * Properties can be accessed and set from a TextChain with:
  * - T TextChain::GetPROPNAME(SdrTextObj *)
@@ -66,7 +69,6 @@
 
 /* End Special Properties Macro */
 
-#include <map>
 
 class ImpChainLinkProperties;
 class SdrTextObj;
@@ -112,12 +114,14 @@ class ImpChainLinkProperties
     ImpChainLinkProperties() {
         INIT_CHAIN_PROP(NilChainingEvent, false)
         INIT_CHAIN_PROP(CursorEvent, CursorChainingEvent::UNCHANGED)
+        INIT_CHAIN_PROP(PreChainingSel, ESelection(0,0,0,0));
     }
 
     private:
     // NOTE: Remember to set default value in contructor when adding field
     DECL_CHAIN_PROP(NilChainingEvent, bool)
     DECL_CHAIN_PROP(CursorEvent, CursorChainingEvent)
+    DECL_CHAIN_PROP(PreChainingSel, ESelection)
 
 };
 
@@ -138,6 +142,7 @@ class TextChain {
     // Specific Link Properties
     DECL_CHAIN_PROP_INTERFACE(CursorEvent, CursorChainingEvent)
     DECL_CHAIN_PROP_INTERFACE(NilChainingEvent, bool)
+    DECL_CHAIN_PROP_INTERFACE(PreChainingSel, ESelection)
 
 
 
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 3ca380d..2908ce7 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -500,12 +500,13 @@ IMPL_LINK_NOARG(SdrObjEditView,ImpChainingEventHdl)
             pTextChain->SetNilChainingEvent(pTextObj, true);
 
             // Save previous selection pos
-            maPreChainingSel = new ESelection(pOLV->GetSelection());
+            pTextChain->SetPreChainingSel(pTextObj, pOLV->GetSelection());
+            //maPreChainingSel = new ESelection(pOLV->GetSelection());
 
             // trigger actual chaining
             pTextObj->onChainingEvent();
 
-            maCursorEvent = new CursorChainingEvent(pTextChain->GetCursorEvent(pTextObj));
+            //maCursorEvent = new CursorChainingEvent(pTextChain->GetCursorEvent(pTextObj));
             //SdrTextObj *pNextLink = pTextObj->GetNextLinkInChain();
 
             // NOTE: Must be called. Don't let the function return if you set it to true and not reset it
@@ -529,16 +530,16 @@ void SdrObjEditView::ImpMoveCursorAfterChainingEvent()
     if (!pTextObj->IsChainable() || !pTextObj->GetNextLinkInChain())
         return;
 
-    if(!maCursorEvent || !maPreChainingSel)
-        return;
 
     SdrTextObj *pNextLink = pTextObj->GetNextLinkInChain();
     OutlinerView* pOLV = GetTextEditOutlinerView();
 
-    switch (*maCursorEvent) {
+    TextChain *pTextChain = pTextObj->GetTextChain();
+
+    switch ( pTextChain->GetCursorEvent(pTextObj) ) {
 
             case CursorChainingEvent::UNCHANGED:
-                    pOLV->SetSelection(*maPreChainingSel);
+                    pOLV->SetSelection(pTextChain->GetPreChainingSel(pTextObj));
                     break;
             case CursorChainingEvent::TO_NEXT_LINK:
                     SdrEndTextEdit();
@@ -552,11 +553,6 @@ void SdrObjEditView::ImpMoveCursorAfterChainingEvent()
                     break;
     }
 
-    // Default case
-    // XXX: You should delete the old ones here too.
-    maCursorEvent = NULL;
-    maPreChainingSel = NULL;
-
 }
 
 IMPL_LINK(SdrObjEditView,ImpOutlinerCalcFieldValueHdl,EditFieldInfo*,pFI)
diff --git a/svx/source/svdraw/textchain.cxx b/svx/source/svdraw/textchain.cxx
index a9b59a9..270712e 100644
--- a/svx/source/svdraw/textchain.cxx
+++ b/svx/source/svdraw/textchain.cxx
@@ -26,6 +26,7 @@
 
 IMPL_CHAIN_PROP_INTERFACE(CursorEvent, CursorChainingEvent)
 IMPL_CHAIN_PROP_INTERFACE(NilChainingEvent, bool)
+IMPL_CHAIN_PROP_INTERFACE(PreChainingSel, ESelection)
 
 /* End Definition of Properties Interface */
 


More information about the Libreoffice-commits mailing list