summaryrefslogtreecommitdiff
path: root/editeng/source/editeng/impedit3.cxx
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2013-05-08 18:12:32 +0200
committerFridrich Strba <fridrich@documentfoundation.org>2013-06-28 12:00:06 +0000
commitda11528150df545a31df3c9863bd4c3925ccdf21 (patch)
treead7eb65227b7d03972637fcaf23a8b96cc1c55a4 /editeng/source/editeng/impedit3.cxx
parent7f50f4092b7beafa5545a9a783dde760b260df4c (diff)
resolved fdo#35756 import more than 64k HTML table cells
Enhanced EditEngine to be able to hold more than 64k paragraphs. Used also in RTF import Calc and Writer, so that could benefit as well. * changed all EditEngine,Outliner,... related paragraph index/count variables from sal_uInt16 to sal_Int32 * sal_Int32 instead of sal_uInt32 to match accessibility API * matched some Outliner methods' paragraph parameters from sal_uLong to sal_Int32 * containers capable to hold size_t nevertheless are limited to a maximum of sal_Int32 * changed definition of EE_PARA_NOT_FOUND and EE_PARA_ALL to SAL_MAX_INT32 + added EE_PARA_MAX_COUNT and EE_TEXTPOS_MAX_COUNT to initialize ESelection with what previously were hard coded 0xFFFF all over the place + for similar reason added EE_TEXTPOS_ALL corresponding to EE_PARA_ALL to initialize an ESelection spanning all available text like aSel(0,0,EE_PARA_ALL,EE_TEXTPOS_ALL) Reviewed-on: https://gerrit.libreoffice.org/3838 Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com> (cherry picked from commit 2af1f5691e8d64afd5246d245d7876b5a2cd5cd8) Conflicts: editeng/inc/editeng/editeng.hxx editeng/inc/editeng/outliner.hxx editeng/inc/editeng/unoedprx.hxx editeng/inc/editeng/unoedsrc.hxx editeng/inc/editeng/unofored.hxx editeng/inc/editeng/unoforou.hxx editeng/inc/editeng/unotext.hxx editeng/source/accessibility/AccessibleHyperlink.cxx editeng/source/accessibility/AccessibleHyperlink.hxx editeng/source/editeng/editeng.cxx editeng/source/editeng/editobj.cxx editeng/source/editeng/editobj2.hxx editeng/source/editeng/impedit.hxx editeng/source/editeng/impedit3.cxx editeng/source/editeng/impedit4.cxx editeng/source/outliner/outleeng.cxx editeng/source/outliner/outleeng.hxx editeng/source/outliner/outliner.cxx editeng/source/outliner/outlvw.cxx editeng/source/uno/unoedprx.cxx editeng/source/uno/unofored.cxx editeng/source/uno/unoforou.cxx editeng/source/uno/unotext.cxx include/editeng/editobj.hxx sc/inc/editutil.hxx sc/qa/unit/subsequent_filters-test.cxx sc/source/core/data/cellvalue.cxx sc/source/core/tool/editutil.cxx sc/source/filter/xml/xmlcelli.hxx sc/source/ui/unoobj/fielduno.cxx sd/source/ui/inc/OutlineView.hxx sd/source/ui/view/drtxtob1.cxx starmath/source/accessibility.cxx starmath/source/accessibility.hxx svx/inc/svx/svdoutl.hxx svx/source/accessibility/AccessibleEmptyEditSource.cxx svx/source/sdr/properties/textproperties.cxx svx/source/svdraw/svdoutl.cxx Change-Id: I62d1b9c399cd709a4f93dbac31b219a61c46ec00 Reviewed-on: https://gerrit.libreoffice.org/4368 Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'editeng/source/editeng/impedit3.cxx')
-rw-r--r--editeng/source/editeng/impedit3.cxx56
1 files changed, 28 insertions, 28 deletions
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index d56ea0e11faf..a247a2cd5265 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -350,7 +350,7 @@ void ImpEditEngine::CheckIdleFormatter()
void ImpEditEngine::FormatFullDoc()
{
- for ( sal_uInt16 nPortion = 0; nPortion < GetParaPortions().Count(); nPortion++ )
+ for ( sal_Int32 nPortion = 0; nPortion < GetParaPortions().Count(); nPortion++ )
GetParaPortions()[nPortion]->MarkSelectionInvalid( 0, GetParaPortions()[nPortion]->GetNode()->Len() );
FormatDoc();
}
@@ -377,7 +377,7 @@ void ImpEditEngine::FormatDoc()
sal_Bool bMapChanged = ImpCheckRefMapMode();
aInvalidRec = Rectangle(); // make empty
- for ( sal_uInt16 nPara = 0; nPara < GetParaPortions().Count(); nPara++ )
+ for ( sal_Int32 nPara = 0; nPara < GetParaPortions().Count(); nPara++ )
{
ParaPortion* pParaPortion = GetParaPortions()[nPara];
if ( pParaPortion->MustRepaint() || ( pParaPortion->IsInvalid() && pParaPortion->IsVisible() ) )
@@ -398,7 +398,7 @@ void ImpEditEngine::FormatDoc()
if ( !bGrow && GetTextRanger() )
{
// For a change in height all below must be reformatted ...
- for ( sal_uInt16 n = nPara+1; n < GetParaPortions().Count(); n++ )
+ for ( sal_Int32 n = nPara+1; n < GetParaPortions().Count(); n++ )
{
ParaPortion* pPP = GetParaPortions()[n];
pPP->MarkSelectionInvalid( 0, pPP->GetNode()->Len() );
@@ -532,7 +532,7 @@ void ImpEditEngine::CheckAutoPageSize()
{
// If ahead is centered / right or tabs ...
aStatus.GetStatusWord() |= !IsVertical() ? EE_STAT_TEXTWIDTHCHANGED : EE_STAT_TEXTHEIGHTCHANGED;
- for ( sal_uInt16 nPara = 0; nPara < GetParaPortions().Count(); nPara++ )
+ for ( sal_Int32 nPara = 0; nPara < GetParaPortions().Count(); nPara++ )
{
// Only paragraphs which are not aligned to the left need to be
// reformatted, the height can not be changed here anymore.
@@ -575,7 +575,7 @@ static sal_Int32 ImplCalculateFontIndependentLineSpacing( const sal_Int32 nFontH
return ( nFontHeight * 12 ) / 10; // + 20%
}
-sal_Bool ImpEditEngine::CreateLines( sal_uInt16 nPara, sal_uInt32 nStartPosY )
+sal_Bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
{
ParaPortion* pParaPortion = GetParaPortions()[nPara];
@@ -1631,7 +1631,7 @@ void ImpEditEngine::CreateAndInsertEmptyLine( ParaPortion* pParaPortion, sal_uIn
if ( !aStatus.IsOutliner() )
{
- sal_uInt16 nPara = GetParaPortions().GetPos( pParaPortion );
+ sal_Int32 nPara = GetParaPortions().GetPos( pParaPortion );
SvxAdjust eJustification = GetJustification( nPara );
long nMaxLineWidth = !IsVertical() ? aPaperSize.Width() : aPaperSize.Height();
nMaxLineWidth -= GetXValue( rLRItem.GetRight() );
@@ -1672,7 +1672,7 @@ void ImpEditEngine::CreateAndInsertEmptyLine( ParaPortion* pParaPortion, sal_uIn
}
else if ( rLSItem.GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_PROP )
{
- sal_uInt16 nPara = GetParaPortions().GetPos( pParaPortion );
+ sal_Int32 nPara = GetParaPortions().GetPos( pParaPortion );
if ( nPara || IsFixedCellHeight() || pTmpLine->GetStartPortion() ) // Not the very first line
{
// There are documents with PropLineSpace 0, why?
@@ -2503,7 +2503,7 @@ void ImpEditEngine::SetTextRanger( TextRanger* pRanger )
delete pTextRanger;
pTextRanger = pRanger;
- for ( sal_uInt16 nPara = 0; nPara < GetParaPortions().Count(); nPara++ )
+ for ( sal_Int32 nPara = 0; nPara < GetParaPortions().Count(); nPara++ )
{
ParaPortion* pParaPortion = GetParaPortions()[nPara];
pParaPortion->MarkSelectionInvalid( 0, pParaPortion->GetNode()->Len() );
@@ -2874,7 +2874,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRec, Point aSta
// --------------------------------------------------
// Over all the paragraphs ...
// --------------------------------------------------
- for ( sal_uInt16 n = 0; n < GetParaPortions().Count(); n++ )
+ for ( sal_Int32 n = 0; n < GetParaPortions().Count(); n++ )
{
const ParaPortion* pPortion = GetParaPortions()[n];
DBG_ASSERT( pPortion, "NULL-Pointer in TokenList in Paint" );
@@ -3837,7 +3837,7 @@ void ImpEditEngine::Paint( ImpEditView* pView, const Rectangle& rRec, sal_Bool b
}
-void ImpEditEngine::InsertContent( ContentNode* pNode, sal_uInt16 nPos )
+void ImpEditEngine::InsertContent( ContentNode* pNode, sal_Int32 nPos )
{
DBG_ASSERT( pNode, "NULL-Pointer in InsertContent! " );
DBG_ASSERT( IsInUndo(), "InsertContent only for Undo()!" );
@@ -3848,7 +3848,7 @@ void ImpEditEngine::InsertContent( ContentNode* pNode, sal_uInt16 nPos )
GetEditEnginePtr()->ParagraphInserted( nPos );
}
-EditPaM ImpEditEngine::SplitContent( sal_uInt16 nNode, sal_uInt16 nSepPos )
+EditPaM ImpEditEngine::SplitContent( sal_Int32 nNode, sal_uInt16 nSepPos )
{
ContentNode* pNode = aEditDoc.GetObject( nNode );
DBG_ASSERT( pNode, "Invalid Node in SplitContent" );
@@ -3858,7 +3858,7 @@ EditPaM ImpEditEngine::SplitContent( sal_uInt16 nNode, sal_uInt16 nSepPos )
return ImpInsertParaBreak( aPaM );
}
-EditPaM ImpEditEngine::ConnectContents( sal_uInt16 nLeftNode, sal_Bool bBackward )
+EditPaM ImpEditEngine::ConnectContents( sal_Int32 nLeftNode, sal_Bool bBackward )
{
ContentNode* pLeftNode = aEditDoc.GetObject( nLeftNode );
ContentNode* pRightNode = aEditDoc.GetObject( nLeftNode+1 );
@@ -3883,7 +3883,7 @@ void ImpEditEngine::SetUpdateMode( bool bUp, EditView* pCurView, sal_Bool bForce
FormatAndUpdate( pCurView );
}
-void ImpEditEngine::ShowParagraph( sal_uInt16 nParagraph, bool bShow )
+void ImpEditEngine::ShowParagraph( sal_Int32 nParagraph, bool bShow )
{
ParaPortion* pPPortion = GetParaPortions().SafeGetObject( nParagraph );
DBG_ASSERT( pPPortion, "ShowParagraph: Paragraph does not exist! ");
@@ -3935,7 +3935,7 @@ void ImpEditEngine::ShowParagraph( sal_uInt16 nParagraph, bool bShow )
}
}
-EditSelection ImpEditEngine::MoveParagraphs( Range aOldPositions, sal_uInt16 nNewPos, EditView* pCurView )
+EditSelection ImpEditEngine::MoveParagraphs( Range aOldPositions, sal_Int32 nNewPos, EditView* pCurView )
{
DBG_ASSERT( GetParaPortions().Count() != 0, "No paragraphs found: MoveParagraphs" );
if ( GetParaPortions().Count() == 0 )
@@ -3954,8 +3954,8 @@ EditSelection ImpEditEngine::MoveParagraphs( Range aOldPositions, sal_uInt16 nNe
{
// in this case one can redraw directly whithout invalidating the
// Portions
- sal_uInt16 nFirstPortion = Min( (sal_uInt16)aOldPositions.Min(), nNewPos );
- sal_uInt16 nLastPortion = Max( (sal_uInt16)aOldPositions.Max(), nNewPos );
+ sal_Int32 nFirstPortion = std::min( static_cast<sal_Int32>(aOldPositions.Min()), nNewPos );
+ sal_Int32 nLastPortion = std::max( static_cast<sal_Int32>(aOldPositions.Max()), nNewPos );
ParaPortion* pUpperPortion = GetParaPortions().SafeGetObject( nFirstPortion );
ParaPortion* pLowerPortion = GetParaPortions().SafeGetObject( nLastPortion );
@@ -3971,13 +3971,13 @@ EditSelection ImpEditEngine::MoveParagraphs( Range aOldPositions, sal_uInt16 nNe
else
{
// redraw from the upper invalid position
- sal_uInt16 nFirstInvPara = Min( (sal_uInt16)aOldPositions.Min(), nNewPos );
+ sal_Int32 nFirstInvPara = std::min( static_cast<sal_Int32>(aOldPositions.Min()), nNewPos );
InvalidateFromParagraph( nFirstInvPara );
}
return aSel;
}
-void ImpEditEngine::InvalidateFromParagraph( sal_uInt16 nFirstInvPara )
+void ImpEditEngine::InvalidateFromParagraph( sal_Int32 nFirstInvPara )
{
// The following paragraphs are not invalidated, since ResetHeight()
// => size change => all the following are re-issued anyway.
@@ -4037,7 +4037,7 @@ ContentNode* ImpEditEngine::GetNextVisNode( ContentNode* pCurNode )
const ParaPortion* ImpEditEngine::GetPrevVisPortion( const ParaPortion* pCurPortion ) const
{
- sal_uInt16 nPara = GetParaPortions().GetPos( pCurPortion );
+ sal_Int32 nPara = GetParaPortions().GetPos( pCurPortion );
DBG_ASSERT( nPara < GetParaPortions().Count() , "Portion not found: GetPrevVisPortion" );
const ParaPortion* pPortion = nPara ? GetParaPortions()[--nPara] : 0;
while ( pPortion && !pPortion->IsVisible() )
@@ -4048,7 +4048,7 @@ const ParaPortion* ImpEditEngine::GetPrevVisPortion( const ParaPortion* pCurPort
const ParaPortion* ImpEditEngine::GetNextVisPortion( const ParaPortion* pCurPortion ) const
{
- sal_uInt16 nPara = GetParaPortions().GetPos( pCurPortion );
+ sal_Int32 nPara = GetParaPortions().GetPos( pCurPortion );
DBG_ASSERT( nPara < GetParaPortions().Count() , "Portion not found: GetPrevVisNode" );
const ParaPortion* pPortion = GetParaPortions().SafeGetObject( ++nPara );
while ( pPortion && !pPortion->IsVisible() )
@@ -4062,9 +4062,9 @@ long ImpEditEngine::CalcVertLineSpacing(Point& rStartPos) const
long nTotalOccupiedHeight = 0;
sal_uInt16 nTotalLineCount = 0;
const ParaPortionList& rParaPortions = GetParaPortions();
- sal_uInt16 nParaCount = rParaPortions.Count();
+ sal_Int32 nParaCount = rParaPortions.Count();
- for (sal_uInt16 i = 0; i < nParaCount; ++i)
+ for (sal_Int32 i = 0; i < nParaCount; ++i)
{
if (GetVerJustification(i) != SVX_VER_JUSTIFY_BLOCK)
// All paragraphs must have the block justification set.
@@ -4105,7 +4105,7 @@ long ImpEditEngine::CalcVertLineSpacing(Point& rStartPos) const
return nTotalSpace / (nTotalLineCount-1);
}
-EditPaM ImpEditEngine::InsertParagraph( sal_uInt16 nPara )
+EditPaM ImpEditEngine::InsertParagraph( sal_Int32 nPara )
{
EditPaM aPaM;
if ( nPara != 0 )
@@ -4125,7 +4125,7 @@ EditPaM ImpEditEngine::InsertParagraph( sal_uInt16 nPara )
return ImpInsertParaBreak( aPaM );
}
-EditSelection* ImpEditEngine::SelectParagraph( sal_uInt16 nPara )
+EditSelection* ImpEditEngine::SelectParagraph( sal_Int32 nPara )
{
EditSelection* pSel = 0;
ContentNode* pNode = GetEditDoc().GetObject( nPara );
@@ -4200,9 +4200,9 @@ const SvxNumberFormat* ImpEditEngine::GetNumberFormat( const ContentNode *pNode
if (pNode)
{
// get index of paragraph
- sal_uInt16 nPara = GetEditDoc().GetPos( const_cast< ContentNode * >(pNode) );
- DBG_ASSERT( nPara < USHRT_MAX, "node not found in array" );
- if (nPara < USHRT_MAX)
+ sal_Int32 nPara = GetEditDoc().GetPos( const_cast< ContentNode * >(pNode) );
+ DBG_ASSERT( nPara < EE_PARA_NOT_FOUND, "node not found in array" );
+ if (nPara < EE_PARA_NOT_FOUND)
{
// the called function may be overloaded by an OutlinerEditEng object to provide
// access to the SvxNumberFormat of the Outliner.
@@ -4304,7 +4304,7 @@ void ImpEditEngine::ImplInitDigitMode( OutputDevice* pOutDev, String* pString, x
}
}
-void ImpEditEngine::ImplInitLayoutMode( OutputDevice* pOutDev, sal_uInt16 nPara, sal_uInt16 nIndex )
+void ImpEditEngine::ImplInitLayoutMode( OutputDevice* pOutDev, sal_Int32 nPara, sal_uInt16 nIndex )
{
sal_Bool bCTL = sal_False;
sal_Bool bR2L = sal_False;