2010-10-14 08:27:31 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2000-09-18 16:07:07 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 07:31:08 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 07:31:08 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 07:31:08 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 07:31:08 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 07:31:08 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 07:31:08 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-17 10:52:11 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_vcl.hxx"
|
|
|
|
|
2004-01-06 12:17:11 +00:00
|
|
|
#include <tools/rc.h>
|
2007-06-27 19:05:10 +00:00
|
|
|
#include <vcl/svdata.hxx>
|
|
|
|
#include <vcl/decoview.hxx>
|
|
|
|
#include <vcl/event.hxx>
|
|
|
|
#include <vcl/cursor.hxx>
|
|
|
|
#include <vcl/virdev.hxx>
|
2007-07-24 09:06:15 +00:00
|
|
|
#include <vcl/svids.hrc>
|
2007-06-27 19:05:10 +00:00
|
|
|
#include <vcl/menu.hxx>
|
2007-07-24 09:06:15 +00:00
|
|
|
#include <vcl/cmdevt.h>
|
|
|
|
#include <vcl/subedit.hxx>
|
2007-06-27 19:05:10 +00:00
|
|
|
#include <vcl/edit.hxx>
|
|
|
|
#include <vcl/svapp.hxx>
|
2009-09-14 12:09:22 +00:00
|
|
|
#include <vcl/controldata.hxx>
|
2007-09-26 14:06:07 +00:00
|
|
|
#include <vcl/msgbox.hxx>
|
2008-07-22 06:53:23 +00:00
|
|
|
#include <vcl/window.h>
|
2007-09-26 14:06:07 +00:00
|
|
|
|
2010-10-16 03:20:00 -05:00
|
|
|
#include <osl/mutex.hxx>
|
2001-05-11 06:26:03 +00:00
|
|
|
|
|
|
|
|
2000-11-20 11:39:41 +00:00
|
|
|
#include <com/sun/star/i18n/XBreakIterator.hpp>
|
2000-11-20 16:52:32 +00:00
|
|
|
#include <com/sun/star/i18n/CharacterIteratorMode.hpp>
|
|
|
|
#include <com/sun/star/i18n/WordType.hpp>
|
2001-02-12 11:57:52 +00:00
|
|
|
#include <cppuhelper/weak.hxx>
|
|
|
|
#include <com/sun/star/datatransfer/XTransferable.hpp>
|
|
|
|
#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
|
|
|
|
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
|
|
|
|
2001-05-11 06:26:03 +00:00
|
|
|
#include <com/sun/star/datatransfer/dnd/DNDConstants.hpp>
|
|
|
|
#include <com/sun/star/datatransfer/dnd/XDragGestureRecognizer.hpp>
|
|
|
|
#include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
|
|
|
|
|
2006-03-14 08:42:11 +00:00
|
|
|
#include <com/sun/star/i18n/XExtendedInputSequenceChecker.hpp>
|
|
|
|
#include <com/sun/star/i18n/InputSequenceCheckMode.hpp>
|
|
|
|
#include <com/sun/star/i18n/ScriptType.hpp>
|
|
|
|
#include <com/sun/star/container/XNameAccess.hpp>
|
|
|
|
|
|
|
|
#include <com/sun/star/uno/Any.hxx>
|
|
|
|
|
|
|
|
#include <comphelper/processfactory.hxx>
|
|
|
|
#include <comphelper/configurationhelper.hxx>
|
|
|
|
|
2001-02-12 11:57:52 +00:00
|
|
|
#include <sot/exchange.hxx>
|
|
|
|
#include <sot/formats.hxx>
|
2001-02-14 07:32:01 +00:00
|
|
|
#include <rtl/memory.h>
|
2010-10-18 12:28:33 +02:00
|
|
|
#include <sal/macros.h>
|
2001-02-12 11:57:52 +00:00
|
|
|
|
2007-06-27 19:05:10 +00:00
|
|
|
#include <vcl/unohelp.hxx>
|
|
|
|
#include <vcl/unohelp2.hxx>
|
2002-03-18 16:41:12 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-12-01 12:11:17 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::lang;
|
|
|
|
using namespace ::rtl;
|
|
|
|
|
|
|
|
// - Redo
|
|
|
|
// - Bei Tracking-Cancel DefaultSelection wieder herstellen
|
|
|
|
|
|
|
|
// =======================================================================
|
|
|
|
|
|
|
|
static FncGetSpecialChars pImplFncGetSpecialChars = NULL;
|
|
|
|
|
|
|
|
// =======================================================================
|
|
|
|
|
|
|
|
#define EDIT_ALIGN_LEFT 1
|
|
|
|
#define EDIT_ALIGN_CENTER 2
|
|
|
|
#define EDIT_ALIGN_RIGHT 3
|
|
|
|
|
|
|
|
#define EDIT_DEL_LEFT 1
|
|
|
|
#define EDIT_DEL_RIGHT 2
|
|
|
|
|
|
|
|
#define EDIT_DELMODE_SIMPLE 11
|
|
|
|
#define EDIT_DELMODE_RESTOFWORD 12
|
|
|
|
#define EDIT_DELMODE_RESTOFCONTENT 13
|
|
|
|
|
|
|
|
// =======================================================================
|
|
|
|
|
|
|
|
struct DDInfo
|
|
|
|
{
|
|
|
|
Cursor aCursor;
|
2001-05-11 06:26:03 +00:00
|
|
|
Selection aDndStartSel;
|
2000-09-18 16:07:07 +00:00
|
|
|
xub_StrLen nDropPos;
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_Bool bStarterOfDD;
|
|
|
|
sal_Bool bDroppedInMe;
|
|
|
|
sal_Bool bVisCursor;
|
2010-11-10 13:50:33 +08:00
|
|
|
sal_Bool bIsStringSupported;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
DDInfo()
|
|
|
|
{
|
|
|
|
aCursor.SetStyle( CURSOR_SHADOW );
|
|
|
|
nDropPos = 0;
|
2010-09-29 15:46:40 +08:00
|
|
|
bStarterOfDD = sal_False;
|
|
|
|
bDroppedInMe = sal_False;
|
|
|
|
bVisCursor = sal_False;
|
2010-11-10 13:50:33 +08:00
|
|
|
bIsStringSupported = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// =======================================================================
|
|
|
|
|
|
|
|
struct Impl_IMEInfos
|
|
|
|
{
|
2001-06-12 13:42:19 +00:00
|
|
|
String aOldTextAfterStartPos;
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16* pAttribs;
|
2000-09-18 16:07:07 +00:00
|
|
|
xub_StrLen nPos;
|
|
|
|
xub_StrLen nLen;
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_Bool bCursor;
|
|
|
|
sal_Bool bWasCursorOverwrite;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-06-12 13:42:19 +00:00
|
|
|
Impl_IMEInfos( xub_StrLen nPos, const String& rOldTextAfterStartPos );
|
2000-09-18 16:07:07 +00:00
|
|
|
~Impl_IMEInfos();
|
|
|
|
|
|
|
|
void CopyAttribs( const xub_StrLen* pA, xub_StrLen nL );
|
|
|
|
void DestroyAttribs();
|
|
|
|
};
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2001-06-12 13:42:19 +00:00
|
|
|
Impl_IMEInfos::Impl_IMEInfos( xub_StrLen nP, const String& rOldTextAfterStartPos )
|
|
|
|
: aOldTextAfterStartPos( rOldTextAfterStartPos )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
nPos = nP;
|
|
|
|
nLen = 0;
|
2010-09-29 15:46:40 +08:00
|
|
|
bCursor = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
pAttribs = NULL;
|
2010-09-29 15:46:40 +08:00
|
|
|
bWasCursorOverwrite = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
Impl_IMEInfos::~Impl_IMEInfos()
|
|
|
|
{
|
2002-07-17 09:56:34 +00:00
|
|
|
delete[] pAttribs;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Impl_IMEInfos::CopyAttribs( const xub_StrLen* pA, xub_StrLen nL )
|
|
|
|
{
|
|
|
|
nLen = nL;
|
2002-07-17 09:56:34 +00:00
|
|
|
delete[] pAttribs;
|
2010-09-29 15:46:40 +08:00
|
|
|
pAttribs = new sal_uInt16[ nL ];
|
|
|
|
rtl_copyMemory( pAttribs, pA, nL*sizeof(sal_uInt16) );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Impl_IMEInfos::DestroyAttribs()
|
|
|
|
{
|
2002-07-17 09:56:34 +00:00
|
|
|
delete[] pAttribs;
|
2000-09-18 16:07:07 +00:00
|
|
|
pAttribs = NULL;
|
2001-05-03 07:19:53 +00:00
|
|
|
nLen = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// =======================================================================
|
|
|
|
|
|
|
|
Edit::Edit( WindowType nType ) :
|
|
|
|
Control( nType )
|
|
|
|
{
|
2006-06-19 18:16:09 +00:00
|
|
|
ImplInitEditData();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
Edit::Edit( Window* pParent, WinBits nStyle ) :
|
|
|
|
Control( WINDOW_EDIT )
|
|
|
|
{
|
2006-06-19 18:16:09 +00:00
|
|
|
ImplInitEditData();
|
2000-09-18 16:07:07 +00:00
|
|
|
ImplInit( pParent, nStyle );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
Edit::Edit( Window* pParent, const ResId& rResId ) :
|
|
|
|
Control( WINDOW_EDIT )
|
|
|
|
{
|
2006-06-19 18:16:09 +00:00
|
|
|
ImplInitEditData();
|
2000-09-18 16:07:07 +00:00
|
|
|
rResId.SetRT( RSC_EDIT );
|
|
|
|
WinBits nStyle = ImplInitRes( rResId );
|
|
|
|
ImplInit( pParent, nStyle );
|
|
|
|
ImplLoadRes( rResId );
|
2002-09-09 09:32:02 +00:00
|
|
|
|
|
|
|
// Derived MultiLineEdit takes care to call Show only after MultiLineEdit
|
|
|
|
// ctor has already started:
|
|
|
|
if ( !(nStyle & WB_HIDE) && rResId.GetRT() != RSC_MULTILINEEDIT )
|
2000-09-18 16:07:07 +00:00
|
|
|
Show();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2008-07-22 06:53:23 +00:00
|
|
|
Edit::Edit( Window* pParent, const ResId& rResId, bool bDisableAccessibleLabeledByRelation ) :
|
|
|
|
Control( WINDOW_EDIT )
|
|
|
|
{
|
|
|
|
ImplInitEditData();
|
|
|
|
rResId.SetRT( RSC_EDIT );
|
|
|
|
WinBits nStyle = ImplInitRes( rResId );
|
|
|
|
ImplInit( pParent, nStyle );
|
|
|
|
ImplLoadRes( rResId );
|
|
|
|
if ( bDisableAccessibleLabeledByRelation )
|
2010-09-29 15:46:40 +08:00
|
|
|
ImplGetWindowImpl()->mbDisableAccessibleLabeledByRelation = sal_True;
|
2008-07-22 06:53:23 +00:00
|
|
|
|
|
|
|
// Derived MultiLineEdit takes care to call Show only after MultiLineEdit
|
|
|
|
// ctor has already started:
|
|
|
|
if ( !(nStyle & WB_HIDE) && rResId.GetRT() != RSC_MULTILINEEDIT )
|
|
|
|
Show();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
Edit::~Edit()
|
|
|
|
{
|
|
|
|
delete mpDDInfo;
|
|
|
|
Cursor* pCursor = GetCursor();
|
|
|
|
if ( pCursor )
|
|
|
|
{
|
|
|
|
SetCursor( NULL );
|
|
|
|
delete pCursor;
|
|
|
|
}
|
|
|
|
|
|
|
|
delete mpIMEInfos;
|
|
|
|
|
|
|
|
if ( mpUpdateDataTimer )
|
|
|
|
delete mpUpdateDataTimer;
|
2001-05-11 06:26:03 +00:00
|
|
|
|
2002-01-18 07:30:09 +00:00
|
|
|
if ( mxDnDListener.is() )
|
|
|
|
{
|
|
|
|
if ( GetDragGestureRecognizer().is() )
|
|
|
|
{
|
|
|
|
uno::Reference< datatransfer::dnd::XDragGestureListener> xDGL( mxDnDListener, uno::UNO_QUERY );
|
|
|
|
GetDragGestureRecognizer()->removeDragGestureListener( xDGL );
|
|
|
|
}
|
|
|
|
if ( GetDropTarget().is() )
|
|
|
|
{
|
|
|
|
uno::Reference< datatransfer::dnd::XDropTargetListener> xDTL( mxDnDListener, uno::UNO_QUERY );
|
|
|
|
GetDropTarget()->removeDropTargetListener( xDTL );
|
|
|
|
}
|
|
|
|
|
|
|
|
uno::Reference< lang::XEventListener> xEL( mxDnDListener, uno::UNO_QUERY );
|
|
|
|
xEL->disposing( lang::EventObject() ); // #95154# #96585# Empty Source means it's the Client
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2006-06-19 18:16:09 +00:00
|
|
|
void Edit::ImplInitEditData()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
mpSubEdit = NULL;
|
|
|
|
mpUpdateDataTimer = NULL;
|
|
|
|
mnXOffset = 0;
|
|
|
|
mnAlign = EDIT_ALIGN_LEFT;
|
|
|
|
mnMaxTextLen = EDIT_NOLIMIT;
|
|
|
|
meAutocompleteAction = AUTOCOMPLETE_KEYINPUT;
|
2010-09-29 15:46:40 +08:00
|
|
|
mbModified = sal_False;
|
|
|
|
mbInternModified = sal_False;
|
|
|
|
mbReadOnly = sal_False;
|
|
|
|
mbInsertMode = sal_True;
|
|
|
|
mbClickedInSelection = sal_False;
|
|
|
|
mbActivePopup = sal_False;
|
|
|
|
mbIsSubEdit = sal_False;
|
|
|
|
mbInMBDown = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
mpDDInfo = NULL;
|
|
|
|
mpIMEInfos = NULL;
|
|
|
|
mcEchoChar = 0;
|
2001-05-11 06:26:03 +00:00
|
|
|
|
2002-09-12 07:35:13 +00:00
|
|
|
// --- RTL --- no default mirroring for Edit controls
|
|
|
|
// note: controls that use a subedit will revert this (SpinField, ComboBox)
|
2010-09-29 15:46:40 +08:00
|
|
|
EnableRTL( sal_False );
|
2002-09-12 07:35:13 +00:00
|
|
|
|
2001-05-11 06:26:03 +00:00
|
|
|
vcl::unohelper::DragAndDropWrapper* pDnDWrapper = new vcl::unohelper::DragAndDropWrapper( this );
|
|
|
|
mxDnDListener = pDnDWrapper;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2005-03-30 08:06:00 +00:00
|
|
|
bool Edit::ImplUseNativeBorder( WinBits nStyle )
|
|
|
|
{
|
2005-04-12 11:18:34 +00:00
|
|
|
bool bRet =
|
|
|
|
IsNativeControlSupported(ImplGetNativeControlType(), HAS_BACKGROUND_TEXTURE)
|
|
|
|
&& ((nStyle&WB_BORDER) && !(nStyle&WB_NOBORDER));
|
|
|
|
if( ! bRet && mbIsSubEdit )
|
2005-03-30 08:06:00 +00:00
|
|
|
{
|
2005-04-12 11:18:34 +00:00
|
|
|
Window* pWindow = GetParent();
|
|
|
|
nStyle = pWindow->GetStyle();
|
|
|
|
bRet = pWindow->IsNativeControlSupported(ImplGetNativeControlType(), HAS_BACKGROUND_TEXTURE)
|
|
|
|
&& ((nStyle&WB_BORDER) && !(nStyle&WB_NOBORDER));
|
2005-03-30 08:06:00 +00:00
|
|
|
}
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
void Edit::ImplInit( Window* pParent, WinBits nStyle )
|
|
|
|
{
|
|
|
|
nStyle = ImplInitStyle( nStyle );
|
|
|
|
if ( !(nStyle & (WB_CENTER | WB_RIGHT)) )
|
|
|
|
nStyle |= WB_LEFT;
|
|
|
|
|
|
|
|
Control::ImplInit( pParent, nStyle, NULL );
|
|
|
|
|
|
|
|
mbReadOnly = (nStyle & WB_READONLY) != 0;
|
|
|
|
|
|
|
|
mnAlign = EDIT_ALIGN_LEFT;
|
2002-09-12 07:35:13 +00:00
|
|
|
|
|
|
|
// --- RTL --- hack: right align until keyinput and cursor travelling works
|
2008-12-16 13:30:53 +00:00
|
|
|
if( IsRTLEnabled() )
|
2002-09-12 07:35:13 +00:00
|
|
|
mnAlign = EDIT_ALIGN_RIGHT;
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( nStyle & WB_RIGHT )
|
|
|
|
mnAlign = EDIT_ALIGN_RIGHT;
|
|
|
|
else if ( nStyle & WB_CENTER )
|
|
|
|
mnAlign = EDIT_ALIGN_CENTER;
|
|
|
|
|
|
|
|
SetCursor( new Cursor );
|
|
|
|
|
|
|
|
SetPointer( Pointer( POINTER_TEXT ) );
|
2010-09-29 15:46:40 +08:00
|
|
|
ImplInitSettings( sal_True, sal_True, sal_True );
|
2001-05-11 06:26:03 +00:00
|
|
|
|
|
|
|
uno::Reference< datatransfer::dnd::XDragGestureListener> xDGL( mxDnDListener, uno::UNO_QUERY );
|
|
|
|
uno::Reference< datatransfer::dnd::XDragGestureRecognizer > xDGR = GetDragGestureRecognizer();
|
|
|
|
if ( xDGR.is() )
|
|
|
|
{
|
|
|
|
xDGR->addDragGestureListener( xDGL );
|
|
|
|
uno::Reference< datatransfer::dnd::XDropTargetListener> xDTL( mxDnDListener, uno::UNO_QUERY );
|
|
|
|
GetDropTarget()->addDropTargetListener( xDTL );
|
|
|
|
GetDropTarget()->setActive( sal_True );
|
|
|
|
GetDropTarget()->setDefaultActions( datatransfer::dnd::DNDConstants::ACTION_COPY_OR_MOVE );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
WinBits Edit::ImplInitStyle( WinBits nStyle )
|
|
|
|
{
|
|
|
|
if ( !(nStyle & WB_NOTABSTOP) )
|
|
|
|
nStyle |= WB_TABSTOP;
|
|
|
|
if ( !(nStyle & WB_NOGROUP) )
|
|
|
|
nStyle |= WB_GROUP;
|
|
|
|
|
|
|
|
return nStyle;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_Bool Edit::IsCharInput( const KeyEvent& rKeyEvent )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
// In the future we must use new Unicode functions for this
|
|
|
|
xub_Unicode cCharCode = rKeyEvent.GetCharCode();
|
2008-08-18 12:05:17 +00:00
|
|
|
return ((cCharCode >= 32) && (cCharCode != 127) &&
|
|
|
|
!rKeyEvent.GetKeyCode().IsMod3() &&
|
|
|
|
!rKeyEvent.GetKeyCode().IsMod2() &&
|
|
|
|
!rKeyEvent.GetKeyCode().IsMod1() );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Edit::ImplModified()
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
mbModified = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
Modify();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
void Edit::ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
|
|
|
|
|
|
|
|
if ( bFont )
|
|
|
|
{
|
|
|
|
Font aFont = rStyleSettings.GetFieldFont();
|
|
|
|
if ( IsControlFont() )
|
|
|
|
aFont.Merge( GetControlFont() );
|
|
|
|
SetZoomedPointFont( aFont );
|
2009-09-14 12:09:22 +00:00
|
|
|
ImplClearLayoutData();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( bFont || bForeground )
|
|
|
|
{
|
|
|
|
Color aTextColor = rStyleSettings.GetFieldTextColor();
|
|
|
|
if ( IsControlForeground() )
|
|
|
|
aTextColor = GetControlForeground();
|
|
|
|
SetTextColor( aTextColor );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( bBackground )
|
|
|
|
{
|
2007-04-26 09:36:22 +00:00
|
|
|
if ( ImplUseNativeBorder( GetStyle() ) || IsPaintTransparent() )
|
2004-05-10 14:46:40 +00:00
|
|
|
{
|
|
|
|
// Transparent background
|
|
|
|
SetBackground();
|
|
|
|
SetFillColor();
|
|
|
|
}
|
|
|
|
else if ( IsControlBackground() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
SetBackground( GetControlBackground() );
|
|
|
|
SetFillColor( GetControlBackground() );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SetBackground( rStyleSettings.GetFieldColor() );
|
|
|
|
SetFillColor( rStyleSettings.GetFieldColor() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-09-04 12:08:17 +00:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
long Edit::ImplGetExtraOffset() const
|
|
|
|
{
|
|
|
|
// MT 09/2002: nExtraOffsetX should become a member, instead of checking every time,
|
|
|
|
// but I need an incompatible update for this...
|
|
|
|
// #94095# Use extra offset only when edit has a border
|
|
|
|
long nExtraOffset = 0;
|
|
|
|
if( ( GetStyle() & WB_BORDER ) || ( mbIsSubEdit && ( GetParent()->GetStyle() & WB_BORDER ) ) )
|
|
|
|
nExtraOffset = 2;
|
|
|
|
|
|
|
|
return nExtraOffset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
XubString Edit::ImplGetText() const
|
|
|
|
{
|
|
|
|
if ( mcEchoChar || (GetStyle() & WB_PASSWORD) )
|
|
|
|
{
|
|
|
|
XubString aText;
|
|
|
|
xub_Unicode cEchoChar;
|
|
|
|
if ( mcEchoChar )
|
|
|
|
cEchoChar = mcEchoChar;
|
|
|
|
else
|
|
|
|
cEchoChar = '*';
|
|
|
|
aText.Fill( maText.Len(), cEchoChar );
|
|
|
|
return aText;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return maText;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2007-04-26 09:36:22 +00:00
|
|
|
void Edit::ImplInvalidateOrRepaint( xub_StrLen nStart, xub_StrLen nEnd )
|
|
|
|
{
|
|
|
|
if( IsPaintTransparent() )
|
2008-01-14 15:20:49 +00:00
|
|
|
{
|
2007-04-26 09:36:22 +00:00
|
|
|
Invalidate();
|
2008-01-14 15:20:49 +00:00
|
|
|
// FIXME: this is currently only on aqua
|
|
|
|
if( ImplGetSVData()->maNWFData.mbNoFocusRects )
|
|
|
|
Update();
|
|
|
|
}
|
2007-04-26 09:36:22 +00:00
|
|
|
else
|
|
|
|
ImplRepaint( nStart, nEnd );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2009-10-23 12:10:07 +02:00
|
|
|
long Edit::ImplGetTextYPosition() const
|
|
|
|
{
|
|
|
|
if ( GetStyle() & WB_TOP )
|
|
|
|
return ImplGetExtraOffset();
|
|
|
|
else if ( GetStyle() & WB_BOTTOM )
|
|
|
|
return GetOutputSizePixel().Height() - GetTextHeight() - ImplGetExtraOffset();
|
|
|
|
return ( GetOutputSizePixel().Height() - GetTextHeight() ) / 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2002-04-29 16:46:18 +00:00
|
|
|
void Edit::ImplRepaint( xub_StrLen nStart, xub_StrLen nEnd, bool bLayout )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( !IsReallyVisible() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
XubString aText = ImplGetText();
|
2002-09-25 16:13:57 +00:00
|
|
|
nStart = 0;
|
|
|
|
nEnd = aText.Len();
|
|
|
|
|
2004-06-17 11:12:07 +00:00
|
|
|
sal_Int32 nDXBuffer[256];
|
|
|
|
sal_Int32* pDXBuffer = NULL;
|
|
|
|
sal_Int32* pDX = nDXBuffer;
|
2002-09-27 10:26:49 +00:00
|
|
|
|
|
|
|
if( aText.Len() )
|
2002-09-25 16:13:57 +00:00
|
|
|
{
|
2010-10-18 12:28:33 +02:00
|
|
|
if( 2*aText.Len() > xub_StrLen(SAL_N_ELEMENTS(nDXBuffer)) )
|
2002-09-27 10:26:49 +00:00
|
|
|
{
|
2004-06-17 11:12:07 +00:00
|
|
|
pDXBuffer = new sal_Int32[2*(aText.Len()+1)];
|
2002-09-27 10:26:49 +00:00
|
|
|
pDX = pDXBuffer;
|
|
|
|
}
|
2002-09-25 16:13:57 +00:00
|
|
|
|
2002-09-27 10:26:49 +00:00
|
|
|
GetCaretPositions( aText, pDX, nStart, nEnd );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2002-09-25 16:13:57 +00:00
|
|
|
long nTH = GetTextHeight();
|
2009-10-23 12:10:07 +02:00
|
|
|
Point aPos( mnXOffset, ImplGetTextYPosition() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2002-09-25 16:13:57 +00:00
|
|
|
if( bLayout )
|
|
|
|
{
|
|
|
|
long nPos = nStart ? pDX[2*nStart] : 0;
|
|
|
|
aPos.X() = nPos + mnXOffset + ImplGetExtraOffset();
|
|
|
|
|
2009-09-14 12:09:22 +00:00
|
|
|
MetricVector* pVector = &mpControlData->mpLayoutData->m_aUnicodeBoundRects;
|
|
|
|
String* pDisplayText = &mpControlData->mpLayoutData->m_aDisplayText;
|
2002-09-25 16:13:57 +00:00
|
|
|
|
|
|
|
DrawText( aPos, aText, nStart, nEnd - nStart, pVector, pDisplayText );
|
|
|
|
|
|
|
|
if( pDXBuffer )
|
2002-10-01 14:43:23 +00:00
|
|
|
delete [] pDXBuffer;
|
2002-09-25 16:13:57 +00:00
|
|
|
return;
|
|
|
|
}
|
2002-04-29 16:46:18 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
Cursor* pCursor = GetCursor();
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_Bool bVisCursor = pCursor ? pCursor->IsVisible() : sal_False;
|
2002-09-25 16:13:57 +00:00
|
|
|
if ( pCursor )
|
2000-09-18 16:07:07 +00:00
|
|
|
pCursor->Hide();
|
|
|
|
|
2005-11-01 09:31:53 +00:00
|
|
|
ImplClearBackground( 0, GetOutputSizePixel().Width() );
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
|
|
|
|
if ( IsEnabled() )
|
2010-09-29 15:46:40 +08:00
|
|
|
ImplInitSettings( sal_False, sal_True, sal_False );
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
SetTextColor( rStyleSettings.GetDisableColor() );
|
|
|
|
|
2008-07-17 10:29:01 +00:00
|
|
|
// Set background color of the normal text
|
|
|
|
if( (GetStyle() & WB_FORCECTRLBACKGROUND) != 0 && IsControlBackground() )
|
2007-04-26 09:36:22 +00:00
|
|
|
{
|
2008-07-17 10:29:01 +00:00
|
|
|
// check if we need to set ControlBackground even in NWF case
|
|
|
|
Push( PUSH_FILLCOLOR | PUSH_LINECOLOR );
|
|
|
|
SetLineColor();
|
|
|
|
SetFillColor( GetControlBackground() );
|
|
|
|
DrawRect( Rectangle( aPos, Size( GetOutputSizePixel().Width() - 2*mnXOffset, nTH ) ) );
|
|
|
|
Pop();
|
|
|
|
|
|
|
|
SetTextFillColor( GetControlBackground() );
|
2007-04-26 09:36:22 +00:00
|
|
|
}
|
2008-07-17 10:29:01 +00:00
|
|
|
else if( IsPaintTransparent() || ImplUseNativeBorder( GetStyle() ) )
|
|
|
|
SetTextFillColor();
|
|
|
|
else
|
|
|
|
SetTextFillColor( IsControlBackground() ? GetControlBackground() : rStyleSettings.GetFieldColor() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_Bool bDrawSelection = maSelection.Len() && ( HasFocus() || ( GetStyle() & WB_NOHIDESELECTION ) || mbActivePopup );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2002-09-25 16:13:57 +00:00
|
|
|
long nPos = nStart ? pDX[2*nStart] : 0;
|
|
|
|
aPos.X() = nPos + mnXOffset + ImplGetExtraOffset();
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !bDrawSelection && !mpIMEInfos )
|
|
|
|
{
|
2002-09-25 16:13:57 +00:00
|
|
|
DrawText( aPos, aText, nStart, nEnd - nStart );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-09-25 16:13:57 +00:00
|
|
|
// save graphics state
|
|
|
|
Push();
|
|
|
|
// first calculate higlighted and non highlighted clip regions
|
|
|
|
Region aHiglightClipRegion;
|
|
|
|
Region aNormalClipRegion;
|
2000-09-18 16:07:07 +00:00
|
|
|
Selection aTmpSel( maSelection );
|
|
|
|
aTmpSel.Justify();
|
2002-09-25 16:13:57 +00:00
|
|
|
// selection is highlighted
|
2004-02-04 13:42:05 +00:00
|
|
|
int i;
|
|
|
|
for( i = 0; i < aText.Len(); i++ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2002-09-25 16:13:57 +00:00
|
|
|
Rectangle aRect( aPos, Size( 10, nTH ) );
|
|
|
|
aRect.Left() = pDX[2*i] + mnXOffset + ImplGetExtraOffset();
|
|
|
|
aRect.Right() = pDX[2*i+1] + mnXOffset + ImplGetExtraOffset();
|
|
|
|
aRect.Justify();
|
|
|
|
bool bHighlight = false;
|
|
|
|
if( i >= aTmpSel.Min() && i < aTmpSel.Max() )
|
|
|
|
bHighlight = true;
|
|
|
|
|
|
|
|
if( mpIMEInfos && mpIMEInfos->pAttribs &&
|
|
|
|
i >= mpIMEInfos->nPos && i < (mpIMEInfos->nPos+mpIMEInfos->nLen ) &&
|
|
|
|
( mpIMEInfos->pAttribs[i-mpIMEInfos->nPos] & EXTTEXTINPUT_ATTR_HIGHLIGHT) )
|
|
|
|
bHighlight = true;
|
|
|
|
|
|
|
|
if( bHighlight )
|
|
|
|
aHiglightClipRegion.Union( aRect );
|
|
|
|
else
|
|
|
|
aNormalClipRegion.Union( aRect );
|
|
|
|
}
|
|
|
|
// draw normal text
|
2002-09-26 07:01:49 +00:00
|
|
|
Color aNormalTextColor = GetTextColor();
|
2002-09-25 16:13:57 +00:00
|
|
|
SetClipRegion( aNormalClipRegion );
|
2004-05-10 14:46:40 +00:00
|
|
|
|
2007-04-26 09:36:22 +00:00
|
|
|
if( IsPaintTransparent() )
|
2004-05-10 14:46:40 +00:00
|
|
|
SetTextFillColor();
|
|
|
|
else
|
2007-04-26 09:36:22 +00:00
|
|
|
{
|
|
|
|
// Set background color when part of the text is selected
|
|
|
|
if ( ImplUseNativeBorder( GetStyle() ) )
|
|
|
|
{
|
|
|
|
if( (GetStyle() & WB_FORCECTRLBACKGROUND) != 0 && IsControlBackground() )
|
|
|
|
SetTextFillColor( GetControlBackground() );
|
|
|
|
else
|
|
|
|
SetTextFillColor();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
SetTextFillColor( IsControlBackground() ? GetControlBackground() : rStyleSettings.GetFieldColor() );
|
|
|
|
}
|
2002-09-25 16:13:57 +00:00
|
|
|
DrawText( aPos, aText, nStart, nEnd - nStart );
|
2004-05-10 14:46:40 +00:00
|
|
|
|
2002-09-25 16:13:57 +00:00
|
|
|
// draw highlighted text
|
|
|
|
SetClipRegion( aHiglightClipRegion );
|
|
|
|
SetTextColor( rStyleSettings.GetHighlightTextColor() );
|
|
|
|
SetTextFillColor( rStyleSettings.GetHighlightColor() );
|
|
|
|
DrawText( aPos, aText, nStart, nEnd - nStart );
|
2002-09-26 07:01:49 +00:00
|
|
|
|
2002-09-25 16:13:57 +00:00
|
|
|
// if IME info exists loop over portions and output different font attributes
|
|
|
|
if( mpIMEInfos && mpIMEInfos->pAttribs )
|
|
|
|
{
|
|
|
|
for( int n = 0; n < 2; n++ )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2002-09-25 16:13:57 +00:00
|
|
|
Region aRegion;
|
|
|
|
if( n == 0 )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2002-09-26 07:01:49 +00:00
|
|
|
SetTextColor( aNormalTextColor );
|
2007-04-26 09:36:22 +00:00
|
|
|
if( IsPaintTransparent() )
|
|
|
|
SetTextFillColor();
|
|
|
|
else
|
|
|
|
SetTextFillColor( IsControlBackground() ? GetControlBackground() : rStyleSettings.GetFieldColor() );
|
2002-09-26 07:01:49 +00:00
|
|
|
aRegion = aNormalClipRegion;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2002-09-25 16:13:57 +00:00
|
|
|
else
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2002-09-26 07:01:49 +00:00
|
|
|
SetTextColor( rStyleSettings.GetHighlightTextColor() );
|
|
|
|
SetTextFillColor( rStyleSettings.GetHighlightColor() );
|
|
|
|
aRegion = aHiglightClipRegion;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2002-09-26 07:01:49 +00:00
|
|
|
for( i = 0; i < mpIMEInfos->nLen; )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 nAttr = mpIMEInfos->pAttribs[i];
|
2002-09-26 07:01:49 +00:00
|
|
|
Region aClip;
|
|
|
|
int nIndex = i;
|
2004-02-02 17:21:33 +00:00
|
|
|
while( nIndex < mpIMEInfos->nLen && mpIMEInfos->pAttribs[nIndex] == nAttr) // #112631# check nIndex before using it
|
2002-09-25 16:13:57 +00:00
|
|
|
{
|
2002-09-26 07:01:49 +00:00
|
|
|
Rectangle aRect( aPos, Size( 10, nTH ) );
|
|
|
|
aRect.Left() = pDX[2*(nIndex+mpIMEInfos->nPos)] + mnXOffset + ImplGetExtraOffset();
|
|
|
|
aRect.Right() = pDX[2*(nIndex+mpIMEInfos->nPos)+1] + mnXOffset + ImplGetExtraOffset();
|
|
|
|
aRect.Justify();
|
|
|
|
aClip.Union( aRect );
|
|
|
|
nIndex++;
|
|
|
|
}
|
|
|
|
i = nIndex;
|
|
|
|
if( aClip.Intersect( aRegion ) && nAttr )
|
|
|
|
{
|
|
|
|
Font aFont = GetFont();
|
|
|
|
if ( nAttr & EXTTEXTINPUT_ATTR_UNDERLINE )
|
|
|
|
aFont.SetUnderline( UNDERLINE_SINGLE );
|
|
|
|
else if ( nAttr & EXTTEXTINPUT_ATTR_BOLDUNDERLINE )
|
|
|
|
aFont.SetUnderline( UNDERLINE_BOLD );
|
|
|
|
else if ( nAttr & EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE )
|
|
|
|
aFont.SetUnderline( UNDERLINE_DOTTED );
|
|
|
|
else if ( nAttr & EXTTEXTINPUT_ATTR_DASHDOTUNDERLINE )
|
|
|
|
aFont.SetUnderline( UNDERLINE_DOTTED );
|
|
|
|
else if ( nAttr & EXTTEXTINPUT_ATTR_GRAYWAVELINE )
|
2002-09-25 16:13:57 +00:00
|
|
|
{
|
2002-09-26 07:01:49 +00:00
|
|
|
aFont.SetUnderline( UNDERLINE_WAVE );
|
|
|
|
SetTextLineColor( Color( COL_LIGHTGRAY ) );
|
2002-09-25 16:13:57 +00:00
|
|
|
}
|
2002-09-26 07:01:49 +00:00
|
|
|
SetFont( aFont );
|
|
|
|
|
|
|
|
if ( nAttr & EXTTEXTINPUT_ATTR_REDTEXT )
|
|
|
|
SetTextColor( Color( COL_RED ) );
|
|
|
|
else if ( nAttr & EXTTEXTINPUT_ATTR_HALFTONETEXT )
|
|
|
|
SetTextColor( Color( COL_LIGHTGRAY ) );
|
|
|
|
|
2002-09-25 16:13:57 +00:00
|
|
|
SetClipRegion( aClip );
|
|
|
|
DrawText( aPos, aText, nStart, nEnd - nStart );
|
|
|
|
}
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
2002-09-25 16:13:57 +00:00
|
|
|
|
|
|
|
// restore graphics state
|
|
|
|
Pop();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2002-09-25 16:13:57 +00:00
|
|
|
if ( bVisCursor && ( !mpIMEInfos || mpIMEInfos->bCursor ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
pCursor->Show();
|
2002-09-25 16:13:57 +00:00
|
|
|
|
|
|
|
if( pDXBuffer )
|
2002-10-01 14:43:23 +00:00
|
|
|
delete [] pDXBuffer;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
void Edit::ImplDelete( const Selection& rSelection, sal_uInt8 nDirection, sal_uInt8 nMode )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
XubString aText = ImplGetText();
|
|
|
|
|
|
|
|
// loeschen moeglich?
|
|
|
|
if ( !rSelection.Len() &&
|
|
|
|
(((rSelection.Min() == 0) && (nDirection == EDIT_DEL_LEFT)) ||
|
|
|
|
((rSelection.Max() == aText.Len()) && (nDirection == EDIT_DEL_RIGHT))) )
|
|
|
|
return;
|
|
|
|
|
2009-09-14 12:09:22 +00:00
|
|
|
ImplClearLayoutData();
|
2002-04-29 16:46:18 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
Selection aSelection( rSelection );
|
|
|
|
aSelection.Justify();
|
|
|
|
|
|
|
|
if ( !aSelection.Len() )
|
|
|
|
{
|
2000-11-20 11:39:41 +00:00
|
|
|
uno::Reference < i18n::XBreakIterator > xBI = ImplGetBreakIterator();
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( nDirection == EDIT_DEL_LEFT )
|
|
|
|
{
|
|
|
|
if ( nMode == EDIT_DELMODE_RESTOFWORD )
|
|
|
|
{
|
2000-11-20 16:52:32 +00:00
|
|
|
i18n::Boundary aBoundary = xBI->getWordBoundary( maText, aSelection.Min(), GetSettings().GetLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES, sal_True );
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( aBoundary.startPos == aSelection.Min() )
|
2000-11-20 16:52:32 +00:00
|
|
|
aBoundary = xBI->previousWord( maText, aSelection.Min(), GetSettings().GetLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES );
|
2000-09-18 16:07:07 +00:00
|
|
|
aSelection.Min() = aBoundary.startPos;
|
|
|
|
}
|
|
|
|
else if ( nMode == EDIT_DELMODE_RESTOFCONTENT )
|
|
|
|
{
|
|
|
|
aSelection.Min() = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sal_Int32 nCount = 1;
|
2000-11-20 16:52:32 +00:00
|
|
|
aSelection.Min() = xBI->previousCharacters( maText, aSelection.Min(), GetSettings().GetLocale(), i18n::CharacterIteratorMode::SKIPCHARACTER, nCount, nCount );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( nMode == EDIT_DELMODE_RESTOFWORD )
|
|
|
|
{
|
2000-11-20 16:52:32 +00:00
|
|
|
i18n::Boundary aBoundary = xBI->nextWord( maText, aSelection.Max(), GetSettings().GetLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES );
|
2000-09-18 16:07:07 +00:00
|
|
|
aSelection.Max() = aBoundary.startPos;
|
|
|
|
}
|
|
|
|
else if ( nMode == EDIT_DELMODE_RESTOFCONTENT )
|
|
|
|
{
|
|
|
|
aSelection.Max() = aText.Len();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sal_Int32 nCount = 1;
|
2000-11-20 16:52:32 +00:00
|
|
|
aSelection.Max() = xBI->nextCharacters( maText, aSelection.Max(), GetSettings().GetLocale(), i18n::CharacterIteratorMode::SKIPCHARACTER, nCount, nCount );;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
maText.Erase( (xub_StrLen)aSelection.Min(), (xub_StrLen)aSelection.Len() );
|
|
|
|
maSelection.Min() = aSelection.Min();
|
|
|
|
maSelection.Max() = aSelection.Min();
|
2006-06-19 18:16:09 +00:00
|
|
|
ImplAlignAndPaint();
|
2010-09-29 15:46:40 +08:00
|
|
|
mbInternModified = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2001-11-30 12:44:07 +00:00
|
|
|
String Edit::ImplGetValidString( const String& rString ) const
|
|
|
|
{
|
|
|
|
String aValidString( rString );
|
|
|
|
aValidString.EraseAllChars( _LF );
|
|
|
|
aValidString.EraseAllChars( _CR );
|
|
|
|
aValidString.SearchAndReplaceAll( '\t', ' ' );
|
|
|
|
return aValidString;
|
|
|
|
}
|
|
|
|
|
2006-03-14 08:42:11 +00:00
|
|
|
// -----------------------------------------------------------------------
|
2010-12-13 13:42:14 +01:00
|
|
|
uno::Reference < i18n::XBreakIterator > Edit::ImplGetBreakIterator() const
|
2006-03-14 08:42:11 +00:00
|
|
|
{
|
|
|
|
//!! since we don't want to become incompatible in the next minor update
|
|
|
|
//!! where this code will get integrated into, xISC will be a local
|
|
|
|
//!! variable instead of a class member!
|
2010-12-13 13:42:14 +01:00
|
|
|
uno::Reference < i18n::XBreakIterator > xBI;
|
2006-03-14 08:42:11 +00:00
|
|
|
// if ( !xBI.is() )
|
|
|
|
{
|
2010-12-13 13:42:14 +01:00
|
|
|
uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
|
Merge commit 'ooo/DEV300_m101' into intm101
The following builds for me:
basebmp, basegfx, comphelper, dtrans, i18npool, i18nutil, l10ntools, o3tl,
psprint_config, regexp, rsc, sax, sot, tools, ucbhelper, unotools, vcl
The rest still needs fixing ;-)
Conflicts:
canvas/prj/build.lst
canvas/source/cairo/cairo_textlayout.cxx
canvas/source/directx/dx_winstuff.hxx
canvas/source/tools/image.cxx
canvas/source/vcl/canvashelper.cxx
comphelper/inc/comphelper/documentconstants.hxx
comphelper/inc/comphelper/optionalvalue.hxx
comphelper/inc/comphelper/querydeep.hxx
comphelper/prj/build.lst
comphelper/qa/complex/makefile.mk
comphelper/qa/string/test_string_noadditional.cxx
comphelper/source/misc/componentmodule.cxx
comphelper/source/misc/mimeconfighelper.cxx
comphelper/source/misc/querydeep.cxx
comphelper/source/misc/uieventslogger.cxx
comphelper/source/property/TypeGeneration.cxx
comphelper/test/uno_iterators/uno_iterators.cxx
comphelper/util/makefile.mk
cppcanvas/source/mtfrenderer/implrenderer.cxx
dtrans/prj/build.lst
dtrans/source/generic/dtrans.cxx
dtrans/source/win32/dtobj/FmtFilter.cxx
i18npool/prj/build.lst
i18npool/source/localedata/data/localedata_others.map
i18npool/source/localedata/data/makefile.mk
i18npool/source/localedata/localedata.cxx
i18npool/source/localedata/saxparser.cxx
i18npool/source/registerservices/registerservices.cxx
i18npool/source/search/textsearch.cxx
l10ntools/inc/cfgmerge.hxx
l10ntools/inc/export.hxx
l10ntools/inc/gsicheck.hxx
l10ntools/inc/l10ntools/vosapp.hxx
l10ntools/inc/tagtest.hxx
l10ntools/inc/xmlparse.hxx
l10ntools/layout/layoutparse.cxx
l10ntools/layout/tralay.cxx
l10ntools/source/cfgmerge.cxx
l10ntools/source/export.cxx
l10ntools/source/export2.cxx
l10ntools/source/gsicheck.cxx
l10ntools/source/help/HelpLinker.cxx
l10ntools/source/lngex.cxx
l10ntools/source/lngmerge.cxx
l10ntools/source/merge.cxx
l10ntools/source/tagtest.cxx
l10ntools/source/xmlparse.cxx
padmin/source/fontentry.cxx
padmin/source/padialog.cxx
padmin/source/padialog.src
padmin/source/pamain.cxx
rsc/inc/rscarray.hxx
rsc/inc/rscclass.hxx
rsc/inc/rscclobj.hxx
rsc/inc/rsccont.hxx
rsc/inc/rscdb.hxx
rsc/inc/rscdef.hxx
rsc/inc/rscmgr.hxx
rsc/inc/rscrange.hxx
rsc/inc/rsctop.hxx
rsc/inc/vclrsc.hxx
rsc/source/parser/rscdb.cxx
rsc/source/parser/rscicpx.cxx
rsc/source/parser/rscinit.cxx
rsc/source/prj/start.cxx
rsc/source/res/rscarray.cxx
rsc/source/res/rscclass.cxx
rsc/source/res/rscclobj.cxx
rsc/source/res/rsccont.cxx
rsc/source/res/rscmgr.cxx
rsc/source/res/rscrange.cxx
rsc/source/res/rsctop.cxx
rsc/source/rsc/rsc.cxx
rsc/source/tools/rscdef.cxx
rsc/source/tools/rsctools.cxx
sax/source/expatwrap/sax_expat.cxx
sax/source/fastparser/facreg.cxx
sax/source/tools/fastserializer.cxx
sot/inc/sot/filelist.hxx
sot/inc/sot/object.hxx
sot/source/base/factory.cxx
sot/source/base/filelist.cxx
sot/source/sdstor/stg.cxx
sot/source/sdstor/stgcache.cxx
sot/source/sdstor/stgole.cxx
sot/source/sdstor/stgstrms.cxx
sot/source/sdstor/storage.cxx
sot/source/sdstor/ucbstorage.cxx
svl/inc/svl/cenumitm.hxx
svl/inc/svl/cintitem.hxx
svl/inc/svl/cntwall.hxx
svl/inc/svl/ctypeitm.hxx
svl/inc/svl/custritm.hxx
svl/inc/svl/dateitem.hxx
svl/inc/svl/filerec.hxx
svl/inc/svl/globalnameitem.hxx
svl/inc/svl/ilstitem.hxx
svl/inc/svl/imageitm.hxx
svl/inc/svl/intitem.hxx
svl/inc/svl/itempool.hxx
svl/inc/svl/itemset.hxx
svl/inc/svl/lckbitem.hxx
svl/inc/svl/poolitem.hxx
svl/inc/svl/ptitem.hxx
svl/inc/svl/rectitem.hxx
svl/inc/svl/sfontitm.hxx
svl/inc/svl/slstitm.hxx
svl/inc/svl/srchitem.hxx
svl/inc/svl/svarray.hxx
svl/inc/svl/svdde.hxx
svl/inc/svl/svstdarr.hxx
svl/inc/svl/szitem.hxx
svl/inc/svl/visitem.hxx
svl/inc/svl/zforlist.hxx
svl/inc/svl/zformat.hxx
svl/prj/build.lst
svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx
svl/qa/complex/ConfigItems/helper/makefile.mk
svl/qa/makefile.mk
svl/source/filepicker/pickerhelper.cxx
svl/source/filerec/filerec.cxx
svl/source/items/cenumitm.cxx
svl/source/items/cintitem.cxx
svl/source/items/cntwall.cxx
svl/source/items/ctypeitm.cxx
svl/source/items/custritm.cxx
svl/source/items/dateitem.cxx
svl/source/items/globalnameitem.cxx
svl/source/items/ilstitem.cxx
svl/source/items/imageitm.cxx
svl/source/items/intitem.cxx
svl/source/items/itempool.cxx
svl/source/items/itemprop.cxx
svl/source/items/itemset.cxx
svl/source/items/lckbitem.cxx
svl/source/items/poolio.cxx
svl/source/items/poolitem.cxx
svl/source/items/ptitem.cxx
svl/source/items/rectitem.cxx
svl/source/items/slstitm.cxx
svl/source/items/srchitem.cxx
svl/source/items/style.cxx
svl/source/items/szitem.cxx
svl/source/items/visitem.cxx
svl/source/items/whiter.cxx
svl/source/memtools/svarray.cxx
svl/source/misc/PasswordHelper.cxx
svl/source/misc/adrparse.cxx
svl/source/misc/lngmisc.cxx
svl/source/notify/brdcst.cxx
svl/source/notify/listener.cxx
svl/source/notify/listenerbase.cxx
svl/source/numbers/makefile.mk
svl/source/numbers/nbdll.cxx
svl/source/numbers/zforfind.cxx
svl/source/numbers/zforlist.cxx
svl/source/numbers/zformat.cxx
svl/source/numbers/zforscan.cxx
svl/source/passwordcontainer/passwordcontainer.cxx
svl/source/svdde/ddecli.cxx
svl/source/svdde/ddeimp.hxx
svl/source/svdde/ddemlos2.h
svl/source/svdde/ddesvr.cxx
svl/source/undo/undo.cxx
svl/source/uno/registerservices.cxx
svl/util/makefile.mk
svtools/bmpmaker/bmpsum.cxx
svtools/bmpmaker/g2g.cxx
svtools/bmpmaker/makefile.mk
svtools/inc/borderhelper.hxx
svtools/inc/svtools/accessiblefactory.hxx
svtools/inc/svtools/apearcfg.hxx
svtools/inc/svtools/brwbox.hxx
svtools/inc/svtools/ctrlbox.hxx
svtools/inc/svtools/ctrltool.hxx
svtools/inc/svtools/editbrowsebox.hxx
svtools/inc/svtools/ehdl.hxx
svtools/inc/svtools/embedhlp.hxx
svtools/inc/svtools/filter.hxx
svtools/inc/svtools/ivctrl.hxx
svtools/inc/svtools/parhtml.hxx
svtools/inc/svtools/printdlg.hxx
svtools/inc/svtools/rtftoken.h
svtools/inc/svtools/ruler.hxx
svtools/inc/svtools/svicnvw.hxx
svtools/inc/svtools/svlbitm.hxx
svtools/inc/svtools/svlbox.hxx
svtools/inc/svtools/svtreebx.hxx
svtools/inc/svtools/tabbar.hxx
svtools/inc/svtools/table/abstracttablecontrol.hxx
svtools/inc/svtools/taskbar.hxx
svtools/inc/svtools/textview.hxx
svtools/inc/svtools/valueset.hxx
svtools/source/brwbox/brwbox1.cxx
svtools/source/brwbox/brwbox2.cxx
svtools/source/brwbox/datwin.cxx
svtools/source/brwbox/datwin.hxx
svtools/source/brwbox/makefile.mk
svtools/source/config/apearcfg.cxx
svtools/source/config/htmlcfg.cxx
svtools/source/config/menuoptions.cxx
svtools/source/config/miscopt.cxx
svtools/source/contnr/cont_pch.cxx
svtools/source/contnr/ctrdll.cxx
svtools/source/contnr/fileview.cxx
svtools/source/contnr/imivctl1.cxx
svtools/source/contnr/ivctrl.cxx
svtools/source/contnr/makefile.mk
svtools/source/contnr/svcontnr.src
svtools/source/contnr/svicnvw.cxx
svtools/source/contnr/svimpbox.cxx
svtools/source/contnr/svimpicn.cxx
svtools/source/contnr/svlbitm.cxx
svtools/source/contnr/svtreebx.cxx
svtools/source/contnr/templwin.cxx
svtools/source/contnr/templwin.hxx
svtools/source/control/asynclink.cxx
svtools/source/control/ctrlbox.cxx
svtools/source/control/ctrldll.cxx
svtools/source/control/ctrltool.cxx
svtools/source/control/filectrl.cxx
svtools/source/control/filectrl.src
svtools/source/control/headbar.cxx
svtools/source/control/inettbc.cxx
svtools/source/control/makefile.mk
svtools/source/control/prgsbar.cxx
svtools/source/control/roadmap.cxx
svtools/source/control/ruler.cxx
svtools/source/control/scriptedtext.cxx
svtools/source/control/stdmenu.cxx
svtools/source/control/tabbar.cxx
svtools/source/control/taskbar.cxx
svtools/source/control/taskbox.cxx
svtools/source/control/taskmisc.cxx
svtools/source/control/taskstat.cxx
svtools/source/control/valueacc.cxx
svtools/source/control/valueset.cxx
svtools/source/dialogs/addresstemplate.cxx
svtools/source/dialogs/addresstemplate.src
svtools/source/dialogs/colrdlg.src
svtools/source/dialogs/filedlg2.cxx
svtools/source/dialogs/filedlg2.hxx
svtools/source/dialogs/makefile.mk
svtools/source/dialogs/printdlg.cxx
svtools/source/dialogs/printdlg.src
svtools/source/dialogs/propctrl.cxx
svtools/source/dialogs/propctrl.hxx
svtools/source/dialogs/property.cxx
svtools/source/edit/makefile.mk
svtools/source/edit/sychconv.cxx
svtools/source/edit/syntaxhighlight.cxx
svtools/source/edit/textdoc.cxx
svtools/source/edit/texteng.cxx
svtools/source/edit/textundo.cxx
svtools/source/edit/textview.cxx
svtools/source/filter.vcl/filter/SvFilterOptionsDialog.cxx
svtools/source/filter.vcl/filter/dlgejpg.cxx
svtools/source/filter.vcl/filter/dlgejpg.hxx
svtools/source/filter.vcl/filter/dlgejpg.src
svtools/source/filter.vcl/filter/dlgepng.cxx
svtools/source/filter.vcl/filter/dlgepng.hxx
svtools/source/filter.vcl/filter/dlgepng.src
svtools/source/filter.vcl/filter/dlgexpor.cxx
svtools/source/filter.vcl/filter/dlgexpor.hxx
svtools/source/filter.vcl/filter/dlgexpor.src
svtools/source/filter.vcl/filter/filter2.cxx
svtools/source/filter.vcl/filter/makefile.mk
svtools/source/filter.vcl/filter/sgfbram.cxx
svtools/source/filter.vcl/filter/sgvmain.cxx
svtools/source/filter.vcl/filter/sgvspln.cxx
svtools/source/filter.vcl/filter/strings.src
svtools/source/filter.vcl/jpeg/makefile.mk
svtools/source/filter.vcl/wmf/emfwr.cxx
svtools/source/filter.vcl/wmf/emfwr.hxx
svtools/source/filter.vcl/wmf/enhwmf.cxx
svtools/source/filter.vcl/wmf/winmtf.hxx
svtools/source/filter.vcl/wmf/wmfwr.cxx
svtools/source/filter.vcl/wmf/wmfwr.hxx
svtools/source/graphic/grfcache.cxx
svtools/source/graphic/grfcache.hxx
svtools/source/graphic/grfmgr.cxx
svtools/source/graphic/makefile.mk
svtools/source/inc/accessibletableimp.hxx
svtools/source/inc/svimpbox.hxx
svtools/source/java/patchjavaerror.src
svtools/source/misc/ehdl.cxx
svtools/source/misc/errtxt.src
svtools/source/misc/helpagentwindow.cxx
svtools/source/misc/imagemgr.cxx
svtools/source/misc/imagemgr.src
svtools/source/misc/imageresourceaccess.cxx
svtools/source/misc/imap.cxx
svtools/source/misc/langtab.src
svtools/source/misc/makefile.mk
svtools/source/misc/svtdata.cxx
svtools/source/misc/templatefoldercache.cxx
svtools/source/misc/transfer2.cxx
svtools/source/misc/undo.src
svtools/source/plugapp/commtest.cxx
svtools/source/plugapp/commtest.src
svtools/source/plugapp/makefile.mk
svtools/source/plugapp/testtool.src
svtools/source/productregistration/productregistration.cxx
svtools/source/svhtml/htmlkywd.cxx
svtools/source/svhtml/parhtml.cxx
svtools/source/svrtf/rtfkey2.cxx
svtools/source/svrtf/rtfkeywd.cxx
svtools/source/table/defaultinputhandler.cxx
svtools/source/table/makefile.mk
svtools/source/table/tablecontrol.cxx
svtools/source/table/tablecontrol_impl.cxx
svtools/source/table/tablecontrol_impl.hxx
svtools/source/table/tabledatawindow.cxx
svtools/source/table/tablegeometry.cxx
svtools/source/table/tablegeometry.hxx
svtools/source/toolpanel/makefile.mk
svtools/source/toolpanel/toolpaneldrawer.cxx
svtools/source/uno/addrtempuno.cxx
svtools/source/uno/miscservices.cxx
svtools/source/uno/svtxgridcontrol.cxx
svtools/source/uno/svtxgridcontrol.hxx
svtools/source/uno/toolboxcontroller.cxx
svtools/source/uno/treecontrolpeer.cxx
svtools/source/uno/unocontroltablemodel.cxx
svtools/source/uno/unocontroltablemodel.hxx
svtools/source/uno/unoimap.cxx
svtools/source/urlobj/inetimg.cxx
svtools/util/makefile.mk
svtools/workben/browser.cxx
svtools/workben/cui/makefile.mk
svtools/workben/makefile.mk
svtools/workben/stest.cxx
svtools/workben/toolpanel/makefile.mk
svtools/workben/urange.cxx
toolkit/inc/toolkit/awt/vclxdevice.hxx
toolkit/inc/toolkit/awt/vclxgraphics.hxx
toolkit/inc/toolkit/awt/vclxwindows.hxx
toolkit/inc/toolkit/controls/dialogcontrol.hxx
toolkit/inc/toolkit/helper/property.hxx
toolkit/inc/toolkit/helper/servicenames.hxx
toolkit/inc/toolkit/helper/throbberimpl.hxx
toolkit/qa/complex/toolkit/accessibility/_XAccessibleComponent.java
toolkit/source/awt/asynccallback.cxx
toolkit/source/awt/vclxgraphics.cxx
toolkit/source/awt/vclxtoolkit.cxx
toolkit/source/awt/vclxwindow.cxx
toolkit/source/awt/xsimpleanimation.cxx
toolkit/source/awt/xthrobber.cxx
toolkit/source/controls/dialogcontrol.cxx
toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
toolkit/source/controls/grid/defaultgriddatamodel.cxx
toolkit/source/controls/grid/gridcontrol.cxx
toolkit/source/controls/grid/initguard.hxx
toolkit/source/controls/unocontrol.cxx
toolkit/source/controls/unocontrolcontainer.cxx
toolkit/source/controls/unocontrols.cxx
toolkit/source/helper/listenermultiplexer.cxx
toolkit/source/helper/property.cxx
toolkit/source/helper/registerservices.cxx
toolkit/source/helper/servicenames.cxx
toolkit/source/helper/throbberimpl.cxx
toolkit/source/helper/tkresmgr.cxx
tools/StaticLibrary_ooopathutils.mk
tools/bootstrp/addexes/makefile.mk
tools/bootstrp/addexes2/makefile.mk
tools/bootstrp/addexes2/mkfilt.cxx
tools/bootstrp/command.cxx
tools/bootstrp/cppdep.cxx
tools/bootstrp/iserver.cxx
tools/bootstrp/makefile.mk
tools/bootstrp/mkcreate.cxx
tools/bootstrp/prj.cxx
tools/bootstrp/rscdep.cxx
tools/bootstrp/sstring.cxx
tools/inc/bootstrp/command.hxx
tools/inc/bootstrp/mkcreate.hxx
tools/inc/bootstrp/prj.hxx
tools/inc/bootstrp/sstring.hxx
tools/inc/tools/agapi.hxx
tools/inc/tools/agitem.hxx
tools/inc/tools/chapi.hxx
tools/inc/tools/download.hxx
tools/inc/tools/eacopier.hxx
tools/inc/tools/fract.hxx
tools/inc/tools/fsys.hxx
tools/inc/tools/geninfo.hxx
tools/inc/tools/globname.hxx
tools/inc/tools/inetmime.hxx
tools/inc/tools/multisel.hxx
tools/inc/tools/poly.hxx
tools/inc/tools/postsys.h
tools/inc/tools/postwin.h
tools/inc/tools/presys.h
tools/inc/tools/prewin.h
tools/inc/tools/pstm.hxx
tools/inc/tools/ref.hxx
tools/inc/tools/simplerm.hxx
tools/inc/tools/solar.h
tools/inc/tools/table.hxx
tools/inc/tools/urlkeys.hxx
tools/inc/tools/urlobj.hxx
tools/prj/build.lst
tools/prj/d.lst
tools/qa/makefile.mk
tools/source/communi/geninfo.cxx
tools/source/debug/debug.cxx
tools/source/fsys/dirent.cxx
tools/source/fsys/tdir.cxx
tools/source/fsys/unx.cxx
tools/source/fsys/urlobj.cxx
tools/source/generic/color.cxx
tools/source/generic/config.cxx
tools/source/generic/fract.cxx
tools/source/inet/inetmime.cxx
tools/source/memtools/multisel.cxx
tools/source/memtools/table.cxx
tools/source/rc/resmgr.cxx
tools/source/ref/globname.cxx
tools/source/ref/pstm.cxx
tools/source/solar/solar.c
tools/source/stream/strmos2.cxx
tools/source/stream/strmunx.cxx
tools/source/stream/strmwnt.cxx
tools/source/string/makefile.mk
tools/source/testtoolloader/testtoolloader.cxx
tools/test/makefile.mk
tools/util/makefile.mk
tools/win/inc/dll.hxx
tools/win/inc/parser.hxx
tools/win/inc/shellex.h
tools/win/inc/shutil.h
tools/win/inc/toolsdll.hxx
tools/win/inc/winshell.hxx
tools/workben/makefile.mk
ucbhelper/source/client/proxydecider.cxx
ucbhelper/workben/ucbexplorer/ucbexplorer.hrc
unotools/inc/unotools/unotunnelhelper.hxx
unotools/source/config/fltrcfg.cxx
unotools/source/config/lingucfg.cxx
unotools/source/config/misccfg.cxx
unotools/source/config/pathoptions.cxx
unotools/source/config/searchopt.cxx
unotools/source/i18n/localedatawrapper.cxx
unotools/source/ucbhelper/localfilehelper.cxx
unotools/source/ucbhelper/ucbhelper.cxx
unotools/source/ucbhelper/xtempfile.cxx
vcl/aqua/inc/salbmp.h
vcl/aqua/inc/salgdi.h
vcl/aqua/inc/salinst.h
vcl/aqua/source/app/salinst.cxx
vcl/aqua/source/gdi/aquaprintaccessoryview.mm
vcl/aqua/source/gdi/salgdi.cxx
vcl/aqua/source/gdi/salprn.cxx
vcl/aqua/source/window/salframeview.mm
vcl/aqua/source/window/salobj.cxx
vcl/inc/vcl/bitmap.hxx
vcl/inc/vcl/brdwin.hxx
vcl/inc/vcl/button.hxx
vcl/inc/vcl/cmdevt.hxx
vcl/inc/vcl/cvtgrf.hxx
vcl/inc/vcl/dialog.hxx
vcl/inc/vcl/dockwin.hxx
vcl/inc/vcl/event.hxx
vcl/inc/vcl/fixed.hxx
vcl/inc/vcl/fldunit.hxx
vcl/inc/vcl/floatwin.hxx
vcl/inc/vcl/gdimtf.hxx
vcl/inc/vcl/glyphcache.hxx
vcl/inc/vcl/graphite_adaptors.hxx
vcl/inc/vcl/graphite_features.hxx
vcl/inc/vcl/graphite_layout.hxx
vcl/inc/vcl/ilstbox.hxx
vcl/inc/vcl/image.h
vcl/inc/vcl/imgctrl.hxx
vcl/inc/vcl/impbmpconv.hxx
vcl/inc/vcl/impprn.hxx
vcl/inc/vcl/jobset.h
vcl/inc/vcl/keycodes.hxx
vcl/inc/vcl/lstbox.hxx
vcl/inc/vcl/mapunit.hxx
vcl/inc/vcl/menu.hxx
vcl/inc/vcl/msgbox.hxx
vcl/inc/vcl/outdev.hxx
vcl/inc/vcl/prndlg.hxx
vcl/inc/vcl/salatype.hxx
vcl/inc/vcl/salbmp.hxx
vcl/inc/vcl/salgdi.hxx
vcl/inc/vcl/salinst.hxx
vcl/inc/vcl/seleng.hxx
vcl/inc/vcl/settings.hxx
vcl/inc/vcl/smartid.hxx
vcl/inc/vcl/status.hxx
vcl/inc/vcl/strhelper.hxx
vcl/inc/vcl/svapp.hxx
vcl/inc/vcl/svdata.hxx
vcl/inc/vcl/syschild.hxx
vcl/inc/vcl/sysdata.hxx
vcl/inc/vcl/taskpanelist.hxx
vcl/inc/vcl/toolbox.hxx
vcl/inc/vcl/vclevent.hxx
vcl/inc/vcl/windata.hxx
vcl/inc/vcl/window.hxx
vcl/inc/vcl/wintypes.hxx
vcl/os2/source/app/salinst.cxx
vcl/os2/source/gdi/salgdi.cxx
vcl/os2/source/window/salmenu.cxx
vcl/os2/source/window/salobj.cxx
vcl/prj/build.lst
vcl/source/app/dbggui.cxx
vcl/source/app/help.cxx
vcl/source/app/idlemgr.cxx
vcl/source/app/settings.cxx
vcl/source/app/svapp.cxx
vcl/source/app/svdata.cxx
vcl/source/app/svmain.cxx
vcl/source/app/svmainhook.cxx
vcl/source/app/unohelp.cxx
vcl/source/app/vclevent.cxx
vcl/source/control/button.cxx
vcl/source/control/combobox.cxx
vcl/source/control/edit.cxx
vcl/source/control/field.cxx
vcl/source/control/fixed.cxx
vcl/source/control/ilstbox.cxx
vcl/source/control/imgctrl.cxx
vcl/source/control/makefile.mk
vcl/source/control/tabctrl.cxx
vcl/source/gdi/bitmap.cxx
vcl/source/gdi/bitmap2.cxx
vcl/source/gdi/bitmap4.cxx
vcl/source/gdi/bmpconv.cxx
vcl/source/gdi/cvtsvm.cxx
vcl/source/gdi/font.cxx
vcl/source/gdi/gdimtf.cxx
vcl/source/gdi/image.cxx
vcl/source/gdi/impimage.cxx
vcl/source/gdi/jobset.cxx
vcl/source/gdi/makefile.mk
vcl/source/gdi/metaact.cxx
vcl/source/gdi/outdev.cxx
vcl/source/gdi/outdev3.cxx
vcl/source/gdi/outdev4.cxx
vcl/source/gdi/outdevnative.cxx
vcl/source/gdi/pdfwriter.cxx
vcl/source/gdi/pdfwriter_impl.cxx
vcl/source/gdi/print3.cxx
vcl/source/gdi/salmisc.cxx
vcl/source/glyphs/gcach_ftyp.cxx
vcl/source/glyphs/gcach_ftyp.hxx
vcl/source/glyphs/glyphcache.cxx
vcl/source/glyphs/graphite_cache.cxx
vcl/source/glyphs/graphite_layout.cxx
vcl/source/glyphs/graphite_textsrc.hxx
vcl/source/helper/canvasbitmap.cxx
vcl/source/helper/smartid.cxx
vcl/source/helper/xconnection.cxx
vcl/source/src/btntext.src
vcl/source/src/images.src
vcl/source/src/print.src
vcl/source/window/accel.cxx
vcl/source/window/accmgr.cxx
vcl/source/window/brdwin.cxx
vcl/source/window/btndlg.cxx
vcl/source/window/dlgctrl.cxx
vcl/source/window/javachild.cxx
vcl/source/window/menu.cxx
vcl/source/window/msgbox.cxx
vcl/source/window/printdlg.cxx
vcl/source/window/status.cxx
vcl/source/window/syschild.cxx
vcl/source/window/toolbox.cxx
vcl/source/window/toolbox2.cxx
vcl/source/window/window.cxx
vcl/source/window/window2.cxx
vcl/source/window/wrkwin.cxx
vcl/unx/gtk/app/gtkdata.cxx
vcl/unx/gtk/app/gtkinst.cxx
vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
vcl/unx/gtk/window/gtkframe.cxx
vcl/unx/gtk/window/gtkobject.cxx
vcl/unx/headless/svpbmp.hxx
vcl/unx/headless/svpgdi.cxx
vcl/unx/headless/svpgdi.hxx
vcl/unx/headless/svpinst.cxx
vcl/unx/headless/svpinst.hxx
vcl/unx/headless/svpprn.cxx
vcl/unx/headless/svpprn.hxx
vcl/unx/headless/svppspgraphics.cxx
vcl/unx/headless/svppspgraphics.hxx
vcl/unx/headless/svptext.cxx
vcl/unx/inc/dtint.hxx
vcl/unx/inc/plugins/gtk/gtkdata.hxx
vcl/unx/inc/pspgraphics.h
vcl/unx/inc/salbmp.h
vcl/unx/inc/saldata.hxx
vcl/unx/inc/saldisp.hxx
vcl/unx/inc/salgdi.h
vcl/unx/inc/salinst.h
vcl/unx/inc/xfont.hxx
vcl/unx/kde/kdedata.cxx
vcl/unx/kde4/KDESalGraphics.cxx
vcl/unx/source/app/keysymnames.cxx
vcl/unx/source/app/saldata.cxx
vcl/unx/source/app/saldisp.cxx
vcl/unx/source/app/salinst.cxx
vcl/unx/source/app/wmadaptor.cxx
vcl/unx/source/dtrans/X11_selection.cxx
vcl/unx/source/dtrans/X11_service.cxx
vcl/unx/source/gdi/makefile.mk
vcl/unx/source/gdi/pspgraphics.cxx
vcl/unx/source/gdi/salgdi.cxx
vcl/unx/source/gdi/salgdi3.cxx
vcl/unx/source/gdi/salprnpsp.cxx
vcl/unx/source/gdi/xfont.cxx
vcl/unx/source/gdi/xlfd_attr.cxx
vcl/unx/source/gdi/xlfd_attr.hxx
vcl/unx/source/gdi/xlfd_extd.cxx
vcl/unx/source/gdi/xlfd_extd.hxx
vcl/unx/source/gdi/xlfd_smpl.cxx
vcl/unx/source/gdi/xlfd_smpl.hxx
vcl/unx/source/printer/ppdparser.cxx
vcl/unx/source/printer/printerinfomanager.cxx
vcl/unx/source/window/salframe.cxx
vcl/unx/source/window/salmenu.cxx
vcl/unx/source/window/salobj.cxx
vcl/util/makefile2.pmk
vcl/win/inc/salbmp.h
vcl/win/inc/saldata.hxx
vcl/win/inc/salgdi.h
vcl/win/inc/salinst.h
vcl/win/source/app/saldata.cxx
vcl/win/source/app/salinst.cxx
vcl/win/source/gdi/salgdi.cxx
vcl/win/source/gdi/salgdi3.cxx
vcl/win/source/gdi/salprn.cxx
vcl/win/source/gdi/winlayout.cxx
vcl/win/source/window/salframe.cxx
vcl/win/source/window/salobj.cxx
vcl/workben/outdevgrind.cxx
vos/inc/vos/execabl.hxx
vos/inc/vos/macros.hxx
vos/inc/vos/pipe.hxx
vos/inc/vos/process.hxx
vos/inc/vos/refernce.hxx
vos/inc/vos/signal.hxx
vos/inc/vos/socket.hxx
vos/inc/vos/stream.hxx
vos/inc/vos/thread.hxx
vos/source/pipe.cxx
vos/source/process.cxx
vos/source/signal.cxx
vos/source/thread.cxx
vos/source/timer.cxx
2011-03-11 14:24:23 +01:00
|
|
|
uno::Reference < XInterface > xI = xMSF->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.BreakIterator")) );
|
2006-03-14 08:42:11 +00:00
|
|
|
if ( xI.is() )
|
|
|
|
{
|
2010-12-13 13:42:14 +01:00
|
|
|
Any x = xI->queryInterface( ::getCppuType((const uno::Reference< i18n::XBreakIterator >*)0) );
|
2006-03-14 08:42:11 +00:00
|
|
|
x >>= xBI;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return xBI;
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-12-13 13:42:14 +01:00
|
|
|
uno::Reference < i18n::XExtendedInputSequenceChecker > Edit::ImplGetInputSequenceChecker() const
|
2006-03-14 08:42:11 +00:00
|
|
|
{
|
|
|
|
//!! since we don't want to become incompatible in the next minor update
|
|
|
|
//!! where this code will get integrated into, xISC will be a local
|
|
|
|
//!! variable instead of a class member!
|
2010-12-13 13:42:14 +01:00
|
|
|
uno::Reference < i18n::XExtendedInputSequenceChecker > xISC;
|
2006-03-14 08:42:11 +00:00
|
|
|
// if ( !xISC.is() )
|
|
|
|
{
|
2010-12-13 13:42:14 +01:00
|
|
|
uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
|
Merge commit 'ooo/DEV300_m101' into intm101
The following builds for me:
basebmp, basegfx, comphelper, dtrans, i18npool, i18nutil, l10ntools, o3tl,
psprint_config, regexp, rsc, sax, sot, tools, ucbhelper, unotools, vcl
The rest still needs fixing ;-)
Conflicts:
canvas/prj/build.lst
canvas/source/cairo/cairo_textlayout.cxx
canvas/source/directx/dx_winstuff.hxx
canvas/source/tools/image.cxx
canvas/source/vcl/canvashelper.cxx
comphelper/inc/comphelper/documentconstants.hxx
comphelper/inc/comphelper/optionalvalue.hxx
comphelper/inc/comphelper/querydeep.hxx
comphelper/prj/build.lst
comphelper/qa/complex/makefile.mk
comphelper/qa/string/test_string_noadditional.cxx
comphelper/source/misc/componentmodule.cxx
comphelper/source/misc/mimeconfighelper.cxx
comphelper/source/misc/querydeep.cxx
comphelper/source/misc/uieventslogger.cxx
comphelper/source/property/TypeGeneration.cxx
comphelper/test/uno_iterators/uno_iterators.cxx
comphelper/util/makefile.mk
cppcanvas/source/mtfrenderer/implrenderer.cxx
dtrans/prj/build.lst
dtrans/source/generic/dtrans.cxx
dtrans/source/win32/dtobj/FmtFilter.cxx
i18npool/prj/build.lst
i18npool/source/localedata/data/localedata_others.map
i18npool/source/localedata/data/makefile.mk
i18npool/source/localedata/localedata.cxx
i18npool/source/localedata/saxparser.cxx
i18npool/source/registerservices/registerservices.cxx
i18npool/source/search/textsearch.cxx
l10ntools/inc/cfgmerge.hxx
l10ntools/inc/export.hxx
l10ntools/inc/gsicheck.hxx
l10ntools/inc/l10ntools/vosapp.hxx
l10ntools/inc/tagtest.hxx
l10ntools/inc/xmlparse.hxx
l10ntools/layout/layoutparse.cxx
l10ntools/layout/tralay.cxx
l10ntools/source/cfgmerge.cxx
l10ntools/source/export.cxx
l10ntools/source/export2.cxx
l10ntools/source/gsicheck.cxx
l10ntools/source/help/HelpLinker.cxx
l10ntools/source/lngex.cxx
l10ntools/source/lngmerge.cxx
l10ntools/source/merge.cxx
l10ntools/source/tagtest.cxx
l10ntools/source/xmlparse.cxx
padmin/source/fontentry.cxx
padmin/source/padialog.cxx
padmin/source/padialog.src
padmin/source/pamain.cxx
rsc/inc/rscarray.hxx
rsc/inc/rscclass.hxx
rsc/inc/rscclobj.hxx
rsc/inc/rsccont.hxx
rsc/inc/rscdb.hxx
rsc/inc/rscdef.hxx
rsc/inc/rscmgr.hxx
rsc/inc/rscrange.hxx
rsc/inc/rsctop.hxx
rsc/inc/vclrsc.hxx
rsc/source/parser/rscdb.cxx
rsc/source/parser/rscicpx.cxx
rsc/source/parser/rscinit.cxx
rsc/source/prj/start.cxx
rsc/source/res/rscarray.cxx
rsc/source/res/rscclass.cxx
rsc/source/res/rscclobj.cxx
rsc/source/res/rsccont.cxx
rsc/source/res/rscmgr.cxx
rsc/source/res/rscrange.cxx
rsc/source/res/rsctop.cxx
rsc/source/rsc/rsc.cxx
rsc/source/tools/rscdef.cxx
rsc/source/tools/rsctools.cxx
sax/source/expatwrap/sax_expat.cxx
sax/source/fastparser/facreg.cxx
sax/source/tools/fastserializer.cxx
sot/inc/sot/filelist.hxx
sot/inc/sot/object.hxx
sot/source/base/factory.cxx
sot/source/base/filelist.cxx
sot/source/sdstor/stg.cxx
sot/source/sdstor/stgcache.cxx
sot/source/sdstor/stgole.cxx
sot/source/sdstor/stgstrms.cxx
sot/source/sdstor/storage.cxx
sot/source/sdstor/ucbstorage.cxx
svl/inc/svl/cenumitm.hxx
svl/inc/svl/cintitem.hxx
svl/inc/svl/cntwall.hxx
svl/inc/svl/ctypeitm.hxx
svl/inc/svl/custritm.hxx
svl/inc/svl/dateitem.hxx
svl/inc/svl/filerec.hxx
svl/inc/svl/globalnameitem.hxx
svl/inc/svl/ilstitem.hxx
svl/inc/svl/imageitm.hxx
svl/inc/svl/intitem.hxx
svl/inc/svl/itempool.hxx
svl/inc/svl/itemset.hxx
svl/inc/svl/lckbitem.hxx
svl/inc/svl/poolitem.hxx
svl/inc/svl/ptitem.hxx
svl/inc/svl/rectitem.hxx
svl/inc/svl/sfontitm.hxx
svl/inc/svl/slstitm.hxx
svl/inc/svl/srchitem.hxx
svl/inc/svl/svarray.hxx
svl/inc/svl/svdde.hxx
svl/inc/svl/svstdarr.hxx
svl/inc/svl/szitem.hxx
svl/inc/svl/visitem.hxx
svl/inc/svl/zforlist.hxx
svl/inc/svl/zformat.hxx
svl/prj/build.lst
svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx
svl/qa/complex/ConfigItems/helper/makefile.mk
svl/qa/makefile.mk
svl/source/filepicker/pickerhelper.cxx
svl/source/filerec/filerec.cxx
svl/source/items/cenumitm.cxx
svl/source/items/cintitem.cxx
svl/source/items/cntwall.cxx
svl/source/items/ctypeitm.cxx
svl/source/items/custritm.cxx
svl/source/items/dateitem.cxx
svl/source/items/globalnameitem.cxx
svl/source/items/ilstitem.cxx
svl/source/items/imageitm.cxx
svl/source/items/intitem.cxx
svl/source/items/itempool.cxx
svl/source/items/itemprop.cxx
svl/source/items/itemset.cxx
svl/source/items/lckbitem.cxx
svl/source/items/poolio.cxx
svl/source/items/poolitem.cxx
svl/source/items/ptitem.cxx
svl/source/items/rectitem.cxx
svl/source/items/slstitm.cxx
svl/source/items/srchitem.cxx
svl/source/items/style.cxx
svl/source/items/szitem.cxx
svl/source/items/visitem.cxx
svl/source/items/whiter.cxx
svl/source/memtools/svarray.cxx
svl/source/misc/PasswordHelper.cxx
svl/source/misc/adrparse.cxx
svl/source/misc/lngmisc.cxx
svl/source/notify/brdcst.cxx
svl/source/notify/listener.cxx
svl/source/notify/listenerbase.cxx
svl/source/numbers/makefile.mk
svl/source/numbers/nbdll.cxx
svl/source/numbers/zforfind.cxx
svl/source/numbers/zforlist.cxx
svl/source/numbers/zformat.cxx
svl/source/numbers/zforscan.cxx
svl/source/passwordcontainer/passwordcontainer.cxx
svl/source/svdde/ddecli.cxx
svl/source/svdde/ddeimp.hxx
svl/source/svdde/ddemlos2.h
svl/source/svdde/ddesvr.cxx
svl/source/undo/undo.cxx
svl/source/uno/registerservices.cxx
svl/util/makefile.mk
svtools/bmpmaker/bmpsum.cxx
svtools/bmpmaker/g2g.cxx
svtools/bmpmaker/makefile.mk
svtools/inc/borderhelper.hxx
svtools/inc/svtools/accessiblefactory.hxx
svtools/inc/svtools/apearcfg.hxx
svtools/inc/svtools/brwbox.hxx
svtools/inc/svtools/ctrlbox.hxx
svtools/inc/svtools/ctrltool.hxx
svtools/inc/svtools/editbrowsebox.hxx
svtools/inc/svtools/ehdl.hxx
svtools/inc/svtools/embedhlp.hxx
svtools/inc/svtools/filter.hxx
svtools/inc/svtools/ivctrl.hxx
svtools/inc/svtools/parhtml.hxx
svtools/inc/svtools/printdlg.hxx
svtools/inc/svtools/rtftoken.h
svtools/inc/svtools/ruler.hxx
svtools/inc/svtools/svicnvw.hxx
svtools/inc/svtools/svlbitm.hxx
svtools/inc/svtools/svlbox.hxx
svtools/inc/svtools/svtreebx.hxx
svtools/inc/svtools/tabbar.hxx
svtools/inc/svtools/table/abstracttablecontrol.hxx
svtools/inc/svtools/taskbar.hxx
svtools/inc/svtools/textview.hxx
svtools/inc/svtools/valueset.hxx
svtools/source/brwbox/brwbox1.cxx
svtools/source/brwbox/brwbox2.cxx
svtools/source/brwbox/datwin.cxx
svtools/source/brwbox/datwin.hxx
svtools/source/brwbox/makefile.mk
svtools/source/config/apearcfg.cxx
svtools/source/config/htmlcfg.cxx
svtools/source/config/menuoptions.cxx
svtools/source/config/miscopt.cxx
svtools/source/contnr/cont_pch.cxx
svtools/source/contnr/ctrdll.cxx
svtools/source/contnr/fileview.cxx
svtools/source/contnr/imivctl1.cxx
svtools/source/contnr/ivctrl.cxx
svtools/source/contnr/makefile.mk
svtools/source/contnr/svcontnr.src
svtools/source/contnr/svicnvw.cxx
svtools/source/contnr/svimpbox.cxx
svtools/source/contnr/svimpicn.cxx
svtools/source/contnr/svlbitm.cxx
svtools/source/contnr/svtreebx.cxx
svtools/source/contnr/templwin.cxx
svtools/source/contnr/templwin.hxx
svtools/source/control/asynclink.cxx
svtools/source/control/ctrlbox.cxx
svtools/source/control/ctrldll.cxx
svtools/source/control/ctrltool.cxx
svtools/source/control/filectrl.cxx
svtools/source/control/filectrl.src
svtools/source/control/headbar.cxx
svtools/source/control/inettbc.cxx
svtools/source/control/makefile.mk
svtools/source/control/prgsbar.cxx
svtools/source/control/roadmap.cxx
svtools/source/control/ruler.cxx
svtools/source/control/scriptedtext.cxx
svtools/source/control/stdmenu.cxx
svtools/source/control/tabbar.cxx
svtools/source/control/taskbar.cxx
svtools/source/control/taskbox.cxx
svtools/source/control/taskmisc.cxx
svtools/source/control/taskstat.cxx
svtools/source/control/valueacc.cxx
svtools/source/control/valueset.cxx
svtools/source/dialogs/addresstemplate.cxx
svtools/source/dialogs/addresstemplate.src
svtools/source/dialogs/colrdlg.src
svtools/source/dialogs/filedlg2.cxx
svtools/source/dialogs/filedlg2.hxx
svtools/source/dialogs/makefile.mk
svtools/source/dialogs/printdlg.cxx
svtools/source/dialogs/printdlg.src
svtools/source/dialogs/propctrl.cxx
svtools/source/dialogs/propctrl.hxx
svtools/source/dialogs/property.cxx
svtools/source/edit/makefile.mk
svtools/source/edit/sychconv.cxx
svtools/source/edit/syntaxhighlight.cxx
svtools/source/edit/textdoc.cxx
svtools/source/edit/texteng.cxx
svtools/source/edit/textundo.cxx
svtools/source/edit/textview.cxx
svtools/source/filter.vcl/filter/SvFilterOptionsDialog.cxx
svtools/source/filter.vcl/filter/dlgejpg.cxx
svtools/source/filter.vcl/filter/dlgejpg.hxx
svtools/source/filter.vcl/filter/dlgejpg.src
svtools/source/filter.vcl/filter/dlgepng.cxx
svtools/source/filter.vcl/filter/dlgepng.hxx
svtools/source/filter.vcl/filter/dlgepng.src
svtools/source/filter.vcl/filter/dlgexpor.cxx
svtools/source/filter.vcl/filter/dlgexpor.hxx
svtools/source/filter.vcl/filter/dlgexpor.src
svtools/source/filter.vcl/filter/filter2.cxx
svtools/source/filter.vcl/filter/makefile.mk
svtools/source/filter.vcl/filter/sgfbram.cxx
svtools/source/filter.vcl/filter/sgvmain.cxx
svtools/source/filter.vcl/filter/sgvspln.cxx
svtools/source/filter.vcl/filter/strings.src
svtools/source/filter.vcl/jpeg/makefile.mk
svtools/source/filter.vcl/wmf/emfwr.cxx
svtools/source/filter.vcl/wmf/emfwr.hxx
svtools/source/filter.vcl/wmf/enhwmf.cxx
svtools/source/filter.vcl/wmf/winmtf.hxx
svtools/source/filter.vcl/wmf/wmfwr.cxx
svtools/source/filter.vcl/wmf/wmfwr.hxx
svtools/source/graphic/grfcache.cxx
svtools/source/graphic/grfcache.hxx
svtools/source/graphic/grfmgr.cxx
svtools/source/graphic/makefile.mk
svtools/source/inc/accessibletableimp.hxx
svtools/source/inc/svimpbox.hxx
svtools/source/java/patchjavaerror.src
svtools/source/misc/ehdl.cxx
svtools/source/misc/errtxt.src
svtools/source/misc/helpagentwindow.cxx
svtools/source/misc/imagemgr.cxx
svtools/source/misc/imagemgr.src
svtools/source/misc/imageresourceaccess.cxx
svtools/source/misc/imap.cxx
svtools/source/misc/langtab.src
svtools/source/misc/makefile.mk
svtools/source/misc/svtdata.cxx
svtools/source/misc/templatefoldercache.cxx
svtools/source/misc/transfer2.cxx
svtools/source/misc/undo.src
svtools/source/plugapp/commtest.cxx
svtools/source/plugapp/commtest.src
svtools/source/plugapp/makefile.mk
svtools/source/plugapp/testtool.src
svtools/source/productregistration/productregistration.cxx
svtools/source/svhtml/htmlkywd.cxx
svtools/source/svhtml/parhtml.cxx
svtools/source/svrtf/rtfkey2.cxx
svtools/source/svrtf/rtfkeywd.cxx
svtools/source/table/defaultinputhandler.cxx
svtools/source/table/makefile.mk
svtools/source/table/tablecontrol.cxx
svtools/source/table/tablecontrol_impl.cxx
svtools/source/table/tablecontrol_impl.hxx
svtools/source/table/tabledatawindow.cxx
svtools/source/table/tablegeometry.cxx
svtools/source/table/tablegeometry.hxx
svtools/source/toolpanel/makefile.mk
svtools/source/toolpanel/toolpaneldrawer.cxx
svtools/source/uno/addrtempuno.cxx
svtools/source/uno/miscservices.cxx
svtools/source/uno/svtxgridcontrol.cxx
svtools/source/uno/svtxgridcontrol.hxx
svtools/source/uno/toolboxcontroller.cxx
svtools/source/uno/treecontrolpeer.cxx
svtools/source/uno/unocontroltablemodel.cxx
svtools/source/uno/unocontroltablemodel.hxx
svtools/source/uno/unoimap.cxx
svtools/source/urlobj/inetimg.cxx
svtools/util/makefile.mk
svtools/workben/browser.cxx
svtools/workben/cui/makefile.mk
svtools/workben/makefile.mk
svtools/workben/stest.cxx
svtools/workben/toolpanel/makefile.mk
svtools/workben/urange.cxx
toolkit/inc/toolkit/awt/vclxdevice.hxx
toolkit/inc/toolkit/awt/vclxgraphics.hxx
toolkit/inc/toolkit/awt/vclxwindows.hxx
toolkit/inc/toolkit/controls/dialogcontrol.hxx
toolkit/inc/toolkit/helper/property.hxx
toolkit/inc/toolkit/helper/servicenames.hxx
toolkit/inc/toolkit/helper/throbberimpl.hxx
toolkit/qa/complex/toolkit/accessibility/_XAccessibleComponent.java
toolkit/source/awt/asynccallback.cxx
toolkit/source/awt/vclxgraphics.cxx
toolkit/source/awt/vclxtoolkit.cxx
toolkit/source/awt/vclxwindow.cxx
toolkit/source/awt/xsimpleanimation.cxx
toolkit/source/awt/xthrobber.cxx
toolkit/source/controls/dialogcontrol.cxx
toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
toolkit/source/controls/grid/defaultgriddatamodel.cxx
toolkit/source/controls/grid/gridcontrol.cxx
toolkit/source/controls/grid/initguard.hxx
toolkit/source/controls/unocontrol.cxx
toolkit/source/controls/unocontrolcontainer.cxx
toolkit/source/controls/unocontrols.cxx
toolkit/source/helper/listenermultiplexer.cxx
toolkit/source/helper/property.cxx
toolkit/source/helper/registerservices.cxx
toolkit/source/helper/servicenames.cxx
toolkit/source/helper/throbberimpl.cxx
toolkit/source/helper/tkresmgr.cxx
tools/StaticLibrary_ooopathutils.mk
tools/bootstrp/addexes/makefile.mk
tools/bootstrp/addexes2/makefile.mk
tools/bootstrp/addexes2/mkfilt.cxx
tools/bootstrp/command.cxx
tools/bootstrp/cppdep.cxx
tools/bootstrp/iserver.cxx
tools/bootstrp/makefile.mk
tools/bootstrp/mkcreate.cxx
tools/bootstrp/prj.cxx
tools/bootstrp/rscdep.cxx
tools/bootstrp/sstring.cxx
tools/inc/bootstrp/command.hxx
tools/inc/bootstrp/mkcreate.hxx
tools/inc/bootstrp/prj.hxx
tools/inc/bootstrp/sstring.hxx
tools/inc/tools/agapi.hxx
tools/inc/tools/agitem.hxx
tools/inc/tools/chapi.hxx
tools/inc/tools/download.hxx
tools/inc/tools/eacopier.hxx
tools/inc/tools/fract.hxx
tools/inc/tools/fsys.hxx
tools/inc/tools/geninfo.hxx
tools/inc/tools/globname.hxx
tools/inc/tools/inetmime.hxx
tools/inc/tools/multisel.hxx
tools/inc/tools/poly.hxx
tools/inc/tools/postsys.h
tools/inc/tools/postwin.h
tools/inc/tools/presys.h
tools/inc/tools/prewin.h
tools/inc/tools/pstm.hxx
tools/inc/tools/ref.hxx
tools/inc/tools/simplerm.hxx
tools/inc/tools/solar.h
tools/inc/tools/table.hxx
tools/inc/tools/urlkeys.hxx
tools/inc/tools/urlobj.hxx
tools/prj/build.lst
tools/prj/d.lst
tools/qa/makefile.mk
tools/source/communi/geninfo.cxx
tools/source/debug/debug.cxx
tools/source/fsys/dirent.cxx
tools/source/fsys/tdir.cxx
tools/source/fsys/unx.cxx
tools/source/fsys/urlobj.cxx
tools/source/generic/color.cxx
tools/source/generic/config.cxx
tools/source/generic/fract.cxx
tools/source/inet/inetmime.cxx
tools/source/memtools/multisel.cxx
tools/source/memtools/table.cxx
tools/source/rc/resmgr.cxx
tools/source/ref/globname.cxx
tools/source/ref/pstm.cxx
tools/source/solar/solar.c
tools/source/stream/strmos2.cxx
tools/source/stream/strmunx.cxx
tools/source/stream/strmwnt.cxx
tools/source/string/makefile.mk
tools/source/testtoolloader/testtoolloader.cxx
tools/test/makefile.mk
tools/util/makefile.mk
tools/win/inc/dll.hxx
tools/win/inc/parser.hxx
tools/win/inc/shellex.h
tools/win/inc/shutil.h
tools/win/inc/toolsdll.hxx
tools/win/inc/winshell.hxx
tools/workben/makefile.mk
ucbhelper/source/client/proxydecider.cxx
ucbhelper/workben/ucbexplorer/ucbexplorer.hrc
unotools/inc/unotools/unotunnelhelper.hxx
unotools/source/config/fltrcfg.cxx
unotools/source/config/lingucfg.cxx
unotools/source/config/misccfg.cxx
unotools/source/config/pathoptions.cxx
unotools/source/config/searchopt.cxx
unotools/source/i18n/localedatawrapper.cxx
unotools/source/ucbhelper/localfilehelper.cxx
unotools/source/ucbhelper/ucbhelper.cxx
unotools/source/ucbhelper/xtempfile.cxx
vcl/aqua/inc/salbmp.h
vcl/aqua/inc/salgdi.h
vcl/aqua/inc/salinst.h
vcl/aqua/source/app/salinst.cxx
vcl/aqua/source/gdi/aquaprintaccessoryview.mm
vcl/aqua/source/gdi/salgdi.cxx
vcl/aqua/source/gdi/salprn.cxx
vcl/aqua/source/window/salframeview.mm
vcl/aqua/source/window/salobj.cxx
vcl/inc/vcl/bitmap.hxx
vcl/inc/vcl/brdwin.hxx
vcl/inc/vcl/button.hxx
vcl/inc/vcl/cmdevt.hxx
vcl/inc/vcl/cvtgrf.hxx
vcl/inc/vcl/dialog.hxx
vcl/inc/vcl/dockwin.hxx
vcl/inc/vcl/event.hxx
vcl/inc/vcl/fixed.hxx
vcl/inc/vcl/fldunit.hxx
vcl/inc/vcl/floatwin.hxx
vcl/inc/vcl/gdimtf.hxx
vcl/inc/vcl/glyphcache.hxx
vcl/inc/vcl/graphite_adaptors.hxx
vcl/inc/vcl/graphite_features.hxx
vcl/inc/vcl/graphite_layout.hxx
vcl/inc/vcl/ilstbox.hxx
vcl/inc/vcl/image.h
vcl/inc/vcl/imgctrl.hxx
vcl/inc/vcl/impbmpconv.hxx
vcl/inc/vcl/impprn.hxx
vcl/inc/vcl/jobset.h
vcl/inc/vcl/keycodes.hxx
vcl/inc/vcl/lstbox.hxx
vcl/inc/vcl/mapunit.hxx
vcl/inc/vcl/menu.hxx
vcl/inc/vcl/msgbox.hxx
vcl/inc/vcl/outdev.hxx
vcl/inc/vcl/prndlg.hxx
vcl/inc/vcl/salatype.hxx
vcl/inc/vcl/salbmp.hxx
vcl/inc/vcl/salgdi.hxx
vcl/inc/vcl/salinst.hxx
vcl/inc/vcl/seleng.hxx
vcl/inc/vcl/settings.hxx
vcl/inc/vcl/smartid.hxx
vcl/inc/vcl/status.hxx
vcl/inc/vcl/strhelper.hxx
vcl/inc/vcl/svapp.hxx
vcl/inc/vcl/svdata.hxx
vcl/inc/vcl/syschild.hxx
vcl/inc/vcl/sysdata.hxx
vcl/inc/vcl/taskpanelist.hxx
vcl/inc/vcl/toolbox.hxx
vcl/inc/vcl/vclevent.hxx
vcl/inc/vcl/windata.hxx
vcl/inc/vcl/window.hxx
vcl/inc/vcl/wintypes.hxx
vcl/os2/source/app/salinst.cxx
vcl/os2/source/gdi/salgdi.cxx
vcl/os2/source/window/salmenu.cxx
vcl/os2/source/window/salobj.cxx
vcl/prj/build.lst
vcl/source/app/dbggui.cxx
vcl/source/app/help.cxx
vcl/source/app/idlemgr.cxx
vcl/source/app/settings.cxx
vcl/source/app/svapp.cxx
vcl/source/app/svdata.cxx
vcl/source/app/svmain.cxx
vcl/source/app/svmainhook.cxx
vcl/source/app/unohelp.cxx
vcl/source/app/vclevent.cxx
vcl/source/control/button.cxx
vcl/source/control/combobox.cxx
vcl/source/control/edit.cxx
vcl/source/control/field.cxx
vcl/source/control/fixed.cxx
vcl/source/control/ilstbox.cxx
vcl/source/control/imgctrl.cxx
vcl/source/control/makefile.mk
vcl/source/control/tabctrl.cxx
vcl/source/gdi/bitmap.cxx
vcl/source/gdi/bitmap2.cxx
vcl/source/gdi/bitmap4.cxx
vcl/source/gdi/bmpconv.cxx
vcl/source/gdi/cvtsvm.cxx
vcl/source/gdi/font.cxx
vcl/source/gdi/gdimtf.cxx
vcl/source/gdi/image.cxx
vcl/source/gdi/impimage.cxx
vcl/source/gdi/jobset.cxx
vcl/source/gdi/makefile.mk
vcl/source/gdi/metaact.cxx
vcl/source/gdi/outdev.cxx
vcl/source/gdi/outdev3.cxx
vcl/source/gdi/outdev4.cxx
vcl/source/gdi/outdevnative.cxx
vcl/source/gdi/pdfwriter.cxx
vcl/source/gdi/pdfwriter_impl.cxx
vcl/source/gdi/print3.cxx
vcl/source/gdi/salmisc.cxx
vcl/source/glyphs/gcach_ftyp.cxx
vcl/source/glyphs/gcach_ftyp.hxx
vcl/source/glyphs/glyphcache.cxx
vcl/source/glyphs/graphite_cache.cxx
vcl/source/glyphs/graphite_layout.cxx
vcl/source/glyphs/graphite_textsrc.hxx
vcl/source/helper/canvasbitmap.cxx
vcl/source/helper/smartid.cxx
vcl/source/helper/xconnection.cxx
vcl/source/src/btntext.src
vcl/source/src/images.src
vcl/source/src/print.src
vcl/source/window/accel.cxx
vcl/source/window/accmgr.cxx
vcl/source/window/brdwin.cxx
vcl/source/window/btndlg.cxx
vcl/source/window/dlgctrl.cxx
vcl/source/window/javachild.cxx
vcl/source/window/menu.cxx
vcl/source/window/msgbox.cxx
vcl/source/window/printdlg.cxx
vcl/source/window/status.cxx
vcl/source/window/syschild.cxx
vcl/source/window/toolbox.cxx
vcl/source/window/toolbox2.cxx
vcl/source/window/window.cxx
vcl/source/window/window2.cxx
vcl/source/window/wrkwin.cxx
vcl/unx/gtk/app/gtkdata.cxx
vcl/unx/gtk/app/gtkinst.cxx
vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
vcl/unx/gtk/window/gtkframe.cxx
vcl/unx/gtk/window/gtkobject.cxx
vcl/unx/headless/svpbmp.hxx
vcl/unx/headless/svpgdi.cxx
vcl/unx/headless/svpgdi.hxx
vcl/unx/headless/svpinst.cxx
vcl/unx/headless/svpinst.hxx
vcl/unx/headless/svpprn.cxx
vcl/unx/headless/svpprn.hxx
vcl/unx/headless/svppspgraphics.cxx
vcl/unx/headless/svppspgraphics.hxx
vcl/unx/headless/svptext.cxx
vcl/unx/inc/dtint.hxx
vcl/unx/inc/plugins/gtk/gtkdata.hxx
vcl/unx/inc/pspgraphics.h
vcl/unx/inc/salbmp.h
vcl/unx/inc/saldata.hxx
vcl/unx/inc/saldisp.hxx
vcl/unx/inc/salgdi.h
vcl/unx/inc/salinst.h
vcl/unx/inc/xfont.hxx
vcl/unx/kde/kdedata.cxx
vcl/unx/kde4/KDESalGraphics.cxx
vcl/unx/source/app/keysymnames.cxx
vcl/unx/source/app/saldata.cxx
vcl/unx/source/app/saldisp.cxx
vcl/unx/source/app/salinst.cxx
vcl/unx/source/app/wmadaptor.cxx
vcl/unx/source/dtrans/X11_selection.cxx
vcl/unx/source/dtrans/X11_service.cxx
vcl/unx/source/gdi/makefile.mk
vcl/unx/source/gdi/pspgraphics.cxx
vcl/unx/source/gdi/salgdi.cxx
vcl/unx/source/gdi/salgdi3.cxx
vcl/unx/source/gdi/salprnpsp.cxx
vcl/unx/source/gdi/xfont.cxx
vcl/unx/source/gdi/xlfd_attr.cxx
vcl/unx/source/gdi/xlfd_attr.hxx
vcl/unx/source/gdi/xlfd_extd.cxx
vcl/unx/source/gdi/xlfd_extd.hxx
vcl/unx/source/gdi/xlfd_smpl.cxx
vcl/unx/source/gdi/xlfd_smpl.hxx
vcl/unx/source/printer/ppdparser.cxx
vcl/unx/source/printer/printerinfomanager.cxx
vcl/unx/source/window/salframe.cxx
vcl/unx/source/window/salmenu.cxx
vcl/unx/source/window/salobj.cxx
vcl/util/makefile2.pmk
vcl/win/inc/salbmp.h
vcl/win/inc/saldata.hxx
vcl/win/inc/salgdi.h
vcl/win/inc/salinst.h
vcl/win/source/app/saldata.cxx
vcl/win/source/app/salinst.cxx
vcl/win/source/gdi/salgdi.cxx
vcl/win/source/gdi/salgdi3.cxx
vcl/win/source/gdi/salprn.cxx
vcl/win/source/gdi/winlayout.cxx
vcl/win/source/window/salframe.cxx
vcl/win/source/window/salobj.cxx
vcl/workben/outdevgrind.cxx
vos/inc/vos/execabl.hxx
vos/inc/vos/macros.hxx
vos/inc/vos/pipe.hxx
vos/inc/vos/process.hxx
vos/inc/vos/refernce.hxx
vos/inc/vos/signal.hxx
vos/inc/vos/socket.hxx
vos/inc/vos/stream.hxx
vos/inc/vos/thread.hxx
vos/source/pipe.cxx
vos/source/process.cxx
vos/source/signal.cxx
vos/source/thread.cxx
vos/source/timer.cxx
2011-03-11 14:24:23 +01:00
|
|
|
uno::Reference < XInterface > xI = xMSF->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.InputSequenceChecker")) );
|
2006-03-14 08:42:11 +00:00
|
|
|
if ( xI.is() )
|
|
|
|
{
|
2010-12-13 13:42:14 +01:00
|
|
|
Any x = xI->queryInterface( ::getCppuType((const uno::Reference< i18n::XExtendedInputSequenceChecker >*)0) );
|
2006-03-14 08:42:11 +00:00
|
|
|
x >>= xISC;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return xISC;
|
|
|
|
}
|
|
|
|
|
2001-11-30 12:44:07 +00:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2007-09-26 14:06:07 +00:00
|
|
|
void Edit::ShowTruncationWarning( Window* pParent )
|
|
|
|
{
|
|
|
|
ResMgr* pResMgr = ImplGetResMgr();
|
|
|
|
if( pResMgr )
|
|
|
|
{
|
|
|
|
WarningBox aBox( pParent, ResId( SV_EDIT_WARNING_BOX, *pResMgr ) );
|
|
|
|
aBox.Execute();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2008-12-01 13:29:22 +00:00
|
|
|
bool Edit::ImplTruncateToMaxLen( rtl::OUString& rStr, sal_uInt32 nSelectionLen ) const
|
2007-09-26 14:06:07 +00:00
|
|
|
{
|
2008-12-01 13:29:22 +00:00
|
|
|
bool bWasTruncated = false;
|
2007-09-26 14:06:07 +00:00
|
|
|
const sal_uInt32 nMaxLen = mnMaxTextLen < 65534 ? mnMaxTextLen : 65534;
|
|
|
|
sal_uInt32 nLenAfter = static_cast<sal_uInt32>(maText.Len()) + rStr.getLength() - nSelectionLen;
|
|
|
|
if ( nLenAfter > nMaxLen )
|
|
|
|
{
|
|
|
|
sal_uInt32 nErasePos = nMaxLen - static_cast<sal_uInt32>(maText.Len()) + nSelectionLen;
|
|
|
|
rStr = rStr.copy( 0, nErasePos );
|
2008-12-01 13:29:22 +00:00
|
|
|
bWasTruncated = true;
|
2007-09-26 14:06:07 +00:00
|
|
|
}
|
2008-12-01 13:29:22 +00:00
|
|
|
return bWasTruncated;
|
2007-09-26 14:06:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2006-03-14 08:42:11 +00:00
|
|
|
void Edit::ImplInsertText( const XubString& rStr, const Selection* pNewSel, sal_Bool bIsUserInput )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
Selection aSelection( maSelection );
|
|
|
|
aSelection.Justify();
|
|
|
|
|
2007-09-26 14:06:07 +00:00
|
|
|
rtl::OUString aNewText( ImplGetValidString( rStr ) );
|
|
|
|
ImplTruncateToMaxLen( aNewText, aSelection.Len() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2009-09-14 12:09:22 +00:00
|
|
|
ImplClearLayoutData();
|
2002-04-29 16:46:18 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( aSelection.Len() )
|
|
|
|
maText.Erase( (xub_StrLen)aSelection.Min(), (xub_StrLen)aSelection.Len() );
|
|
|
|
else if ( !mbInsertMode && (aSelection.Max() < maText.Len()) )
|
|
|
|
maText.Erase( (xub_StrLen)aSelection.Max(), 1 );
|
|
|
|
|
2006-03-14 08:42:11 +00:00
|
|
|
// take care of input-sequence-checking now
|
|
|
|
if (bIsUserInput && rStr.Len())
|
|
|
|
{
|
|
|
|
DBG_ASSERT( rStr.Len() == 1, "unexpected string length. User input is expected to providse 1 char only!" );
|
|
|
|
|
|
|
|
// determine if input-sequence-checking should be applied or not
|
|
|
|
//
|
2010-11-22 23:04:19 +01:00
|
|
|
static OUString sModule( RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.Office.Common/I18N") );
|
|
|
|
static OUString sRelNode( RTL_CONSTASCII_USTRINGPARAM("CTL") );
|
|
|
|
static OUString sCTLSequenceChecking( RTL_CONSTASCII_USTRINGPARAM("CTLSequenceChecking") );
|
|
|
|
static OUString sCTLSequenceCheckingRestricted( RTL_CONSTASCII_USTRINGPARAM("CTLSequenceCheckingRestricted") );
|
|
|
|
static OUString sCTLSequenceCheckingTypeAndReplace( RTL_CONSTASCII_USTRINGPARAM("CTLSequenceCheckingTypeAndReplace") );
|
|
|
|
static OUString sCTLFont( RTL_CONSTASCII_USTRINGPARAM("CTLFont") );
|
2006-03-14 08:42:11 +00:00
|
|
|
//
|
|
|
|
sal_Bool bCTLSequenceChecking = sal_False;
|
|
|
|
sal_Bool bCTLSequenceCheckingRestricted = sal_False;
|
|
|
|
sal_Bool bCTLSequenceCheckingTypeAndReplace = sal_False;
|
|
|
|
sal_Bool bCTLFontEnabled = sal_False;
|
|
|
|
sal_Bool bIsInputSequenceChecking = sal_False;
|
|
|
|
//
|
|
|
|
// get access to the configuration of this office module
|
|
|
|
try
|
|
|
|
{
|
2010-12-13 13:42:14 +01:00
|
|
|
uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
|
|
|
|
uno::Reference< container::XNameAccess > xModuleCfg( ::comphelper::ConfigurationHelper::openConfig(
|
2006-03-14 08:42:11 +00:00
|
|
|
xMSF,
|
|
|
|
sModule,
|
|
|
|
::comphelper::ConfigurationHelper::E_READONLY ),
|
|
|
|
uno::UNO_QUERY );
|
|
|
|
|
|
|
|
//!! get values from configuration.
|
|
|
|
//!! we can't use SvtCTLOptions here since vcl must not be linked
|
|
|
|
//!! against svtools. (It is already the other way around.)
|
|
|
|
Any aCTLSequenceChecking = ::comphelper::ConfigurationHelper::readRelativeKey( xModuleCfg, sRelNode, sCTLSequenceChecking );
|
|
|
|
Any aCTLSequenceCheckingRestricted = ::comphelper::ConfigurationHelper::readRelativeKey( xModuleCfg, sRelNode, sCTLSequenceCheckingRestricted );
|
|
|
|
Any aCTLSequenceCheckingTypeAndReplace = ::comphelper::ConfigurationHelper::readRelativeKey( xModuleCfg, sRelNode, sCTLSequenceCheckingTypeAndReplace );
|
|
|
|
Any aCTLFontEnabled = ::comphelper::ConfigurationHelper::readRelativeKey( xModuleCfg, sRelNode, sCTLFont );
|
|
|
|
aCTLSequenceChecking >>= bCTLSequenceChecking;
|
|
|
|
aCTLSequenceCheckingRestricted >>= bCTLSequenceCheckingRestricted;
|
|
|
|
aCTLSequenceCheckingTypeAndReplace >>= bCTLSequenceCheckingTypeAndReplace;
|
|
|
|
aCTLFontEnabled >>= bCTLFontEnabled;
|
|
|
|
}
|
|
|
|
catch(...)
|
|
|
|
{
|
|
|
|
bIsInputSequenceChecking = sal_False; // continue with inserting the new text
|
|
|
|
}
|
|
|
|
//
|
|
|
|
uno::Reference < i18n::XBreakIterator > xBI( ImplGetBreakIterator(), UNO_QUERY );
|
|
|
|
bIsInputSequenceChecking = rStr.Len() == 1 &&
|
|
|
|
bCTLFontEnabled &&
|
|
|
|
bCTLSequenceChecking &&
|
|
|
|
aSelection.Min() > 0 && /* first char needs not to be checked */
|
|
|
|
xBI.is() && i18n::ScriptType::COMPLEX == xBI->getScriptType( rStr, 0 );
|
|
|
|
|
|
|
|
|
|
|
|
uno::Reference < i18n::XExtendedInputSequenceChecker > xISC;
|
|
|
|
if (bIsInputSequenceChecking && (xISC = ImplGetInputSequenceChecker()).is())
|
|
|
|
{
|
|
|
|
sal_Unicode cChar = rStr.GetChar(0);
|
|
|
|
xub_StrLen nTmpPos = static_cast< xub_StrLen >( aSelection.Min() );
|
|
|
|
sal_Int16 nCheckMode = bCTLSequenceCheckingRestricted ?
|
|
|
|
i18n::InputSequenceCheckMode::STRICT : i18n::InputSequenceCheckMode::BASIC;
|
|
|
|
|
|
|
|
// the text that needs to be checked is only the one
|
|
|
|
// before the current cursor position
|
|
|
|
rtl::OUString aOldText( maText.Copy(0, nTmpPos) );
|
|
|
|
rtl::OUString aTmpText( aOldText );
|
|
|
|
if (bCTLSequenceCheckingTypeAndReplace)
|
|
|
|
{
|
2006-06-19 18:16:09 +00:00
|
|
|
xISC->correctInputSequence( aTmpText, nTmpPos - 1, cChar, nCheckMode );
|
2006-03-14 08:42:11 +00:00
|
|
|
|
|
|
|
// find position of first character that has changed
|
|
|
|
sal_Int32 nOldLen = aOldText.getLength();
|
|
|
|
sal_Int32 nTmpLen = aTmpText.getLength();
|
|
|
|
const sal_Unicode *pOldTxt = aOldText.getStr();
|
|
|
|
const sal_Unicode *pTmpTxt = aTmpText.getStr();
|
|
|
|
sal_Int32 nChgPos = 0;
|
|
|
|
while ( nChgPos < nOldLen && nChgPos < nTmpLen &&
|
|
|
|
pOldTxt[nChgPos] == pTmpTxt[nChgPos] )
|
|
|
|
++nChgPos;
|
|
|
|
|
|
|
|
xub_StrLen nChgLen = static_cast< xub_StrLen >( nTmpLen - nChgPos );
|
|
|
|
String aChgText( aTmpText.copy( nChgPos ), nChgLen );
|
|
|
|
|
|
|
|
// remove text from first pos to be changed to current pos
|
2006-06-19 18:16:09 +00:00
|
|
|
maText.Erase( static_cast< xub_StrLen >( nChgPos ), static_cast< xub_StrLen >( nTmpPos - nChgPos ) );
|
2006-03-14 08:42:11 +00:00
|
|
|
|
|
|
|
if (aChgText.Len())
|
|
|
|
{
|
|
|
|
aNewText = aChgText;
|
|
|
|
aSelection.Min() = nChgPos; // position for new text to be inserted
|
|
|
|
}
|
|
|
|
else
|
|
|
|
aNewText = String::EmptyString();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// should the character be ignored (i.e. not get inserted) ?
|
|
|
|
if (!xISC->checkInputSequence( aOldText, nTmpPos - 1, cChar, nCheckMode ))
|
|
|
|
aNewText = String::EmptyString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// at this point now we will insert the non-empty text 'normally' some lines below...
|
|
|
|
}
|
|
|
|
|
2007-09-26 14:06:07 +00:00
|
|
|
if ( aNewText.getLength() )
|
|
|
|
maText.Insert( String( aNewText ), (xub_StrLen)aSelection.Min() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( !pNewSel )
|
|
|
|
{
|
2007-09-26 14:06:07 +00:00
|
|
|
maSelection.Min() = aSelection.Min() + aNewText.getLength();
|
2000-09-18 16:07:07 +00:00
|
|
|
maSelection.Max() = maSelection.Min();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
maSelection = *pNewSel;
|
|
|
|
if ( maSelection.Min() > maText.Len() )
|
|
|
|
maSelection.Min() = maText.Len();
|
|
|
|
if ( maSelection.Max() > maText.Len() )
|
|
|
|
maSelection.Max() = maText.Len();
|
|
|
|
}
|
|
|
|
|
2006-06-19 18:16:09 +00:00
|
|
|
ImplAlignAndPaint();
|
2010-09-29 15:46:40 +08:00
|
|
|
mbInternModified = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Edit::ImplSetText( const XubString& rText, const Selection* pNewSelection )
|
|
|
|
{
|
|
|
|
// Der Text wird dadurch geloescht das der alte Text komplett 'selektiert'
|
|
|
|
// wird, dann InsertText, damit flackerfrei.
|
2003-03-27 16:59:30 +00:00
|
|
|
if ( ( rText.Len() <= mnMaxTextLen ) && ( (rText != maText) || (pNewSelection && (*pNewSelection != maSelection)) ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2009-09-14 12:09:22 +00:00
|
|
|
ImplClearLayoutData();
|
2000-09-18 16:07:07 +00:00
|
|
|
maSelection.Min() = 0;
|
|
|
|
maSelection.Max() = maText.Len();
|
|
|
|
if ( mnXOffset || HasPaintEvent() )
|
|
|
|
{
|
|
|
|
mnXOffset = 0;
|
2001-11-30 12:44:07 +00:00
|
|
|
maText = ImplGetValidString( rText );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2006-03-22 09:38:14 +00:00
|
|
|
// #i54929# recalculate mnXOffset before ImplSetSelection,
|
|
|
|
// else cursor ends up in wrong position
|
|
|
|
ImplAlign();
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( pNewSelection )
|
2010-09-29 15:46:40 +08:00
|
|
|
ImplSetSelection( *pNewSelection, sal_False );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( mnXOffset && !pNewSelection )
|
|
|
|
maSelection.Max() = 0;
|
|
|
|
|
|
|
|
Invalidate();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ImplInsertText( rText, pNewSelection );
|
2008-07-25 08:09:51 +00:00
|
|
|
|
|
|
|
ImplCallEventListeners( VCLEVENT_EDIT_MODIFY );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2004-05-10 14:46:40 +00:00
|
|
|
int Edit::ImplGetNativeControlType()
|
|
|
|
{
|
|
|
|
int nCtrl = 0;
|
|
|
|
Window *pControl = mbIsSubEdit ? GetParent() : this;
|
|
|
|
|
|
|
|
switch( pControl->GetType() )
|
|
|
|
{
|
|
|
|
case WINDOW_COMBOBOX:
|
|
|
|
case WINDOW_PATTERNBOX:
|
|
|
|
case WINDOW_NUMERICBOX:
|
|
|
|
case WINDOW_METRICBOX:
|
|
|
|
case WINDOW_CURRENCYBOX:
|
|
|
|
case WINDOW_DATEBOX:
|
|
|
|
case WINDOW_TIMEBOX:
|
|
|
|
case WINDOW_LONGCURRENCYBOX:
|
|
|
|
nCtrl = CTRL_COMBOBOX;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WINDOW_MULTILINEEDIT:
|
2004-10-13 07:49:36 +00:00
|
|
|
if ( GetWindow( WINDOW_BORDER ) != this )
|
|
|
|
nCtrl = CTRL_MULTILINE_EDITBOX;
|
|
|
|
else
|
|
|
|
nCtrl = CTRL_EDITBOX_NOBORDER;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WINDOW_EDIT:
|
2004-05-10 14:46:40 +00:00
|
|
|
case WINDOW_PATTERNFIELD:
|
|
|
|
case WINDOW_METRICFIELD:
|
|
|
|
case WINDOW_CURRENCYFIELD:
|
|
|
|
case WINDOW_DATEFIELD:
|
|
|
|
case WINDOW_TIMEFIELD:
|
|
|
|
case WINDOW_LONGCURRENCYFIELD:
|
|
|
|
case WINDOW_NUMERICFIELD:
|
|
|
|
case WINDOW_SPINFIELD:
|
|
|
|
if( pControl->GetStyle() & WB_SPIN )
|
|
|
|
nCtrl = CTRL_SPINBOX;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( GetWindow( WINDOW_BORDER ) != this )
|
|
|
|
nCtrl = CTRL_EDITBOX;
|
|
|
|
else
|
|
|
|
nCtrl = CTRL_EDITBOX_NOBORDER;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
nCtrl = CTRL_EDITBOX;
|
|
|
|
}
|
|
|
|
return nCtrl;
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
void Edit::ImplClearBackground( long nXStart, long nXEnd )
|
|
|
|
{
|
2005-11-01 09:31:53 +00:00
|
|
|
/*
|
|
|
|
* note: at this point the cursor must be switched off already
|
|
|
|
*/
|
2000-09-18 16:07:07 +00:00
|
|
|
Point aTmpPoint;
|
|
|
|
Rectangle aRect( aTmpPoint, GetOutputSizePixel() );
|
|
|
|
aRect.Left() = nXStart;
|
|
|
|
aRect.Right() = nXEnd;
|
|
|
|
|
2007-04-26 09:36:22 +00:00
|
|
|
if( ImplUseNativeBorder( GetStyle() ) || IsPaintTransparent() )
|
2004-05-10 14:46:40 +00:00
|
|
|
{
|
|
|
|
// draw the inner part by painting the whole control using its border window
|
|
|
|
Window *pControl = this;
|
|
|
|
Window *pBorder = GetWindow( WINDOW_BORDER );
|
|
|
|
if( pBorder == this )
|
|
|
|
{
|
|
|
|
// we have no border, use parent
|
|
|
|
pControl = mbIsSubEdit ? GetParent() : this;
|
|
|
|
pBorder = pControl->GetWindow( WINDOW_BORDER );
|
2007-04-26 09:36:22 +00:00
|
|
|
if( pBorder == this )
|
|
|
|
pBorder = GetParent();
|
2004-05-10 14:46:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( pBorder )
|
|
|
|
{
|
|
|
|
// set proper clipping region to not overdraw the whole control
|
|
|
|
Region aClipRgn = GetPaintRegion();
|
|
|
|
if( !aClipRgn.IsNull() )
|
|
|
|
{
|
|
|
|
// transform clipping region to border window's coordinate system
|
2006-03-22 09:38:14 +00:00
|
|
|
if( IsRTLEnabled() != pBorder->IsRTLEnabled() && Application::GetSettings().GetLayoutRTL() )
|
|
|
|
{
|
|
|
|
// need to mirror in case border is not RTL but edit is (or vice versa)
|
|
|
|
|
|
|
|
// mirror
|
|
|
|
Rectangle aBounds( aClipRgn.GetBoundRect() );
|
|
|
|
int xNew = GetOutputSizePixel().Width() - aBounds.GetWidth() - aBounds.Left();
|
|
|
|
aClipRgn.Move( xNew - aBounds.Left(), 0 );
|
|
|
|
|
|
|
|
// move offset of border window
|
|
|
|
Point aBorderOffs;
|
|
|
|
aBorderOffs = pBorder->ScreenToOutputPixel( OutputToScreenPixel( aBorderOffs ) );
|
|
|
|
aClipRgn.Move( aBorderOffs.X(), aBorderOffs.Y() );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// normal case
|
|
|
|
Point aBorderOffs;
|
|
|
|
aBorderOffs = pBorder->ScreenToOutputPixel( OutputToScreenPixel( aBorderOffs ) );
|
|
|
|
aClipRgn.Move( aBorderOffs.X(), aBorderOffs.Y() );
|
|
|
|
}
|
2004-05-10 14:46:40 +00:00
|
|
|
|
|
|
|
Region oldRgn( pBorder->GetClipRegion() );
|
|
|
|
pBorder->SetClipRegion( aClipRgn );
|
|
|
|
|
|
|
|
pBorder->Paint( Rectangle() );
|
|
|
|
|
|
|
|
pBorder->SetClipRegion( oldRgn );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
pBorder->Paint( Rectangle() );
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
Erase( aRect );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
void Edit::ImplShowCursor( sal_Bool bOnlyIfVisible )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( !IsUpdateMode() || ( bOnlyIfVisible && !IsReallyVisible() ) )
|
|
|
|
return;
|
|
|
|
|
|
|
|
Cursor* pCursor = GetCursor();
|
|
|
|
XubString aText = ImplGetText();
|
2002-09-25 16:13:57 +00:00
|
|
|
|
2002-09-27 10:26:49 +00:00
|
|
|
long nTextPos = 0;
|
|
|
|
|
2004-06-17 11:12:07 +00:00
|
|
|
sal_Int32 nDXBuffer[256];
|
|
|
|
sal_Int32* pDXBuffer = NULL;
|
|
|
|
sal_Int32* pDX = nDXBuffer;
|
2002-09-27 10:26:49 +00:00
|
|
|
|
|
|
|
if( aText.Len() )
|
2002-09-25 16:13:57 +00:00
|
|
|
{
|
2010-10-18 12:28:33 +02:00
|
|
|
if( 2*aText.Len() > xub_StrLen(SAL_N_ELEMENTS(nDXBuffer)) )
|
2002-09-27 10:26:49 +00:00
|
|
|
{
|
2004-06-17 11:12:07 +00:00
|
|
|
pDXBuffer = new sal_Int32[2*(aText.Len()+1)];
|
2002-09-27 10:26:49 +00:00
|
|
|
pDX = pDXBuffer;
|
|
|
|
}
|
2002-09-25 16:13:57 +00:00
|
|
|
|
2002-09-27 10:26:49 +00:00
|
|
|
GetCaretPositions( aText, pDX, 0, aText.Len() );
|
2002-09-25 16:13:57 +00:00
|
|
|
|
2002-09-27 10:26:49 +00:00
|
|
|
if( maSelection.Max() < aText.Len() )
|
|
|
|
nTextPos = pDX[ 2*maSelection.Max() ];
|
|
|
|
else
|
|
|
|
nTextPos = pDX[ 2*aText.Len()-1 ];
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
long nCursorWidth = 0;
|
|
|
|
if ( !mbInsertMode && !maSelection.Len() && (maSelection.Max() < aText.Len()) )
|
|
|
|
nCursorWidth = GetTextWidth( aText, (xub_StrLen)maSelection.Max(), 1 );
|
2002-09-25 16:13:57 +00:00
|
|
|
long nCursorPosX = nTextPos + mnXOffset + ImplGetExtraOffset();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// Cursor muss im sichtbaren Bereich landen:
|
2009-10-23 12:10:07 +02:00
|
|
|
const Size aOutSize = GetOutputSizePixel();
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( (nCursorPosX < 0) || (nCursorPosX >= aOutSize.Width()) )
|
|
|
|
{
|
|
|
|
long nOldXOffset = mnXOffset;
|
|
|
|
|
|
|
|
if ( nCursorPosX < 0 )
|
|
|
|
{
|
2002-09-25 16:13:57 +00:00
|
|
|
mnXOffset = - nTextPos;
|
2000-09-18 16:07:07 +00:00
|
|
|
long nMaxX = 0;
|
|
|
|
mnXOffset += aOutSize.Width() / 5;
|
|
|
|
if ( mnXOffset > nMaxX )
|
|
|
|
mnXOffset = nMaxX;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-09-25 16:13:57 +00:00
|
|
|
mnXOffset = (aOutSize.Width()-ImplGetExtraOffset()) - nTextPos;
|
2000-09-18 16:07:07 +00:00
|
|
|
// Etwas mehr?
|
2002-09-25 16:13:57 +00:00
|
|
|
if ( (aOutSize.Width()-ImplGetExtraOffset()) < nTextPos )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2002-09-04 12:08:17 +00:00
|
|
|
long nMaxNegX = (aOutSize.Width()-ImplGetExtraOffset()) - GetTextWidth( aText );
|
2000-09-18 16:07:07 +00:00
|
|
|
mnXOffset -= aOutSize.Width() / 5;
|
|
|
|
if ( mnXOffset < nMaxNegX ) // beides negativ...
|
|
|
|
mnXOffset = nMaxNegX;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-09-25 16:13:57 +00:00
|
|
|
nCursorPosX = nTextPos + mnXOffset + ImplGetExtraOffset();
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( nCursorPosX == aOutSize.Width() ) // dann nicht sichtbar...
|
|
|
|
nCursorPosX--;
|
|
|
|
|
|
|
|
if ( mnXOffset != nOldXOffset )
|
2007-04-26 09:36:22 +00:00
|
|
|
ImplInvalidateOrRepaint();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2009-10-23 12:10:07 +02:00
|
|
|
const long nTextHeight = GetTextHeight();
|
|
|
|
const long nCursorPosY = ImplGetTextYPosition();
|
2000-09-18 16:07:07 +00:00
|
|
|
pCursor->SetPos( Point( nCursorPosX, nCursorPosY ) );
|
|
|
|
pCursor->SetSize( Size( nCursorWidth, nTextHeight ) );
|
|
|
|
pCursor->Show();
|
2002-09-25 16:13:57 +00:00
|
|
|
|
|
|
|
if( pDXBuffer )
|
2002-10-01 14:43:23 +00:00
|
|
|
delete [] pDXBuffer;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Edit::ImplAlign()
|
|
|
|
{
|
|
|
|
long nTextWidth = GetTextWidth( ImplGetText() );
|
|
|
|
long nOutWidth = GetOutputSizePixel().Width();
|
|
|
|
|
2001-07-18 16:07:21 +00:00
|
|
|
if ( mnAlign == EDIT_ALIGN_LEFT )
|
|
|
|
{
|
|
|
|
if( mnXOffset && ( nTextWidth < nOutWidth ) )
|
|
|
|
mnXOffset = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
else if ( mnAlign == EDIT_ALIGN_RIGHT )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2002-09-13 15:01:29 +00:00
|
|
|
long nMinXOffset = nOutWidth - nTextWidth - 1 - ImplGetExtraOffset();
|
2008-12-16 13:30:53 +00:00
|
|
|
bool bRTL = IsRTLEnabled();
|
|
|
|
if( mbIsSubEdit && GetParent() )
|
|
|
|
bRTL = GetParent()->IsRTLEnabled();
|
|
|
|
if( bRTL )
|
2002-09-25 16:13:57 +00:00
|
|
|
{
|
2002-10-16 15:51:10 +00:00
|
|
|
if( nTextWidth < nOutWidth )
|
2002-09-25 16:13:57 +00:00
|
|
|
mnXOffset = nMinXOffset;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-03-05 15:50:08 +00:00
|
|
|
if( nTextWidth < nOutWidth )
|
|
|
|
mnXOffset = nMinXOffset;
|
|
|
|
else if ( mnXOffset < nMinXOffset )
|
2002-09-25 16:13:57 +00:00
|
|
|
mnXOffset = nMinXOffset;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else if( mnAlign == EDIT_ALIGN_CENTER )
|
|
|
|
{
|
|
|
|
// Mit Abfrage schoener, wenn gescrollt, dann aber nicht zentriert im gescrollten Zustand...
|
|
|
|
// if ( nTextWidth < nOutWidth )
|
|
|
|
mnXOffset = (nOutWidth - nTextWidth) / 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2006-06-19 18:16:09 +00:00
|
|
|
void Edit::ImplAlignAndPaint()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
ImplAlign();
|
2007-04-26 09:36:22 +00:00
|
|
|
ImplInvalidateOrRepaint( 0, STRING_LEN );
|
2000-09-18 16:07:07 +00:00
|
|
|
ImplShowCursor();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2006-03-14 10:14:43 +00:00
|
|
|
xub_StrLen Edit::ImplGetCharPos( const Point& rWindowPos ) const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2002-09-25 16:13:57 +00:00
|
|
|
xub_StrLen nIndex = STRING_LEN;
|
|
|
|
String aText = ImplGetText();
|
|
|
|
|
2004-06-17 11:12:07 +00:00
|
|
|
sal_Int32 nDXBuffer[256];
|
|
|
|
sal_Int32* pDXBuffer = NULL;
|
|
|
|
sal_Int32* pDX = nDXBuffer;
|
2010-10-18 12:28:33 +02:00
|
|
|
if( 2*aText.Len() > xub_StrLen(SAL_N_ELEMENTS(nDXBuffer)) )
|
2002-09-25 16:13:57 +00:00
|
|
|
{
|
2004-06-17 11:12:07 +00:00
|
|
|
pDXBuffer = new sal_Int32[2*(aText.Len()+1)];
|
2002-09-25 16:13:57 +00:00
|
|
|
pDX = pDXBuffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
GetCaretPositions( aText, pDX, 0, aText.Len() );
|
2002-10-16 15:51:10 +00:00
|
|
|
long nX = rWindowPos.X() - mnXOffset - ImplGetExtraOffset();
|
2002-09-25 16:13:57 +00:00
|
|
|
for( int i = 0; i < aText.Len(); i++ )
|
|
|
|
{
|
|
|
|
if( (pDX[2*i] >= nX && pDX[2*i+1] <= nX) ||
|
|
|
|
(pDX[2*i+1] >= nX && pDX[2*i] <= nX))
|
|
|
|
{
|
2006-06-19 18:16:09 +00:00
|
|
|
nIndex = sal::static_int_cast<xub_StrLen>(i);
|
2002-10-16 15:51:10 +00:00
|
|
|
if( pDX[2*i] < pDX[2*i+1] )
|
|
|
|
{
|
|
|
|
if( nX > (pDX[2*i]+pDX[2*i+1])/2 )
|
|
|
|
nIndex++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( nX < (pDX[2*i]+pDX[2*i+1])/2 )
|
|
|
|
nIndex++;
|
|
|
|
}
|
2002-09-25 16:13:57 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2002-10-16 15:51:10 +00:00
|
|
|
if( nIndex == STRING_LEN )
|
|
|
|
{
|
|
|
|
nIndex = 0;
|
|
|
|
long nDiff = Abs( pDX[0]-nX );
|
|
|
|
for( int i = 1; i < aText.Len(); i++ )
|
|
|
|
{
|
|
|
|
long nNewDiff = Abs( pDX[2*i]-nX );
|
|
|
|
|
|
|
|
if( nNewDiff < nDiff )
|
|
|
|
{
|
2006-06-19 18:16:09 +00:00
|
|
|
nIndex = sal::static_int_cast<xub_StrLen>(i);
|
2002-10-16 15:51:10 +00:00
|
|
|
nDiff = nNewDiff;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if( nIndex == aText.Len()-1 && Abs( pDX[2*nIndex+1] - nX ) < nDiff )
|
|
|
|
nIndex = STRING_LEN;
|
|
|
|
}
|
2002-09-25 16:13:57 +00:00
|
|
|
|
|
|
|
if( pDXBuffer )
|
2002-10-01 14:43:23 +00:00
|
|
|
delete [] pDXBuffer;
|
2002-09-25 16:13:57 +00:00
|
|
|
|
|
|
|
return nIndex;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
void Edit::ImplSetCursorPos( xub_StrLen nChar, sal_Bool bSelect )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
Selection aSelection( maSelection );
|
|
|
|
aSelection.Max() = nChar;
|
|
|
|
if ( !bSelect )
|
|
|
|
aSelection.Min() = aSelection.Max();
|
|
|
|
ImplSetSelection( aSelection );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Edit::ImplLoadRes( const ResId& rResId )
|
|
|
|
{
|
|
|
|
Control::ImplLoadRes( rResId );
|
|
|
|
|
|
|
|
xub_StrLen nTextLength = ReadShortRes();
|
|
|
|
if ( nTextLength )
|
|
|
|
SetMaxTextLen( nTextLength );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
void Edit::ImplCopyToSelectionClipboard()
|
|
|
|
{
|
|
|
|
if ( GetSelection().Len() )
|
|
|
|
{
|
2006-06-19 18:16:09 +00:00
|
|
|
::com::sun::star::uno::Reference<com::sun::star::datatransfer::clipboard::XClipboard> aSelection(GetPrimarySelection());
|
2003-03-27 16:59:30 +00:00
|
|
|
ImplCopy( aSelection );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-08-20 10:09:37 +00:00
|
|
|
void Edit::ImplCopy( uno::Reference< datatransfer::clipboard::XClipboard >& rxClipboard )
|
|
|
|
{
|
2005-01-31 12:22:03 +00:00
|
|
|
::vcl::unohelper::TextDataObject::CopyStringTo( GetSelected(), rxClipboard );
|
2001-08-20 10:09:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Edit::ImplPaste( uno::Reference< datatransfer::clipboard::XClipboard >& rxClipboard )
|
|
|
|
{
|
|
|
|
if ( rxClipboard.is() )
|
|
|
|
{
|
2002-07-02 09:59:44 +00:00
|
|
|
uno::Reference< datatransfer::XTransferable > xDataObj;
|
|
|
|
|
2001-08-20 10:09:37 +00:00
|
|
|
const sal_uInt32 nRef = Application::ReleaseSolarMutex();
|
2002-07-02 09:59:44 +00:00
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
xDataObj = rxClipboard->getContents();
|
|
|
|
}
|
|
|
|
catch( const ::com::sun::star::uno::Exception& )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2001-08-20 10:09:37 +00:00
|
|
|
Application::AcquireSolarMutex( nRef );
|
2002-07-02 09:59:44 +00:00
|
|
|
|
2001-08-20 10:09:37 +00:00
|
|
|
if ( xDataObj.is() )
|
|
|
|
{
|
|
|
|
datatransfer::DataFlavor aFlavor;
|
|
|
|
SotExchange::GetFormatDataFlavor( SOT_FORMAT_STRING, aFlavor );
|
2002-11-08 09:19:07 +00:00
|
|
|
try
|
2001-08-20 10:09:37 +00:00
|
|
|
{
|
|
|
|
uno::Any aData = xDataObj->getTransferData( aFlavor );
|
|
|
|
::rtl::OUString aText;
|
|
|
|
aData >>= aText;
|
2008-12-01 13:29:22 +00:00
|
|
|
if( ImplTruncateToMaxLen( aText, maSelection.Len() ) )
|
|
|
|
ShowTruncationWarning( const_cast<Edit*>(this) );
|
2001-08-20 10:09:37 +00:00
|
|
|
ReplaceSelected( aText );
|
|
|
|
}
|
2002-11-08 09:19:07 +00:00
|
|
|
catch( const ::com::sun::star::uno::Exception& )
|
|
|
|
{
|
|
|
|
}
|
2001-08-20 10:09:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
void Edit::MouseButtonDown( const MouseEvent& rMEvt )
|
|
|
|
{
|
|
|
|
if ( mpSubEdit )
|
|
|
|
{
|
|
|
|
Control::MouseButtonDown( rMEvt );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
xub_StrLen nChar = ImplGetCharPos( rMEvt.GetPosPixel() );
|
|
|
|
Selection aSelection( maSelection );
|
|
|
|
aSelection.Justify();
|
|
|
|
|
|
|
|
if ( rMEvt.GetClicks() < 4 )
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
mbClickedInSelection = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( rMEvt.GetClicks() == 3 )
|
2003-03-27 16:59:30 +00:00
|
|
|
{
|
2000-09-18 16:07:07 +00:00
|
|
|
ImplSetSelection( Selection( 0, 0xFFFF ) );
|
2003-03-27 16:59:30 +00:00
|
|
|
ImplCopyToSelectionClipboard();
|
|
|
|
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
else if ( rMEvt.GetClicks() == 2 )
|
|
|
|
{
|
2000-11-20 11:39:41 +00:00
|
|
|
uno::Reference < i18n::XBreakIterator > xBI = ImplGetBreakIterator();
|
2000-11-20 16:52:32 +00:00
|
|
|
i18n::Boundary aBoundary = xBI->getWordBoundary( maText, aSelection.Max(), GetSettings().GetLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES, sal_True );
|
2000-09-18 16:07:07 +00:00
|
|
|
ImplSetSelection( Selection( aBoundary.startPos, aBoundary.endPos ) );
|
2003-03-27 16:59:30 +00:00
|
|
|
ImplCopyToSelectionClipboard();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else if ( !rMEvt.IsShift() && HasFocus() && aSelection.IsInside( nChar ) )
|
2010-09-29 15:46:40 +08:00
|
|
|
mbClickedInSelection = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
else if ( rMEvt.IsLeft() )
|
|
|
|
ImplSetCursorPos( nChar, rMEvt.IsShift() );
|
|
|
|
|
|
|
|
if ( !mbClickedInSelection && rMEvt.IsLeft() && ( rMEvt.GetClicks() == 1 ) )
|
|
|
|
StartTracking( STARTTRACK_SCROLLREPEAT );
|
|
|
|
}
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
mbInMBDown = sal_True; // Dann im GetFocus nicht alles selektieren
|
2000-09-18 16:07:07 +00:00
|
|
|
GrabFocus();
|
2010-09-29 15:46:40 +08:00
|
|
|
mbInMBDown = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Edit::MouseButtonUp( const MouseEvent& rMEvt )
|
|
|
|
{
|
|
|
|
if ( mbClickedInSelection && rMEvt.IsLeft() )
|
|
|
|
{
|
|
|
|
xub_StrLen nChar = ImplGetCharPos( rMEvt.GetPosPixel() );
|
2010-09-29 15:46:40 +08:00
|
|
|
ImplSetCursorPos( nChar, sal_False );
|
|
|
|
mbClickedInSelection = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2001-08-20 10:09:37 +00:00
|
|
|
else if ( rMEvt.IsMiddle() && !mbReadOnly &&
|
|
|
|
( GetSettings().GetMouseSettings().GetMiddleButtonAction() == MOUSE_MIDDLE_PASTESELECTION ) )
|
|
|
|
{
|
2006-06-19 18:16:09 +00:00
|
|
|
::com::sun::star::uno::Reference<com::sun::star::datatransfer::clipboard::XClipboard> aSelection(Window::GetPrimarySelection());
|
2001-09-27 17:05:56 +00:00
|
|
|
ImplPaste( aSelection );
|
2003-06-04 10:21:53 +00:00
|
|
|
ImplModified();
|
2001-08-20 10:09:37 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Edit::Tracking( const TrackingEvent& rTEvt )
|
|
|
|
{
|
|
|
|
if ( rTEvt.IsTrackingEnded() )
|
|
|
|
{
|
|
|
|
if ( mbClickedInSelection )
|
|
|
|
{
|
|
|
|
xub_StrLen nChar = ImplGetCharPos( rTEvt.GetMouseEvent().GetPosPixel() );
|
2010-09-29 15:46:40 +08:00
|
|
|
ImplSetCursorPos( nChar, sal_False );
|
|
|
|
mbClickedInSelection = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2003-03-27 16:59:30 +00:00
|
|
|
else if ( rTEvt.GetMouseEvent().IsLeft() )
|
2001-08-20 10:09:37 +00:00
|
|
|
{
|
2003-03-27 16:59:30 +00:00
|
|
|
ImplCopyToSelectionClipboard();
|
2001-08-20 10:09:37 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( !mbClickedInSelection )
|
|
|
|
{
|
|
|
|
xub_StrLen nChar = ImplGetCharPos( rTEvt.GetMouseEvent().GetPosPixel() );
|
2010-09-29 15:46:40 +08:00
|
|
|
ImplSetCursorPos( nChar, sal_True );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
2008-07-21 11:10:40 +00:00
|
|
|
|
|
|
|
if ( mpUpdateDataTimer && !mbIsSubEdit && mpUpdateDataTimer->IsActive() )
|
|
|
|
mpUpdateDataTimer->Start();//do not update while the user is still travelling in the control
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_Bool Edit::ImplHandleKeyEvent( const KeyEvent& rKEvt )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_Bool bDone = sal_False;
|
|
|
|
sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode();
|
2000-09-18 16:07:07 +00:00
|
|
|
KeyFuncType eFunc = rKEvt.GetKeyCode().GetFunction();
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
mbInternModified = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( eFunc != KEYFUNC_DONTKNOW )
|
|
|
|
{
|
|
|
|
switch ( eFunc )
|
|
|
|
{
|
|
|
|
case KEYFUNC_CUT:
|
|
|
|
{
|
|
|
|
if ( !mbReadOnly && maSelection.Len() && !(GetStyle() & WB_PASSWORD) )
|
|
|
|
{
|
|
|
|
Cut();
|
|
|
|
ImplModified();
|
2010-09-29 15:46:40 +08:00
|
|
|
bDone = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case KEYFUNC_COPY:
|
|
|
|
{
|
|
|
|
if ( !(GetStyle() & WB_PASSWORD) )
|
|
|
|
{
|
|
|
|
Copy();
|
2010-09-29 15:46:40 +08:00
|
|
|
bDone = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case KEYFUNC_PASTE:
|
|
|
|
{
|
|
|
|
if ( !mbReadOnly )
|
|
|
|
{
|
|
|
|
Paste();
|
2010-09-29 15:46:40 +08:00
|
|
|
bDone = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case KEYFUNC_UNDO:
|
|
|
|
{
|
|
|
|
if ( !mbReadOnly )
|
|
|
|
{
|
|
|
|
Undo();
|
2010-09-29 15:46:40 +08:00
|
|
|
bDone = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default: // wird dann evtl. unten bearbeitet.
|
|
|
|
eFunc = KEYFUNC_DONTKNOW;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-04-06 14:37:22 +00:00
|
|
|
if ( !bDone && rKEvt.GetKeyCode().IsMod1() && !rKEvt.GetKeyCode().IsMod2() )
|
2005-11-01 09:31:53 +00:00
|
|
|
{
|
|
|
|
if ( nCode == KEY_A )
|
|
|
|
{
|
|
|
|
ImplSetSelection( Selection( 0, maText.Len() ) );
|
2010-09-29 15:46:40 +08:00
|
|
|
bDone = sal_True;
|
2005-11-01 09:31:53 +00:00
|
|
|
}
|
|
|
|
else if ( rKEvt.GetKeyCode().IsShift() && (nCode == KEY_S) )
|
|
|
|
{
|
|
|
|
if ( pImplFncGetSpecialChars )
|
|
|
|
{
|
|
|
|
Selection aSaveSel = GetSelection(); // Falls jemand in Get/LoseFocus die Selektion verbiegt, z.B. URL-Zeile...
|
|
|
|
XubString aChars = pImplFncGetSpecialChars( this, GetFont() );
|
|
|
|
SetSelection( aSaveSel );
|
|
|
|
if ( aChars.Len() )
|
|
|
|
{
|
|
|
|
ImplInsertText( aChars );
|
|
|
|
ImplModified();
|
|
|
|
}
|
2010-09-29 15:46:40 +08:00
|
|
|
bDone = sal_True;
|
2005-11-01 09:31:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( eFunc == KEYFUNC_DONTKNOW && ! bDone )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
switch ( nCode )
|
|
|
|
{
|
2009-01-02 15:26:18 +00:00
|
|
|
case com::sun::star::awt::Key::SELECT_ALL:
|
|
|
|
{
|
|
|
|
ImplSetSelection( Selection( 0, maText.Len() ) );
|
2010-09-29 15:46:40 +08:00
|
|
|
bDone = sal_True;
|
2009-01-02 15:26:18 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
case KEY_LEFT:
|
|
|
|
case KEY_RIGHT:
|
|
|
|
case KEY_HOME:
|
|
|
|
case KEY_END:
|
2009-01-02 15:26:18 +00:00
|
|
|
case com::sun::star::awt::Key::MOVE_WORD_FORWARD:
|
|
|
|
case com::sun::star::awt::Key::SELECT_WORD_FORWARD:
|
|
|
|
case com::sun::star::awt::Key::MOVE_WORD_BACKWARD:
|
|
|
|
case com::sun::star::awt::Key::SELECT_WORD_BACKWARD:
|
|
|
|
case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_LINE:
|
|
|
|
case com::sun::star::awt::Key::MOVE_TO_END_OF_LINE:
|
|
|
|
case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_LINE:
|
|
|
|
case com::sun::star::awt::Key::SELECT_TO_END_OF_LINE:
|
|
|
|
case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_PARAGRAPH:
|
|
|
|
case com::sun::star::awt::Key::MOVE_TO_END_OF_PARAGRAPH:
|
|
|
|
case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_PARAGRAPH:
|
|
|
|
case com::sun::star::awt::Key::SELECT_TO_END_OF_PARAGRAPH:
|
|
|
|
case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_DOCUMENT:
|
|
|
|
case com::sun::star::awt::Key::MOVE_TO_END_OF_DOCUMENT:
|
|
|
|
case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_DOCUMENT:
|
|
|
|
case com::sun::star::awt::Key::SELECT_TO_END_OF_DOCUMENT:
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( !rKEvt.GetKeyCode().IsMod2() )
|
|
|
|
{
|
2009-09-14 12:09:22 +00:00
|
|
|
ImplClearLayoutData();
|
2000-11-20 11:39:41 +00:00
|
|
|
uno::Reference < i18n::XBreakIterator > xBI = ImplGetBreakIterator();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
Selection aSel( maSelection );
|
2009-01-02 15:26:18 +00:00
|
|
|
bool bWord = rKEvt.GetKeyCode().IsMod1();
|
|
|
|
bool bSelect = rKEvt.GetKeyCode().IsShift();
|
|
|
|
bool bGoLeft = (nCode == KEY_LEFT);
|
|
|
|
bool bGoRight = (nCode == KEY_RIGHT);
|
|
|
|
bool bGoHome = (nCode == KEY_HOME);
|
|
|
|
bool bGoEnd = (nCode == KEY_END);
|
|
|
|
|
|
|
|
switch( nCode )
|
|
|
|
{
|
|
|
|
case com::sun::star::awt::Key::MOVE_WORD_FORWARD:
|
|
|
|
bGoRight = bWord = true;break;
|
|
|
|
case com::sun::star::awt::Key::SELECT_WORD_FORWARD:
|
|
|
|
bGoRight = bSelect = bWord = true;break;
|
|
|
|
case com::sun::star::awt::Key::MOVE_WORD_BACKWARD:
|
|
|
|
bGoLeft = bWord = true;break;
|
|
|
|
case com::sun::star::awt::Key::SELECT_WORD_BACKWARD:
|
|
|
|
bGoLeft = bSelect = bWord = true;break;
|
|
|
|
case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_LINE:
|
|
|
|
case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_PARAGRAPH:
|
|
|
|
case com::sun::star::awt::Key::SELECT_TO_BEGIN_OF_DOCUMENT:
|
|
|
|
bSelect = true;
|
|
|
|
// fallthrough intended
|
|
|
|
case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_LINE:
|
|
|
|
case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_PARAGRAPH:
|
|
|
|
case com::sun::star::awt::Key::MOVE_TO_BEGIN_OF_DOCUMENT:
|
|
|
|
bGoHome = true;break;
|
|
|
|
case com::sun::star::awt::Key::SELECT_TO_END_OF_LINE:
|
|
|
|
case com::sun::star::awt::Key::SELECT_TO_END_OF_PARAGRAPH:
|
|
|
|
case com::sun::star::awt::Key::SELECT_TO_END_OF_DOCUMENT:
|
|
|
|
bSelect = true;
|
|
|
|
// fallthrough intended
|
|
|
|
case com::sun::star::awt::Key::MOVE_TO_END_OF_LINE:
|
|
|
|
case com::sun::star::awt::Key::MOVE_TO_END_OF_PARAGRAPH:
|
|
|
|
case com::sun::star::awt::Key::MOVE_TO_END_OF_DOCUMENT:
|
|
|
|
bGoEnd = true;break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
};
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
// Range wird in ImplSetSelection geprueft...
|
2009-01-02 15:26:18 +00:00
|
|
|
if ( bGoLeft && aSel.Max() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( bWord )
|
|
|
|
{
|
2000-11-20 16:52:32 +00:00
|
|
|
i18n::Boundary aBoundary = xBI->getWordBoundary( maText, aSel.Max(), GetSettings().GetLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES, sal_True );
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( aBoundary.startPos == aSel.Max() )
|
2000-11-20 16:52:32 +00:00
|
|
|
aBoundary = xBI->previousWord( maText, aSel.Max(), GetSettings().GetLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES );
|
2000-09-18 16:07:07 +00:00
|
|
|
aSel.Max() = aBoundary.startPos;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sal_Int32 nCount = 1;
|
2000-11-20 16:52:32 +00:00
|
|
|
aSel.Max() = xBI->previousCharacters( maText, aSel.Max(), GetSettings().GetLocale(), i18n::CharacterIteratorMode::SKIPCHARACTER, nCount, nCount );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
2009-01-02 15:26:18 +00:00
|
|
|
else if ( bGoRight && ( aSel.Max() < maText.Len() ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( bWord )
|
|
|
|
{
|
2000-11-20 16:52:32 +00:00
|
|
|
i18n::Boundary aBoundary = xBI->nextWord( maText, aSel.Max(), GetSettings().GetLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES );
|
2000-09-18 16:07:07 +00:00
|
|
|
aSel.Max() = aBoundary.startPos;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sal_Int32 nCount = 1;
|
2000-11-20 16:52:32 +00:00
|
|
|
aSel.Max() = xBI->nextCharacters( maText, aSel.Max(), GetSettings().GetLocale(), i18n::CharacterIteratorMode::SKIPCHARACTER, nCount, nCount );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
2009-01-02 15:26:18 +00:00
|
|
|
else if ( bGoHome )
|
|
|
|
{
|
2000-09-18 16:07:07 +00:00
|
|
|
aSel.Max() = 0;
|
2009-01-02 15:26:18 +00:00
|
|
|
}
|
|
|
|
else if ( bGoEnd )
|
|
|
|
{
|
2000-09-18 16:07:07 +00:00
|
|
|
aSel.Max() = 0xFFFF;
|
2009-01-02 15:26:18 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2009-01-02 15:26:18 +00:00
|
|
|
if ( !bSelect )
|
2000-09-18 16:07:07 +00:00
|
|
|
aSel.Min() = aSel.Max();
|
|
|
|
|
2001-08-20 10:09:37 +00:00
|
|
|
if ( aSel != GetSelection() )
|
|
|
|
{
|
|
|
|
ImplSetSelection( aSel );
|
2003-03-27 16:59:30 +00:00
|
|
|
ImplCopyToSelectionClipboard();
|
2001-08-20 10:09:37 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2009-01-02 15:26:18 +00:00
|
|
|
if ( bGoEnd && maAutocompleteHdl.IsSet() && !rKEvt.GetKeyCode().GetModifier() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( (maSelection.Min() == maSelection.Max()) && (maSelection.Min() == maText.Len()) )
|
|
|
|
{
|
|
|
|
meAutocompleteAction = AUTOCOMPLETE_KEYINPUT;
|
|
|
|
maAutocompleteHdl.Call( this );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
bDone = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2009-01-02 15:26:18 +00:00
|
|
|
case com::sun::star::awt::Key::DELETE_WORD_BACKWARD:
|
|
|
|
case com::sun::star::awt::Key::DELETE_WORD_FORWARD:
|
|
|
|
case com::sun::star::awt::Key::DELETE_TO_BEGIN_OF_LINE:
|
|
|
|
case com::sun::star::awt::Key::DELETE_TO_END_OF_LINE:
|
2000-09-18 16:07:07 +00:00
|
|
|
case KEY_BACKSPACE:
|
|
|
|
case KEY_DELETE:
|
|
|
|
{
|
|
|
|
if ( !mbReadOnly && !rKEvt.GetKeyCode().IsMod2() )
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt8 nDel = (nCode == KEY_DELETE) ? EDIT_DEL_RIGHT : EDIT_DEL_LEFT;
|
|
|
|
sal_uInt8 nMode = rKEvt.GetKeyCode().IsMod1() ? EDIT_DELMODE_RESTOFWORD : EDIT_DELMODE_SIMPLE;
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( (nMode == EDIT_DELMODE_RESTOFWORD) && rKEvt.GetKeyCode().IsShift() )
|
|
|
|
nMode = EDIT_DELMODE_RESTOFCONTENT;
|
2009-01-02 15:26:18 +00:00
|
|
|
switch( nCode )
|
|
|
|
{
|
|
|
|
case com::sun::star::awt::Key::DELETE_WORD_BACKWARD:
|
|
|
|
nDel = EDIT_DEL_LEFT;
|
|
|
|
nMode = EDIT_DELMODE_RESTOFWORD;
|
|
|
|
break;
|
|
|
|
case com::sun::star::awt::Key::DELETE_WORD_FORWARD:
|
|
|
|
nDel = EDIT_DEL_RIGHT;
|
|
|
|
nMode = EDIT_DELMODE_RESTOFWORD;
|
|
|
|
break;
|
|
|
|
case com::sun::star::awt::Key::DELETE_TO_BEGIN_OF_LINE:
|
|
|
|
nDel = EDIT_DEL_LEFT;
|
|
|
|
nMode = EDIT_DELMODE_RESTOFCONTENT;
|
|
|
|
break;
|
|
|
|
case com::sun::star::awt::Key::DELETE_TO_END_OF_LINE:
|
|
|
|
nDel = EDIT_DEL_RIGHT;
|
|
|
|
nMode = EDIT_DELMODE_RESTOFCONTENT;
|
|
|
|
break;
|
|
|
|
default: break;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
xub_StrLen nOldLen = maText.Len();
|
|
|
|
ImplDelete( maSelection, nDel, nMode );
|
|
|
|
if ( maText.Len() != nOldLen )
|
|
|
|
ImplModified();
|
2010-09-29 15:46:40 +08:00
|
|
|
bDone = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case KEY_INSERT:
|
|
|
|
{
|
2001-06-12 13:42:19 +00:00
|
|
|
if ( !mpIMEInfos && !mbReadOnly && !rKEvt.GetKeyCode().IsMod2() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
SetInsertMode( !mbInsertMode );
|
2010-09-29 15:46:40 +08:00
|
|
|
bDone = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2010-10-11 16:41:16 +02:00
|
|
|
/* #i101255# disable autocomplete tab forward/backward
|
|
|
|
users expect tab/shif-tab to move the focus to other controls
|
|
|
|
not suddenly to cycle the autocompletion
|
2000-09-18 16:07:07 +00:00
|
|
|
case KEY_TAB:
|
|
|
|
{
|
|
|
|
if ( !mbReadOnly && maAutocompleteHdl.IsSet() &&
|
|
|
|
maSelection.Min() && (maSelection.Min() == maText.Len()) &&
|
|
|
|
!rKEvt.GetKeyCode().IsMod1() && !rKEvt.GetKeyCode().IsMod2() )
|
|
|
|
{
|
|
|
|
// Kein Autocomplete wenn alles Selektiert oder Edit leer, weil dann
|
|
|
|
// keine vernuenftige Tab-Steuerung!
|
|
|
|
if ( rKEvt.GetKeyCode().IsShift() )
|
|
|
|
meAutocompleteAction = AUTOCOMPLETE_TABBACKWARD;
|
|
|
|
else
|
|
|
|
meAutocompleteAction = AUTOCOMPLETE_TABFORWARD;
|
|
|
|
|
|
|
|
maAutocompleteHdl.Call( this );
|
|
|
|
|
|
|
|
// Wurde nichts veraendert, dann TAB fuer DialogControl
|
|
|
|
if ( GetSelection().Len() )
|
2010-09-29 15:46:40 +08:00
|
|
|
bDone = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2010-10-11 16:41:16 +02:00
|
|
|
*/
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
if ( IsCharInput( rKEvt ) )
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
bDone = sal_True; // Auch bei ReadOnly die Zeichen schlucken.
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !mbReadOnly )
|
|
|
|
{
|
2006-03-14 08:42:11 +00:00
|
|
|
ImplInsertText( rKEvt.GetCharCode(), 0, sal_True );
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( maAutocompleteHdl.IsSet() )
|
|
|
|
{
|
|
|
|
if ( (maSelection.Min() == maSelection.Max()) && (maSelection.Min() == maText.Len()) )
|
|
|
|
{
|
|
|
|
meAutocompleteAction = AUTOCOMPLETE_KEYINPUT;
|
|
|
|
maAutocompleteHdl.Call( this );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( mbInternModified )
|
|
|
|
ImplModified();
|
|
|
|
|
|
|
|
return bDone;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Edit::KeyInput( const KeyEvent& rKEvt )
|
|
|
|
{
|
2008-07-21 11:10:40 +00:00
|
|
|
if ( mpUpdateDataTimer && !mbIsSubEdit && mpUpdateDataTimer->IsActive() )
|
|
|
|
mpUpdateDataTimer->Start();//do not update while the user is still travelling in the control
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( mpSubEdit || !ImplHandleKeyEvent( rKEvt ) )
|
|
|
|
Control::KeyInput( rKEvt );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2002-04-29 16:46:18 +00:00
|
|
|
void Edit::FillLayoutData() const
|
|
|
|
{
|
2009-09-14 12:09:22 +00:00
|
|
|
mpControlData->mpLayoutData = new vcl::ControlLayoutData();
|
2002-05-03 12:04:12 +00:00
|
|
|
const_cast<Edit*>(this)->ImplRepaint( 0, STRING_LEN, true );
|
2002-04-29 16:46:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
void Edit::Paint( const Rectangle& )
|
|
|
|
{
|
|
|
|
if ( !mpSubEdit )
|
|
|
|
ImplRepaint();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Edit::Resize()
|
|
|
|
{
|
|
|
|
if ( !mpSubEdit && IsReallyVisible() )
|
|
|
|
{
|
2002-05-08 15:05:42 +00:00
|
|
|
Control::Resize();
|
2000-09-18 16:07:07 +00:00
|
|
|
// Wegen vertikaler Zentrierung...
|
|
|
|
mnXOffset = 0;
|
|
|
|
ImplAlign();
|
|
|
|
Invalidate();
|
|
|
|
ImplShowCursor();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2011-01-12 15:07:10 +01:00
|
|
|
void Edit::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
ImplInitSettings( sal_True, sal_True, sal_True );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
Point aPos = pDev->LogicToPixel( rPos );
|
|
|
|
Size aSize = pDev->LogicToPixel( rSize );
|
|
|
|
Font aFont = GetDrawPixelFont( pDev );
|
|
|
|
OutDevType eOutDevType = pDev->GetOutDevType();
|
|
|
|
|
|
|
|
pDev->Push();
|
|
|
|
pDev->SetMapMode();
|
|
|
|
pDev->SetFont( aFont );
|
|
|
|
pDev->SetTextFillColor();
|
|
|
|
|
|
|
|
// Border/Background
|
|
|
|
pDev->SetLineColor();
|
|
|
|
pDev->SetFillColor();
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_Bool bBorder = !(nFlags & WINDOW_DRAW_NOBORDER ) && (GetStyle() & WB_BORDER);
|
|
|
|
sal_Bool bBackground = !(nFlags & WINDOW_DRAW_NOBACKGROUND) && IsControlBackground();
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( bBorder || bBackground )
|
|
|
|
{
|
|
|
|
Rectangle aRect( aPos, aSize );
|
|
|
|
if ( bBorder )
|
|
|
|
{
|
2004-09-08 16:47:35 +00:00
|
|
|
ImplDrawFrame( pDev, aRect );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
if ( bBackground )
|
|
|
|
{
|
|
|
|
pDev->SetFillColor( GetControlBackground() );
|
|
|
|
pDev->DrawRect( aRect );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Inhalt
|
|
|
|
if ( ( nFlags & WINDOW_DRAW_MONO ) || ( eOutDevType == OUTDEV_PRINTER ) )
|
|
|
|
pDev->SetTextColor( Color( COL_BLACK ) );
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( !(nFlags & WINDOW_DRAW_NODISABLE ) && !IsEnabled() )
|
|
|
|
{
|
|
|
|
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
|
|
|
|
pDev->SetTextColor( rStyleSettings.GetDisableColor() );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pDev->SetTextColor( GetTextColor() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
XubString aText = ImplGetText();
|
|
|
|
long nTextHeight = pDev->GetTextHeight();
|
|
|
|
long nTextWidth = pDev->GetTextWidth( aText );
|
|
|
|
long nOnePixel = GetDrawPixel( pDev, 1 );
|
|
|
|
long nOffX = 3*nOnePixel;
|
|
|
|
long nOffY = (aSize.Height() - nTextHeight) / 2;
|
|
|
|
|
|
|
|
// Clipping?
|
|
|
|
if ( (nOffY < 0) ||
|
|
|
|
((nOffY+nTextHeight) > aSize.Height()) ||
|
|
|
|
((nOffX+nTextWidth) > aSize.Width()) )
|
|
|
|
{
|
|
|
|
Rectangle aClip( aPos, aSize );
|
|
|
|
if ( nTextHeight > aSize.Height() )
|
|
|
|
aClip.Bottom() += nTextHeight-aSize.Height()+1; // Damit HP-Drucker nicht 'weg-optimieren'
|
|
|
|
pDev->IntersectClipRegion( aClip );
|
|
|
|
}
|
|
|
|
|
2004-07-05 14:42:12 +00:00
|
|
|
if ( GetStyle() & WB_CENTER )
|
|
|
|
{
|
|
|
|
aPos.X() += (aSize.Width() - nTextWidth) / 2;
|
|
|
|
nOffX = 0;
|
|
|
|
}
|
|
|
|
else if ( GetStyle() & WB_RIGHT )
|
|
|
|
{
|
|
|
|
aPos.X() += aSize.Width() - nTextWidth;
|
|
|
|
nOffX = -nOffX;
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
pDev->DrawText( Point( aPos.X() + nOffX, aPos.Y() + nOffY ), aText );
|
|
|
|
pDev->Pop();
|
2003-06-12 07:18:42 +00:00
|
|
|
|
|
|
|
if ( GetSubEdit() )
|
|
|
|
{
|
|
|
|
GetSubEdit()->Draw( pDev, rPos, rSize, nFlags );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2008-03-05 16:07:56 +00:00
|
|
|
void Edit::ImplInvalidateOutermostBorder( Window* pWin )
|
2007-08-03 13:07:02 +00:00
|
|
|
{
|
|
|
|
// allow control to show focused state
|
|
|
|
Window *pInvalWin = pWin, *pBorder = pWin;
|
|
|
|
while( ( pBorder = pInvalWin->GetWindow( WINDOW_BORDER ) ) != pInvalWin && pBorder &&
|
|
|
|
pInvalWin->ImplGetFrame() == pBorder->ImplGetFrame() )
|
|
|
|
{
|
|
|
|
pInvalWin = pBorder;
|
|
|
|
}
|
|
|
|
|
|
|
|
pInvalWin->Invalidate( INVALIDATE_CHILDREN | INVALIDATE_UPDATE );
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
void Edit::GetFocus()
|
|
|
|
{
|
|
|
|
if ( mpSubEdit )
|
|
|
|
mpSubEdit->ImplGrabFocus( GetGetFocusFlags() );
|
|
|
|
else if ( !mbActivePopup )
|
|
|
|
{
|
|
|
|
maUndoText = maText;
|
|
|
|
|
2011-01-12 15:07:10 +01:00
|
|
|
sal_uLong nSelOptions = GetSettings().GetStyleSettings().GetSelectionOptions();
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !( GetStyle() & (WB_NOHIDESELECTION|WB_READONLY) )
|
|
|
|
&& ( GetGetFocusFlags() & (GETFOCUS_INIT|GETFOCUS_TAB|GETFOCUS_CURSOR|GETFOCUS_MNEMONIC) ) )
|
|
|
|
{
|
|
|
|
if ( nSelOptions & SELECTION_OPTION_SHOWFIRST )
|
|
|
|
{
|
|
|
|
maSelection.Min() = maText.Len();
|
|
|
|
maSelection.Max() = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
maSelection.Min() = 0;
|
|
|
|
maSelection.Max() = maText.Len();
|
|
|
|
}
|
2002-11-28 12:24:50 +00:00
|
|
|
if ( mbIsSubEdit )
|
|
|
|
((Edit*)GetParent())->ImplCallEventListeners( VCLEVENT_EDIT_SELECTIONCHANGED );
|
|
|
|
else
|
|
|
|
ImplCallEventListeners( VCLEVENT_EDIT_SELECTIONCHANGED );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ImplShowCursor();
|
|
|
|
|
2007-08-03 13:07:02 +00:00
|
|
|
// FIXME: this is currently only on aqua
|
|
|
|
// check for other platforms that need similar handling
|
|
|
|
if( ImplGetSVData()->maNWFData.mbNoFocusRects &&
|
|
|
|
IsNativeWidgetEnabled() &&
|
|
|
|
IsNativeControlSupported( CTRL_EDITBOX, PART_ENTIRE_CONTROL ) )
|
|
|
|
{
|
2007-09-13 15:32:52 +00:00
|
|
|
ImplInvalidateOutermostBorder( mbIsSubEdit ? GetParent() : this );
|
2007-08-03 13:07:02 +00:00
|
|
|
}
|
|
|
|
else if ( maSelection.Len() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
// Selektion malen
|
|
|
|
if ( !HasPaintEvent() )
|
2007-04-26 09:36:22 +00:00
|
|
|
ImplInvalidateOrRepaint();
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
Invalidate();
|
|
|
|
}
|
|
|
|
|
2000-11-08 08:17:31 +00:00
|
|
|
SetInputContext( InputContext( GetFont(), !IsReadOnly() ? INPUTCONTEXT_TEXT|INPUTCONTEXT_EXTTEXTINPUT : 0 ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Control::GetFocus();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2002-07-03 09:36:01 +00:00
|
|
|
Window* Edit::GetPreferredKeyInputWindow()
|
|
|
|
{
|
|
|
|
if ( mpSubEdit )
|
|
|
|
return mpSubEdit->GetPreferredKeyInputWindow();
|
|
|
|
else
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
void Edit::LoseFocus()
|
|
|
|
{
|
2008-07-21 11:10:40 +00:00
|
|
|
if ( mpUpdateDataTimer && !mbIsSubEdit && mpUpdateDataTimer->IsActive() )
|
|
|
|
{
|
|
|
|
//notify an update latest when the focus is lost
|
|
|
|
mpUpdateDataTimer->Stop();
|
|
|
|
mpUpdateDataTimer->Timeout();
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !mpSubEdit )
|
|
|
|
{
|
2007-08-03 13:07:02 +00:00
|
|
|
// FIXME: this is currently only on aqua
|
|
|
|
// check for other platforms that need similar handling
|
|
|
|
if( ImplGetSVData()->maNWFData.mbNoFocusRects &&
|
|
|
|
IsNativeWidgetEnabled() &&
|
|
|
|
IsNativeControlSupported( CTRL_EDITBOX, PART_ENTIRE_CONTROL ) )
|
|
|
|
{
|
2007-09-13 15:32:52 +00:00
|
|
|
ImplInvalidateOutermostBorder( mbIsSubEdit ? GetParent() : this );
|
2007-08-03 13:07:02 +00:00
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !mbActivePopup && !( GetStyle() & WB_NOHIDESELECTION ) && maSelection.Len() )
|
2007-04-26 09:36:22 +00:00
|
|
|
ImplInvalidateOrRepaint(); // Selektion malen
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Control::LoseFocus();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Edit::Command( const CommandEvent& rCEvt )
|
|
|
|
{
|
2001-02-14 07:32:01 +00:00
|
|
|
if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
PopupMenu* pPopup = Edit::CreatePopupMenu();
|
|
|
|
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
|
|
|
|
if ( rStyleSettings.GetOptions() & STYLE_OPTION_HIDEDISABLED )
|
|
|
|
pPopup->SetMenuFlags( MENU_FLAG_HIDEDISABLEDENTRIES );
|
|
|
|
|
|
|
|
if ( !maSelection.Len() )
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
pPopup->EnableItem( SV_MENU_EDIT_CUT, sal_False );
|
|
|
|
pPopup->EnableItem( SV_MENU_EDIT_COPY, sal_False );
|
|
|
|
pPopup->EnableItem( SV_MENU_EDIT_DELETE, sal_False );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( IsReadOnly() )
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
pPopup->EnableItem( SV_MENU_EDIT_CUT, sal_False );
|
|
|
|
pPopup->EnableItem( SV_MENU_EDIT_PASTE, sal_False );
|
|
|
|
pPopup->EnableItem( SV_MENU_EDIT_DELETE, sal_False );
|
|
|
|
pPopup->EnableItem( SV_MENU_EDIT_INSERTSYMBOL, sal_False );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Paste nur, wenn Text im Clipboard
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_Bool bData = sal_False;
|
2001-05-04 08:50:19 +00:00
|
|
|
uno::Reference< datatransfer::clipboard::XClipboard > xClipboard = GetClipboard();
|
2001-02-12 11:57:52 +00:00
|
|
|
if ( xClipboard.is() )
|
|
|
|
{
|
2001-03-07 09:30:39 +00:00
|
|
|
const sal_uInt32 nRef = Application::ReleaseSolarMutex();
|
2001-02-12 11:57:52 +00:00
|
|
|
uno::Reference< datatransfer::XTransferable > xDataObj = xClipboard->getContents();
|
2001-03-07 09:30:39 +00:00
|
|
|
Application::AcquireSolarMutex( nRef );
|
2001-02-12 11:57:52 +00:00
|
|
|
if ( xDataObj.is() )
|
|
|
|
{
|
|
|
|
datatransfer::DataFlavor aFlavor;
|
|
|
|
SotExchange::GetFormatDataFlavor( SOT_FORMAT_STRING, aFlavor );
|
|
|
|
bData = xDataObj->isDataFlavorSupported( aFlavor );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pPopup->EnableItem( SV_MENU_EDIT_PASTE, bData );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( maUndoText == maText )
|
2010-09-29 15:46:40 +08:00
|
|
|
pPopup->EnableItem( SV_MENU_EDIT_UNDO, sal_False );
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( ( maSelection.Min() == 0 ) && ( maSelection.Max() == maText.Len() ) )
|
2010-09-29 15:46:40 +08:00
|
|
|
pPopup->EnableItem( SV_MENU_EDIT_SELECTALL, sal_False );
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !pImplFncGetSpecialChars )
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 nPos = pPopup->GetItemPos( SV_MENU_EDIT_INSERTSYMBOL );
|
2000-09-18 16:07:07 +00:00
|
|
|
pPopup->RemoveItem( nPos );
|
|
|
|
pPopup->RemoveItem( nPos-1 );
|
|
|
|
}
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
mbActivePopup = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
Selection aSaveSel = GetSelection(); // Falls jemand in Get/LoseFocus die Selektion verbiegt, z.B. URL-Zeile...
|
|
|
|
Point aPos = rCEvt.GetMousePosPixel();
|
|
|
|
if ( !rCEvt.IsMouseEvent() )
|
|
|
|
{
|
|
|
|
// !!! Irgendwann einmal Menu zentriert in der Selektion anzeigen !!!
|
|
|
|
Size aSize = GetOutputSizePixel();
|
|
|
|
aPos = Point( aSize.Width()/2, aSize.Height()/2 );
|
|
|
|
}
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 n = pPopup->Execute( this, aPos );
|
2000-09-18 16:07:07 +00:00
|
|
|
Edit::DeletePopupMenu( pPopup );
|
|
|
|
SetSelection( aSaveSel );
|
|
|
|
switch ( n )
|
|
|
|
{
|
|
|
|
case SV_MENU_EDIT_UNDO:
|
|
|
|
Undo();
|
|
|
|
ImplModified();
|
|
|
|
break;
|
|
|
|
case SV_MENU_EDIT_CUT:
|
|
|
|
Cut();
|
|
|
|
ImplModified();
|
|
|
|
break;
|
|
|
|
case SV_MENU_EDIT_COPY:
|
|
|
|
Copy();
|
|
|
|
break;
|
|
|
|
case SV_MENU_EDIT_PASTE:
|
|
|
|
Paste();
|
|
|
|
ImplModified();
|
|
|
|
break;
|
|
|
|
case SV_MENU_EDIT_DELETE:
|
|
|
|
DeleteSelected();
|
|
|
|
ImplModified();
|
|
|
|
break;
|
|
|
|
case SV_MENU_EDIT_SELECTALL:
|
|
|
|
ImplSetSelection( Selection( 0, maText.Len() ) );
|
|
|
|
break;
|
|
|
|
case SV_MENU_EDIT_INSERTSYMBOL:
|
|
|
|
{
|
|
|
|
XubString aChars = pImplFncGetSpecialChars( this, GetFont() );
|
|
|
|
SetSelection( aSaveSel );
|
|
|
|
if ( aChars.Len() )
|
|
|
|
{
|
|
|
|
ImplInsertText( aChars );
|
|
|
|
ImplModified();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2010-09-29 15:46:40 +08:00
|
|
|
mbActivePopup = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else if ( rCEvt.GetCommand() == COMMAND_VOICE )
|
|
|
|
{
|
|
|
|
const CommandVoiceData* pData = rCEvt.GetVoiceData();
|
|
|
|
if ( pData->GetType() == VOICECOMMANDTYPE_DICTATION )
|
|
|
|
{
|
|
|
|
switch ( pData->GetCommand() )
|
|
|
|
{
|
|
|
|
case DICTATIONCOMMAND_UNKNOWN:
|
|
|
|
{
|
|
|
|
ReplaceSelected( pData->GetText() );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DICTATIONCOMMAND_LEFT:
|
|
|
|
{
|
|
|
|
ImplHandleKeyEvent( KeyEvent( 0, KeyCode( KEY_LEFT, KEY_MOD1 ) ) );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DICTATIONCOMMAND_RIGHT:
|
|
|
|
{
|
|
|
|
ImplHandleKeyEvent( KeyEvent( 0, KeyCode( KEY_RIGHT, KEY_MOD1 ) ) );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DICTATIONCOMMAND_UNDO:
|
|
|
|
{
|
|
|
|
Undo();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DICTATIONCOMMAND_DEL:
|
|
|
|
{
|
|
|
|
ImplHandleKeyEvent( KeyEvent( 0, KeyCode( KEY_LEFT, KEY_MOD1|KEY_SHIFT ) ) );
|
|
|
|
DeleteSelected();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ( rCEvt.GetCommand() == COMMAND_STARTEXTTEXTINPUT )
|
|
|
|
{
|
|
|
|
DeleteSelected();
|
|
|
|
delete mpIMEInfos;
|
2001-06-12 13:42:19 +00:00
|
|
|
xub_StrLen nPos = (xub_StrLen)maSelection.Max();
|
|
|
|
mpIMEInfos = new Impl_IMEInfos( nPos, maText.Copy( nPos ) );
|
2000-11-08 08:17:31 +00:00
|
|
|
mpIMEInfos->bWasCursorOverwrite = !IsInsertMode();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else if ( rCEvt.GetCommand() == COMMAND_ENDEXTTEXTINPUT )
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_Bool bInsertMode = !mpIMEInfos->bWasCursorOverwrite;
|
2000-09-18 16:07:07 +00:00
|
|
|
delete mpIMEInfos;
|
|
|
|
mpIMEInfos = NULL;
|
|
|
|
// Font wieder ohne Attribute einstellen, wird jetzt im Repaint nicht
|
|
|
|
// mehr neu initialisiert
|
2010-09-29 15:46:40 +08:00
|
|
|
ImplInitSettings( sal_True, sal_False, sal_False );
|
2000-11-08 08:17:31 +00:00
|
|
|
|
|
|
|
SetInsertMode( bInsertMode );
|
2001-03-28 14:02:50 +00:00
|
|
|
|
|
|
|
ImplModified();
|
2004-05-10 14:46:40 +00:00
|
|
|
|
|
|
|
// #i25161# call auto complete handler for ext text commit also
|
|
|
|
if ( maAutocompleteHdl.IsSet() )
|
|
|
|
{
|
|
|
|
if ( (maSelection.Min() == maSelection.Max()) && (maSelection.Min() == maText.Len()) )
|
|
|
|
{
|
|
|
|
meAutocompleteAction = AUTOCOMPLETE_KEYINPUT;
|
|
|
|
maAutocompleteHdl.Call( this );
|
|
|
|
}
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else if ( rCEvt.GetCommand() == COMMAND_EXTTEXTINPUT )
|
|
|
|
{
|
|
|
|
const CommandExtTextInputData* pData = rCEvt.GetExtTextInputData();
|
|
|
|
|
|
|
|
maText.Erase( mpIMEInfos->nPos, mpIMEInfos->nLen );
|
|
|
|
maText.Insert( pData->GetText(), mpIMEInfos->nPos );
|
2001-06-12 13:42:19 +00:00
|
|
|
if ( mpIMEInfos->bWasCursorOverwrite )
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 nOldIMETextLen = mpIMEInfos->nLen;
|
|
|
|
sal_uInt16 nNewIMETextLen = pData->GetText().Len();
|
2001-06-12 13:42:19 +00:00
|
|
|
if ( ( nOldIMETextLen > nNewIMETextLen ) &&
|
|
|
|
( nNewIMETextLen < mpIMEInfos->aOldTextAfterStartPos.Len() ) )
|
|
|
|
{
|
|
|
|
// restore old characters
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 nRestore = nOldIMETextLen - nNewIMETextLen;
|
2001-06-12 13:42:19 +00:00
|
|
|
maText.Insert( mpIMEInfos->aOldTextAfterStartPos.Copy( nNewIMETextLen, nRestore ), mpIMEInfos->nPos + nNewIMETextLen );
|
|
|
|
}
|
|
|
|
else if ( ( nOldIMETextLen < nNewIMETextLen ) &&
|
2001-06-13 09:30:29 +00:00
|
|
|
( nOldIMETextLen < mpIMEInfos->aOldTextAfterStartPos.Len() ) )
|
2001-06-12 13:42:19 +00:00
|
|
|
{
|
|
|
|
// overwrite
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 nOverwrite = nNewIMETextLen - nOldIMETextLen;
|
2001-06-13 09:30:29 +00:00
|
|
|
if ( ( nOldIMETextLen + nOverwrite ) > mpIMEInfos->aOldTextAfterStartPos.Len() )
|
|
|
|
nOverwrite = mpIMEInfos->aOldTextAfterStartPos.Len() - nOldIMETextLen;
|
2001-06-12 13:42:19 +00:00
|
|
|
maText.Erase( mpIMEInfos->nPos + nNewIMETextLen, nOverwrite );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( pData->GetTextAttr() )
|
|
|
|
{
|
|
|
|
mpIMEInfos->CopyAttribs( pData->GetTextAttr(), pData->GetText().Len() );
|
|
|
|
mpIMEInfos->bCursor = pData->IsCursorVisible();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mpIMEInfos->DestroyAttribs();
|
|
|
|
}
|
|
|
|
|
2006-06-19 18:16:09 +00:00
|
|
|
ImplAlignAndPaint();
|
2000-09-18 16:07:07 +00:00
|
|
|
xub_StrLen nCursorPos = mpIMEInfos->nPos + pData->GetCursorPos();
|
|
|
|
SetSelection( Selection( nCursorPos, nCursorPos ) );
|
2000-11-08 08:17:31 +00:00
|
|
|
SetInsertMode( !pData->IsCursorOverwrite() );
|
2000-11-08 09:47:49 +00:00
|
|
|
|
|
|
|
if ( pData->IsCursorVisible() )
|
|
|
|
GetCursor()->Show();
|
|
|
|
else
|
|
|
|
GetCursor()->Hide();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2000-11-08 08:17:31 +00:00
|
|
|
else if ( rCEvt.GetCommand() == COMMAND_CURSORPOS )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2000-11-08 08:17:31 +00:00
|
|
|
if ( mpIMEInfos )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
xub_StrLen nCursorPos = (sal_uInt16)GetSelection().Max();
|
2000-11-08 08:17:31 +00:00
|
|
|
SetCursorRect( NULL, GetTextWidth(
|
|
|
|
maText, nCursorPos, mpIMEInfos->nPos+mpIMEInfos->nLen-nCursorPos ) );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2001-08-08 09:40:38 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
SetCursorRect();
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2008-10-29 09:25:50 +00:00
|
|
|
else if ( rCEvt.GetCommand() == COMMAND_SELECTIONCHANGE )
|
|
|
|
{
|
|
|
|
const CommandSelectionChangeData *pData = rCEvt.GetSelectionChangeData();
|
|
|
|
Selection aSelection( pData->GetStart(), pData->GetEnd() );
|
|
|
|
SetSelection(aSelection);
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
Control::Command( rCEvt );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Edit::StateChanged( StateChangedType nType )
|
|
|
|
{
|
|
|
|
if ( nType == STATE_CHANGE_INITSHOW )
|
|
|
|
{
|
|
|
|
if ( !mpSubEdit )
|
|
|
|
{
|
|
|
|
mnXOffset = 0; // Falls vorher GrabFocus, als Groesse noch falsch.
|
|
|
|
ImplAlign();
|
|
|
|
if ( !mpSubEdit )
|
2010-09-29 15:46:40 +08:00
|
|
|
ImplShowCursor( sal_False );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2007-04-26 09:36:22 +00:00
|
|
|
// update background (eventual SetPaintTransparent)
|
2010-09-29 15:46:40 +08:00
|
|
|
ImplInitSettings( sal_False, sal_False, sal_True );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else if ( nType == STATE_CHANGE_ENABLE )
|
|
|
|
{
|
|
|
|
if ( !mpSubEdit )
|
|
|
|
{
|
|
|
|
// Es aendert sich nur die Textfarbe...
|
2007-04-26 09:36:22 +00:00
|
|
|
ImplInvalidateOrRepaint( 0, 0xFFFF );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
2008-12-16 13:30:53 +00:00
|
|
|
else if ( nType == STATE_CHANGE_STYLE || nType == STATE_CHANGE_MIRRORING )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2008-12-16 13:30:53 +00:00
|
|
|
WinBits nStyle = GetStyle();
|
|
|
|
if( nType == STATE_CHANGE_STYLE )
|
|
|
|
{
|
|
|
|
nStyle = ImplInitStyle( GetStyle() );
|
|
|
|
SetStyle( nStyle );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 nOldAlign = mnAlign;
|
2000-09-18 16:07:07 +00:00
|
|
|
mnAlign = EDIT_ALIGN_LEFT;
|
2002-09-12 07:35:13 +00:00
|
|
|
|
|
|
|
// --- RTL --- hack: right align until keyinput and cursor travelling works
|
2008-12-16 13:30:53 +00:00
|
|
|
// edits are always RTL disabled
|
|
|
|
// however the parent edits contain the correct setting
|
|
|
|
if( mbIsSubEdit && GetParent()->IsRTLEnabled() )
|
|
|
|
{
|
|
|
|
if( GetParent()->GetStyle() & WB_LEFT )
|
|
|
|
mnAlign = EDIT_ALIGN_RIGHT;
|
|
|
|
if ( nType == STATE_CHANGE_MIRRORING )
|
|
|
|
SetLayoutMode( TEXT_LAYOUT_BIDI_RTL | TEXT_LAYOUT_TEXTORIGIN_LEFT );
|
|
|
|
}
|
|
|
|
else if( mbIsSubEdit && !GetParent()->IsRTLEnabled() )
|
|
|
|
{
|
|
|
|
if ( nType == STATE_CHANGE_MIRRORING )
|
|
|
|
SetLayoutMode( TEXT_LAYOUT_BIDI_LTR | TEXT_LAYOUT_TEXTORIGIN_LEFT );
|
|
|
|
}
|
2002-09-12 07:35:13 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( nStyle & WB_RIGHT )
|
|
|
|
mnAlign = EDIT_ALIGN_RIGHT;
|
|
|
|
else if ( nStyle & WB_CENTER )
|
|
|
|
mnAlign = EDIT_ALIGN_CENTER;
|
|
|
|
if ( maText.Len() && ( mnAlign != nOldAlign ) )
|
|
|
|
{
|
|
|
|
ImplAlign();
|
|
|
|
Invalidate();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else if ( nType == STATE_CHANGE_ZOOM )
|
|
|
|
{
|
|
|
|
if ( !mpSubEdit )
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
ImplInitSettings( sal_True, sal_False, sal_False );
|
|
|
|
ImplShowCursor( sal_True );
|
2000-09-18 16:07:07 +00:00
|
|
|
Invalidate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ( nType == STATE_CHANGE_CONTROLFONT )
|
|
|
|
{
|
|
|
|
if ( !mpSubEdit )
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
ImplInitSettings( sal_True, sal_False, sal_False );
|
2000-09-18 16:07:07 +00:00
|
|
|
ImplShowCursor();
|
|
|
|
Invalidate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
|
|
|
|
{
|
|
|
|
if ( !mpSubEdit )
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
ImplInitSettings( sal_False, sal_True, sal_False );
|
2000-09-18 16:07:07 +00:00
|
|
|
Invalidate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
|
|
|
|
{
|
|
|
|
if ( !mpSubEdit )
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
ImplInitSettings( sal_False, sal_False, sal_True );
|
2000-09-18 16:07:07 +00:00
|
|
|
Invalidate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Control::StateChanged( nType );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Edit::DataChanged( const DataChangedEvent& rDCEvt )
|
|
|
|
{
|
|
|
|
if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
|
|
|
|
(rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
|
|
|
|
((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
|
|
|
|
(rDCEvt.GetFlags() & SETTINGS_STYLE)) )
|
|
|
|
{
|
|
|
|
if ( !mpSubEdit )
|
|
|
|
{
|
2010-09-29 15:46:40 +08:00
|
|
|
ImplInitSettings( sal_True, sal_True, sal_True );
|
|
|
|
ImplShowCursor( sal_True );
|
2000-09-18 16:07:07 +00:00
|
|
|
Invalidate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Control::DataChanged( rDCEvt );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Edit::ImplShowDDCursor()
|
|
|
|
{
|
|
|
|
if ( !mpDDInfo->bVisCursor )
|
|
|
|
{
|
|
|
|
long nTextWidth = GetTextWidth( maText, 0, mpDDInfo->nDropPos );
|
|
|
|
long nTextHeight = GetTextHeight();
|
|
|
|
Rectangle aCursorRect( Point( nTextWidth + mnXOffset, (GetOutputSize().Height()-nTextHeight)/2 ), Size( 2, nTextHeight ) );
|
|
|
|
mpDDInfo->aCursor.SetWindow( this );
|
|
|
|
mpDDInfo->aCursor.SetPos( aCursorRect.TopLeft() );
|
|
|
|
mpDDInfo->aCursor.SetSize( aCursorRect.GetSize() );
|
|
|
|
mpDDInfo->aCursor.Show();
|
2010-09-29 15:46:40 +08:00
|
|
|
mpDDInfo->bVisCursor = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Edit::ImplHideDDCursor()
|
|
|
|
{
|
|
|
|
if ( mpDDInfo && mpDDInfo->bVisCursor )
|
|
|
|
{
|
|
|
|
mpDDInfo->aCursor.Hide();
|
2010-09-29 15:46:40 +08:00
|
|
|
mpDDInfo->bVisCursor = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Edit::Modify()
|
|
|
|
{
|
2002-09-04 12:08:17 +00:00
|
|
|
if ( mbIsSubEdit )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
((Edit*)GetParent())->Modify();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( mpUpdateDataTimer )
|
|
|
|
mpUpdateDataTimer->Start();
|
|
|
|
|
2004-10-22 11:13:08 +00:00
|
|
|
if ( ImplCallEventListenersAndHandler( VCLEVENT_EDIT_MODIFY, maModifyHdl, this ) )
|
|
|
|
// have been destroyed while calling into the handlers
|
|
|
|
return;
|
2003-05-22 08:38:48 +00:00
|
|
|
|
|
|
|
// #i13677# notify edit listeners about caret position change
|
|
|
|
ImplCallEventListeners( VCLEVENT_EDIT_SELECTIONCHANGED );
|
2008-03-05 16:07:56 +00:00
|
|
|
|
|
|
|
// FIXME: this is currently only on aqua
|
|
|
|
// check for other platforms that need similar handling
|
|
|
|
if( ImplGetSVData()->maNWFData.mbNoFocusRects &&
|
|
|
|
IsNativeWidgetEnabled() &&
|
|
|
|
IsNativeControlSupported( CTRL_EDITBOX, PART_ENTIRE_CONTROL ) )
|
|
|
|
{
|
|
|
|
ImplInvalidateOutermostBorder( this );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Edit::UpdateData()
|
|
|
|
{
|
|
|
|
maUpdateDataHdl.Call( this );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
IMPL_LINK( Edit, ImplUpdateDataHdl, Timer*, EMPTYARG )
|
|
|
|
{
|
|
|
|
UpdateData();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2011-01-12 15:07:10 +01:00
|
|
|
void Edit::EnableUpdateData( sal_uLong nTimeout )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( !nTimeout )
|
|
|
|
DisableUpdateData();
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( !mpUpdateDataTimer )
|
|
|
|
{
|
|
|
|
mpUpdateDataTimer = new Timer;
|
|
|
|
mpUpdateDataTimer->SetTimeoutHdl( LINK( this, Edit, ImplUpdateDataHdl ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
mpUpdateDataTimer->SetTimeout( nTimeout );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Edit::SetEchoChar( xub_Unicode c )
|
|
|
|
{
|
|
|
|
mcEchoChar = c;
|
|
|
|
if ( mpSubEdit )
|
|
|
|
mpSubEdit->SetEchoChar( c );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
void Edit::SetReadOnly( sal_Bool bReadOnly )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( mbReadOnly != bReadOnly )
|
|
|
|
{
|
|
|
|
mbReadOnly = bReadOnly;
|
|
|
|
if ( mpSubEdit )
|
|
|
|
mpSubEdit->SetReadOnly( bReadOnly );
|
|
|
|
|
|
|
|
StateChanged( STATE_CHANGE_READONLY );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Edit::SetAutocompleteHdl( const Link& rHdl )
|
|
|
|
{
|
|
|
|
maAutocompleteHdl = rHdl;
|
|
|
|
if ( mpSubEdit )
|
|
|
|
mpSubEdit->SetAutocompleteHdl( rHdl );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
void Edit::SetInsertMode( sal_Bool bInsert )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( bInsert != mbInsertMode )
|
|
|
|
{
|
|
|
|
mbInsertMode = bInsert;
|
|
|
|
if ( mpSubEdit )
|
|
|
|
mpSubEdit->SetInsertMode( bInsert );
|
|
|
|
else
|
|
|
|
ImplShowCursor();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_Bool Edit::IsInsertMode() const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( mpSubEdit )
|
|
|
|
return mpSubEdit->IsInsertMode();
|
|
|
|
else
|
|
|
|
return mbInsertMode;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Edit::SetMaxTextLen( xub_StrLen nMaxLen )
|
|
|
|
{
|
|
|
|
mnMaxTextLen = nMaxLen ? nMaxLen : EDIT_NOLIMIT;
|
|
|
|
|
|
|
|
if ( mpSubEdit )
|
2007-01-02 14:47:45 +00:00
|
|
|
mpSubEdit->SetMaxTextLen( mnMaxTextLen );
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
{
|
2007-01-02 14:47:45 +00:00
|
|
|
if ( maText.Len() > mnMaxTextLen )
|
|
|
|
ImplDelete( Selection( mnMaxTextLen, maText.Len() ), EDIT_DEL_RIGHT, EDIT_DELMODE_SIMPLE );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Edit::SetSelection( const Selection& rSelection )
|
|
|
|
{
|
|
|
|
// Wenn von aussen z.B. im MouseButtonDown die Selektion geaendert wird,
|
|
|
|
// soll nicht gleich ein Tracking() zuschlagen und die Selektion aendern.
|
|
|
|
if ( IsTracking() )
|
|
|
|
EndTracking();
|
|
|
|
else if ( mpSubEdit && mpSubEdit->IsTracking() )
|
|
|
|
mpSubEdit->EndTracking();
|
|
|
|
|
|
|
|
ImplSetSelection( rSelection );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
void Edit::ImplSetSelection( const Selection& rSelection, sal_Bool bPaint )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if ( mpSubEdit )
|
|
|
|
mpSubEdit->ImplSetSelection( rSelection );
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( rSelection != maSelection )
|
|
|
|
{
|
|
|
|
Selection aOld( maSelection );
|
|
|
|
Selection aNew( rSelection );
|
|
|
|
|
|
|
|
if ( aNew.Min() > maText.Len() )
|
|
|
|
aNew.Min() = maText.Len();
|
|
|
|
if ( aNew.Max() > maText.Len() )
|
|
|
|
aNew.Max() = maText.Len();
|
|
|
|
if ( aNew.Min() < 0 )
|
|
|
|
aNew.Min() = 0;
|
|
|
|
if ( aNew.Max() < 0 )
|
|
|
|
aNew.Max() = 0;
|
|
|
|
|
|
|
|
if ( aNew != maSelection )
|
|
|
|
{
|
2009-09-14 12:09:22 +00:00
|
|
|
ImplClearLayoutData();
|
2000-09-18 16:07:07 +00:00
|
|
|
maSelection = aNew;
|
|
|
|
|
2007-04-26 09:36:22 +00:00
|
|
|
if ( bPaint && ( aOld.Len() || aNew.Len() || IsPaintTransparent() ) )
|
|
|
|
ImplInvalidateOrRepaint( 0, maText.Len() );
|
2000-09-18 16:07:07 +00:00
|
|
|
ImplShowCursor();
|
2002-11-28 12:24:50 +00:00
|
|
|
if ( mbIsSubEdit )
|
|
|
|
((Edit*)GetParent())->ImplCallEventListeners( VCLEVENT_EDIT_SELECTIONCHANGED );
|
|
|
|
else
|
|
|
|
ImplCallEventListeners( VCLEVENT_EDIT_SELECTIONCHANGED );
|
2002-09-20 14:49:17 +00:00
|
|
|
// #103511# notify combobox listeners of deselection
|
|
|
|
if( !maSelection && GetParent() && GetParent()->GetType() == WINDOW_COMBOBOX )
|
|
|
|
((Edit*)GetParent())->ImplCallEventListeners( VCLEVENT_COMBOBOX_DESELECT );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
const Selection& Edit::GetSelection() const
|
|
|
|
{
|
|
|
|
if ( mpSubEdit )
|
|
|
|
return mpSubEdit->GetSelection();
|
|
|
|
else
|
|
|
|
return maSelection;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Edit::ReplaceSelected( const XubString& rStr )
|
|
|
|
{
|
|
|
|
if ( mpSubEdit )
|
|
|
|
mpSubEdit->ReplaceSelected( rStr );
|
|
|
|
else
|
|
|
|
ImplInsertText( rStr );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Edit::DeleteSelected()
|
|
|
|
{
|
|
|
|
if ( mpSubEdit )
|
|
|
|
mpSubEdit->DeleteSelected();
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( maSelection.Len() )
|
|
|
|
ImplDelete( maSelection, EDIT_DEL_RIGHT, EDIT_DELMODE_SIMPLE );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
XubString Edit::GetSelected() const
|
|
|
|
{
|
|
|
|
if ( mpSubEdit )
|
|
|
|
return mpSubEdit->GetSelected();
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Selection aSelection( maSelection );
|
|
|
|
aSelection.Justify();
|
|
|
|
return maText.Copy( (xub_StrLen)aSelection.Min(), (xub_StrLen)aSelection.Len() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Edit::Cut()
|
|
|
|
{
|
|
|
|
if ( !(GetStyle() & WB_PASSWORD ) )
|
|
|
|
{
|
|
|
|
Copy();
|
|
|
|
ReplaceSelected( ImplGetSVEmptyStr() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Edit::Copy()
|
|
|
|
{
|
|
|
|
if ( !(GetStyle() & WB_PASSWORD ) )
|
|
|
|
{
|
2001-09-27 17:05:56 +00:00
|
|
|
::com::sun::star::uno::Reference<com::sun::star::datatransfer::clipboard::XClipboard> aClipboard(GetClipboard());
|
|
|
|
ImplCopy( aClipboard );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Edit::Paste()
|
|
|
|
{
|
2001-09-27 17:05:56 +00:00
|
|
|
::com::sun::star::uno::Reference<com::sun::star::datatransfer::clipboard::XClipboard> aClipboard(GetClipboard());
|
|
|
|
ImplPaste( aClipboard );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Edit::Undo()
|
|
|
|
{
|
|
|
|
if ( mpSubEdit )
|
|
|
|
mpSubEdit->Undo();
|
|
|
|
else
|
|
|
|
{
|
|
|
|
XubString aText( maText );
|
|
|
|
ImplDelete( Selection( 0, aText.Len() ), EDIT_DEL_RIGHT, EDIT_DELMODE_SIMPLE );
|
|
|
|
ImplInsertText( maUndoText );
|
|
|
|
ImplSetSelection( Selection( 0, maUndoText.Len() ) );
|
|
|
|
maUndoText = aText;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Edit::SetText( const XubString& rStr )
|
|
|
|
{
|
|
|
|
if ( mpSubEdit )
|
|
|
|
mpSubEdit->SetText( rStr ); // Nicht direkt ImplSetText, falls SetText ueberladen
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Selection aNewSel( 0, 0 ); // Damit nicht gescrollt wird
|
|
|
|
ImplSetText( rStr, &aNewSel );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Edit::SetText( const XubString& rStr, const Selection& rSelection )
|
|
|
|
{
|
|
|
|
if ( mpSubEdit )
|
|
|
|
mpSubEdit->SetText( rStr, rSelection );
|
|
|
|
else
|
|
|
|
ImplSetText( rStr, &rSelection );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
XubString Edit::GetText() const
|
|
|
|
{
|
|
|
|
if ( mpSubEdit )
|
|
|
|
return mpSubEdit->GetText();
|
|
|
|
else
|
|
|
|
return maText;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Edit::SetModifyFlag()
|
|
|
|
{
|
|
|
|
if ( mpSubEdit )
|
2010-09-29 15:46:40 +08:00
|
|
|
mpSubEdit->mbModified = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2010-09-29 15:46:40 +08:00
|
|
|
mbModified = sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Edit::ClearModifyFlag()
|
|
|
|
{
|
|
|
|
if ( mpSubEdit )
|
2010-09-29 15:46:40 +08:00
|
|
|
mpSubEdit->mbModified = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2010-09-29 15:46:40 +08:00
|
|
|
mbModified = sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Edit::SetSubEdit( Edit* pEdit )
|
|
|
|
{
|
|
|
|
mpSubEdit = pEdit;
|
|
|
|
if ( mpSubEdit )
|
|
|
|
{
|
|
|
|
SetPointer( POINTER_ARROW ); // Nur das SubEdit hat den BEAM...
|
2010-09-29 15:46:40 +08:00
|
|
|
mpSubEdit->mbIsSubEdit = sal_True;
|
2006-03-14 10:14:43 +00:00
|
|
|
|
|
|
|
mpSubEdit->SetReadOnly( mbReadOnly );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
Size Edit::CalcMinimumSize() const
|
|
|
|
{
|
2008-01-14 12:05:13 +00:00
|
|
|
Size aSize ( GetTextWidth( GetText() ), GetTextHeight() );
|
2009-05-27 17:40:24 +00:00
|
|
|
// do not create edit fields in which one cannot enter anything
|
|
|
|
// a default minimum width should exist for at least 3 characters
|
|
|
|
Size aMinSize ( CalcSize( 3 ) );
|
|
|
|
if( aSize.Width() < aMinSize.Width() )
|
|
|
|
aSize.Width() = aMinSize.Width();
|
2010-07-05 11:20:24 +02:00
|
|
|
// add some space between text entry and border
|
2009-08-31 16:08:23 +00:00
|
|
|
aSize.Height() += 4;
|
|
|
|
|
2009-08-07 12:32:48 +00:00
|
|
|
aSize = CalcWindowSize( aSize );
|
|
|
|
|
|
|
|
// ask NWF what if it has an opinion, too
|
|
|
|
ImplControlValue aControlValue;
|
|
|
|
Rectangle aRect( Point( 0, 0 ), aSize );
|
2010-07-05 11:20:24 +02:00
|
|
|
Rectangle aContent, aBound;
|
2009-08-07 12:32:48 +00:00
|
|
|
if( const_cast<Edit*>(this)->GetNativeControlRegion(
|
|
|
|
CTRL_EDITBOX, PART_ENTIRE_CONTROL,
|
|
|
|
aRect, 0, aControlValue, rtl::OUString(), aBound, aContent) )
|
|
|
|
{
|
2010-07-05 11:20:24 +02:00
|
|
|
if( aBound.GetHeight() > aSize.Height() )
|
|
|
|
aSize.Height() = aBound.GetHeight();
|
2009-08-07 12:32:48 +00:00
|
|
|
}
|
|
|
|
return aSize;
|
2008-01-14 12:05:13 +00:00
|
|
|
}
|
|
|
|
|
2010-07-08 19:03:59 +02:00
|
|
|
Size Edit::GetMinimumEditSize()
|
|
|
|
{
|
|
|
|
Window* pDefWin = ImplGetDefaultWindow();
|
|
|
|
Edit aEdit( pDefWin, WB_BORDER );
|
|
|
|
Size aSize( aEdit.CalcMinimumSize() );
|
|
|
|
return aSize;
|
|
|
|
}
|
|
|
|
|
2008-01-14 12:05:13 +00:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
Size Edit::GetOptimalSize(WindowSizeType eType) const
|
|
|
|
{
|
|
|
|
switch (eType) {
|
|
|
|
case WINDOWSIZE_MINIMUM:
|
|
|
|
return CalcMinimumSize();
|
|
|
|
default:
|
|
|
|
return Control::GetOptimalSize( eType );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
Size Edit::CalcSize( xub_StrLen nChars ) const
|
|
|
|
{
|
|
|
|
// Breite fuer n Zeichen, unabhaengig vom Inhalt.
|
|
|
|
// Funktioniert nur bei FixedFont richtig, sonst Mittelwert.
|
|
|
|
Size aSz( GetTextWidth( XubString( 'x' ) ), GetTextHeight() );
|
|
|
|
aSz.Width() *= nChars;
|
|
|
|
aSz = CalcWindowSize( aSz );
|
|
|
|
return aSz;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
xub_StrLen Edit::GetMaxVisChars() const
|
|
|
|
{
|
|
|
|
const Window* pW = mpSubEdit ? mpSubEdit : this;
|
|
|
|
long nOutWidth = pW->GetOutputSizePixel().Width();
|
|
|
|
long nCharWidth = GetTextWidth( XubString( 'x' ) );
|
|
|
|
return nCharWidth ? (xub_StrLen)(nOutWidth/nCharWidth) : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
2006-03-14 10:14:43 +00:00
|
|
|
|
|
|
|
xub_StrLen Edit::GetCharPos( const Point& rWindowPos ) const
|
|
|
|
{
|
|
|
|
return ImplGetCharPos( rWindowPos );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
void Edit::SetGetSpecialCharsFunction( FncGetSpecialChars fn )
|
|
|
|
{
|
|
|
|
pImplFncGetSpecialChars = fn;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
FncGetSpecialChars Edit::GetGetSpecialCharsFunction()
|
|
|
|
{
|
|
|
|
return pImplFncGetSpecialChars;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
PopupMenu* Edit::CreatePopupMenu()
|
|
|
|
{
|
2005-09-28 13:40:22 +00:00
|
|
|
ResMgr* pResMgr = ImplGetResMgr();
|
|
|
|
if( ! pResMgr )
|
|
|
|
return new PopupMenu();
|
|
|
|
|
2007-04-26 08:27:25 +00:00
|
|
|
PopupMenu* pPopup = new PopupMenu( ResId( SV_RESID_MENU_EDIT, *pResMgr ) );
|
2011-04-14 19:41:41 +02:00
|
|
|
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
|
|
|
|
if ( rStyleSettings.GetAcceleratorsInContextMenus() )
|
|
|
|
{
|
|
|
|
pPopup->SetAccelKey( SV_MENU_EDIT_UNDO, KeyCode( KEYFUNC_UNDO ) );
|
|
|
|
pPopup->SetAccelKey( SV_MENU_EDIT_CUT, KeyCode( KEYFUNC_CUT ) );
|
|
|
|
pPopup->SetAccelKey( SV_MENU_EDIT_COPY, KeyCode( KEYFUNC_COPY ) );
|
|
|
|
pPopup->SetAccelKey( SV_MENU_EDIT_PASTE, KeyCode( KEYFUNC_PASTE ) );
|
|
|
|
pPopup->SetAccelKey( SV_MENU_EDIT_DELETE, KeyCode( KEYFUNC_DELETE ) );
|
|
|
|
pPopup->SetAccelKey( SV_MENU_EDIT_SELECTALL, KeyCode( KEY_A, sal_False, sal_True, sal_False, sal_False ) );
|
|
|
|
pPopup->SetAccelKey( SV_MENU_EDIT_INSERTSYMBOL, KeyCode( KEY_S, sal_True, sal_True, sal_False, sal_False ) );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
return pPopup;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void Edit::DeletePopupMenu( PopupMenu* pMenu )
|
|
|
|
{
|
|
|
|
delete pMenu;
|
|
|
|
}
|
|
|
|
|
2001-05-11 06:26:03 +00:00
|
|
|
// ::com::sun::star::datatransfer::dnd::XDragGestureListener
|
|
|
|
void Edit::dragGestureRecognized( const ::com::sun::star::datatransfer::dnd::DragGestureEvent& rDGE ) throw (::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
2010-10-13 01:47:23 -05:00
|
|
|
SolarMutexGuard aVclGuard;
|
2001-05-11 06:26:03 +00:00
|
|
|
|
|
|
|
if ( !IsTracking() && maSelection.Len() &&
|
2010-09-29 15:46:40 +08:00
|
|
|
!(GetStyle() & WB_PASSWORD) && (!mpDDInfo || mpDDInfo->bStarterOfDD == sal_False) ) // Kein Mehrfach D&D
|
2001-05-11 06:26:03 +00:00
|
|
|
{
|
|
|
|
Selection aSel( maSelection );
|
|
|
|
aSel.Justify();
|
|
|
|
|
|
|
|
// Nur wenn Maus in der Selektion...
|
|
|
|
Point aMousePos( rDGE.DragOriginX, rDGE.DragOriginY );
|
|
|
|
xub_StrLen nChar = ImplGetCharPos( aMousePos );
|
|
|
|
if ( (nChar >= aSel.Min()) && (nChar < aSel.Max()) )
|
|
|
|
{
|
|
|
|
if ( !mpDDInfo )
|
|
|
|
mpDDInfo = new DDInfo;
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
mpDDInfo->bStarterOfDD = sal_True;
|
2001-05-11 06:26:03 +00:00
|
|
|
mpDDInfo->aDndStartSel = aSel;
|
|
|
|
|
|
|
|
|
|
|
|
if ( IsTracking() )
|
|
|
|
EndTracking(); // Vor D&D Tracking ausschalten
|
|
|
|
|
2002-03-18 16:41:12 +00:00
|
|
|
::vcl::unohelper::TextDataObject* pDataObj = new ::vcl::unohelper::TextDataObject( GetSelected() );
|
2001-10-23 11:38:57 +00:00
|
|
|
sal_Int8 nActions = datatransfer::dnd::DNDConstants::ACTION_COPY;
|
|
|
|
if ( !IsReadOnly() )
|
|
|
|
nActions |= datatransfer::dnd::DNDConstants::ACTION_MOVE;
|
|
|
|
rDGE.DragSource->startDrag( rDGE, nActions, 0 /*cursor*/, 0 /*image*/, pDataObj, mxDnDListener );
|
2002-04-29 10:18:12 +00:00
|
|
|
if ( GetCursor() )
|
|
|
|
GetCursor()->Hide();
|
|
|
|
|
2001-05-11 06:26:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ::com::sun::star::datatransfer::dnd::XDragSourceListener
|
|
|
|
void Edit::dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSourceDropEvent& rDSDE ) throw (::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
2010-10-13 01:47:23 -05:00
|
|
|
SolarMutexGuard aVclGuard;
|
2001-05-11 06:26:03 +00:00
|
|
|
|
2001-10-23 11:38:57 +00:00
|
|
|
if ( rDSDE.DropSuccess && ( rDSDE.DropAction & datatransfer::dnd::DNDConstants::ACTION_MOVE ) )
|
2001-05-11 06:26:03 +00:00
|
|
|
{
|
|
|
|
Selection aSel( mpDDInfo->aDndStartSel );
|
|
|
|
if ( mpDDInfo->bDroppedInMe )
|
|
|
|
{
|
|
|
|
if ( aSel.Max() > mpDDInfo->nDropPos )
|
|
|
|
{
|
|
|
|
long nLen = aSel.Len();
|
|
|
|
aSel.Min() += nLen;
|
|
|
|
aSel.Max() += nLen;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ImplDelete( aSel, EDIT_DEL_RIGHT, EDIT_DELMODE_SIMPLE );
|
|
|
|
ImplModified();
|
|
|
|
}
|
|
|
|
|
|
|
|
ImplHideDDCursor();
|
|
|
|
delete mpDDInfo;
|
|
|
|
mpDDInfo = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ::com::sun::star::datatransfer::dnd::XDropTargetListener
|
|
|
|
void Edit::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& rDTDE ) throw (::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
2010-10-13 01:47:23 -05:00
|
|
|
SolarMutexGuard aVclGuard;
|
2001-05-11 06:26:03 +00:00
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_Bool bChanges = sal_False;
|
2001-05-11 06:26:03 +00:00
|
|
|
if ( !mbReadOnly && mpDDInfo )
|
|
|
|
{
|
|
|
|
ImplHideDDCursor();
|
|
|
|
|
|
|
|
Selection aSel( maSelection );
|
|
|
|
aSel.Justify();
|
|
|
|
|
|
|
|
if ( aSel.Len() && !mpDDInfo->bStarterOfDD )
|
|
|
|
ImplDelete( aSel, EDIT_DEL_RIGHT, EDIT_DELMODE_SIMPLE );
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
mpDDInfo->bDroppedInMe = sal_True;
|
2001-05-11 06:26:03 +00:00
|
|
|
|
|
|
|
aSel.Min() = mpDDInfo->nDropPos;
|
|
|
|
aSel.Max() = mpDDInfo->nDropPos;
|
|
|
|
ImplSetSelection( aSel );
|
|
|
|
|
|
|
|
uno::Reference< datatransfer::XTransferable > xDataObj = rDTDE.Transferable;
|
|
|
|
if ( xDataObj.is() )
|
|
|
|
{
|
|
|
|
datatransfer::DataFlavor aFlavor;
|
|
|
|
SotExchange::GetFormatDataFlavor( SOT_FORMAT_STRING, aFlavor );
|
|
|
|
if ( xDataObj->isDataFlavorSupported( aFlavor ) )
|
|
|
|
{
|
|
|
|
uno::Any aData = xDataObj->getTransferData( aFlavor );
|
|
|
|
::rtl::OUString aText;
|
|
|
|
aData >>= aText;
|
|
|
|
ImplInsertText( aText );
|
2010-09-29 15:46:40 +08:00
|
|
|
bChanges = sal_True;
|
2001-05-11 06:26:03 +00:00
|
|
|
ImplModified();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !mpDDInfo->bStarterOfDD )
|
|
|
|
{
|
|
|
|
delete mpDDInfo;
|
|
|
|
mpDDInfo = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rDTDE.Context->dropComplete( bChanges );
|
|
|
|
}
|
|
|
|
|
2010-07-21 17:06:56 +02:00
|
|
|
void Edit::dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent& rDTDE ) throw (::com::sun::star::uno::RuntimeException)
|
2001-05-11 06:26:03 +00:00
|
|
|
{
|
2001-08-08 09:40:38 +00:00
|
|
|
if ( !mpDDInfo )
|
|
|
|
{
|
|
|
|
mpDDInfo = new DDInfo;
|
|
|
|
}
|
2010-07-21 17:06:56 +02:00
|
|
|
// search for string data type
|
|
|
|
const Sequence< com::sun::star::datatransfer::DataFlavor >& rFlavors( rDTDE.SupportedDataFlavors );
|
|
|
|
sal_Int32 nEle = rFlavors.getLength();
|
2010-11-10 13:50:33 +08:00
|
|
|
mpDDInfo->bIsStringSupported = sal_False;
|
2010-07-21 17:06:56 +02:00
|
|
|
for( sal_Int32 i = 0; i < nEle; i++ )
|
|
|
|
{
|
|
|
|
sal_Int32 nIndex = 0;
|
|
|
|
rtl::OUString aMimetype = rFlavors[i].MimeType.getToken( 0, ';', nIndex );
|
|
|
|
if( aMimetype.equalsAscii( "text/plain" ) )
|
|
|
|
{
|
2010-11-10 13:50:33 +08:00
|
|
|
mpDDInfo->bIsStringSupported = sal_True;
|
2010-07-21 17:06:56 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2001-05-11 06:26:03 +00:00
|
|
|
}
|
|
|
|
|
2006-06-19 18:16:09 +00:00
|
|
|
void Edit::dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent& ) throw (::com::sun::star::uno::RuntimeException)
|
2001-05-11 06:26:03 +00:00
|
|
|
{
|
2010-10-13 01:47:23 -05:00
|
|
|
SolarMutexGuard aVclGuard;
|
2001-05-11 06:26:03 +00:00
|
|
|
|
|
|
|
ImplHideDDCursor();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Edit::dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& rDTDE ) throw (::com::sun::star::uno::RuntimeException)
|
|
|
|
{
|
2010-10-13 01:47:23 -05:00
|
|
|
SolarMutexGuard aVclGuard;
|
2001-05-11 06:26:03 +00:00
|
|
|
|
|
|
|
Point aMousePos( rDTDE.LocationX, rDTDE.LocationY );
|
|
|
|
|
|
|
|
xub_StrLen nPrevDropPos = mpDDInfo->nDropPos;
|
|
|
|
mpDDInfo->nDropPos = ImplGetCharPos( aMousePos );
|
|
|
|
|
2001-10-23 11:38:57 +00:00
|
|
|
/*
|
2001-05-11 06:26:03 +00:00
|
|
|
Size aOutSize = GetOutputSizePixel();
|
|
|
|
if ( ( aMousePos.X() < 0 ) || ( aMousePos.X() > aOutSize.Width() ) )
|
|
|
|
{
|
2001-10-23 11:38:57 +00:00
|
|
|
// Scroll?
|
|
|
|
// No, I will not receive events in this case....
|
2001-05-11 06:26:03 +00:00
|
|
|
}
|
2001-10-23 11:38:57 +00:00
|
|
|
*/
|
2001-05-11 06:26:03 +00:00
|
|
|
|
|
|
|
Selection aSel( maSelection );
|
|
|
|
aSel.Justify();
|
|
|
|
|
2001-10-23 11:38:57 +00:00
|
|
|
// Don't accept drop in selection or read-only field...
|
2010-07-21 17:06:56 +02:00
|
|
|
if ( IsReadOnly() || aSel.IsInside( mpDDInfo->nDropPos ) || ! mpDDInfo->bIsStringSupported )
|
2001-05-11 06:26:03 +00:00
|
|
|
{
|
|
|
|
ImplHideDDCursor();
|
|
|
|
rDTDE.Context->rejectDrag();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Alten Cursor wegzeichnen...
|
|
|
|
if ( !mpDDInfo->bVisCursor || ( nPrevDropPos != mpDDInfo->nDropPos ) )
|
|
|
|
{
|
|
|
|
ImplHideDDCursor();
|
|
|
|
ImplShowDDCursor();
|
|
|
|
}
|
2001-08-08 09:40:38 +00:00
|
|
|
rDTDE.Context->acceptDrag( rDTDE.DropAction );
|
2001-05-11 06:26:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
ImplSubEdit::ImplSubEdit( Edit* pParent, WinBits nStyle ) :
|
|
|
|
Edit( pParent, nStyle )
|
|
|
|
{
|
|
|
|
pParent->SetSubEdit( this );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void ImplSubEdit::Modify()
|
|
|
|
{
|
|
|
|
GetParent()->Modify();
|
|
|
|
}
|
2008-10-29 09:25:50 +00:00
|
|
|
|
|
|
|
XubString Edit::GetSurroundingText() const
|
|
|
|
{
|
|
|
|
if ( mpSubEdit )
|
|
|
|
return mpSubEdit->GetSurroundingText();
|
|
|
|
else
|
|
|
|
return maText;
|
|
|
|
}
|
|
|
|
|
|
|
|
Selection Edit::GetSurroundingTextSelection() const
|
|
|
|
{
|
|
|
|
return GetSelection();
|
|
|
|
}
|
2010-10-14 08:27:31 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|