[Libreoffice-commits] core.git: Branch 'feature/gsoc14-draw-chained-text-boxes' - include/svx svx/source
matteocam
matteo.campanelli at gmail.com
Sun Jun 28 23:20:38 PDT 2015
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.campanelli at 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_cast<SdrTextObj*>(this), true);
+
+ aTxtChainFlow.ExecuteOverflow(&aDrawOutliner, &aDrawOutliner);
+ }
+ // Probably not necessary
+ //else {
+ // // No overflow: set the whole thing
+ // const_cast<SdrTextObj*>(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);
}
More information about the Libreoffice-commits
mailing list