summaryrefslogtreecommitdiff
path: root/editeng/source
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2012-10-08 15:13:37 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-05-19 20:07:34 +0100
commitb9bea009ac27ffe822b43911a5c7a30d36c43c50 (patch)
tree694a333d18cdfd8fa97b97957d454ce9abe1403e /editeng/source
parentacccf7a13fd0f87e5aecdc7d5412726a76dba275 (diff)
Related: #119885# Made EditMode work with text boxes...
where text is reaching over the TextBox's bounds (cherry picked from commit fbbef010986ea359b5209e6d3884bdf4e4ac86a6) Conflicts: editeng/source/editeng/impedit.cxx Change-Id: I00020a33faf86c8671259e71179932cddf54cfe1
Diffstat (limited to 'editeng/source')
-rw-r--r--editeng/source/editeng/impedit.cxx88
1 files changed, 37 insertions, 51 deletions
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index bbdaca32cdc3..c0d98e957a5f 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -44,7 +44,6 @@
#include <sot/exchange.hxx>
#include <sot/formats.hxx>
-
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::linguistic2;
@@ -433,65 +432,52 @@ void ImpEditView::SetOutputArea( const Rectangle& rRect )
void ImpEditView::ResetOutputArea( const Rectangle& rRect )
{
- Rectangle aCurArea( aOutArea );
- SetOutputArea( rRect );
- // Invalidate surrounding areas if in update mode of the engine on sal_True
- if ( !aCurArea.IsEmpty() && pEditEngine->pImpEditEngine->GetUpdateMode() )
+ // remember old out area
+ const Rectangle aOldArea(aOutArea);
+
+ // apply new one
+ SetOutputArea(rRect);
+
+ // invalidate surrounding areas if update is true
+ if(!aOldArea.IsEmpty() && pEditEngine->pImpEditEngine->GetUpdateMode())
{
- long nMore = 0;
- if ( DoInvalidateMore() )
- nMore = GetWindow()->PixelToLogic( Size( nInvMore, 0 ) ).Width();
- if ( aCurArea.Left() < aOutArea.Left() )
+ // #i119885# use grown area if needed; do when getting bigger OR smaller
+ const sal_Int32 nMore(DoInvalidateMore() ? GetWindow()->PixelToLogic(Size(nInvMore, 0)).Width() : 0);
+
+ if(aOldArea.Left() > aOutArea.Left())
{
- Rectangle aRect( aCurArea.TopLeft(),
- Size( aOutArea.Left()-aCurArea.Left(), aCurArea.GetHeight() ) );
- if ( nMore )
- {
- aRect.Left() -= nMore;
- aRect.Top() -= nMore;
- aRect.Bottom() += nMore;
- }
- GetWindow()->Invalidate( aRect );
+ GetWindow()->Invalidate(Rectangle(aOutArea.Left() - nMore, aOldArea.Top() - nMore, aOldArea.Left(), aOldArea.Bottom() + nMore));
}
- if ( aCurArea.Right() > aOutArea.Right() )
+ else if(aOldArea.Left() < aOutArea.Left())
{
- long nW = aCurArea.Right() - aOutArea.Right();
- Point aPos( aCurArea.TopRight() );
- aPos.X() -= nW;
- Rectangle aRect( aPos, Size( nW, aCurArea.GetHeight() ) );
- if ( nMore )
- {
- aRect.Right() += nMore;
- aRect.Top() -= nMore;
- aRect.Bottom() += nMore;
- }
- GetWindow()->Invalidate( aRect );
+ GetWindow()->Invalidate(Rectangle(aOldArea.Left() - nMore, aOldArea.Top() - nMore, aOutArea.Left(), aOldArea.Bottom() + nMore));
}
- if ( aCurArea.Top() < aOutArea.Top() )
+
+ if(aOldArea.Right() > aOutArea.Right())
{
- Rectangle aRect( aCurArea.TopLeft(), Size( aCurArea.GetWidth(), aOutArea.Top() - aCurArea.Top() ) );
- if ( nMore )
- {
- aRect.Top() -= nMore;
- aRect.Left() -= nMore;
- aRect.Right() += nMore;
- }
- GetWindow()->Invalidate( aRect );
+ GetWindow()->Invalidate(Rectangle(aOutArea.Right(), aOldArea.Top() - nMore, aOldArea.Right() + nMore, aOldArea.Bottom() + nMore));
}
- if ( aCurArea.Bottom() > aOutArea.Bottom() )
+ else if(aOldArea.Right() < aOutArea.Right())
{
- long nH = aCurArea.Bottom() - aOutArea.Bottom();
- Point aPos( aCurArea.BottomLeft() );
- aPos.Y() -= nH;
- Rectangle aRect( aPos, Size( aCurArea.GetWidth(), nH ) );
- if ( nMore )
- {
- aRect.Bottom() += nMore;
- aRect.Left() -= nMore;
- aRect.Right() += nMore;
- }
+ GetWindow()->Invalidate(Rectangle(aOldArea.Right(), aOldArea.Top() - nMore, aOutArea.Right() + nMore, aOldArea.Bottom() + nMore));
+ }
- GetWindow()->Invalidate( aRect );
+ if(aOldArea.Top() > aOutArea.Top())
+ {
+ GetWindow()->Invalidate(Rectangle(aOldArea.Left() - nMore, aOutArea.Top() - nMore, aOldArea.Right() + nMore, aOldArea.Top()));
+ }
+ else if(aOldArea.Top() < aOutArea.Top())
+ {
+ GetWindow()->Invalidate(Rectangle(aOldArea.Left() - nMore, aOldArea.Top() - nMore, aOldArea.Right() + nMore, aOutArea.Top()));
+ }
+
+ if(aOldArea.Bottom() > aOutArea.Bottom())
+ {
+ GetWindow()->Invalidate(Rectangle(aOldArea.Left() - nMore, aOutArea.Bottom(), aOldArea.Right() + nMore, aOldArea.Bottom() + nMore));
+ }
+ else if(aOldArea.Bottom() < aOutArea.Bottom())
+ {
+ GetWindow()->Invalidate(Rectangle(aOldArea.Left() - nMore, aOldArea.Bottom(), aOldArea.Right() + nMore, aOutArea.Bottom() + nMore));
}
}
}