Files
libreoffice/sw/source/ui/wrtsh/select.cxx

1082 lines
25 KiB
C++
Raw Normal View History

2000-09-18 16:15:01 +00:00
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2000-09-18 16:15:01 +00:00
*
* Copyright 2008 by Sun Microsystems, Inc.
2000-09-18 16:15:01 +00:00
*
* OpenOffice.org - a multi-platform office productivity suite
2000-09-18 16:15:01 +00:00
*
* $RCSfile: select.cxx,v $
* $Revision: 1.33 $
2000-09-18 16:15:01 +00:00
*
* This file is part of OpenOffice.org.
2000-09-18 16:15:01 +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:15:01 +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:15:01 +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:15:01 +00:00
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
2000-09-18 16:15:01 +00:00
#include <limits.h>
#include <hintids.hxx>
#include <sfx2/bindings.hxx>
#include <svl/eitem.hxx>
#include <svl/macitem.hxx>
#include <unotools/charclass.hxx>
#include <svx/scripttypeitem.hxx>
2000-09-18 16:15:01 +00:00
#ifndef _CMDID_H
#include <cmdid.h>
#endif
#ifndef _VIEW_HXX
#include <view.hxx>
#endif
#ifndef _BASESH_HXX
#include <basesh.hxx>
#endif
#include <wrtsh.hxx>
#include <frmatr.hxx>
#include <initui.hxx>
#include <mdiexp.hxx>
#include <fmtcol.hxx>
#include <frmfmt.hxx>
#include <swundo.hxx> // fuer Undo-Ids
#include <swevent.hxx>
#include <swdtflvr.hxx>
#include <crsskip.hxx>
2000-09-18 16:15:01 +00:00
#if OSL_DEBUG_LEVEL > 1
2000-09-18 16:15:01 +00:00
#include <pam.hxx>
#endif
namespace com { namespace sun { namespace star { namespace util {
struct SearchOptions;
} } } }
using namespace ::com::sun::star::util;
2000-09-18 16:15:01 +00:00
static long nStartDragX = 0, nStartDragY = 0;
static BOOL bStartDrag = FALSE;
void SwWrtShell::Invalidate()
{
// to avoid making the slot volatile, invalidate it everytime if something could have been changed
// this is still much cheaper than asking for the state every 200 ms (and avoid background processing)
GetView().GetViewFrame()->GetBindings().Invalidate( FN_STAT_SELMODE );
}
2000-09-18 16:15:01 +00:00
BOOL SwWrtShell::SelNearestWrd()
{
MV_KONTEXT(this);
if( !IsInWrd() && !IsEndWrd() && !IsSttWrd() )
PrvWrd();
if( IsEndWrd() )
Left(CRSR_SKIP_CELLS, FALSE, 1, FALSE );
2000-09-18 16:15:01 +00:00
return SelWrd();
}
BOOL SwWrtShell::SelWrd(const Point *pPt, BOOL )
{
BOOL bRet;
{
MV_KONTEXT(this);
SttSelect();
bRet = SwCrsrShell::SelectWord( pPt );
}
EndSelect();
if( bRet )
{
bSelWrd = TRUE;
if(pPt)
aStart = *pPt;
}
return bRet;
}
void SwWrtShell::SelSentence(const Point *pPt, BOOL )
2000-09-18 16:15:01 +00:00
{
{
MV_KONTEXT(this);
ClearMark();
SwCrsrShell::GoStartSentence();
2000-09-18 16:15:01 +00:00
SttSelect();
SwCrsrShell::GoEndSentence();
2000-09-18 16:15:01 +00:00
}
EndSelect();
if(pPt)
aStart = *pPt;
bSelLn = TRUE;
bSelWrd = FALSE; // SelWord abschalten, sonst geht kein SelLine weiter
2000-09-18 16:15:01 +00:00
}
void SwWrtShell::SelPara(const Point *pPt, BOOL )
2000-09-18 16:15:01 +00:00
{
{
MV_KONTEXT(this);
ClearMark();
SwCrsrShell::MovePara( fnParaCurr, fnParaStart );
2000-09-18 16:15:01 +00:00
SttSelect();
SwCrsrShell::MovePara( fnParaCurr, fnParaEnd );
2000-09-18 16:15:01 +00:00
}
EndSelect();
if(pPt)
aStart = *pPt;
bSelLn = FALSE;
2000-09-18 16:15:01 +00:00
bSelWrd = FALSE; // SelWord abschalten, sonst geht kein SelLine weiter
}
long SwWrtShell::SelAll()
{
const BOOL bLockedView = IsViewLocked();
LockView( TRUE );
2000-09-18 16:15:01 +00:00
{
CWS-TOOLING: integrate CWS bjm02 2009-08-12 Bjoern Michaelsen #i101879# moved officeversion from envelope body to requestbody 2009-08-11 Bjoern Michaelsen #i103732# reverting changeset f3f527950572 2009-08-10 Bjoern Michaelsen cws bjm02: merging local minibranches 2009-08-10 Bjoern Michaelsen #i104128# remove additional duplication in svx headers, remove license header merge conflicts in svx headers 2009-08-10 Bjoern Michaelsen #i100484# fixed buildbreaker on win32 2009-08-10 Bjoern Michaelsen #i104128# remove duplication in svx headers 2009-08-04 Bjoern Michaelsen #i103913# fixed bookmark updating when moving numbered para 2009-08-03 Bjoern Michaelsen #i101879# include officeversion/productname in soaprequest 2009-07-31 Bjoern Michaelsen #i84926# Selecting all in blockmode automatically falls back to std mode 2009-07-31 Bjoern Michaelsen #i100484# operation on 'pCmpLine' may be undefined, thanks cmc 2009-07-29 Bjoern Michaelsen #i103059# fixing crash on empty enumeration 2009-07-29 Bjoern Michaelsen #i98659# fixing typo in usagetracking option tabpage 2009-07-29 Bjoern Michaelsen #i103732# not triggering loading of oooimprovement dll if usage tracking is disabled 2009-07-29 Bjoern Michaelsen #i103036# stlunosequence can be use simple array-pointers as iterators, fixing used type in xmloff 2009-07-29 Bjoern Michaelsen #i103036# stlunosequence can be use simple array-pointers as iterators 2009-07-29 Bjoern Michaelsen #i103182# completely removing unused functions in extensions/oooimprovement 2009-07-28 Bjoern Michaelsen cws bjm02: merged changes from master up to milestone DEV300_m53 2009-06-29 Bjoern Michaelsen #i103182# commenting out getFailedAttempts(..) for future use 2009-06-29 Bjoern Michaelsen #i103183# removed unused function sw::mark::CrossRefBookmark::IsLegalName(..) 2009-06-29 Bjoern Michaelsen #i103182# removing unused functions in extensions/oooimprovement 2009-06-24 Bjoern Michaelsen #i103059# not using enumeration for getByName/getByIndex 2009-06-24 Bjoern Michaelsen #i103059# not using enumeration for hasByName/GetCount/hasElements for performance reasons 2009-06-24 Bjoern Michaelsen #i103036# stlunosequence can be use simple array-pointers as iterators 2009-08-27 releng CWS-TOOLING: integrate CWS hr65 2009-08-26 Jens-Heiner Rechtien #i104521#: implement 'setcurrent'; document --hg option to 'create' 2009-08-26 Jens-Heiner Rechtien #i104521#: SOAP method setSCMName() doesn't return a value 2009-08-26 Jens-Heiner Rechtien #i104521#: implement [set|get]_scm() 2009-08-26 Jens-Heiner Rechtien #i104521#: implement --hg switch to 'cws create' 2009-08-27 vg CWS-TOOLING: integrate CWS hr64_DEV300 2009-07-21 13:24:57 +0200 hr r274189 : #i99576#: re-enable optimization for tabcont.cxx 2009-07-21 13:17:18 +0200 hr r274188 : #i99592: disable -xspace optimization for Solaris x86 and SunStudio 12, due to some mis-optimzation in sc and elsewhere. SunStudio 12 update 1 is OK, but needs a few unrelated changes which will be implemented in DEV300 code line 2009-08-27 releng CWS-TOOLING: integrate CWS sw32bf02 2009-08-25 15:52:04 +0200 hde r275366 : reactived testcases hit by issue 102752 2009-08-21 13:52:17 +0200 od r275245 : #i102921# delete files whose deletion has been forgotten in cws impress172 2009-08-21 11:20:47 +0200 od r275225 : CWS-TOOLING: rebase CWS sw32bf02 to trunk@275001 (milestone: DEV300:m55) 2009-08-20 16:21:30 +0200 od r275191 : #i92511# method <lcl_MoveAllLowerObjs(..)> - invalidation of cache for object rectangle inclusive spaces is needed. 2009-08-20 15:50:40 +0200 od r275188 : #i96726# method <SwPagePreView::DocSzChgd(..)> - trigger recalculation of page preview layout even if the count of pages is not changing 2009-08-20 12:37:32 +0200 od r275172 : #i100466# correction for showing and hiding redlines 2009-08-18 13:25:18 +0200 od r275100 : #i103817# method <XMLTextImportHelper::SetStyleAndAttrs(..) - assure that a heading applies the outline style, if no other list style is applied. 2009-08-18 13:21:38 +0200 od r275098 : #i103817# allow the outline style - list style for outline numbering - to be set directly at the paragraph 2009-08-17 14:13:02 +0200 od r275052 : #i103684# add missing documentation for new optional OutlineLevel attribute introduced in OOo 3.1 2009-08-17 14:00:25 +0200 od r275049 : #i100481# method <XMLTextFrameContext_Impl::CreateChildContext(..)># - correct condition for handling embedded documents and embedded math objects 2009-08-12 14:11:34 +0200 od r274891 : #i97379# assure that columns are not applied to fly frames, which represent graphics or embedded objects 2009-08-12 12:51:43 +0200 od r274889 : #i101870# method <SwTxtNode::_MakeNewTxtNode(..)> - perform action on different paragraph styles before applying new paragraph style 2009-08-12 12:24:44 +0200 od r274888 : #i101092# method <ViewShell::Paint(..)> - encapsulate paint of document background and document into pre and post drawing layer paint calls 2009-08-12 11:38:48 +0200 od r274886 : #i98766# minor adjustment in order to be warning free under Mac port builds 2009-08-12 11:33:54 +0200 od r274885 : #i99267# method <SwTabFrm::MakeAll()> - reset <bSplit> after forward move to assure that follows can be joined, if further space is available. 2009-08-12 11:11:49 +0200 od r274882 : #i98766# method <ViewShell::SmoothScroll(..) - disable smooth scroll for Mac port builds 2009-08-10 12:17:58 +0200 od r274801 : CWS-TOOLING: rebase CWS sw32bf02 to trunk@274622 (milestone: DEV300:m54) 2009-07-21 16:56:45 +0200 od r274206 : #i103685# method <SwTxtFormatter::NewTabPortion(..)> - adjust condition to apply automatic tab stop at left margin correctly in case that tab stops are not relative to indent 2009-07-10 11:53:53 +0200 od r273883 : #i102752 method <SwDrawContact::Modify(..)> - assure that a ShapePropertyChangeNotifier exists 2009-07-07 12:01:58 +0200 mst r273788 : #i103304# apply patch by dtardon to fix bogus conditional 2009-07-07 09:01:13 +0200 od r273767 : CWS-TOOLING: rebase CWS sw32bf02 to trunk@273468 (milestone: DEV300:m51) 2009-08-27 vg CWS-TOOLING: integrate CWS native264_DEV300 2009-08-13 11:58:58 +0200 is r274928 : #i104200# update to jre6u16 2009-08-27 vg CWS-TOOLING: integrate CWS automationdev300m54tables 2009-08-14 13:01:05 +0200 wg r274976 : i104224 2009-08-14 13:00:28 +0200 wg r274975 : i104224 2009-08-14 12:12:34 +0200 wg r274974 : i104222 2009-08-13 14:28:13 +0200 wg r274944 : i104205 2009-08-13 14:27:40 +0200 wg r274943 : i104205 2009-08-13 14:26:36 +0200 wg r274942 : i104205
2009-08-27 15:54:55 +00:00
if(bBlockMode)
LeaveBlockMode();
2000-09-18 16:15:01 +00:00
MV_KONTEXT(this);
BOOL bMoveTable = FALSE;
CWS-TOOLING: integrate CWS sw31bf02 2009-01-26 08:39:59 +0100 fme r266900 : #i93190# placeholder field should be checked in IsEqualsFlags as well 2009-01-21 17:32:32 +0100 ama r266695 : CWS-TOOLING: rebase CWS sw31bf02 to trunk@266428 (milestone: DEV300:m39) 2009-01-19 09:26:02 +0100 ama r266475 : Fix #i96109#: Bracket mismatch 2009-01-19 09:08:47 +0100 ama r266473 : Fix #i96391#: Wrong default parameter 2009-01-19 09:07:13 +0100 ama r266472 : Fix #i96112#: Bracket mismatch 2009-01-19 08:51:42 +0100 ama r266471 : Fix #i96113#: Bracket mismatch 2009-01-16 15:07:01 +0100 ama r266421 : Fix #i93105#: export 0x14 2009-01-16 09:07:02 +0100 ama r266400 : Fix #i96111#: Wrong condition 2009-01-16 08:49:47 +0100 ama r266399 : Fix #i99110#: Wrong condition 2009-01-12 15:54:46 +0100 ama r266164 : Fix #i17949#: Ctrl+A if document starts with a section 2009-01-09 15:39:44 +0100 ama r266091 : Fix #i93144#: Crash during update of TOC 2009-01-09 14:40:20 +0100 ama r266086 : Fix #i90072#: Shorten undo strings 2008-12-10 16:34:57 +0100 fme r265203 : #i73332# Crash with section endnotes 2008-12-10 15:04:29 +0100 fme r265194 : #i93190# Omit painting of placeholder fields during pdf export 2008-12-09 16:46:54 +0100 fme r265115 : #i96167# haggi - reset view options before disposing view 2008-12-09 16:17:13 +0100 fme r265114 : #i96167# Added missing word coun invalidation on splitting node in second half 2008-12-09 15:49:19 +0100 fme r265108 : #i91740# Write actual text only for hyphen portions 2008-12-09 14:52:13 +0100 fme r265090 : #91483# Disable some Insert menu entries in case cursor is located in hidden text
2009-02-13 11:19:56 +00:00
SwPosition *pStartPos = 0;
SwPosition *pEndPos = 0;
SwShellCrsr* pTmpCrsr = 0;
2000-09-18 16:15:01 +00:00
if( !HasWholeTabSelection() )
{
if ( IsSelection() && IsCrsrPtAtEnd() )
SwapPam();
CWS-TOOLING: integrate CWS sw31bf02 2009-01-26 08:39:59 +0100 fme r266900 : #i93190# placeholder field should be checked in IsEqualsFlags as well 2009-01-21 17:32:32 +0100 ama r266695 : CWS-TOOLING: rebase CWS sw31bf02 to trunk@266428 (milestone: DEV300:m39) 2009-01-19 09:26:02 +0100 ama r266475 : Fix #i96109#: Bracket mismatch 2009-01-19 09:08:47 +0100 ama r266473 : Fix #i96391#: Wrong default parameter 2009-01-19 09:07:13 +0100 ama r266472 : Fix #i96112#: Bracket mismatch 2009-01-19 08:51:42 +0100 ama r266471 : Fix #i96113#: Bracket mismatch 2009-01-16 15:07:01 +0100 ama r266421 : Fix #i93105#: export 0x14 2009-01-16 09:07:02 +0100 ama r266400 : Fix #i96111#: Wrong condition 2009-01-16 08:49:47 +0100 ama r266399 : Fix #i99110#: Wrong condition 2009-01-12 15:54:46 +0100 ama r266164 : Fix #i17949#: Ctrl+A if document starts with a section 2009-01-09 15:39:44 +0100 ama r266091 : Fix #i93144#: Crash during update of TOC 2009-01-09 14:40:20 +0100 ama r266086 : Fix #i90072#: Shorten undo strings 2008-12-10 16:34:57 +0100 fme r265203 : #i73332# Crash with section endnotes 2008-12-10 15:04:29 +0100 fme r265194 : #i93190# Omit painting of placeholder fields during pdf export 2008-12-09 16:46:54 +0100 fme r265115 : #i96167# haggi - reset view options before disposing view 2008-12-09 16:17:13 +0100 fme r265114 : #i96167# Added missing word coun invalidation on splitting node in second half 2008-12-09 15:49:19 +0100 fme r265108 : #i91740# Write actual text only for hyphen portions 2008-12-09 14:52:13 +0100 fme r265090 : #91483# Disable some Insert menu entries in case cursor is located in hidden text
2009-02-13 11:19:56 +00:00
pTmpCrsr = getShellCrsr( false );
if( pTmpCrsr )
{
pStartPos = new SwPosition( *pTmpCrsr->GetPoint() );
pEndPos = new SwPosition( *pTmpCrsr->GetMark() );
}
2000-09-18 16:15:01 +00:00
Push();
BOOL bIsFullSel = !MoveSection( fnSectionCurr, fnSectionStart);
SwapPam();
bIsFullSel &= !MoveSection( fnSectionCurr, fnSectionEnd);
Pop(FALSE);
GoStart(TRUE, &bMoveTable, FALSE, !bIsFullSel);
}
else
{
EnterStdMode();
SttEndDoc(TRUE);
2000-09-18 16:15:01 +00:00
}
SttSelect();
GoEnd(TRUE, &bMoveTable);
CWS-TOOLING: integrate CWS sw31bf02 2009-01-26 08:39:59 +0100 fme r266900 : #i93190# placeholder field should be checked in IsEqualsFlags as well 2009-01-21 17:32:32 +0100 ama r266695 : CWS-TOOLING: rebase CWS sw31bf02 to trunk@266428 (milestone: DEV300:m39) 2009-01-19 09:26:02 +0100 ama r266475 : Fix #i96109#: Bracket mismatch 2009-01-19 09:08:47 +0100 ama r266473 : Fix #i96391#: Wrong default parameter 2009-01-19 09:07:13 +0100 ama r266472 : Fix #i96112#: Bracket mismatch 2009-01-19 08:51:42 +0100 ama r266471 : Fix #i96113#: Bracket mismatch 2009-01-16 15:07:01 +0100 ama r266421 : Fix #i93105#: export 0x14 2009-01-16 09:07:02 +0100 ama r266400 : Fix #i96111#: Wrong condition 2009-01-16 08:49:47 +0100 ama r266399 : Fix #i99110#: Wrong condition 2009-01-12 15:54:46 +0100 ama r266164 : Fix #i17949#: Ctrl+A if document starts with a section 2009-01-09 15:39:44 +0100 ama r266091 : Fix #i93144#: Crash during update of TOC 2009-01-09 14:40:20 +0100 ama r266086 : Fix #i90072#: Shorten undo strings 2008-12-10 16:34:57 +0100 fme r265203 : #i73332# Crash with section endnotes 2008-12-10 15:04:29 +0100 fme r265194 : #i93190# Omit painting of placeholder fields during pdf export 2008-12-09 16:46:54 +0100 fme r265115 : #i96167# haggi - reset view options before disposing view 2008-12-09 16:17:13 +0100 fme r265114 : #i96167# Added missing word coun invalidation on splitting node in second half 2008-12-09 15:49:19 +0100 fme r265108 : #i91740# Write actual text only for hyphen portions 2008-12-09 14:52:13 +0100 fme r265090 : #91483# Disable some Insert menu entries in case cursor is located in hidden text
2009-02-13 11:19:56 +00:00
if( pStartPos )
{
pTmpCrsr = getShellCrsr( false );
if( pTmpCrsr )
{
// Some special handling for sections (e.g. TOC) at the beginning of the document body
// to avoid the selection of the first section
// if the last selection was behind the first section or
// if the last selection was already the first section
// In this both cases we select to the end of document
if( *pTmpCrsr->GetPoint() < *pEndPos ||
( *pStartPos == *pTmpCrsr->GetMark() &&
*pEndPos == *pTmpCrsr->GetPoint() ) )
SwCrsrShell::SttEndDoc(FALSE);
}
delete pStartPos;
delete pEndPos;
}
2000-09-18 16:15:01 +00:00
}
EndSelect();
LockView( bLockedView );
2000-09-18 16:15:01 +00:00
return 1;
}
/*------------------------------------------------------------------------
Beschreibung: Textsuche
------------------------------------------------------------------------*/
CWS-TOOLING: integrate CWS notes7 2008-12-29 19:45:08 +0100 mod r265824 : CWS-TOOLING: rebase CWS notes7 to trunk@265758 (milestone: DEV300:m38) 2008-12-16 14:54:42 +0100 mod r265544 : #i97239# 2008-12-16 14:53:18 +0100 mod r265543 : #i97239# 2008-12-16 13:36:43 +0100 mod r265537 : 96602 2008-12-13 13:02:54 +0100 mba r265452 : warning fixed 2008-12-13 08:20:21 +0100 mod r265448 : search inside notes 2008-12-13 00:11:47 +0100 mod r265447 : search inside notes 2008-12-13 00:11:09 +0100 mod r265446 : search inside notes 2008-12-13 00:10:52 +0100 mod r265445 : search inside notes 2008-12-12 19:39:14 +0100 mod r265439 : search inside notes 2008-12-12 19:02:44 +0100 mod r265438 : search inside notes 2008-12-12 16:42:07 +0100 mba r265431 : #i80135#: search in notes 2008-12-12 16:11:54 +0100 mba r265429 : #i80135#: search in notes 2008-12-12 16:11:02 +0100 mba r265428 : #i80135#: search in notes 2008-12-11 20:24:20 +0100 pb r265358 : fix: #i80135# fixes for aNotesBtn 2008-12-11 20:23:19 +0100 pb r265357 : fix: #i80135# fixes for aNotesBtn 2008-12-11 07:42:17 +0100 pb r265241 : fix: #i80135# CB_NOTES added 2008-12-11 07:40:36 +0100 pb r265240 : fix: #i80135# CB_NOTES added 2008-12-11 07:32:03 +0100 pb r265239 : fix: #i80135# CheckBox aNotesBtn added 2008-12-11 07:24:45 +0100 pb r265238 : fix: #i80135# CheckBox aNotesBtn added 2008-12-10 15:41:31 +0100 mod r265198 : crash using replies 2008-12-10 15:21:23 +0100 mod r265195 : crash using replies 2008-12-10 13:45:14 +0100 mba r265181 : warning fixed 2008-12-10 13:26:45 +0100 mba r265178 : warning fixed 2008-12-10 11:48:23 +0100 mba r265162 : fixed compilation error on Linux 2008-12-03 18:39:07 +0100 mod r264806 : we don't get the Ctrl-Alt-N on mac inside a note, let's do the whole reply thing using the shell, cleaner anyway 2008-12-03 17:13:59 +0100 mod r264802 : search dialog can be started and closed when focus is inside a note 2008-12-03 00:07:08 +0100 mod r264733 : search inside notes 2008-12-02 18:06:08 +0100 mod r264729 : WaE 2008-12-02 15:01:26 +0100 mod r264703 : WaE 2008-12-02 00:20:14 +0100 mod r264644 : WaE 2008-12-01 10:06:14 +0100 mod r264587 : WaE 2008-12-01 01:28:34 +0100 mod r264585 : WaE 2008-11-30 22:51:19 +0100 mod r264584 : search inside notes 2008-11-30 17:03:04 +0100 mod r264583 : search inside notes 2008-11-28 16:30:05 +0100 mod r264560 : #i96602# 2008-11-28 16:14:50 +0100 mod r264559 : test 2008-11-28 16:11:37 +0100 mod r264558 : test 2008-11-17 17:46:10 +0100 mod r263735 : WaE 2008-11-17 17:45:56 +0100 mod r263734 : WaE 2008-11-17 17:37:35 +0100 mod r263733 : revert manual fix for icu 2008-11-17 15:03:55 +0100 mod r263726 : manual fix for icu 2008-11-17 11:17:49 +0100 mod r263707 : manual fix for icu 2008-11-14 15:51:19 +0100 mod r263679 : fix 2008-11-14 14:48:02 +0100 mod r263676 : some more cleanup, redline comments not in the margin for 3.1 2008-11-14 08:37:07 +0100 mod r263664 : end of line missing 2008-11-13 18:36:53 +0100 mod r263660 : WaE 2008-11-13 18:20:04 +0100 mod r263659 : #i94374# 2008-11-13 15:51:28 +0100 mod r263648 : CWS-TOOLING: rebase CWS notes7 to trunk@263288 (milestone: DEV300:m35) 2008-11-13 08:33:19 +0100 mod r263622 : typos 2008-11-02 23:18:19 +0100 mod r263278 : changes notes, replies 2008-11-01 11:48:35 +0100 mod r262873 : replies, comments 2008-11-01 11:44:57 +0100 mod r262872 : notes search button 2008-10-10 14:34:34 +0200 mod r262150 : migration from cvs to svn 2008-10-10 14:33:39 +0200 mod r262149 : migration from cvs to svn
2009-01-02 15:51:45 +00:00
ULONG SwWrtShell::SearchPattern( const SearchOptions& rSearchOpt, BOOL bSearchInNotes,
2000-09-18 16:15:01 +00:00
SwDocPositions eStt, SwDocPositions eEnd,
FindRanges eFlags, int bReplace )
{
// keine Erweiterung bestehender Selektionen
if(!(eFlags & FND_IN_SEL))
ClearMark();
BOOL bCancel = FALSE;
CWS-TOOLING: integrate CWS notes7 2008-12-29 19:45:08 +0100 mod r265824 : CWS-TOOLING: rebase CWS notes7 to trunk@265758 (milestone: DEV300:m38) 2008-12-16 14:54:42 +0100 mod r265544 : #i97239# 2008-12-16 14:53:18 +0100 mod r265543 : #i97239# 2008-12-16 13:36:43 +0100 mod r265537 : 96602 2008-12-13 13:02:54 +0100 mba r265452 : warning fixed 2008-12-13 08:20:21 +0100 mod r265448 : search inside notes 2008-12-13 00:11:47 +0100 mod r265447 : search inside notes 2008-12-13 00:11:09 +0100 mod r265446 : search inside notes 2008-12-13 00:10:52 +0100 mod r265445 : search inside notes 2008-12-12 19:39:14 +0100 mod r265439 : search inside notes 2008-12-12 19:02:44 +0100 mod r265438 : search inside notes 2008-12-12 16:42:07 +0100 mba r265431 : #i80135#: search in notes 2008-12-12 16:11:54 +0100 mba r265429 : #i80135#: search in notes 2008-12-12 16:11:02 +0100 mba r265428 : #i80135#: search in notes 2008-12-11 20:24:20 +0100 pb r265358 : fix: #i80135# fixes for aNotesBtn 2008-12-11 20:23:19 +0100 pb r265357 : fix: #i80135# fixes for aNotesBtn 2008-12-11 07:42:17 +0100 pb r265241 : fix: #i80135# CB_NOTES added 2008-12-11 07:40:36 +0100 pb r265240 : fix: #i80135# CB_NOTES added 2008-12-11 07:32:03 +0100 pb r265239 : fix: #i80135# CheckBox aNotesBtn added 2008-12-11 07:24:45 +0100 pb r265238 : fix: #i80135# CheckBox aNotesBtn added 2008-12-10 15:41:31 +0100 mod r265198 : crash using replies 2008-12-10 15:21:23 +0100 mod r265195 : crash using replies 2008-12-10 13:45:14 +0100 mba r265181 : warning fixed 2008-12-10 13:26:45 +0100 mba r265178 : warning fixed 2008-12-10 11:48:23 +0100 mba r265162 : fixed compilation error on Linux 2008-12-03 18:39:07 +0100 mod r264806 : we don't get the Ctrl-Alt-N on mac inside a note, let's do the whole reply thing using the shell, cleaner anyway 2008-12-03 17:13:59 +0100 mod r264802 : search dialog can be started and closed when focus is inside a note 2008-12-03 00:07:08 +0100 mod r264733 : search inside notes 2008-12-02 18:06:08 +0100 mod r264729 : WaE 2008-12-02 15:01:26 +0100 mod r264703 : WaE 2008-12-02 00:20:14 +0100 mod r264644 : WaE 2008-12-01 10:06:14 +0100 mod r264587 : WaE 2008-12-01 01:28:34 +0100 mod r264585 : WaE 2008-11-30 22:51:19 +0100 mod r264584 : search inside notes 2008-11-30 17:03:04 +0100 mod r264583 : search inside notes 2008-11-28 16:30:05 +0100 mod r264560 : #i96602# 2008-11-28 16:14:50 +0100 mod r264559 : test 2008-11-28 16:11:37 +0100 mod r264558 : test 2008-11-17 17:46:10 +0100 mod r263735 : WaE 2008-11-17 17:45:56 +0100 mod r263734 : WaE 2008-11-17 17:37:35 +0100 mod r263733 : revert manual fix for icu 2008-11-17 15:03:55 +0100 mod r263726 : manual fix for icu 2008-11-17 11:17:49 +0100 mod r263707 : manual fix for icu 2008-11-14 15:51:19 +0100 mod r263679 : fix 2008-11-14 14:48:02 +0100 mod r263676 : some more cleanup, redline comments not in the margin for 3.1 2008-11-14 08:37:07 +0100 mod r263664 : end of line missing 2008-11-13 18:36:53 +0100 mod r263660 : WaE 2008-11-13 18:20:04 +0100 mod r263659 : #i94374# 2008-11-13 15:51:28 +0100 mod r263648 : CWS-TOOLING: rebase CWS notes7 to trunk@263288 (milestone: DEV300:m35) 2008-11-13 08:33:19 +0100 mod r263622 : typos 2008-11-02 23:18:19 +0100 mod r263278 : changes notes, replies 2008-11-01 11:48:35 +0100 mod r262873 : replies, comments 2008-11-01 11:44:57 +0100 mod r262872 : notes search button 2008-10-10 14:34:34 +0200 mod r262150 : migration from cvs to svn 2008-10-10 14:33:39 +0200 mod r262149 : migration from cvs to svn
2009-01-02 15:51:45 +00:00
ULONG nRet = Find( rSearchOpt, bSearchInNotes, eStt, eEnd, bCancel, eFlags, bReplace );
if(bCancel)
{
Undo(UNDO_EMPTY, 1);
nRet = ULONG_MAX;
}
return nRet;
2000-09-18 16:15:01 +00:00
}
/*------------------------------------------------------------------------
Beschreibung: Suche nach Vorlagen
------------------------------------------------------------------------*/
ULONG SwWrtShell::SearchTempl( const String &rTempl,
SwDocPositions eStt, SwDocPositions eEnd,
FindRanges eFlags, const String* pReplTempl )
{
// keine Erweiterung bestehender Selektionen
if(!(eFlags & FND_IN_SEL))
ClearMark();
SwTxtFmtColl *pColl = GetParaStyle(rTempl, SwWrtShell::GETSTYLE_CREATESOME);
SwTxtFmtColl *pReplaceColl = 0;
if( pReplTempl )
pReplaceColl = GetParaStyle(*pReplTempl, SwWrtShell::GETSTYLE_CREATESOME );
BOOL bCancel = FALSE;
ULONG nRet = Find(pColl? *pColl: GetDfltTxtFmtColl(),
eStt,eEnd, bCancel, eFlags, pReplaceColl);
if(bCancel)
{
Undo(UNDO_EMPTY, 1);
nRet = ULONG_MAX;
}
return nRet;
2000-09-18 16:15:01 +00:00
}
// Suche nach Attributen ----------------------------------------------------
ULONG SwWrtShell::SearchAttr( const SfxItemSet& rFindSet, BOOL bNoColls,
SwDocPositions eStart, SwDocPositions eEnde,
FindRanges eFlags, const SearchOptions* pSearchOpt,
2000-09-18 16:15:01 +00:00
const SfxItemSet* pReplaceSet )
{
// Keine Erweiterung bestehender Selektionen
if (!(eFlags & FND_IN_SEL))
ClearMark();
// Suchen
BOOL bCancel = FALSE;
ULONG nRet = Find( rFindSet, bNoColls, eStart, eEnde, bCancel, eFlags, pSearchOpt, pReplaceSet);
if(bCancel)
{
Undo(UNDO_EMPTY, 1);
nRet = ULONG_MAX;
}
return nRet;
2000-09-18 16:15:01 +00:00
}
// ---------- Selektionsmodi ----------
void SwWrtShell::PushMode()
{
pModeStack = new ModeStack( pModeStack, bIns, bExtMode, bAddMode, bBlockMode );
2000-09-18 16:15:01 +00:00
}
void SwWrtShell::PopMode()
{
if ( 0 == pModeStack )
return;
if ( bExtMode && !pModeStack->bExt )
LeaveExtMode();
if ( bAddMode && !pModeStack->bAdd )
LeaveAddMode();
if ( bBlockMode && !pModeStack->bBlock )
LeaveBlockMode();
2000-09-18 16:15:01 +00:00
bIns = pModeStack->bIns;
ModeStack *pTmp = pModeStack->pNext;
delete pModeStack;
pModeStack = pTmp;
}
/*
* Zwei Methoden fuer das Cursorsetzen; die erste mappt auf die
* gleichnamige Methoden an der CursorShell, die zweite hebt
* zuerst alle Selektionen auf.
*/
long SwWrtShell::SetCrsr(const Point *pPt, BOOL bTextOnly)
{
/*
* eine gfs. bestehende Selektion an der Position des
* Mausklicks aufheben
*/
if(!IsInSelect() && ChgCurrPam(*pPt)) {
ClearMark();
}
2000-09-18 16:15:01 +00:00
return SwCrsrShell::SetCrsr(*pPt, bTextOnly);
}
long SwWrtShell::SetCrsrKillSel(const Point *pPt, BOOL bTextOnly )
{
ACT_KONTEXT(this);
ResetSelect(pPt,FALSE);
return SwCrsrShell::SetCrsr(*pPt, bTextOnly);
}
void SwWrtShell::UnSelectFrm()
{
// Rahmenselektion aufheben mit garantiert ungueltiger Position
2000-09-18 16:15:01 +00:00
Point aPt(LONG_MIN, LONG_MIN);
SelectObj(aPt, 0);
SwTransferable::ClearSelection( *this );
2000-09-18 16:15:01 +00:00
}
/*
* Aufheben aller Selektionen
*/
long SwWrtShell::ResetSelect(const Point *,BOOL)
{
if(IsSelFrmMode())
{
UnSelectFrm();
LeaveSelFrmMode();
}
else
{
/* ACT_KONTEXT() macht eine Action auf -
um im Basicablauf keine Probleme mit der
Shellumschaltung zu bekommen, darf
GetChgLnk().Call() erst nach
EndAction() gerufen werden.
*/
{
ACT_KONTEXT(this);
bSelWrd = bSelLn = FALSE;
KillPams();
ClearMark();
fnKillSel = &SwWrtShell::Ignore;
fnSetCrsr = &SwWrtShell::SetCrsr;
}
/*
* nach dem Aufheben aller Selektionen koennte ein Update der
* Attr-Controls notwendig sein.
*/
GetChgLnk().Call(this);
}
Invalidate();
SwTransferable::ClearSelection( *this );
2000-09-18 16:15:01 +00:00
return 1;
}
/*
* tue nichts
*/
long SwWrtShell::Ignore(const Point *, BOOL ) {
return 1;
}
/*
* Start eines Selektionsvorganges.
*/
void SwWrtShell::SttSelect()
{
if(bInSelect)
return;
if(!HasMark())
SetMark();
if( bBlockMode )
{
SwShellCrsr* pTmp = getShellCrsr( true );
if( !pTmp->HasMark() )
pTmp->SetMark();
}
2000-09-18 16:15:01 +00:00
fnKillSel = &SwWrtShell::Ignore;
fnSetCrsr = &SwWrtShell::SetCrsr;
bInSelect = TRUE;
Invalidate();
SwTransferable::CreateSelection( *this );
2000-09-18 16:15:01 +00:00
}
/*
* Ende eines Selektionsvorganges.
*/
void SwWrtShell::EndSelect()
{
if(!bInSelect || bExtMode)
return;
bInSelect = FALSE;
(this->*fnLeaveSelect)(0,FALSE);
if(!bAddMode) {
fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
fnKillSel = &SwWrtShell::ResetSelect;
}
}
/* Methode, um eine bestehende wortweise oder zeilenweise Selektion
* zu erweitern.
*/
inline BOOL operator<(const Point &rP1,const Point &rP2)
{
return rP1.Y() < rP2.Y() || (rP1.Y() == rP2.Y() && rP1.X() < rP2.X());
}
long SwWrtShell::ExtSelWrd(const Point *pPt, BOOL )
{
MV_KONTEXT(this);
if( IsTableMode() )
return 1;
// Bug 66823: actual crsr has in additional mode no selection?
// Then destroy the actual an go to prev, this will be expand
if( !HasMark() && GoPrevCrsr() )
{
BOOL bHasMark = HasMark(); // thats wrong!
GoNextCrsr();
if( bHasMark )
{
DestroyCrsr();
GoPrevCrsr();
}
}
// check the direction of the selection with the new point
BOOL bRet = FALSE, bMoveCrsr = TRUE, bToTop = FALSE;
2000-09-18 16:15:01 +00:00
SwCrsrShell::SelectWord( &aStart ); // select the startword
SwCrsrShell::Push(); // save the cursor
SwCrsrShell::SetCrsr( *pPt ); // and check the direction
switch( SwCrsrShell::CompareCursor( StackMkCurrPt ))
{
case -1: bToTop = FALSE; break;
case 1: bToTop = TRUE; break;
default: bMoveCrsr = FALSE; break;
}
SwCrsrShell::Pop( FALSE ); // retore the saved cursor
if( bMoveCrsr )
{
// select to Top but cursor select to Bottom? or
// select to Bottom but cursor select to Top? --> swap the cursor
if( bToTop )
SwapPam();
SwCrsrShell::Push(); // save cur cursor
if( SwCrsrShell::SelectWord( pPt )) // select the current word
{
if( bToTop )
SwapPam();
Combine();
bRet = TRUE;
}
else
{
SwCrsrShell::Pop( FALSE );
if( bToTop )
SwapPam();
}
}
else
bRet = TRUE;
return bRet;
}
long SwWrtShell::ExtSelLn(const Point *pPt, BOOL )
{
MV_KONTEXT(this);
SwCrsrShell::SetCrsr(*pPt);
if( IsTableMode() )
return 1;
// Bug 66823: actual crsr has in additional mode no selection?
// Then destroy the actual an go to prev, this will be expand
if( !HasMark() && GoPrevCrsr() )
{
BOOL bHasMark = HasMark(); // thats wrong!
GoNextCrsr();
if( bHasMark )
{
DestroyCrsr();
GoPrevCrsr();
}
}
// ggfs. den Mark der Selektion anpassen
BOOL bToTop = !IsCrsrPtAtEnd();
SwapPam();
// der "Mark" muss am Zeilenende/-anfang stehen
if( bToTop ? !IsEndSentence() : !IsStartSentence() )
2000-09-18 16:15:01 +00:00
{
if( bToTop )
{
if( !IsEndPara() )
SwCrsrShell::Right(1,CRSR_SKIP_CHARS);
SwCrsrShell::GoEndSentence();
2000-09-18 16:15:01 +00:00
}
else
SwCrsrShell::GoStartSentence();
2000-09-18 16:15:01 +00:00
}
SwapPam();
return bToTop ? SwCrsrShell::GoStartSentence() : SwCrsrShell::GoEndSentence();
2000-09-18 16:15:01 +00:00
}
/*
* zurueck in den Standard Mode: kein Mode, keine Selektionen.
*/
void SwWrtShell::EnterStdMode()
{
if(bAddMode)
LeaveAddMode();
if(bBlockMode)
LeaveBlockMode();
bBlockMode = FALSE;
2000-09-18 16:15:01 +00:00
bExtMode = FALSE;
bInSelect = FALSE;
if(IsSelFrmMode())
{
UnSelectFrm();
LeaveSelFrmMode();
}
else
{
/* ACT_KONTEXT() opens and action which has to be
closed prior to the call of
GetChgLnk().Call()
*/
{
ACT_KONTEXT(this);
bSelWrd = bSelLn = FALSE;
if( !IsRetainSelection() )
KillPams();
ClearMark();
fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
fnKillSel = &SwWrtShell::ResetSelect;
}
}
Invalidate();
SwTransferable::ClearSelection( *this );
2000-09-18 16:15:01 +00:00
}
/*
* Extended Mode
*/
void SwWrtShell::EnterExtMode()
{
if(bBlockMode)
{
LeaveBlockMode();
KillPams();
ClearMark();
}
2000-09-18 16:15:01 +00:00
bExtMode = TRUE;
bAddMode = FALSE;
bBlockMode = FALSE;
2000-09-18 16:15:01 +00:00
SttSelect();
}
void SwWrtShell::LeaveExtMode()
{
bExtMode = FALSE;
EndSelect();
}
/*
* Ende einer Selektion; falls die Selektion leer ist,
* ClearMark().
*/
long SwWrtShell::SttLeaveSelect(const Point *, BOOL )
{
if(SwCrsrShell::HasSelection() && !IsSelTblCells() && bClearMark) {
return 0;
}
// if( IsSelTblCells() ) aSelTblLink.Call(this);
ClearMark();
return 1;
}
/*
* Verlassen des Selektionsmodus in Additional Mode
*/
long SwWrtShell::AddLeaveSelect(const Point *, BOOL )
{
if(IsTableMode()) LeaveAddMode();
else if(SwCrsrShell::HasSelection())
CreateCrsr();
return 1;
}
/*
* Additional Mode
*/
void SwWrtShell::EnterAddMode()
{
if(IsTableMode()) return;
if(bBlockMode)
LeaveBlockMode();
2000-09-18 16:15:01 +00:00
fnLeaveSelect = &SwWrtShell::AddLeaveSelect;
fnKillSel = &SwWrtShell::Ignore;
fnSetCrsr = &SwWrtShell::SetCrsr;
bAddMode = TRUE;
bBlockMode = FALSE;
2000-09-18 16:15:01 +00:00
bExtMode = FALSE;
if(SwCrsrShell::HasSelection())
CreateCrsr();
Invalidate();
2000-09-18 16:15:01 +00:00
}
void SwWrtShell::LeaveAddMode()
{
fnLeaveSelect = &SwWrtShell::SttLeaveSelect;
fnKillSel = &SwWrtShell::ResetSelect;
fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
bAddMode = FALSE;
Invalidate();
2000-09-18 16:15:01 +00:00
}
/*
* Block Mode
*/
void SwWrtShell::EnterBlockMode()
{
bBlockMode = FALSE;
EnterStdMode();
bBlockMode = TRUE;
CrsrToBlockCrsr();
Invalidate();
}
void SwWrtShell::LeaveBlockMode()
{
bBlockMode = FALSE;
BlockCrsrToCrsr();
EndSelect();
Invalidate();
}
2000-09-18 16:15:01 +00:00
// Einfuegemodus
void SwWrtShell::SetInsMode( BOOL bOn )
{
bIns = bOn;
2000-11-28 17:49:16 +00:00
SwCrsrShell::SetOverwriteCrsr( !bIns );
2000-09-18 16:15:01 +00:00
const SfxBoolItem aTmp( SID_ATTR_INSERT, bIns );
GetView().GetViewFrame()->GetBindings().SetState( aTmp );
2000-11-28 17:49:16 +00:00
StartAction();
EndAction();
Invalidate();
2000-09-18 16:15:01 +00:00
}
CWS-TOOLING: integrate CWS os132 2009-07-21 15:24:18 +0200 os r274201 : #i103696# SwXTextPortion/SwXParagraph excluded 2009-07-15 13:19:17 +0200 os r274007 : #i103564# typo 2009-07-15 13:09:30 +0200 os r274005 : #i103564# SwFrames::hasElements 2009-07-15 13:02:16 +0200 os r274003 : #i103564# SwXBookmark::getPropertySetInfo fixed 2009-06-26 10:11:00 +0200 os r273395 : CWS-TOOLING: rebase CWS os132 to trunk@272827 (milestone: DEV300:m50) 2009-06-23 08:52:24 +0200 os r273256 : #i102764# patch: attribute ListBoxes correctly handled in ::Reset() 2009-06-23 08:51:31 +0200 os r273255 : #i102764# ResetColor() added to remove background color 2009-06-22 14:57:38 +0200 os r273233 : #i102619# prevent access to already destroyed shell 2009-06-18 13:26:51 +0200 os r273112 : #i99508# ::insertTextContent: re-route to ::attach() 2009-06-18 10:59:53 +0200 os r273107 : #i85405# patch to enable 'Print grid' CheckBox correctly 2009-06-18 10:54:02 +0200 os r273106 : #i85133# dispose connection in GetColumnFmt to prevent connection locking 2009-06-18 10:24:31 +0200 os r273104 : #99535# ExportGraphic changed 2009-06-18 10:24:03 +0200 os r273103 : #99535# ExportGraphic changed 2009-06-18 10:23:11 +0200 os r273102 : #i102841# redlining mode switches to insert mode (cmc) 2009-06-17 14:05:42 +0200 os r273070 : #i102111# do not save already saved HTML documents before switching to source veiw 2009-06-17 13:18:20 +0200 os r273063 : #i101825# set rembered start position at the real start not at the initial start 2009-06-17 08:24:10 +0200 os r273048 : #99535# no dierect access to the file picker interface 2009-06-16 15:00:12 +0200 os r273020 : #i99937# notification of user options changes re-introduced 2009-06-15 14:36:03 +0200 os r272987 : #i98032# unreplaced text in protected areas must not be attributed either 2009-06-15 14:20:26 +0200 os r272985 : #i98032# replace list has to be initialised 2009-06-04 13:29:02 +0200 os r272624 : #i97810# set focus into column page 2009-06-04 11:01:14 +0200 os r272617 : #i98164# dialog resize to ease localisation 2009-06-04 10:59:44 +0200 os r272616 : #i98164# dialog resize to ease localisation 2009-05-28 16:05:03 +0200 os r272413 : #i98172# ConvertFieldsToText: take care of tabs with attributes 2009-05-28 11:12:45 +0200 os r272385 : #i59361# dialog controls resized 2009-05-28 11:03:14 +0200 os r272383 : #i59174# dialog controls moved
2009-08-06 12:44:16 +00:00
//Overwrite mode is incompatible with red-lining
void SwWrtShell::SetRedlineModeAndCheckInsMode( USHORT eMode )
{
SetRedlineMode( eMode );
if (IsRedlineOn())
SetInsMode( true );
}
2000-09-18 16:15:01 +00:00
/*
* Rahmen bearbeiten
*/
long SwWrtShell::BeginFrmDrag(const Point *pPt, BOOL)
{
fnDrag = &SwFEShell::Drag;
if(bStartDrag)
{
Point aTmp( nStartDragX, nStartDragY );
SwFEShell::BeginDrag( &aTmp, FALSE );
}
else
SwFEShell::BeginDrag( pPt, FALSE );
return 1;
}
void SwWrtShell::EnterSelFrmMode(const Point *pPos)
{
if(pPos)
{
nStartDragX = pPos->X();
nStartDragY = pPos->Y();
bStartDrag = TRUE;
}
bNoEdit = bLayoutMode = TRUE;
HideCrsr();
// gleicher Aufruf von BeginDrag an der SwFEShell
fnDrag = &SwWrtShell::BeginFrmDrag;
fnEndDrag = &SwWrtShell::UpdateLayoutFrm;
SwBaseShell::SetFrmMode( FLY_DRAG_START, this );
Invalidate();
2000-09-18 16:15:01 +00:00
}
void SwWrtShell::LeaveSelFrmMode()
{
fnDrag = &SwWrtShell::BeginDrag;
fnEndDrag = &SwWrtShell::EndDrag;
bLayoutMode = FALSE;
bStartDrag = FALSE;
Edit();
SwBaseShell::SetFrmMode( FLY_DRAG_END, this );
Invalidate();
2000-09-18 16:15:01 +00:00
}
/*------------------------------------------------------------------------
Beschreibung: Rahmengebundenes Macro ausfuehren
------------------------------------------------------------------------*/
IMPL_LINK( SwWrtShell, ExecFlyMac, void *, pFlyFmt )
{
const SwFrmFmt *pFmt = pFlyFmt ? (SwFrmFmt*)pFlyFmt : GetFlyFrmFmt();
ASSERT(pFmt, kein FrameFormat.);
const SvxMacroItem &rFmtMac = pFmt->GetMacro();
if(rFmtMac.HasMacro(SW_EVENT_OBJECT_SELECT))
{
const SvxMacro &rMac = rFmtMac.GetMacro(SW_EVENT_OBJECT_SELECT);
if( IsFrmSelected() )
bLayoutMode = TRUE;
CallChgLnk();
ExecMacro( rMac );
}
return 0;
}
long SwWrtShell::UpdateLayoutFrm(const Point *pPt, BOOL )
{
// voerst Dummy
SwFEShell::EndDrag( pPt, FALSE );
fnDrag = &SwWrtShell::BeginFrmDrag;
return 1;
}
/*
* Handler fuer das Togglen der Modi. Liefern alten Mode zurueck.
*/
long SwWrtShell::ToggleAddMode()
{
bAddMode ? LeaveAddMode(): EnterAddMode();
Invalidate();
2000-09-18 16:15:01 +00:00
return !bAddMode;
}
long SwWrtShell::ToggleBlockMode()
{
bBlockMode ? LeaveBlockMode(): EnterBlockMode();
Invalidate();
return !bBlockMode;
}
2000-09-18 16:15:01 +00:00
long SwWrtShell::ToggleExtMode()
{
bExtMode ? LeaveExtMode() : EnterExtMode();
Invalidate();
2000-09-18 16:15:01 +00:00
return !bExtMode;
}
/*
* Draggen im Standard Modus (Selektieren von Inhalt)
*/
long SwWrtShell::BeginDrag(const Point * /*pPt*/, BOOL )
2000-09-18 16:15:01 +00:00
{
if(bSelWrd)
{
bInSelect = TRUE;
if( !IsCrsrPtAtEnd() )
SwapPam();
fnDrag = &SwWrtShell::ExtSelWrd;
fnSetCrsr = &SwWrtShell::Ignore;
}
else if(bSelLn)
{
bInSelect = TRUE;
fnDrag = &SwWrtShell::ExtSelLn;
fnSetCrsr = &SwWrtShell::Ignore;
}
else
{
fnDrag = &SwWrtShell::Drag;
SttSelect();
}
return 1;
}
long SwWrtShell::Drag(const Point *, BOOL )
{
if( IsSelTblCells() )
aSelTblLink.Call(this);
return 1;
}
long SwWrtShell::EndDrag(const Point * /*pPt*/, BOOL )
2000-09-18 16:15:01 +00:00
{
fnDrag = &SwWrtShell::BeginDrag;
if( IsExtSel() )
LeaveExtSel();
if( IsSelTblCells() )
aSelTblLink.Call(this);
EndSelect();
return 1;
}
// --> FME 2004-07-30 #i32329# Enhanced table selection
BOOL SwWrtShell::SelectTableRowCol( const Point& rPt, const Point* pEnd, bool bRowDrag )
{
MV_KONTEXT(this);
SttSelect();
if(SelTblRowCol( rPt, pEnd, bRowDrag ))
{
fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
fnKillSel = &SwWrtShell::ResetSelect;
return TRUE;
}
return FALSE;
}
// <--
2000-09-18 16:15:01 +00:00
/*------------------------------------------------------------------------
Beschreibung: Selektion einer Tabellenzeile / Spalte
------------------------------------------------------------------------*/
BOOL SwWrtShell::SelectTableRow()
2000-09-18 16:15:01 +00:00
{
if ( SelTblRow() )
{
fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
fnKillSel = &SwWrtShell::ResetSelect;
return TRUE;
}
return FALSE;
}
BOOL SwWrtShell::SelectTableCol()
2000-09-18 16:15:01 +00:00
{
if ( SelTblCol() )
{
fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
fnKillSel = &SwWrtShell::ResetSelect;
return TRUE;
}
return FALSE;
}
BOOL SwWrtShell::SelectTableCell()
{
if ( SelTblBox() )
{
fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
fnKillSel = &SwWrtShell::ResetSelect;
return TRUE;
}
return FALSE;
}
2000-09-18 16:15:01 +00:00
/*------------------------------------------------------------------------
Beschreibung: Prueft, ob eine Wortselektion vorliegt.
Gemaess den Regeln fuer intelligentes Cut / Paste
werden umgebende Spaces rausgeschnitten.
Return: Liefert Art der Wortselektion zurueck.
------------------------------------------------------------------------*/
int SwWrtShell::IntelligentCut(int nSelection, BOOL bCut)
{
// kein intelligentes Drag and Drop bei Mehrfachselektion
// es existieren mehrere Cursor, da ein zweiter bereits
// an die Zielposition gesetzt wurde
if( IsAddMode() || !(nSelection & nsSelectionType::SEL_TXT) )
2000-09-18 16:15:01 +00:00
return FALSE;
String sTxt;
CharClass& rCC = GetAppCharClass();
2000-09-18 16:15:01 +00:00
// wenn das erste und das letzte Zeichen kein Wortzeichen ist,
// ist kein Wort selektiert.
sal_Unicode cPrev = GetChar(FALSE);
sal_Unicode cNext = GetChar(TRUE, -1);
if( !cPrev || !cNext ||
!rCC.isLetterNumeric( ( sTxt = cPrev), 0 ) ||
!rCC.isLetterNumeric( ( sTxt = cNext), 0 ) )
2000-09-18 16:15:01 +00:00
return NO_WORD;
cPrev = GetChar(FALSE, -1);
cNext = GetChar(TRUE);
2000-09-18 16:15:01 +00:00
int cWord = NO_WORD;
// ist ein Wort selektiert?
if(!cWord && cPrev && cNext &&
CH_TXTATR_BREAKWORD != cPrev && CH_TXTATR_INWORD != cPrev &&
CH_TXTATR_BREAKWORD != cNext && CH_TXTATR_INWORD != cNext &&
!rCC.isLetterNumeric( ( sTxt = cPrev), 0 ) &&
!rCC.isLetterNumeric( ( sTxt = cNext), 0 ) )
2000-09-18 16:15:01 +00:00
cWord = WORD_NO_SPACE;
if(cWord == WORD_NO_SPACE && ' ' == cPrev )
2000-09-18 16:15:01 +00:00
{
cWord = WORD_SPACE_BEFORE;
// Space davor loeschen
if(bCut)
{
Push();
if(IsCrsrPtAtEnd())
SwapPam();
ClearMark();
SetMark();
SwCrsrShell::Left(1,CRSR_SKIP_CHARS);
2000-09-18 16:15:01 +00:00
SwFEShell::Delete();
Pop( FALSE );
}
}
else if(cWord == WORD_NO_SPACE && cNext == ' ')
{
cWord = WORD_SPACE_AFTER;
// Space dahinter loeschen
if(bCut) {
Push();
if(!IsCrsrPtAtEnd()) SwapPam();
ClearMark();
SetMark();
SwCrsrShell::Right(1,CRSR_SKIP_CHARS);
2000-09-18 16:15:01 +00:00
SwFEShell::Delete();
Pop( FALSE );
}
}
return cWord;
}
// jump to the next / previous hyperlink - inside text and also
// on graphics
BOOL SwWrtShell::SelectNextPrevHyperlink( BOOL bNext )
{
StartAction();
BOOL bRet = SwCrsrShell::SelectNxtPrvHyperlink( bNext );
if( !bRet )
{
// will we have this feature?
EnterStdMode();
if( bNext )
SttEndDoc(TRUE);
else
SttEndDoc(FALSE);
bRet = SwCrsrShell::SelectNxtPrvHyperlink( bNext );
}
EndAction();
BOOL bCreateXSelection = FALSE;
const BOOL bFrmSelected = IsFrmSelected() || IsObjSelected();
if( IsSelection() )
{
if ( bFrmSelected )
UnSelectFrm();
// Funktionspointer fuer das Aufheben der Selektion setzen
// bei Cursor setzen
fnKillSel = &SwWrtShell::ResetSelect;
fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
bCreateXSelection = TRUE;
}
else if( bFrmSelected )
{
EnterSelFrmMode();
bCreateXSelection = TRUE;
}
else if( (CNT_GRF | CNT_OLE ) & GetCntType() )
{
SelectObj( GetCharRect().Pos() );
EnterSelFrmMode();
bCreateXSelection = TRUE;
}
if( bCreateXSelection )
SwTransferable::CreateSelection( *this );
return bRet;
}
2000-09-18 16:15:01 +00:00
/* fuer den Erhalt der Selektion wird nach SetMark() der Cursor
* nach links bewegt, damit er durch das Einfuegen von Text nicht
* verschoben wird. Da auf der CORE-Seite am aktuellen Cursor
* eine bestehende Selektion aufgehoben wird, wird der Cursor auf
* den Stack gepushed. Nach dem Verschieben werden sie wieder
* zusammengefasst. */