summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormatteocam <matteo.campanelli@gmail.com>2015-09-07 12:44:37 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2015-09-20 13:05:15 +0200
commit5b04c453cc03c0d2c6067625242f07deb8f78ba0 (patch)
tree448a77bb49fdeda0f83b2d6b92982d3c3992f6c6
parentchained editeng: Change size settings if box is chainable (diff)
downloadcore-5b04c453cc03c0d2c6067625242f07deb8f78ba0.tar.gz
core-5b04c453cc03c0d2c6067625242f07deb8f78ba0.zip
chained editeng: Change EndTextEdit behavior to support recursive overflow
Change-Id: I14009fa2e91b19a850e45484de7cd234e872689a
-rw-r--r--svx/source/svdraw/svdotxed.cxx51
1 files changed, 49 insertions, 2 deletions
diff --git a/svx/source/svdraw/svdotxed.cxx b/svx/source/svdraw/svdotxed.cxx
index c68b085bb43e..4e070276ae6d 100644
--- a/svx/source/svdraw/svdotxed.cxx
+++ b/svx/source/svdraw/svdotxed.cxx
@@ -23,10 +23,12 @@
#include <svx/svdoutl.hxx>
#include <editeng/editdata.hxx>
#include <editeng/outliner.hxx>
+#include <editeng/overflowingtxt.hxx>
#include <editeng/editstat.hxx>
#include <svl/itemset.hxx>
#include <editeng/eeitem.hxx>
#include <svx/sdtfchim.hxx>
+#include <svx/textchain.hxx>
bool SdrTextObj::HasTextEdit() const
@@ -126,6 +128,19 @@ bool SdrTextObj::BegTextEdit(SdrOutliner& rOutl)
return true;
}
+void ImpUpdateOutlParamsForOverflow(SdrOutliner *pOutl, SdrTextObj *pTextObj)
+{
+ // Code from ImpSetTextEditParams
+ Size aPaperMin;
+ Size aPaperMax;
+ Rectangle aEditArea;
+ pTextObj->TakeTextEditArea(&aPaperMin,&aPaperMax,&aEditArea,NULL);
+
+ pOutl->SetMinAutoPaperSize(aPaperMin);
+ pOutl->SetMaxAutoPaperSize(aPaperMax);
+ pOutl->SetPaperSize(Size());
+}
+
void SdrTextObj::TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, Rectangle* pViewInit, Rectangle* pViewMin) const
{
bool bFitToSize(IsFitToSize());
@@ -263,9 +278,10 @@ void SdrTextObj::TakeTextEditArea(Size* pPaperMin, Size* pPaperMax, Rectangle* p
void SdrTextObj::EndTextEdit(SdrOutliner& rOutl)
{
+ OutlinerParaObject* pNewText = NULL;
+
if(rOutl.IsModified())
{
- OutlinerParaObject* pNewText = NULL;
// to make the gray field background vanish again
rOutl.UpdateFields();
@@ -277,8 +293,39 @@ void SdrTextObj::EndTextEdit(SdrOutliner& rOutl)
// uses GetCurrentBoundRect() which needs to take the text into account
// to work correct
mbInEditMode = false;
- SetOutlinerParaObject(pNewText);
+
+ // We don't want broadcasting if we are merely trying to move to next box (this prevents infinite loops)
+ if (IsChainable() && GetTextChain()->GetSwitchingToNextBox(this)) {
+ GetTextChain()->SetSwitchingToNextBox(this, false);
+ if( getActiveText() )
+ getActiveText()->SetOutlinerParaObject( pNewText);
+ } else { // If we are not doing in-chaining switching just set the ParaObject
+ SetOutlinerParaObject(pNewText);
+ }
+ }
+
+ /* Beginning Chaining-related code */
+ rOutl.ClearOverflowingParaNum();
+
+ /* Flush overflow for next textbox - Necessary for recursive chaining */
+ if (false &&
+ IsChainable() &&
+ GetNextLinkInChain() &&
+ GetTextChain()->GetPendingOverflowCheck(GetNextLinkInChain()) )
+ {
+ GetTextChain()->SetPendingOverflowCheck(GetNextLinkInChain(), false);
+
+ SdrOutliner rDrawOutl = GetNextLinkInChain()->ImpGetDrawOutliner();
+ // Prepare Outliner for overflow check
+ ImpUpdateOutlParamsForOverflow(&rDrawOutl, GetNextLinkInChain());
+ const OutlinerParaObject *pObj = GetNextLinkInChain()->GetOutlinerParaObject();
+ rDrawOutl.SetText(*pObj);
+
+ rDrawOutl.SetUpdateMode(true);
+ // XXX: Change name of method below to impHandleChainingEventsNonEditMode
+ GetNextLinkInChain()->impHandleChainingEventsDuringDecomposition(rDrawOutl);
}
+ /* End Chaining-related code */
pEdtOutl = NULL;
rOutl.Clear();