diff options
-rw-r--r-- | accessibility/source/extended/textwindowaccessibility.cxx | 28 | ||||
-rw-r--r-- | basctl/source/basicide/baside2.cxx | 8 | ||||
-rw-r--r-- | basctl/source/basicide/baside2b.cxx | 12 | ||||
-rw-r--r-- | include/vcl/textdata.hxx | 12 | ||||
-rw-r--r-- | include/vcl/texteng.hxx | 76 | ||||
-rw-r--r-- | sw/source/ui/dbui/mmaddressblockpage.cxx | 10 | ||||
-rw-r--r-- | sw/source/uibase/uiview/srcview.cxx | 2 | ||||
-rw-r--r-- | vcl/source/edit/textdat2.hxx | 8 | ||||
-rw-r--r-- | vcl/source/edit/textdata.cxx | 6 | ||||
-rw-r--r-- | vcl/source/edit/textdoc.cxx | 21 | ||||
-rw-r--r-- | vcl/source/edit/textdoc.hxx | 2 | ||||
-rw-r--r-- | vcl/source/edit/texteng.cxx | 134 | ||||
-rw-r--r-- | vcl/source/edit/textund2.hxx | 12 | ||||
-rw-r--r-- | vcl/source/edit/textundo.cxx | 10 | ||||
-rw-r--r-- | vcl/source/edit/textview.cxx | 18 | ||||
-rw-r--r-- | vcl/source/edit/vclmedit.cxx | 9 | ||||
-rw-r--r-- | vcl/source/edit/xtextedt.cxx | 16 |
17 files changed, 188 insertions, 196 deletions
diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx index 23b7b1e903ab..4d9e8329a45e 100644 --- a/accessibility/source/extended/textwindowaccessibility.cxx +++ b/accessibility/source/extended/textwindowaccessibility.cxx @@ -928,19 +928,15 @@ Document::retrieveCharacterBounds(Paragraph const * pParagraph, if ( nIndex == nLength ) { aBounds = AWTRectangle( - m_rEngine.PaMtoEditCursor(::TextPaM(nNumber, - static_cast< ::sal_uInt16 >(nIndex)))); + m_rEngine.PaMtoEditCursor(::TextPaM(nNumber, nIndex))); } else { ::Rectangle aLeft( - m_rEngine.PaMtoEditCursor(::TextPaM(nNumber, - static_cast< ::sal_uInt16 >(nIndex)))); + m_rEngine.PaMtoEditCursor(::TextPaM(nNumber, nIndex))); // XXX numeric overflow ::Rectangle aRight( - m_rEngine.PaMtoEditCursor(::TextPaM(nNumber, - static_cast< ::sal_uInt16 >(nIndex) - + 1))); + m_rEngine.PaMtoEditCursor(::TextPaM(nNumber, nIndex + 1))); // XXX numeric overflow (2x) // FIXME If the vertical extends of the two cursors do not match, assume // nIndex is the last character on the line; the bounding box will then @@ -1173,7 +1169,7 @@ void Document::retrieveRunAttributesImpl( tPropValMap& rRunAttrSeq) { ::sal_uLong nNumber = static_cast< ::sal_uLong >( pParagraph->getNumber() ); - ::TextPaM aPaM( nNumber, static_cast< ::sal_uInt16 >( Index ) ); + ::TextPaM aPaM( nNumber, Index ); // XXX numeric overflow // FIXME TEXTATTR_HYPERLINK ignored: ::TextAttribFontColor const * pColor @@ -1290,8 +1286,8 @@ void Document::copyParagraphText(Paragraph const * pParagraph, " Document::copyParagraphText", static_cast< css::uno::XWeak * >(this)); m_rView.SetSelection( - ::TextSelection(::TextPaM(nNumber, static_cast< ::sal_uInt16 >(nBegin)), - ::TextPaM(nNumber, static_cast< ::sal_uInt16 >(nEnd)))); + ::TextSelection(::TextPaM(nNumber, nBegin), + ::TextPaM(nNumber, nEnd))); // XXX numeric overflow (2x) m_rView.Copy(); } @@ -1345,8 +1341,8 @@ void Document::changeParagraphSelection(Paragraph * pParagraph, " Document::changeParagraphSelection", static_cast< css::uno::XWeak * >(this)); m_rView.SetSelection( - ::TextSelection(::TextPaM(nNumber, static_cast< ::sal_uInt16 >(nBegin)), - ::TextPaM(nNumber, static_cast< ::sal_uInt16 >(nEnd)))); + ::TextSelection(::TextPaM(nNumber, nBegin), + ::TextPaM(nNumber, nEnd))); // XXX numeric overflow (2x) } } @@ -2111,10 +2107,10 @@ void Document::handleParagraphNotifications() return -1; ::sal_Int32 Osp = m_nSelectionFirstPara, Osl = m_nSelectionFirstPos, Oep = m_nSelectionLastPara, Oel = m_nSelectionLastPos; ::sal_Int32 Nsp = nNewFirstPara, Nsl = nNewFirstPos, Nep = nNewLastPara, Nel = nNewLastPos; - TextPaM Ns(Nsp, sal_uInt16(Nsl)); - TextPaM Ne(Nep, sal_uInt16(Nel)); - TextPaM Os(Osp, sal_uInt16(Osl)); - TextPaM Oe(Oep, sal_uInt16(Oel)); + TextPaM Ns(Nsp, Nsl); + TextPaM Ne(Nep, Nel); + TextPaM Os(Osp, Osl); + TextPaM Oe(Oep, Oel); if (Os == Oe && Ns == Ne) { diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index 88a2d64fb451..ee451cf59d8c 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -319,10 +319,10 @@ bool ModulWindow::BasicExecute() { DBG_ASSERT( xModule.Is(), "Kein Modul!" ); AddStatus( BASWIN_RUNNINGBASIC ); - sal_uInt16 nStart, nEnd, nCurMethodStart = 0; + sal_uInt16 nStart, nEnd; TextSelection aSel = GetEditView()->GetSelection(); // Init cursor to top - nCurMethodStart = ( aSel.GetStart().GetPara() + 1 ); + const sal_uInt32 nCurMethodStart = aSel.GetStart().GetPara() + 1; SbMethod* pMethod = 0; // first Macro, else blind "Main" (ExtSearch?) for ( sal_uInt16 nMacro = 0; nMacro < xModule->GetMethods()->Count(); nMacro++ ) @@ -568,7 +568,7 @@ bool ModulWindow::BasicToggleBreakPoint() bool bNewBreakPoint = false; - for ( sal_uLong nLine = aSel.GetStart().GetPara(); nLine <= aSel.GetEnd().GetPara(); nLine++ ) + for ( sal_uInt32 nLine = aSel.GetStart().GetPara(); nLine <= aSel.GetEnd().GetPara(); ++nLine ) { if ( ToggleBreakPoint( nLine ) ) bNewBreakPoint = true; @@ -589,7 +589,7 @@ void ModulWindow::BasicToggleBreakPointEnabled() TextSelection aSel = pView->GetSelection(); BreakPointList& rList = GetBreakPoints(); - for ( sal_uLong nLine = ++aSel.GetStart().GetPara(), nEnd = ++aSel.GetEnd().GetPara(); nLine <= nEnd; ++nLine ) + for ( sal_uInt32 nLine = ++aSel.GetStart().GetPara(), nEnd = ++aSel.GetEnd().GetPara(); nLine <= nEnd; ++nLine ) { BreakPoint* pBrk = rList.FindBreakPoint( nLine ); if ( pBrk ) diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index f19f827f4263..560d56965dd3 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -597,7 +597,7 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt ) void EditorWindow::HandleAutoCorrect() { TextSelection aSel = GetEditView()->GetSelection(); - sal_uLong nLine = aSel.GetStart().GetPara(); + const sal_uInt32 nLine = aSel.GetStart().GetPara(); const sal_Int32 nIndex = aSel.GetStart().GetIndex(); OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified const OUString& sActSubName = GetActualSubName( nLine ); // the actual procedure @@ -674,7 +674,7 @@ void EditorWindow::HandleAutoCorrect() TextSelection EditorWindow::GetLastHighlightPortionTextSelection() {//creates a text selection from the highlight portion on the cursor - sal_uLong nLine = GetEditView()->GetSelection().GetStart().GetPara(); + const sal_uInt32 nLine = GetEditView()->GetSelection().GetStart().GetPara(); const sal_Int32 nIndex = GetEditView()->GetSelection().GetStart().GetIndex(); OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified std::vector<HighlightPortion> aPortions; @@ -707,7 +707,7 @@ TextSelection EditorWindow::GetLastHighlightPortionTextSelection() void EditorWindow::HandleAutoCloseParen() { TextSelection aSel = GetEditView()->GetSelection(); - sal_uLong nLine = aSel.GetStart().GetPara(); + const sal_uInt32 nLine = aSel.GetStart().GetPara(); OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified if( aLine.getLength() > 0 && aLine[aSel.GetEnd().GetIndex()-1] != '(' ) @@ -722,7 +722,7 @@ void EditorWindow::HandleAutoCloseParen() void EditorWindow::HandleAutoCloseDoubleQuotes() { TextSelection aSel = GetEditView()->GetSelection(); - sal_uLong nLine = aSel.GetStart().GetPara(); + const sal_uInt32 nLine = aSel.GetStart().GetPara(); OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified std::vector<HighlightPortion> aPortions; @@ -744,7 +744,7 @@ void EditorWindow::HandleProcedureCompletion() { TextSelection aSel = GetEditView()->GetSelection(); - sal_uLong nLine = aSel.GetStart().GetPara(); + const sal_uInt32 nLine = aSel.GetStart().GetPara(); OUString aLine( pEditEngine->GetText( nLine ) ); OUString sProcType; @@ -836,7 +836,7 @@ void EditorWindow::HandleCodeCompletion() rModulWindow.UpdateModule(); rModulWindow.GetSbModule()->GetCodeCompleteDataFromParse(aCodeCompleteCache); TextSelection aSel = GetEditView()->GetSelection(); - sal_uLong nLine = aSel.GetStart().GetPara(); + const sal_uInt32 nLine = aSel.GetStart().GetPara(); OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified std::vector< OUString > aVect; //vector to hold the base variable+methods for the nested reflection diff --git a/include/vcl/textdata.hxx b/include/vcl/textdata.hxx index 722a94c43755..d206da947c66 100644 --- a/include/vcl/textdata.hxx +++ b/include/vcl/textdata.hxx @@ -30,15 +30,15 @@ class TextPaM { private: - sal_uLong mnPara; + sal_uInt32 mnPara; sal_Int32 mnIndex; public: TextPaM() : mnPara(0), mnIndex(0) {} - TextPaM( sal_uLong nPara, sal_Int32 nIndex ) : mnPara(nPara), mnIndex(nIndex) {} + TextPaM( sal_uInt32 nPara, sal_Int32 nIndex ) : mnPara(nPara), mnIndex(nIndex) {} - sal_uLong GetPara() const { return mnPara; } - sal_uLong& GetPara() { return mnPara; } + sal_uInt32 GetPara() const { return mnPara; } + sal_uInt32& GetPara() { return mnPara; } sal_Int32 GetIndex() const { return mnIndex; } sal_Int32& GetIndex() { return mnIndex; } @@ -128,8 +128,8 @@ private: sal_uLong mnValue; public: - TextHint( sal_uLong nId ); - TextHint( sal_uLong nId, sal_uLong nValue ); + TextHint( sal_uInt32 nId ); + TextHint( sal_uInt32 nId, sal_uLong nValue ); sal_uLong GetValue() const { return mnValue; } }; diff --git a/include/vcl/texteng.hxx b/include/vcl/texteng.hxx index 2d8e83188a56..2b64ccc35bad 100644 --- a/include/vcl/texteng.hxx +++ b/include/vcl/texteng.hxx @@ -141,7 +141,7 @@ private: protected: - void CursorMoved( sal_uLong nNode ); + void CursorMoved( sal_uInt32 nNode ); void TextModified(); void ImpInitDoc(); @@ -152,9 +152,9 @@ protected: TextPaM ImpInsertParaBreak( const TextSelection& rTextSelection, bool bKeepEndingAttribs = true ); TextPaM ImpInsertParaBreak( const TextPaM& rPaM, bool bKeepEndingAttribs = true ); void ImpRemoveChars( const TextPaM& rPaM, sal_Int32 nChars, SfxUndoAction* pCurUndo = 0 ); - TextPaM ImpConnectParagraphs( sal_uLong nLeft, sal_uLong nRight ); - void ImpRemoveParagraph( sal_uLong nPara ); - void ImpInitWritingDirections( sal_uLong nPara ); + TextPaM ImpConnectParagraphs( sal_uInt32 nLeft, sal_uInt32 nRight ); + void ImpRemoveParagraph( sal_uInt32 nPara ); + void ImpInitWritingDirections( sal_uInt32 nPara ); LocaleDataWrapper* ImpGetLocaleDataWrapper(); // to remain compatible in the minor release we copy the above ImpInsertText @@ -166,11 +166,11 @@ protected: SAL_DLLPRIVATE bool IsInputSequenceCheckingRequired( sal_Unicode c, const TextSelection& rCurSel ) const; // broadcast or adjust selections - void ImpParagraphInserted( sal_uLong nPara ); - void ImpParagraphRemoved( sal_uLong nPara ); - void ImpCharsRemoved( sal_uLong nPara, sal_Int32 nPos, sal_Int32 nChars ); - void ImpCharsInserted( sal_uLong nPara, sal_Int32 nPos, sal_Int32 nChars ); - void ImpFormattingParagraph( sal_uLong nPara ); + void ImpParagraphInserted( sal_uInt32 nPara ); + void ImpParagraphRemoved( sal_uInt32 nPara ); + void ImpCharsRemoved( sal_uInt32 nPara, sal_Int32 nPos, sal_Int32 nChars ); + void ImpCharsInserted( sal_uInt32 nPara, sal_Int32 nPos, sal_Int32 nChars ); + void ImpFormattingParagraph( sal_uInt32 nPara ); void ImpTextHeightChanged(); void ImpTextFormatted(); @@ -178,13 +178,13 @@ protected: void CheckIdleFormatter(); void IdleFormatAndUpdate( TextView* pCurView = 0, sal_uInt16 nMaxTimerRestarts = 5 ); - bool CreateLines( sal_uLong nPara ); - void CreateAndInsertEmptyLine( sal_uLong nPara ); - void ImpBreakLine( sal_uLong nPara, TextLine* pLine, TETextPortion* pPortion, sal_Int32 nPortionStart, long nRemainingWidth ); - sal_uInt16 SplitTextPortion( sal_uLong nPara, sal_Int32 nPos ); - void CreateTextPortions( sal_uLong nPara, sal_Int32 nStartPos ); - void RecalcTextPortion( sal_uLong nPara, sal_Int32 nStartPos, sal_Int32 nNewChars ); - void SeekCursor( sal_uLong nNode, sal_Int32 nPos, vcl::Font& rFont, OutputDevice* pOutDev ); + bool CreateLines( sal_uInt32 nPara ); + void CreateAndInsertEmptyLine( sal_uInt32 nPara ); + void ImpBreakLine( sal_uInt32 nPara, TextLine* pLine, TETextPortion* pPortion, sal_Int32 nPortionStart, long nRemainingWidth ); + sal_uInt16 SplitTextPortion( sal_uInt32 nPara, sal_Int32 nPos ); + void CreateTextPortions( sal_uInt32 nPara, sal_Int32 nStartPos ); + void RecalcTextPortion( sal_uInt32 nPara, sal_Int32 nStartPos, sal_Int32 nNewChars ); + void SeekCursor( sal_uInt32 nNode, sal_Int32 nPos, vcl::Font& rFont, OutputDevice* pOutDev ); void FormatDoc(); void FormatFullDoc(); @@ -196,26 +196,26 @@ protected: bool IsFormatted() const { return mbFormatted; } - sal_Int32 GetCharPos( sal_uLong nPara, sal_uInt16 nLine, long nDocPosX, bool bSmart = false ); + sal_Int32 GetCharPos( sal_uInt32 nPara, sal_uInt16 nLine, long nDocPosX, bool bSmart = false ); Rectangle GetEditCursor( const TextPaM& rPaM, bool bSpecial, bool bPreferPortionStart = false ); - sal_Int32 ImpFindIndex( sal_uLong nPortion, const Point& rPosInPara, bool bSmart ); - long ImpGetPortionXOffset( sal_uLong nPara, TextLine* pLine, sal_uInt16 nTextPortion ); - long ImpGetXPos( sal_uLong nPara, TextLine* pLine, sal_Int32 nIndex, bool bPreferPortionStart = false ); - long ImpGetOutputOffset( sal_uLong nPara, TextLine* pLine, sal_Int32 nIndex, sal_Int32 nIndex2 ); - sal_uInt8 ImpGetRightToLeft( sal_uLong nPara, sal_Int32 nPos, sal_Int32* pStart = NULL, sal_Int32* pEnd = NULL ); + sal_Int32 ImpFindIndex( sal_uInt32 nPortion, const Point& rPosInPara, bool bSmart ); + long ImpGetPortionXOffset( sal_uInt32 nPara, TextLine* pLine, sal_uInt16 nTextPortion ); + long ImpGetXPos( sal_uInt32 nPara, TextLine* pLine, sal_Int32 nIndex, bool bPreferPortionStart = false ); + long ImpGetOutputOffset( sal_uInt32 nPara, TextLine* pLine, sal_Int32 nIndex, sal_Int32 nIndex2 ); + sal_uInt8 ImpGetRightToLeft( sal_uInt32 nPara, sal_Int32 nPos, sal_Int32* pStart = NULL, sal_Int32* pEnd = NULL ); static void ImpInitLayoutMode( OutputDevice* pOutDev, bool bDrawingR2LPortion = false ); TxtAlign ImpGetAlign() const; sal_uLong CalcTextHeight(); - sal_uLong CalcParaHeight( sal_uLong nParagraph ) const; - sal_uLong CalcTextWidth( sal_uLong nPara ); - sal_uLong CalcTextWidth( sal_uLong nPara, sal_Int32 nPortionStart, sal_Int32 nPortionLen, const vcl::Font* pFont = 0 ); - Range GetInvalidYOffsets( sal_uLong nPortion ); + sal_uLong CalcParaHeight( sal_uInt32 nParagraph ) const; + sal_uLong CalcTextWidth( sal_uInt32 nPara ); + sal_uLong CalcTextWidth( sal_uInt32 nPara, sal_Int32 nPortionStart, sal_Int32 nPortionLen, const vcl::Font* pFont = 0 ); + Range GetInvalidYOffsets( sal_uInt32 nPortion ); // for Undo/Redo - void InsertContent( TextNode* pNode, sal_uLong nPara ); - TextPaM SplitContent( sal_uLong nNode, sal_Int32 nSepPos ); - TextPaM ConnectContents( sal_uLong nLeftNode ); + void InsertContent( TextNode* pNode, sal_uInt32 nPara ); + TextPaM SplitContent( sal_uInt32 nNode, sal_Int32 nSepPos ); + TextPaM ConnectContents( sal_uInt32 nLeftNode ); // adjust PaM's and selections that were transferred to the API to a valid range void ValidateSelection( TextSelection& rSel ) const; @@ -260,12 +260,12 @@ public: long GetCharHeight() const { return mnCharHeight; } sal_uLong GetParagraphCount() const; - OUString GetText( sal_uLong nParagraph ) const; - sal_Int32 GetTextLen( sal_uLong nParagraph ) const; - sal_uLong GetTextHeight( sal_uLong nParagraph ) const; + OUString GetText( sal_uInt32 nParagraph ) const; + sal_Int32 GetTextLen( sal_uInt32 nParagraph ) const; + sal_uLong GetTextHeight( sal_uInt32 nParagraph ) const; - sal_uInt16 GetLineCount( sal_uLong nParagraph ) const; - sal_Int32 GetLineLen( sal_uLong nParagraph, sal_uInt16 nLine ) const; + sal_uInt16 GetLineCount( sal_uInt32 nParagraph ) const; + sal_Int32 GetLineLen( sal_uInt32 nParagraph, sal_uInt16 nLine ) const; void SetRightToLeft( bool bR2L ); bool IsRightToLeft() const { return mbRightToLeft; } @@ -298,10 +298,10 @@ public: const TextAttrib* FindAttrib( const TextPaM& rPaM, sal_uInt16 nWhich ) const; const TextCharAttrib* FindCharAttrib( const TextPaM& rPaM, sal_uInt16 nWhich ) const; - void RemoveAttribs( sal_uLong nPara, sal_uInt16 nWhich, bool bIdleFormatAndUpdate ); - void RemoveAttrib( sal_uLong nPara, const TextCharAttrib& rAttrib ); - void RemoveAttribs( sal_uLong nPara, bool bIdleFormatAndUpdate = true ); - void SetAttrib( const TextAttrib& rAttr, sal_uLong nPara, sal_Int32 nStart, sal_Int32 nEnd, bool bIdleFormatAndUpdate = true ); + void RemoveAttribs( sal_uInt32 nPara, sal_uInt16 nWhich, bool bIdleFormatAndUpdate ); + void RemoveAttrib( sal_uInt32 nPara, const TextCharAttrib& rAttrib ); + void RemoveAttribs( sal_uInt32 nPara, bool bIdleFormatAndUpdate = true ); + void SetAttrib( const TextAttrib& rAttr, sal_uInt32 nPara, sal_Int32 nStart, sal_Int32 nEnd, bool bIdleFormatAndUpdate = true ); TxtAlign GetTextAlign() const { return meAlign; } void SetTextAlign( TxtAlign eAlign ); diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx index 1bb0ec8d9bdc..843fbe375c70 100644 --- a/sw/source/ui/dbui/mmaddressblockpage.cxx +++ b/sw/source/ui/dbui/mmaddressblockpage.cxx @@ -1443,7 +1443,7 @@ void AddressMultiLineEdit::InsertNewEntry( const OUString& rStr ) // insert new entry after current selected one. ExtTextView* pTextView = GetTextView(); const TextSelection& rSelection = pTextView->GetSelection(); - sal_uLong nPara = rSelection.GetStart().GetPara(); + const sal_uInt32 nPara = rSelection.GetStart().GetPara(); sal_Int32 nIndex = rSelection.GetEnd().GetIndex(); ExtTextEngine *pTextEngine = GetTextEngine(); const TextCharAttrib *pAttrib; @@ -1486,7 +1486,7 @@ void AddressMultiLineEdit::RemoveCurrentEntry() (pBeginAttrib->GetStart() <= rSelection.GetStart().GetIndex() && pBeginAttrib->GetEnd() >= rSelection.GetEnd().GetIndex())) { - sal_uLong nPara = rSelection.GetStart().GetPara(); + const sal_uInt32 nPara = rSelection.GetStart().GetPara(); TextSelection aEntrySel(TextPaM( nPara, pBeginAttrib->GetStart()), TextPaM(nPara, pBeginAttrib->GetEnd())); pTextEngine->ReplaceText(aEntrySel, OUString()); //restore the attributes @@ -1506,7 +1506,7 @@ void AddressMultiLineEdit::MoveCurrentItem(sal_uInt16 nMove) && pBeginAttrib->GetEnd() >= rSelection.GetEnd().GetIndex())) { //current item has been found - sal_uLong nPara = rSelection.GetStart().GetPara(); + sal_uInt32 nPara = rSelection.GetStart().GetPara(); sal_Int32 nIndex = pBeginAttrib->GetStart(); TextSelection aEntrySel(TextPaM( nPara, pBeginAttrib->GetStart()), TextPaM(nPara, pBeginAttrib->GetEnd())); const OUString sCurrentItem = pTextEngine->GetText(aEntrySel); @@ -1610,7 +1610,7 @@ OUString AddressMultiLineEdit::GetCurrentItem() (pBeginAttrib->GetStart() <= rSelection.GetStart().GetIndex() && pBeginAttrib->GetEnd() >= rSelection.GetEnd().GetIndex())) { - sal_uLong nPara = rSelection.GetStart().GetPara(); + const sal_uInt32 nPara = rSelection.GetStart().GetPara(); TextSelection aEntrySel(TextPaM( nPara, pBeginAttrib->GetStart()), TextPaM(nPara, pBeginAttrib->GetEnd())); return pTextEngine->GetText( aEntrySel ); } @@ -1627,7 +1627,7 @@ void AddressMultiLineEdit::SelectCurrentItem() (pBeginAttrib->GetStart() <= rSelection.GetStart().GetIndex() && pBeginAttrib->GetEnd() >= rSelection.GetEnd().GetIndex())) { - sal_uLong nPara = rSelection.GetStart().GetPara(); + const sal_uInt32 nPara = rSelection.GetStart().GetPara(); TextSelection aEntrySel(TextPaM( nPara, pBeginAttrib->GetStart()), TextPaM(nPara, pBeginAttrib->GetEnd())); pTextView->SetSelection(aEntrySel); Invalidate(); diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx index 69df7cbb1934..72b4de7b4f59 100644 --- a/sw/source/uibase/uiview/srcview.cxx +++ b/sw/source/uibase/uiview/srcview.cxx @@ -580,7 +580,7 @@ sal_uInt16 SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem, bool bAtStart = pTextView->GetSelection() == TextSelection( aPaM, aPaM ); if( !bForward ) - aPaM = TextPaM( (sal_uLong)-1, USHRT_MAX ); + aPaM = TextPaM( TEXT_PARA_ALL, USHRT_MAX ); if( bFromStart ) { diff --git a/vcl/source/edit/textdat2.hxx b/vcl/source/edit/textdat2.hxx index 6e57f9005d7e..f7d4fcea0ab2 100644 --- a/vcl/source/edit/textdat2.hxx +++ b/vcl/source/edit/textdat2.hxx @@ -216,10 +216,10 @@ public: TEParaPortions() : mvData() {} ~TEParaPortions(); - size_t Count() const { return mvData.size(); } - TEParaPortion* GetObject( size_t nIndex ) { return mvData[nIndex]; } - void Insert( TEParaPortion* pObject, size_t nPos ) { mvData.insert( mvData.begin()+nPos, pObject ); } - void Remove( size_t nPos ) { mvData.erase( mvData.begin()+nPos ); } + sal_uInt32 Count() const { return static_cast<sal_uInt32>(mvData.size()); } + TEParaPortion* GetObject( sal_uInt32 nIndex ) { return mvData[nIndex]; } + void Insert( TEParaPortion* pObject, sal_uInt32 nPos ) { mvData.insert( mvData.begin()+nPos, pObject ); } + void Remove( sal_uInt32 nPos ) { mvData.erase( mvData.begin()+nPos ); } }; class TextSelFunctionSet: public FunctionSet diff --git a/vcl/source/edit/textdata.cxx b/vcl/source/edit/textdata.cxx index fe95af59c754..19adc7d4cfca 100644 --- a/vcl/source/edit/textdata.cxx +++ b/vcl/source/edit/textdata.cxx @@ -260,14 +260,12 @@ void IdleFormatter::ForceTimeout() } } -TextHint::TextHint( sal_uLong Id ) : SfxSimpleHint( Id ) +TextHint::TextHint( sal_uInt32 Id ) : SfxSimpleHint( Id ), mnValue(0) { - mnValue = 0; } -TextHint::TextHint( sal_uLong Id, sal_uLong nValue ) : SfxSimpleHint( Id ) +TextHint::TextHint( sal_uInt32 Id, sal_uLong nValue ) : SfxSimpleHint( Id ), mnValue(nValue) { - mnValue = nValue; } TEIMEInfos::TEIMEInfos( const TextPaM& rPos, const OUString& rOldTextAfterStartPos ) diff --git a/vcl/source/edit/textdoc.cxx b/vcl/source/edit/textdoc.cxx index f3d2cd19f9d0..d13c5f91a12d 100644 --- a/vcl/source/edit/textdoc.cxx +++ b/vcl/source/edit/textdoc.cxx @@ -422,18 +422,18 @@ void TextDoc::Clear() void TextDoc::DestroyTextNodes() { - for ( sal_uLong nNode = 0; nNode < maTextNodes.size(); nNode++ ) - delete maTextNodes[ nNode ]; + for ( auto pNode : maTextNodes ) + delete pNode; maTextNodes.clear(); } OUString TextDoc::GetText( const sal_Unicode* pSep ) const { - sal_uLong nNodes = maTextNodes.size(); + sal_uInt32 nNodes = static_cast<sal_uInt32>(maTextNodes.size()); OUString aASCIIText; - sal_uLong nLastNode = nNodes-1; - for ( sal_uLong nNode = 0; nNode < nNodes; nNode++ ) + const sal_uInt32 nLastNode = nNodes-1; + for ( sal_uInt32 nNode = 0; nNode < nNodes; ++nNode ) { TextNode* pNode = maTextNodes[ nNode ]; OUString aTmp( pNode->GetText() ); @@ -445,7 +445,7 @@ OUString TextDoc::GetText( const sal_Unicode* pSep ) const return aASCIIText; } -OUString TextDoc::GetText( sal_uLong nPara ) const +OUString TextDoc::GetText( sal_uInt32 nPara ) const { OUString aText; @@ -459,18 +459,18 @@ OUString TextDoc::GetText( sal_uLong nPara ) const sal_uLong TextDoc::GetTextLen( const sal_Unicode* pSep, const TextSelection* pSel ) const { sal_uLong nLen = 0; - sal_uLong nNodes = maTextNodes.size(); + sal_uInt32 nNodes = static_cast<sal_uInt32>(maTextNodes.size()); if ( nNodes ) { - sal_uLong nStartNode = 0; - sal_uLong nEndNode = nNodes-1; + sal_uInt32 nStartNode = 0; + sal_uInt32 nEndNode = nNodes-1; if ( pSel ) { nStartNode = pSel->GetStart().GetPara(); nEndNode = pSel->GetEnd().GetPara(); } - for ( sal_uLong nNode = nStartNode; nNode <= nEndNode; nNode++ ) + for ( sal_uInt32 nNode = nStartNode; nNode <= nEndNode; ++nNode ) { TextNode* pNode = maTextNodes[ nNode ]; @@ -520,6 +520,7 @@ TextPaM TextDoc::InsertParaBreak( const TextPaM& rPaM, bool bKeepEndingAttribs ) TextNode* pNode = maTextNodes[ rPaM.GetPara() ]; TextNode* pNew = pNode->Split( rPaM.GetIndex(), bKeepEndingAttribs ); + DBG_ASSERT( maTextNodes.size()<SAL_MAX_UINT32, "InsertParaBreak: more than 4Gi paragraphs!" ); maTextNodes.insert( maTextNodes.begin() + rPaM.GetPara() + 1, pNew ); TextPaM aPaM( rPaM.GetPara()+1, 0 ); diff --git a/vcl/source/edit/textdoc.hxx b/vcl/source/edit/textdoc.hxx index 1efecf9fb425..25095b1d096b 100644 --- a/vcl/source/edit/textdoc.hxx +++ b/vcl/source/edit/textdoc.hxx @@ -115,7 +115,7 @@ public: sal_uLong GetTextLen( const sal_Unicode* pSep, const TextSelection* pSel = NULL ) const; OUString GetText( const sal_Unicode* pSep ) const; - OUString GetText( sal_uLong nPara ) const; + OUString GetText( sal_uInt32 nPara ) const; void SetLeftMargin( sal_uInt16 n ) { mnLeftMargin = n; } sal_uInt16 GetLeftMargin() const { return mnLeftMargin; } diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index f964d16cd7bd..ef5455cd2983 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -261,9 +261,9 @@ OUString TextEngine::GetText( LineEnd aSeparator ) const OUString TextEngine::GetTextLines( LineEnd aSeparator ) const { OUString aText; - sal_uLong nParas = mpTEParaPortions->Count(); + const sal_uInt32 nParas = mpTEParaPortions->Count(); const sal_Unicode* pSep = static_getLineEndText( aSeparator ); - for ( sal_uLong nP = 0; nP < nParas; nP++ ) + for ( sal_uInt32 nP = 0; nP < nParas; ++nP ) { TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nP ); @@ -279,7 +279,7 @@ OUString TextEngine::GetTextLines( LineEnd aSeparator ) const return aText; } -OUString TextEngine::GetText( sal_uLong nPara ) const +OUString TextEngine::GetText( sal_uInt32 nPara ) const { return mpDoc->GetText( nPara ); } @@ -297,7 +297,7 @@ sal_uLong TextEngine::GetTextLen( const TextSelection& rSel, LineEnd aSeparator return mpDoc->GetTextLen( static_getLineEndText( aSeparator ), &aSel ); } -sal_Int32 TextEngine::GetTextLen( sal_uLong nPara ) const +sal_Int32 TextEngine::GetTextLen( const sal_uInt32 nPara ) const { return mpDoc->GetNodes()[ nPara ]->GetText().getLength(); } @@ -386,7 +386,7 @@ void TextEngine::ImpInitDoc() mpDoc->GetNodes().insert( mpDoc->GetNodes().begin(), pNode ); TEParaPortion* pIniPortion = new TEParaPortion( pNode ); - mpTEParaPortions->Insert( pIniPortion, (sal_uLong)0 ); + mpTEParaPortions->Insert( pIniPortion, 0 ); mbFormatted = false; @@ -404,10 +404,10 @@ OUString TextEngine::GetText( const TextSelection& rSel, LineEnd aSeparator ) co TextSelection aSel( rSel ); aSel.Justify(); - sal_uLong nStartPara = aSel.GetStart().GetPara(); - sal_uLong nEndPara = aSel.GetEnd().GetPara(); + const sal_uInt32 nStartPara = aSel.GetStart().GetPara(); + const sal_uInt32 nEndPara = aSel.GetEnd().GetPara(); const sal_Unicode* pSep = static_getLineEndText( aSeparator ); - for ( sal_uLong nNode = aSel.GetStart().GetPara(); nNode <= nEndPara; nNode++ ) + for ( sal_uInt32 nNode = aSel.GetStart().GetPara(); nNode <= nEndPara; ++nNode ) { TextNode* pNode = mpDoc->GetNodes()[ nNode ]; @@ -429,8 +429,7 @@ void TextEngine::ImpRemoveText() { ImpInitDoc(); - TextPaM aStartPaM( 0, 0 ); - TextSelection aEmptySel( aStartPaM, aStartPaM ); + const TextSelection aEmptySel; for ( size_t nView = 0; nView < mpViews->size(); nView++ ) { TextView* pView = (*mpViews)[ nView ]; @@ -447,10 +446,9 @@ void TextEngine::SetText( const OUString& rText ) // the manually inserted text cannot be reversed by the user EnableUndo( false ); - TextPaM aStartPaM( 0, 0 ); - TextSelection aEmptySel( aStartPaM, aStartPaM ); + const TextSelection aEmptySel; - TextPaM aPaM = aStartPaM; + TextPaM aPaM; if ( !rText.isEmpty() ) aPaM = ImpInsertText( aEmptySel, rText ); @@ -473,7 +471,7 @@ void TextEngine::SetText( const OUString& rText ) DBG_ASSERT( !HasUndoManager() || !GetUndoManager().GetUndoActionCount(), "SetText: Undo!" ); } -void TextEngine::CursorMoved( sal_uLong nNode ) +void TextEngine::CursorMoved( sal_uInt32 nNode ) { // delete empty attribute; but only if paragraph is not empty! TextNode* pNode = mpDoc->GetNodes()[ nNode ]; @@ -508,7 +506,7 @@ void TextEngine::ImpRemoveChars( const TextPaM& rPaM, sal_Int32 nChars, SfxUndoA ImpCharsRemoved( rPaM.GetPara(), rPaM.GetIndex(), nChars ); } -TextPaM TextEngine::ImpConnectParagraphs( sal_uLong nLeft, sal_uLong nRight ) +TextPaM TextEngine::ImpConnectParagraphs( sal_uInt32 nLeft, sal_uInt32 nRight ) { DBG_ASSERT( nLeft != nRight, "ImpConnectParagraphs: connect the very same paragraph ?" ); @@ -552,11 +550,11 @@ TextPaM TextEngine::ImpDeleteText( const TextSelection& rSel ) DBG_ASSERT( mpDoc->IsValidPaM( aStartPaM ), "ImpDeleteText(1): bad Index" ); DBG_ASSERT( mpDoc->IsValidPaM( aEndPaM ), "ImpDeleteText(2): bad Index" ); - sal_uLong nStartNode = aStartPaM.GetPara(); - sal_uLong nEndNode = aEndPaM.GetPara(); + const sal_uInt32 nStartNode = aStartPaM.GetPara(); + sal_uInt32 nEndNode = aEndPaM.GetPara(); // remove all Nodes inbetween - for ( sal_uLong z = nStartNode+1; z < nEndNode; z++ ) + for ( sal_uInt32 z = nStartNode+1; z < nEndNode; ++z ) { // always nStartNode+1, because of Remove()! ImpRemoveParagraph( nStartNode+1 ); @@ -605,7 +603,7 @@ TextPaM TextEngine::ImpDeleteText( const TextSelection& rSel ) return aStartPaM; } -void TextEngine::ImpRemoveParagraph( sal_uLong nPara ) +void TextEngine::ImpRemoveParagraph( sal_uInt32 nPara ) { TextNode* pNode = mpDoc->GetNodes()[ nPara ]; std::unique_ptr<TEParaPortion> xPortion(mpTEParaPortions->GetObject( nPara )); @@ -863,7 +861,7 @@ Rectangle TextEngine::PaMtoEditCursor( const TextPaM& rPaM, bool bSpecial ) } else { - for ( sal_uLong nPortion = 0; nPortion < rPaM.GetPara(); nPortion++ ) + for ( sal_uInt32 nPortion = 0; nPortion < rPaM.GetPara(); ++nPortion ) { TEParaPortion* pPortion = mpTEParaPortions->GetObject(nPortion); nY += pPortion->GetLines().size() * mnCharHeight; @@ -929,7 +927,7 @@ Rectangle TextEngine::GetEditCursor( const TextPaM& rPaM, bool bSpecial, bool bP return aEditCursor; } -long TextEngine::ImpGetXPos( sal_uLong nPara, TextLine* pLine, sal_Int32 nIndex, bool bPreferPortionStart ) +long TextEngine::ImpGetXPos( sal_uInt32 nPara, TextLine* pLine, sal_Int32 nIndex, bool bPreferPortionStart ) { DBG_ASSERT( ( nIndex >= pLine->GetStart() ) && ( nIndex <= pLine->GetEnd() ) , "ImpGetXPos: Bad parameters!" ); @@ -1031,7 +1029,7 @@ const TextCharAttrib* TextEngine::FindCharAttrib( const TextPaM& rPaM, sal_uInt1 bool TextEngine::HasAttrib( sal_uInt16 nWhich ) const { bool bAttr = false; - for ( sal_uLong n = mpDoc->GetNodes().size(); --n && !bAttr; ) + for ( auto n = mpDoc->GetNodes().size(); --n && !bAttr; ) { TextNode* pNode = mpDoc->GetNodes()[ n ]; bAttr = pNode->GetCharAttribs().HasAttrib( nWhich ); @@ -1044,7 +1042,7 @@ TextPaM TextEngine::GetPaM( const Point& rDocPos, bool bSmart ) DBG_ASSERT( GetUpdateMode(), "GetPaM: GetUpdateMode()" ); long nY = 0; - for ( sal_uLong nPortion = 0; nPortion < mpTEParaPortions->Count(); nPortion++ ) + for ( sal_uInt32 nPortion = 0; nPortion < mpTEParaPortions->Count(); ++nPortion ) { TEParaPortion* pPortion = mpTEParaPortions->GetObject( nPortion ); long nTmpHeight = pPortion->GetLines().size() * mnCharHeight; @@ -1062,12 +1060,12 @@ TextPaM TextEngine::GetPaM( const Point& rDocPos, bool bSmart ) } // not found - go to last visible - sal_uLong nLastNode = mpDoc->GetNodes().size() - 1; + const sal_uInt32 nLastNode = static_cast<sal_uInt32>(mpDoc->GetNodes().size() - 1); TextNode* pLast = mpDoc->GetNodes()[ nLastNode ]; return TextPaM( nLastNode, pLast->GetText().getLength() ); } -sal_Int32 TextEngine::ImpFindIndex( sal_uLong nPortion, const Point& rPosInPara, bool bSmart ) +sal_Int32 TextEngine::ImpFindIndex( sal_uInt32 nPortion, const Point& rPosInPara, bool bSmart ) { DBG_ASSERT( IsFormatted(), "GetPaM: Not formatted" ); TEParaPortion* pPortion = mpTEParaPortions->GetObject( nPortion ); @@ -1102,7 +1100,7 @@ sal_Int32 TextEngine::ImpFindIndex( sal_uLong nPortion, const Point& rPosInPara, return nCurIndex; } -sal_Int32 TextEngine::GetCharPos( sal_uLong nPortion, sal_uInt16 nLine, long nXPos, bool ) +sal_Int32 TextEngine::GetCharPos( sal_uInt32 nPortion, sal_uInt16 nLine, long nXPos, bool ) { TEParaPortion* pPortion = mpTEParaPortions->GetObject( nPortion ); @@ -1151,7 +1149,7 @@ sal_uLong TextEngine::GetTextHeight() const return mnCurTextHeight; } -sal_uLong TextEngine::GetTextHeight( sal_uLong nParagraph ) const +sal_uLong TextEngine::GetTextHeight( sal_uInt32 nParagraph ) const { DBG_ASSERT( GetUpdateMode(), "GetTextHeight: GetUpdateMode()" ); @@ -1161,7 +1159,7 @@ sal_uLong TextEngine::GetTextHeight( sal_uLong nParagraph ) const return CalcParaHeight( nParagraph ); } -sal_uLong TextEngine::CalcTextWidth( sal_uLong nPara ) +sal_uLong TextEngine::CalcTextWidth( sal_uInt32 nPara ) { sal_uLong nParaWidth = 0; TEParaPortion* pPortion = mpTEParaPortions->GetObject( nPara ); @@ -1188,7 +1186,7 @@ sal_uLong TextEngine::CalcTextWidth() if ( mnCurTextWidth == 0xFFFFFFFF ) { mnCurTextWidth = 0; - for ( sal_uLong nPara = mpTEParaPortions->Count(); nPara; ) + for ( sal_uInt32 nPara = mpTEParaPortions->Count(); nPara; ) { sal_uLong nParaWidth = CalcTextWidth( --nPara ); if ( nParaWidth > mnCurTextWidth ) @@ -1203,12 +1201,12 @@ sal_uLong TextEngine::CalcTextHeight() DBG_ASSERT( GetUpdateMode(), "CalcTextHeight: GetUpdateMode()" ); sal_uLong nY = 0; - for ( sal_uLong nPortion = mpTEParaPortions->Count(); nPortion; ) + for ( auto nPortion = mpTEParaPortions->Count(); nPortion; ) nY += CalcParaHeight( --nPortion ); return nY; } -sal_uLong TextEngine::CalcTextWidth( sal_uLong nPara, sal_Int32 nPortionStart, sal_Int32 nLen, const vcl::Font* pFont ) +sal_uLong TextEngine::CalcTextWidth( sal_uInt32 nPara, sal_Int32 nPortionStart, sal_Int32 nLen, const vcl::Font* pFont ) { #ifdef DBG_UTIL // within the text there must not be a Portion change (attribute/tab)! @@ -1241,7 +1239,7 @@ sal_uLong TextEngine::CalcTextWidth( sal_uLong nPara, sal_Int32 nPortionStart, s return nWidth; } -sal_uInt16 TextEngine::GetLineCount( sal_uLong nParagraph ) const +sal_uInt16 TextEngine::GetLineCount( sal_uInt32 nParagraph ) const { DBG_ASSERT( nParagraph < mpTEParaPortions->Count(), "GetLineCount: Out of range" ); @@ -1252,7 +1250,7 @@ sal_uInt16 TextEngine::GetLineCount( sal_uLong nParagraph ) const return 0; } -sal_Int32 TextEngine::GetLineLen( sal_uLong nParagraph, sal_uInt16 nLine ) const +sal_Int32 TextEngine::GetLineLen( sal_uInt32 nParagraph, sal_uInt16 nLine ) const { DBG_ASSERT( nParagraph < mpTEParaPortions->Count(), "GetLineCount: Out of range" ); @@ -1265,7 +1263,7 @@ sal_Int32 TextEngine::GetLineLen( sal_uLong nParagraph, sal_uInt16 nLine ) const return 0; } -sal_uLong TextEngine::CalcParaHeight( sal_uLong nParagraph ) const +sal_uLong TextEngine::CalcParaHeight( sal_uInt32 nParagraph ) const { sal_uLong nHeight = 0; @@ -1277,7 +1275,7 @@ sal_uLong TextEngine::CalcParaHeight( sal_uLong nParagraph ) const return nHeight; } -Range TextEngine::GetInvalidYOffsets( sal_uLong nPortion ) +Range TextEngine::GetInvalidYOffsets( sal_uInt32 nPortion ) { TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPortion ); sal_uInt16 nLines = pTEParaPortion->GetLines().size(); @@ -1354,7 +1352,7 @@ void TextEngine::ResetUndo() mpUndoManager->Clear(); } -void TextEngine::InsertContent( TextNode* pNode, sal_uLong nPara ) +void TextEngine::InsertContent( TextNode* pNode, sal_uInt32 nPara ) { DBG_ASSERT( pNode, "InsertContent: NULL-Pointer!" ); DBG_ASSERT( IsInUndo(), "InsertContent: only in Undo()!" ); @@ -1364,7 +1362,7 @@ void TextEngine::InsertContent( TextNode* pNode, sal_uLong nPara ) ImpParagraphInserted( nPara ); } -TextPaM TextEngine::SplitContent( sal_uLong nNode, sal_Int32 nSepPos ) +TextPaM TextEngine::SplitContent( sal_uInt32 nNode, sal_Int32 nSepPos ) { #ifdef DBG_UTIL TextNode* pNode = mpDoc->GetNodes()[ nNode ]; @@ -1376,13 +1374,13 @@ TextPaM TextEngine::SplitContent( sal_uLong nNode, sal_Int32 nSepPos ) return ImpInsertParaBreak( aPaM ); } -TextPaM TextEngine::ConnectContents( sal_uLong nLeftNode ) +TextPaM TextEngine::ConnectContents( sal_uInt32 nLeftNode ) { DBG_ASSERT( IsInUndo(), "ConnectContent: only in Undo()!" ); return ImpConnectParagraphs( nLeftNode, nLeftNode+1 ); } -void TextEngine::SeekCursor( sal_uLong nPara, sal_Int32 nPos, vcl::Font& rFont, OutputDevice* pOutDev ) +void TextEngine::SeekCursor( sal_uInt32 nPara, sal_Int32 nPos, vcl::Font& rFont, OutputDevice* pOutDev ) { rFont = maFont; if ( pOutDev ) @@ -1520,7 +1518,7 @@ void TextEngine::CheckIdleFormatter() void TextEngine::FormatFullDoc() { - for ( sal_uLong nPortion = 0; nPortion < mpTEParaPortions->Count(); nPortion++ ) + for ( sal_uInt32 nPortion = 0; nPortion < mpTEParaPortions->Count(); ++nPortion ) { TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPortion ); sal_Int32 nLen = pTEParaPortion->GetNode()->GetText().getLength(); @@ -1542,7 +1540,7 @@ void TextEngine::FormatDoc() bool bGrow = false; maInvalidRect = Rectangle(); // clear - for ( sal_uLong nPara = 0; nPara < mpTEParaPortions->Count(); nPara++ ) + for ( sal_uInt32 nPara = 0; nPara < mpTEParaPortions->Count(); ++nPara ) { TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara ); if ( pTEParaPortion->IsInvalid() ) @@ -1620,7 +1618,7 @@ void TextEngine::FormatDoc() ImpTextFormatted(); } -void TextEngine::CreateAndInsertEmptyLine( sal_uLong nPara ) +void TextEngine::CreateAndInsertEmptyLine( sal_uInt32 nPara ) { TextNode* pNode = mpDoc->GetNodes()[ nPara ]; TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara ); @@ -1652,7 +1650,7 @@ void TextEngine::CreateAndInsertEmptyLine( sal_uLong nPara ) } } -void TextEngine::ImpBreakLine( sal_uLong nPara, TextLine* pLine, TETextPortion*, sal_Int32 nPortionStart, long nRemainingWidth ) +void TextEngine::ImpBreakLine( sal_uInt32 nPara, TextLine* pLine, TETextPortion*, sal_Int32 nPortionStart, long nRemainingWidth ) { TextNode* pNode = mpDoc->GetNodes()[ nPara ]; @@ -1702,7 +1700,7 @@ void TextEngine::ImpBreakLine( sal_uLong nPara, TextLine* pLine, TETextPortion*, pLine->SetEndPortion( nEndPortion ); } -sal_uInt16 TextEngine::SplitTextPortion( sal_uLong nPara, sal_Int32 nPos ) +sal_uInt16 TextEngine::SplitTextPortion( sal_uInt32 nPara, sal_Int32 nPos ) { // the Portion at nPos is being split, unless there is already a switch at nPos @@ -1738,7 +1736,7 @@ sal_uInt16 TextEngine::SplitTextPortion( sal_uLong nPara, sal_Int32 nPos ) return nSplitPortion; } -void TextEngine::CreateTextPortions( sal_uLong nPara, sal_Int32 nStartPos ) +void TextEngine::CreateTextPortions( sal_uInt32 nPara, sal_Int32 nStartPos ) { TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara ); TextNode* pNode = pTEParaPortion->GetNode(); @@ -1831,7 +1829,7 @@ void TextEngine::CreateTextPortions( sal_uLong nPara, sal_Int32 nStartPos ) OSL_ENSURE(pTEParaPortion->GetTextPortions().size(), "CreateTextPortions: No Portions?!"); } -void TextEngine::RecalcTextPortion( sal_uLong nPara, sal_Int32 nStartPos, sal_Int32 nNewChars ) +void TextEngine::RecalcTextPortion( sal_uInt32 nPara, sal_Int32 nStartPos, sal_Int32 nNewChars ) { TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara ); OSL_ENSURE(pTEParaPortion->GetTextPortions().size(), "RecalcTextPortion: no Portions!"); @@ -1942,7 +1940,7 @@ void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, Rectan const StyleSettings& rStyleSettings = pOutDev->GetSettings().GetStyleSettings(); // for all paragraphs - for ( sal_uLong nPara = 0; nPara < mpTEParaPortions->Count(); nPara++ ) + for ( sal_uInt32 nPara = 0; nPara < mpTEParaPortions->Count(); ++nPara ) { TEParaPortion* pPortion = mpTEParaPortions->GetObject( nPara ); // in case while typing Idle-Formatting, asynchronous Paint @@ -2120,7 +2118,7 @@ void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, Rectan } } -bool TextEngine::CreateLines( sal_uLong nPara ) +bool TextEngine::CreateLines( sal_uInt32 nPara ) { // bool: changing Height of Paragraph Yes/No - true/false @@ -2467,7 +2465,7 @@ bool TextEngine::Read( SvStream& rInput, const TextSelection* pSel ) aSel = *pSel; else { - sal_uLong nParas = mpDoc->GetNodes().size(); + sal_uInt32 nParas = static_cast<sal_uInt32>(mpDoc->GetNodes().size()); TextNode* pNode = mpDoc->GetNodes()[ nParas - 1 ]; aSel = TextPaM( nParas-1 , pNode->GetText().getLength() ); } @@ -2508,7 +2506,7 @@ bool TextEngine::Write( SvStream& rOutput, const TextSelection* pSel, bool bHTML aSel = *pSel; else { - sal_uLong nParas = mpDoc->GetNodes().size(); + sal_uInt32 nParas = static_cast<sal_uInt32>(mpDoc->GetNodes().size()); TextNode* pNode = mpDoc->GetNodes()[ nParas - 1 ]; aSel.GetStart() = TextPaM( 0, 0 ); aSel.GetEnd() = TextPaM( nParas-1, pNode->GetText().getLength() ); @@ -2520,7 +2518,7 @@ bool TextEngine::Write( SvStream& rOutput, const TextSelection* pSel, bool bHTML rOutput.WriteLine( "<BODY>" ); } - for ( sal_uLong nPara = aSel.GetStart().GetPara(); nPara <= aSel.GetEnd().GetPara(); nPara++ ) + for ( sal_uInt32 nPara = aSel.GetStart().GetPara(); nPara <= aSel.GetEnd().GetPara(); ++nPara ) { TextNode* pNode = mpDoc->GetNodes()[ nPara ]; @@ -2587,7 +2585,7 @@ bool TextEngine::Write( SvStream& rOutput, const TextSelection* pSel, bool bHTML return rOutput.GetError() == 0; } -void TextEngine::RemoveAttribs( sal_uLong nPara, bool bIdleFormatAndUpdate ) +void TextEngine::RemoveAttribs( sal_uInt32 nPara, bool bIdleFormatAndUpdate ) { if ( nPara < mpDoc->GetNodes().size() ) { @@ -2608,7 +2606,7 @@ void TextEngine::RemoveAttribs( sal_uLong nPara, bool bIdleFormatAndUpdate ) } } } -void TextEngine::RemoveAttribs( sal_uLong nPara, sal_uInt16 nWhich, bool bIdleFormatAndUpdate ) +void TextEngine::RemoveAttribs( sal_uInt32 nPara, sal_uInt16 nWhich, bool bIdleFormatAndUpdate ) { if ( nPara < mpDoc->GetNodes().size() ) { @@ -2632,7 +2630,7 @@ void TextEngine::RemoveAttribs( sal_uLong nPara, sal_uInt16 nWhich, bool bIdleFo } } } -void TextEngine::RemoveAttrib( sal_uLong nPara, const TextCharAttrib& rAttrib ) +void TextEngine::RemoveAttrib( sal_uInt32 nPara, const TextCharAttrib& rAttrib ) { if ( nPara < mpDoc->GetNodes().size() ) { @@ -2657,7 +2655,7 @@ void TextEngine::RemoveAttrib( sal_uLong nPara, const TextCharAttrib& rAttrib ) } } -void TextEngine::SetAttrib( const TextAttrib& rAttr, sal_uLong nPara, sal_Int32 nStart, sal_Int32 nEnd, bool bIdleFormatAndUpdate ) +void TextEngine::SetAttrib( const TextAttrib& rAttr, sal_uInt32 nPara, sal_Int32 nStart, sal_Int32 nEnd, bool bIdleFormatAndUpdate ) { // For now do not check if Attributes overlap! @@ -2705,10 +2703,10 @@ void TextEngine::ValidateSelection( TextSelection& rSel ) const void TextEngine::ValidatePaM( TextPaM& rPaM ) const { - sal_uLong nMaxPara = mpDoc->GetNodes().size() - 1; - if ( rPaM.GetPara() > nMaxPara ) + const sal_uInt32 nParas = static_cast<sal_uInt32>(mpDoc->GetNodes().size()); + if ( rPaM.GetPara() >= nParas ) { - rPaM.GetPara() = nMaxPara; + rPaM.GetPara() = nParas ? nParas-1 : 0; rPaM.GetIndex() = 0xFFFF; } @@ -2719,7 +2717,7 @@ void TextEngine::ValidatePaM( TextPaM& rPaM ) const // adjust State & Selection -void TextEngine::ImpParagraphInserted( sal_uLong nPara ) +void TextEngine::ImpParagraphInserted( sal_uInt32 nPara ) { // No adjustment needed for the active View; // but for all passive Views the Selection needs adjusting. @@ -2742,7 +2740,7 @@ void TextEngine::ImpParagraphInserted( sal_uLong nPara ) Broadcast( TextHint( TEXT_HINT_PARAINSERTED, nPara ) ); } -void TextEngine::ImpParagraphRemoved( sal_uLong nPara ) +void TextEngine::ImpParagraphRemoved( sal_uInt32 nPara ) { if ( mpViews->size() > 1 ) { @@ -2751,7 +2749,7 @@ void TextEngine::ImpParagraphRemoved( sal_uLong nPara ) TextView* pView = (*mpViews)[ --nView ]; if ( pView != GetActiveView() ) { - sal_uLong nParas = mpDoc->GetNodes().size(); + const sal_uInt32 nParas = static_cast<sal_uInt32>(mpDoc->GetNodes().size()); for ( int n = 0; n <= 1; n++ ) { TextPaM& rPaM = n ? pView->GetSelection().GetStart(): pView->GetSelection().GetEnd(); @@ -2770,7 +2768,7 @@ void TextEngine::ImpParagraphRemoved( sal_uLong nPara ) Broadcast( TextHint( TEXT_HINT_PARAREMOVED, nPara ) ); } -void TextEngine::ImpCharsRemoved( sal_uLong nPara, sal_Int32 nPos, sal_Int32 nChars ) +void TextEngine::ImpCharsRemoved( sal_uInt32 nPara, sal_Int32 nPos, sal_Int32 nChars ) { if ( mpViews->size() > 1 ) { @@ -2797,7 +2795,7 @@ void TextEngine::ImpCharsRemoved( sal_uLong nPara, sal_Int32 nPos, sal_Int32 nCh Broadcast( TextHint( TEXT_HINT_PARACONTENTCHANGED, nPara ) ); } -void TextEngine::ImpCharsInserted( sal_uLong nPara, sal_Int32 nPos, sal_Int32 nChars ) +void TextEngine::ImpCharsInserted( sal_uInt32 nPara, sal_Int32 nPos, sal_Int32 nChars ) { if ( mpViews->size() > 1 ) { @@ -2821,7 +2819,7 @@ void TextEngine::ImpCharsInserted( sal_uLong nPara, sal_Int32 nPos, sal_Int32 nC Broadcast( TextHint( TEXT_HINT_PARACONTENTCHANGED, nPara ) ); } -void TextEngine::ImpFormattingParagraph( sal_uLong nPara ) +void TextEngine::ImpFormattingParagraph( sal_uInt32 nPara ) { Broadcast( TextHint( TEXT_HINT_FORMATPARA, nPara ) ); } @@ -2889,7 +2887,7 @@ void TextEngine::SetRightToLeft( bool bR2L ) } } -void TextEngine::ImpInitWritingDirections( sal_uLong nPara ) +void TextEngine::ImpInitWritingDirections( sal_uInt32 nPara ) { TEParaPortion* pParaPortion = mpTEParaPortions->GetObject( nPara ); std::vector<TEWritingDirectionInfo>& rInfos = pParaPortion->GetWritingDirectionInfos(); @@ -2931,7 +2929,7 @@ void TextEngine::ImpInitWritingDirections( sal_uLong nPara ) } -sal_uInt8 TextEngine::ImpGetRightToLeft( sal_uLong nPara, sal_Int32 nPos, sal_Int32* pStart, sal_Int32* pEnd ) +sal_uInt8 TextEngine::ImpGetRightToLeft( sal_uInt32 nPara, sal_Int32 nPos, sal_Int32* pStart, sal_Int32* pEnd ) { sal_uInt8 nRightToLeft = 0; @@ -2959,7 +2957,7 @@ sal_uInt8 TextEngine::ImpGetRightToLeft( sal_uLong nPara, sal_Int32 nPos, sal_In return nRightToLeft; } -long TextEngine::ImpGetPortionXOffset( sal_uLong nPara, TextLine* pLine, sal_uInt16 nTextPortion ) +long TextEngine::ImpGetPortionXOffset( sal_uInt32 nPara, TextLine* pLine, sal_uInt16 nTextPortion ) { long nX = pLine->GetStartX(); @@ -3053,7 +3051,7 @@ TxtAlign TextEngine::ImpGetAlign() const return eAlign; } -long TextEngine::ImpGetOutputOffset( sal_uLong nPara, TextLine* pLine, sal_Int32 nIndex, sal_Int32 nIndex2 ) +long TextEngine::ImpGetOutputOffset( sal_uInt32 nPara, TextLine* pLine, sal_Int32 nIndex, sal_Int32 nIndex2 ) { TEParaPortion* pPortion = mpTEParaPortions->GetObject( nPara ); diff --git a/vcl/source/edit/textund2.hxx b/vcl/source/edit/textund2.hxx index fc33c27da396..3b8a10465589 100644 --- a/vcl/source/edit/textund2.hxx +++ b/vcl/source/edit/textund2.hxx @@ -26,12 +26,12 @@ class TextUndoDelPara : public TextUndo { private: bool mbDelObject; - sal_uLong mnPara; + sal_uInt32 mnPara; TextNode* mpNode; // points at the valid not-destroyed object public: TYPEINFO_OVERRIDE(); - TextUndoDelPara( TextEngine* pTextEngine, TextNode* pNode, sal_uLong nPara ); + TextUndoDelPara( TextEngine* pTextEngine, TextNode* pNode, sal_uInt32 nPara ); virtual ~TextUndoDelPara(); virtual void Undo() SAL_OVERRIDE; @@ -43,12 +43,12 @@ public: class TextUndoConnectParas : public TextUndo { private: - sal_uLong mnPara; + sal_uInt32 mnPara; sal_Int32 mnSepPos; public: TYPEINFO_OVERRIDE(); - TextUndoConnectParas( TextEngine* pTextEngine, sal_uLong nPara, sal_Int32 nSepPos ); + TextUndoConnectParas( TextEngine* pTextEngine, sal_uInt32 nPara, sal_Int32 nSepPos ); virtual ~TextUndoConnectParas(); virtual void Undo() SAL_OVERRIDE; @@ -60,12 +60,12 @@ public: class TextUndoSplitPara : public TextUndo { private: - sal_uLong mnPara; + sal_uInt32 mnPara; sal_Int32 mnSepPos; public: TYPEINFO_OVERRIDE(); - TextUndoSplitPara( TextEngine* pTextEngine, sal_uLong nPara, sal_Int32 nSepPos ); + TextUndoSplitPara( TextEngine* pTextEngine, sal_uInt32 nPara, sal_Int32 nSepPos ); virtual ~TextUndoSplitPara(); virtual void Undo() SAL_OVERRIDE; diff --git a/vcl/source/edit/textundo.cxx b/vcl/source/edit/textundo.cxx index 41391ac4bd86..d47ff8f67ca8 100644 --- a/vcl/source/edit/textundo.cxx +++ b/vcl/source/edit/textundo.cxx @@ -142,7 +142,7 @@ void TextUndo::SetSelection( const TextSelection& rSel ) GetView()->ImpSetSelection( rSel ); } -TextUndoDelPara::TextUndoDelPara( TextEngine* pTextEngine, TextNode* pNode, sal_uLong nPara ) +TextUndoDelPara::TextUndoDelPara( TextEngine* pTextEngine, TextNode* pNode, sal_uInt32 nPara ) : TextUndo( pTextEngine ) { mpNode = pNode; @@ -182,8 +182,8 @@ void TextUndoDelPara::Redo() mbDelObject = true; // belongs again to the Undo - sal_uLong nParas = GetDoc()->GetNodes().size(); - sal_uLong n = mnPara < nParas ? mnPara : (nParas-1); + const sal_uInt32 nParas = static_cast<sal_uInt32>(GetDoc()->GetNodes().size()); + const sal_uInt32 n = mnPara < nParas ? mnPara : nParas-1; TextNode* pN = GetDoc()->GetNodes()[ n ]; TextPaM aPaM( n, pN->GetText().getLength() ); SetSelection( aPaM ); @@ -194,7 +194,7 @@ OUString TextUndoDelPara::GetComment () const return ResId(STR_TEXTUNDO_DELPARA, *ImplGetResMgr()); } -TextUndoConnectParas::TextUndoConnectParas( TextEngine* pTextEngine, sal_uLong nPara, sal_Int32 nPos ) +TextUndoConnectParas::TextUndoConnectParas( TextEngine* pTextEngine, sal_uInt32 nPara, sal_Int32 nPos ) : TextUndo( pTextEngine ) { mnPara = nPara; @@ -222,7 +222,7 @@ OUString TextUndoConnectParas::GetComment () const return ResId(STR_TEXTUNDO_CONNECTPARAS, *ImplGetResMgr()).toString(); } -TextUndoSplitPara::TextUndoSplitPara( TextEngine* pTextEngine, sal_uLong nPara, sal_Int32 nPos ) +TextUndoSplitPara::TextUndoSplitPara( TextEngine* pTextEngine, sal_uInt32 nPara, sal_Int32 nPos ) : TextUndo( pTextEngine ) { mnPara = nPara; diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx index fb28c7d2a8e8..c526ffe5759f 100644 --- a/vcl/source/edit/textview.cxx +++ b/vcl/source/edit/textview.cxx @@ -401,9 +401,9 @@ void TextView::ImpHighlight( const TextSelection& rSel ) Rectangle aVisArea( mpImpl->maStartDocPos, mpImpl->mpWindow->GetOutputSizePixel() ); long nY = 0; - sal_uLong nStartPara = aSel.GetStart().GetPara(); - sal_uLong nEndPara = aSel.GetEnd().GetPara(); - for ( sal_uLong nPara = 0; nPara <= nEndPara; nPara++ ) + const sal_uInt32 nStartPara = aSel.GetStart().GetPara(); + const sal_uInt32 nEndPara = aSel.GetEnd().GetPara(); + for ( sal_uInt32 nPara = 0; nPara <= nEndPara; ++nPara ) { long nParaHeight = (long)mpImpl->mpTextEngine->CalcParaHeight( nPara ); if ( ( nPara >= nStartPara ) && ( ( nY + nParaHeight ) > aVisArea.Top() ) ) @@ -685,11 +685,11 @@ bool TextView::KeyInput( const KeyEvent& rKeyEvent ) //expand selection to include all protected content - if there is any const TextCharAttrib* pStartAttr = mpImpl->mpTextEngine->FindCharAttrib( TextPaM(mpImpl->maSelection.GetStart().GetPara(), - mpImpl->maSelection.GetStart().GetIndex()), + mpImpl->maSelection.GetStart().GetIndex()), TEXTATTR_PROTECTED ); const TextCharAttrib* pEndAttr = mpImpl->mpTextEngine->FindCharAttrib( TextPaM(mpImpl->maSelection.GetEnd().GetPara(), - mpImpl->maSelection.GetEnd().GetIndex()), + mpImpl->maSelection.GetEnd().GetIndex()), TEXTATTR_PROTECTED ); if(pStartAttr && pStartAttr->GetStart() < mpImpl->maSelection.GetStart().GetIndex()) { @@ -1634,7 +1634,7 @@ TextPaM TextView::CursorStartOfDoc() TextPaM TextView::CursorEndOfDoc() { - sal_uLong nNode = mpImpl->mpTextEngine->mpDoc->GetNodes().size() - 1; + const sal_uInt32 nNode = static_cast<sal_uInt32>(mpImpl->mpTextEngine->mpDoc->GetNodes().size() - 1); TextNode* pNode = mpImpl->mpTextEngine->mpDoc->GetNodes()[ nNode ]; TextPaM aPaM( nNode, pNode->GetText().getLength() ); return aPaM; @@ -1854,9 +1854,9 @@ bool TextView::IsInSelection( const TextPaM& rPaM ) TextSelection aSel = mpImpl->maSelection; aSel.Justify(); - sal_uLong nStartNode = aSel.GetStart().GetPara(); - sal_uLong nEndNode = aSel.GetEnd().GetPara(); - sal_uLong nCurNode = rPaM.GetPara(); + const sal_uInt32 nStartNode = aSel.GetStart().GetPara(); + const sal_uInt32 nEndNode = aSel.GetEnd().GetPara(); + const sal_uInt32 nCurNode = rPaM.GetPara(); if ( ( nCurNode > nStartNode ) && ( nCurNode < nEndNode ) ) return true; diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx index f4b87780f1f8..6e18ae4883e1 100644 --- a/vcl/source/edit/vclmedit.cxx +++ b/vcl/source/edit/vclmedit.cxx @@ -580,8 +580,8 @@ void ImpVclMEdit::SetSelection( const Selection& rSelection ) long nEnd = std::max( aNewSelection.Min(), aNewSelection.Max() ); TextSelection aTextSel; - sal_uLong nPara = 0; - sal_uInt16 nChar = 0; + sal_uInt32 nPara = 0; + sal_Int32 nChar = 0; sal_uInt16 x = 0; while ( x <= nEnd ) { @@ -611,8 +611,7 @@ const Selection& ImpVclMEdit::GetSelection() const ExtTextEngine* pExtTextEngine = mpTextWindow->GetTextEngine(); // paragraphs before - sal_uLong n; - for ( n = 0; n < aTextSel.GetStart().GetPara(); n++ ) + for ( sal_uInt32 n = 0; n < aTextSel.GetStart().GetPara(); ++n ) { maSelection.Min() += pExtTextEngine->GetTextLen( n ); maSelection.Min()++; @@ -622,7 +621,7 @@ const Selection& ImpVclMEdit::GetSelection() const maSelection.Max() = maSelection.Min(); maSelection.Min() += aTextSel.GetStart().GetIndex(); - for ( n = aTextSel.GetStart().GetPara(); n < aTextSel.GetEnd().GetPara(); n++ ) + for ( sal_uInt32 n = aTextSel.GetStart().GetPara(); n < aTextSel.GetEnd().GetPara(); ++n ) { maSelection.Max() += pExtTextEngine->GetTextLen( n ); maSelection.Max()++; diff --git a/vcl/source/edit/xtextedt.cxx b/vcl/source/edit/xtextedt.cxx index 222cbe4ff00a..8abe3438f06b 100644 --- a/vcl/source/edit/xtextedt.cxx +++ b/vcl/source/edit/xtextedt.cxx @@ -38,8 +38,8 @@ TextSelection ExtTextEngine::MatchGroup( const TextPaM& rCursor ) const { TextSelection aSel( rCursor ); const sal_Int32 nPos = rCursor.GetIndex(); - sal_uLong nPara = rCursor.GetPara(); - sal_uLong nParas = GetParagraphCount(); + sal_uInt32 nPara = rCursor.GetPara(); + const sal_uInt32 nParas = GetParagraphCount(); if ( ( nPara < nParas ) && ( nPos < GetTextLen( nPara ) ) ) { sal_Int32 nMatchIndex = maGroupChars.indexOf( GetText( rCursor.GetPara() )[ nPos ] ); @@ -147,21 +147,21 @@ bool ExtTextEngine::Search( TextSelection& rSel, const util::SearchOptions& rSea } bool bFound = false; - sal_uLong nStartNode, nEndNode; + sal_uInt32 nEndNode; if ( bSearchInSelection ) nEndNode = bForward ? aSel.GetEnd().GetPara() : aSel.GetStart().GetPara(); else nEndNode = bForward ? (GetParagraphCount()-1) : 0; - nStartNode = aStartPaM.GetPara(); + const sal_uInt32 nStartNode = aStartPaM.GetPara(); util::SearchOptions aOptions( rSearchOptions ); aOptions.Locale = Application::GetSettings().GetLanguageTag().getLocale(); utl::TextSearch aSearcher( rSearchOptions ); // iterate over the paragraphs - for ( sal_uLong nNode = nStartNode; + for ( sal_uInt32 nNode = nStartNode; bForward ? ( nNode <= nEndNode) : ( nNode >= nEndNode ); bForward ? nNode++ : nNode-- ) { @@ -339,14 +339,14 @@ bool ExtTextView::ImpIndentBlock( bool bRight ) HideSelection(); GetTextEngine()->UndoActionStart(); - sal_uLong nStartPara = aSel.GetStart().GetPara(); - sal_uLong nEndPara = aSel.GetEnd().GetPara(); + const sal_uInt32 nStartPara = aSel.GetStart().GetPara(); + sal_uInt32 nEndPara = aSel.GetEnd().GetPara(); if ( aSel.HasRange() && !aSel.GetEnd().GetIndex() ) { nEndPara--; // do not indent } - for ( sal_uLong nPara = nStartPara; nPara <= nEndPara; nPara++ ) + for ( sal_uInt32 nPara = nStartPara; nPara <= nEndPara; ++nPara ) { if ( bRight ) { |