[Libreoffice-commits] core.git: Branch 'feature/gsoc14-draw-chained-text-boxes' - editeng/source svx/source
matteocam
matteo.campanelli at gmail.com
Mon Jun 1 13:36:18 PDT 2015
editeng/source/editeng/impedit.hxx | 6 ++--
editeng/source/editeng/impedit3.cxx | 40 ++++++++++++++++++++++++----
svx/source/svdraw/svdotextdecomposition.cxx | 2 -
3 files changed, 40 insertions(+), 8 deletions(-)
New commits:
commit 10c03833f92274e5cbb063ccec910a2b379341fa
Author: matteocam <matteo.campanelli at gmail.com>
Date: Mon Jun 1 16:35:43 2015 -0400
Can detect first line of overflowing
Change-Id: I18f4f00a49be9b257ea8d3f5acb7e811905b1548
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 559a1dd..6eabd9c 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -466,6 +466,7 @@ private:
// For Chaining
sal_Int32 mnOverflowingPara = -1;
+ sal_Int32 mnOverflowingLine = -1;
IdleFormattter aIdleFormatter;
@@ -691,6 +692,8 @@ private:
const ParaPortionList& GetParaPortions() const { return aParaPortionList; }
ParaPortionList& GetParaPortions() { return aParaPortionList; }
+ void ImplUpdateOverflowingParaNum( sal_uInt32 );
+ void ImplUpdateOverflowingLineNum( sal_uInt32, sal_uInt32, sal_uInt32 );
protected:
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
@@ -1028,9 +1031,8 @@ public:
bool IsFirstWordCapitalization() const { return bFirstWordCapitalization; }
sal_Int32 GetOverflowingParaNum() const { return mnOverflowingPara; }
- void SetOverflowingParaNum(sal_Int32 nPara) { mnOverflowingPara = nPara; }
+ sal_Int32 GetOverflowingLineNum() const { return mnOverflowingLine; }
void ClearOverflowingParaNum() { mnOverflowingPara = -1; }
- void UpdateOverflowingParaNum( sal_uInt32 );
};
inline EPaM ImpEditEngine::CreateEPaM( const EditPaM& rPaM )
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 3f8895f..54554af 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -617,10 +617,12 @@ void ImpEditEngine::CheckPageOverflow()
fprintf(stderr, "[OVERFLOW-CHECK] Current MaxAutoPaperSize is %d\n", nBoxHeight);
fprintf(stderr, "[CONTROL_STATUS] AutoPageSize is %s", ( aStatus.GetControlWord() & EE_CNTRL_AUTOPAGESIZE ) ? "ON\n" : "OFF\n" );
- if (CalcTextHeight(NULL) > nBoxHeight)
+ sal_uInt32 nTxtHeight = CalcTextHeight(NULL);
+
+ if (nTxtHeight > nBoxHeight)
{
// which paragraph is the first to cause higher size of the box?
- UpdateOverflowingParaNum( nBoxHeight); // XXX: currently only for horizontal text
+ ImplUpdateOverflowingParaNum( nBoxHeight); // XXX: currently only for horizontal text
aStatus.SetPageOverflow(true);
} else
{
@@ -4632,7 +4634,7 @@ void ImpEditEngine::ImplExpandCompressedPortions( EditLine* pLine, ParaPortion*
}
}
-void ImpEditEngine::UpdateOverflowingParaNum(sal_uInt32 nPaperHeight)
+void ImpEditEngine::ImplUpdateOverflowingParaNum(sal_uInt32 nPaperHeight)
{
sal_uInt32 nY = 0;
sal_uInt32 nPH;
@@ -4643,11 +4645,39 @@ void ImpEditEngine::UpdateOverflowingParaNum(sal_uInt32 nPaperHeight)
nY += nPH;
if ( nY > nPaperHeight /*nCurTextHeight*/ ) // found first paragraph overflowing
{
- SetOverflowingParaNum( nPara );
- fprintf(stderr, "[CHAINING] Setting first overflowing para: %d\n", nPara);
+ mnOverflowingPara = nPara;
+ fprintf(stderr, "[CHAINING] Setting first overflowing #Para#: %d\n", nPara);
+ ImplUpdateOverflowingLineNum( nPaperHeight, nPara, nY-nPH);
return;
}
}
}
+void ImpEditEngine::ImplUpdateOverflowingLineNum(sal_uInt32 nPaperHeight,
+ sal_uInt32 nOverflowingPara,
+ sal_uInt32 nHeightBeforeOverflowingPara)
+{
+ sal_uInt32 nY = nHeightBeforeOverflowingPara;
+ sal_uInt32 nLH;
+
+ ParaPortion *pPara = GetParaPortions()[nOverflowingPara];
+
+ // Like UpdateOverflowingParaNum but for each line in the first
+ // overflowing paragraph.
+ for ( sal_Int32 nLine = 0; nLine < pPara->GetLines().Count(); nLine++ ) {
+ EditLine *pLine = pPara->GetLines()[nLine];
+ nLH = pLine->GetHeight();
+ nY += nLH;
+ if ( nY > nPaperHeight ) // found first line overflowing
+ {
+ mnOverflowingLine = nLine;
+ fprintf(stderr, "[CHAINING] Setting first overflowing -Line- to: %d\n", nLine);
+ return;
+ }
+ }
+
+
+
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index 6f29f26..bf81c09 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -762,7 +762,7 @@ void SdrTextObj::impCopyTextInTextObj2(SdrTextObj *pNextTextObj) const
};
OverflowingText aOverflowingTxt =
- OverflowingText("headTxt (On its own) ", NULL, "I'm Appended to #");
+ OverflowingText("headTxt (On its own)", NULL, "I'm Appended to #");
if (mpOverflowingText) {
// XXX: Not sure if necessary
More information about the Libreoffice-commits
mailing list