[Libreoffice-commits] core.git: 4 commits - dbaccess/source include/svtools include/vcl svtools/source svx/source sw/source vcl/source

Caolán McNamara caolanm at redhat.com
Sat Jan 11 12:18:44 PST 2014


 dbaccess/source/ui/control/FieldDescControl.cxx |    6 ++--
 dbaccess/source/ui/dlg/dlgsave.cxx              |    2 -
 dbaccess/source/ui/misc/WCPage.cxx              |    4 +-
 dbaccess/source/ui/tabledesign/TEditControl.cxx |    8 ++---
 include/svtools/editbrowsebox.hxx               |    8 ++---
 include/svtools/editimplementation.hxx          |    6 ++--
 include/vcl/cmdevt.hxx                          |    6 ----
 include/vcl/edit.hxx                            |   12 ++++----
 include/vcl/vclmedit.hxx                        |    4 +-
 svtools/source/uno/unoiface.cxx                 |    2 -
 svx/source/fmcomp/gridcell.cxx                  |    8 ++---
 svx/source/inc/gridcell.hxx                     |    6 ++--
 sw/source/ui/docvw/edtwin.cxx                   |    2 -
 vcl/source/control/combobox.cxx                 |    2 -
 vcl/source/control/edit.cxx                     |   28 +++++++++-----------
 vcl/source/edit/vclmedit.cxx                    |   33 +++++++++++-------------
 vcl/source/gdi/cvtsvm.cxx                       |    4 +-
 vcl/source/window/cmdevt.cxx                    |    6 ----
 vcl/source/window/winproc.cxx                   |    5 +--
 19 files changed, 68 insertions(+), 84 deletions(-)

New commits:
commit f3f6629a2ec9fc5f02d2102f2b4c6407f851208c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Jan 11 17:15:18 2014 +0000

    longparas: OldTextLen and DeltaStart are unused
    
    Change-Id: Icfcbfece1954675cd4b8882f66726d80b7315e61

diff --git a/include/vcl/cmdevt.hxx b/include/vcl/cmdevt.hxx
index 58b8b08..e67a2a9 100644
--- a/include/vcl/cmdevt.hxx
+++ b/include/vcl/cmdevt.hxx
@@ -48,8 +48,6 @@ private:
     OUString            maText;
     sal_uInt16*             mpTextAttr;
     xub_StrLen          mnCursorPos;
-    xub_StrLen          mnDeltaStart;
-    xub_StrLen          mnOldTextLen;
     sal_uInt16              mnCursorFlags;
     sal_Bool                mbOnlyCursor;
 
@@ -58,8 +56,6 @@ public:
                                                  const sal_uInt16* pTextAttr,
                                                  sal_Int32 nCursorPos,
                                                  sal_uInt16 nCursorFlags,
-                                                 sal_Int32 nDeltaStart,
-                                                 sal_Int32 nOldTextLen,
                                                  sal_Bool bOnlyCursor );
                         CommandExtTextInputData( const CommandExtTextInputData& rData );
                         ~CommandExtTextInputData();
@@ -71,8 +67,6 @@ public:
     sal_Bool                IsCursorVisible() const { return (mnCursorFlags & EXTTEXTINPUT_CURSOR_INVISIBLE) == 0; }
     sal_Bool                IsCursorOverwrite() const { return (mnCursorFlags & EXTTEXTINPUT_CURSOR_OVERWRITE) != 0; }
     sal_uInt16              GetCursorFlags() const { return mnCursorFlags; }
-    xub_StrLen          GetDeltaStart() const { return mnDeltaStart; }
-    xub_StrLen          GetOldTextLen() const { return mnOldTextLen; }
     sal_Bool                IsOnlyCursorChanged() const { return mbOnlyCursor; }
 };
 
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index 93607fb..0cf02b6 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -5778,7 +5778,7 @@ void QuickHelpData::Start( SwWrtShell& rSh, sal_uInt16 nWrdLen )
                                 EXTTEXTINPUT_ATTR_HIGHLIGHT;
         const std::vector<sal_uInt16> aAttrs( nL, nVal );
         CommandExtTextInputData aCETID( sStr, &aAttrs[0], nL,
-                                        0, 0, 0, sal_False );
+                                        0, false );
 
         //fdo#33092. If the current input language is the default
         //language that text would appear in if typed, then don't
diff --git a/vcl/source/window/cmdevt.cxx b/vcl/source/window/cmdevt.cxx
index 15f6d06..6326def 100644
--- a/vcl/source/window/cmdevt.cxx
+++ b/vcl/source/window/cmdevt.cxx
@@ -26,8 +26,6 @@ CommandExtTextInputData::CommandExtTextInputData( const OUString& rText,
                                                   const sal_uInt16* pTextAttr,
                                                   sal_Int32 nCursorPos,
                                                   sal_uInt16 nCursorFlags,
-                                                  sal_Int32 nDeltaStart,
-                                                  sal_Int32 nOldTextLen,
                                                   sal_Bool bOnlyCursor ) :
     maText( rText )
 {
@@ -39,8 +37,6 @@ CommandExtTextInputData::CommandExtTextInputData( const OUString& rText,
     else
         mpTextAttr = NULL;
     mnCursorPos     = nCursorPos;
-    mnDeltaStart    = nDeltaStart;
-    mnOldTextLen    = nOldTextLen;
     mnCursorFlags   = nCursorFlags;
     mbOnlyCursor    = bOnlyCursor;
 }
@@ -58,8 +54,6 @@ CommandExtTextInputData::CommandExtTextInputData( const CommandExtTextInputData&
     else
         mpTextAttr = NULL;
     mnCursorPos     = rData.mnCursorPos;
-    mnDeltaStart    = rData.mnDeltaStart;
-    mnOldTextLen    = rData.mnOldTextLen;
     mnCursorFlags   = rData.mnCursorFlags;
     mbOnlyCursor    = rData.mbOnlyCursor;
 }
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index 83cd4d2..d42cb95 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -1301,7 +1301,6 @@ static long ImplHandleExtTextInput( Window* pWindow,
     // Call Event and store the information
     CommandExtTextInputData aData( rText, pTextAttr,
                                    nCursorPos, nCursorFlags,
-                                   nDeltaStart, pWinData->mpExtOldText->getLength(),
                                    bOnlyCursor );
     *pWinData->mpExtOldText = rText;
     if ( pWinData->mpExtOldAttrAry )
commit cea2bd4d2d4601c22b6706c3ec334c4ad8b55c2d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Jan 11 17:00:51 2014 +0000

    longparas: unnecessary xub_StrLen cast
    
    Change-Id: I794faf7ba0c2dd32b0c846dd1cf6d1825cf8b63c

diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 214bbf5..92ea28e 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -394,7 +394,7 @@ IMPL_LINK_NOARG(ComboBox, ImplSelectHdl)
                 if ( (nP != LISTBOX_ENTRY_NOTFOUND) && (!mpImplLB->GetEntryList()->IsEntryPosSelected( nP )) )
                 {
                     aText = aText.replaceAt( nPrevIndex, nTokenLen, "" );
-                    nIndex = sal::static_int_cast<xub_StrLen>(nIndex - nTokenLen);
+                    nIndex = nIndex - nTokenLen;
                     sal_Int32 nSepCount=0;
                     if ( (nPrevIndex+nSepCount < aText.getLength()) && (aText[nPrevIndex+nSepCount] == mcMultiSep) )
                     {
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 460244e..aa579e7 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -1297,12 +1297,12 @@ sal_Int32 Edit::ImplGetCharPos( const Point& rWindowPos ) const
 
     GetCaretPositions( aText, pDX, 0, aText.getLength() );
     long nX = rWindowPos.X() - mnXOffset - ImplGetExtraOffset();
-    for( int i = 0; i < aText.getLength(); i++ )
+    for( sal_Int32 i = 0; i < aText.getLength(); i++ )
     {
         if( (pDX[2*i] >= nX && pDX[2*i+1] <= nX) ||
             (pDX[2*i+1] >= nX && pDX[2*i] <= nX))
         {
-            nIndex = sal::static_int_cast<xub_StrLen>(i);
+            nIndex = i;
             if( pDX[2*i] < pDX[2*i+1] )
             {
                 if( nX > (pDX[2*i]+pDX[2*i+1])/2 )
@@ -1320,13 +1320,13 @@ sal_Int32 Edit::ImplGetCharPos( const Point& rWindowPos ) const
     {
         nIndex = 0;
         long nDiff = std::abs( pDX[0]-nX );
-        for( int i = 1; i < aText.getLength(); i++ )
+        for( sal_Int32 i = 1; i < aText.getLength(); i++ )
         {
             long nNewDiff = std::abs( pDX[2*i]-nX );
 
             if( nNewDiff < nDiff )
             {
-                nIndex = sal::static_int_cast<xub_StrLen>(i);
+                nIndex = i;
                 nDiff = nNewDiff;
             }
         }
@@ -2270,7 +2270,7 @@ void Edit::Command( const CommandEvent& rCEvt )
     {
         if ( mpIMEInfos )
         {
-            xub_StrLen nCursorPos = (sal_uInt16)GetSelection().Max();
+            sal_Int32 nCursorPos = GetSelection().Max();
             SetCursorRect( NULL, GetTextWidth( maText.toString(), nCursorPos, mpIMEInfos->nPos+mpIMEInfos->nLen-nCursorPos ) );
         }
         else
diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx
index 2f4c755..3d9cec0 100644
--- a/vcl/source/edit/vclmedit.cxx
+++ b/vcl/source/edit/vclmedit.cxx
@@ -91,7 +91,7 @@ private:
     ScrollBarBox*       mpScrollBox;
 
     Point               maTextWindowOffset;
-    xub_StrLen          mnTextWidth;
+    sal_Int32           mnTextWidth;
     mutable Selection   maSelection;
 
 protected:
@@ -286,7 +286,7 @@ void ImpVclMEdit::ImpSetScrollBarRanges()
         // Es gibt kein Notify bei Breiten-Aenderung...
 //      sal_uLong nW = Max( (sal_uLong)mpTextWindow->GetOutputSizePixel().Width()*5, (sal_uLong)nTextWidth );
 //      mpHScrollBar->SetRange( Range( 0, (long)nW ) );
-        mpHScrollBar->SetRange( Range( 0, (long)mnTextWidth-1 ) );
+        mpHScrollBar->SetRange( Range( 0, mnTextWidth-1 ) );
     }
 }
 
@@ -547,11 +547,11 @@ void ImpVclMEdit::Notify( SfxBroadcaster&, const SfxHint& rHint )
         {
             if ( mpHScrollBar )
             {
-                sal_uLong nWidth = mpTextWindow->GetTextEngine()->CalcTextWidth();
+                sal_Int32 nWidth = mpTextWindow->GetTextEngine()->CalcTextWidth();
                 if ( nWidth != mnTextWidth )
                 {
-                    mnTextWidth = sal::static_int_cast< xub_StrLen >(nWidth);
-                    mpHScrollBar->SetRange( Range( 0, (long)mnTextWidth-1 ) );
+                    mnTextWidth = nWidth;
+                    mpHScrollBar->SetRange( Range( 0, mnTextWidth-1 ) );
                     ImpSetHScrollBarThumbPos();
                 }
             }
diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx
index 54dafd3..43b285c 100644
--- a/vcl/source/gdi/cvtsvm.cxx
+++ b/vcl/source/gdi/cvtsvm.cxx
@@ -281,13 +281,13 @@ void ImplReadUnicodeComment( sal_uInt32 nStrmPos, SvStream& rIStm, OUString& rSt
     {
         sal_uInt16  nType;
         sal_uInt32  nActionSize;
-        xub_StrLen  nStringLen;
+        sal_Size    nStringLen;
 
         rIStm.Seek( nStrmPos );
         rIStm   >> nType
                 >> nActionSize;
 
-        nStringLen = sal::static_int_cast<xub_StrLen>(( nActionSize - 4 ) >> 1);
+        nStringLen = (nActionSize - 4) >> 1;
 
         if ( nStringLen && ( nType == GDI_UNICODE_COMMENT ) )
             rString = read_uInt16s_ToOUString(rIStm, nStringLen);
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index 7a93680..83cd4d2 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -1282,7 +1282,7 @@ static long ImplHandleExtTextInput( Window* pWindow,
             nDeltaStart = 0;
         else
         {
-            xub_StrLen i = 0;
+            sal_Int32 i = 0;
             while ( i < nDeltaStart )
             {
                 if ( pWinData->mpExtOldAttrAry[i] != pTextAttr[i] )
@@ -1300,7 +1300,7 @@ static long ImplHandleExtTextInput( Window* pWindow,
 
     // Call Event and store the information
     CommandExtTextInputData aData( rText, pTextAttr,
-                                   (xub_StrLen)nCursorPos, nCursorFlags,
+                                   nCursorPos, nCursorFlags,
                                    nDeltaStart, pWinData->mpExtOldText->getLength(),
                                    bOnlyCursor );
     *pWinData->mpExtOldText = rText;
commit 3a81e90a45e361bef3dbacf533f6a5ddf7e901fa
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Jan 11 16:37:01 2014 +0000

    longparas: lift 16bit max edit length
    
    Change-Id: Ide74f0a48f06cbe9539f16ef6c6d04bba043dcf9

diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx
index 40b2f4b..9f76105 100644
--- a/dbaccess/source/ui/control/FieldDescControl.cxx
+++ b/dbaccess/source/ui/control/FieldDescControl.cxx
@@ -896,7 +896,7 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
             return;
         m_nPos++;
         {
-            sal_uInt32 nMax = EDIT_NOLIMIT;
+            sal_Int32 nMax = EDIT_NOLIMIT;
             OUString aTmpString;
             try
             {
@@ -907,7 +907,7 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
                     aTmpString = xMetaData->getExtraNameCharacters();
                 }
             }
-            catch(Exception&)
+            catch (const Exception&)
             {
                 DBG_UNHANDLED_EXCEPTION();
             }
@@ -917,7 +917,7 @@ void OFieldDescControl::ActivateAggregate( EControlType eType )
                                                     STR_HELP_DEFAULT_VALUE,
                                                     FIELD_PRPOERTY_COLUMNNAME,
                                                     WB_BORDER );
-            m_pColumnName->SetMaxTextLen(xub_StrLen( nMax ? nMax : EDIT_NOLIMIT));
+            m_pColumnName->SetMaxTextLen(nMax ? nMax : EDIT_NOLIMIT);
             m_pColumnName->setCheck( isSQL92CheckEnabled(getConnection()) );
         }
 
diff --git a/dbaccess/source/ui/dlg/dlgsave.cxx b/dbaccess/source/ui/dlg/dlgsave.cxx
index c7d63f7..ce21f4d 100644
--- a/dbaccess/source/ui/dlg/dlgsave.cxx
+++ b/dbaccess/source/ui/dlg/dlgsave.cxx
@@ -271,7 +271,7 @@ OSaveAsDlg::OSaveAsDlg( Window * pParent,
                 m_pImpl->m_aPB_CANCEL.SetPosPixel(Point(m_pImpl->m_aPB_CANCEL.GetPosPixel().X(),aPos.Y()));
                 m_pImpl->m_aPB_HELP.SetPosPixel(Point(m_pImpl->m_aPB_HELP.GetPosPixel().X(),aPos.Y()));
 
-                sal_uInt16 nLength =  m_pImpl->m_xMetaData.is() ? static_cast<sal_uInt16>(m_pImpl->m_xMetaData->getMaxTableNameLength()) : 0;
+                sal_Int32 nLength =  m_pImpl->m_xMetaData.is() ? m_pImpl->m_xMetaData->getMaxTableNameLength() : 0;
                 nLength = nLength ? nLength : EDIT_NOLIMIT;
 
                 m_pImpl->m_aTitle.SetMaxTextLen(nLength);
diff --git a/dbaccess/source/ui/misc/WCPage.cxx b/dbaccess/source/ui/misc/WCPage.cxx
index 67c4eb2..ad6439f 100644
--- a/dbaccess/source/ui/misc/WCPage.cxx
+++ b/dbaccess/source/ui/misc/WCPage.cxx
@@ -71,7 +71,7 @@ OCopyTable::OCopyTable( Window * pParent )
 {
     DBG_CTOR(OCopyTable,NULL);
 
-    m_edTableName.SetMaxTextLen( EDIT_NOLIMIT );
+    m_edTableName.SetMaxTextLen(EDIT_NOLIMIT);
 
     if ( m_pParent->m_xDestConnection.is() )
     {
@@ -98,7 +98,7 @@ OCopyTable::OCopyTable( Window * pParent )
         m_edKeyName.SetText(sKeyName);
 
         sal_Int32 nMaxLen = m_pParent->getMaxColumnNameLength();
-        m_edKeyName.SetMaxTextLen(nMaxLen ? (xub_StrLen)nMaxLen : EDIT_NOLIMIT);
+        m_edKeyName.SetMaxTextLen(nMaxLen ? nMaxLen : EDIT_NOLIMIT);
     }
 
     FreeResource();
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx
index 6156cd3..820ba0f 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx
@@ -219,7 +219,7 @@ void OTableEditorCtrl::InitCellController()
 {
     DBG_CHKTHIS(OTableEditorCtrl,NULL);
     // Cell Field name
-    xub_StrLen nMaxTextLen = EDIT_NOLIMIT;
+    sal_Int32 nMaxTextLen = EDIT_NOLIMIT;
     OUString sExtraNameChars;
     Reference<XConnection> xCon;
     try
@@ -227,7 +227,7 @@ void OTableEditorCtrl::InitCellController()
         xCon = GetView()->getController().getConnection();
         Reference< XDatabaseMetaData> xMetaData = xCon.is() ? xCon->getMetaData() : Reference< XDatabaseMetaData>();
 
-        nMaxTextLen = ((xub_StrLen)xMetaData.is() ? static_cast<xub_StrLen>(xMetaData->getMaxColumnNameLength()) : 0);
+        nMaxTextLen = xMetaData.is() ? xMetaData->getMaxColumnNameLength() : 0;
 
         if( nMaxTextLen == 0 )
             nMaxTextLen = EDIT_NOLIMIT;
@@ -312,7 +312,7 @@ sal_Bool OTableEditorCtrl::SetDataPtr( long nRow )
     if(nRow == -1)
         return sal_False;
 
-    OSL_ENSURE((xub_StrLen)nRow < m_pRowList->size(),"Row is greater than size!");
+    OSL_ENSURE(nRow < (long)m_pRowList->size(),"Row is greater than size!");
     if(nRow >= (long)m_pRowList->size())
         return sal_False;
     pActRow = (*m_pRowList)[nRow];
@@ -806,7 +806,7 @@ OUString OTableEditorCtrl::GenerateName( const OUString& rName )
     Reference<XConnection> xCon = GetView()->getController().getConnection();
     Reference< XDatabaseMetaData> xMetaData = xCon.is() ? xCon->getMetaData() : Reference< XDatabaseMetaData>();
 
-    xub_StrLen nMaxTextLen((xub_StrLen)( xMetaData.is() ? xMetaData->getMaxColumnNameLength() : 0));
+    sal_Int32 nMaxTextLen(xMetaData.is() ? xMetaData->getMaxColumnNameLength() : 0);
 
     if( (rName.getLength()+2) >nMaxTextLen )
         aBaseName = rName.copy( 0, nMaxTextLen-2 );
diff --git a/include/svtools/editbrowsebox.hxx b/include/svtools/editbrowsebox.hxx
index 93d0c59..517d61c 100644
--- a/include/svtools/editbrowsebox.hxx
+++ b/include/svtools/editbrowsebox.hxx
@@ -134,8 +134,8 @@ namespace svt
         virtual sal_Bool            IsReadOnly() const = 0;
         virtual void                SetReadOnly( sal_Bool bReadOnly ) = 0;
 
-        virtual xub_StrLen          GetMaxTextLen() const = 0;
-        virtual void                SetMaxTextLen( xub_StrLen _nMaxLen ) = 0;
+        virtual sal_Int32           GetMaxTextLen() const = 0;
+        virtual void                SetMaxTextLen( sal_Int32 _nMaxLen ) = 0;
 
         virtual Selection           GetSelection() const = 0;
         virtual void                SetSelection( const Selection& _rSelection ) = 0;
@@ -170,8 +170,8 @@ namespace svt
         virtual sal_Bool            IsReadOnly() const;
         virtual void                SetReadOnly( sal_Bool bReadOnly );
 
-        virtual xub_StrLen          GetMaxTextLen() const;
-        virtual void                SetMaxTextLen( xub_StrLen _nMaxLen );
+        virtual sal_Int32           GetMaxTextLen() const;
+        virtual void                SetMaxTextLen( sal_Int32 _nMaxLen );
 
         virtual Selection           GetSelection() const;
         virtual void                SetSelection( const Selection& _rSelection );
diff --git a/include/svtools/editimplementation.hxx b/include/svtools/editimplementation.hxx
index 19fb48f..c6de2b7 100644
--- a/include/svtools/editimplementation.hxx
+++ b/include/svtools/editimplementation.hxx
@@ -101,16 +101,16 @@ OUString GenericEditImplementation< EDIT >::GetSelected( LineEnd ) const
 
 //----------------------------------------------------------------------
 template <class EDIT>
-void GenericEditImplementation< EDIT >::SetMaxTextLen( xub_StrLen _nMaxLen )
+void GenericEditImplementation< EDIT >::SetMaxTextLen( sal_Int32 _nMaxLen )
 {
     m_rEdit.SetMaxTextLen( _nMaxLen );
 }
 
 //----------------------------------------------------------------------
 template <class EDIT>
-xub_StrLen GenericEditImplementation< EDIT >::GetMaxTextLen() const
+sal_Int32 GenericEditImplementation< EDIT >::GetMaxTextLen() const
 {
-    return (xub_StrLen)m_rEdit.GetMaxTextLen( );
+    return m_rEdit.GetMaxTextLen( );
 }
 
 //----------------------------------------------------------------------
diff --git a/include/vcl/edit.hxx b/include/vcl/edit.hxx
index 23fce46..6df0714 100644
--- a/include/vcl/edit.hxx
+++ b/include/vcl/edit.hxx
@@ -44,7 +44,7 @@ struct Impl_IMEInfos;
 // - Edit-Types -
 // --------------
 
-#define EDIT_NOLIMIT                STRING_LEN
+#define EDIT_NOLIMIT                SAL_MAX_INT32
 #define EDIT_UPDATEDATA_TIMEOUT     350
 
 typedef OUString (*FncGetSpecialChars)( Window* pWin, const Font& rFont );
@@ -70,7 +70,7 @@ private:
     long                mnXOffset;
     Selection           maSelection;
     sal_uInt16          mnAlign;
-    xub_StrLen          mnMaxTextLen;
+    sal_Int32           mnMaxTextLen;
     sal_Int32           mnWidthInChars;
     sal_Int32           mnMaxWidthChars;
     AutocompleteAction  meAutocompleteAction;
@@ -89,7 +89,7 @@ private:
 
     DECL_DLLPRIVATE_LINK(      ImplUpdateDataHdl, void* );
 
-    SAL_DLLPRIVATE bool        ImplTruncateToMaxLen( OUString&, sal_uInt32 nSelectionLen ) const;
+    SAL_DLLPRIVATE bool        ImplTruncateToMaxLen( OUString&, sal_Int32 nSelectionLen ) const;
     SAL_DLLPRIVATE void        ImplInitEditData();
     SAL_DLLPRIVATE void        ImplModified();
     SAL_DLLPRIVATE OUString    ImplGetText() const;
@@ -189,8 +189,8 @@ public:
     void                SetInsertMode( sal_Bool bInsert );
     sal_Bool                IsInsertMode() const;
 
-    virtual void        SetMaxTextLen( xub_StrLen nMaxLen = EDIT_NOLIMIT );
-    virtual xub_StrLen  GetMaxTextLen() const { return mnMaxTextLen; }
+    virtual void        SetMaxTextLen( sal_Int32 nMaxLen = EDIT_NOLIMIT );
+    virtual sal_Int32   GetMaxTextLen() const { return mnMaxTextLen; }
 
     void                SetWidthInChars(sal_Int32 nWidthInChars);
     sal_Int32           GetWidthInChars() const { return mnWidthInChars; }
diff --git a/include/vcl/vclmedit.hxx b/include/vcl/vclmedit.hxx
index 36a1f69..ce567e9 100644
--- a/include/vcl/vclmedit.hxx
+++ b/include/vcl/vclmedit.hxx
@@ -79,8 +79,8 @@ public:
 
     void            EnableFocusSelectionHide( sal_Bool bHide );
 
-    virtual void    SetMaxTextLen( xub_StrLen nMaxLen = 0 );
-    virtual xub_StrLen GetMaxTextLen() const;
+    virtual void    SetMaxTextLen(sal_Int32 nMaxLen = 0);
+    virtual sal_Int32 GetMaxTextLen() const;
 
     void            SetMaxTextWidth( sal_uLong nMaxWidth );
 
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index b47d510..72b77c5 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -1067,7 +1067,7 @@ void DbLimitedLengthField::implAdjustGenericFieldSetting( const Reference< XProp
 }
 
 //------------------------------------------------------------------------------
-void DbLimitedLengthField::implSetEffectiveMaxTextLen( sal_Int16 _nMaxLen )
+void DbLimitedLengthField::implSetEffectiveMaxTextLen( sal_Int32 _nMaxLen )
 {
     dynamic_cast< Edit* >( m_pWindow )->SetMaxTextLen( _nMaxLen );
     if ( m_pPainter )
@@ -1212,7 +1212,7 @@ void DbTextField::updateFromModel( Reference< XPropertySet > _rxModel )
     OUString sText;
     _rxModel->getPropertyValue( FM_PROP_TEXT ) >>= sText;
 
-    xub_StrLen nMaxTextLen = m_pEdit->GetMaxTextLen();
+    sal_Int32 nMaxTextLen = m_pEdit->GetMaxTextLen();
     if ( EDIT_NOLIMIT != nMaxTextLen && sText.getLength() > nMaxTextLen )
     {
         sal_Int32 nDiff = sText.getLength() - nMaxTextLen;
@@ -1229,7 +1229,7 @@ sal_Bool DbTextField::commitControl()
 {
     OUString aText( m_pEdit->GetText( getModelLineEndSetting( m_rColumn.getModel() ) ) );
     // we have to check if the length before we can decide if the value was modified
-    xub_StrLen nMaxTextLen = m_pEdit->GetMaxTextLen();
+    sal_Int32 nMaxTextLen = m_pEdit->GetMaxTextLen();
     if ( EDIT_NOLIMIT != nMaxTextLen )
     {
         OUString sOldValue;
@@ -1243,7 +1243,7 @@ sal_Bool DbTextField::commitControl()
 }
 
 //------------------------------------------------------------------------------
-void DbTextField::implSetEffectiveMaxTextLen( sal_Int16 _nMaxLen )
+void DbTextField::implSetEffectiveMaxTextLen( sal_Int32 _nMaxLen )
 {
     if ( m_pEdit )
         m_pEdit->SetMaxTextLen( _nMaxLen );
diff --git a/svx/source/inc/gridcell.hxx b/svx/source/inc/gridcell.hxx
index e8eed6f..df3d10d 100644
--- a/svx/source/inc/gridcell.hxx
+++ b/svx/source/inc/gridcell.hxx
@@ -381,11 +381,11 @@ protected:
     virtual void implAdjustGenericFieldSetting( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel );
 
 protected:
-    inline void implSetMaxTextLen( sal_Int16 _nMaxLen )
+    void implSetMaxTextLen( sal_Int16 _nMaxLen )
     {
         implSetEffectiveMaxTextLen( _nMaxLen ? _nMaxLen : EDIT_NOLIMIT );
     }
-    virtual void implSetEffectiveMaxTextLen( sal_Int16 _nMaxLen );
+    virtual void implSetEffectiveMaxTextLen( sal_Int32 _nMaxLen );
 };
 
 //==================================================================
@@ -419,7 +419,7 @@ protected:
     virtual sal_Bool    commitControl( );
     virtual void        updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel );
     // DbLimitedLengthField
-    virtual void        implSetEffectiveMaxTextLen( sal_Int16 _nMaxLen );
+    virtual void        implSetEffectiveMaxTextLen( sal_Int32 _nMaxLen );
 };
 
 //==================================================================
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 85022c9..460244e 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -867,14 +867,12 @@ void Edit::ShowTruncationWarning( Window* pParent )
 
 // -----------------------------------------------------------------------
 
-bool Edit::ImplTruncateToMaxLen( OUString& rStr, sal_uInt32 nSelectionLen ) const
+bool Edit::ImplTruncateToMaxLen( OUString& rStr, sal_Int32 nSelectionLen ) const
 {
     bool bWasTruncated = false;
-    const sal_uInt32 nMaxLen = mnMaxTextLen < 65534 ? mnMaxTextLen : 65534;
-    sal_uInt32 nLenAfter = static_cast<sal_uInt32>(maText.getLength()) + rStr.getLength() - nSelectionLen;
-    if ( nLenAfter > nMaxLen )
+    if (maText.getLength() - nSelectionLen > mnMaxTextLen - rStr.getLength())
     {
-        sal_uInt32 nErasePos = nMaxLen - static_cast<sal_uInt32>(maText.getLength()) + nSelectionLen;
+        sal_Int32 nErasePos = mnMaxTextLen - maText.getLength() + nSelectionLen;
         rStr = rStr.copy( 0, nErasePos );
         bWasTruncated = true;
     }
@@ -2594,7 +2592,7 @@ sal_Bool Edit::IsInsertMode() const
 
 // -----------------------------------------------------------------------
 
-void Edit::SetMaxTextLen( xub_StrLen nMaxLen )
+void Edit::SetMaxTextLen(sal_Int32 nMaxLen)
 {
     mnMaxTextLen = nMaxLen ? nMaxLen : EDIT_NOLIMIT;
 
diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx
index 340d8fe..2f4c755 100644
--- a/vcl/source/edit/vclmedit.cxx
+++ b/vcl/source/edit/vclmedit.cxx
@@ -112,8 +112,8 @@ public:
     void        SetReadOnly( sal_Bool bRdOnly );
     sal_Bool        IsReadOnly() const;
 
-    void        SetMaxTextLen( xub_StrLen nLen );
-    xub_StrLen  GetMaxTextLen() const;
+    void        SetMaxTextLen(sal_Int32 nLen);
+    sal_Int32   GetMaxTextLen() const;
 
     void        SetMaxTextWidth( sal_uLong nMaxWidth );
 
@@ -376,15 +376,14 @@ sal_Bool ImpVclMEdit::IsReadOnly() const
     return mpTextWindow->GetTextView()->IsReadOnly();
 }
 
-void ImpVclMEdit::SetMaxTextLen( xub_StrLen nLen )
+void ImpVclMEdit::SetMaxTextLen(sal_Int32 nLen)
 {
-    mpTextWindow->GetTextEngine()->SetMaxTextLen( nLen );
+    mpTextWindow->GetTextEngine()->SetMaxTextLen(nLen);
 }
 
-xub_StrLen ImpVclMEdit::GetMaxTextLen() const
+sal_Int32 ImpVclMEdit::GetMaxTextLen() const
 {
-    return sal::static_int_cast< xub_StrLen >(
-        mpTextWindow->GetTextEngine()->GetMaxTextLen());
+    return mpTextWindow->GetTextEngine()->GetMaxTextLen();
 }
 
 void ImpVclMEdit::InsertText( const OUString& rStr )
@@ -718,7 +717,7 @@ TextWindow::TextWindow( Window* pParent ) : Window( pParent )
     SetPointer( Pointer( POINTER_TEXT ) );
 
     mpExtTextEngine = new ExtTextEngine;
-    mpExtTextEngine->SetMaxTextLen( STRING_MAXLEN );
+    mpExtTextEngine->SetMaxTextLen(EDIT_NOLIMIT);
     if( pParent->GetStyle() & WB_BORDER )
         mpExtTextEngine->SetLeftMargin( 2 );
     mpExtTextEngine->SetLocale( GetSettings().GetLanguageTag().getLocale() );
@@ -949,7 +948,7 @@ VclMultiLineEdit::VclMultiLineEdit( Window* pParent, const ResId& rResId )
     ImplInitSettings( sal_True, sal_True, sal_True );
     pUpdateDataTimer = 0;
 
-    sal_uInt16 nMaxLen = Edit::GetMaxTextLen();
+    sal_Int32 nMaxLen = Edit::GetMaxTextLen();
     if ( nMaxLen )
         SetMaxTextLen( nMaxLen );
 
@@ -1114,9 +1113,9 @@ sal_Bool VclMultiLineEdit::IsReadOnly() const
     return pImpVclMEdit->IsReadOnly();
 }
 
-void VclMultiLineEdit::SetMaxTextLen( xub_StrLen nMaxLen )
+void VclMultiLineEdit::SetMaxTextLen(sal_Int32 nMaxLen)
 {
-    pImpVclMEdit->SetMaxTextLen( nMaxLen );
+    pImpVclMEdit->SetMaxTextLen(nMaxLen);
 }
 
 void VclMultiLineEdit::SetMaxTextWidth( sal_uLong nMaxWidth )
@@ -1124,7 +1123,7 @@ void VclMultiLineEdit::SetMaxTextWidth( sal_uLong nMaxWidth )
     pImpVclMEdit->SetMaxTextWidth(nMaxWidth );
 }
 
-xub_StrLen VclMultiLineEdit::GetMaxTextLen() const
+sal_Int32 VclMultiLineEdit::GetMaxTextLen() const
 {
     return pImpVclMEdit->GetMaxTextLen();
 }
commit f8f18871b0293e8a8b5a9fa24a99e44902946ff4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Jan 11 16:42:32 2014 +0000

    longparas: convert GetMaxVisChars from xub_StrLen to sal_Int32
    
    Change-Id: I25fcfc3ae5a599bbd7ebef3071895ec9dbf2949e

diff --git a/include/vcl/edit.hxx b/include/vcl/edit.hxx
index a5f7757..23fce46 100644
--- a/include/vcl/edit.hxx
+++ b/include/vcl/edit.hxx
@@ -234,7 +234,7 @@ public:
     virtual Size        CalcMinimumSizeForText(const OUString &rString) const;
     virtual Size        GetOptimalSize() const;
     virtual Size        CalcSize( sal_uInt16 nChars ) const;
-    virtual xub_StrLen  GetMaxVisChars() const;
+    virtual sal_Int32   GetMaxVisChars() const;
 
     sal_Int32           GetCharPos( const Point& rWindowPos ) const;
 
diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx
index d8c3721..6675253 100644
--- a/svtools/source/uno/unoiface.cxx
+++ b/svtools/source/uno/unoiface.cxx
@@ -788,7 +788,7 @@ void VCLXFileControl::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines )
     nLines = 1;
     FileControl* pControl = (FileControl*) GetWindow();
     if ( pControl )
-        nCols = (sal_Int16) pControl->GetEdit().GetMaxVisChars();
+        nCols = pControl->GetEdit().GetMaxVisChars();
 }
 
 void VCLXFileControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index dee721f..85022c9 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -2957,12 +2957,12 @@ Size Edit::CalcSize( xub_StrLen nChars ) const
 
 // -----------------------------------------------------------------------
 
-xub_StrLen Edit::GetMaxVisChars() const
+sal_Int32 Edit::GetMaxVisChars() const
 {
     const Window* pW = mpSubEdit ? mpSubEdit : this;
-    long nOutWidth = pW->GetOutputSizePixel().Width();
-    long nCharWidth = GetTextWidth( OUString('x') );
-    return nCharWidth ? (xub_StrLen)(nOutWidth/nCharWidth) : 0;
+    sal_Int32 nOutWidth = pW->GetOutputSizePixel().Width();
+    sal_Int32 nCharWidth = GetTextWidth( OUString('x') );
+    return nCharWidth ? nOutWidth/nCharWidth : 0;
 }
 
 // -----------------------------------------------------------------------


More information about the Libreoffice-commits mailing list