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

2015-07-10 Thread matteocam
 include/svx/svdotext.hxx|2 +-
 svx/source/svdraw/svdedxv.cxx   |5 +
 svx/source/svdraw/svdotext.cxx  |   31 +--
 svx/source/svdraw/textchainflow.cxx |6 ++
 4 files changed, 29 insertions(+), 15 deletions(-)

New commits:
commit 9ea78c59302bc8b7451aa886e8894610c9c34140
Author: matteocam matteo.campane...@gmail.com
Date:   Fri Jul 10 16:17:58 2015 -0400

Fixed some errors and removed recursive static drawing

Change-Id: I8098dbed7a711b4dad31add1e2ec76d163d0d371

diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index ceeb633..4ab6313 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -367,7 +367,7 @@ public:
 // Chaining
 bool IsToBeChained() const;
 SdrTextObj *GetNextLinkInChain() const;
-bool IsChainable() const { return GetNextLinkInChain() != NULL; }
+bool IsChainable() const;
 void SetPreventChainable();
 bool GetPreventChainable() const;
 TextChain *GetTextChain() const;
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 80bd5ff..3abebed 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -491,6 +491,11 @@ IMPL_LINK_NOARG(SdrObjEditView,ImpChainingEventHdl)
 if( pTextObj  pOLV)
 {
 TextChain *pTextChain = pTextObj-GetTextChain();
+
+ // XXX: IsChainable and GetNilChainingEvent are a bit mixed up atm
+if (!pTextObj-IsChainable()) {
+return 0;
+}
 // This is true during an underflow-caused overflow (with 
pEdtOutl-SetText())
 if (pTextChain-GetNilChainingEvent(pTextObj)) {
 return 0;
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index afa40df..567afd9 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1566,8 +1566,8 @@ void SdrTextObj::SetToBeChained(bool bToBeChained)
 
 TextChain *SdrTextObj::GetTextChain() const
 {
-if (!IsChainable())
-return NULL;
+//if (!IsChainable())
+//return NULL;
 
 return pModel-GetTextChain();
 }
@@ -1984,11 +1984,23 @@ void SdrTextObj::onEditOutlinerStatusEvent( EditStatus* 
pEditStatus )
 }
 }
 
-void SdrTextObj::onChainingEvent()
+bool SdrTextObj::IsChainable() const
 {
-if (!IsChainable() || GetNextLinkInChain() == NULL)
-return;
+if (!GetName().startsWith(Chainable)) {
+fprintf(stderr, [CHAINABLE?] %p is _not_ chainable\n, this);
+return false;
+}
 
+// Check that no overflow is going on
+if (!GetTextChain() || GetTextChain()-GetNilChainingEvent(this))
+return false;
+
+return true;
+
+}
+
+void SdrTextObj::onChainingEvent()
+{
 if (!pEdtOutl)
 return;
 
@@ -2073,17 +2085,8 @@ 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)) {
-fprintf(stderr, [CHAINABLE?] %p is _not_ chainable\n, this);
-return NULL;
-}
-
 sal_uInt32 nextIndex = (GetOrdNum()+1);
 
 if (nextIndex  pPage-GetObjCount())
diff --git a/svx/source/svdraw/textchainflow.cxx 
b/svx/source/svdraw/textchainflow.cxx
index c7531f1..8907e3a 100644
--- a/svx/source/svdraw/textchainflow.cxx
+++ b/svx/source/svdraw/textchainflow.cxx
@@ -145,8 +145,14 @@ void TextChainFlow::ExecuteUnderflow(SdrOutliner *pOutl)
 if (!mpTargetLink-GetPreventChainable())
 mpNextLink-NbcSetOutlinerParaObject(pOutl-GetEmptyParaObject());
 
+// We store the size since NbcSetOutlinerParaObject can change it
+Size aOldSize = pOutl-GetMaxAutoPaperSize();
+
 mpTargetLink-NbcSetOutlinerParaObject(pNewText);
 
+pOutl-SetMaxAutoPaperSize(aOldSize);
+pOutl-SetText(*pNewText);
+
 //GetTextChain()-SetNilChainingEvent(mpTargetLink, false);
 
 // Check for new overflow
commit cbd8c9dcfd45329cc7afa0b5e17f6363e2254d3f
Author: matteocam matteo.campane...@gmail.com
Date:   Fri Jul 10 13:36:50 2015 -0400

Revert Revert Prevent multiple chaining events for static text

This reverts commit f2497029a458b6f33e62776c09f23227c7b3407d.

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 

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

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

New commits:
commit b77be468428db23301b14a091bfa758f17789934
Author: matteocam matteo.campane...@gmail.com
Date:   Tue Jul 29 03:04:15 2014 +0300

ToBeChained status added to SdrTextObj

Change-Id: If7c7bd4384aeb705ba52eee5465c2b5aee78b1d9

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