Update contrib.
2 * Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
22 #include "OstTraceDefinitions.h"
23 #ifdef OST_TRACE_COMPILER_IN_USE
24 #include "FormLinePagTraces.h"
27 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
28 #include "FRMCONST_INTERNAL.H"
29 #include "FRMCONST_PARTNER.H"
32 TLinePaginator::TLinePaginator():
45 TBool TLinePaginator::AppendLineL(TPageLine aLine)
48 TBool pageBreak=EFalse;
50 if(aLine.iStartNewPage && !iFirstLine)
52 SetPotentialBreakPoint(aLine.iDocPos);
59 SetPotentialBreakPoint(aLine.iDocPos);
60 if (iHeightRem<iHeightLines+aLine.iLineHeight /*&& !iFirstLine*/)
63 //__ASSERT_DEBUG(!iFirstLine || !iBreakOnPage,Panic()); //###
67 if (aLine.iLineHeight > iHeightRem)
71 SetPotentialBreakPoint(aLine.iDocPos);
74 CheckTallLineL(aLine);
81 SetPotentialBreakPoint(aLine.iDocPos);
84 CheckTallLineL(aLine); //This picks up tall lines at the start of the document the above one picks up the rest
90 iHeightLines+=aLine.iLineHeight;
91 iKeepWithPrev=aLine.iKeepWithNext;
95 void TLinePaginator::InsertPageBreakL()
98 iHeightRem=iPageHeight;
100 TInt deltaDocPos=iDocPos-iPrevPageBreak;
103 OstTrace0( TRACE_DUMP, TLINEPAGINATOR_INSERTPAGEBREAKL, "EFInvalidNumberCharsOnPage" );
105 __ASSERT_DEBUG(deltaDocPos>0,FormPanic(EFInvalidNumberCharsOnPage));
106 iPageList->AppendL(deltaDocPos);
107 iPrevPageBreak=iDocPos;
110 void TLinePaginator::CheckTallLineL(TPageLine& aLine)
112 while (aLine.iLineHeight>iPageHeight)
114 aLine.iLineHeight-=iPageHeight;
115 iPageList->AppendL(0);
119 void TLinePaginator::FlushL(TInt aEndDocPos)
121 SetPotentialBreakPoint(aEndDocPos);
125 void TLinePaginator::SetPageHeight(TInt aPageHeight)
127 iPageHeight=aPageHeight;
128 iHeightRem=aPageHeight;
132 // It is expected that the array passed in will be an empty one
133 void TLinePaginator::SetArray(CArrayFix<TInt>* aCharsPerPage)
135 iPageList=aCharsPerPage;
137 // reset if the array is not (for some reason) already cleared.
138 if (iPageList->Count() > 0)
142 void TLinePaginator::Reset()
146 iPrevPageBreak=iDocPos=0;
148 iHeightRem=iPageHeight;
153 void TLinePaginator::ResetArray()
156 iPageList->Compress();
159 void TLinePaginator::SetPotentialBreakPoint(TInt aDocPos)
163 iHeightRem-=iHeightLines;