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

2015-08-05 Thread matteocam
 include/svx/textchain.hxx |   10 +++--
 svx/source/svdraw/svdotxed.cxx|   16 
 svx/source/svdraw/textchain.cxx   |   65 +-
 svx/source/svdraw/textchaincursor.cxx |7 +++
 4 files changed, 32 insertions(+), 66 deletions(-)

New commits:
commit 0cd61255022e054c795baf364b1a0e0ceca9cc76
Author: matteocam matteo.campane...@gmail.com
Date:   Wed Aug 5 13:18:26 2015 +0200

Handle Pending Overflow Check for domino chaining

Change-Id: I9053f858c97f68f99cea3705e08e374aedc53107

diff --git a/include/svx/textchain.hxx b/include/svx/textchain.hxx
index 631f646..91e8211 100644
--- a/include/svx/textchain.hxx
+++ b/include/svx/textchain.hxx
@@ -38,10 +38,10 @@
  *in constructor of ImpChainLinkProperties below
  *(V is the initialization value for PROPNAME)
  *
- * 2) Add
+ * 3) Add
  *  DECL_CHAIN_PROP_INTERFACE(PROPNAME, T)
  *in class TextChain (under public:);
- * 3)  Add
+ * 4)  Add
  *   IMPL_CHAIN_PROP_INTERFACE(PROPNAME, T)
  *in file svx/source/svdraw/textchain.cxx
 */
@@ -119,15 +119,17 @@ class ImpChainLinkProperties
 INIT_CHAIN_PROP(PreChainingSel, ESelection(0,0,0,0));
 INIT_CHAIN_PROP(PostChainingSel, ESelection(0,0,0,0));
 INIT_CHAIN_PROP(IsPartOfLastParaInNextLink, false) // XXX: Should come 
from file
+INIT_CHAIN_PROP(PendingOverflowCheck, false)
 }
 
 private:
-// NOTE: Remember to set default value in contructor when adding field
+// NOTE: Remember to set default value in constructor when adding field
 DECL_CHAIN_PROP(NilChainingEvent, bool)
 DECL_CHAIN_PROP(CursorEvent, CursorChainingEvent)
 DECL_CHAIN_PROP(PreChainingSel, ESelection)
 DECL_CHAIN_PROP(PostChainingSel, ESelection)
 DECL_CHAIN_PROP(IsPartOfLastParaInNextLink, bool)
+DECL_CHAIN_PROP(PendingOverflowCheck, bool)
 
 };
 
@@ -154,6 +156,8 @@ class TextChain {
 DECL_CHAIN_PROP_INTERFACE(PostChainingSel, ESelection)
 // return whether a paragraph is split between this box and the next
 DECL_CHAIN_PROP_INTERFACE(IsPartOfLastParaInNextLink, bool)
+// return whether there is a pending overflow check (usually when we move 
cursor after an overflow in the prev link)
+DECL_CHAIN_PROP_INTERFACE(PendingOverflowCheck, bool)
 
 
 
diff --git a/svx/source/svdraw/svdotxed.cxx b/svx/source/svdraw/svdotxed.cxx
index 72c6ca4..02c800fe 100644
--- a/svx/source/svdraw/svdotxed.cxx
+++ b/svx/source/svdraw/svdotxed.cxx
@@ -28,6 +28,7 @@
 #include svl/itemset.hxx
 #include editeng/eeitem.hxx
 #include svx/sdtfchim.hxx
+#include svx/textchain.hxx
 
 
 bool SdrTextObj::HasTextEdit() const
@@ -280,8 +281,23 @@ void SdrTextObj::EndTextEdit(SdrOutliner rOutl)
 SetOutlinerParaObject(pNewText);
 }
 
+/* Beginning Chaining-related code */
 // we do not need the bookmark at the overflowing check anymore.
 rOutl.ClearOverflowingParaNum();
+// XXX: Experiment
+/* Flush overflow for next textbox */
+if (IsChainable() 
+GetNextLinkInChain() 
+GetTextChain()-GetPendingOverflowCheck(GetNextLinkInChain()) )
+{
+GetTextChain()-SetPendingOverflowCheck(GetNextLinkInChain(), false);
+// NEXT: Prepare outliner for overflow
+SdrOutliner rDrawOutl = GetNextLinkInChain()-ImpGetDrawOutliner();
+rDrawOutl.SetUpdateMode(true);
+// XXX: Change name of method above to 
impHandleChainingEventsNonEditMode
+
GetNextLinkInChain()-impHandleChainingEventsDuringDecomposition(rDrawOutl);
+}
+/* End Chaining-related code */
 
 pEdtOutl = NULL;
 rOutl.Clear();
diff --git a/svx/source/svdraw/textchain.cxx b/svx/source/svdraw/textchain.cxx
index c19b924..911e006 100644
--- a/svx/source/svdraw/textchain.cxx
+++ b/svx/source/svdraw/textchain.cxx
@@ -30,6 +30,8 @@ IMPL_CHAIN_PROP_INTERFACE(NilChainingEvent, bool)
 IMPL_CHAIN_PROP_INTERFACE(PreChainingSel, ESelection)
 IMPL_CHAIN_PROP_INTERFACE(PostChainingSel, ESelection)
 IMPL_CHAIN_PROP_INTERFACE(IsPartOfLastParaInNextLink, bool)
+IMPL_CHAIN_PROP_INTERFACE(PendingOverflowCheck, bool)
+
 
 /* End Definition of Properties Interface */
 
@@ -46,69 +48,6 @@ TextChain::~TextChain()
 // XXX: Should free all LinkProperties
 }
 
-/*
-bool TextChain::IsLinkInChain(SdrTextObj *) const
-{
-return true;// XXX: Should make an actual check
-}
-
-void TextChain::AppendLink(SdrTextObj *)
-{
-// XXX
-}
-
-SdrTextObj *TextChain::GetNextLink(const SdrTextObj *pTextObj) const
-{
-return impGetNextLink(pTextObj);
-}
-
-SdrTextObj *TextChain::GetPrevLink(const SdrTextObj *pTextObj) const
-{
-return impGetPrevLink(pTextObj);
-}
-
-SdrTextObj *TextChain::impGetNextLink(const SdrTextObj *pTextObj) const
-{
-// XXX: Temporary implementation based on index number
-
-SdrTextObj *pNextTextObj = NULL;
-SdrPage *pPage = pTextObj-pPage;
-
-if ( pPage  pPage-GetObjCount()  1) {
-
-sal_uInt32 nextIndex = (pTextObj-GetOrdNum()+1);

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

2015-07-27 Thread matteocam
 include/svx/svdmodel.hxx|1 +
 include/svx/svdotext.hxx|2 ++
 include/svx/textchain.hxx   |   12 ++--
 svx/source/svdraw/svdmodel.cxx  |6 ++
 svx/source/svdraw/svdotext.cxx  |   32 
 svx/source/svdraw/textchain.cxx |2 ++
 6 files changed, 49 insertions(+), 6 deletions(-)

New commits:
commit c6987ebc1dc98d0d9807ff3c9b683ade341eb8fe
Author: matteocam matteo.campane...@gmail.com
Date:   Mon Jul 27 12:00:21 2015 +0200

Implement text chain as doubly linked list in SdrTextObj

Change-Id: Id755e129b9f0dc820eae0c47b21d247ce7c4504c

diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx
index 815ab1c..4b5c462 100644
--- a/include/svx/svdmodel.hxx
+++ b/include/svx/svdmodel.hxx
@@ -338,6 +338,7 @@ public:
 
 SdrOutliner GetChainingOutliner(const SdrTextObj* pObj=NULL) 
const;
 TextChain *GetTextChain() const;
+void SetNextLinkInTextChain(SdrTextObj *pPrev, SdrTextObj *pNext);
 
 SdrOutliner GetHitTestOutliner() const { return 
*pHitTestOutliner; }
 const SdrTextObj*GetFormattingTextObj() const;
diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index 6dc4ed4..17a542c 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -230,6 +230,7 @@ protected:
 //FIXME(matteocam)
 // the successor in a chain
 SdrTextObj *mpNextInChain = NULL;
+SdrTextObj *mpPrevInChain = NULL;
 
 // indicating the for its text to be chained to another text box
 bool mbToBeChained : 1;
@@ -367,6 +368,7 @@ public:
 // Chaining // XXX: how are we using IsToBeChained at the moment?
 bool IsToBeChained() const;
 SdrTextObj *GetNextLinkInChain() const;
+void SetNextLinkInChain(SdrTextObj *);
 SdrTextObj *GetPrevLinkInChain() const;
 bool IsChainable() const;
 void SetPreventChainable();
diff --git a/include/svx/textchain.hxx b/include/svx/textchain.hxx
index 41f0fc8..b39cc04 100644
--- a/include/svx/textchain.hxx
+++ b/include/svx/textchain.hxx
@@ -137,11 +137,11 @@ class TextChain {
 TextChain();
 ~TextChain();
 
-void AppendLink(SdrTextObj *);
-bool IsLinkInChain(SdrTextObj *) const;
+//void AppendLink(SdrTextObj *);
+//bool IsLinkInChain(SdrTextObj *) const;
 
-SdrTextObj *GetNextLink(const SdrTextObj *) const;
-SdrTextObj *GetPrevLink(const SdrTextObj *) const;
+//SdrTextObj *GetNextLink(const SdrTextObj *) const;
+//SdrTextObj *GetPrevLink(const SdrTextObj *) const;
 
 ChainLinkId GetId(const SdrTextObj *) const;
 ImpChainLinkProperties *GetLinkProperties(const SdrTextObj *);
@@ -160,8 +160,8 @@ class TextChain {
 LinkPropertiesMap maLinkPropertiesMap;
 
 private:
-SdrTextObj *impGetNextLink(const SdrTextObj *) const;
-SdrTextObj *impGetPrevLink(const SdrTextObj *) const;
+//SdrTextObj *impGetNextLink(const SdrTextObj *) const;
+//SdrTextObj *impGetPrevLink(const SdrTextObj *) const;
 
 
 };
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index 2260188..cd9b764 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -2013,6 +2013,12 @@ TextChain *SdrModel::GetTextChain() const
 return pTextChain;
 }
 
+void SdrModel::SetNextLinkInTextChain(SdrTextObj *pPrev, SdrTextObj *pNext)
+{
+// Delegate to SdrTextObj
+pPrev-SetNextLinkInChain(pNext);
+}
+
 const SdrPage* SdrModel::GetMasterPage(sal_uInt16 nPgNum) const
 {
 DBG_ASSERT(nPgNum  maMaPag.size(), SdrModel::GetMasterPage: Access out 
of range (!));
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 83bd15d..5f4f2f5 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -2082,18 +2082,50 @@ void SdrTextObj::SetObjectItemNoBroadcast(const 
SfxPoolItem rItem)
 
 SdrTextObj* SdrTextObj::GetNextLinkInChain() const
 {
+/*
 if (GetTextChain())
 return GetTextChain()-GetNextLink(this);
 
 return NULL;
+*/
+
+return mpNextInChain;
+}
+
+void SdrTextObj::SetNextLinkInChain(SdrTextObj *pNextObj)
+{
+// Basically a doubly linked list implementation
+
+SdrTextObj *pOldNextObj = mpNextInChain;
+
+// Replace next link
+mpNextInChain = pNextObj;
+// Deal with old next link's prev link
+if (pOldNextObj) {
+pOldNextObj-mpPrevInChain = NULL;
+}
+
+// Deal with new next link's prev link
+if (mpNextInChain) {
+if (mpNextInChain-mpPrevInChain)
+mpNextInChain-mpPrevInChain-mpNextInChain = NULL;
+mpNextInChain-mpPrevInChain = this;
+}
+
+// TODO: Introduce check for circular chains
+
 }
 
 SdrTextObj* SdrTextObj::GetPrevLinkInChain() const
 {
+/*
 if (GetTextChain())
 return GetTextChain()-GetPrevLink(this);
 
 return NULL;
+*/
+
+return mpPrevInChain;
 }
 
 void SdrTextObj::SetPreventChainable()
diff --git a/svx/source/svdraw/textchain.cxx 

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

2015-07-24 Thread matteocam
 include/svx/textchaincursor.hxx   |3 ++-
 svx/source/svdraw/textchaincursor.cxx |   24 +++-
 2 files changed, 21 insertions(+), 6 deletions(-)

New commits:
commit 50e6f53542903e7e17385a4be2679b2ba51d6371
Author: matteocam matteo.campane...@gmail.com
Date:   Fri Jul 24 11:00:27 2015 +0200

Handle Backspace

Change-Id: Ied9802481595f1f823ccd1abe6b6ccc97897a856

diff --git a/include/svx/textchaincursor.hxx b/include/svx/textchaincursor.hxx
index b56dd72..1d9c4de 100644
--- a/include/svx/textchaincursor.hxx
+++ b/include/svx/textchaincursor.hxx
@@ -42,7 +42,8 @@ private:
 void impChangeEditingTextObj(SdrTextObj *pTargetTextObj, ESelection 
aNewSel) const;
 void impDetectEvent(const KeyEvent rKEvt,
 CursorChainingEvent *pOutCursorEvt,
-ESelection *pOutSel) const;
+ESelection *pOutSel,
+bool *bOutHandled) const;
 };
 
 
diff --git a/svx/source/svdraw/textchaincursor.cxx 
b/svx/source/svdraw/textchaincursor.cxx
index 3952d8b..af2af7c 100644
--- a/svx/source/svdraw/textchaincursor.cxx
+++ b/svx/source/svdraw/textchaincursor.cxx
@@ -41,19 +41,22 @@ bool TextChainCursorManager::HandleKeyEvent( const 
KeyEvent rKEvt ) const
 CursorChainingEvent aCursorEvent;
 
 // check what the cursor/event situation looks like
-impDetectEvent(rKEvt, aCursorEvent, aNewSel);
+bool bCompletelyHandled = false;
+impDetectEvent(rKEvt, aCursorEvent, aNewSel, bCompletelyHandled);
 
 if (aCursorEvent == CursorChainingEvent::NULL_EVENT)
 return false;
 else {
 HandleCursorEvent(aCursorEvent, aNewSel);
-return true;
+// return value depends on the situation we are in
+return bCompletelyHandled;
 }
 }
 
 void TextChainCursorManager::impDetectEvent(const KeyEvent rKEvt,
 CursorChainingEvent *pOutCursorEvt,
-ESelection *pOutSel) const
+ESelection *pOutSel,
+bool *bOutHandled) const
 {
 SdrOutliner *pOutl = mpEditView-GetTextEditOutliner();
 OutlinerView *pOLV = mpEditView-GetTextEditOutlinerView();
@@ -80,22 +83,33 @@ void TextChainCursorManager::impDetectEvent(const KeyEvent 
rKEvt,
 ESelection aEndSel = ESelection(nLastPara, nLastParaLen);
 bool bAtEndOfTextContent = aCurSel.IsEqual(aEndSel);
 
-// Are we pushing at the end of the object?
+// Possibility: Are we pushing at the end of the object?
 if (nCode == KEY_RIGHT  bAtEndOfTextContent  pNextLink)
 {
 *pOutCursorEvt = CursorChainingEvent::TO_NEXT_LINK;
 // Selection unchanged: we are at the beginning of the box
+*bOutHandled = true; // Nothing more to do than move cursor
 return;
 }
 
 ESelection aStartSel = ESelection(0, 0);
 bool bAtStartOfTextContent = aCurSel.IsEqual(aStartSel);
 
-// Are we pushing at the start of the object?
+// Possibility: Are we pushing at the start of the object?
 if (nCode == KEY_LEFT  bAtStartOfTextContent  pPrevLink)
 {
 *pOutCursorEvt = CursorChainingEvent::TO_PREV_LINK;
 *pOutSel = ESelection(10, 10); // Set at end of selection
+*bOutHandled = true; // Nothing more to do than move cursor
+return;
+}
+
+// Possibility: Are we pushing at the start of the object and deleting 
left?
+if (nCode == KEY_BACKSPACE  bAtStartOfTextContent  pPrevLink)
+{
+*pOutCursorEvt = CursorChainingEvent::TO_PREV_LINK;
+*pOutSel = ESelection(10, 10); // Set at end of selection
+*bOutHandled = false; // We need to delete characters after moving 
cursor
 return;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-07-24 Thread matteocam
 include/svx/svdedxv.hxx   |1 +
 svx/source/svdraw/svdedxv.cxx |   12 +++-
 2 files changed, 12 insertions(+), 1 deletion(-)

New commits:
commit c70006435a69471b921faf785571dfc61514e1e0
Author: matteocam matteo.campane...@gmail.com
Date:   Fri Jul 24 18:15:29 2015 +0200

Add Cursor handling after post-paste chaining

Change-Id: Id3bd5a86e09d0171f6d0afdbd228fa6e45042a6d

diff --git a/include/svx/svdedxv.hxx b/include/svx/svdedxv.hxx
index c7e9c99..6b6f27c 100644
--- a/include/svx/svdedxv.hxx
+++ b/include/svx/svdedxv.hxx
@@ -128,6 +128,7 @@ protected:
 // handler for AutoGrowing text with active Outliner
 DECL_LINK(ImpOutlinerStatusEventHdl,EditStatus*);
 DECL_LINK(ImpChainingEventHdl,void*);
+DECL_LINK(ImpAfterPasteChainingEventHdl,void*);
 DECL_LINK(ImpOutlinerCalcFieldValueHdl,EditFieldInfo*);
 
 // link for EndTextEditHdl
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index fb71e2f..9324ffd 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -525,6 +525,16 @@ IMPL_LINK_NOARG(SdrObjEditView,ImpChainingEventHdl)
 return 0;
 }
 
+IMPL_LINK_NOARG(SdrObjEditView,ImpAfterPasteChainingEventHdl)
+{
+SdrTextObj* pTextObj = dynamic_cast SdrTextObj * ( GetTextEditObject());
+if (!pTextObj)
+return 0;
+ImpChainingEventHdl(NULL);
+TextChainCursorManager *pCursorManager = new TextChainCursorManager(this, 
pTextObj);
+ImpMoveCursorAfterChainingEvent(pCursorManager);
+return 0;
+}
 
 void SdrObjEditView::ImpMoveCursorAfterChainingEvent(TextChainCursorManager 
*pCursorManager)
 {
@@ -789,7 +799,7 @@ bool SdrObjEditView::SdrBeginTextEdit(
 pTextEditOutlinerView-ShowCursor();
 
pTextEditOutliner-SetStatusEventHdl(LINK(this,SdrObjEditView,ImpOutlinerStatusEventHdl));
 if (pTextObj-IsChainable()) {
-
pTextEditOutlinerView-SetEndPasteLinkHdl(LINK(this,SdrObjEditView,ImpChainingEventHdl)
 );
+
pTextEditOutlinerView-SetEndPasteLinkHdl(LINK(this,SdrObjEditView,ImpAfterPasteChainingEventHdl)
 );
 /* We should call:
  *
 ImpChainingEventHdl(NULL);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-07-23 Thread matteocam
 include/svx/textchaincursor.hxx   |   15 +-
 svx/source/svdraw/svdedxv.cxx |   48 ++
 svx/source/svdraw/textchaincursor.cxx |   44 ++-
 3 files changed, 65 insertions(+), 42 deletions(-)

New commits:
commit cdc0e22b54d8b2c20950a955070488c5603e66c0
Author: matteocam matteo.campane...@gmail.com
Date:   Thu Jul 23 23:46:47 2015 +0200

Move code for right motion into TextChainCursorManager

Change-Id: Ifa6aecbd2c55763583f2d48b0883698f876cbc6c

diff --git a/include/svx/textchaincursor.hxx b/include/svx/textchaincursor.hxx
index 71dbc60..456d3c1 100644
--- a/include/svx/textchaincursor.hxx
+++ b/include/svx/textchaincursor.hxx
@@ -20,10 +20,21 @@
 #ifndef INCLUDED_SVX_TEXTCHAINCURSOR_HXX
 #define INCLUDED_SVX_TEXTCHAINCURSOR_HXX
 
+class SdrObjEditView;
+class SdrTextObj;
+class KeyEvent;
 
-class TextChainCursorHandler
+
+class TextChainCursorManager
 {
-TextChainCursorHandler();
+public:
+TextChainCursorManager(SdrObjEditView *pEditView, const SdrTextObj 
*pTextObj);
+
+bool HandleKeyEvent( const KeyEvent rKEvt ) const;
+
+private:
+SdrObjEditView *mpEditView;
+const SdrTextObj *mpTextObj;
 };
 
 
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 180ae2e..89e4902 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -52,6 +52,7 @@
 #include svdglob.hxx
 #include svx/globl3d.hxx
 #include svx/textchain.hxx
+#include svx/textchaincursor.hxx
 #include editeng/outliner.hxx
 #include editeng/adjustitem.hxx
 #include svtools/colorcfg.hxx
@@ -1282,49 +1283,20 @@ bool SdrObjEditView::IsTextEditFrameHit(const Point 
rHit) const
 
 bool SdrObjEditView::ImpHandleMotionThroughBoxesKeyInput(const KeyEvent 
rKEvt, vcl::Window* pWin)
 {
-// XXX: Find a clean way to do this (even cleaner than the code commented 
below)
-// if( pTextEditOutlinerView-IsKeyEventPushingOutOfPage(rKevt, pWin)
-//   pWin = HandleKeyPushingOutOfBox(rKevt);
-KeyFuncType eFunc = rKEvt.GetKeyCode().GetFunction();
-sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode();
-ESelection aCurSel = pTextEditOutlinerView-GetSelection();
-
-
 SdrTextObj* pTextObj = NULL;
 if (mxTextEditObj.is())
 pTextObj= dynamic_castSdrTextObj*(mxTextEditObj.get());
+else
+return false;
 
-bool bHandled = false;
-
-// XXX: Add check for last position in the para
-if (pTextObj  pTextObj-IsChainable()  pTextObj-GetNextLinkInChain() 

-eFunc ==  KeyFuncType::DONTKNOW)
-{
-SdrOutliner *pOutl = GetTextEditOutliner();
-sal_Int32 nLastPara = pOutl-GetParagraphCount()-1;
-OUString aLastParaText = 
pOutl-GetText(pOutl-GetParagraph(nLastPara));
-sal_Int32 nLastParaLen = aLastParaText.getLength();
-
-if (nCode == KEY_RIGHT 
-aCurSel.nEndPara == nLastPara 
-aCurSel.nEndPos == nLastParaLen
-)
-{
-fprintf(stderr, [CHAIN - CURSOR] Trying to move to next box\n );
-
-// Move to next box
-SdrEndTextEdit();
-SdrTextObj *pNextLink = pTextObj-GetNextLinkInChain();
-SdrBeginTextEdit(pNextLink);
-bHandled = true;
-}
-
+TextChainCursorManager aCursorManager(this, pTextObj);
+if( aCursorManager.HandleKeyEvent(rKEvt) ) {
+// Possibly do other stuff here if necessary...
 // XXX: Careful with the checks below (in KeyInput) for pWin and co. 
You should do them here I guess.
-
+return true;
+} else {
+return false;
 }
-
-return bHandled;
-
 }
 
 bool SdrObjEditView::KeyInput(const KeyEvent rKEvt, vcl::Window* pWin)
@@ -1356,8 +1328,6 @@ bool SdrObjEditView::KeyInput(const KeyEvent rKEvt, 
vcl::Window* pWin)
 #endif
 ImpMakeTextCursorAreaVisible();
 
-
-
 return true;
 }
 }
diff --git a/svx/source/svdraw/textchaincursor.cxx 
b/svx/source/svdraw/textchaincursor.cxx
index 45f8533..37b5931 100644
--- a/svx/source/svdraw/textchaincursor.cxx
+++ b/svx/source/svdraw/textchaincursor.cxx
@@ -17,11 +17,53 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include svx/textchain.hxx
 #include svx/textchaincursor.hxx
+#include svx/svdedxv.hxx
+#include svx/svdoutl.hxx
 
-TextChainCursorHandler::TextChainCursorHandler()
+TextChainCursorManager::TextChainCursorManager(SdrObjEditView *pEditView, 
const SdrTextObj *pTextObj) :
+mpEditView(pEditView),
+mpTextObj(pTextObj)
 {
 
 }
 
+bool TextChainCursorManager::HandleKeyEvent( const KeyEvent rKEvt ) const
+{
+bool bHandled = false;
+
+// XXX: Find a clean way to do this (even cleaner than the code commented 
below)
+// if( pTextEditOutlinerView-IsKeyEventPushingOutOfPage(rKevt, pWin)
+//   pWin = HandleKeyPushingOutOfBox(rKevt);
+KeyFuncType eFunc = rKEvt.GetKeyCode().GetFunction();
+sal_uInt16 nCode = 

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

2015-07-23 Thread matteocam
 include/svx/textchaincursor.hxx   |4 +++
 svx/source/svdraw/svdedxv.cxx |   31 +++-
 svx/source/svdraw/textchaincursor.cxx |   43 ++
 3 files changed, 51 insertions(+), 27 deletions(-)

New commits:
commit 70ce299e1a6c4a1d7375ddb089acfb8b60a9e8c8
Author: matteocam matteo.campane...@gmail.com
Date:   Fri Jul 24 01:03:58 2015 +0200

Add specific method for cursor event handling

Change-Id: I664e1ac9ac52d7d54e2f3ca35cbb429dc2e131cb

diff --git a/include/svx/textchaincursor.hxx b/include/svx/textchaincursor.hxx
index 456d3c1..ce5200f 100644
--- a/include/svx/textchaincursor.hxx
+++ b/include/svx/textchaincursor.hxx
@@ -31,10 +31,14 @@ public:
 TextChainCursorManager(SdrObjEditView *pEditView, const SdrTextObj 
*pTextObj);
 
 bool HandleKeyEvent( const KeyEvent rKEvt ) const;
+void HandleCursorEvent(const CursorChainingEvent aCurEvt,
+   const ESelection  aNewSel) const;
 
 private:
 SdrObjEditView *mpEditView;
 const SdrTextObj *mpTextObj;
+
+void impChangeEditingTextObj(SdrTextObj *pTargetTextObj, ESelection 
aNewSel) const;
 };
 
 
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index fe7f6c4..15e2228 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -536,39 +536,16 @@ void SdrObjEditView::ImpMoveCursorAfterChainingEvent()
 if (!pTextObj-IsChainable() || !pTextObj-GetNextLinkInChain())
 return;
 
-
-SdrTextObj *pNextLink = pTextObj-GetNextLinkInChain();
-OutlinerView* pOLV = GetTextEditOutlinerView();
-
 TextChain *pTextChain = pTextObj-GetTextChain();
 ESelection aNewSel = pTextChain-GetPostChainingSel(pTextObj);
 
-switch ( pTextChain-GetCursorEvent(pTextObj) ) {
-
-case CursorChainingEvent::UNCHANGED:
-// Set same selection as before the chaining (which is saved 
as PostChainingSel)
-// We need an explicit set because the Outliner is messed up
-//after text transfer and otherwise it brings us at 
arbitrary positions.
-pOLV-SetSelection(aNewSel);
-break;
-case CursorChainingEvent::TO_NEXT_LINK:
-SdrEndTextEdit();
-SdrBeginTextEdit(pNextLink);
-// OutlinerView has changed, so we update the pointer
-pOLV = GetTextEditOutlinerView();
-pOLV-SetSelection(aNewSel); // XXX
-break;
-case CursorChainingEvent::TO_PREV_LINK:
-// XXX: To be handled
-break;
-case CursorChainingEvent::NULL_EVENT:
-// Do nothing here
-break;
-}
+TextChainCursorManager aCursorManager(this, pTextObj);
+aCursorManager.HandleCursorEvent(
+pTextChain-GetCursorEvent(pTextObj),
+aNewSel);
 
 // Reset event
 pTextChain-SetCursorEvent(pTextObj, CursorChainingEvent::NULL_EVENT);
-
 }
 
 IMPL_LINK(SdrObjEditView,ImpOutlinerCalcFieldValueHdl,EditFieldInfo*,pFI)
diff --git a/svx/source/svdraw/textchaincursor.cxx 
b/svx/source/svdraw/textchaincursor.cxx
index 37b5931..a0def07 100644
--- a/svx/source/svdraw/textchaincursor.cxx
+++ b/svx/source/svdraw/textchaincursor.cxx
@@ -22,6 +22,10 @@
 #include svx/svdedxv.hxx
 #include svx/svdoutl.hxx
 
+// XXX: Possible duplication of code in behavior with stuff in ImpEditView (or 
ImpEditEngine) and OutlinerView
+
+// XXX: We violate Demeter's Law several times here, I'm afraid
+
 TextChainCursorManager::TextChainCursorManager(SdrObjEditView *pEditView, 
const SdrTextObj *pTextObj) :
 mpEditView(pEditView),
 mpTextObj(pTextObj)
@@ -66,4 +70,43 @@ bool TextChainCursorManager::HandleKeyEvent( const KeyEvent 
rKEvt ) const
 return bHandled;
 }
 
+void TextChainCursorManager::HandleCursorEvent(const CursorChainingEvent 
aCurEvt,
+   const ESelection  aNewSel) const
+{
+OutlinerView* pOLV = mpEditView-GetTextEditOutlinerView();
+SdrTextObj *pNextLink = mpTextObj-GetNextLinkInChain();
+SdrTextObj *pPrevLink = mpTextObj-GetPrevLinkInChain();
+
+switch ( aCurEvt ) {
+case CursorChainingEvent::UNCHANGED:
+// Set same selection as before the chaining (which is saved 
as PostChainingSel)
+// We need an explicit set because the Outliner is messed up
+//after text transfer and otherwise it brings us at 
arbitrary positions.
+pOLV-SetSelection(aNewSel);
+break;
+case CursorChainingEvent::TO_NEXT_LINK:
+impChangeEditingTextObj(pNextLink, aNewSel);
+break;
+case CursorChainingEvent::TO_PREV_LINK:
+impChangeEditingTextObj(pPrevLink, aNewSel);
+break;
+case CursorChainingEvent::NULL_EVENT:
+// Do nothing here
+break;

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

2015-07-23 Thread matteocam
 include/svx/textchaincursor.hxx   |4 +
 svx/source/svdraw/svdedxv.cxx |3 +
 svx/source/svdraw/textchaincursor.cxx |   85 +-
 3 files changed, 61 insertions(+), 31 deletions(-)

New commits:
commit 4ded1c96716ac12fabda495901f677d366265926
Author: matteocam matteo.campane...@gmail.com
Date:   Fri Jul 24 01:38:16 2015 +0200

Add specific method for detecting event

Change-Id: I3030f4a5c80bcade440fb66d578430abb15dfc44

diff --git a/include/svx/textchaincursor.hxx b/include/svx/textchaincursor.hxx
index ce5200f..b56dd72 100644
--- a/include/svx/textchaincursor.hxx
+++ b/include/svx/textchaincursor.hxx
@@ -23,6 +23,7 @@
 class SdrObjEditView;
 class SdrTextObj;
 class KeyEvent;
+class SdrOutliner;
 
 
 class TextChainCursorManager
@@ -39,6 +40,9 @@ private:
 const SdrTextObj *mpTextObj;
 
 void impChangeEditingTextObj(SdrTextObj *pTargetTextObj, ESelection 
aNewSel) const;
+void impDetectEvent(const KeyEvent rKEvt,
+CursorChainingEvent *pOutCursorEvt,
+ESelection *pOutSel) const;
 };
 
 
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 15e2228..c9428dc 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -1266,6 +1266,9 @@ bool 
SdrObjEditView::ImpHandleMotionThroughBoxesKeyInput(const KeyEvent rKEvt,
 else
 return false;
 
+if (!pTextObj-IsChainable())
+return false;
+
 TextChainCursorManager aCursorManager(this, pTextObj);
 if( aCursorManager.HandleKeyEvent(rKEvt) ) {
 // Possibly do other stuff here if necessary...
diff --git a/svx/source/svdraw/textchaincursor.cxx 
b/svx/source/svdraw/textchaincursor.cxx
index a0def07..7ca44f7 100644
--- a/svx/source/svdraw/textchaincursor.cxx
+++ b/svx/source/svdraw/textchaincursor.cxx
@@ -30,49 +30,73 @@ 
TextChainCursorManager::TextChainCursorManager(SdrObjEditView *pEditView, const
 mpEditView(pEditView),
 mpTextObj(pTextObj)
 {
+assert(mpEditView);
+assert(mpTextObj);
 
 }
 
 bool TextChainCursorManager::HandleKeyEvent( const KeyEvent rKEvt ) const
 {
-bool bHandled = false;
+ESelection aNewSel;
+CursorChainingEvent aCursorEvent;
+
+// check what the cursor/event situation looks like
+impDetectEvent(rKEvt, aCursorEvent, aNewSel);
+
+if (aCursorEvent == CursorChainingEvent::NULL_EVENT)
+return false;
+else {
+HandleCursorEvent(aCursorEvent, aNewSel);
+return true;
+}
+}
+
+void TextChainCursorManager::impDetectEvent(const KeyEvent rKEvt,
+CursorChainingEvent *pOutCursorEvt,
+ESelection *pOutSel) const
+{
+SdrOutliner *pOutl = mpEditView-GetTextEditOutliner();
+OutlinerView *pOLV = mpEditView-GetTextEditOutlinerView();
 
-// XXX: Find a clean way to do this (even cleaner than the code commented 
below)
-// if( pTextEditOutlinerView-IsKeyEventPushingOutOfPage(rKevt, pWin)
-//   pWin = HandleKeyPushingOutOfBox(rKevt);
 KeyFuncType eFunc = rKEvt.GetKeyCode().GetFunction();
-sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode();
-ESelection aCurSel = mpEditView-GetTextEditOutlinerView()-GetSelection();
 
-if (mpTextObj  mpTextObj-IsChainable()  
mpTextObj-GetNextLinkInChain() 
-eFunc ==  KeyFuncType::DONTKNOW)
+// We need to have this KeyFuncType
+if (eFunc !=  KeyFuncType::DONTKNOW)
 {
-SdrOutliner *pOutl = mpEditView-GetTextEditOutliner();
-sal_Int32 nLastPara = pOutl-GetParagraphCount()-1;
-OUString aLastParaText = 
pOutl-GetText(pOutl-GetParagraph(nLastPara));
-sal_Int32 nLastParaLen = aLastParaText.getLength();
-
-if (nCode == KEY_RIGHT 
-aCurSel.nEndPara == nLastPara 
-aCurSel.nEndPos == nLastParaLen
-)
-{
-fprintf(stderr, [CHAIN - CURSOR] Trying to move to next box\n );
-
-// Move to next box
-mpEditView-SdrEndTextEdit();
-SdrTextObj *pNextLink = mpTextObj-GetNextLinkInChain();
-mpEditView-SdrBeginTextEdit(pNextLink);
-bHandled = true;
-}
+*pOutCursorEvt = CursorChainingEvent::NULL_EVENT;
+return;
+}
 
+sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode();
+ESelection aCurSel = pOLV-GetSelection();
+
+sal_Int32 nLastPara = pOutl-GetParagraphCount()-1;
+OUString aLastParaText = pOutl-GetText(pOutl-GetParagraph(nLastPara));
+sal_Int32 nLastParaLen = aLastParaText.getLength();
+
+bool bAtEndOfTextContent =
+(aCurSel.nEndPara == nLastPara) 
+(aCurSel.nEndPos == nLastParaLen);
+
+if (nCode == KEY_RIGHT  bAtEndOfTextContent)
+{
+*pOutCursorEvt = CursorChainingEvent::TO_NEXT_LINK;
+// Selection unchanged: we are at the beginning of the box
 }
-return bHandled;
+
+// if (nCode == KEY_LEFT  

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

2015-07-23 Thread matteocam
 include/svx/textchain.hxx   |8 
 svx/source/svdraw/svdotext.cxx  |   18 +++---
 svx/source/svdraw/textchain.cxx |   26 --
 3 files changed, 27 insertions(+), 25 deletions(-)

New commits:
commit 03941b5adfa468372983331f39b9fabb962d5616
Author: matteocam matteo.campane...@gmail.com
Date:   Thu Jul 23 19:26:03 2015 +0200

Move implementation of next link in TextChain

Change-Id: If511e1d64af34d85470f1de5c43cbfb72651179e

diff --git a/include/svx/textchain.hxx b/include/svx/textchain.hxx
index ad929ed..41f0fc8 100644
--- a/include/svx/textchain.hxx
+++ b/include/svx/textchain.hxx
@@ -140,8 +140,8 @@ class TextChain {
 void AppendLink(SdrTextObj *);
 bool IsLinkInChain(SdrTextObj *) const;
 
-SdrTextObj *GetNextLink(SdrTextObj *) const;
-SdrTextObj *GetPrevLink(SdrTextObj *) const;
+SdrTextObj *GetNextLink(const SdrTextObj *) const;
+SdrTextObj *GetPrevLink(const SdrTextObj *) const;
 
 ChainLinkId GetId(const SdrTextObj *) const;
 ImpChainLinkProperties *GetLinkProperties(const SdrTextObj *);
@@ -160,8 +160,8 @@ class TextChain {
 LinkPropertiesMap maLinkPropertiesMap;
 
 private:
-SdrTextObj *impGetNextLink(SdrTextObj *) const;
-SdrTextObj *impGetPrevLink(SdrTextObj *) const;
+SdrTextObj *impGetNextLink(const SdrTextObj *) const;
+SdrTextObj *impGetPrevLink(const SdrTextObj *) const;
 
 
 };
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index f315d01..35b481b 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -2082,22 +2082,10 @@ void SdrTextObj::SetObjectItemNoBroadcast(const 
SfxPoolItem rItem)
 
 SdrTextObj* SdrTextObj::GetNextLinkInChain() const
 {
-/* FIXME(matteocam) return mpNextInChain; */
-SdrTextObj *pNextTextObj = NULL;
-
-if ( pPage  pPage-GetObjCount()  1) {
-
-sal_uInt32 nextIndex = (GetOrdNum()+1);
-
-if (nextIndex  pPage-GetObjCount())
-pNextTextObj =  dynamic_cast SdrTextObj * ( pPage-GetObj( 
nextIndex ) );
-
-return pNextTextObj;
-} else {
-fprintf(stderr, Make New Object please\n);
-return NULL;
-}
+if (GetTextChain())
+return GetTextChain()-GetNextLink(this);
 
+return NULL;
 }
 
 SdrTextObj* SdrTextObj::GetPrevLinkInChain() const
diff --git a/svx/source/svdraw/textchain.cxx b/svx/source/svdraw/textchain.cxx
index 787b298..31ea1fd 100644
--- a/svx/source/svdraw/textchain.cxx
+++ b/svx/source/svdraw/textchain.cxx
@@ -19,6 +19,7 @@
 
 #include svx/textchain.hxx
 #include svx/svdotext.hxx
+#include svx/svdpage.hxx
 
 /*
  * Definition of Properties Interface
@@ -55,23 +56,36 @@ void TextChain::AppendLink(SdrTextObj *)
 // XXX
 }
 
-SdrTextObj *TextChain::GetNextLink(SdrTextObj *pTextObj) const
+SdrTextObj *TextChain::GetNextLink(const SdrTextObj *pTextObj) const
 {
 return impGetNextLink(pTextObj);
 }
 
-SdrTextObj *TextChain::GetPrevLink(SdrTextObj *pTextObj) const
+SdrTextObj *TextChain::GetPrevLink(const SdrTextObj *pTextObj) const
 {
 return impGetPrevLink(pTextObj);
 }
 
-SdrTextObj *TextChain::impGetNextLink(SdrTextObj *pTextObj) const
+SdrTextObj *TextChain::impGetNextLink(const SdrTextObj *pTextObj) const
 {
-// XXX: To be implemented
-return NULL;
+SdrTextObj *pNextTextObj = NULL;
+SdrPage *pPage = pTextObj-pPage;
+
+if ( pPage  pPage-GetObjCount()  1) {
+
+sal_uInt32 nextIndex = (pTextObj-GetOrdNum()+1);
+
+if (nextIndex  pPage-GetObjCount())
+pNextTextObj =  dynamic_cast SdrTextObj * ( pPage-GetObj( 
nextIndex ) );
+
+return pNextTextObj;
+} else {
+fprintf(stderr, Make New Object please\n);
+return NULL;
+}
 }
 
-SdrTextObj *TextChain::impGetPrevLink(SdrTextObj *pTextObj) const
+SdrTextObj *TextChain::impGetPrevLink(const SdrTextObj *pTextObj) const
 {
 // XXX: To be implemented
 return NULL;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-07-23 Thread matteocam
 include/svx/textchaincursor.hxx   |   29 -
 svx/source/svdraw/svdedxv.cxx |4 ++--
 svx/source/svdraw/textchaincursor.cxx |   26 ++
 3 files changed, 56 insertions(+), 3 deletions(-)

New commits:
commit f21494386f8a40fdd82511fb7204284a2f16cdf2
Author: matteocam matteo.campane...@gmail.com
Date:   Thu Jul 23 20:49:31 2015 +0200

Prototype textchaincursor files

Change-Id: Icf93a63f51cae31c804f4ab247e577f5a5deca77

diff --git a/include/svx/textchaincursor.hxx b/include/svx/textchaincursor.hxx
index 0e6c127..71dbc60 100644
--- a/include/svx/textchaincursor.hxx
+++ b/include/svx/textchaincursor.hxx
@@ -1,6 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the License); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_TEXTCHAINCURSOR_HXX
+#define INCLUDED_SVX_TEXTCHAINCURSOR_HXX
 
 
 class TextChainCursorHandler
 {
-
+TextChainCursorHandler();
 };
+
+
+#endif // INCLUDED_SVX_TEXTCHAINCURSOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 59b5fd4..180ae2e 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -1317,9 +1317,9 @@ bool 
SdrObjEditView::ImpHandleMotionThroughBoxesKeyInput(const KeyEvent rKEvt,
 SdrTextObj *pNextLink = pTextObj-GetNextLinkInChain();
 SdrBeginTextEdit(pNextLink);
 bHandled = true;
-} // else if (...)
+}
 
-// XXX: Careful with the checks below for pWin and co. You should do 
them here I guess.
+// XXX: Careful with the checks below (in KeyInput) for pWin and co. 
You should do them here I guess.
 
 }
 
diff --git a/svx/source/svdraw/textchaincursor.cxx 
b/svx/source/svdraw/textchaincursor.cxx
index 8b13789..45f8533 100644
--- a/svx/source/svdraw/textchaincursor.cxx
+++ b/svx/source/svdraw/textchaincursor.cxx
@@ -1 +1,27 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the License); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
 
+#include svx/textchaincursor.hxx
+
+TextChainCursorHandler::TextChainCursorHandler()
+{
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-07-13 Thread matteocam
 include/svx/textchain.hxx   |7 +--
 svx/source/svdraw/textchain.cxx |9 +
 2 files changed, 6 insertions(+), 10 deletions(-)

New commits:
commit afe335ac3bf0bcd79ee58699f132cf4ad7e5aefe
Author: matteocam matteo.campane...@gmail.com
Date:   Mon Jul 13 11:12:05 2015 -0400

Add IsPartOfLastParaInNextLink Property

Change-Id: I0410c4417bebb7ffb9cd162a1ecf3d5028f513fa

diff --git a/include/svx/textchain.hxx b/include/svx/textchain.hxx
index 6a70c8b..8d0ae47 100644
--- a/include/svx/textchain.hxx
+++ b/include/svx/textchain.hxx
@@ -117,6 +117,7 @@ class ImpChainLinkProperties
 INIT_CHAIN_PROP(CursorEvent, CursorChainingEvent::NULL_EVENT)
 INIT_CHAIN_PROP(PreChainingSel, ESelection(0,0,0,0));
 INIT_CHAIN_PROP(PostChainingSel, ESelection(0,0,0,0));
+INIT_CHAIN_PROP(IsPartOfLastParaInNextLink, false)
 }
 
 private:
@@ -125,6 +126,7 @@ class ImpChainLinkProperties
 DECL_CHAIN_PROP(CursorEvent, CursorChainingEvent)
 DECL_CHAIN_PROP(PreChainingSel, ESelection)
 DECL_CHAIN_PROP(PostChainingSel, ESelection)
+DECL_CHAIN_PROP(IsPartOfLastParaInNextLink, bool)
 
 };
 
@@ -147,9 +149,10 @@ class TextChain {
 DECL_CHAIN_PROP_INTERFACE(NilChainingEvent, bool)
 DECL_CHAIN_PROP_INTERFACE(PreChainingSel, ESelection)
 DECL_CHAIN_PROP_INTERFACE(PostChainingSel, ESelection)
+// return whether a paragraph is split between this box and the next
+DECL_CHAIN_PROP_INTERFACE(IsPartOfLastParaInNextLink, bool)
+
 
-// return whether a paragraph is split between the two links in the 
argument
-bool GetLinksHaveMergeableFirstPara(SdrTextObj *, SdrTextObj *);
 
 protected:
 LinkPropertiesMap maLinkPropertiesMap;
diff --git a/svx/source/svdraw/textchain.cxx b/svx/source/svdraw/textchain.cxx
index 36966bb..25b75ae 100644
--- a/svx/source/svdraw/textchain.cxx
+++ b/svx/source/svdraw/textchain.cxx
@@ -28,6 +28,7 @@ IMPL_CHAIN_PROP_INTERFACE(CursorEvent, CursorChainingEvent)
 IMPL_CHAIN_PROP_INTERFACE(NilChainingEvent, bool)
 IMPL_CHAIN_PROP_INTERFACE(PreChainingSel, ESelection)
 IMPL_CHAIN_PROP_INTERFACE(PostChainingSel, ESelection)
+IMPL_CHAIN_PROP_INTERFACE(IsPartOfLastParaInNextLink, bool)
 
 /* End Definition of Properties Interface */
 
@@ -59,14 +60,6 @@ SdrTextObj *TextChain::GetNextLink(SdrTextObj *) const
 return NULL; // XXX: To be changed. It'd be a mess to implement now
 }
 
-
-bool TextChain::GetLinksHaveMergeableFirstPara(SdrTextObj* /* pPrevLink */, 
SdrTextObj* /* pNextLink */)
-{
-// XXX
-return false;
-}
-
-
 ImpChainLinkProperties *TextChain::GetLinkProperties(const SdrTextObj *pLink)
 {
 // if the guy does not already have properties in the map make them
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-07-10 Thread matteocam
 include/svx/textchain.hxx   |   12 ++--
 svx/source/svdraw/svdedxv.cxx   |2 +-
 svx/source/svdraw/svdotext.cxx  |4 
 svx/source/svdraw/svdotextdecomposition.cxx |3 +++
 svx/source/svdraw/textchain.cxx |4 ++--
 svx/source/svdraw/textchainflow.cxx |5 +
 6 files changed, 21 insertions(+), 9 deletions(-)

New commits:
commit 942824a9e0c9bb679e0393122eb38fe4d4f212a1
Author: matteocam matteo.campane...@gmail.com
Date:   Fri Jul 10 12:56:24 2015 -0400

Prevent multiple chaining events for static text

Change-Id: I3d42cc161dbb2002df710f0bd424bc89fdbfb224

diff --git a/include/svx/textchain.hxx b/include/svx/textchain.hxx
index 69b197e..6a70c8b 100644
--- a/include/svx/textchain.hxx
+++ b/include/svx/textchain.hxx
@@ -53,15 +53,15 @@
 a##PropName = (PropDefault);
 
 #define DECL_CHAIN_PROP_INTERFACE(PropName, PropType) \
-PropType Get##PropName (SdrTextObj *); \
-void Set##PropName (SdrTextObj *, PropType);
+PropType Get##PropName (const SdrTextObj *); \
+void Set##PropName (const SdrTextObj *, PropType);
 
 #define IMPL_CHAIN_PROP_INTERFACE(PropName, PropType) \
-PropType TextChain::Get##PropName (SdrTextObj *pTarget) { \
+PropType TextChain::Get##PropName (const SdrTextObj *pTarget) { \
 ImpChainLinkProperties *pLinkProperties = GetLinkProperties(pTarget); \
 return pLinkProperties-a##PropName; \
 } \
-void TextChain::Set##PropName (SdrTextObj *pTarget, PropType aPropParam) \
+void TextChain::Set##PropName (const SdrTextObj *pTarget, PropType 
aPropParam) \
 { \
 ImpChainLinkProperties *pLinkProperties = GetLinkProperties(pTarget); \
 pLinkProperties-a##PropName = aPropParam; \
@@ -139,8 +139,8 @@ class TextChain {
 bool IsLinkInChain(SdrTextObj *) const;
 SdrTextObj *GetNextLink(SdrTextObj *) const;
 
-ChainLinkId GetId(SdrTextObj *) const;
-ImpChainLinkProperties *GetLinkProperties(SdrTextObj *);
+ChainLinkId GetId(const SdrTextObj *) const;
+ImpChainLinkProperties *GetLinkProperties(const SdrTextObj *);
 
 // Specific Link Properties
 DECL_CHAIN_PROP_INTERFACE(CursorEvent, CursorChainingEvent)
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 5e00942..80bd5ff 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -497,7 +497,7 @@ IMPL_LINK_NOARG(SdrObjEditView,ImpChainingEventHdl)
 }
 
 // We prevent to trigger further handling of overflow/underflow 
for pTextObj
-pTextChain-SetNilChainingEvent(pTextObj, true);
+pTextChain-SetNilChainingEvent(pTextObj, true); // XXX
 
 // Save previous selection pos // NOTE: It must be done to have 
the right CursorEvent in KeyInput
 pTextChain-SetPreChainingSel(pTextObj, pOLV-GetSelection());
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 0a33fa4..afa40df 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -2073,6 +2073,10 @@ SdrTextObj* SdrTextObj::GetNextLinkInChain() const
 /* FIXME(matteocam) return mpNextInChain; */
 SdrTextObj *pNextTextObj = NULL;
 
+// Check that no overflow is going on // XXX: This should be moved in 
IsChainable
+if (GetTextChain()-GetNilChainingEvent(this))
+return NULL;
+
 if ( pPage  pPage-GetObjCount()  1) {
 
 if (!GetName().startsWith(Chainable)) {
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx 
b/svx/source/svdraw/svdotextdecomposition.cxx
index 954f261..241ec8b 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -1490,6 +1490,7 @@ void SdrTextObj::impDecomposeChainedTextPrimitive(
  // We need the outliner we get the overflow info from as well as
  //  the outliner for drawing (e.g. a drawing or chaining outliner)
  // maybe the latter ones can be passed at the time of overflow and such
+GetTextChain()-SetNilChainingEvent(this, true);
 TextChainFlow aTxtChainFlow(const_castSdrTextObj*(this));
 bool bIsOverflow;
 
@@ -1514,6 +1515,8 @@ void SdrTextObj::impDecomposeChainedTextPrimitive(
 aTxtChainFlow.ExecuteOverflow(rOutliner, rChainingOutl);
 }
 
+GetTextChain()-SetNilChainingEvent(this, false);
+
 /* End overflow/underflow handling */
 
 // set visualizing page at Outliner; needed e.g. for PageNumberField 
decomposition
diff --git a/svx/source/svdraw/textchain.cxx b/svx/source/svdraw/textchain.cxx
index a7bd1b6..36966bb 100644
--- a/svx/source/svdraw/textchain.cxx
+++ b/svx/source/svdraw/textchain.cxx
@@ -67,7 +67,7 @@ bool TextChain::GetLinksHaveMergeableFirstPara(SdrTextObj* /* 
pPrevLink */, SdrT
 }
 
 
-ImpChainLinkProperties *TextChain::GetLinkProperties(SdrTextObj *pLink)
+ImpChainLinkProperties *TextChain::GetLinkProperties(const SdrTextObj *pLink)
 {
 // if the guy does 

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

2015-07-10 Thread matteocam
 include/svx/svdotext.hxx|1 
 svx/source/svdraw/svdotextdecomposition.cxx |   62 ++--
 2 files changed, 33 insertions(+), 30 deletions(-)

New commits:
commit cf9aae1558581a6e3851ab1db039bb16e86699be
Author: matteocam matteo.campane...@gmail.com
Date:   Fri Jul 10 17:35:24 2015 -0400

Use a separate method for static chaining

Change-Id: I289b411b5867c5e2b06f75633790f407bc3dbba1

diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index 4ab6313..761c4e0 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -626,6 +626,7 @@ public:
 drawinglayer::primitive2d::Primitive2DSequence rTarget,
 const drawinglayer::primitive2d::SdrChainedTextPrimitive2D 
rSdrChainedTextPrimitive,
 const drawinglayer::geometry::ViewInformation2D aViewInformation) 
const;
+void impHandleChainingEventsDuringDecomposition(SdrOutliner rOutliner) 
const;
 
 
 // timing generators
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx 
b/svx/source/svdraw/svdotextdecomposition.cxx
index 241ec8b..b627b77 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -1423,6 +1423,37 @@ void 
SdrTextObj::impGetScrollTextTiming(drawinglayer::animation::AnimationEntryL
 }
 }
 
+void SdrTextObj::impHandleChainingEventsDuringDecomposition(SdrOutliner 
rOutliner) const
+{
+GetTextChain()-SetNilChainingEvent(this, true);
+
+TextChainFlow aTxtChainFlow(const_castSdrTextObj*(this));
+bool bIsOverflow;
+
+aTxtChainFlow.CheckForFlowEvents(rOutliner);
+
+if (aTxtChainFlow.IsUnderflow()  !IsInEditMode())
+{
+// underflow-induced overflow
+aTxtChainFlow.ExecuteUnderflow(rOutliner);
+bIsOverflow = aTxtChainFlow.IsOverflow();
+} else {
+// standard overflow (no underlow before)
+bIsOverflow = aTxtChainFlow.IsOverflow();
+}
+
+if (bIsOverflow  !IsInEditMode()) {
+// Initialize Chaining Outliner
+SdrOutliner rChainingOutl = pModel-GetChainingOutliner(this);
+ImpInitDrawOutliner( rChainingOutl );
+rChainingOutl.SetUpdateMode(true);
+// We must pass the chaining outliner otherwise we would mess up 
decomposition
+aTxtChainFlow.ExecuteOverflow(rOutliner, rChainingOutl);
+}
+
+GetTextChain()-SetNilChainingEvent(this, false);
+}
+
 void SdrTextObj::impDecomposeChainedTextPrimitive(
 drawinglayer::primitive2d::Primitive2DSequence rTarget,
 const drawinglayer::primitive2d::SdrChainedTextPrimitive2D 
rSdrChainedTextPrimitive,
@@ -1486,36 +1517,7 @@ void SdrTextObj::impDecomposeChainedTextPrimitive(
 
 /* Begin overflow/underflow handling */
 
- // any parameter in the constructor?
- // We need the outliner we get the overflow info from as well as
- //  the outliner for drawing (e.g. a drawing or chaining outliner)
- // maybe the latter ones can be passed at the time of overflow and such
-GetTextChain()-SetNilChainingEvent(this, true);
-TextChainFlow aTxtChainFlow(const_castSdrTextObj*(this));
-bool bIsOverflow;
-
-aTxtChainFlow.CheckForFlowEvents(rOutliner);
-
-if (aTxtChainFlow.IsUnderflow()  !IsInEditMode())
-{
-// underflow-induced overflow
-aTxtChainFlow.ExecuteUnderflow(rOutliner);
-bIsOverflow = aTxtChainFlow.IsOverflow();
-} else {
-// standard overflow (no underlow before)
-bIsOverflow = aTxtChainFlow.IsOverflow();
-}
-
-if (bIsOverflow  !IsInEditMode()) {
-// Initialize Chaining Outliner
-SdrOutliner rChainingOutl = pModel-GetChainingOutliner(this);
-ImpInitDrawOutliner( rChainingOutl );
-rChainingOutl.SetUpdateMode(true);
-// We must pass the chaining outliner otherwise we would mess up 
decomposition
-aTxtChainFlow.ExecuteOverflow(rOutliner, rChainingOutl);
-}
-
-GetTextChain()-SetNilChainingEvent(this, false);
+impHandleChainingEventsDuringDecomposition(rOutliner);
 
 /* End overflow/underflow handling */
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-07-08 Thread matteocam
 include/svx/svdedxv.hxx   |9 +
 svx/source/svdraw/svdedxv.cxx |   64 +++---
 2 files changed, 57 insertions(+), 16 deletions(-)

New commits:
commit e76ca3b674ebd74bdd1ad81dc9ab942c7151f0e1
Author: matteocam matteo.campane...@gmail.com
Date:   Wed Jul 8 09:00:20 2015 -0400

Move to the other box after OF.

Change-Id: I5184cfb09bb796821fa12a07f085bf790d46b792

diff --git a/include/svx/svdedxv.hxx b/include/svx/svdedxv.hxx
index 010032e..0f9de4d 100644
--- a/include/svx/svdedxv.hxx
+++ b/include/svx/svdedxv.hxx
@@ -35,6 +35,9 @@ class ImpSdrEditPara;
 struct PasteOrDropInfos;
 class SdrUndoManager;
 
+enum class CursorChainingEvent;
+class ESelection;
+
 namespace com { namespace sun { namespace star { namespace uno {
 class Any;
 } } } }
@@ -94,6 +97,10 @@ private:
 
 SVX_DLLPRIVATE void ImpClearVars();
 
+// FIXME(matteocam)
+CursorChainingEvent *maCursorEvent;
+ESelection *maPreChainingSel;
+
 protected:
 // central method to get an SdrUndoManager for enhanced TextEdit. Default 
will
 // try to return a dynamic_casted GetModel()-GetSdrUndoManager(). 
Applications
@@ -103,6 +110,8 @@ protected:
 
 OutlinerView* ImpFindOutlinerView(vcl::Window* pWin) const;
 
+void ImpMoveCursorAfterChainingEvent();
+
 // Create a new OutlinerView at the heap and initialize all required 
parameters.
 // pTextEditObj, pTextEditPV and pTextEditOutliner have to be initialized
 OutlinerView* ImpMakeOutlinerView(vcl::Window* pWin, bool bNoPaint, 
OutlinerView* pGivenView) const;
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index febb1c5..c09dfb1 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -500,7 +500,7 @@ IMPL_LINK_NOARG(SdrObjEditView,ImpChainingEventHdl)
 pTextChain-SetNilChainingEvent(pTextObj, true);
 
 // Save previous selection pos
-ESelection aPreChainingSel(pOLV-GetSelection());
+maPreChainingSel = new ESelection(pOLV-GetSelection());
 
 // trigger actual chaining
 pTextObj-onChainingEvent();
@@ -508,22 +508,9 @@ IMPL_LINK_NOARG(SdrObjEditView,ImpChainingEventHdl)
 // XXX: this logic could be put in a separate approppriate class
 /* Cursor motion stuff */
 
-CursorChainingEvent aCursorEvent = 
pTextChain-GetCursorEvent(pTextObj);
-SdrTextObj *pNextLink = pTextObj-GetNextLinkInChain();
+maCursorEvent = new 
CursorChainingEvent(pTextChain-GetCursorEvent(pTextObj));
+//SdrTextObj *pNextLink = pTextObj-GetNextLinkInChain();
 
-switch (aCursorEvent) {
-
-case CursorChainingEvent::UNCHANGED:
-pOLV-SetSelection(aPreChainingSel);
-break;
-case CursorChainingEvent::TO_NEXT_LINK:
-//SdrEndTextEdit(true);
-//SdrBeginTextEdit(pNextLink, nullptr, nullptr, false, 
nullptr, nullptr, true, true);
-break;
-case CursorChainingEvent::TO_PREV_LINK:
-// XXX: To be handled
-break;
-}
 
 // Find last Para
 /*
@@ -545,6 +532,47 @@ IMPL_LINK_NOARG(SdrObjEditView,ImpChainingEventHdl)
 return 0;
 }
 
+
+void SdrObjEditView::ImpMoveCursorAfterChainingEvent()
+{
+if (!mxTextEditObj.is())
+return;
+
+SdrTextObj* pTextObj = dynamic_castSdrTextObj*(mxTextEditObj.get());
+
+if (!pTextObj-IsChainable() || !pTextObj-GetNextLinkInChain())
+return;
+
+assert(maCursorEvent);
+assert(maPreChainingSel);
+
+SdrTextObj *pNextLink = pTextObj-GetNextLinkInChain();
+OutlinerView* pOLV = GetTextEditOutlinerView();
+
+switch (*maCursorEvent) {
+
+case CursorChainingEvent::UNCHANGED:
+pOLV-SetSelection(*maPreChainingSel);
+break;
+case CursorChainingEvent::TO_NEXT_LINK:
+SdrEndTextEdit();
+SdrBeginTextEdit(pNextLink);
+
+//SdrEndTextEdit(true);
+//SdrBeginTextEdit(pNextLink, nullptr, nullptr, false, 
nullptr, nullptr, true, true);
+break;
+case CursorChainingEvent::TO_PREV_LINK:
+// XXX: To be handled
+break;
+}
+
+// Default case
+// XXX: You should delete the old ones here too.
+maCursorEvent = NULL;
+maPreChainingSel = NULL;
+
+}
+
 IMPL_LINK(SdrObjEditView,ImpOutlinerCalcFieldValueHdl,EditFieldInfo*,pFI)
 {
 bool bOk=false;
@@ -1274,6 +1302,10 @@ bool SdrObjEditView::KeyInput(const KeyEvent rKEvt, 
vcl::Window* pWin)
 if (pItemBrowser!=nullptr) pItemBrowser-SetDirty();
 #endif
 ImpMakeTextCursorAreaVisible();
+
+// FIXME(matteocam)
+ImpMoveCursorAfterChainingEvent();
+
 return true;
 

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

2015-07-08 Thread matteocam
 include/svx/textchain.hxx   |   88 
 svx/source/svdraw/svdedxv.cxx   |   14 -
 svx/source/svdraw/textchain.cxx |   39 ---
 svx/source/svdraw/textchainflow.cxx |2 
 4 files changed, 89 insertions(+), 54 deletions(-)

New commits:
commit 4c9e5c5862d1aed26f96228c2fe01ebf0de8fd01
Author: matteocam matteo.campane...@gmail.com
Date:   Wed Jul 8 10:29:51 2015 -0400

Define macro system for text chain properties

Change-Id: Id50a9996e0b60e0650dbd67fdb4ebbc8ef2f1d4a

diff --git a/include/svx/textchain.hxx b/include/svx/textchain.hxx
index 730489b..efd52ef 100644
--- a/include/svx/textchain.hxx
+++ b/include/svx/textchain.hxx
@@ -20,6 +20,52 @@
 #ifndef INCLUDED_SVX_TEXTCHAIN_HXX
 #define INCLUDED_SVX_TEXTCHAIN_HXX
 
+/*
+ * Properties can be accessed and set from a TextChain with:
+ * - T TextChain::GetPROPNAME(SdrTextObj *)
+ * - void TextChain::SetPROPNAME(SdrTextObj *, T)
+ * where T and PROPNAME are respectively type and name of a property.
+ *
+ * To add a property PROPNAME of type T (and its interface) in TextChain:
+ * 1) Add
+ *  DECL_CHAIN_PROP(PROPNAME, T)
+ *in class ImpChainLinkProperties;
+ * 2) Add
+ *  INIT_CHAIN_PROP(PROPNAME, V)
+ *in constructor of ImpChainLinkProperties below
+ *(V is the initialization value for PROPNAME)
+ *
+ * 2) Add
+ *  DECL_CHAIN_PROP_INTERFACE(PROPNAME, T)
+ *in class TextChain (under public:);
+ * 3)  Add
+ *   IMPL_CHAIN_PROP_INTERFACE(PROPNAME, T)
+ *in file svx/source/svdraw/textchain.cxx
+*/
+
+#define DECL_CHAIN_PROP(PropName, PropType) \
+PropType a##PropName;
+
+#define INIT_CHAIN_PROP(PropName, PropDefault) \
+a##PropName = (PropDefault);
+
+#define DECL_CHAIN_PROP_INTERFACE(PropName, PropType) \
+PropType Get##PropName (SdrTextObj *); \
+void Set##PropName (SdrTextObj *, PropType);
+
+#define IMPL_CHAIN_PROP_INTERFACE(PropName, PropType) \
+PropType TextChain::Get##PropName (SdrTextObj *pTarget) { \
+ImpChainLinkProperties *pLinkProperties = GetLinkProperties(pTarget); \
+return pLinkProperties-a##PropName; \
+} \
+void TextChain::Set##PropName (SdrTextObj *pTarget, PropType aPropParam) \
+{ \
+ImpChainLinkProperties *pLinkProperties = GetLinkProperties(pTarget); \
+pLinkProperties-a##PropName = aPropParam; \
+}
+
+/* End Special Properties Macro */
+
 #include map
 
 class ImpChainLinkProperties;
@@ -39,16 +85,40 @@ enum class CursorChainingEvent
 UNCHANGED
 };
 
+/*
+ * // Note Sure I need the code here
+struct CursorChainingInfo
+{
+public:
+CursorChainingEvent GetEvent() const;
+ESelection GetPreChainingSel() const;
+ESelection GetPostChainingSel() const;
+
+void SetEvent(CursorChainingEvent aEvent) { maEvent = aEvent; }
+void SetPreChainingSel(ESelection aSel) { maPreChainingSel = aSel; }
+void SetPostChainingSel(ESelection aSel) { maPostChaingingSel = aSel; }
+private:
+CursorChainingEvent maEvent;
+ESelection maPreChainingSel;
+ESelection maPostChainingSel;
+};
+* */
+
 class ImpChainLinkProperties
 {
 protected:
 friend class TextChain;
 
-ImpChainLinkProperties();
+ImpChainLinkProperties() {
+INIT_CHAIN_PROP(NilChainingEvent, false)
+INIT_CHAIN_PROP(CursorEvent, CursorChainingEvent::UNCHANGED)
+}
 
+private:
 // NOTE: Remember to set default value in contructor when adding field
-bool bNilChainingEvent;
-CursorChainingEvent aCursorEvent; // XXX: replace with enum instead of 
bool?
+DECL_CHAIN_PROP(NilChainingEvent, bool)
+DECL_CHAIN_PROP(CursorEvent, CursorChainingEvent)
+
 };
 
 
@@ -62,18 +132,18 @@ class TextChain {
 bool IsLinkInChain(SdrTextObj *) const;
 SdrTextObj *GetNextLink(SdrTextObj *) const;
 
-CursorChainingEvent GetCursorEvent(SdrTextObj *);
-void SetCursorEvent(SdrTextObj *, CursorChainingEvent);
-
 ChainLinkId GetId(SdrTextObj *) const;
 ImpChainLinkProperties *GetLinkProperties(SdrTextObj *);
 
+// Specific Link Properties
+DECL_CHAIN_PROP_INTERFACE(CursorEvent, CursorChainingEvent)
+DECL_CHAIN_PROP_INTERFACE(NilChainingEvent, bool)
+
+
+
 // return whether a paragraph is split between the two links in the 
argument
 bool GetLinksHaveMergeableFirstPara(SdrTextObj *, SdrTextObj *);
 
-bool GetNilChainingEvent(SdrTextObj *pTarget);
-void SetNilChainingEvent(SdrTextObj *, bool);
-
 protected:
 LinkPropertiesMap maLinkPropertiesMap;
 };
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index c09dfb1..04bf0df 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -505,23 +505,9 @@ IMPL_LINK_NOARG(SdrObjEditView,ImpChainingEventHdl)
 // trigger actual chaining
 pTextObj-onChainingEvent();
 
-// XXX: this logic could be put in a separate approppriate class
-

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

2015-07-08 Thread matteocam
 include/svx/textchainflow.hxx   |   16 
 svx/source/svdraw/svdedxv.cxx   |1 -
 svx/source/svdraw/textchainflow.cxx |   22 ++
 3 files changed, 26 insertions(+), 13 deletions(-)

New commits:
commit d59384c316e6a161ae86edcb8bfaa3b837ff33b8
Author: matteocam matteo.campane...@gmail.com
Date:   Wed Jul 8 11:30:31 2015 -0400

Change Cursor Info only in EditingTextChainFlow

Change-Id: Iaf21679f416607c8c59d1c88484a306727abd7cc

diff --git a/include/svx/textchainflow.hxx b/include/svx/textchainflow.hxx
index 70ff6e4..ade3404 100644
--- a/include/svx/textchainflow.hxx
+++ b/include/svx/textchainflow.hxx
@@ -20,6 +20,9 @@
 #ifndef INCLUDED_SVX_TEXTCHAINFLOW_HXX
 #define INCLUDED_SVX_TEXTCHAINFLOW_HXX
 
+
+#include svx/textchain.hxx
+
 class SdrTextObj;
 class SdrOutliner;
 class NonOverflowingText;
@@ -59,10 +62,11 @@ class TextChainFlow {
 
 //  -- Protected Members --
 protected:
+CursorChainingEvent maCursorEvent;
 
 void impCheckForFlowEvents(SdrOutliner *, SdrOutliner *);
 
-TextChain *GetTextChain();
+TextChain *GetTextChain() const;
 
 virtual void impLeaveOnlyNonOverflowingText(SdrOutliner *);
 virtual void impMoveChainedTextToNextLink(SdrOutliner *);
@@ -77,7 +81,7 @@ class TextChainFlow {
 //  -- Private Members --
 private:
 
-void impUpdateCursorEvent(SdrOutliner *, bool);
+void impUpdateCursorInfo(SdrOutliner *, bool);
 
 SdrTextObj *mpTargetLink;
 SdrTextObj *mpNextLink;
@@ -92,6 +96,7 @@ class TextChainFlow {
 OFlowChainedText *mpOverflChText;
 UFlowChainedText *mpUnderflChText;
 
+// XXX: It would be nice to get rid of this
 bool mbOFisUFinduced;
 };
 
@@ -99,19 +104,22 @@ class TextChainFlow {
 // NOTE: EditingTextChainFlow might be strongly coupled with behavior in 
SdrTextObj::onChainingEvent
 class EditingTextChainFlow : public TextChainFlow
 {
-public:
+public:
 EditingTextChainFlow(SdrTextObj *);
 virtual void CheckForFlowEvents(SdrOutliner *) SAL_OVERRIDE;
 
 //virtual void ExecuteOverflow(SdrOutliner *, SdrOutliner *) SAL_OVERRIDE;
 
-protected:
+protected:
 virtual void impLeaveOnlyNonOverflowingText(SdrOutliner *) SAL_OVERRIDE;
 
 virtual void impSetTextForEditingOutliner(OutlinerParaObject *);
 
 virtual void impSetFlowOutlinerParams(SdrOutliner *, SdrOutliner *) 
SAL_OVERRIDE;
 
+private:
+void impBroadcasCursorInfo() const;
+
 };
 
 #endif // INCLUDED_SVX_TEXTCHAINFLOW_HXX
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 3b5f021..2b165c7 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -544,7 +544,6 @@ void SdrObjEditView::ImpMoveCursorAfterChainingEvent()
 case CursorChainingEvent::TO_NEXT_LINK:
 SdrEndTextEdit();
 SdrBeginTextEdit(pNextLink);
-
 //SdrEndTextEdit(true);
 //SdrBeginTextEdit(pNextLink, nullptr, nullptr, false, 
nullptr, nullptr, true, true);
 break;
diff --git a/svx/source/svdraw/textchainflow.cxx 
b/svx/source/svdraw/textchainflow.cxx
index 4b80ea4..2700bf3 100644
--- a/svx/source/svdraw/textchainflow.cxx
+++ b/svx/source/svdraw/textchainflow.cxx
@@ -18,7 +18,6 @@
  */
 
 
-#include svx/textchain.hxx
 #include svx/svdotext.hxx
 #include svx/svdoutl.hxx
 #include editeng/outlobj.hxx
@@ -38,6 +37,8 @@ TextChainFlow::TextChainFlow(SdrTextObj *pChainTarget)
 
 mpOverflChText = NULL;
 mpUnderflChText = NULL;
+
+maCursorEvent = CursorChainingEvent::UNCHANGED;
 }
 
 
@@ -78,7 +79,7 @@ void TextChainFlow::impCheckForFlowEvents(SdrOutliner 
*pFlowOutl, SdrOutliner *p
 bOverflow = bIsPageOverflow  mpNextLink;
 bUnderflow = !bIsPageOverflow   mpNextLink  mpNextLink-HasText();
 
-impUpdateCursorEvent(pFlowOutl, bOverflow);
+impUpdateCursorInfo(pFlowOutl, bOverflow);
 
 if (pParamOutl != NULL)
 {
@@ -96,7 +97,7 @@ void TextChainFlow::impCheckForFlowEvents(SdrOutliner 
*pFlowOutl, SdrOutliner *p
 
 }
 
-void TextChainFlow::impUpdateCursorEvent(SdrOutliner *, bool bIsOverflow)
+void TextChainFlow::impUpdateCursorInfo(SdrOutliner *, bool bIsOverflow)
 {
 // XXX: Current implementation might create problems with UF-
 //  In fact UF causes a
@@ -105,12 +106,10 @@ void TextChainFlow::impUpdateCursorEvent(SdrOutliner *, 
bool bIsOverflow)
 if (bIsOverflow  !mbOFisUFinduced) {
 bool bCursorOut = true; // XXX: Should have real check
 if (bCursorOut) {
-GetTextChain()-SetCursorEvent(GetLinkTarget(),
- CursorChainingEvent::TO_NEXT_LINK);
+maCursorEvent = CursorChainingEvent::TO_NEXT_LINK;
 }
 } else {
-GetTextChain()-SetCursorEvent(GetLinkTarget(),
- CursorChainingEvent::UNCHANGED);
+maCursorEvent = CursorChainingEvent::UNCHANGED;
 }
 }
 
@@ -210,7 +209,7 @@ 

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

2015-07-08 Thread matteocam
 include/svx/textchain.hxx |5 +++--
 svx/source/svdraw/svdedxv.cxx |2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

New commits:
commit bfc9fc2eaa7d27bcadc99aa1ea277a83abc69ef9
Author: matteocam matteo.campane...@gmail.com
Date:   Wed Jul 8 11:46:22 2015 -0400

Add and handle CursorChainEvent::NULL_EVENT

Change-Id: I051b2487593271a5b689ba586a6cc1619e77b4a6

diff --git a/include/svx/textchain.hxx b/include/svx/textchain.hxx
index 77e3b32..7920a72 100644
--- a/include/svx/textchain.hxx
+++ b/include/svx/textchain.hxx
@@ -84,7 +84,8 @@ enum class CursorChainingEvent
 {
 TO_NEXT_LINK,
 TO_PREV_LINK,
-UNCHANGED
+UNCHANGED,
+NULL_EVENT
 };
 
 /*
@@ -113,7 +114,7 @@ class ImpChainLinkProperties
 
 ImpChainLinkProperties() {
 INIT_CHAIN_PROP(NilChainingEvent, false)
-INIT_CHAIN_PROP(CursorEvent, CursorChainingEvent::UNCHANGED)
+INIT_CHAIN_PROP(CursorEvent, CursorChainingEvent::NULL_EVENT)
 INIT_CHAIN_PROP(PreChainingSel, ESelection(0,0,0,0));
 }
 
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 2b165c7..d893dab 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -553,7 +553,7 @@ void SdrObjEditView::ImpMoveCursorAfterChainingEvent()
 }
 
 // Reset event
-pTextChain-SetCursorEvent(pTextObj, CursorChainingEvent::UNCHANGED);
+pTextChain-SetCursorEvent(pTextObj, CursorChainingEvent::NULL_EVENT);
 
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-07-07 Thread matteocam
 include/svx/textchainflow.hxx   |2 +-
 svx/source/svdraw/textchainflow.cxx |   19 ---
 2 files changed, 13 insertions(+), 8 deletions(-)

New commits:
commit 0b4dfe7c504b67f6aabf168bd7c2f21345de6d13
Author: matteocam matteo.campane...@gmail.com
Date:   Tue Jul 7 22:55:58 2015 -0400

Don't change cursor if UF-induced OF occurs

Change-Id: Ibf3fdee16ca40aed8cde52cc55181fc103b6c81e

diff --git a/include/svx/textchainflow.hxx b/include/svx/textchainflow.hxx
index aa17f1e..70ff6e4 100644
--- a/include/svx/textchainflow.hxx
+++ b/include/svx/textchainflow.hxx
@@ -92,7 +92,7 @@ class TextChainFlow {
 OFlowChainedText *mpOverflChText;
 UFlowChainedText *mpUnderflChText;
 
-
+bool mbOFisUFinduced;
 };
 
 
diff --git a/svx/source/svdraw/textchainflow.cxx 
b/svx/source/svdraw/textchainflow.cxx
index 74f15a1..2647afa 100644
--- a/svx/source/svdraw/textchainflow.cxx
+++ b/svx/source/svdraw/textchainflow.cxx
@@ -34,6 +34,8 @@ TextChainFlow::TextChainFlow(SdrTextObj *pChainTarget)
 
 bUnderflow = bOverflow = false;
 
+mbOFisUFinduced = false;
+
 mpOverflChText = NULL;
 mpUnderflChText = NULL;
 
@@ -73,32 +75,35 @@ void TextChainFlow::impCheckForFlowEvents(SdrOutliner 
*pFlowOutl, SdrOutliner *p
 
 bool bIsPageOverflow = pFlowOutl-IsPageOverflow();
 
-impUpdateCursorEvent(pFlowOutl, bIsPageOverflow);
+// NOTE: overflow and underflow cannot be both true
+bOverflow = bIsPageOverflow  mpNextLink;
+bUnderflow = !bIsPageOverflow   mpNextLink  mpNextLink-HasText();
+
+impUpdateCursorEvent(pFlowOutl, bOverflow);
 
 if (pParamOutl != NULL)
 {
 pFlowOutl-SetUpdateMode(bOldUpdateMode); // XXX: Plausibly should be 
the prev. state
 }
 
-// NOTE: overflow and underflow cannot be both true
-bOverflow = bIsPageOverflow  mpNextLink;
-bUnderflow = !bIsPageOverflow   mpNextLink  mpNextLink-HasText();
-
 // Set (Non)OverflowingTxt here (if any)
 mpOverflChText = bOverflow ? new OFlowChainedText(pFlowOutl) : NULL;
 
 // Set current underflowing text (if any)
 mpUnderflChText = bUnderflow ? new UFlowChainedText(pFlowOutl) : NULL;
 
+// To check whether an overflow is underflow induced or not (useful in 
cursor checking)
+mbOFisUFinduced = bUnderflow;
+
 }
 
-void TextChainFlow::impUpdateCursorEvent(SdrOutliner *pFlowOutl, bool 
bIsOverflow)
+void TextChainFlow::impUpdateCursorEvent(SdrOutliner *, bool bIsOverflow)
 {
 // XXX: Current implementation might create problems with UF-
 //  In fact UF causes a
 
 
-if (bIsOverflow) {
+if (bIsOverflow  !mbOFisUFinduced) {
 bool bCursorOut = true; // XXX: Should have real check
 if (bCursorOut) {
 GetTextChain()-SetCursorEvent(GetLinkTarget(),
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-07-06 Thread matteocam
 include/svx/textchainflow.hxx   |3 +++
 svx/source/svdraw/textchainflow.cxx |   20 
 2 files changed, 23 insertions(+)

New commits:
commit bbe782455d41af44bb42f39b7f0a2ffc73af1fb5
Author: matteocam matteo.campane...@gmail.com
Date:   Mon Jul 6 16:35:38 2015 -0400

Update cursor event

Change-Id: Iad5429e73e8a5fdf3ffd6c88759cbcaf772a5a31

diff --git a/include/svx/textchainflow.hxx b/include/svx/textchainflow.hxx
index 5489bb1..aa17f1e 100644
--- a/include/svx/textchainflow.hxx
+++ b/include/svx/textchainflow.hxx
@@ -76,6 +76,9 @@ class TextChainFlow {
 
 //  -- Private Members --
 private:
+
+void impUpdateCursorEvent(SdrOutliner *, bool);
+
 SdrTextObj *mpTargetLink;
 SdrTextObj *mpNextLink;
 
diff --git a/svx/source/svdraw/textchainflow.cxx 
b/svx/source/svdraw/textchainflow.cxx
index 1e63cc7..74f15a1 100644
--- a/svx/source/svdraw/textchainflow.cxx
+++ b/svx/source/svdraw/textchainflow.cxx
@@ -73,6 +73,8 @@ void TextChainFlow::impCheckForFlowEvents(SdrOutliner 
*pFlowOutl, SdrOutliner *p
 
 bool bIsPageOverflow = pFlowOutl-IsPageOverflow();
 
+impUpdateCursorEvent(pFlowOutl, bIsPageOverflow);
+
 if (pParamOutl != NULL)
 {
 pFlowOutl-SetUpdateMode(bOldUpdateMode); // XXX: Plausibly should be 
the prev. state
@@ -90,6 +92,24 @@ void TextChainFlow::impCheckForFlowEvents(SdrOutliner 
*pFlowOutl, SdrOutliner *p
 
 }
 
+void TextChainFlow::impUpdateCursorEvent(SdrOutliner *pFlowOutl, bool 
bIsOverflow)
+{
+// XXX: Current implementation might create problems with UF-
+//  In fact UF causes a
+
+
+if (bIsOverflow) {
+bool bCursorOut = true; // XXX: Should have real check
+if (bCursorOut) {
+GetTextChain()-SetCursorEvent(GetLinkTarget(),
+ CursorChainingEvent::TO_NEXT_LINK);
+}
+} else {
+GetTextChain()-SetCursorEvent(GetLinkTarget(),
+ CursorChainingEvent::UNCHANGED);
+}
+}
+
 void TextChainFlow::CheckForFlowEvents(SdrOutliner *pFlowOutl)
 {
 impCheckForFlowEvents(pFlowOutl, NULL);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-07-06 Thread matteocam
 include/svx/svdedxv.hxx |2 +-
 include/svx/textchain.hxx   |   11 +++
 svx/source/svdraw/svdedxv.cxx   |   31 +++
 svx/source/svdraw/textchain.cxx |   13 +
 4 files changed, 44 insertions(+), 13 deletions(-)

New commits:
commit 5d5b0c29b59557ace847ffd34a1aa15220c806cd
Author: matteocam matteo.campane...@gmail.com
Date:   Mon Jul 6 15:57:03 2015 -0400

Adds CursorChainEvent and related code in SdrObjEditView

Change-Id: Ife00e7cd5c67ec127961ef7c89f8cf6b3a87f5a5

diff --git a/include/svx/svdedxv.hxx b/include/svx/svdedxv.hxx
index 67945b58b..010032e 100644
--- a/include/svx/svdedxv.hxx
+++ b/include/svx/svdedxv.hxx
@@ -125,7 +125,7 @@ protected:
 void ImpMacroUp(const Point rUpPos);
 void ImpMacroDown(const Point rDownPos);
 
-   DECL_LINK( BeginPasteOrDropHdl, PasteOrDropInfos* );
+DECL_LINK( BeginPasteOrDropHdl, PasteOrDropInfos* );
 DECL_LINK( EndPasteOrDropHdl, PasteOrDropInfos* );
 
 protected:
diff --git a/include/svx/textchain.hxx b/include/svx/textchain.hxx
index 8032747..730489b 100644
--- a/include/svx/textchain.hxx
+++ b/include/svx/textchain.hxx
@@ -32,6 +32,12 @@ namespace rtl {
 typedef rtl::OUString ChainLinkId;
 typedef std::map ChainLinkId, ImpChainLinkProperties * LinkPropertiesMap;
 
+enum class CursorChainingEvent
+{
+TO_NEXT_LINK,
+TO_PREV_LINK,
+UNCHANGED
+};
 
 class ImpChainLinkProperties
 {
@@ -40,7 +46,9 @@ class ImpChainLinkProperties
 
 ImpChainLinkProperties();
 
+// NOTE: Remember to set default value in contructor when adding field
 bool bNilChainingEvent;
+CursorChainingEvent aCursorEvent; // XXX: replace with enum instead of 
bool?
 };
 
 
@@ -54,6 +62,9 @@ class TextChain {
 bool IsLinkInChain(SdrTextObj *) const;
 SdrTextObj *GetNextLink(SdrTextObj *) const;
 
+CursorChainingEvent GetCursorEvent(SdrTextObj *);
+void SetCursorEvent(SdrTextObj *, CursorChainingEvent);
+
 ChainLinkId GetId(SdrTextObj *) const;
 ImpChainLinkProperties *GetLinkProperties(SdrTextObj *);
 
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 74a14e1..bc5bfb0 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -51,6 +51,7 @@
 #include svx/svdstr.hrc
 #include svdglob.hxx
 #include svx/globl3d.hxx
+#include svx/textchain.hxx
 #include editeng/outliner.hxx
 #include editeng/adjustitem.hxx
 #include svtools/colorcfg.hxx
@@ -495,8 +496,24 @@ IMPL_LINK_NOARG(SdrObjEditView,ImpChainingEventHdl)
 // trigger actual chaining
 pTextObj-onChainingEvent();
 
+// XXX: this logic could be put in a separate approppriate class
 /* Cursor motion stuff */
+CursorChainingEvent aCursorEvent = 
pTextObj-GetTextChain()-GetCursorEvent(pTextObj);
+SdrTextObj *pNextLink = pTextObj-GetNextLinkInChain();
 
+switch (aCursorEvent) {
+
+case CursorChainingEvent::UNCHANGED:
+pOLV-SetSelection(aPreChainingSel);
+break;
+case CursorChainingEvent::TO_NEXT_LINK:
+SdrEndTextEdit();
+SdrBeginTextEdit(pNextLink);
+break;
+case CursorChainingEvent::TO_PREV_LINK:
+// XXX: To be handled
+break;
+}
 
 // Find last Para
 /*
@@ -508,8 +525,6 @@ IMPL_LINK_NOARG(SdrObjEditView,ImpChainingEventHdl)
 ESelection 
aEndSel(nLastParaIndex,nLenLastPara,nLastParaIndex,nLenLastPara);
 */
 
-pOLV-SetSelection(aPreChainingSel);
-
 } else {
 // XXX
 fprintf(stderr, [OnChaining] No Edit Outliner View\n);
@@ -758,7 +773,8 @@ bool SdrObjEditView::SdrBeginTextEdit(
 
 pTextEditOutlinerView-ShowCursor();
 
pTextEditOutliner-SetStatusEventHdl(LINK(this,SdrObjEditView,ImpOutlinerStatusEventHdl));
-
pTextEditOutliner-SetChainingEventHdl(LINK(this,SdrObjEditView,ImpChainingEventHdl)
 );
+if (pTextObj-IsChainable())
+
pTextEditOutliner-SetChainingEventHdl(LINK(this,SdrObjEditView,ImpChainingEventHdl)
 );
 
 #ifdef DBG_UTIL
 if (pItemBrowser!=nullptr) pItemBrowser-SetDirty();
@@ -808,15 +824,6 @@ bool SdrObjEditView::SdrBeginTextEdit(
 }
 }
 
-// FIXME(matteocam)
-// XXX: Trying to get to the next text obj directly
-if (pTextObj-IsChainable()) {
-SdrTextObj *pNextLink = pTextObj-GetNextLinkInChain();
-SdrEndTextEdit();
-SdrBeginTextEdit(pNextLink);
-}
-
-
 return true; // ran fine, let TextEdit run now
 }
 else
diff --git a/svx/source/svdraw/textchain.cxx b/svx/source/svdraw/textchain.cxx
index 09911f4..37bca69 100644
--- a/svx/source/svdraw/textchain.cxx
+++ 

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

2015-06-30 Thread matteocam
 include/svx/textchainflow.hxx   |   30 +---
 svx/source/svdraw/svdotext.cxx  |1 
 svx/source/svdraw/textchainflow.cxx |  133 ++--
 3 files changed, 44 insertions(+), 120 deletions(-)

New commits:
commit ffc855ced5099d07fa71230448ef376fe4ba33e3
Author: matteocam matteo.campane...@gmail.com
Date:   Tue Jun 30 11:13:09 2015 -0400

Use OFlowChainedText in TextChainFlow

Change-Id: I2aaa472590ba90880c545ca767069860623b8089

diff --git a/include/svx/textchainflow.hxx b/include/svx/textchainflow.hxx
index 776dc22..3215194 100644
--- a/include/svx/textchainflow.hxx
+++ b/include/svx/textchainflow.hxx
@@ -26,12 +26,13 @@ class NonOverflowingText;
 class OverflowingText;
 class TextChain;
 class OutlinerParaObject;
+class OFlowChainedText;
 
-// XXX: Specialize class for Editing mode and non editing mode?
 // XXX: const qualifiers?
 
 class TextChainFlow {
 
+//  -- Public Members --
 public:
 TextChainFlow(SdrTextObj *pChainTarget);
 virtual ~TextChainFlow();
@@ -39,16 +40,22 @@ class TextChainFlow {
 // Check for flow events in Outliner
 virtual void CheckForFlowEvents(SdrOutliner *);
 
-bool IsOverflow();
-bool IsUnderflow();
-
 void ExecuteUnderflow(SdrOutliner *);
 
 // Uses two outliners: one for the non-overfl text and one for overflowing 
(might be the same)
 virtual void ExecuteOverflow(SdrOutliner *, SdrOutliner *);
 
-SdrTextObj *GetLinkTarget();
+// Getters
+
+bool IsOverflow() const;
+bool IsUnderflow() const;
+
+SdrTextObj *GetLinkTarget() const;
+SdrTextObj *GetNextLink() const;
+
+OFlowChainedText *GetOverflowChainedText() const;
 
+//  -- Protected Members --
 protected:
 
 void impCheckForFlowEvents(SdrOutliner *, SdrOutliner *);
@@ -62,11 +69,11 @@ class TextChainFlow {
 
 OutlinerParaObject *impGetNonOverflowingParaObject(SdrOutliner *pOutliner);
 OutlinerParaObject *impGetOverflowingParaObject(SdrOutliner *pOutliner);
+// impGetMergedUnderflowingParaObject merges underflowing text with the 
one in the next box
+OutlinerParaObject *impGetMergedUnderflowingParaObject(SdrOutliner 
*pOutliner);
 
+//  -- Private Members --
 private:
-
-void impSetOutlinerToEmptyTxt(SdrOutliner *pOutliner);
-
 SdrTextObj *mpTargetLink;
 SdrTextObj *mpNextLink;
 
@@ -77,8 +84,10 @@ class TextChainFlow {
 bool bUnderflow;
 bool bOverflow;
 
-OverflowingText *mpOverflowingTxt;
-NonOverflowingText *mpNonOverflowingTxt;
+OFlowChainedText *mpOverflChText;
+
+//OverflowingText *mpOverflowingTxt;
+//NonOverflowingText *mpNonOverflowingTxt;
 
 OutlinerParaObject *mpUnderflowingPObj;
 
@@ -93,7 +102,6 @@ class EditingTextChainFlow : public TextChainFlow
 
 //virtual void ExecuteOverflow(SdrOutliner *, SdrOutliner *) SAL_OVERRIDE;
 
-
 protected:
 virtual void impLeaveOnlyNonOverflowingText(SdrOutliner *) SAL_OVERRIDE;
 
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index d0443fa..fbb76d0 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -50,7 +50,6 @@
 #include svx/textchainflow.hxx
 #include svl/style.hxx
 #include editeng/editeng.hxx
-#include editeng/overflowingtxt.hxx
 #include svl/itemiter.hxx
 #include svx/sdr/properties/textproperties.hxx
 #include vcl/metaact.hxx
diff --git a/svx/source/svdraw/textchainflow.cxx 
b/svx/source/svdraw/textchainflow.cxx
index 1261175..0e4be0b 100644
--- a/svx/source/svdraw/textchainflow.cxx
+++ b/svx/source/svdraw/textchainflow.cxx
@@ -34,8 +34,9 @@ TextChainFlow::TextChainFlow(SdrTextObj *pChainTarget)
 
 bUnderflow = bOverflow = false;
 
-mpOverflowingTxt = NULL;
-mpNonOverflowingTxt = NULL;
+mpOverflChText = NULL;
+//mpOverflowingTxt = NULL;
+//mpNonOverflowingTxt = NULL;
 
 mpUnderflowingPObj = NULL;
 
@@ -86,9 +87,10 @@ void TextChainFlow::impCheckForFlowEvents(SdrOutliner 
*pFlowOutl, SdrOutliner *p
 bUnderflow = !bIsPageOverflow   mpNextLink  mpNextLink-HasText();
 
 // Set (Non)OverflowingTxt here
+mpOverflChText = bOverflow ? new OFlowChainedText(pFlowOutl, 
mpNextLink-GetOutlinerParaObject()) : NULL;
 
-mpOverflowingTxt = bOverflow ? pFlowOutl-GetOverflowingText() : NULL;
-mpNonOverflowingTxt = bOverflow ? pFlowOutl-GetNonOverflowingText() : 
NULL;
+//mpOverflowingTxt = bOverflow ? pFlowOutl-GetOverflowingText() : NULL;
+//mpNonOverflowingTxt = bOverflow ? pFlowOutl-GetNonOverflowingText() : 
NULL;
 
 // Set current underflowing text (if any)
 mpUnderflowingPObj = bUnderflow ? pFlowOutl-CreateParaObject() : NULL;
@@ -101,12 +103,12 @@ void TextChainFlow::CheckForFlowEvents(SdrOutliner 
*pFlowOutl)
 }
 
 
-bool TextChainFlow::IsOverflow()
+bool TextChainFlow::IsOverflow() const
 {
 return bOverflow;
 }
 
-bool TextChainFlow::IsUnderflow()
+bool TextChainFlow::IsUnderflow() const
 {
 return bUnderflow;
 }
@@ -178,118 +180,24 

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

2015-06-30 Thread matteocam
 include/svx/textchainflow.hxx   |1 +
 svx/source/svdraw/svdotext.cxx  |8 ++--
 svx/source/svdraw/textchainflow.cxx |6 +-
 3 files changed, 8 insertions(+), 7 deletions(-)

New commits:
commit 878920775d8a436c16e0553b20783b70b278231c
Author: matteocam matteo.campane...@gmail.com
Date:   Tue Jun 30 12:04:48 2015 -0400

Prevent recursive underflow/overflow calls (for the same object)

Change-Id: I76705d41da739e327be0c9a67245da055b77

diff --git a/include/svx/textchainflow.hxx b/include/svx/textchainflow.hxx
index 3215194..ce6d728 100644
--- a/include/svx/textchainflow.hxx
+++ b/include/svx/textchainflow.hxx
@@ -94,6 +94,7 @@ class TextChainFlow {
 };
 
 
+// NOTE: EditingTextChainFlow might be strongly coupled with behavior in 
SdrTextObj::onChainingEvent
 class EditingTextChainFlow : public TextChainFlow
 {
 public:
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index fbb76d0..948428c 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1975,7 +1975,7 @@ void SdrTextObj::onChainingEvent()
 
 // This is true during an underflow-caused overflow (with 
pEdtOutl-SetText())
 if (GetTextChain()-GetNilChainingEvent(this)) {
-GetTextChain()-SetNilChainingEvent(this, false);
+
 return;
 }
 
@@ -1985,6 +1985,8 @@ void SdrTextObj::onChainingEvent()
 EditingTextChainFlow aTxtChainFlow(this);
 aTxtChainFlow.CheckForFlowEvents(pEdtOutl);
 
+// We prevent to trigger further handling of overflow/underflow for this 
SdrTextObj
+GetTextChain()-SetNilChainingEvent(this, true);
 
 if (aTxtChainFlow.IsOverflow()) {
 fprintf(stderr, [CHAINING] Overflow going on\n);
@@ -2000,11 +2002,13 @@ void SdrTextObj::onChainingEvent()
 if (bIsOverflowFromUnderflow) {
 fprintf(stderr, [CHAINING] Overflow going on (underflow 
induced)\n);
 // prevents infinite loops when setting text for editing outliner
-GetTextChain()-SetNilChainingEvent(const_castSdrTextObj*(this), 
true);
+
 
 aTxtChainFlow.ExecuteOverflow(aDrawOutliner, aDrawOutliner);
+
 }
 }
+GetTextChain()-SetNilChainingEvent(this, false);
 }
 
 
diff --git a/svx/source/svdraw/textchainflow.cxx 
b/svx/source/svdraw/textchainflow.cxx
index b3dcd80..93bb2f1 100644
--- a/svx/source/svdraw/textchainflow.cxx
+++ b/svx/source/svdraw/textchainflow.cxx
@@ -122,9 +122,7 @@ void TextChainFlow::ExecuteUnderflow(SdrOutliner *pOutl)
 OutlinerParaObject *pNextLinkWholeText = 
mpNextLink-GetOutlinerParaObject();
 
 // making whole text
-OutlinerParaObject *pCurText;   // XXX: at next line we have editing 
outliner in editing version
-//pCurText = pOutl-CreateParaObject();
-
+OutlinerParaObject *pCurText;
 // We saved this text already
 pCurText = mpUnderflowingPObj;
 
@@ -183,8 +181,6 @@ OutlinerParaObject 
*TextChainFlow::impGetNonOverflowingParaObject(SdrOutliner *p
 return mpOverflChText-CreateNonOverflowingParaObject(pOutliner);
 }
 
-
-
 SdrTextObj *TextChainFlow::GetLinkTarget() const
 {
 return mpTargetLink;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-06-29 Thread matteocam
 include/svx/textchainflow.hxx   |   15 ++---
 svx/source/svdraw/textchainflow.cxx |   40 ++--
 2 files changed, 46 insertions(+), 9 deletions(-)

New commits:
commit f175965e22c57565ee2ffd2105b4c26a817835ca
Author: matteocam matteo.campane...@gmail.com
Date:   Mon Jun 29 13:59:33 2015 -0400

Moved editing-specific code

Change-Id: I9fa410a60fb6341c5f031cc152141c03975b409e

diff --git a/include/svx/textchainflow.hxx b/include/svx/textchainflow.hxx
index 8528a9f..10ba90a 100644
--- a/include/svx/textchainflow.hxx
+++ b/include/svx/textchainflow.hxx
@@ -45,7 +45,7 @@ class TextChainFlow {
 void ExecuteUnderflow(SdrOutliner *);
 
 // Uses two outliners: one for the non-overfl text and one for overflowing 
(might be the same)
-void ExecuteOverflow(SdrOutliner *, SdrOutliner *);
+virtual void ExecuteOverflow(SdrOutliner *, SdrOutliner *);
 
 SdrTextObj *GetLinkTarget();
 
@@ -55,8 +55,8 @@ class TextChainFlow {
 
 TextChain *GetTextChain();
 
-void impLeaveOnlyNonOverflowingText(SdrOutliner *);
-void impMoveChainedTextToNextLink(SdrOutliner *);
+virtual void impLeaveOnlyNonOverflowingText(SdrOutliner *);
+virtual void impMoveChainedTextToNextLink(SdrOutliner *);
 
 OutlinerParaObject *impGetNonOverflowingParaObject(SdrOutliner *pOutliner);
 OutlinerParaObject *impGetOverflowingParaObject(SdrOutliner *pOutliner);
@@ -88,6 +88,15 @@ class EditingTextChainFlow : public TextChainFlow
 public:
 EditingTextChainFlow(SdrTextObj *);
 virtual void CheckForFlowEvents(SdrOutliner *) SAL_OVERRIDE;
+
+//virtual void ExecuteOverflow(SdrOutliner *, SdrOutliner *) SAL_OVERRIDE;
+
+
+protected:
+virtual void impLeaveOnlyNonOverflowingText(SdrOutliner *) SAL_OVERRIDE;
+
+virtual void impSetTextForEditingOutliner(OutlinerParaObject *);
+
 };
 
 #endif // INCLUDED_SVX_TEXTCHAINFLOW_HXX
diff --git a/svx/source/svdraw/textchainflow.cxx 
b/svx/source/svdraw/textchainflow.cxx
index ec5dc9a..652e803 100644
--- a/svx/source/svdraw/textchainflow.cxx
+++ b/svx/source/svdraw/textchainflow.cxx
@@ -63,7 +63,7 @@ void TextChainFlow::impCheckForFlowEvents(SdrOutliner 
*pFlowOutl, SdrOutliner *p
 if (pParamOutl != NULL)
 {
 // XXX: Set parameters
-// XXX: does this work if you do it before setting the text?
+// XXX: does this work if you do it before setting the text? Seems so.
 pFlowOutl-SetUpdateMode(true);
 pFlowOutl-SetMaxAutoPaperSize(pParamOutl-GetMaxAutoPaperSize());
 pFlowOutl-SetMinAutoPaperSize(pParamOutl-GetMinAutoPaperSize());
@@ -152,15 +152,11 @@ void TextChainFlow::ExecuteOverflow(SdrOutliner 
*pNonOverflOutl, SdrOutliner *pO
 void TextChainFlow::impLeaveOnlyNonOverflowingText(SdrOutliner *pNonOverflOutl)
 {
 OutlinerParaObject *pNewText = 
impGetNonOverflowingParaObject(pNonOverflOutl);
-
-// XXX
-if (mpTargetLink-pEdtOutl != NULL) {
-mpTargetLink-pEdtOutl-SetText(*pNewText);
-}
 // adds it to current outliner anyway (useful in static decomposition)
 pNonOverflOutl-SetText(*pNewText);
 
 mpTargetLink-NbcSetOutlinerParaObject(pNewText);
+
 }
 
 void TextChainFlow::impMoveChainedTextToNextLink(SdrOutliner *pOverflOutl)
@@ -308,4 +304,36 @@ void EditingTextChainFlow::CheckForFlowEvents(SdrOutliner 
*pFlowOutl)
 
 }
 
+/*
+void EditingTextChainFlow::ExecuteOverflow(SdrOutliner *pOutl1, SdrOutliner 
*pOutl2)
+{
+
+
+impSetTextForEditingOutliner
+
+// Set cursor
+pEditView-pImpEditView-SetEditSelection( aCurSel );
+pEditView-pImpEditView-DrawSelection();
+pEditView-ShowCursor( true, false );
+
+
+}
+*
+* */
+
+void EditingTextChainFlow::impLeaveOnlyNonOverflowingText(SdrOutliner 
*pNonOverflOutl)
+{
+OutlinerParaObject *pNewText = 
impGetNonOverflowingParaObject(pNonOverflOutl);
+impSetTextForEditingOutliner(pNewText);
+
+GetLinkTarget()-NbcSetOutlinerParaObject(pNewText);
+}
+
+void EditingTextChainFlow::impSetTextForEditingOutliner(OutlinerParaObject 
*pNewText)
+{
+if (GetLinkTarget()-pEdtOutl != NULL) {
+GetLinkTarget()-pEdtOutl-SetText(*pNewText);
+}
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-06-29 Thread matteocam
 include/svx/textchainflow.hxx   |4 
 svx/source/svdraw/textchainflow.cxx |   23 +++
 2 files changed, 23 insertions(+), 4 deletions(-)

New commits:
commit 88c71f468817eac65a17b6a56e729661b4365704
Author: matteocam matteo.campane...@gmail.com
Date:   Mon Jun 29 18:28:14 2015 -0400

Drawing outliner's item pool set to that of editing outl

Change-Id: I5ba711fda7df498e0405f351eca953db615e232b

diff --git a/include/svx/textchainflow.hxx b/include/svx/textchainflow.hxx
index 10ba90a..776dc22 100644
--- a/include/svx/textchainflow.hxx
+++ b/include/svx/textchainflow.hxx
@@ -58,6 +58,8 @@ class TextChainFlow {
 virtual void impLeaveOnlyNonOverflowingText(SdrOutliner *);
 virtual void impMoveChainedTextToNextLink(SdrOutliner *);
 
+virtual void impSetFlowOutlinerParams(SdrOutliner *, SdrOutliner *);
+
 OutlinerParaObject *impGetNonOverflowingParaObject(SdrOutliner *pOutliner);
 OutlinerParaObject *impGetOverflowingParaObject(SdrOutliner *pOutliner);
 
@@ -97,6 +99,8 @@ class EditingTextChainFlow : public TextChainFlow
 
 virtual void impSetTextForEditingOutliner(OutlinerParaObject *);
 
+virtual void impSetFlowOutlinerParams(SdrOutliner *, SdrOutliner *) 
SAL_OVERRIDE;
+
 };
 
 #endif // INCLUDED_SVX_TEXTCHAINFLOW_HXX
diff --git a/svx/source/svdraw/textchainflow.cxx 
b/svx/source/svdraw/textchainflow.cxx
index 652e803..723c7f7 100644
--- a/svx/source/svdraw/textchainflow.cxx
+++ b/svx/source/svdraw/textchainflow.cxx
@@ -50,6 +50,11 @@ TextChainFlow::~TextChainFlow()
 
 }
 
+void TextChainFlow::impSetFlowOutlinerParams(SdrOutliner *, SdrOutliner *)
+{
+// Nothing to do if not in editing mode
+}
+
 /*
  * Check for overflow in the state of pFlowOutl.
  * If pParamOutl is not NULL sets some parameters from there.
@@ -59,22 +64,21 @@ TextChainFlow::~TextChainFlow()
 */
 void TextChainFlow::impCheckForFlowEvents(SdrOutliner *pFlowOutl, SdrOutliner 
*pParamOutl)
 {
+bool bOldUpdateMode = pFlowOutl-GetUpdateMode();
 // NOTE: Nah you probably don't need this
 if (pParamOutl != NULL)
 {
 // XXX: Set parameters
 // XXX: does this work if you do it before setting the text? Seems so.
 pFlowOutl-SetUpdateMode(true);
-pFlowOutl-SetMaxAutoPaperSize(pParamOutl-GetMaxAutoPaperSize());
-pFlowOutl-SetMinAutoPaperSize(pParamOutl-GetMinAutoPaperSize());
-pFlowOutl-SetPaperSize(pParamOutl-GetPaperSize());
+   impSetFlowOutlinerParams(pFlowOutl, pParamOutl);
 }
 
 bool bIsPageOverflow = pFlowOutl-IsPageOverflow();
 
 if (pParamOutl != NULL)
 {
-pFlowOutl-SetUpdateMode(false); // XXX: Plausibly should be the prev. 
state
+pFlowOutl-SetUpdateMode(bOldUpdateMode); // XXX: Plausibly should be 
the prev. state
 }
 
 // NOTE: overflow and underflow cannot be both true
@@ -336,4 +340,15 @@ void 
EditingTextChainFlow::impSetTextForEditingOutliner(OutlinerParaObject *pNew
 }
 }
 
+void EditingTextChainFlow::impSetFlowOutlinerParams(SdrOutliner *pFlowOutl, 
SdrOutliner *pParamOutl)
+{
+// Set right size for overflow
+pFlowOutl-SetMaxAutoPaperSize(pParamOutl-GetMaxAutoPaperSize());
+pFlowOutl-SetMinAutoPaperSize(pParamOutl-GetMinAutoPaperSize());
+pFlowOutl-SetPaperSize(pParamOutl-GetPaperSize());
+
+// Set right text attributes
+pFlowOutl-SetEditTextObjectPool(pParamOutl-GetEditTextObjectPool());
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-06-29 Thread matteocam
 include/svx/svdotext.hxx|8 -
 svx/source/svdraw/svdotext.cxx  |  110 --
 svx/source/svdraw/svdotextdecomposition.cxx |  211 
 3 files changed, 6 insertions(+), 323 deletions(-)

New commits:
commit ac2de02674bd624064a4875894d4f1e18134e420
Author: matteocam matteo.campane...@gmail.com
Date:   Mon Jun 29 04:33:56 2015 -0400

Cleaned text transferring code in SdrTextObj class

Change-Id: I9dbd71749bce1643bbdbd119463dd584cb235156

diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index 6e81767..dee2912 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -326,10 +326,6 @@ protected:
 
 virtual ~SdrTextObj();
 
-virtual void onOverflowStatusEvent( );
-virtual void onUnderflowStatusEvent( );
-
-
 public:
 TYPEINFO_OVERRIDE();
 
@@ -622,10 +618,6 @@ public:
 const drawinglayer::primitive2d::SdrChainedTextPrimitive2D 
rSdrChainedTextPrimitive,
 const drawinglayer::geometry::ViewInformation2D aViewInformation) 
const;
 
-void impMoveChainedTextToNextLink(SdrOutliner *pOutliner, SdrTextObj 
*pNextTextObj) const;
-OutlinerParaObject *impGetOverflowingParaObject(SdrOutliner *pOutliner, 
SdrTextObj *pNextTextObj) const;
-void impLeaveOnlyNonOverflowingText(SdrOutliner *pOutliner) const;
-OutlinerParaObject *impGetNonOverflowingParaObject(SdrOutliner *pOutliner) 
const;
 
 // timing generators
 void impGetBlinkTextTiming(drawinglayer::animation::AnimationEntryList 
rAnimList) const;
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index b3b7332..d0443fa 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1966,82 +1966,8 @@ void SdrTextObj::onEditOutlinerStatusEvent( EditStatus* 
pEditStatus )
 }
 }
 
-void SdrTextObj::onOverflowStatusEvent( )
-{
-// Pushes text in next link on the fly
-if ( mbToBeChained ) {
-SdrOutliner aDrawOutliner = ImpGetDrawOutliner();
-
-   if (pEdtOutl != NULL)
-mpOverflowingText = pEdtOutl-GetOverflowingText();
-else {
-assert(0); // Should never happen. FIXME(matteocam)
-}
-
-SdrTextObj *pNextTextObj = GetNextLinkInChain();
-
-impLeaveOnlyNonOverflowingText(aDrawOutliner);
-
-// Transfer overflowing text
-impMoveChainedTextToNextLink(aDrawOutliner, pNextTextObj);
-}
-}
-
-void SdrTextObj::onUnderflowStatusEvent( )
-{
-SdrTextObj *pNextLink = GetNextLinkInChain();
-SdrOutliner aDrawOutliner = ImpGetDrawOutliner();
-
-if (!pNextLink-HasText())
-return;
-
-//  Get the text of the other guy and add it to the last paragraph
-// XXX: For now it's not merging anything just adding the while thing as a 
separate para
-OutlinerParaObject *pNextLinkWholeText = 
pNextLink-GetOutlinerParaObject();
-if (!pNextLinkWholeText)
-return;
-
-OutlinerParaObject *pCurText;
-
-pCurText = pEdtOutl-CreateParaObject();
-
-// NewTextForCurBox = Txt(CurBox) ++ Txt(NextBox)
-// prepare for checking overflow
-aDrawOutliner.SetUpdateMode(true);
-aDrawOutliner.SetMaxAutoPaperSize(pEdtOutl-GetMaxAutoPaperSize());
-aDrawOutliner.SetMinAutoPaperSize(pEdtOutl-GetMinAutoPaperSize());
-aDrawOutliner.SetPaperSize(pEdtOutl-GetPaperSize());
-aDrawOutliner.SetText(*pCurText);
-aDrawOutliner.AddText(*pNextLinkWholeText);
-
-bool bIsOverflowFromUnderflow = aDrawOutliner.IsPageOverflow();
-// Save mpOverflowingText (important for overflow handlers below) // XXX: 
Change the wayt this is done?
-if (bIsOverflowFromUnderflow)
-mpOverflowingText = aDrawOutliner.GetOverflowingText();
-
-OutlinerParaObject *pNewText = aDrawOutliner.CreateParaObject();
-
-// Set the other box empty so if overflow does not occur we are fine
-pNextLink-NbcSetOutlinerParaObject(aDrawOutliner.GetEmptyParaObject());
-
-// handle overflow
-if (bIsOverflowFromUnderflow) {
-// prevents infinite loops when setting text for editing outliner
-GetTextChain()-SetNilChainingEvent(const_castSdrTextObj*(this), 
true);
-
-impLeaveOnlyNonOverflowingText(aDrawOutliner);
-impMoveChainedTextToNextLink(aDrawOutliner, pNextLink);
-} else {
-// No overflow: set the whole thing
-const_castSdrTextObj*(this)-SetOutlinerParaObject(pNewText);
-}
-}
-
-
 void SdrTextObj::onChainingEvent()
 {
-
-
 if (!IsChainable() || GetNextLinkInChain() == NULL)
 return;
 
@@ -2057,56 +1983,28 @@ void SdrTextObj::onChainingEvent()
 // Outliner for text transfer
 SdrOutliner aDrawOutliner = ImpGetDrawOutliner();
 
-// XXX: Specializing the class?
-// OBS: you don't need all the setting parameters crap for underflow 
with this
 EditingTextChainFlow aTxtChainFlow(this);
 aTxtChainFlow.CheckForFlowEvents(pEdtOutl);
 
 
 if (aTxtChainFlow.IsOverflow()) {
- 

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

2015-06-29 Thread matteocam
 include/svx/textchainflow.hxx   |2 +
 svx/source/svdraw/svdotext.cxx  |   42 
 svx/source/svdraw/svdotextdecomposition.cxx |3 +-
 3 files changed, 46 insertions(+), 1 deletion(-)

New commits:
commit cb012b74d38f963f89eb1e16c6687e8f63f7bddb
Author: matteocam matteo.campane...@gmail.com
Date:   Mon Jun 29 02:19:38 2015 -0400

TextChainFlow used for OF/UF in editing mode too

Change-Id: If894d1e27240d5c7c7b37ed5cfcf2a9b468c81db

diff --git a/include/svx/textchainflow.hxx b/include/svx/textchainflow.hxx
index e581965..d76f371 100644
--- a/include/svx/textchainflow.hxx
+++ b/include/svx/textchainflow.hxx
@@ -41,6 +41,8 @@ class TextChainFlow {
 bool IsUnderflow();
 
 void ExecuteUnderflow(SdrOutliner *);
+
+// Uses two outliners: one for the non-overfl text and one for overflowing 
(might be the same)
 void ExecuteOverflow(SdrOutliner *, SdrOutliner *);
 
 protected:
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 1e8d526..8b47a40 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -2040,6 +2040,8 @@ void SdrTextObj::onUnderflowStatusEvent( )
 
 void SdrTextObj::onChainingEvent()
 {
+
+
 if (!IsChainable() || GetNextLinkInChain() == NULL)
 return;
 
@@ -2052,6 +2054,46 @@ void SdrTextObj::onChainingEvent()
 return;
 }
 
+// Outliner for text transfer
+SdrOutliner aDrawOutliner = ImpGetDrawOutliner();
+
+// XXX: Specializing the class?
+// OBS: you don't need all the setting parameters crap for underflow 
with this
+TextChainFlow aTxtChainFlow(this);
+aTxtChainFlow.CheckForFlowEvents(pEdtOutl, NULL);
+
+
+if (aTxtChainFlow.IsOverflow()) {
+fprintf(stderr, Overflow going on\n);
+
+// One outliner is for non-overflowing text, the other for overflowing 
text
+// In this case they can both be the drawing outliner
+aTxtChainFlow.ExecuteOverflow(aDrawOutliner, aDrawOutliner);
+} else if (aTxtChainFlow.IsUnderflow()) {
+fprintf(stderr, Underflow going on\n);
+// underflow-induced overflow
+aTxtChainFlow.ExecuteUnderflow(aDrawOutliner);
+bool bIsOverflowFromUnderflow = aTxtChainFlow.IsOverflow();
+
+// handle overflow
+if (bIsOverflowFromUnderflow) {
+fprintf(stderr, Overflow going on (underflow induced)\n);
+// prevents infinite loops when setting text for editing outliner
+GetTextChain()-SetNilChainingEvent(const_castSdrTextObj*(this), 
true);
+
+aTxtChainFlow.ExecuteOverflow(aDrawOutliner, aDrawOutliner);
+}
+// Probably not necessary
+//else {
+//// No overflow: set the whole thing
+//const_castSdrTextObj*(this)-SetOutlinerParaObject(pNewText);
+//}
+}
+
+return;
+
+// Begin old code
+
 bool bIsPageOverflow;
 
 bIsPageOverflow = pEdtOutl-IsPageOverflow();
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx 
b/svx/source/svdraw/svdotextdecomposition.cxx
index 2ba2012..0479632 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -1654,6 +1654,7 @@ void SdrTextObj::impDecomposeChainedTextPrimitive(
 aTxtChainFlow.ExecuteUnderflow(rOutliner);
 bIsOverflow = aTxtChainFlow.IsOverflow();
 } else {
+// standard overflow (no underlow before)
 bIsOverflow = aTxtChainFlow.IsOverflow();
 }
 
@@ -1662,7 +1663,7 @@ void SdrTextObj::impDecomposeChainedTextPrimitive(
 SdrOutliner rChainingOutl = pModel-GetChainingOutliner(this);
 ImpInitDrawOutliner( rChainingOutl );
 rChainingOutl.SetUpdateMode(true);
-
+// We must pass the chaining outliner otherwise we would mess up 
decomposition
 aTxtChainFlow.ExecuteOverflow(rOutliner, rChainingOutl);
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-06-29 Thread matteocam
 include/svx/svdotext.hxx|1 +
 include/svx/textchainflow.hxx   |   18 --
 svx/source/svdraw/svdotext.cxx  |6 +++---
 svx/source/svdraw/svdotextdecomposition.cxx |2 +-
 4 files changed, 21 insertions(+), 6 deletions(-)

New commits:
commit f1d992435c64257114a68fb4c02e4379ea745b48
Author: matteocam matteo.campane...@gmail.com
Date:   Mon Jun 29 03:55:31 2015 -0400

Using EditingTextChainFlow in editing mode

Change-Id: Id49b9ed246e40436287e557b8218761f92127e49

diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index b5dde0f..6e81767 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -139,6 +139,7 @@ private:
 
 friend classTextChain;
 friend classTextChainFlow;
+friend classEditingTextChainFlow;
 
 // CustomShapeproperties need to access the bTextFrame member:
 friend class sdr::properties::CustomShapeProperties;
diff --git a/include/svx/textchainflow.hxx b/include/svx/textchainflow.hxx
index 1ae66f2..8528a9f 100644
--- a/include/svx/textchainflow.hxx
+++ b/include/svx/textchainflow.hxx
@@ -34,9 +34,10 @@ class TextChainFlow {
 
 public:
 TextChainFlow(SdrTextObj *pChainTarget);
-~TextChainFlow();
+virtual ~TextChainFlow();
 
-void CheckForFlowEvents(SdrOutliner *, SdrOutliner *);
+// Check for flow events in Outliner
+virtual void CheckForFlowEvents(SdrOutliner *);
 
 bool IsOverflow();
 bool IsUnderflow();
@@ -46,7 +47,12 @@ class TextChainFlow {
 // Uses two outliners: one for the non-overfl text and one for overflowing 
(might be the same)
 void ExecuteOverflow(SdrOutliner *, SdrOutliner *);
 
+SdrTextObj *GetLinkTarget();
+
 protected:
+
+void impCheckForFlowEvents(SdrOutliner *, SdrOutliner *);
+
 TextChain *GetTextChain();
 
 void impLeaveOnlyNonOverflowingText(SdrOutliner *);
@@ -76,6 +82,14 @@ class TextChainFlow {
 
 };
 
+
+class EditingTextChainFlow : public TextChainFlow
+{
+public:
+EditingTextChainFlow(SdrTextObj *);
+virtual void CheckForFlowEvents(SdrOutliner *) SAL_OVERRIDE;
+};
+
 #endif // INCLUDED_SVX_TEXTCHAINFLOW_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 8b47a40..b3b7332 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -2059,8 +2059,8 @@ void SdrTextObj::onChainingEvent()
 
 // XXX: Specializing the class?
 // OBS: you don't need all the setting parameters crap for underflow 
with this
-TextChainFlow aTxtChainFlow(this);
-aTxtChainFlow.CheckForFlowEvents(pEdtOutl, NULL);
+EditingTextChainFlow aTxtChainFlow(this);
+aTxtChainFlow.CheckForFlowEvents(pEdtOutl);
 
 
 if (aTxtChainFlow.IsOverflow()) {
@@ -2082,7 +2082,7 @@ void SdrTextObj::onChainingEvent()
 GetTextChain()-SetNilChainingEvent(const_castSdrTextObj*(this), 
true);
 
 aTxtChainFlow.ExecuteOverflow(aDrawOutliner, aDrawOutliner);
-}
+} // XXX: For the code below
 // Probably not necessary
 //else {
 //// No overflow: set the whole thing
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx 
b/svx/source/svdraw/svdotextdecomposition.cxx
index 0479632..cd107d5 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -1646,7 +1646,7 @@ void SdrTextObj::impDecomposeChainedTextPrimitive(
 TextChainFlow aTxtChainFlow(const_castSdrTextObj*(this));
 bool bIsOverflow;
 
-aTxtChainFlow.CheckForFlowEvents(rOutliner, NULL); // seconod parameter 
is to check whether you have to prepare the outliner's parameters
+aTxtChainFlow.CheckForFlowEvents(rOutliner);
 
 if (aTxtChainFlow.IsUnderflow()  !IsInEditMode())
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-06-25 Thread matteocam
 include/svx/svdotext.hxx   |2 +
 include/svx/textchainflow.hxx  |   44 +
 svx/source/svdraw/svdotext.cxx |1 
 3 files changed, 47 insertions(+)

New commits:
commit 61a2e01298b89f1a53a2ed7d553145dcf19b3623
Author: matteocam matteo.campane...@gmail.com
Date:   Thu Jun 25 15:33:29 2015 -0400

Added header for TextChainFlow

Change-Id: I64371ecb081025f81e9066c3183b58875803db56

diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index e66dff0..b5dde0f 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -45,6 +45,7 @@ class SvxFieldItem;
 class ImpSdrObjTextLink;
 class EditStatus;
 class TextChain;
+class TextChainFlow;
 
 namespace sdr { namespace properties {
 class TextProperties;
@@ -137,6 +138,7 @@ private:
 friend classsdr::table::SdrTableRTFParser;
 
 friend classTextChain;
+friend classTextChainFlow;
 
 // CustomShapeproperties need to access the bTextFrame member:
 friend class sdr::properties::CustomShapeProperties;
diff --git a/include/svx/textchainflow.hxx b/include/svx/textchainflow.hxx
new file mode 100644
index 000..5b4b7b5
--- /dev/null
+++ b/include/svx/textchainflow.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the License); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_TEXTCHAINFLOW_HXX
+#define INCLUDED_SVX_TEXTCHAINFLOW_HXX
+
+#include map
+
+
+class SdrTextObj;
+
+namespace rtl {
+class OUString;
+}
+
+class TextChainFlow {
+
+public:
+TextChainFlow() {}
+~TextChainFlow() {}
+
+protected:
+};
+
+#endif // INCLUDED_SVX_TEXTCHAINFLOW_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index cfe7cbd..1e8d526 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -47,6 +47,7 @@
 #include svx/svdpool.hxx
 #include svx/xflclit.hxx
 #include svx/textchain.hxx
+#include svx/textchainflow.hxx
 #include svl/style.hxx
 #include editeng/editeng.hxx
 #include editeng/overflowingtxt.hxx
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-06-25 Thread matteocam
 include/svx/textchainflow.hxx   |   49 +++-
 svx/source/svdraw/svdotextdecomposition.cxx |   44 +
 2 files changed, 79 insertions(+), 14 deletions(-)

New commits:
commit d694690fd619c7be735551378f753cf6b84bb55f
Author: matteocam matteo.campane...@gmail.com
Date:   Thu Jun 25 18:14:28 2015 -0400

Written mechanisms for static OF/UF in proper classes

Change-Id: Ica4b774670ae2bf25b5f6ee66f55c120e3e6b005

diff --git a/include/svx/textchainflow.hxx b/include/svx/textchainflow.hxx
index 5b4b7b5..e581965 100644
--- a/include/svx/textchainflow.hxx
+++ b/include/svx/textchainflow.hxx
@@ -20,22 +20,55 @@
 #ifndef INCLUDED_SVX_TEXTCHAINFLOW_HXX
 #define INCLUDED_SVX_TEXTCHAINFLOW_HXX
 
-#include map
-
-
 class SdrTextObj;
+class SdrOutliner;
+class NonOverflowingText;
+class OverflowingText;
+class TextChain;
 
-namespace rtl {
-class OUString;
-}
+// XXX: Specialize class for Editing mode and non editing mode?
+// XXX: const qualifiers?
 
 class TextChainFlow {
 
 public:
-TextChainFlow() {}
-~TextChainFlow() {}
+TextChainFlow(SdrTextObj *pChainTarget);
+~TextChainFlow();
+
+void CheckForFlowEvents(SdrOutliner *, SdrOutliner *);
+
+bool IsOverflow();
+bool IsUnderflow();
+
+void ExecuteUnderflow(SdrOutliner *);
+void ExecuteOverflow(SdrOutliner *, SdrOutliner *);
 
 protected:
+TextChain *GetTextChain();
+
+void impLeaveOnlyNonOverflowingText(SdrOutliner *);
+void impMoveChainedTextToNextLink(SdrOutliner *);
+
+OutlinerParaObject *impGetNonOverflowingParaObject(SdrOutliner *pOutliner);
+OutlinerParaObject *impGetOverflowingParaObject(SdrOutliner *pOutliner);
+
+private:
+
+void impSetOutlinerToEmptyTxt(SdrOutliner *pOutliner);
+
+SdrTextObj *mpTargetLink;
+SdrTextObj *mpNextLink;
+
+TextChain *mpTextChain;
+
+bool bCheckedFlowEvents;
+
+bool bUnderflow;
+bool bOverflow;
+
+OverflowingText *mpOverflowingTxt;
+NonOverflowingText *mpNonOverflowingTxt;
+
 };
 
 #endif // INCLUDED_SVX_TEXTCHAINFLOW_HXX
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx 
b/svx/source/svdraw/svdotextdecomposition.cxx
index 70c4f2c..2ba2012 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -24,6 +24,7 @@
 #include svx/svdotext.hxx
 #include svx/svdmodel.hxx
 #include svx/textchain.hxx
+#include svx/textchainflow.hxx
 #include basegfx/vector/b2dvector.hxx
 #include sdr/primitive2d/sdrtextprimitive2d.hxx
 #include drawinglayer/primitive2d/textprimitive2d.hxx
@@ -861,7 +862,7 @@ OutlinerParaObject 
*SdrTextObj::impGetOverflowingParaObject(SdrOutliner *pOutlin
 // Draw everything
 OutlinerParaObject *pNewText = pOutliner-CreateParaObject();
 return pNewText;
- }
+}
 
 void SdrTextObj::impMoveChainedTextToNextLink(SdrOutliner *pOutliner, 
SdrTextObj *pNextTextObj) const
 {
@@ -1638,6 +1639,36 @@ void SdrTextObj::impDecomposeChainedTextPrimitive(
 
 /* Begin underflow handling */
 
+ // any parameter in the constructor?
+ // We need the outliner we get the overflow info from as well as
+ //  the outliner for drawing (e.g. a drawing or chaining outliner)
+ // maybe the latter ones can be passed at the time of overflow and such
+TextChainFlow aTxtChainFlow(const_castSdrTextObj*(this));
+bool bIsOverflow;
+
+aTxtChainFlow.CheckForFlowEvents(rOutliner, NULL); // seconod parameter 
is to check whether you have to prepare the outliner's parameters
+
+if (aTxtChainFlow.IsUnderflow()  !IsInEditMode())
+{
+// underflow-induced overflow
+aTxtChainFlow.ExecuteUnderflow(rOutliner);
+bIsOverflow = aTxtChainFlow.IsOverflow();
+} else {
+bIsOverflow = aTxtChainFlow.IsOverflow();
+}
+
+if (bIsOverflow  !IsInEditMode()) {
+// Initialize Chaining Outliner
+SdrOutliner rChainingOutl = pModel-GetChainingOutliner(this);
+ImpInitDrawOutliner( rChainingOutl );
+rChainingOutl.SetUpdateMode(true);
+
+aTxtChainFlow.ExecuteOverflow(rOutliner, rChainingOutl);
+}
+
+/*
+
+// Begin old code
 bool bIsPageUnderflow = !rOutliner.IsPageOverflow()  !IsInEditMode();
 if (bIsPageUnderflow) {
 
@@ -1646,7 +1677,6 @@ void SdrTextObj::impDecomposeChainedTextPrimitive(
 OutlinerParaObject *pNextLinkWholeText = 
pNextLink-GetOutlinerParaObject();
 
 // making whole text
-
 OutlinerParaObject *pCurText;
 pCurText = rOutliner.CreateParaObject(); // XXX: this is editing 
outliner in editing version
 
@@ -1662,19 +1692,19 @@ void SdrTextObj::impDecomposeChainedTextPrimitive(
 const_castSdrTextObj*(this)-NbcSetOutlinerParaObject(pNewText);
 }
 } // You might be done at this point, unless there is an overflow and 
that's handled in std way.
-
+*/
 /* End underflow handling */
 
 
 /* Begin overflow handling */ // 

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

2015-06-23 Thread matteocam
 include/svx/textchain.hxx   |4 --
 svx/source/svdraw/svdotext.cxx  |   54 +---
 svx/source/svdraw/textchain.cxx |   13 -
 3 files changed, 2 insertions(+), 69 deletions(-)

New commits:
commit 374be8c82ea75bb5908ed44d0e358deab433341e
Author: matteocam matteo.campane...@gmail.com
Date:   Tue Jun 23 19:07:07 2015 -0400

Removed references to HandlingOveflow property

Change-Id: Icef338d4e3d286ef4b2a0640ede1984cbf71e699

diff --git a/include/svx/textchain.hxx b/include/svx/textchain.hxx
index 9290f22..56b0af8 100644
--- a/include/svx/textchain.hxx
+++ b/include/svx/textchain.hxx
@@ -41,7 +41,6 @@ class ImpChainLinkProperties
 ImpChainLinkProperties();
 
 bool bOverwriteOnOverflow;
-bool bHandlingUnderflow;
 bool bNilChainingEvent;
 };
 
@@ -65,9 +64,6 @@ class TextChain {
 void SetOverwriteOnOverflow(SdrTextObj *, bool );
 bool GetOverwriteOnOverflow(SdrTextObj *pTarget);
 
-bool GetLinkHandlingUnderflow(SdrTextObj *pTarget);
-void SetLinkHandlingUnderflow(SdrTextObj *, bool);
-
 bool GetNilChainingEvent(SdrTextObj *pTarget);
 void SetNilChainingEvent(SdrTextObj *, bool);
 
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index c6adc5a..71fe911 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1971,16 +1971,7 @@ void SdrTextObj::onOverflowStatusEvent( )
 if ( mbToBeChained ) {
 SdrOutliner aDrawOutliner = ImpGetDrawOutliner();
 
-// If this is the a post-underflow-type of overflow then we cannot
-//trust the editing outl on the text since it has still the old one
-if(GetTextChain()-GetLinkHandlingUnderflow(this)) {
-OutlinerParaObject *pPObj = GetOutlinerParaObject();
-aDrawOutliner.SetUpdateMode(true);
-aDrawOutliner.SetMaxAutoPaperSize(pEdtOutl-GetMaxAutoPaperSize());
-aDrawOutliner.SetText(*pPObj);
-aDrawOutliner.IsPageOverflow(); // Check for overflow to set flags
-mpOverflowingText = aDrawOutliner.GetOverflowingText();
-} else  if (pEdtOutl != NULL)
+   if (pEdtOutl != NULL)
 mpOverflowingText = pEdtOutl-GetOverflowingText();
 else {
 assert(0); // Should never happen. FIXME(matteocam)
@@ -1989,21 +1980,6 @@ void SdrTextObj::onOverflowStatusEvent( )
 SdrTextObj *pNextTextObj = GetNextLinkInChain();
 
 impLeaveOnlyNonOverflowingText(aDrawOutliner);
-if (GetTextChain()-GetLinkHandlingUnderflow(this))
-{
-// reset underflow handling
-GetTextChain()-SetLinkHandlingUnderflow(this, false);
-/* We are about to call set text on underflowing text,
- * since there is nothing more to be handled this should be nil
-*/
-GetTextChain()-SetNilChainingEvent(this, true);
-// Set text for editing outliner; will trigger onChainingEvent 
(which will return immediately)
-OutlinerParaObject *pPObj = GetOutlinerParaObject();
-pEdtOutl-SetText(*pPObj);
-// XXX: not sure if next lines necessary
-OutlinerParaObject *pNewPObj = pEdtOutl-CreateParaObject();
-NbcSetOutlinerParaObject(pNewPObj);
-}
 
 // Transfer overflowing text
 impMoveChainedTextToNextLink(aDrawOutliner, pNextTextObj);
@@ -2015,21 +1991,6 @@ void SdrTextObj::onUnderflowStatusEvent( )
 SdrTextObj *pNextLink = GetNextLinkInChain();
 SdrOutliner aDrawOutliner = ImpGetDrawOutliner();
 
-if (GetTextChain()-GetLinkHandlingUnderflow(this))
-{
-// possibly coming from an overflow
-if (pEdtOutl) {
-GetTextChain()-SetLinkHandlingUnderflow(this, false);
-GetTextChain()-SetNilChainingEvent(this, true);
-OutlinerParaObject *pPObj = GetOutlinerParaObject();
-pEdtOutl-SetText(*pPObj);
-OutlinerParaObject *pNewPObj = pEdtOutl-CreateParaObject();
-SetOutlinerParaObject(pNewPObj);
-}
-
-return;
-}
-
 if (!pNextLink-HasText())
 return;
 
@@ -2106,18 +2067,7 @@ void SdrTextObj::onChainingEvent()
 
 bool bIsPageOverflow;
 
-if (GetTextChain()-GetLinkHandlingUnderflow(this))
-{
-// If handling underflow we check for overflow in the object
-Outliner aDrawOutliner = ImpGetDrawOutliner();
-aDrawOutliner.SetUpdateMode(true);
-aDrawOutliner.SetMaxAutoPaperSize(pEdtOutl-GetMaxAutoPaperSize());
-OutlinerParaObject *pPObj = GetOutlinerParaObject();
-aDrawOutliner.SetText(*pPObj);
-bIsPageOverflow = aDrawOutliner.IsPageOverflow();
-} else {
-bIsPageOverflow = pEdtOutl-IsPageOverflow();
-}
+bIsPageOverflow = pEdtOutl-IsPageOverflow();
 
 // Propagates the need for change
 SetToBeChained( bIsPageOverflow );
diff --git a/svx/source/svdraw/textchain.cxx 

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

2015-06-23 Thread matteocam
 include/svx/textchain.hxx   |4 --
 svx/source/svdraw/svdotext.cxx  |   11 +
 svx/source/svdraw/svdotextdecomposition.cxx |   55 +---
 svx/source/svdraw/textchain.cxx |   13 --
 4 files changed, 4 insertions(+), 79 deletions(-)

New commits:
commit 3119dabf25d33f805bd8943c2e4857934d97e1a7
Author: matteocam matteo.campane...@gmail.com
Date:   Tue Jun 23 19:22:45 2015 -0400

Removed references to SetOverwriteOnOverflow

Change-Id: I17271e25f9e5fc8feeafdc1c09916674f1e6d494

diff --git a/include/svx/textchain.hxx b/include/svx/textchain.hxx
index 56b0af8..8032747 100644
--- a/include/svx/textchain.hxx
+++ b/include/svx/textchain.hxx
@@ -40,7 +40,6 @@ class ImpChainLinkProperties
 
 ImpChainLinkProperties();
 
-bool bOverwriteOnOverflow;
 bool bNilChainingEvent;
 };
 
@@ -61,9 +60,6 @@ class TextChain {
 // return whether a paragraph is split between the two links in the 
argument
 bool GetLinksHaveMergeableFirstPara(SdrTextObj *, SdrTextObj *);
 
-void SetOverwriteOnOverflow(SdrTextObj *, bool );
-bool GetOverwriteOnOverflow(SdrTextObj *pTarget);
-
 bool GetNilChainingEvent(SdrTextObj *pTarget);
 void SetNilChainingEvent(SdrTextObj *, bool);
 
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 71fe911..7625ca6 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1994,7 +1994,7 @@ void SdrTextObj::onUnderflowStatusEvent( )
 if (!pNextLink-HasText())
 return;
 
-//  1) get the text of the other guy and add it to the last paragraph
+//  Get the text of the other guy and add it to the last paragraph
 // XXX: For now it's not merging anything just adding the while thing as a 
separate para
 OutlinerParaObject *pNextLinkWholeText = 
pNextLink-GetOutlinerParaObject();
 if (!pNextLinkWholeText)
@@ -2014,24 +2014,17 @@ void SdrTextObj::onUnderflowStatusEvent( )
 aDrawOutliner.AddText(*pNextLinkWholeText);
 
 bool bIsOverflowFromUnderflow = aDrawOutliner.IsPageOverflow();
+// Save mpOverflowingText (important for overflow handlers below) // XXX: 
Change the wayt this is done?
 if (bIsOverflowFromUnderflow)
 mpOverflowingText = aDrawOutliner.GetOverflowingText();
 
 OutlinerParaObject *pNewText = aDrawOutliner.CreateParaObject();
 
-// 2) Set the text of the next guy to what is left
-// (since this happens automatically by overflow we just order to reset 
the destination box's text)
-GetTextChain()-SetOverwriteOnOverflow(pNextLink, true);
-
-// We make sure we don't handle underflow while handling underflow
-//GetTextChain()-SetLinkHandlingUnderflow(this, true);
-
 // Set the other box empty so if overflow does not occur we are fine
 pNextLink-NbcSetOutlinerParaObject(aDrawOutliner.GetEmptyParaObject());
 
 // handle overflow
 if (bIsOverflowFromUnderflow) {
-
 // prevents infinite loops when setting text for editing outliner
 GetTextChain()-SetNilChainingEvent(const_castSdrTextObj*(this), 
true);
 impLeaveOnlyNonOverflowingText(aDrawOutliner);
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx 
b/svx/source/svdraw/svdotextdecomposition.cxx
index dcb4ad2..83f9a0c 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -784,9 +784,7 @@ void SdrTextObj::impLeaveOnlyNonOverflowingText(SdrOutliner 
*pOutliner) const
 {
 OutlinerParaObject *pNewText = impGetNonOverflowingParaObject(pOutliner);
 
-//bool bInUnderflow =  
GetTextChain()-GetLinkHandlingUnderflow(const_castSdrTextObj*(this));
-// we need this when we are in editing mode (AND this is not an 
underflow-caused overflow)
-if (pEdtOutl != NULL /*  !bInUnderflow */) {
+if (pEdtOutl != NULL) {
 pEdtOutl-SetText(*pNewText);
 }
 // adds it to current outliner anyway (useful in static decomposition)
@@ -803,38 +801,6 @@ OutlinerParaObject 
*SdrTextObj::impGetOverflowingParaObject(SdrOutliner *pOutlin
 if (mpOverflowingText == NULL)
 return NULL;
 
-// XXX: Put following code in a separate method (possibly in another class)
-if ( GetTextChain()-GetOverwriteOnOverflow(pNextTextObj) )
-{
-// We only make three blocks of paragraphs and ignore the rest
-
-// reset behavior
-GetTextChain()-SetOverwriteOnOverflow(pNextTextObj, false);
-
-if (mpOverflowingText-HasOtherParas()) {
-// Make Para Object from the ending lines (to be appended later)
-impSetOutlinerToEmptyTxt(pOutliner);
-Paragraph *pFstPara = pOutliner-GetParagraph(0);
-pOutliner-SetText(mpOverflowingText-GetEndingLines(), pFstPara);
-OutlinerParaObject *pLastPara = pOutliner-CreateParaObject();
-
-// Set heading lines as first paragraph
-

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

2015-06-19 Thread matteocam
 include/svx/textchain.hxx   |4 
 svx/source/svdraw/svdotext.cxx  |9 -
 svx/source/svdraw/svdotextdecomposition.cxx |5 -
 svx/source/svdraw/textchain.cxx |   13 +
 4 files changed, 29 insertions(+), 2 deletions(-)

New commits:
commit 56c559b69e9549611b2ae5dad67842b60880646b
Author: matteocam matteo.campane...@gmail.com
Date:   Fri Jun 19 22:43:26 2015 -0400

Adding one more state to underflow processing

Change-Id: I130935fc96ea270c7661b324e473ab825547b45b

diff --git a/include/svx/textchain.hxx b/include/svx/textchain.hxx
index a03bf57..9290f22 100644
--- a/include/svx/textchain.hxx
+++ b/include/svx/textchain.hxx
@@ -42,6 +42,7 @@ class ImpChainLinkProperties
 
 bool bOverwriteOnOverflow;
 bool bHandlingUnderflow;
+bool bNilChainingEvent;
 };
 
 
@@ -67,6 +68,9 @@ class TextChain {
 bool GetLinkHandlingUnderflow(SdrTextObj *pTarget);
 void SetLinkHandlingUnderflow(SdrTextObj *, bool);
 
+bool GetNilChainingEvent(SdrTextObj *pTarget);
+void SetNilChainingEvent(SdrTextObj *, bool);
+
 protected:
 LinkPropertiesMap maLinkPropertiesMap;
 };
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 3c394de..51c75a0 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -2004,10 +2004,12 @@ void SdrTextObj::onUnderflowStatusEvent( )
 {
 // possibly coming from an overflow
 if (pEdtOutl) {
+GetTextChain()-SetLinkHandlingUnderflow(this, false);
+GetTextChain()-SetNilChainingEvent(this, true);
 OutlinerParaObject *pPObj = GetOutlinerParaObject();
 pEdtOutl-SetText(*pPObj);
 }
-GetTextChain()-SetLinkHandlingUnderflow(this, false);
+
 return;
 }
 
@@ -2147,6 +2149,11 @@ void SdrTextObj::onChainingEvent()
 if (!pEdtOutl)
 return;
 
+if (GetTextChain()-GetNilChainingEvent(this)) {
+GetTextChain()-SetNilChainingEvent(this, false);
+return;
+}
+
 bool bIsPageOverflow;
 
 if (GetTextChain()-GetLinkHandlingUnderflow(this))
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx 
b/svx/source/svdraw/svdotextdecomposition.cxx
index a4de09d..d4a3438 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -789,7 +789,10 @@ void 
SdrTextObj::impLeaveOnlyNonOverflowingText(SdrOutliner *pOutliner) const
 pEdtOutl-SetText(*pNewText);
 // adds it to current outliner anyway (useful in static decomposition)
 pOutliner-SetText(*pNewText);
-const_castSdrTextObj*(this)-NbcSetOutlinerParaObject(pNewText);
+if (bInUnderflow) // must make a broadcast to reset underflow (XXX: can I 
reset it from here?)
+const_castSdrTextObj*(this)-SetOutlinerParaObject(pNewText);
+else
+const_castSdrTextObj*(this)-NbcSetOutlinerParaObject(pNewText);
 }
 
 OutlinerParaObject *SdrTextObj::impGetOverflowingParaObject(SdrOutliner 
*pOutliner, SdrTextObj *pNextTextObj) const
diff --git a/svx/source/svdraw/textchain.cxx b/svx/source/svdraw/textchain.cxx
index 3e4f546..1fd7f92 100644
--- a/svx/source/svdraw/textchain.cxx
+++ b/svx/source/svdraw/textchain.cxx
@@ -26,6 +26,7 @@ ImpChainLinkProperties::ImpChainLinkProperties()
 // give defaults
 bOverwriteOnOverflow = false;
 bHandlingUnderflow = false;
+bNilChainingEvent = false;
 }
 
 // XXX: All getters in the class assume that the guy is in the chain
@@ -72,6 +73,18 @@ void TextChain::SetLinkHandlingUnderflow(SdrTextObj 
*pTarget, bool bHandlingUnde
 pLinkProperties-bHandlingUnderflow = bHandlingUnderflow;
 }
 
+bool TextChain::GetNilChainingEvent(SdrTextObj *pTarget)
+{
+ImpChainLinkProperties *pLinkProperties = GetLinkProperties(pTarget);
+return pLinkProperties-bNilChainingEvent;
+}
+
+void TextChain::SetNilChainingEvent(SdrTextObj *pTarget, bool 
bNilChainingEvent)
+{
+ImpChainLinkProperties *pLinkProperties = GetLinkProperties(pTarget);
+pLinkProperties-bNilChainingEvent = bNilChainingEvent;
+}
+
 void TextChain::SetOverwriteOnOverflow(SdrTextObj *pTarget, bool bOverwrite)
 {
 ImpChainLinkProperties *pLinkProperties = GetLinkProperties(pTarget);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-06-18 Thread matteocam
 include/svx/textchain.hxx   |6 +-
 svx/source/svdraw/svdotext.cxx  |   11 +++
 svx/source/svdraw/textchain.cxx |   13 +
 3 files changed, 29 insertions(+), 1 deletion(-)

New commits:
commit 465d9d703de940244adb218e60a4f2f77b7c036d
Author: matteocam matteo.campane...@gmail.com
Date:   Thu Jun 18 23:33:28 2015 -0400

Controlling for underflow handling

Change-Id: I26fb6b4878e1bca1ea09872624631578a568896d

diff --git a/include/svx/textchain.hxx b/include/svx/textchain.hxx
index 01798d5..a03bf57 100644
--- a/include/svx/textchain.hxx
+++ b/include/svx/textchain.hxx
@@ -41,7 +41,7 @@ class ImpChainLinkProperties
 ImpChainLinkProperties();
 
 bool bOverwriteOnOverflow;
-// all kind of stuff such has MergeableFirstParagraphs or if overwrite 
should occurr on overflow
+bool bHandlingUnderflow;
 };
 
 
@@ -60,9 +60,13 @@ class TextChain {
 
 // return whether a paragraph is split between the two links in the 
argument
 bool GetLinksHaveMergeableFirstPara(SdrTextObj *, SdrTextObj *);
+
 void SetOverwriteOnOverflow(SdrTextObj *, bool );
 bool GetOverwriteOnOverflow(SdrTextObj *pTarget);
 
+bool GetLinkHandlingUnderflow(SdrTextObj *pTarget);
+void SetLinkHandlingUnderflow(SdrTextObj *, bool);
+
 protected:
 LinkPropertiesMap maLinkPropertiesMap;
 };
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 8ac625e..911dadc 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1999,9 +1999,17 @@ void SdrTextObj::onUnderflowStatusEvent( )
 SdrTextObj *pNextLink = GetNextLinkInChain();
 SdrOutliner aDrawOutliner = ImpGetDrawOutliner();
 
+if (GetTextChain()-GetLinkHandlingUnderflow(this))
+{
+GetTextChain()-SetLinkHandlingUnderflow(this, false);
+return;
+}
+
 if (!pNextLink-HasText())
 return;
 
+
+
 //  1) get the text of the other guy and add it to the last paragraph
 // XXX: For now it's not merging anything just adding the while thing as a 
separate para
 OutlinerParaObject *pNextLinkWholeText = 
pNextLink-GetOutlinerParaObject();
@@ -2016,6 +2024,9 @@ void SdrTextObj::onUnderflowStatusEvent( )
 // (since this happens automatically by overflow we just order to 
reset the destination box's text)
 GetTextChain()-SetOverwriteOnOverflow(pNextLink, true);
 
+// We make sure we don't handle underflow while handling underflow
+GetTextChain()-SetLinkHandlingUnderflow(this, true);
+
 if (pEdtOutl != NULL)
 pEdtOutl-SetText(*pNewText);
 
diff --git a/svx/source/svdraw/textchain.cxx b/svx/source/svdraw/textchain.cxx
index 3637d45..3e4f546 100644
--- a/svx/source/svdraw/textchain.cxx
+++ b/svx/source/svdraw/textchain.cxx
@@ -25,6 +25,7 @@ ImpChainLinkProperties::ImpChainLinkProperties()
 {
 // give defaults
 bOverwriteOnOverflow = false;
+bHandlingUnderflow = false;
 }
 
 // XXX: All getters in the class assume that the guy is in the chain
@@ -59,6 +60,18 @@ bool TextChain::GetLinksHaveMergeableFirstPara(SdrTextObj* 
/* pPrevLink */, SdrT
 return false;
 }
 
+bool TextChain::GetLinkHandlingUnderflow(SdrTextObj *pTarget)
+{
+ImpChainLinkProperties *pLinkProperties = GetLinkProperties(pTarget);
+return pLinkProperties-bHandlingUnderflow;
+}
+
+void TextChain::SetLinkHandlingUnderflow(SdrTextObj *pTarget, bool 
bHandlingUnderflow)
+{
+ImpChainLinkProperties *pLinkProperties = GetLinkProperties(pTarget);
+pLinkProperties-bHandlingUnderflow = bHandlingUnderflow;
+}
+
 void TextChain::SetOverwriteOnOverflow(SdrTextObj *pTarget, bool bOverwrite)
 {
 ImpChainLinkProperties *pLinkProperties = GetLinkProperties(pTarget);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-06-18 Thread matteocam
 include/svx/textchain.hxx   |   24 -
 svx/source/svdraw/textchain.cxx |   44 +---
 2 files changed, 59 insertions(+), 9 deletions(-)

New commits:
commit d674ed2e472d555a0eb4ec46c7d104ae85907794
Author: matteocam matteo.campane...@gmail.com
Date:   Thu Jun 18 15:24:10 2015 -0400

Prototype of TextChain having support for overwrite on overflow

Change-Id: I6ea6e4053663ecdb3e484d857e0a9dd3b7fc1dae

diff --git a/include/svx/textchain.hxx b/include/svx/textchain.hxx
index b3eda9b..01798d5 100644
--- a/include/svx/textchain.hxx
+++ b/include/svx/textchain.hxx
@@ -29,16 +29,19 @@ namespace rtl {
 class OUString;
 }
 
-typedef std::map rtl::OUString, ImpChainLinkProperties  LinkPropertiesMaps;
+typedef rtl::OUString ChainLinkId;
+typedef std::map ChainLinkId, ImpChainLinkProperties * LinkPropertiesMap;
 
 
 class ImpChainLinkProperties
 {
-public:
+protected:
 friend class TextChain;
 
-private:
-// all kind of stuff such has MergeableFirstParagraphs or if 
overflapping should occurr on overflow
+ImpChainLinkProperties();
+
+bool bOverwriteOnOverflow;
+// all kind of stuff such has MergeableFirstParagraphs or if overwrite 
should occurr on overflow
 };
 
 
@@ -46,13 +49,22 @@ class TextChain {
 
 public:
 TextChain();
+~TextChain();
+
 void AppendLink(SdrTextObj *);
-SdrTextObj *GetNextLink(SdrTextObj *);
+bool IsLinkInChain(SdrTextObj *) const;
+SdrTextObj *GetNextLink(SdrTextObj *) const;
+
+ChainLinkId GetId(SdrTextObj *) const;
+ImpChainLinkProperties *GetLinkProperties(SdrTextObj *);
 
 // return whether a paragraph is split between the two links in the 
argument
-bool GetLinksHaveMergeableFirstPara(SdrTextObj *pPrevLink, SdrTextObj 
*pNextLink);
+bool GetLinksHaveMergeableFirstPara(SdrTextObj *, SdrTextObj *);
 void SetOverwriteOnOverflow(SdrTextObj *, bool );
 bool GetOverwriteOnOverflow(SdrTextObj *pTarget);
+
+protected:
+LinkPropertiesMap maLinkPropertiesMap;
 };
 
 #endif // INCLUDED_SVX_TEXTCHAIN_HXX
diff --git a/svx/source/svdraw/textchain.cxx b/svx/source/svdraw/textchain.cxx
index 709d562..3637d45 100644
--- a/svx/source/svdraw/textchain.cxx
+++ b/svx/source/svdraw/textchain.cxx
@@ -20,20 +20,40 @@
 #include svx/textchain.hxx
 #include svx/svdotext.hxx
 
+
+ImpChainLinkProperties::ImpChainLinkProperties()
+{
+// give defaults
+bOverwriteOnOverflow = false;
+}
+
+// XXX: All getters in the class assume that the guy is in the chain
+
 TextChain::TextChain()
 {
 }
 
+TextChain::~TextChain()
+{
+// XXX: Should free all LinkProperties
+}
+
+bool TextChain::IsLinkInChain(SdrTextObj *) const
+{
+return true;// XXX: Should make an actual check
+}
+
 void TextChain::AppendLink(SdrTextObj *)
 {
+// XXX
 }
 
-SdrTextObj *TextChain::GetNextLink(SdrTextObj *)
+SdrTextObj *TextChain::GetNextLink(SdrTextObj *) const
 {
-return NULL; // XXX
+return NULL; // XXX: To be changed. It'd be a mess to implement now
 }
 
-bool TextChain::GetLinksHaveMergeableFirstPara(SdrTextObj *pPrevLink, 
SdrTextObj *pNextLink)
+bool TextChain::GetLinksHaveMergeableFirstPara(SdrTextObj* /* pPrevLink */, 
SdrTextObj* /* pNextLink */)
 {
 // XXX
 return false;
@@ -41,12 +61,30 @@ bool TextChain::GetLinksHaveMergeableFirstPara(SdrTextObj 
*pPrevLink, SdrTextObj
 
 void TextChain::SetOverwriteOnOverflow(SdrTextObj *pTarget, bool bOverwrite)
 {
+ImpChainLinkProperties *pLinkProperties = GetLinkProperties(pTarget);
+pLinkProperties-bOverwriteOnOverflow = bOverwrite;
+}
+
+ImpChainLinkProperties *TextChain::GetLinkProperties(SdrTextObj *pLink)
+{
+// if the guy does not already have properties in the map make them
+ChainLinkId aLinkId = GetId(pLink);
+if (maLinkPropertiesMap.find(aLinkId) == maLinkPropertiesMap.end()) {
+maLinkPropertiesMap[aLinkId] = new ImpChainLinkProperties;
+}
 
+return maLinkPropertiesMap[aLinkId];
 }
 
 bool TextChain::GetOverwriteOnOverflow(SdrTextObj *pTarget)
 {
+ImpChainLinkProperties *pLinkProperties = GetLinkProperties(pTarget);
+return pLinkProperties-bOverwriteOnOverflow;
+}
 
+ChainLinkId TextChain::GetId(SdrTextObj *pLink) const
+{
+return pLink-GetName();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-06-17 Thread matteocam
 include/svx/svdotext.hxx   |1 +
 svx/source/svdraw/svdotext.cxx |6 ++
 2 files changed, 7 insertions(+)

New commits:
commit 95e136712bde6f457184464d0477ec7b720b4b89
Author: matteocam matteo.campane...@gmail.com
Date:   Wed Jun 17 16:06:32 2015 -0400

Added SdrTextObj::onUnderflowStatusEvent

Change-Id: I8661462f01d6ec23bed86275c9bbf7b94a5ab546

diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index 32321f4..9dcb58a 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -550,6 +550,7 @@ public:
 virtual void onEditOutlinerStatusEvent( EditStatus* pEditStatus );
 
 virtual void onOverflowStatusEvent( );
+virtual void onUnderflowStatusEvent( );
 
 
 
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 87cef77..867423b 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1983,6 +1983,11 @@ void SdrTextObj::onOverflowStatusEvent( )
 }
 }
 
+void SdrTextObj::onUnderflowStatusEvent( )
+{
+
+}
+
 /** returns the currently active text. */
 SdrText* SdrTextObj::getActiveText() const
 {
@@ -2103,6 +2108,7 @@ IMPL_LINK_NOARG(SdrTextObj,ImpDecomposeChainedText)
  * 2) Set the text of the other guy to what is left
  *
 */
+onUnderflowStatusEvent();
 }
 return 0;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-06-17 Thread matteocam
 include/svx/textchain.hxx   |   23 ++-
 svx/source/svdraw/svdotext.cxx  |1 +
 svx/source/svdraw/textchain.cxx |   11 +++
 3 files changed, 34 insertions(+), 1 deletion(-)

New commits:
commit 5b9dc85fd7134abba82dd1910f9fb726535f9e97
Author: matteocam matteo.campane...@gmail.com
Date:   Wed Jun 17 17:47:40 2015 -0400

Drafted classes and methods for implemening underflow as overwriting 
overflow

Change-Id: Ie7a904dc0cae0b2403d777390f5ee8eae534a6f7

diff --git a/include/svx/textchain.hxx b/include/svx/textchain.hxx
index 42dc999..b3eda9b 100644
--- a/include/svx/textchain.hxx
+++ b/include/svx/textchain.hxx
@@ -20,8 +20,28 @@
 #ifndef INCLUDED_SVX_TEXTCHAIN_HXX
 #define INCLUDED_SVX_TEXTCHAIN_HXX
 
+#include map
+
+class ImpChainLinkProperties;
 class SdrTextObj;
 
+namespace rtl {
+class OUString;
+}
+
+typedef std::map rtl::OUString, ImpChainLinkProperties  LinkPropertiesMaps;
+
+
+class ImpChainLinkProperties
+{
+public:
+friend class TextChain;
+
+private:
+// all kind of stuff such has MergeableFirstParagraphs or if 
overflapping should occurr on overflow
+};
+
+
 class TextChain {
 
 public:
@@ -31,7 +51,8 @@ class TextChain {
 
 // return whether a paragraph is split between the two links in the 
argument
 bool GetLinksHaveMergeableFirstPara(SdrTextObj *pPrevLink, SdrTextObj 
*pNextLink);
-
+void SetOverwriteOnOverflow(SdrTextObj *, bool );
+bool GetOverwriteOnOverflow(SdrTextObj *pTarget);
 };
 
 #endif // INCLUDED_SVX_TEXTCHAIN_HXX
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 64d1937..2ff88aa 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -46,6 +46,7 @@
 #include svx/xflgrit.hxx
 #include svx/svdpool.hxx
 #include svx/xflclit.hxx
+#include svx/textchain.hxx
 #include svl/style.hxx
 #include editeng/editeng.hxx
 #include editeng/overflowingtxt.hxx
diff --git a/svx/source/svdraw/textchain.cxx b/svx/source/svdraw/textchain.cxx
index a4495b0..709d562 100644
--- a/svx/source/svdraw/textchain.cxx
+++ b/svx/source/svdraw/textchain.cxx
@@ -38,4 +38,15 @@ bool TextChain::GetLinksHaveMergeableFirstPara(SdrTextObj 
*pPrevLink, SdrTextObj
 // XXX
 return false;
 }
+
+void TextChain::SetOverwriteOnOverflow(SdrTextObj *pTarget, bool bOverwrite)
+{
+
+}
+
+bool TextChain::GetOverwriteOnOverflow(SdrTextObj *pTarget)
+{
+
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-06-16 Thread matteocam
 include/svx/svdmodel.hxx|5 +
 include/svx/svdotext.hxx|1 +
 include/svx/textchain.hxx   |3 +++
 svx/source/svdraw/svdmodel.cxx  |   14 ++
 svx/source/svdraw/svdotext.cxx  |8 
 svx/source/svdraw/textchain.cxx |5 +
 6 files changed, 36 insertions(+)

New commits:
commit dde308668425a5849d49e3ac5040e2157141cc6c
Author: matteocam matteo.campane...@gmail.com
Date:   Tue Jun 16 12:35:28 2015 -0400

Changed SdrModel and SdrTextObj to use TextChain

Change-Id: I3e2e4cbe861f48366e3ab0abbe83c97e0aafe69b

diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx
index bdc992d..c7f7233 100644
--- a/include/svx/svdmodel.hxx
+++ b/include/svx/svdmodel.hxx
@@ -75,6 +75,8 @@ class SotStorage;
 class SdrOutlinerCache;
 class SdrUndoFactory;
 class ImageMap;
+class TextChain;
+
 namespace comphelper
 {
 class IEmbeddedHelper;
@@ -211,6 +213,8 @@ protected:
 sal_uInt16  nDefaultTabulator;
 sal_uInt32  nMaxUndoCount;
 
+TextChain*  pTextChain;
+
 
 
 // sdr::Comment interface
@@ -328,6 +332,7 @@ public:
 SdrOutliner GetDrawOutliner(const SdrTextObj* pObj=NULL) const;
 
 SdrOutliner GetChainingOutliner(const SdrTextObj* pObj=NULL) 
const;
+TextChain *GetTextChain() const;
 
 SdrOutliner GetHitTestOutliner() const { return 
*pHitTestOutliner; }
 const SdrTextObj*GetFormattingTextObj() const;
diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index 83b488e..bbc9207 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -361,6 +361,7 @@ public:
 bool IsChainable() const { return GetNextLinkInChain() != NULL; }
 void SetPreventChainable();
 bool GetPreventChainable() const;
+TextChain *GetTextChain() const;
 
 SdrObjKind GetTextKind() const { return eTextKind; }
 
diff --git a/include/svx/textchain.hxx b/include/svx/textchain.hxx
index e094334..42dc999 100644
--- a/include/svx/textchain.hxx
+++ b/include/svx/textchain.hxx
@@ -29,6 +29,9 @@ class TextChain {
 void AppendLink(SdrTextObj *);
 SdrTextObj *GetNextLink(SdrTextObj *);
 
+// return whether a paragraph is split between the two links in the 
argument
+bool GetLinksHaveMergeableFirstPara(SdrTextObj *pPrevLink, SdrTextObj 
*pNextLink);
+
 };
 
 #endif // INCLUDED_SVX_TEXTCHAIN_HXX
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index ce0ff7a..19652f4 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -54,6 +54,7 @@
 #include svx/svdpool.hxx
 #include svx/svdobj.hxx
 #include svx/svdotext.hxx
+#include svx/textchain.hxx
 #include svx/svdetc.hxx
 #include svx/svdoutl.hxx
 #include svx/svdoole2.hxx
@@ -212,9 +213,17 @@ void SdrModel::ImpCtor(SfxItemPool* pPool, 
::comphelper::IEmbeddedHelper* _pEmbe
 pHitTestOutliner = SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, this );
 ImpSetOutlinerDefaults(pHitTestOutliner, true);
 
+// FIXME(matteocam)
+/* Start Text Chaining related code */
+
+// Initialize Chaining Outliner
 pChainingOutliner = SdrMakeOutliner( OUTLINERMODE_TEXTOBJECT, this );
 ImpSetOutlinerDefaults(pChainingOutliner, true);
 
+// Make a TextChain
+pTextChain = new TextChain;
+
+/* End Text Chaining related code */
 
 ImpCreateTables();
 }
@@ -1977,6 +1986,11 @@ void SdrModel::PageListChanged()
 {
 }
 
+TextChain *SdrModel::GetTextChain() const
+{
+return pTextChain;
+}
+
 const SdrPage* SdrModel::GetMasterPage(sal_uInt16 nPgNum) const
 {
 DBG_ASSERT(nPgNum  maMaPag.size(), SdrModel::GetMasterPage: Access out 
of range (!));
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 03b8388..cc17892 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1543,6 +1543,14 @@ void SdrTextObj::SetToBeChained(bool bToBeChained)
 mbToBeChained = bToBeChained;
 }
 
+TextChain *SdrTextObj::GetTextChain() const
+{
+if (!IsChainable())
+return NULL;
+
+return pModel-GetTextChain();
+}
+
 void SdrTextObj::SetVerticalWriting(bool bVertical)
 {
 OutlinerParaObject* pOutlinerParaObject = GetOutlinerParaObject();
diff --git a/svx/source/svdraw/textchain.cxx b/svx/source/svdraw/textchain.cxx
index 194d4d4..17595c9 100644
--- a/svx/source/svdraw/textchain.cxx
+++ b/svx/source/svdraw/textchain.cxx
@@ -32,3 +32,8 @@ SdrTextObj *TextChain::GetNextLink(SdrTextObj *)
 {
 return NULL; // XXX
 }
+
+bool TextChain::GetLinksHaveMergeableFirstPara(SdrTextObj *pPrevLink, 
SdrTextObj *pNextLink)
+{
+
+}
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-06-11 Thread matteocam
 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.campane...@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_castSdrTextObj*(this)-mpOverflowingText = 
rOutliner.GetOverflowingText();
+if (GetNextLinkInChain())
+impMoveChainedTextToNextLink(rChainingOutl, GetNextLinkInChain());
+
 }
 /* End overflow handling */
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-06-10 Thread matteocam
 include/svx/svdotext.hxx|7 -
 svx/source/svdraw/svdotext.cxx  |   12 +-
 svx/source/svdraw/svdotextdecomposition.cxx |  138 +++-
 svx/source/svdraw/svdotxed.cxx  |2 
 4 files changed, 86 insertions(+), 73 deletions(-)

New commits:
commit 2e66cafe5bdef5a0c64c190b0b73a7db61dcc3a1
Author: matteocam matteo.campane...@gmail.com
Date:   Wed Jun 10 18:43:29 2015 -0400

Passed right outliner around

Change-Id: I7eeb193e53926093e91393667ab9c788ebebda9d

diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index 964ee43..0552029 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -608,9 +608,10 @@ public:
 const drawinglayer::primitive2d::SdrChainedTextPrimitive2D 
rSdrChainedTextPrimitive,
 const drawinglayer::geometry::ViewInformation2D aViewInformation) 
const;
 
-void impMoveChainedTextToNextLink(SdrTextObj *pNextTextObj) const;
-OutlinerParaObject *impGetNonOverflowingParaObject() const;
-void impLeaveOnlyNonOverflowingText() const;
+void impMoveChainedTextToNextLink(SdrOutliner *pOutliner, SdrTextObj 
*pNextTextObj) const;
+OutlinerParaObject *impGetOverflowingParaObject(SdrOutliner *pOutliner, 
SdrTextObj *pNextTextObj) const;
+void impLeaveOnlyNonOverflowingText(SdrOutliner *pOutliner) const;
+OutlinerParaObject *impGetNonOverflowingParaObject(SdrOutliner *pOutliner) 
const;
 
 // Handler for Chained Text
 DECL_LINK(ImpDecomposeChainedText,bool*);
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index bf46cb9..82b883f 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1958,11 +1958,10 @@ void SdrTextObj::onEditOutlinerStatusEvent( EditStatus* 
pEditStatus )
 
 void SdrTextObj::onOverflowStatusEvent( bool bIsPageOverflow )
 {
-// FIXME: Should have a IsChainable or something.
-if (IsAutoGrowWidth() || IsAutoGrowHeight() || IsAutoFit())
+if (!IsChainable())
 return;
 
-if ( GetNextLinkInChain() != NULL ) // is this a chainable object?
+if ( GetNextLinkInChain() != NULL ) // is there anything to transfer text 
to?
 {
 // set whether there is need for chaining
 // (used in EndTextEdit to crop the overflowing part)
@@ -1973,17 +1972,18 @@ void SdrTextObj::onOverflowStatusEvent( bool 
bIsPageOverflow )
 
 // Pushes text in next link on the fly
 if ( bIsPageOverflow ) {
+SdrOutliner aDrawOutliner = ImpGetDrawOutliner();
 if (pEdtOutl != NULL)
 mpOverflowingText = pEdtOutl-GetOverflowingText();
 else
-mpOverflowingText = ImpGetDrawOutliner().GetOverflowingText();
+mpOverflowingText = aDrawOutliner.GetOverflowingText();
 
 SdrTextObj *pNextTextObj = GetNextLinkInChain();
 
-impLeaveOnlyNonOverflowingText();
+impLeaveOnlyNonOverflowingText(aDrawOutliner);
 
 // Transfer overflowing text
-impMoveChainedTextToNextLink(pNextTextObj);
+impMoveChainedTextToNextLink(aDrawOutliner, pNextTextObj);
 }
 
 }
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx 
b/svx/source/svdraw/svdotextdecomposition.cxx
index 88f6136..9fff4c0 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -732,36 +732,36 @@ OutlinerParaObject 
*SdrTextObj::impGetNonOverflowingParaObject(SdrOutliner *pOut
 {
 NonOverflowingText *pNonOverflowingTxt;
 pNonOverflowingTxt =
-rOutliner.GetNonOverflowingText();
+pOutliner-GetNonOverflowingText();
 
-pOutliner.Clear();
-//pOutliner.SetStyleSheet( 0, pEdtOutl-GetStyleSheet(0));
+pOutliner-Clear();
+//pOutliner-SetStyleSheet( 0, pEdtOutl-GetStyleSheet(0));
 
 if (pNonOverflowingTxt-mPreOverflowingTxt ==  
 pNonOverflowingTxt-mpHeadParas != NULL) {
 // Only (possibly empty) paragraphs before overflowing one
-pOutliner.SetText(*pNonOverflowingTxt-mpHeadParas);
+pOutliner-SetText(*pNonOverflowingTxt-mpHeadParas);
 } else { // We have to include the non-overflowing lines from the overfl. 
para
 
 // first make a ParaObject for the strings
-Paragraph *pTmpPara0 = pOutliner.GetParagraph(0);
-pOutliner.SetText(pNonOverflowingTxt-mPreOverflowingTxt, pTmpPara0);
-OutlinerParaObject *pPObj = pOutliner.CreateParaObject();
-pOutliner.Clear();
-//pOutliner.SetStyleSheet( 0, pEdtOutl-GetStyleSheet(0));
+Paragraph *pTmpPara0 = pOutliner-GetParagraph(0);
+pOutliner-SetText(pNonOverflowingTxt-mPreOverflowingTxt, pTmpPara0);
+OutlinerParaObject *pPObj = pOutliner-CreateParaObject();
+pOutliner-Clear();
+//pOutliner-SetStyleSheet( 0, pEdtOutl-GetStyleSheet(0));
 
 if (pNonOverflowingTxt-mpHeadParas != NULL)
-

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

2015-06-08 Thread matteocam
 include/svx/svdotext.hxx   |1 +
 svx/source/svdraw/svdotext.cxx |7 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 0a465a127873c94e16a7b98f3a834e8fd66b3232
Author: matteocam matteo.campane...@gmail.com
Date:   Mon Jun 8 20:14:37 2015 -0400

Defined IsChainable for SdrTextObj.

Change-Id: I3b7437590473e7f0464dfe89e0e43b2d453ed667

diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index 7583736..964ee43 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -354,6 +354,7 @@ public:
 // Chaining
 bool IsToBeChained() const;
 SdrTextObj *GetNextLinkInChain() const;
+bool IsChainable() const { return GetNextLinkInChain() != NULL; }
 
 SdrObjKind GetTextKind() const { return eTextKind; }
 
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 519c5f8..ec10858 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -2041,7 +2041,12 @@ SdrTextObj* SdrTextObj::GetNextLinkInChain() const
 SdrTextObj *pNextTextObj = NULL;
 
 if ( pPage  pPage-GetObjCount()  1) {
-int nextIndex = (GetOrdNum()+1) % pPage-GetObjCount();
+int nextIndex = (GetOrdNum()+1);
+// FIXME
+if (nextIndex = 3 || nextIndex = pPage-GetObjCount()) {
+fprintf(stderr, Object not chainable\n);
+return NULL;
+}
 pNextTextObj =  dynamic_cast SdrTextObj * ( pPage-GetObj( nextIndex 
) );
 
 return pNextTextObj;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-06-04 Thread matteocam
 include/svx/svdotext.hxx|1 +
 svx/source/svdraw/svdotextdecomposition.cxx |   12 ++--
 svx/source/svdraw/svdotxed.cxx  |5 -
 3 files changed, 15 insertions(+), 3 deletions(-)

New commits:
commit c3c510a4cb0bae1e9acf1e2b172540456094202b
Author: matteocam matteo.campane...@gmail.com
Date:   Fri Jun 5 01:54:10 2015 -0400

Non-overflowing text is moved when we exit editing

Change-Id: I4cab6c3363a2e58667599583d28a27cadb5266aa

diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index a93f087..75df5ed 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -606,6 +606,7 @@ public:
 const drawinglayer::geometry::ViewInformation2D aViewInformation) 
const;
 
 void impMoveChainedTextToNextLink(SdrTextObj *pNextTextObj) const;
+OutlinerParaObject *impGetNonOverflowingParaObject() const;
 void impLeaveOnlyNonOverflowingText() const;
 
 // Handler for Chained Text
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx 
b/svx/source/svdraw/svdotextdecomposition.cxx
index 802863f..6b7b630 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -728,7 +728,7 @@ void SdrTextObj::impDecomposeContourTextPrimitive(
 rTarget = aConverter.getPrimitive2DSequence();
 }
 
-void SdrTextObj::impLeaveOnlyNonOverflowingText() const
+OutlinerParaObject *SdrTextObj::impGetNonOverflowingParaObject() const
 {
 // Cut non overflowing text
 NonOverflowingText *pNonOverflowingTxt =
@@ -754,7 +754,12 @@ void SdrTextObj::impLeaveOnlyNonOverflowingText() const
 rOutliner.AddText(*pPObj);
 }
 
-OutlinerParaObject *pNewText = rOutliner.CreateParaObject();
+ return rOutliner.CreateParaObject();
+}
+
+void SdrTextObj::impLeaveOnlyNonOverflowingText() const
+{
+OutlinerParaObject *pNewText = impGetNonOverflowingParaObject();
 const_castSdrTextObj*(this)-SetOutlinerParaObject(pNewText);
 //const_castSdrTextObj*(this)-ReformatText();
 }
@@ -1540,6 +1545,9 @@ void SdrTextObj::impDecomposeChainedTextPrimitive(
 assert (pNextTextObj);
 // NOTE: Commented because we do not need to do this anymore (maybe 
and for now)
 //impMoveChainedTextToNextLink(pNextTextObj); // XXX: it actually 
moves the overflowing text currently
+
+// XXX:
+//const_castSdrTextObj*(this)-impLeaveOnlyNonOverflowingText();
 // Chaining occurred. Let's reset the status
 const_castSdrTextObj*(this)-SetToBeChained( false );
 
diff --git a/svx/source/svdraw/svdotxed.cxx b/svx/source/svdraw/svdotxed.cxx
index c0a5164..62e2c01 100644
--- a/svx/source/svdraw/svdotxed.cxx
+++ b/svx/source/svdraw/svdotxed.cxx
@@ -280,7 +280,10 @@ void SdrTextObj::EndTextEdit(SdrOutliner rOutl)
 // for now doing the same as below - probably we don't need
 // any more chain checks here but one single default behavior
 sal_Int32 nParaAnz = rOutl.GetParagraphCount();
-pNewText = rOutl.CreateParaObject( 0, nParaAnz );
+// XXX: FRESHLY COMMENTED (5/6/15) // FIXME:matteocam
+//pNewText = rOutl.CreateParaObject( 0, nParaAnz );
+
+pNewText = impGetNonOverflowingParaObject();
 
 // set non overflow part of text to current box
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-06-01 Thread matteocam
 include/svx/svdotext.hxx|1 
 svx/source/svdraw/svdotext.cxx  |2 
 svx/source/svdraw/svdotextdecomposition.cxx |   78 ++--
 3 files changed, 65 insertions(+), 16 deletions(-)

New commits:
commit 10690b5ffeedf8ab441b7057298fce8b1caa4581
Author: matteocam matteo.campane...@gmail.com
Date:   Mon Jun 1 12:46:10 2015 -0400

Stub of impCopyTextInTextObj2. Removed copying in EndTextEdit

Change-Id: Iff31d54c4ebcff9f50834105a9e1851179181e47

diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index a15a24d..1e50a68 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -605,6 +605,7 @@ public:
 const drawinglayer::geometry::ViewInformation2D aViewInformation) 
const;
 
 void impCopyTextInTextObj(SdrTextObj *pNextTextObj) const;
+void impCopyTextInTextObj2(SdrTextObj *pNextTextObj) const;
 
 // Handler for Chained Text
 DECL_LINK(ImpDecomposeChainedText,EditStatus*);
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 1695183..c0b59e8 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1966,7 +1966,7 @@ void SdrTextObj::onEditOutlinerStatusEvent( EditStatus* 
pEditStatus )
 if ( pEditStatus-IsPageOverflow() ) {
 mpOverflowingText = pEdtOutl-GetOverflowingParaObject();
 SdrTextObj *pNextTextObj = GetNextLinkInChain();
-impCopyTextInTextObj(pNextTextObj);
+impCopyTextInTextObj2(pNextTextObj);
 }
 
 }
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx 
b/svx/source/svdraw/svdotextdecomposition.cxx
index 5705da5..36fa13d 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -732,7 +732,9 @@ void SdrTextObj::embedText() const
 
 }
 
-void SdrTextObj::impCopyTextInTextObj(SdrTextObj *pNextTextObj) const
+// A new temporary implementation of impCopyTextInTextObj
+// Should implement the whole logic
+void SdrTextObj::impCopyTextInTextObj2(SdrTextObj *pNextTextObj) const
 {
 // prevent copying text in same box
 if ( this ==  pNextTextObj )
@@ -740,23 +742,33 @@ void SdrTextObj::impCopyTextInTextObj(SdrTextObj 
*pNextTextObj) const
 
 SdrOutliner rOutliner = ImpGetDrawOutliner();
 
-// append a string in front of everything
-// NOTE: Trying with set-text first
+
rOutliner.SetStatusEventHdl1(LINK(this,SdrTextObj,ImpDecomposeChainedText));
+
+struct OverflowingText {
+OUString headTxt;
+OutlinerParaObject *tailParas;
+};
 
 if (mpOverflowingText) {
-// Set text first
+// get first para of destination box
+// XXX: Check it exists
+
+// Get other paras of destination box
+// XXX: Check they exist
 
-rOutliner.SetText(*mpOverflowingText);
-Paragraph *pFstPara = rOutliner.GetParagraph(0);
-OUString aTxtFstPara = rOutliner.GetText(pFstPara);
 
-rOutliner.SetText(X + aTxtFstPara, pFstPara);
-// gets the whole thing
-OutlinerParaObject *pNewText = rOutliner.CreateParaObject();
-// draws everything - result = X ++ overflowingText
-pNextTextObj-NbcSetOutlinerParaObject(pNewText);
 }
 
+}
+
+
+void SdrTextObj::impCopyTextInTextObj(SdrTextObj *pNextTextObj) const
+{
+// prevent copying text in same box
+if ( this ==  pNextTextObj )
+return;
+
+SdrOutliner rOutliner = ImpGetDrawOutliner();
 
 /*
 // Code inspired by SvxOutlinerForwarder::AppendTextPortion
@@ -772,9 +784,44 @@ void SdrTextObj::impCopyTextInTextObj(SdrTextObj 
*pNextTextObj) const
 }
 * */
 
-   rOutliner.SetStatusEventHdl1(LINK(this,SdrTextObj,ImpDecomposeChainedText));
+
rOutliner.SetStatusEventHdl1(LINK(this,SdrTextObj,ImpDecomposeChainedText));
+
+// Push text through the chain if there's any
+
+// append a string in front of everything
+// NOTE: Trying with set-text first
+
+if (mpOverflowingText) {
+
+/* Desired behavior:
+ * - take first overflowing word and paragraph from there
+ * - Outliner::GetOverflowingPara should return the second overflowing 
para
+ * - then these two should pasted together (as below?)
+*/
+
+/*
+ * The goal is to have UpdateOverflowingParaNum be finer grained and
+ * work at level of lines instead of para-s
+*/
+
+// Set new text first
+rOutliner.SetText(*mpOverflowingText);
+
+/*
+ * We merge new text in front of the first paragraph
+ * so we get a pointer to it and its text.
+*/
+Paragraph *pFstPara = rOutliner.GetParagraph(0);
+OUString aTxtFstPara = rOutliner.GetText(pFstPara);
+
+//
+rOutliner.SetText(X + aTxtFstPara, pFstPara);
+// gets the whole thing
+OutlinerParaObject *pNewText = 

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

2014-07-31 Thread matteocam
 include/svx/svdotext.hxx |3 +
 svx/source/sdr/primitive2d/sdrdecompositiontools.cxx |3 -
 svx/source/svdraw/svdotextdecomposition.cxx  |   35 ++-
 svx/source/svdraw/svdotxed.cxx   |   11 +
 4 files changed, 18 insertions(+), 34 deletions(-)

New commits:
commit 6ae67a97b82445ab3e1cf0fd5cc3048d2d8308fb
Author: matteocam matteo.campane...@gmail.com
Date:   Thu Jul 31 21:47:38 2014 +0300

Only non overflown text kept for original box. No copying occurs.

Change-Id: Ic7b1afd8e4617baf69407338fcf233d24dee975e

diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index b5fa059..dce4166 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -214,6 +214,9 @@ public:
 const Point GetTextEditOffset() const { return maTextEditOffset; }
 void SetTextEditOffset(const Point rNew) { maTextEditOffset = rNew; }
 
+// FIXME(matteocam) // XXX: move as protected
+OutlinerParaObject *mpOverflowingText = NULL;
+
 protected:
 
 //FIXME(matteocam)
diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx 
b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
index b0d879c..a61e61e 100644
--- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
+++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
@@ -307,12 +307,9 @@ namespace drawinglayer
 }
 else if( rText.isToBeChained()  !rText.isInEditMode() ) // 
FIXME(matteocam)
 {
-//bool b = true; // XXX: Chained Text by default!
-//if (b)
 pNew = new SdrChainedTextPrimitive2D(
 rText.getSdrText(),
 rText.getOutlinerParaObject() );
-//else // end FIXME
 }
 else // text in range
 {
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx 
b/svx/source/svdraw/svdotextdecomposition.cxx
index 67a3fde7..ad2cfe6 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -1508,32 +1508,21 @@ void SdrTextObj::impDecomposeChainedTextPrimitive(
 const drawinglayer::primitive2d::SdrChainedTextPrimitive2D 
rSdrChainedTextPrimitive,
 const drawinglayer::geometry::ViewInformation2D aViewInformation) 
const
 {
-/* BEGIN Experiments */
 // FIXME(matteocam)
-
-// we use (text) object 0 and 1 for these experiments:
-// copying text from one to the other.
-
-SdrTextObj *pNextTextObj;
-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;
-}
-
-// for debugging purposes:
-// 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)); */
-impCopyTextInTextObj(pNextTextObj); // just do it
-//return;
-//}
+
+//impCopyTextInTextObj(pNextTextObj); // just do it
+
+// put overflowing text in next text box
+if (mpOverflowingText != NULL) {
+SdrTextObj *pNextTextObj = GetNextLinkInChain();
+//pNextTextObj-SetOutlinerParaObject( mpOverflowingText );
+
+//SdrOutliner rOutl = pNextTextObj-ImpGetDrawOutliner();
+//pNextTextObj-BegTextEdit( rOutl );
+// XXX: Also, will all those calls currently in impCopyTextInTextObj 
be necessary too?
+}
 
 drawinglayer::primitive2d::Primitive2DSequence aRetval(0);
 rTarget = aRetval;
diff --git a/svx/source/svdraw/svdotxed.cxx b/svx/source/svdraw/svdotxed.cxx
index f6d3fba..ec533bb 100644
--- a/svx/source/svdraw/svdotxed.cxx
+++ b/svx/source/svdraw/svdotxed.cxx
@@ -266,6 +266,9 @@ void SdrTextObj::EndTextEdit(SdrOutliner rOutl)
 // set non overflow part of text to current box
 pNewText = rOutl.GetNonOverflowingParaObject();
 pNextText = rOutl.GetOverflowingParaObject();
+// set overflowing text for SdrChainedTextPrimitive2D
+mpOverflowingText = pNextText;
+//SetOverflowingText( pNextText );
 
 // XXX: should this SdrTextObj know how much text to ask by 
CreateParaObject?
 //  No, it must be the editengine (or outliner) to give it 
since it is
@@ -292,14 +295,6 @@ void SdrTextObj::EndTextEdit(SdrOutliner rOutl)
 nStat = ~EE_CNTRL_AUTOPAGESIZE;
 rOutl.SetControlWord(nStat);
 
-// sets text to next box
-if (pNextText != NULL) {
-SdrTextObj *pNextTextObj = GetNextLinkInChain();
-pNextTextObj-SetOutlinerParaObject( pNextText );
-pNextTextObj-BegTextEdit( rOutl );
-// XXX: Also,