include/editeng/overflowingtxt.hxx | 2 - include/svx/svdotext.hxx | 7 ++- svx/source/svdraw/svdotext.cxx | 22 +++++++++++ svx/source/svdraw/svdotextdecomposition.cxx | 55 +++++++++------------------- 4 files changed, 46 insertions(+), 40 deletions(-)
New commits: commit 9aa0cc23f6e7fcf7bad76ec66bec397bb1267b31 Author: matteocam <[email protected]> Date: Mon Jun 15 14:20:20 2015 -0400 Prevent decomposition primitives to be called recursively Change-Id: Iab626d01c7b2850feb1f5d792373615a65e32070 diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index 6a0e40d..b030462 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -775,6 +775,7 @@ OutlinerParaObject *SdrTextObj::impGetNonOverflowingParaObject(SdrOutliner *pOut return pOutliner->CreateParaObject(); } +/* Following function should not be called while decomposing static text */ void SdrTextObj::impLeaveOnlyNonOverflowingText(SdrOutliner *pOutliner) const { OutlinerParaObject *pNewText = impGetNonOverflowingParaObject(pOutliner); @@ -1566,36 +1567,6 @@ void SdrTextObj::impDecomposeChainedTextPrimitive( const drawinglayer::primitive2d::SdrChainedTextPrimitive2D& rSdrChainedTextPrimitive, const drawinglayer::geometry::ViewInformation2D& aViewInformation) const { - /* // Previous code - To maybe be resumed later on - // FIXME(matteocam) - // fprintf(stderr, "Object #0 = %p, Object #1 = %p\n", - // pPage->GetObj(0), pPage->GetObj(1)); - - //impMoveChainedTextToNextLink(pNextTextObj); // just do it - - // put overflowing text in next text box - if (IsToBeChained()) { - SdrTextObj *pNextTextObj = GetNextLinkInChain(); - 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_cast<SdrTextObj*>(this)->impLeaveOnlyNonOverflowingText(); - // Let's reset the status now to prevent infinite loops - const_cast<SdrTextObj*>(this)->SetToBeChained( false ); - impLeaveOnlyNonOverflowingText(); - - //SdrOutliner rOutl = pNextTextObj->ImpGetDrawOutliner(); - //pNextTextObj->BegTextEdit( rOutl ); - // XXX: Also, will all those calls currently in impMoveChainedTextToNextLink be necessary too? - - }*/ - - /* -- Beginning code from impDecomposeAutoFitText -- */ - // XXX: The idea is, _for_now_, to do exactly what it does there but without the text stretching, - // hopefully to get a "neutral" decomposition - // decompose matrix to have position and size of text basegfx::B2DVector aScale, aTranslate; double fRotate, fShearX; @@ -1659,13 +1630,21 @@ void SdrTextObj::impDecomposeChainedTextPrimitive( if ( rOutliner.IsPageOverflow() && !IsInEditMode()) { // Save the overflowing text before changing the outliner's state const_cast<SdrTextObj*>(this)->mpOverflowingText = rOutliner.GetOverflowingText(); - impLeaveOnlyNonOverflowingText(&rOutliner); + + /* Leave only non overflowing text */ + OutlinerParaObject *pNewTextCurBox = impGetNonOverflowingParaObject(&rOutliner); + // we need this when we are in editing mode + // XXX: we use next line just to be sure for now + if (pEdtOutl != NULL) + pEdtOutl->SetText(*pNewTextCurBox); + // adds it to current outliner anyway (useful in static decomposition) + rOutliner.SetText(*pNewTextCurBox); /* Get chaining outliner here */ // Code adapted from ImpGetDrawOutliner SdrOutliner &rChainingOutl = pModel->GetChainingOutliner(this); ImpInitDrawOutliner( rChainingOutl ); - rOutliner.SetUpdateMode(true); + rChainingOutl.SetUpdateMode(true); /* Transfer of text to next link */ if (GetNextLinkInChain() commit b570fb9b63b01823d99345736e55385fcc1734fc Author: matteocam <[email protected]> Date: Fri Jun 12 12:11:37 2015 -0400 Special case of dragging handled. Transfer of text by decomposition prevented Change-Id: Ib84d087a73e957583047a3206171dfe3ab906b7f diff --git a/include/editeng/overflowingtxt.hxx b/include/editeng/overflowingtxt.hxx index 1546835..973729f 100644 --- a/include/editeng/overflowingtxt.hxx +++ b/include/editeng/overflowingtxt.hxx @@ -56,7 +56,7 @@ class NonOverflowingText { mPreOverflowingTxt(preOverflowingTxt) { if (pHeadParas == NULL) // Redundant line for debugging - DBG_ASSERT( pHeadParas != NULL, "pHeadParas is null?!" ); + DBG_ASSERT( pHeadParas != NULL, "pHeadParas is null?! All text is overflowing then" ); } }; diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx index 0bb58c5..9fd6262 100644 --- a/include/svx/svdotext.hxx +++ b/include/svx/svdotext.hxx @@ -215,8 +215,11 @@ public: const Point& GetTextEditOffset() const { return maTextEditOffset; } void SetTextEditOffset(const Point& rNew) { maTextEditOffset = rNew; } + virtual SdrObject* getFullDragClone() const SAL_OVERRIDE; + protected: OverflowingText *mpOverflowingText = NULL; + bool mbIsUnchainableClone = false; //FIXME(matteocam) // the successor in a chain @@ -353,6 +356,8 @@ public: bool IsToBeChained() const; SdrTextObj *GetNextLinkInChain() const; bool IsChainable() const { return GetNextLinkInChain() != NULL; } + void SetPreventChainable(); + bool GetPreventChainable() const; SdrObjKind GetTextKind() const { return eTextKind; } diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index cef2fff..03b8388 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -2060,6 +2060,28 @@ SdrTextObj* SdrTextObj::GetNextLinkInChain() const } +void SdrTextObj::SetPreventChainable() +{ + mbIsUnchainableClone = true; +} + +bool SdrTextObj::GetPreventChainable() const +{ + return mbIsUnchainableClone; +} + + SdrObject* SdrTextObj::getFullDragClone() const + { + SdrObject *pClone = SdrAttrObj::getFullDragClone(); + SdrTextObj *pTextObjClone = dynamic_cast<SdrTextObj *>(pClone); + if (pTextObjClone != NULL) { + // Avoid transferring of text for chainable object during dragging + pTextObjClone->SetPreventChainable(); + } + + return pClone; + } + IMPL_LINK(SdrTextObj,ImpDecomposeChainedText,bool*,bIsPageOverflow) { onOverflowStatusEvent( *bIsPageOverflow ); diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index 1f845c8..6a0e40d 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -1655,7 +1655,8 @@ void SdrTextObj::impDecomposeChainedTextPrimitive( /* Begin overflow handling */ // If overflow occurs we have to cut the text at the right point - if ( rOutliner.IsPageOverflow() ) { + // If in edit mode ImpEditEngine should have taken care of this + if ( rOutliner.IsPageOverflow() && !IsInEditMode()) { // Save the overflowing text before changing the outliner's state const_cast<SdrTextObj*>(this)->mpOverflowingText = rOutliner.GetOverflowingText(); impLeaveOnlyNonOverflowingText(&rOutliner); @@ -1666,10 +1667,12 @@ void SdrTextObj::impDecomposeChainedTextPrimitive( ImpInitDrawOutliner( rChainingOutl ); rOutliner.SetUpdateMode(true); - /* Actual transfer of text */ - - if (GetNextLinkInChain()) + /* Transfer of text to next link */ + if (GetNextLinkInChain() + && !GetPreventChainable() ) // we don't transfer text while dragging because of resizing + { impMoveChainedTextToNextLink(&rChainingOutl, GetNextLinkInChain()); + } } /* End overflow handling */ commit ae8b6ee72f72f11b015a4673e81ca8b2945dcf5f Author: matteocam <[email protected]> Date: Fri Jun 12 10:27:33 2015 -0400 mpOverflowingText moved as protected member Change-Id: I5f3ec0447c16e3939d30474396fea0952b13d7f0 diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx index 0552029..0bb58c5 100644 --- a/include/svx/svdotext.hxx +++ b/include/svx/svdotext.hxx @@ -215,10 +215,8 @@ public: const Point& GetTextEditOffset() const { return maTextEditOffset; } void SetTextEditOffset(const Point& rNew) { maTextEditOffset = rNew; } - // FIXME(matteocam) // XXX: move as protected - OverflowingText *mpOverflowingText = NULL; - protected: + OverflowingText *mpOverflowingText = NULL; //FIXME(matteocam) // the successor in a chain diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index 748e980..1f845c8 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -1660,7 +1660,6 @@ void SdrTextObj::impDecomposeChainedTextPrimitive( const_cast<SdrTextObj*>(this)->mpOverflowingText = rOutliner.GetOverflowingText(); impLeaveOnlyNonOverflowingText(&rOutliner); - // XXX: Order transfer of stuff in next link here /* Get chaining outliner here */ // Code adapted from ImpGetDrawOutliner SdrOutliner &rChainingOutl = pModel->GetChainingOutliner(this); _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
