27 #include "FRMCONST_PARTNER.H" |
27 #include "FRMCONST_PARTNER.H" |
28 #include "TAGMA_INTERNAL.H" |
28 #include "TAGMA_INTERNAL.H" |
29 #include "FRMTLAY_INTERNAL.H" |
29 #include "FRMTLAY_INTERNAL.H" |
30 #endif |
30 #endif |
31 |
31 |
|
32 #include "OstTraceDefinitions.h" |
|
33 #ifdef OST_TRACE_COMPILER_IN_USE |
|
34 #include "LAYEMUTraces.h" |
|
35 #endif |
|
36 |
32 const TInt KMaxExtraLines = 10; // maximum number of lines to format after the current and following lines |
37 const TInt KMaxExtraLines = 10; // maximum number of lines to format after the current and following lines |
33 // before using background formatting |
38 // before using background formatting |
34 // during page down/up, the number of lines that should remain visible after |
39 // during page down/up, the number of lines that should remain visible after |
35 // the scroll, counting from the first line that is not completely visible. |
40 // the scroll, counting from the first line that is not completely visible. |
36 // i.e. setting this to 0 means always scroll KMaxProportionOfScreenToScroll. |
41 // i.e. setting this to 0 means always scroll KMaxProportionOfScreenToScroll. |
208 |
213 |
209 void CTextLayout::EndRedraw() |
214 void CTextLayout::EndRedraw() |
210 { |
215 { |
211 if(!iReadyToRedraw) |
216 if(!iReadyToRedraw) |
212 return; |
217 return; |
213 |
218 |
|
219 if (iBeginRedrawCount <= 0) |
|
220 { |
|
221 OstTrace0( TRACE_DUMP, CTEXTLAYOUT_ENDREDRAW, "CTextLayout::EndRedraw" ); |
|
222 } |
214 __ASSERT_ALWAYS(iBeginRedrawCount > 0, Panic(EInvalidRedraw)); |
223 __ASSERT_ALWAYS(iBeginRedrawCount > 0, Panic(EInvalidRedraw)); |
215 |
224 |
216 if (0 == --iBeginRedrawCount) |
225 if (0 == --iBeginRedrawCount) |
217 { |
226 { |
218 if (NULL != iWnd) |
227 if (NULL != iWnd) |
228 } |
237 } |
229 } |
238 } |
230 |
239 |
231 void CTextLayout::SetExternalDraw(const TRect& aRect) |
240 void CTextLayout::SetExternalDraw(const TRect& aRect) |
232 { |
241 { |
|
242 if (0 != iBeginRedrawCount) |
|
243 { |
|
244 OstTrace0( TRACE_FATAL, DUP1_CTEXTLAYOUT_SETEXTERNALDRAW, "EInvalidRedraw" ); |
|
245 } |
233 __ASSERT_ALWAYS(0 == iBeginRedrawCount, Panic(EInvalidRedraw)); |
246 __ASSERT_ALWAYS(0 == iBeginRedrawCount, Panic(EInvalidRedraw)); |
234 iBeginRedrawCount++; |
247 iBeginRedrawCount++; |
235 iRedrawRect = aRect; |
248 iRedrawRect = aRect; |
236 } |
249 } |
237 |
250 |
238 void CTextLayout::ResetExternalDraw() |
251 void CTextLayout::ResetExternalDraw() |
239 { |
252 { |
|
253 if (1 != iBeginRedrawCount) |
|
254 { |
|
255 OstTrace0( TRACE_FATAL, CTEXTLAYOUT_RESETEXTERNALDRAW, "EInvalidRedraw" ); |
|
256 } |
240 __ASSERT_ALWAYS(1 == iBeginRedrawCount, Panic(EInvalidRedraw)); |
257 __ASSERT_ALWAYS(1 == iBeginRedrawCount, Panic(EInvalidRedraw)); |
241 |
258 |
242 iBeginRedrawCount--; |
259 iBeginRedrawCount--; |
243 iRedrawRect = TRect(); |
260 iRedrawRect = TRect(); |
244 } |
261 } |
413 EXPORT_C void CTextLayout::SetFormatMode(CLayoutData::TFormatMode aFormatMode,TInt aWrapWidth, |
430 EXPORT_C void CTextLayout::SetFormatMode(CLayoutData::TFormatMode aFormatMode,TInt aWrapWidth, |
414 MGraphicsDeviceMap* aFormatDevice) |
431 MGraphicsDeviceMap* aFormatDevice) |
415 { |
432 { |
416 if (aFormatMode == CLayoutData::EFWysiwygMode || aFormatMode == CLayoutData::EFPrintPreviewMode) |
433 if (aFormatMode == CLayoutData::EFWysiwygMode || aFormatMode == CLayoutData::EFPrintPreviewMode) |
417 { |
434 { |
|
435 if (aFormatDevice == NULL) |
|
436 { |
|
437 OstTrace0( TRACE_FATAL, CTEXTLAYOUT_SETFORMATMODE, "EFormatDeviceNotSet" ); |
|
438 } |
418 __ASSERT_ALWAYS(aFormatDevice != NULL,Panic(EFormatDeviceNotSet)); |
439 __ASSERT_ALWAYS(aFormatDevice != NULL,Panic(EFormatDeviceNotSet)); |
419 iSource->iFormatDevice = aFormatDevice; |
440 iSource->iFormatDevice = aFormatDevice; |
420 } |
441 } |
421 else |
442 else |
422 iSource->iFormatDevice = iSource->iImageDevice; |
443 iSource->iFormatDevice = iSource->iImageDevice; |
775 @param aLineNo Line number in formatted text, counting the first line as line |
796 @param aLineNo Line number in formatted text, counting the first line as line |
776 one. |
797 one. |
777 @return The document position of the first character on the line. */ |
798 @return The document position of the first character on the line. */ |
778 EXPORT_C TInt CTextLayout::FirstCharOnLine(TInt aLineNo) const |
799 EXPORT_C TInt CTextLayout::FirstCharOnLine(TInt aLineNo) const |
779 { |
800 { |
|
801 if (aLineNo <= 0) |
|
802 { |
|
803 OstTrace0( TRACE_DUMP, CTEXTLAYOUT_FIRSTCHARONLINE, "EInvalidLineNumber" ); |
|
804 } |
780 __ASSERT_DEBUG(aLineNo > 0,Panic(EInvalidLineNumber)); |
805 __ASSERT_DEBUG(aLineNo > 0,Panic(EInvalidLineNumber)); |
781 if (iText->StartChar() == iText->EndChar()) |
806 if (iText->StartChar() == iText->EndChar()) |
782 return EFNoCurrentFormat; |
807 return EFNoCurrentFormat; |
783 aLineNo--; |
808 aLineNo--; |
784 TTmLineInfo info; |
809 TTmLineInfo info; |
1148 TInt xCoords[4]; |
1173 TInt xCoords[4]; |
1149 |
1174 |
1150 if (iText->LayoutHeight() == 0) |
1175 if (iText->LayoutHeight() == 0) |
1151 return TRect(0,0,0,0); |
1176 return TRect(0,0,0,0); |
1152 |
1177 |
|
1178 if (!PosIsFormatted(aDocPos1)) |
|
1179 { |
|
1180 OstTrace0( TRACE_FATAL, CTEXTLAYOUT_GETLINERECTL, "ECharacterNotFormatted" ); |
|
1181 } |
1153 __ASSERT_ALWAYS(PosIsFormatted(aDocPos1),Panic(ECharacterNotFormatted)); |
1182 __ASSERT_ALWAYS(PosIsFormatted(aDocPos1),Panic(ECharacterNotFormatted)); |
|
1183 if (!PosIsFormatted(aDocPos2)) |
|
1184 { |
|
1185 OstTrace0( TRACE_DUMP, DUP1_CTEXTLAYOUT_GETLINERECTL, "ECharacterNotFormatted" ); |
|
1186 } |
1154 __ASSERT_DEBUG(PosIsFormatted(aDocPos2),Panic(ECharacterNotFormatted)); |
1187 __ASSERT_DEBUG(PosIsFormatted(aDocPos2),Panic(ECharacterNotFormatted)); |
1155 |
1188 |
1156 TTmDocPosSpec docSpec(aDocPos1, TTmDocPosSpec::ELeading); |
1189 TTmDocPosSpec docSpec(aDocPos1, TTmDocPosSpec::ELeading); |
1157 TTmPosInfo2 pos_info; |
1190 TTmPosInfo2 pos_info; |
1158 |
1191 |
1162 xCoords[0] = point.iX; |
1195 xCoords[0] = point.iX; |
1163 |
1196 |
1164 // Getthe Line rectangle |
1197 // Getthe Line rectangle |
1165 GetLineRect(point.iY,rect); |
1198 GetLineRect(point.iY,rect); |
1166 |
1199 |
|
1200 if (rect.iTl.iY > point.iY || rect.iBr.iY < point.iY) |
|
1201 { |
|
1202 OstTrace0( TRACE_DUMP, DUP2_CTEXTLAYOUT_GETLINERECTL, "EPixelNotInFormattedLine" ); |
|
1203 } |
1167 __ASSERT_DEBUG(rect.iTl.iY <= point.iY && rect.iBr.iY >= point.iY,Panic(EPixelNotInFormattedLine)); |
1204 __ASSERT_DEBUG(rect.iTl.iY <= point.iY && rect.iBr.iY >= point.iY,Panic(EPixelNotInFormattedLine)); |
1168 |
1205 |
1169 // Finding the leading edge of aDocPos2 |
1206 // Finding the leading edge of aDocPos2 |
1170 docSpec.iPos = aDocPos2; |
1207 docSpec.iPos = aDocPos2; |
1171 TBool isformatted = FindDocPos(docSpec, pos_info); |
1208 TBool isformatted = FindDocPos(docSpec, pos_info); |
1573 @pre aDocPos is in the range 0...DocumentLength |
1610 @pre aDocPos is in the range 0...DocumentLength |
1574 @post aDocPos has been formatted |
1611 @post aDocPos has been formatted |
1575 */ |
1612 */ |
1576 EXPORT_C void CTextLayout::ExtendFormattingToCoverPosL(TInt aDocPos) |
1613 EXPORT_C void CTextLayout::ExtendFormattingToCoverPosL(TInt aDocPos) |
1577 { |
1614 { |
|
1615 if (0 > aDocPos || aDocPos > DocumentLength()) |
|
1616 { |
|
1617 OstTrace0( TRACE_DUMP, CTEXTLAYOUT_EXTENDFORMATTINGTOCOVERPOSL, "EInvalidDocPos" ); |
|
1618 } |
1578 __ASSERT_DEBUG(0 <= aDocPos && aDocPos <= DocumentLength(), |
1619 __ASSERT_DEBUG(0 <= aDocPos && aDocPos <= DocumentLength(), |
1579 Panic(EInvalidDocPos)); |
1620 Panic(EInvalidDocPos)); |
1580 TTmFormatParam param; |
1621 TTmFormatParam param; |
1581 InitFormatParam(param); |
1622 InitFormatParam(param); |
1582 param.iStartChar = iText->StartChar(); |
1623 param.iStartChar = iText->StartChar(); |
1597 param.iEndChar = aDocPos + 1; |
1638 param.iEndChar = aDocPos + 1; |
1598 if(iText->EndChar() < param.iEndChar) |
1639 if(iText->EndChar() < param.iEndChar) |
1599 { |
1640 { |
1600 iText->ExtendFormattingDownwardsL(param); |
1641 iText->ExtendFormattingDownwardsL(param); |
1601 } |
1642 } |
|
1643 if ((aDocPos < iText->StartChar()) || (aDocPos > iText->EndChar())) |
|
1644 { |
|
1645 OstTrace0( TRACE_DUMP, DUP1_CTEXTLAYOUT_EXTENDFORMATTINGTOCOVERPOSL, "ECharacterNotFormatted" ); |
|
1646 } |
1602 __ASSERT_DEBUG((aDocPos >= iText->StartChar()) && (aDocPos <= iText->EndChar()), |
1647 __ASSERT_DEBUG((aDocPos >= iText->StartChar()) && (aDocPos <= iText->EndChar()), |
1603 Panic(ECharacterNotFormatted)); |
1648 Panic(ECharacterNotFormatted)); |
1604 } |
1649 } |
1605 |
1650 |
1606 |
1651 |
1623 FormatCharRangeL(aStartDocPos,aEndDocPos,0); |
1668 FormatCharRangeL(aStartDocPos,aEndDocPos,0); |
1624 } |
1669 } |
1625 |
1670 |
1626 void CTextLayout::FormatCharRangeL(TInt aStartDocPos,TInt aEndDocPos,TInt aPixelOffset) |
1671 void CTextLayout::FormatCharRangeL(TInt aStartDocPos,TInt aEndDocPos,TInt aPixelOffset) |
1627 { |
1672 { |
|
1673 if (aStartDocPos < 0 && aStartDocPos > DocumentLength()) |
|
1674 { |
|
1675 OstTrace0( TRACE_DUMP, CTEXTLAYOUT_FORMATCHARRANGEL, "EInvalidDocPos" ); |
|
1676 } |
1628 __ASSERT_DEBUG(aStartDocPos >= 0 && aStartDocPos <= DocumentLength(),Panic(EInvalidDocPos)); |
1677 __ASSERT_DEBUG(aStartDocPos >= 0 && aStartDocPos <= DocumentLength(),Panic(EInvalidDocPos)); |
|
1678 if (aEndDocPos < 0 || aEndDocPos > DocumentLength()) |
|
1679 { |
|
1680 OstTrace0( TRACE_DUMP, DUP1_CTEXTLAYOUT_FORMATCHARRANGEL, "EInvalidDocPos" ); |
|
1681 } |
1629 __ASSERT_DEBUG(aEndDocPos >= 0 && aEndDocPos <= DocumentLength(),Panic(EInvalidDocPos)); |
1682 __ASSERT_DEBUG(aEndDocPos >= 0 && aEndDocPos <= DocumentLength(),Panic(EInvalidDocPos)); |
|
1683 if (aStartDocPos > aEndDocPos) |
|
1684 { |
|
1685 OstTrace0( TRACE_DUMP, DUP2_CTEXTLAYOUT_FORMATCHARRANGEL, "ENoCharRangeToFormat" ); |
|
1686 } |
1630 __ASSERT_DEBUG(aStartDocPos <= aEndDocPos,Panic(ENoCharRangeToFormat)); |
1687 __ASSERT_DEBUG(aStartDocPos <= aEndDocPos,Panic(ENoCharRangeToFormat)); |
1631 |
1688 |
1632 TTmFormatParam param; |
1689 TTmFormatParam param; |
1633 InitFormatParam(param); |
1690 InitFormatParam(param); |
1634 param.iStartChar = iSource->ParagraphStart(aStartDocPos); |
1691 param.iStartChar = iSource->ParagraphStart(aStartDocPos); |
1675 if (result.iUnformattedStart == KMaxTInt) |
1732 if (result.iUnformattedStart == KMaxTInt) |
1676 { |
1733 { |
1677 TTmLineInfo info; |
1734 TTmLineInfo info; |
1678 TTmDocPos pos(iUnformattedStart, ETrue); |
1735 TTmDocPos pos(iUnformattedStart, ETrue); |
1679 TBool isFormatted = iText->DocPosToLine(pos,info); |
1736 TBool isFormatted = iText->DocPosToLine(pos,info); |
|
1737 if (!isFormatted) |
|
1738 { |
|
1739 OstTrace0( TRACE_DUMP, CTEXTLAYOUT_FORMATNEXTLINEL, "EPosNotFormatted" ); |
|
1740 } |
1680 __ASSERT_DEBUG(isFormatted, Panic(EPosNotFormatted)); |
1741 __ASSERT_DEBUG(isFormatted, Panic(EPosNotFormatted)); |
1681 isFormatted = iText->ParNumberToLine(info.iParNumber,KMaxTInt,info); |
1742 isFormatted = iText->ParNumberToLine(info.iParNumber,KMaxTInt,info); |
|
1743 if (!isFormatted) |
|
1744 { |
|
1745 OstTrace0( TRACE_DUMP, DUP1_CTEXTLAYOUT_FORMATNEXTLINEL, "EPosNotFormatted" ); |
|
1746 } |
1682 __ASSERT_DEBUG(isFormatted, Panic(EPosNotFormatted)); |
1747 __ASSERT_DEBUG(isFormatted, Panic(EPosNotFormatted)); |
1683 aBottomPixel = info.iOuterRect.iBr.iY - iBandTop; |
1748 aBottomPixel = info.iOuterRect.iBr.iY - iBandTop; |
1684 } |
1749 } |
1685 |
1750 |
1686 // Indicate that formatting is complete up to the lower edge of the current line. |
1751 // Indicate that formatting is complete up to the lower edge of the current line. |
1864 else |
1929 else |
1865 { |
1930 { |
1866 if (iText->YPosToLine(iBandTop,info)) |
1931 if (iText->YPosToLine(iBandTop,info)) |
1867 top_line_number = info.iLineNumber; |
1932 top_line_number = info.iLineNumber; |
1868 else |
1933 else |
|
1934 { |
|
1935 OstTrace0( TRACE_DUMP, DUP1_CTEXTLAYOUT_SCROLLLINESL, "EPosNotFormatted" ); |
1869 User::Leave(EPosNotFormatted); |
1936 User::Leave(EPosNotFormatted); |
|
1937 } |
1870 partial_line = iBandTop > info.iOuterRect.iTl.iY; |
1938 partial_line = iBandTop > info.iOuterRect.iTl.iY; |
1871 } |
1939 } |
1872 |
1940 |
1873 // Find the line number of the desired first visible line. |
1941 // Find the line number of the desired first visible line. |
1874 // Defect fix for INC015850. Changed IF so that if the currently |
1942 // Defect fix for INC015850. Changed IF so that if the currently |
1894 } |
1962 } |
1895 aLines -= lines_scrolled; |
1963 aLines -= lines_scrolled; |
1896 if (lines_scrolled) |
1964 if (lines_scrolled) |
1897 { |
1965 { |
1898 if (!iText->LineNumberToLine(desired_top_line_number,info)) |
1966 if (!iText->LineNumberToLine(desired_top_line_number,info)) |
1899 User::Leave(EPosNotFormatted); |
1967 { |
|
1968 OstTrace0( TRACE_DUMP, CTEXTLAYOUT_SCROLLLINESL, "EPosNotFormatted" ); |
|
1969 User::Leave(EPosNotFormatted); |
|
1970 } |
1900 // if the line to be scrolled to is taller than the screen, we want |
1971 // if the line to be scrolled to is taller than the screen, we want |
1901 // to make sure that the baseline is not scrolled off the screen. |
1972 // to make sure that the baseline is not scrolled off the screen. |
1902 if (visible_height < info.iBaseline - info.iOuterRect.iTl.iY) |
1973 if (visible_height < info.iBaseline - info.iOuterRect.iTl.iY) |
1903 return ScrollL(iBandTop + visible_height - info.iBaseline, aScrollBlankSpace); |
1974 return ScrollL(iBandTop + visible_height - info.iBaseline, aScrollBlankSpace); |
1904 return ScrollL(iBandTop - info.iOuterRect.iTl.iY,aScrollBlankSpace); |
1975 return ScrollL(iBandTop - info.iOuterRect.iTl.iY,aScrollBlankSpace); |
1911 if (iScrollFlags & EFScrollOnlyToTopsOfLines) |
1982 if (iScrollFlags & EFScrollOnlyToTopsOfLines) |
1912 { |
1983 { |
1913 // If we are restricting scroll to the tops of lines, then lines at |
1984 // If we are restricting scroll to the tops of lines, then lines at |
1914 // bottom are irrelevant, so all we do is lose the top line. |
1985 // bottom are irrelevant, so all we do is lose the top line. |
1915 if (!iText->YPosToLine(iBandTop, info)) |
1986 if (!iText->YPosToLine(iBandTop, info)) |
1916 User::Leave(EPosNotFormatted); |
1987 { |
|
1988 OstTrace0( TRACE_DUMP, DUP2_CTEXTLAYOUT_SCROLLLINESL, "EPosNotFormatted" ); |
|
1989 User::Leave(EPosNotFormatted); |
|
1990 } |
1917 return ScrollL(-info.iOuterRect.Height(), aScrollBlankSpace); |
1991 return ScrollL(-info.iOuterRect.Height(), aScrollBlankSpace); |
1918 } |
1992 } |
1919 |
1993 |
1920 int desired_bottom_line_number = 0; |
1994 int desired_bottom_line_number = 0; |
1921 int band_bottom = iBandTop + visible_height; |
1995 int band_bottom = iBandTop + visible_height; |
1934 TBool partial_line = FALSE; |
2008 TBool partial_line = FALSE; |
1935 int bottom_line_number = 0; |
2009 int bottom_line_number = 0; |
1936 if (iText->YPosToLine(band_bottom - 1,info)) |
2010 if (iText->YPosToLine(band_bottom - 1,info)) |
1937 bottom_line_number = info.iLineNumber; |
2011 bottom_line_number = info.iLineNumber; |
1938 else |
2012 else |
1939 User::Leave(EPosNotFormatted); |
2013 { |
|
2014 OstTrace0( TRACE_DUMP, DUP3_CTEXTLAYOUT_SCROLLLINESL, "EPosNotFormatted" ); |
|
2015 User::Leave(EPosNotFormatted); |
|
2016 } |
1940 partial_line = band_bottom < info.iOuterRect.iBr.iY; |
2017 partial_line = band_bottom < info.iOuterRect.iBr.iY; |
1941 |
2018 |
1942 // Find the line number of the desired last visible line. |
2019 // Find the line number of the desired last visible line. |
1943 desired_bottom_line_number = bottom_line_number - aLines; |
2020 desired_bottom_line_number = bottom_line_number - aLines; |
1944 if (partial_line) |
2021 if (partial_line) |
1960 } |
2037 } |
1961 aLines -= lines_scrolled; |
2038 aLines -= lines_scrolled; |
1962 if (lines_scrolled) |
2039 if (lines_scrolled) |
1963 { |
2040 { |
1964 if (!iText->LineNumberToLine(desired_bottom_line_number,info)) |
2041 if (!iText->LineNumberToLine(desired_bottom_line_number,info)) |
1965 User::Leave(EPosNotFormatted); |
2042 { |
|
2043 OstTrace0( TRACE_DUMP, DUP4_CTEXTLAYOUT_SCROLLLINESL, "EPosNotFormattedL" ); |
|
2044 User::Leave(EPosNotFormatted); |
|
2045 } |
1966 return ScrollL(band_bottom - info.iOuterRect.iBr.iY,aScrollBlankSpace); |
2046 return ScrollL(band_bottom - info.iOuterRect.iBr.iY,aScrollBlankSpace); |
1967 } |
2047 } |
1968 else |
2048 else |
1969 return 0; |
2049 return 0; |
1970 } |
2050 } |
2156 EFDisallowScrollingBlankSpace); |
2236 EFDisallowScrollingBlankSpace); |
2157 aYCursorPos = aPixelsScrolled == 0? |
2237 aYCursorPos = aPixelsScrolled == 0? |
2158 visible_height - 1 |
2238 visible_height - 1 |
2159 : SuggestCursorPos(aYCursorPos); |
2239 : SuggestCursorPos(aYCursorPos); |
2160 |
2240 |
|
2241 if (-visible_height > aPixelsScrolled) |
|
2242 { |
|
2243 OstTrace0( TRACE_DUMP, CTEXTLAYOUT_PAGEDOWNL, "EPageScrollError" ); |
|
2244 } |
2161 __ASSERT_DEBUG(-visible_height <= aPixelsScrolled, |
2245 __ASSERT_DEBUG(-visible_height <= aPixelsScrolled, |
2162 Panic(EPageScrollError)); |
2246 Panic(EPageScrollError)); |
|
2247 if (0 > aYCursorPos || aYCursorPos > visible_height) |
|
2248 { |
|
2249 OstTrace0( TRACE_DUMP, DUP1_CTEXTLAYOUT_PAGEDOWNL, "EPageScrollError" ); |
|
2250 } |
2163 __ASSERT_DEBUG(0 <= aYCursorPos && aYCursorPos <= visible_height, |
2251 __ASSERT_DEBUG(0 <= aYCursorPos && aYCursorPos <= visible_height, |
2164 Panic(EPageScrollError)); |
2252 Panic(EPageScrollError)); |
2165 } |
2253 } |
2166 |
2254 |
2167 /** Reformats to reflect a single character edit. |
2255 /** Reformats to reflect a single character edit. |
2190 @return EFalse if no more lines need to be reformatted. ETrue if some more lines |
2278 @return EFalse if no more lines need to be reformatted. ETrue if some more lines |
2191 need to be reformatted. */ |
2279 need to be reformatted. */ |
2192 EXPORT_C TBool CTextLayout::HandleCharEditL(TUint aType,TInt& aCursorPos,TInt& aGood,TInt& aFormatBottom, |
2280 EXPORT_C TBool CTextLayout::HandleCharEditL(TUint aType,TInt& aCursorPos,TInt& aGood,TInt& aFormatBottom, |
2193 TInt& aFormatTop,TInt& aScroll,TBool aFormatFromStartOfPar) |
2281 TInt& aFormatTop,TInt& aScroll,TBool aFormatFromStartOfPar) |
2194 { |
2282 { |
|
2283 if (iSource->iFormatMode == CLayoutData::EFPrintPreviewMode) |
|
2284 { |
|
2285 OstTrace0( TRACE_FATAL, DUP2_CTEXTLAYOUT_HANDLECHAREDITL, "EPrintPreviewModeError" ); |
|
2286 } |
2195 __ASSERT_ALWAYS(iSource->iFormatMode != CLayoutData::EFPrintPreviewMode,Panic(EPrintPreviewModeError)); |
2287 __ASSERT_ALWAYS(iSource->iFormatMode != CLayoutData::EFPrintPreviewMode,Panic(EPrintPreviewModeError)); |
|
2288 if (aType > EFRightDelete) |
|
2289 { |
|
2290 OstTrace0( TRACE_FATAL, CTEXTLAYOUT_HANDLECHAREDITL, "EBadCharacterEditType" ); |
|
2291 } |
2196 __ASSERT_ALWAYS(aType <= EFRightDelete,Panic(EBadCharacterEditType)); |
2292 __ASSERT_ALWAYS(aType <= EFRightDelete,Panic(EBadCharacterEditType)); |
|
2293 if (!(!aFormatFromStartOfPar || aType == EFRightDelete || aType == EFLeftDelete)) |
|
2294 { |
|
2295 OstTrace0( TRACE_FATAL, DUP1_CTEXTLAYOUT_HANDLECHAREDITL, "EBadCharacterEditType" ); |
|
2296 } |
2197 __ASSERT_ALWAYS(!aFormatFromStartOfPar || aType == EFRightDelete || aType == EFLeftDelete,Panic(EBadCharacterEditType)); |
2297 __ASSERT_ALWAYS(!aFormatFromStartOfPar || aType == EFRightDelete || aType == EFLeftDelete,Panic(EBadCharacterEditType)); |
|
2298 if (aCursorPos < iText->StartChar() || aCursorPos >= iText->EndChar()) |
|
2299 { |
|
2300 OstTrace0( TRACE_FATAL, DUP3_CTEXTLAYOUT_HANDLECHAREDITL, "ECharacterNotFormatted" ); |
|
2301 } |
2198 __ASSERT_ALWAYS(aCursorPos >= iText->StartChar() && aCursorPos < iText->EndChar(),Panic(ECharacterNotFormatted)); |
2302 __ASSERT_ALWAYS(aCursorPos >= iText->StartChar() && aCursorPos < iText->EndChar(),Panic(ECharacterNotFormatted)); |
2199 |
2303 |
2200 // Mark the entire paragraph invalid if background formatting is taking place. |
2304 // Mark the entire paragraph invalid if background formatting is taking place. |
2201 iParInvalid = iUnformattedStart != KMaxTInt; |
2305 iParInvalid = iUnformattedStart != KMaxTInt; |
2202 |
2306 |
2356 must extend out to paragraph boundaries and cannot be restricted to only some |
2460 must extend out to paragraph boundaries and cannot be restricted to only some |
2357 lines. */ |
2461 lines. */ |
2358 EXPORT_C void CTextLayout::HandleBlockChangeL(TCursorSelection aSelection,TInt aOldLength, |
2462 EXPORT_C void CTextLayout::HandleBlockChangeL(TCursorSelection aSelection,TInt aOldLength, |
2359 TViewRectChanges& aChanges,TBool aFormatFromStartOfPar) |
2463 TViewRectChanges& aChanges,TBool aFormatFromStartOfPar) |
2360 { |
2464 { |
|
2465 if (iSource->iFormatMode == CLayoutData::EFPrintPreviewMode) |
|
2466 { |
|
2467 OstTrace0( TRACE_FATAL, CTEXTLAYOUT_HANDLEBLOCKCHANGEL, "EPrintPreviewModeError" ); |
|
2468 } |
2361 __ASSERT_ALWAYS(iSource->iFormatMode != CLayoutData::EFPrintPreviewMode,Panic(EPrintPreviewModeError)); |
2469 __ASSERT_ALWAYS(iSource->iFormatMode != CLayoutData::EFPrintPreviewMode,Panic(EPrintPreviewModeError)); |
2362 |
2470 |
2363 // Do nothing if the selection is outside the formatted range. |
2471 // Do nothing if the selection is outside the formatted range. |
2364 if (aSelection.LowerPos() > iText->EndChar() || aSelection.HigherPos() < iText->StartChar()) |
2472 if (aSelection.LowerPos() > iText->EndChar() || aSelection.HigherPos() < iText->StartChar()) |
2365 { |
2473 { |
2482 application's year view). */ |
2590 application's year view). */ |
2483 EXPORT_C void CTextLayout::AdjustVerticalAlignment(CParaFormat::TAlignment aVerticalAlignment) |
2591 EXPORT_C void CTextLayout::AdjustVerticalAlignment(CParaFormat::TAlignment aVerticalAlignment) |
2484 { |
2592 { |
2485 int excess = BandHeight() - FormattedHeightInPixels(); |
2593 int excess = BandHeight() - FormattedHeightInPixels(); |
2486 int space_before = 0; |
2594 int space_before = 0; |
|
2595 |
|
2596 if (IsFormattingBand()) |
|
2597 { |
|
2598 OstTrace0( TRACE_FATAL, CTEXTLAYOUT_ADJUSTVERTICALALIGNMENT, "EMustFormatAllText" ); |
|
2599 } |
2487 __ASSERT_ALWAYS(!IsFormattingBand(),Panic(EMustFormatAllText)); |
2600 __ASSERT_ALWAYS(!IsFormattingBand(),Panic(EMustFormatAllText)); |
2488 TTmLineInfo info; |
2601 TTmLineInfo info; |
2489 |
2602 |
2490 switch (aVerticalAlignment) |
2603 switch (aVerticalAlignment) |
2491 { |
2604 { |
2722 }; |
2835 }; |
2723 |
2836 |
2724 // Repeat draw, for double border. |
2837 // Repeat draw, for double border. |
2725 if (aBorder.iBorder[border].iLineStyle==TParaBorder::EDouble) // Now have only got solid border, drawn as rect. |
2838 if (aBorder.iBorder[border].iLineStyle==TParaBorder::EDouble) // Now have only got solid border, drawn as rect. |
2726 { |
2839 { |
|
2840 if (drawAsLine) |
|
2841 { |
|
2842 OstTrace0( TRACE_DUMP, CTEXTLAYOUT_DRAWBORDERS, "EDrawingBorderError" ); |
|
2843 } |
2727 __ASSERT_DEBUG(!drawAsLine,Panic(EDrawingBorderError)); |
2844 __ASSERT_DEBUG(!drawAsLine,Panic(EDrawingBorderError)); |
2728 (*ptrStartWidth)-=directionOut*widthInPixels[border]; |
2845 (*ptrStartWidth)-=directionOut*widthInPixels[border]; |
2729 (*ptrEndWidth)-=directionOut*widthInPixels[border]; |
2846 (*ptrEndWidth)-=directionOut*widthInPixels[border]; |
2730 (*ptrStartLength)+=widthInPixels[indexJoint1]; |
2847 (*ptrStartLength)+=widthInPixels[indexJoint1]; |
2731 (*ptrEndLength)-=widthInPixels[indexJoint2]; |
2848 (*ptrEndLength)-=widthInPixels[indexJoint2]; |
4104 return pixels_scrolled + SetBandTop(); |
4221 return pixels_scrolled + SetBandTop(); |
4105 } |
4222 } |
4106 |
4223 |
4107 TInt CTextLayout::ScrollDocPosIntoViewL(const TTmDocPos& aDocPos) |
4224 TInt CTextLayout::ScrollDocPosIntoViewL(const TTmDocPos& aDocPos) |
4108 { |
4225 { |
|
4226 if (aDocPos.iPos > iText->Source()->DocumentLength()) |
|
4227 { |
|
4228 OstTrace0( TRACE_DUMP, CTEXTLAYOUT_SCROLLDOCPOSINTOVIEWL, "EInvalidDocPos" ); |
|
4229 } |
4109 __ASSERT_DEBUG(aDocPos.iPos <= iText->Source()->DocumentLength(), |
4230 __ASSERT_DEBUG(aDocPos.iPos <= iText->Source()->DocumentLength(), |
4110 Panic(EInvalidDocPos)); |
4231 Panic(EInvalidDocPos)); |
4111 TTmLineInfo info; |
4232 TTmLineInfo info; |
4112 ExtendFormattingToCoverPosL(aDocPos.iPos); |
4233 ExtendFormattingToCoverPosL(aDocPos.iPos); |
4113 if (!iText->DocPosToLine(aDocPos,info)) |
4234 if (!iText->DocPosToLine(aDocPos,info)) |
4114 { |
4235 { |
|
4236 if (iText->Source()->DocumentLength() != 0) |
|
4237 { |
|
4238 OstTrace0( TRACE_DUMP, DUP1_CTEXTLAYOUT_SCROLLDOCPOSINTOVIEWL, "ECharacterNotFormatted" ); |
|
4239 } |
4115 __ASSERT_DEBUG(iText->Source()->DocumentLength() == 0, |
4240 __ASSERT_DEBUG(iText->Source()->DocumentLength() == 0, |
4116 Panic(ECharacterNotFormatted)); |
4241 Panic(ECharacterNotFormatted)); |
4117 return ScrollL(iBandTop, EFDisallowScrollingBlankSpace); |
4242 return ScrollL(iBandTop, EFDisallowScrollingBlankSpace); |
4118 } |
4243 } |
4119 TRect line_rect = info.iOuterRect; |
4244 TRect line_rect = info.iOuterRect; |