[Libreoffice-commits] core.git: 4 commits - include/vcl vcl/source
Caolán McNamara
caolanm at redhat.com
Sun Jan 12 12:09:56 PST 2014
include/vcl/cmdevt.hxx | 40 +++++++++++++++++++--------------------
include/vcl/edit.hxx | 4 +--
vcl/source/control/edit.cxx | 44 +++++++++++++++++++++----------------------
vcl/source/window/cmdevt.cxx | 11 +++-------
4 files changed, 48 insertions(+), 51 deletions(-)
New commits:
commit 69a945d0dbc58c150cbede8d35a189eefe8f2367
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Jan 12 11:31:23 2014 +0000
longparas: these 0xFFFF are STRING_LEN
Change-Id: I9501efae520a994baaf675f70f3570d9ba3233aa
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index f3bd838..48d5dc7 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -1437,7 +1437,7 @@ void Edit::MouseButtonDown( const MouseEvent& rMEvt )
mbClickedInSelection = sal_False;
if ( rMEvt.GetClicks() == 3 )
{
- ImplSetSelection( Selection( 0, 0xFFFF ) );
+ ImplSetSelection( Selection( 0, STRING_LEN ) );
ImplCopyToSelectionClipboard();
}
@@ -1713,7 +1713,7 @@ sal_Bool Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt )
}
else if ( bGoEnd )
{
- aSel.Max() = 0xFFFF;
+ aSel.Max() = STRING_LEN;
}
if ( !bSelect )
commit f042e84e63d14fca4252235d7b9a68b1cb1074b4
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Jan 12 11:20:39 2014 +0000
longparas: nStart and nEnd are always overwritten
so simplify to the reality, which conveniently removes some
hard-coded 0xFFFF and STRING_LEN uses
Change-Id: I4fc014a972f6a157c18f8194c410b7cbff03de4a
diff --git a/include/vcl/edit.hxx b/include/vcl/edit.hxx
index 6df0714..6fc7917 100644
--- a/include/vcl/edit.hxx
+++ b/include/vcl/edit.hxx
@@ -93,8 +93,8 @@ private:
SAL_DLLPRIVATE void ImplInitEditData();
SAL_DLLPRIVATE void ImplModified();
SAL_DLLPRIVATE OUString ImplGetText() const;
- SAL_DLLPRIVATE void ImplRepaint( sal_Int32 nStart = 0, sal_Int32 nEnd = STRING_LEN, bool bLayout = false );
- SAL_DLLPRIVATE void ImplInvalidateOrRepaint( sal_Int32 nStart = 0, sal_Int32 nEnd = STRING_LEN );
+ SAL_DLLPRIVATE void ImplRepaint(bool bLayout = false);
+ SAL_DLLPRIVATE void ImplInvalidateOrRepaint();
SAL_DLLPRIVATE void ImplDelete( const Selection& rSelection, sal_uInt8 nDirection, sal_uInt8 nMode );
SAL_DLLPRIVATE void ImplSetText( const OUString& rStr, const Selection* pNewSelection = 0 );
SAL_DLLPRIVATE void ImplInsertText( const OUString& rStr, const Selection* pNewSelection = 0, sal_Bool bIsUserInput = sal_False );
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index f7c2415..f3bd838 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -496,7 +496,7 @@ OUString Edit::ImplGetText() const
// -----------------------------------------------------------------------
-void Edit::ImplInvalidateOrRepaint( sal_Int32 nStart, sal_Int32 nEnd )
+void Edit::ImplInvalidateOrRepaint()
{
if( IsPaintTransparent() )
{
@@ -506,7 +506,7 @@ void Edit::ImplInvalidateOrRepaint( sal_Int32 nStart, sal_Int32 nEnd )
Update();
}
else
- ImplRepaint( nStart, nEnd );
+ ImplRepaint();
}
// -----------------------------------------------------------------------
@@ -522,14 +522,14 @@ long Edit::ImplGetTextYPosition() const
// -----------------------------------------------------------------------
-void Edit::ImplRepaint( sal_Int32 nStart, sal_Int32 nEnd, bool bLayout )
+void Edit::ImplRepaint(bool bLayout)
{
if ( !IsReallyVisible() )
return;
OUString aText = ImplGetText();
- nStart = 0;
- nEnd = aText.getLength();
+ sal_Int32 nStart = 0;
+ sal_Int32 nEnd = aText.getLength();
sal_Int32 nDXBuffer[256];
sal_Int32* pDXBuffer = NULL;
@@ -1275,7 +1275,7 @@ void Edit::ImplAlign()
void Edit::ImplAlignAndPaint()
{
ImplAlign();
- ImplInvalidateOrRepaint( 0, STRING_LEN );
+ ImplInvalidateOrRepaint();
ImplShowCursor();
}
@@ -1861,7 +1861,7 @@ void Edit::KeyInput( const KeyEvent& rKEvt )
void Edit::FillLayoutData() const
{
mpControlData->mpLayoutData = new vcl::ControlLayoutData();
- const_cast<Edit*>(this)->ImplRepaint( 0, STRING_LEN, true );
+ const_cast<Edit*>(this)->ImplRepaint(true);
}
// -----------------------------------------------------------------------
@@ -2343,7 +2343,7 @@ void Edit::StateChanged( StateChangedType nType )
if ( !mpSubEdit )
{
// change text color only
- ImplInvalidateOrRepaint( 0, 0xFFFF );
+ ImplInvalidateOrRepaint();
}
}
else if ( nType == STATE_CHANGE_STYLE || nType == STATE_CHANGE_MIRRORING )
@@ -2648,7 +2648,7 @@ void Edit::ImplSetSelection( const Selection& rSelection, sal_Bool bPaint )
maSelection = aNew;
if ( bPaint && ( aOld.Len() || aNew.Len() || IsPaintTransparent() ) )
- ImplInvalidateOrRepaint( 0, maText.getLength() );
+ ImplInvalidateOrRepaint();
ImplShowCursor();
sal_Bool bCaret = sal_False, bSelection = sal_False;
commit ad4f00a992f9df5d0e7051a44e2f714ad8e03d2a
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Jan 12 11:09:33 2014 +0000
longparas: raise 16bit Impl_IMEInfos limits to 32bit
Change-Id: I2196119a8205892724f0d8b75a05940666839642
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 52bbedf..f7c2415 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -124,22 +124,22 @@ struct Impl_IMEInfos
{
OUString aOldTextAfterStartPos;
sal_uInt16* pAttribs;
- xub_StrLen nPos;
- xub_StrLen nLen;
+ sal_Int32 nPos;
+ sal_Int32 nLen;
bool bCursor;
bool bWasCursorOverwrite;
- Impl_IMEInfos( xub_StrLen nPos, const OUString& rOldTextAfterStartPos );
- ~Impl_IMEInfos();
+ Impl_IMEInfos(sal_Int32 nPos, const OUString& rOldTextAfterStartPos);
+ ~Impl_IMEInfos();
- void CopyAttribs( const xub_StrLen* pA, xub_StrLen nL );
+ void CopyAttribs(const sal_uInt16* pA, sal_Int32 nL);
void DestroyAttribs();
};
// -----------------------------------------------------------------------
-Impl_IMEInfos::Impl_IMEInfos( xub_StrLen nP, const OUString& rOldTextAfterStartPos )
- : aOldTextAfterStartPos( rOldTextAfterStartPos )
+Impl_IMEInfos::Impl_IMEInfos(sal_Int32 nP, const OUString& rOldTextAfterStartPos)
+ : aOldTextAfterStartPos(rOldTextAfterStartPos)
{
nPos = nP;
nLen = 0;
@@ -157,7 +157,7 @@ Impl_IMEInfos::~Impl_IMEInfos()
// -----------------------------------------------------------------------
-void Impl_IMEInfos::CopyAttribs( const xub_StrLen* pA, xub_StrLen nL )
+void Impl_IMEInfos::CopyAttribs(const sal_uInt16* pA, sal_Int32 nL)
{
nLen = nL;
delete[] pAttribs;
@@ -1182,7 +1182,7 @@ void Edit::ImplShowCursor( sal_Bool bOnlyIfVisible )
long nCursorWidth = 0;
if ( !mbInsertMode && !maSelection.Len() && (maSelection.Max() < aText.getLength()) )
- nCursorWidth = GetTextWidth( aText, (xub_StrLen)maSelection.Max(), 1 );
+ nCursorWidth = GetTextWidth(aText, maSelection.Max(), 1);
long nCursorPosX = nTextPos + mnXOffset + ImplGetExtraOffset();
// cursor should land in visible area
@@ -1357,7 +1357,7 @@ void Edit::ImplLoadRes( const ResId& rResId )
{
Control::ImplLoadRes( rResId );
- xub_StrLen nTextLength = ReadShortRes();
+ sal_uInt16 nTextLength = ReadShortRes();
if ( nTextLength )
SetMaxTextLen( nTextLength );
}
commit 40a8208e678b2c00b7be63ac53cb76550819abc5
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Jan 12 10:26:13 2014 +0000
longparas: raise 16bit cursor pos limit to 32bit
Change-Id: I08e4e954d4f07800d23b50d3fc933b1d2984eca0
diff --git a/include/vcl/cmdevt.hxx b/include/vcl/cmdevt.hxx
index e67a2a9..8f68020 100644
--- a/include/vcl/cmdevt.hxx
+++ b/include/vcl/cmdevt.hxx
@@ -46,38 +46,38 @@ class VCL_DLLPUBLIC CommandExtTextInputData
{
private:
OUString maText;
- sal_uInt16* mpTextAttr;
- xub_StrLen mnCursorPos;
- sal_uInt16 mnCursorFlags;
- sal_Bool mbOnlyCursor;
+ sal_uInt16* mpTextAttr;
+ sal_Int32 mnCursorPos;
+ sal_uInt16 mnCursorFlags;
+ bool mbOnlyCursor;
public:
CommandExtTextInputData( const OUString& rText,
const sal_uInt16* pTextAttr,
sal_Int32 nCursorPos,
sal_uInt16 nCursorFlags,
- sal_Bool bOnlyCursor );
+ bool bOnlyCursor );
CommandExtTextInputData( const CommandExtTextInputData& rData );
~CommandExtTextInputData();
const OUString& GetText() const { return maText; }
- const sal_uInt16* GetTextAttr() const { return mpTextAttr; }
- sal_uInt16 GetCharTextAttr( sal_uInt16 nIndex ) const;
- xub_StrLen GetCursorPos() const { return mnCursorPos; }
- 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; }
- sal_Bool IsOnlyCursorChanged() const { return mbOnlyCursor; }
+ const sal_uInt16* GetTextAttr() const { return mpTextAttr; }
+ sal_uInt16 GetCharTextAttr(sal_Int32 nIndex) const
+ {
+ assert(nIndex >= 0);
+ if (mpTextAttr && nIndex < maText.getLength() && nIndex >=0)
+ return mpTextAttr[nIndex];
+ else
+ return 0;
+ }
+
+ sal_Int32 GetCursorPos() const { return mnCursorPos; }
+ bool IsCursorVisible() const { return (mnCursorFlags & EXTTEXTINPUT_CURSOR_INVISIBLE) == 0; }
+ bool IsCursorOverwrite() const { return (mnCursorFlags & EXTTEXTINPUT_CURSOR_OVERWRITE) != 0; }
+ sal_uInt16 GetCursorFlags() const { return mnCursorFlags; }
+ bool IsOnlyCursorChanged() const { return mbOnlyCursor; }
};
-inline sal_uInt16 CommandExtTextInputData::GetCharTextAttr( sal_uInt16 nIndex ) const
-{
- if ( mpTextAttr && (nIndex < maText.getLength()) )
- return mpTextAttr[nIndex];
- else
- return 0;
-}
-
// ---------------------------
// - CommandInputContextData -
// ---------------------------
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index aa579e7..52bbedf 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -2257,7 +2257,7 @@ void Edit::Command( const CommandEvent& rCEvt )
}
ImplAlignAndPaint();
- xub_StrLen nCursorPos = mpIMEInfos->nPos + pData->GetCursorPos();
+ sal_Int32 nCursorPos = mpIMEInfos->nPos + pData->GetCursorPos();
SetSelection( Selection( nCursorPos, nCursorPos ) );
SetInsertMode( !pData->IsCursorOverwrite() );
diff --git a/vcl/source/window/cmdevt.cxx b/vcl/source/window/cmdevt.cxx
index 6326def..9f1b467 100644
--- a/vcl/source/window/cmdevt.cxx
+++ b/vcl/source/window/cmdevt.cxx
@@ -23,11 +23,9 @@
#include <vcl/cmdevt.hxx>
CommandExtTextInputData::CommandExtTextInputData( const OUString& rText,
- const sal_uInt16* pTextAttr,
- sal_Int32 nCursorPos,
- sal_uInt16 nCursorFlags,
- sal_Bool bOnlyCursor ) :
- maText( rText )
+ const sal_uInt16* pTextAttr, sal_Int32 nCursorPos, sal_uInt16 nCursorFlags,
+ bool bOnlyCursor)
+ : maText(rText)
{
if ( pTextAttr && !maText.isEmpty() )
{
@@ -62,8 +60,7 @@ CommandExtTextInputData::CommandExtTextInputData( const CommandExtTextInputData&
CommandExtTextInputData::~CommandExtTextInputData()
{
- if ( mpTextAttr )
- delete [] mpTextAttr;
+ delete [] mpTextAttr;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list