[Libreoffice-commits] core.git: Branch 'feature/gsoc14-draw-chained-text-boxes' - svx/source
matteocam
matteo.campanelli at gmail.com
Mon Jun 22 11:51:52 PDT 2015
svx/source/svdraw/svdotext.cxx | 106 ++++++++++++++++++++++-------------------
1 file changed, 59 insertions(+), 47 deletions(-)
New commits:
commit 80b60bbf45c56e7a61ecfc6d015ca7e1b2d43f9f
Author: matteocam <matteo.campanelli at gmail.com>
Date: Mon Jun 22 14:51:08 2015 -0400
Another FSM; passing by UF temporarily while in UF-caused OF
Change-Id: I994011dc8962b8b8c915ec129f88e56874587a36
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 02c1519..49ef5b2 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1974,16 +1974,12 @@ void SdrTextObj::onOverflowStatusEvent( )
// 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)) {
- // XXX: Maybe you can get this info directly from editing outl?
OutlinerParaObject *pPObj = GetOutlinerParaObject();
aDrawOutliner.SetUpdateMode(true);
aDrawOutliner.SetMaxAutoPaperSize(pEdtOutl->GetMaxAutoPaperSize());
aDrawOutliner.SetText(*pPObj);
aDrawOutliner.IsPageOverflow(); // Check for overflow to set flags
mpOverflowingText = aDrawOutliner.GetOverflowingText();
-
- // reset underflow handling
- GetTextChain()->SetLinkHandlingUnderflow(this, false);
} else if (pEdtOutl != NULL)
mpOverflowingText = pEdtOutl->GetOverflowingText();
else {
@@ -1993,6 +1989,21 @@ 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);
@@ -2054,6 +2065,50 @@ void SdrTextObj::onUnderflowStatusEvent( )
}
}
+
+void SdrTextObj::onChainingEvent()
+{
+ if (!IsChainable() || GetNextLinkInChain() == NULL)
+ return;
+
+ if (!pEdtOutl)
+ return;
+
+
+ if (GetTextChain()->GetNilChainingEvent(this)) {
+ GetTextChain()->SetNilChainingEvent(this, false);
+ return;
+ }
+
+ 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();
+ }
+
+ // Propagates the need for change
+ SetToBeChained( bIsPageOverflow );
+ fprintf(stderr, "[CHAINING] Need for Chaining is %s\n",
+ bIsPageOverflow ? "TRUE" : "FALSE");
+
+ if ( bIsPageOverflow ) {
+ onOverflowStatusEvent();
+ } else {
+ onUnderflowStatusEvent();
+ }
+ return;
+}
+
+
/** returns the currently active text. */
SdrText* SdrTextObj::getActiveText() const
{
@@ -2147,49 +2202,6 @@ bool SdrTextObj::GetPreventChainable() const
return pClone;
}
-void SdrTextObj::onChainingEvent()
-{
- if (!IsChainable() || GetNextLinkInChain() == NULL)
- return;
-
- if (!pEdtOutl)
- return;
-
-
- if (GetTextChain()->GetNilChainingEvent(this)) {
- GetTextChain()->SetNilChainingEvent(this, false);
- return;
- }
-
- 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();
- }
-
- // Propagates the need for change
- SetToBeChained( bIsPageOverflow );
- fprintf(stderr, "[CHAINING] Need for Chaining is %s\n",
- bIsPageOverflow ? "TRUE" : "FALSE");
-
- if ( bIsPageOverflow ) {
- onOverflowStatusEvent();
- } else {
- onUnderflowStatusEvent();
- }
- return;
-}
-
-
// The concept of the text object:
// ~~~~~~~~~~~~~~~~~~~~~~~~
More information about the Libreoffice-commits
mailing list