[Libreoffice-commits] core.git: 7 commits - basctl/source dbaccess/source include/vcl svtools/source toolkit/source vcl/inc vcl/source

Caolán McNamara caolanm at redhat.com
Mon Jan 13 01:50:37 PST 2014


 basctl/source/basicide/baside2b.cxx                   |    2 
 dbaccess/source/ui/dlg/directsql.cxx                  |    6 
 dbaccess/source/ui/querydesign/LimitBox.cxx           |    2 
 dbaccess/source/ui/querydesign/limitboxcontroller.cxx |    2 
 include/vcl/combobox.hxx                              |    3 
 include/vcl/edit.hxx                                  |    2 
 include/vcl/lstbox.hxx                                |    2 
 include/vcl/spinfld.hxx                               |    2 
 include/vcl/vclmedit.hxx                              |    3 
 svtools/source/uno/unoiface.cxx                       |    2 
 toolkit/source/awt/vclxwindows.cxx                    |    4 
 vcl/inc/ilstbox.hxx                                   |    2 
 vcl/inc/salwtype.hxx                                  |    4 
 vcl/source/control/combobox.cxx                       |    4 
 vcl/source/control/edit.cxx                           |   16 -
 vcl/source/control/ilstbox.cxx                        |    3 
 vcl/source/control/lstbox.cxx                         |    4 
 vcl/source/control/spinfld.cxx                        |    2 
 vcl/source/edit/textdoc.cxx                           |    7 
 vcl/source/edit/texteng.cxx                           |  153 ++++++++----------
 vcl/source/edit/vclmedit.cxx                          |   10 -
 vcl/source/window/winproc.cxx                         |    2 
 22 files changed, 112 insertions(+), 125 deletions(-)

New commits:
commit c364fc1fc3555fc26dbcc04feaac2436cb8b6b7d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jan 13 01:10:27 2014 +0000

    longparas: xub_StrLen to sal_Int32
    
    Change-Id: Ib3eb5f9df112696b326bb30e4deed49d37f30c86

diff --git a/include/vcl/edit.hxx b/include/vcl/edit.hxx
index 6fc7917..87db7c1 100644
--- a/include/vcl/edit.hxx
+++ b/include/vcl/edit.hxx
@@ -233,7 +233,7 @@ public:
     virtual Size        CalcMinimumSize() const;
     virtual Size        CalcMinimumSizeForText(const OUString &rString) const;
     virtual Size        GetOptimalSize() const;
-    virtual Size        CalcSize( sal_uInt16 nChars ) const;
+    virtual Size        CalcSize(sal_Int32 nChars) const;
     virtual sal_Int32   GetMaxVisChars() const;
 
     sal_Int32           GetCharPos( const Point& rWindowPos ) const;
diff --git a/include/vcl/spinfld.hxx b/include/vcl/spinfld.hxx
index a31b1ae..9e51a6f 100644
--- a/include/vcl/spinfld.hxx
+++ b/include/vcl/spinfld.hxx
@@ -103,7 +103,7 @@ public:
     virtual Size    CalcMinimumSize() const;
     virtual Size    CalcMinimumSizeForText(const OUString &rString) const;
     virtual Size    GetOptimalSize() const;
-    virtual Size    CalcSize( sal_uInt16 nChars ) const;
+    virtual Size    CalcSize(sal_Int32 nChars) const;
 };
 
 #endif // INCLUDED_VCL_SPINFLD_HXX
diff --git a/vcl/inc/ilstbox.hxx b/vcl/inc/ilstbox.hxx
index 18dfee8..d01c326 100644
--- a/vcl/inc/ilstbox.hxx
+++ b/vcl/inc/ilstbox.hxx
@@ -347,7 +347,7 @@ public:
     bool            IsMouseMoveSelectEnabled() const    { return mbMouseMoveSelect; }
     bool            IsMouseMoveSelect() const   { return mbMouseMoveSelect||mbStackMode; }
 
-    Size            CalcSize( sal_uInt16 nMaxLines ) const;
+    Size            CalcSize(sal_Int32 nMaxLines) const;
     Rectangle       GetBoundingRectangle( sal_uInt16 nItem ) const;
 
     long            GetEntryHeight() const              { return mnMaxHeight; }
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index d260b07..3a5e579 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -2942,7 +2942,7 @@ Size Edit::GetOptimalSize() const
 
 // -----------------------------------------------------------------------
 
-Size Edit::CalcSize( xub_StrLen nChars ) const
+Size Edit::CalcSize(sal_Int32 nChars) const
 {
     // width for N characters, independent from content.
     // works only correct for fixed fonts, average otherwise
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index e15898d..9724474 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -2154,12 +2154,11 @@ void ImplListBoxWindow::ScrollHorz( long n )
 
 // -----------------------------------------------------------------------
 
-Size ImplListBoxWindow::CalcSize( sal_uInt16 nMaxLines ) const
+Size ImplListBoxWindow::CalcSize(sal_Int32 nMaxLines) const
 {
     // FIXME: LISTBOX_ENTRY_FLAG_MULTILINE
 
     Size aSz;
-//  sal_uInt16 nL = Min( nMaxLines, mpEntryList->GetEntryCount() );
     aSz.Height() =  nMaxLines * mnMaxHeight;
     aSz.Width() = mnMaxWidth + 2*mnBorder;
     return aSz;
diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
index f070dfa..6f619cc 100644
--- a/vcl/source/control/spinfld.cxx
+++ b/vcl/source/control/spinfld.cxx
@@ -1005,7 +1005,7 @@ Size SpinField::GetOptimalSize() const
 
 // -----------------------------------------------------------------------
 
-Size SpinField::CalcSize( sal_uInt16 nChars ) const
+Size SpinField::CalcSize(sal_Int32 nChars) const
 {
     Size aSz = Edit::CalcSize( nChars );
 
commit 1b7a5c634a22dee2f7d6e9f3d82820765725943a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jan 13 00:59:39 2014 +0000

    disentangle CalcSize
    
    Change-Id: I42248ff611dbe7c109076da5d548717898341be3

diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index fee2d61..2ae6efd 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -2842,7 +2842,7 @@ void CodeCompleteWindow::ResizeAndPositionListBox()
         const sal_uInt16& nColumns = aLongestEntry.getLength();
         const sal_uInt16& nLines = std::min( (sal_uInt16) 6, pListBox->GetEntryCount() );
 
-        Size aSize = pListBox->CalcSize( nColumns, nLines );
+        Size aSize = pListBox->CalcBlockSize( nColumns, nLines );
         //set the size
         SetSizePixel( aSize );
         //1 px smaller, to see the border
diff --git a/dbaccess/source/ui/dlg/directsql.cxx b/dbaccess/source/ui/dlg/directsql.cxx
index 6e1d407..ef2084f 100644
--- a/dbaccess/source/ui/dlg/directsql.cxx
+++ b/dbaccess/source/ui/dlg/directsql.cxx
@@ -43,17 +43,17 @@ DBG_NAME(DirectSQLDialog)
         ,m_xConnection(_rxConn)
     {
         get(m_pSQL,"sql");
-        Size aSize(m_pSQL->CalcSize(60, 7));
+        Size aSize(m_pSQL->CalcBlockSize(60, 7));
         m_pSQL->set_width_request(aSize.Width());
         m_pSQL->set_height_request(aSize.Height());
         get(m_pExecute,"execute");
         get(m_pSQLHistory,"sqlhistory");
         get(m_pStatus,"status");
-        aSize  = m_pStatus->CalcSize(60, 5);
+        aSize  = m_pStatus->CalcBlockSize(60, 5);
         m_pStatus->set_height_request(aSize.Height());
         get(m_pShowOutput,"showoutput");
         get(m_pOutput,"output");
-        aSize  = m_pOutput->CalcSize(60, 5);
+        aSize  = m_pOutput->CalcBlockSize(60, 5);
         m_pOutput->set_height_request(aSize.Height());
         get(m_pClose,"close");
 
diff --git a/dbaccess/source/ui/querydesign/LimitBox.cxx b/dbaccess/source/ui/querydesign/LimitBox.cxx
index 688758f..5f4510d 100644
--- a/dbaccess/source/ui/querydesign/LimitBox.cxx
+++ b/dbaccess/source/ui/querydesign/LimitBox.cxx
@@ -96,7 +96,7 @@ void LimitBox::ReformatAll()
 
 Size LimitBox::GetOptimalSize() const
 {
-    return CalcSize(10,1);
+    return CalcBlockSize(10,1);
 }
 
 ///Initialize entries
diff --git a/dbaccess/source/ui/querydesign/limitboxcontroller.cxx b/dbaccess/source/ui/querydesign/limitboxcontroller.cxx
index a21f771..67d20e0 100644
--- a/dbaccess/source/ui/querydesign/limitboxcontroller.cxx
+++ b/dbaccess/source/ui/querydesign/limitboxcontroller.cxx
@@ -208,7 +208,7 @@ uno::Reference< awt::XWindow > SAL_CALL LimitBoxController::createItemWindow(
     {
         SolarMutexGuard aSolarMutexGuard;
         m_pLimitBox = new LimitBoxImpl(pParent, this);
-        m_pLimitBox->SetSizePixel(m_pLimitBox->CalcSize(6,1));
+        m_pLimitBox->SetSizePixel(m_pLimitBox->CalcBlockSize(6,1));
         xItemWindow = VCLUnoHelper::GetInterface( m_pLimitBox );
     }
 
diff --git a/include/vcl/combobox.hxx b/include/vcl/combobox.hxx
index 76533ab..6cd3d5c 100644
--- a/include/vcl/combobox.hxx
+++ b/include/vcl/combobox.hxx
@@ -172,8 +172,7 @@ public:
     Size            CalcMinimumSize() const;
     virtual Size    GetOptimalSize() const;
     Size            CalcAdjustedSize( const Size& rPrefSize ) const;
-    using Edit::CalcSize;
-    Size            CalcSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const;
+    Size            CalcBlockSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const;
     void            GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const;
 
     void            SetMRUEntries( const OUString& rEntries, sal_Unicode cSep = ';' );
diff --git a/include/vcl/lstbox.hxx b/include/vcl/lstbox.hxx
index cc63c2f..e57ea80 100644
--- a/include/vcl/lstbox.hxx
+++ b/include/vcl/lstbox.hxx
@@ -196,7 +196,7 @@ public:
     Size                CalcMinimumSize() const;    //size of lstbox area, i.e. including scrollbar/dropdown
     virtual Size        GetOptimalSize() const;
     Size                CalcAdjustedSize( const Size& rPrefSize ) const;
-    Size                CalcSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const;
+    Size                CalcBlockSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const;
     void                GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const;
 
     sal_uInt16          GetMRUCount() const;
diff --git a/include/vcl/vclmedit.hxx b/include/vcl/vclmedit.hxx
index ce567e9..e1c69e3 100644
--- a/include/vcl/vclmedit.hxx
+++ b/include/vcl/vclmedit.hxx
@@ -119,8 +119,7 @@ public:
 
     virtual Size    CalcMinimumSize() const;
     Size            CalcAdjustedSize( const Size& rPrefSize ) const;
-    using Edit::CalcSize;
-    Size            CalcSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const;
+    Size            CalcBlockSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const;
     void            GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const;
 
     void            Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags );
diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx
index 6675253..2793e12 100644
--- a/svtools/source/uno/unoiface.cxx
+++ b/svtools/source/uno/unoiface.cxx
@@ -366,7 +366,7 @@ OUString VCLXMultiLineEdit::getTextLines() throw(::com::sun::star::uno::RuntimeE
     ::com::sun::star::awt::Size aSz;
     MultiLineEdit* pEdit = (MultiLineEdit*) GetWindow();
     if ( pEdit )
-        aSz = AWTSize(pEdit->CalcSize( nCols, nLines ));
+        aSz = AWTSize(pEdit->CalcBlockSize( nCols, nLines ));
     return aSz;
 }
 
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index 21325de..98c2fe1 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -2015,7 +2015,7 @@ void VCLXListBox::setProperty( const OUString& PropertyName, const ::com::sun::s
     Size aSz;
     ListBox* pListBox = (ListBox*) GetWindow();
     if ( pListBox )
-        aSz = pListBox->CalcSize( nCols, nLines );
+        aSz = pListBox->CalcBlockSize( nCols, nLines );
     return AWTSize(aSz);
 }
 
@@ -4522,7 +4522,7 @@ void VCLXComboBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
     Size aSz;
     ComboBox* pComboBox = (ComboBox*) GetWindow();
     if ( pComboBox )
-        aSz = pComboBox->CalcSize( nCols, nLines );
+        aSz = pComboBox->CalcBlockSize( nCols, nLines );
     return AWTSize(aSz);
 }
 
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 92ea28e..b725be4 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -1114,7 +1114,7 @@ Size ComboBox::CalcAdjustedSize( const Size& rPrefSize ) const
     aSz.Height() -= nTop+nBottom;
     if ( !IsDropDownBox() )
     {
-        long nEntryHeight = CalcSize( 1, 1 ).Height();
+        long nEntryHeight = CalcBlockSize( 1, 1 ).Height();
         long nLines = aSz.Height() / nEntryHeight;
         if ( nLines < 1 )
             nLines = 1;
@@ -1133,7 +1133,7 @@ Size ComboBox::CalcAdjustedSize( const Size& rPrefSize ) const
 
 // -----------------------------------------------------------------------
 
-Size ComboBox::CalcSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const
+Size ComboBox::CalcBlockSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const
 {
     // show ScrollBars where appropriate
     Size aMinSz = CalcMinimumSize();
diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx
index fe358ae..de38eaa 100644
--- a/vcl/source/control/lstbox.cxx
+++ b/vcl/source/control/lstbox.cxx
@@ -1351,7 +1351,7 @@ Size ListBox::CalcAdjustedSize( const Size& rPrefSize ) const
     aSz.Height() -= nTop+nBottom;
     if ( !IsDropDownBox() )
     {
-        long nEntryHeight = CalcSize( 1, 1 ).Height();
+        long nEntryHeight = CalcBlockSize( 1, 1 ).Height();
         long nLines = aSz.Height() / nEntryHeight;
         if ( nLines < 1 )
             nLines = 1;
@@ -1368,7 +1368,7 @@ Size ListBox::CalcAdjustedSize( const Size& rPrefSize ) const
 }
 
 
-Size ListBox::CalcSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const
+Size ListBox::CalcBlockSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const
 {
     // ScrollBars are shown if needed
     Size aMinSz = CalcMinimumSize();
diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx
index 3d9cec0..af2d417 100644
--- a/vcl/source/edit/vclmedit.cxx
+++ b/vcl/source/edit/vclmedit.cxx
@@ -143,7 +143,7 @@ public:
     void        Enable( sal_Bool bEnable );
 
     Size        CalcMinimumSize() const;
-    Size        CalcSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const;
+    Size        CalcBlockSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const;
     void        GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const;
 
     void        SetAlign( WinBits nWinStyle );
@@ -646,7 +646,7 @@ Size ImpVclMEdit::CalcMinimumSize() const
     return aSz;
 }
 
-Size ImpVclMEdit::CalcSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const
+Size ImpVclMEdit::CalcBlockSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const
 {
     static const sal_Unicode sampleChar = 'X';
 
@@ -1227,7 +1227,7 @@ Size VclMultiLineEdit::CalcAdjustedSize( const Size& rPrefSize ) const
     // center vertically for whole lines
 
     long nHeight = aSz.Height() - nTop - nBottom;
-    long nLineHeight = pImpVclMEdit->CalcSize( 1, 1 ).Height();
+    long nLineHeight = pImpVclMEdit->CalcBlockSize( 1, 1 ).Height();
     long nLines = nHeight / nLineHeight;
     if ( nLines < 1 )
         nLines = 1;
@@ -1238,9 +1238,9 @@ Size VclMultiLineEdit::CalcAdjustedSize( const Size& rPrefSize ) const
     return aSz;
 }
 
-Size VclMultiLineEdit::CalcSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const
+Size VclMultiLineEdit::CalcBlockSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const
 {
-    Size aSz = pImpVclMEdit->CalcSize( nColumns, nLines );
+    Size aSz = pImpVclMEdit->CalcBlockSize( nColumns, nLines );
 
     sal_Int32 nLeft, nTop, nRight, nBottom;
     ((Window*)this)->GetBorder( nLeft, nTop, nRight, nBottom );
commit 89f7e4ec62dd427168c46e7599f74a16a6a239b0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Jan 12 20:29:41 2014 +0000

    longparas: drop STRING_MAXLEN limit in TextEngine
    
    Change-Id: Ib0f72e1fc0938ca286d0131b7bb1a00499ada7d4

diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index 2a4a9fc..c2eac53 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -676,99 +676,96 @@ TextPaM TextEngine::ImpInsertText( sal_Unicode c, const TextSelection& rCurSel,
     TextPaM aPaM( rCurSel.GetStart() );
     TextNode* pNode = mpDoc->GetNodes().GetObject( aPaM.GetPara() );
 
-    if ( pNode->GetText().getLength() < STRING_MAXLEN )
-    {
-        bool bDoOverwrite = ( bOverwrite &&
-                ( aPaM.GetIndex() < pNode->GetText().getLength() ) );
+    bool bDoOverwrite = ( bOverwrite &&
+            ( aPaM.GetIndex() < pNode->GetText().getLength() ) );
 
-        bool bUndoAction = ( rCurSel.HasRange() || bDoOverwrite );
+    bool bUndoAction = ( rCurSel.HasRange() || bDoOverwrite );
 
-        if ( bUndoAction )
-            UndoActionStart();
+    if ( bUndoAction )
+        UndoActionStart();
 
-        if ( rCurSel.HasRange() )
-        {
-            aPaM = ImpDeleteText( rCurSel );
-        }
-        else if ( bDoOverwrite )
-        {
-            // if selection, then don't overwrite a character
-            TextSelection aTmpSel( aPaM );
-            aTmpSel.GetEnd().GetIndex()++;
-            ImpDeleteText( aTmpSel );
-        }
+    if ( rCurSel.HasRange() )
+    {
+        aPaM = ImpDeleteText( rCurSel );
+    }
+    else if ( bDoOverwrite )
+    {
+        // if selection, then don't overwrite a character
+        TextSelection aTmpSel( aPaM );
+        aTmpSel.GetEnd().GetIndex()++;
+        ImpDeleteText( aTmpSel );
+    }
 
-        if (bIsUserInput && IsInputSequenceCheckingRequired( c, rCurSel ))
+    if (bIsUserInput && IsInputSequenceCheckingRequired( c, rCurSel ))
+    {
+        uno::Reference < i18n::XExtendedInputSequenceChecker > xISC = GetInputSequenceChecker();
+        SvtCTLOptions aCTLOptions;
+
+        if (xISC.is())
         {
-            uno::Reference < i18n::XExtendedInputSequenceChecker > xISC = GetInputSequenceChecker();
-            SvtCTLOptions aCTLOptions;
+            xub_StrLen nTmpPos = aPaM.GetIndex();
+            sal_Int16 nCheckMode = aCTLOptions.IsCTLSequenceCheckingRestricted() ?
+                    i18n::InputSequenceCheckMode::STRICT : i18n::InputSequenceCheckMode::BASIC;
 
-            if (xISC.is())
+            // the text that needs to be checked is only the one
+            // before the current cursor position
+            OUString aOldText( mpDoc->GetText( aPaM.GetPara() ).copy(0, nTmpPos) );
+            OUString aNewText( aOldText );
+            if (aCTLOptions.IsCTLSequenceCheckingTypeAndReplace())
             {
-                xub_StrLen nTmpPos = aPaM.GetIndex();
-                sal_Int16 nCheckMode = aCTLOptions.IsCTLSequenceCheckingRestricted() ?
-                        i18n::InputSequenceCheckMode::STRICT : i18n::InputSequenceCheckMode::BASIC;
-
-                // the text that needs to be checked is only the one
-                // before the current cursor position
-                OUString aOldText( mpDoc->GetText( aPaM.GetPara() ).copy(0, nTmpPos) );
-                OUString aNewText( aOldText );
-                if (aCTLOptions.IsCTLSequenceCheckingTypeAndReplace())
-                {
-                    xISC->correctInputSequence( aNewText, nTmpPos - 1, c, nCheckMode );
-
-                    // find position of first character that has changed
-                    sal_Int32 nOldLen = aOldText.getLength();
-                    sal_Int32 nNewLen = aNewText.getLength();
-                    const sal_Unicode *pOldTxt = aOldText.getStr();
-                    const sal_Unicode *pNewTxt = aNewText.getStr();
-                    sal_Int32 nChgPos = 0;
-                    while ( nChgPos < nOldLen && nChgPos < nNewLen &&
-                            pOldTxt[nChgPos] == pNewTxt[nChgPos] )
-                        ++nChgPos;
-
-                    OUString aChgText( aNewText.copy( nChgPos ) );
-
-                    // select text from first pos to be changed to current pos
-                    TextSelection aSel( TextPaM( aPaM.GetPara(), (sal_uInt16) nChgPos ), aPaM );
-
-                    if (!aChgText.isEmpty())
-                        // ImpInsertText implicitly handles undo...
-                        return ImpInsertText( aSel, aChgText );
-                    else
-                        return aPaM;
-                }
+                xISC->correctInputSequence( aNewText, nTmpPos - 1, c, nCheckMode );
+
+                // find position of first character that has changed
+                sal_Int32 nOldLen = aOldText.getLength();
+                sal_Int32 nNewLen = aNewText.getLength();
+                const sal_Unicode *pOldTxt = aOldText.getStr();
+                const sal_Unicode *pNewTxt = aNewText.getStr();
+                sal_Int32 nChgPos = 0;
+                while ( nChgPos < nOldLen && nChgPos < nNewLen &&
+                        pOldTxt[nChgPos] == pNewTxt[nChgPos] )
+                    ++nChgPos;
+
+                OUString aChgText( aNewText.copy( nChgPos ) );
+
+                // select text from first pos to be changed to current pos
+                TextSelection aSel( TextPaM( aPaM.GetPara(), (sal_uInt16) nChgPos ), aPaM );
+
+                if (!aChgText.isEmpty())
+                    // ImpInsertText implicitly handles undo...
+                    return ImpInsertText( aSel, aChgText );
                 else
-                {
-                    // should the character be ignored (i.e. not get inserted) ?
-                    if (!xISC->checkInputSequence( aOldText, nTmpPos - 1, c, nCheckMode ))
-                        return aPaM;    // nothing to be done -> no need for undo
-                }
+                    return aPaM;
+            }
+            else
+            {
+                // should the character be ignored (i.e. not get inserted) ?
+                if (!xISC->checkInputSequence( aOldText, nTmpPos - 1, c, nCheckMode ))
+                    return aPaM;    // nothing to be done -> no need for undo
             }
-
-            // at this point now we will insert the character 'normally' some lines below...
         }
 
+        // at this point now we will insert the character 'normally' some lines below...
+    }
 
-        if ( IsUndoEnabled() && !IsInUndo() )
-        {
-            TextUndoInsertChars* pNewUndo = new TextUndoInsertChars( this, aPaM, OUString(c) );
-            sal_Bool bTryMerge = ( !bDoOverwrite && ( c != ' ' ) ) ? sal_True : sal_False;
-            InsertUndo( pNewUndo, bTryMerge );
-        }
 
-        TEParaPortion* pPortion = mpTEParaPortions->GetObject( aPaM.GetPara() );
-        pPortion->MarkInvalid( aPaM.GetIndex(), 1 );
-        if ( c == '\t' )
-            pPortion->SetNotSimpleInvalid();
-        aPaM = mpDoc->InsertText( aPaM, c );
-        ImpCharsInserted( aPaM.GetPara(), aPaM.GetIndex()-1, 1 );
+    if ( IsUndoEnabled() && !IsInUndo() )
+    {
+        TextUndoInsertChars* pNewUndo = new TextUndoInsertChars( this, aPaM, OUString(c) );
+        sal_Bool bTryMerge = ( !bDoOverwrite && ( c != ' ' ) ) ? sal_True : sal_False;
+        InsertUndo( pNewUndo, bTryMerge );
+    }
 
-        TextModified();
+    TEParaPortion* pPortion = mpTEParaPortions->GetObject( aPaM.GetPara() );
+    pPortion->MarkInvalid( aPaM.GetIndex(), 1 );
+    if ( c == '\t' )
+        pPortion->SetNotSimpleInvalid();
+    aPaM = mpDoc->InsertText( aPaM, c );
+    ImpCharsInserted( aPaM.GetPara(), aPaM.GetIndex()-1, 1 );
 
-        if ( bUndoAction )
-            UndoActionEnd();
-    }
+    TextModified();
+
+    if ( bUndoAction )
+        UndoActionEnd();
 
     return aPaM;
 }
commit 3e749d7867a69ce923b1a6d30f08ec5acc0eb7eb
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Jan 12 20:28:31 2014 +0000

    longparas: drop STRING_MAXLEN limit in TextDoc
    
    Change-Id: Iabe74f423c2d65bad637e56e5ab44dd808d41df1

diff --git a/vcl/source/edit/textdoc.cxx b/vcl/source/edit/textdoc.cxx
index bf22b77..afe30a8 100644
--- a/vcl/source/edit/textdoc.cxx
+++ b/vcl/source/edit/textdoc.cxx
@@ -459,15 +459,8 @@ void TextDoc::DestroyTextNodes()
 
 OUString TextDoc::GetText( const sal_Unicode* pSep ) const
 {
-    sal_uLong nLen = GetTextLen( pSep );
     sal_uLong nNodes = maTextNodes.Count();
 
-    if ( nLen > STRING_MAXLEN )
-    {
-        OSL_FAIL( "Text zu gross fuer String" );
-        return OUString();
-    }
-
     OUString aASCIIText;
     sal_uLong nLastNode = nNodes-1;
     for ( sal_uLong nNode = 0; nNode < nNodes; nNode++ )
commit 2a44ab09d744dd719a26f6ddab0e45473176414d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Jan 12 20:27:35 2014 +0000

    longparas: STRING_LEN->EDIT_NOLIMIT
    
    Change-Id: I4ca1875bf4afa228c1617b4590a3a56f71de57c8

diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index dcf1519..d260b07 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -1283,7 +1283,7 @@ void Edit::ImplAlignAndPaint()
 
 sal_Int32 Edit::ImplGetCharPos( const Point& rWindowPos ) const
 {
-    sal_Int32 nIndex = STRING_LEN;
+    sal_Int32 nIndex = EDIT_NOLIMIT;
     OUString aText = ImplGetText();
 
     sal_Int32   nDXBuffer[256];
@@ -1316,7 +1316,7 @@ sal_Int32 Edit::ImplGetCharPos( const Point& rWindowPos ) const
             break;
         }
     }
-    if( nIndex == STRING_LEN )
+    if( nIndex == EDIT_NOLIMIT )
     {
         nIndex = 0;
         long nDiff = std::abs( pDX[0]-nX );
@@ -1331,7 +1331,7 @@ sal_Int32 Edit::ImplGetCharPos( const Point& rWindowPos ) const
             }
         }
         if( nIndex == aText.getLength()-1 && std::abs( pDX[2*nIndex+1] - nX ) < nDiff )
-            nIndex = STRING_LEN;
+            nIndex = EDIT_NOLIMIT;
     }
 
     if( pDXBuffer )
@@ -1437,7 +1437,7 @@ void Edit::MouseButtonDown( const MouseEvent& rMEvt )
         mbClickedInSelection = sal_False;
         if ( rMEvt.GetClicks() == 3 )
         {
-            ImplSetSelection( Selection( 0, STRING_LEN ) );
+            ImplSetSelection( Selection( 0, EDIT_NOLIMIT) );
             ImplCopyToSelectionClipboard();
 
         }
@@ -1713,7 +1713,7 @@ sal_Bool Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt )
                     }
                     else if ( bGoEnd )
                     {
-                        aSel.Max() = STRING_LEN;
+                        aSel.Max() = EDIT_NOLIMIT;
                     }
 
                     if ( !bSelect )
commit 9ceccaaa4d7d475c7d5d0800805ac94c5a965765
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Jan 12 20:25:03 2014 +0000

    longparas: xub_StrLen to sal_Int32
    
    Change-Id: I93af34cd936510ee14ca1eead55a7abc3036554b

diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 48d5dc7..dcf1519 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -101,7 +101,7 @@ struct DDInfo
 {
     Cursor          aCursor;
     Selection       aDndStartSel;
-    xub_StrLen      nDropPos;
+    sal_Int32       nDropPos;
     bool            bStarterOfDD;
     bool            bDroppedInMe;
     bool            bVisCursor;
@@ -3165,7 +3165,7 @@ void Edit::dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEv
 
     Point aMousePos( rDTDE.LocationX, rDTDE.LocationY );
 
-    xub_StrLen nPrevDropPos = mpDDInfo->nDropPos;
+    sal_Int32 nPrevDropPos = mpDDInfo->nDropPos;
     mpDDInfo->nDropPos = ImplGetCharPos( aMousePos );
 
     /*
commit cd4a1e79cdb36eb63f0fad6e6657fbcb63d4008e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Jan 12 20:22:37 2014 +0000

    make mnCursorPos a sal_Int32
    
    Change-Id: I37743b6c310acc70ceb9d08f502dcd7a96a436e4

diff --git a/vcl/inc/salwtype.hxx b/vcl/inc/salwtype.hxx
index 770c025..4828f39 100644
--- a/vcl/inc/salwtype.hxx
+++ b/vcl/inc/salwtype.hxx
@@ -176,9 +176,9 @@ struct SalExtTextInputEvent
     sal_uLong           mnTime;         // Time in ms, when event is created
     OUString            maText;         // Text
     const sal_uInt16*   mpTextAttr;     // Text-Attribute
-    sal_uLong           mnCursorPos;    // Cursor-Position
+    sal_Int32           mnCursorPos;    // Cursor-Position
     sal_uInt8           mnCursorFlags;  // EXTTEXTINPUT_CURSOR_xxx
-    sal_Bool            mbOnlyCursor;   // sal_True: Only Cursor-Position has been changed
+    bool                mbOnlyCursor;   // true: Only Cursor-Position has been changed
 };
 
 // EXTTEXTINPUTPOS
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index d42cb95..e6d3d23 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -1226,7 +1226,7 @@ static long ImplHandleKey( Window* pWindow, sal_uInt16 nSVEvent,
 static long ImplHandleExtTextInput( Window* pWindow,
                                     const OUString& rText,
                                     const sal_uInt16* pTextAttr,
-                                    sal_uLong nCursorPos, sal_uInt16 nCursorFlags )
+                                    sal_Int32 nCursorPos, sal_uInt16 nCursorFlags )
 {
     ImplSVData* pSVData = ImplGetSVData();
     Window*     pChild = NULL;


More information about the Libreoffice-commits mailing list