svx/source/svdraw/svdotext.cxx | 55 ++++++++++++++++++---------- svx/source/svdraw/svdotextdecomposition.cxx | 5 +- 2 files changed, 40 insertions(+), 20 deletions(-)
New commits: commit 5c5e9a24af2fc406234145a0bc99ec1ac8c8c2c6 Author: matteocam <matteo.campane...@gmail.com> Date: Mon Jun 22 16:56:34 2015 -0400 Handle UF and consequent OF in the same pass in editing mode Change-Id: Ic46137a666342d9cea99973fc1ce1a3ff759824a diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index 49ef5b2..df1a01b 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -2036,33 +2036,52 @@ void SdrTextObj::onUnderflowStatusEvent( ) // 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(); - if (pNextLinkWholeText) { - OutlinerParaObject *pCurText; + if (!pNextLinkWholeText) + return; + + OutlinerParaObject *pCurText; - pCurText = pEdtOutl->CreateParaObject(); + pCurText = pEdtOutl->CreateParaObject(); - // NewTextForCurBox = Txt(CurBox) ++ Txt(NextBox) - aDrawOutliner.SetText(*pCurText); - aDrawOutliner.AddText(*pNextLinkWholeText); - OutlinerParaObject *pNewText = aDrawOutliner.CreateParaObject(); + // NewTextForCurBox = Txt(CurBox) ++ Txt(NextBox) + // prepare for checking overflow + aDrawOutliner.SetUpdateMode(true); + aDrawOutliner.SetMaxAutoPaperSize(pEdtOutl->GetMaxAutoPaperSize()); + aDrawOutliner.SetText(*pCurText); + aDrawOutliner.AddText(*pNextLinkWholeText); - // 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); + bool bIsOverflowFromUnderflow = aDrawOutliner.IsPageOverflow(); - // We make sure we don't handle underflow while handling underflow - GetTextChain()->SetLinkHandlingUnderflow(this, true); + OutlinerParaObject *pNewText = aDrawOutliner.CreateParaObject(); - // Set the other box empty so if overflow does not occur we are fine - pNextLink->NbcSetOutlinerParaObject(aDrawOutliner.GetEmptyParaObject()); + // 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); - /* - if (pEdtOutl != NULL) - pEdtOutl->SetText(*pNewText); - */ + // 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_cast<SdrTextObj*>(this), true); + impLeaveOnlyNonOverflowingText(&aDrawOutliner); + impMoveChainedTextToNextLink(&aDrawOutliner, pNextLink); + } else { const_cast<SdrTextObj*>(this)->SetOutlinerParaObject(pNewText); } + + /* + if (pEdtOutl != NULL) + pEdtOutl->SetText(*pNewText); + */ + + // Don't need this if handling everything here + //const_cast<SdrTextObj*>(this)->SetOutlinerParaObject(pNewText); + } diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index 6b00aacc..2ad4c40 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -783,10 +783,11 @@ void SdrTextObj::impLeaveOnlyNonOverflowingText(SdrOutliner *pOutliner) const { OutlinerParaObject *pNewText = impGetNonOverflowingParaObject(pOutliner); - bool bInUnderflow = GetTextChain()->GetLinkHandlingUnderflow(const_cast<SdrTextObj*>(this)); + //bool bInUnderflow = GetTextChain()->GetLinkHandlingUnderflow(const_cast<SdrTextObj*>(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 /* && !bInUnderflow */) { pEdtOutl->SetText(*pNewText); + } // adds it to current outliner anyway (useful in static decomposition) pOutliner->SetText(*pNewText); /*if (bInUnderflow) // must make a broadcast to reset underflow (XXX: can I reset it from here?) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits