[Libreoffice-commits] .: sc/source
Noel Power
noelp at kemper.freedesktop.org
Wed Nov 30 10:50:36 PST 2011
sc/source/ui/app/inputhdl.cxx | 21 +++++++++++----
sc/source/ui/app/inputwin.cxx | 57 ++++++++++--------------------------------
sc/source/ui/inc/inputwin.hxx | 2 +
3 files changed, 32 insertions(+), 48 deletions(-)
New commits:
commit 93acae3d17c528bd98b28cc9078c8dd7612316a8
Author: Noel Power <noel.power at novell.com>
Date: Wed Nov 30 18:49:40 2011 +0000
gsoc inputbar ( fix scrolling ) add support for hard linebreaks
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index e857551..0fdd0e4 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -2061,7 +2061,11 @@ IMPL_LINK( ScInputHandler, ModifyHdl, void *, EMPTYARG )
// update input line from ModifyHdl for changes that are not
// wrapped by DataChanging/DataChanged calls (like Drag&Drop)
- String aText = GetEditText(pEngine);
+ String aText;
+ if ( pInputWin->IsMultiLineInput() )
+ aText = ScEditUtil::GetMultilineString(*pEngine);
+ else
+ aText = GetEditText(pEngine);
lcl_RemoveTabs(aText);
pInputWin->SetTextString(aText);
}
@@ -2109,11 +2113,15 @@ void ScInputHandler::DataChanged( sal_Bool bFromTopNotify )
if (eMode==SC_INPUT_TYPE || eMode==SC_INPUT_TABLE)
{
- String aText = GetEditText(pEngine);
+ String aText;
+ if ( pInputWin->IsMultiLineInput() )
+ aText = ScEditUtil::GetMultilineString(*pEngine);
+ else
+ aText = GetEditText(pEngine);
lcl_RemoveTabs(aText);
if ( pInputWin )
- pInputWin->SetTextString(aText);
+ pInputWin->SetTextString( aText );
}
// wenn der Cursor vor dem Absatzende steht, werden Teile rechts rausgeschoben
@@ -3010,7 +3018,7 @@ sal_Bool ScInputHandler::KeyInput( const KeyEvent& rKEvt, sal_Bool bStartEdit /*
switch ( nCode )
{
case KEY_RETURN:
- if (bControl && !bShift && !bInputLine)
+ if (bControl && !bShift && ( !bInputLine || pInputWin && pInputWin->IsMultiLineInput() ) )
bDoEnter = sal_True;
else if ( nModi == 0 && nTipVisible && pFormulaData && nAutoPos != SCPOS_INVALID )
{
@@ -3404,7 +3412,10 @@ void ScInputHandler::NotifyChange( const ScInputHdlState* pState,
if (pData)
{
pEngine->SetText( *pData );
- aString = GetEditText(pEngine);
+ if ( pInputWin->IsMultiLineInput() )
+ aString = ScEditUtil::GetMultilineString(*pEngine);
+ else
+ aString = GetEditText(pEngine);
lcl_RemoveTabs(aString);
bTextValid = false;
aCurrentText.Erase();
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 650293a..5689307 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -180,7 +180,8 @@ ScInputWindow::ScInputWindow( Window* pParent, SfxBindings* pBind ) :
mnMaxY (0),
bIsOkCancelMode ( false ),
bIsMultiLine ( false ),
- bInResize ( false )
+ bInResize ( false ),
+ mbIsMultiLine ( lcl_isExperimentalMode() )
{
ScModule* pScMod = SC_MOD();
SfxImageManager* pImgMgr = SfxImageManager::GetImageManager( pScMod );
@@ -518,7 +519,7 @@ void ScInputWindow::Select()
void ScInputWindow::Resize()
{
ToolBox::Resize();
- if ( lcl_isExperimentalMode() )
+ if ( mbIsMultiLine )
{
aTextWindow.Resize();
Size aSize = GetSizePixel();
@@ -759,7 +760,7 @@ bool ScInputWindow::IsPointerAtResizePos()
void ScInputWindow::MouseMove( const MouseEvent& rMEvt )
{
- if ( lcl_isExperimentalMode() )
+ if ( mbIsMultiLine )
{
Point aPosPixel = GetPointerPosPixel();
@@ -805,7 +806,7 @@ void ScInputWindow::MouseMove( const MouseEvent& rMEvt )
void ScInputWindow::MouseButtonDown( const MouseEvent& rMEvt )
{
- if ( lcl_isExperimentalMode() )
+ if ( mbIsMultiLine )
{
if ( rMEvt.IsLeft() )
{
@@ -829,7 +830,7 @@ void ScInputWindow::MouseButtonDown( const MouseEvent& rMEvt )
}
void ScInputWindow::MouseButtonUp( const MouseEvent& rMEvt )
{
- if ( lcl_isExperimentalMode() )
+ if ( mbIsMultiLine )
{
ReleaseMouse();
if ( rMEvt.IsLeft() )
@@ -1180,17 +1181,19 @@ IMPL_LINK(ScMultiTextWnd, ModifyHdl, EENotify*, pNotify)
IMPL_LINK(ScMultiTextWnd, NotifyHdl, EENotify*, pNotify)
{
// need to process EE_NOTIFY_TEXTVIEWSCROLLED here
- // sometimes when pasting we don't seem to get EE_NOTIFY_TEXTVIEWSCROLLED
- // but we always seem to get EE_NOTIFY_TEXTMODIFIED
+ // sometimes we don't seem to get EE_NOTIFY_TEXTVIEWSCROLLED e.g. when
+ // we insert text at the begining of the text so the cursor never moves
+ // down to generate a scroll event
+
if ( pNotify && ( pNotify->eNotificationType == EE_NOTIFY_TEXTVIEWSCROLLED
- || pNotify->eNotificationType == EE_NOTIFY_TEXTMODIFIED ) )
+ || pNotify->eNotificationType == EE_NOTIFY_TEXTHEIGHTCHANGED ) )
SetScrollBarRange();
return 0;
}
long ScMultiTextWnd::GetEditEngTxtHeight()
{
- return pEditView ? pEditView->GetEditEngine()->GetTextHeight(0) : 0;
+ return pEditView ? pEditView->GetEditEngine()->GetTextHeight() : 0;
}
void ScMultiTextWnd::SetScrollBarRange()
@@ -1372,40 +1375,8 @@ void ScMultiTextWnd::StopEditEngine( sal_Bool bAll )
void ScMultiTextWnd::SetTextString( const String& rNewString )
{
- if ( rNewString != aString )
- {
- // #TODO - is it really necessary to do this here, the base
- // class never seems to have it's own editengine set up
- long nTextSize = 0;
- xub_StrLen nDifPos;
- if (rNewString.Len() > aString.Len())
- nDifPos = rNewString.Match(aString);
- else
- nDifPos = aString.Match(rNewString);
-
- long nSize1 = GetTextWidth(aString);
- long nSize2 = GetTextWidth(rNewString);
- if ( nSize1>0 && nSize2>0 )
- nTextSize = Max( nSize1, nSize2 );
- else
- nTextSize = GetOutputSize().Width();
-
- if (nDifPos == STRING_MATCH)
- nDifPos = 0;
-
- Point aLogicStart = PixelToLogic(Point(nTextStartPos-1,0));
- long nStartPos = aLogicStart.X();
- long nInvPos = nStartPos;
- if (nDifPos)
- nInvPos += GetTextWidth(aString,0,nDifPos);
-
- sal_uInt16 nFlags = 0;
- if ( nDifPos == aString.Len() ) // only new characters appended
- nFlags = INVALIDATE_NOERASE; // then background is already clear
- Invalidate( Rectangle( nInvPos, 0,
- nStartPos+nTextSize, GetOutputSize().Height()-1 ),
- nFlags );
- }
+ if ( pEditView )
+ pEditView->Invalidate();
ScTextWnd::SetTextString( rNewString );
SetScrollBarRange();
DoScroll();
diff --git a/sc/source/ui/inc/inputwin.hxx b/sc/source/ui/inc/inputwin.hxx
index f6aacb3..76730b6 100644
--- a/sc/source/ui/inc/inputwin.hxx
+++ b/sc/source/ui/inc/inputwin.hxx
@@ -277,6 +277,7 @@ public:
virtual void MouseButtonUp( const MouseEvent& rMEvt );
virtual void MouseButtonDown( const MouseEvent& rMEvt );
virtual void MouseMove( const MouseEvent& rMEvt );
+ bool IsMultiLineInput() { return mbIsMultiLine; }
protected:
virtual void SetText( const String& rString );
virtual String GetText() const;
@@ -297,6 +298,7 @@ private:
sal_Bool bIsOkCancelMode;
bool bIsMultiLine;
bool bInResize;
+ bool mbIsMultiLine;
};
//==================================================================
More information about the Libreoffice-commits
mailing list