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

966 lines
25 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
re-base on ALv2 code. Includes: Patches contributed by Oliver-Rainer Wittmann sw34bf06: #i117783# - Writer's implementation of XPagePrintable - apply print settings to new printing routines http://svn.apache.org/viewvc?view=revision&revision=1172115 sw34bf06: #o12311627# use <rtl_random> methods to create unique ids for list styles and list ids http://svn.apache.org/viewvc?view=revision&revision=1172112 sw34bf06 #i114725#,#i115828# - method <SwDoc::ClearDoc()> - clear list structures completely http://svn.apache.org/viewvc?view=revision&revision=1172122 i#118572 - remove ui string and help content regarding usage of Java Mail in Writer's Mail Merge as Java Mail is not used. http://svn.apache.org/viewvc?view=revision&revision=1197035 Patches contributed by Mathias Bauer cws mba34issues01: #i117718#: provide filter name in case storage of medium does not allow to detect one http://svn.apache.org/viewvc?view=revision&revision=1172350 cws mba34issues01: #i117721#: directly provide parameters retrieved from SfxMedium http://svn.apache.org/viewvc?view=revision&revision=1172353 gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394707 http://svn.apache.org/viewvc?view=revision&revision=1394326 http://svn.apache.org/viewvc?view=revision&revision=1396797 http://svn.apache.org/viewvc?view=revision&revision=1397315 cws mba34issues01: #i117723#: convert assertion into trace http://svn.apache.org/viewvc?view=revision&revision=1172355 cws mba34issues01: #i117699#: keep layout alive until swdoc dies http://svn.apache.org/viewvc?view=revision&revision=1172362 cws mba34issues01: #i117943#: missing color attributes in RTF clipboard http://svn.apache.org/viewvc?view=revision&revision=1172363 Patch contributed by Henning Brinkmann imported patch i#103878 http://svn.apache.org/viewvc?view=revision&revision=1172109 Patches contributed by Michael Stahl sw34bf06: #i117955#: WW8 export: disable storing of section breaks in endnotes http://svn.apache.org/viewvc?view=revision&revision=1172119 Patch contributed by imacat Fixed the Asian language work count. http://svn.apache.org/viewvc?view=revision&revision=1241345 Patch contributed by Pedro Giffuni i#20878 - Add comment with BZ issue for reference. http://svn.apache.org/viewvc?view=revision&revision=1244517 Patch contributed by Andre Fischer Do not add targets for junit tests when junit is disabled. http://svn.apache.org/viewvc?view=revision&revision=1241508 add writerperfect dependency.
2011-03-31 10:05:04 +02:00
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
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 <editeng/scripttypeitem.hxx>
2000-09-18 16:15:01 +00:00
#include <cmdid.h>
#include <view.hxx>
#include <basesh.hxx>
#include <wrtsh.hxx>
#include <frmatr.hxx>
#include <initui.hxx>
#include <mdiexp.hxx>
#include <fmtcol.hxx>
#include <frmfmt.hxx>
#include <swundo.hxx> // for Undo-Ids
2000-09-18 16:15:01 +00:00
#include <swevent.hxx>
#include <swdtflvr.hxx>
#include <crsskip.hxx>
#include <wordcountdialog.hxx>
2000-09-18 16:15:01 +00:00
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;
2000-09-18 16:15:01 +00:00
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 );
SwWordCountWrapper *pWrdCnt = (SwWordCountWrapper*)GetView().GetViewFrame()->GetChildWindow(SwWordCountWrapper::GetChildWindowId());
if (pWrdCnt)
pWrdCnt->UpdateCounts();
}
sal_Bool SwWrtShell::SelNearestWrd()
2000-09-18 16:15:01 +00:00
{
SwMvContext aMvContext(this);
2000-09-18 16:15:01 +00:00
if( !IsInWrd() && !IsEndWrd() && !IsSttWrd() )
PrvWrd();
if( IsEndWrd() )
Left(CRSR_SKIP_CELLS, sal_False, 1, sal_False );
2000-09-18 16:15:01 +00:00
return SelWrd();
}
sal_Bool SwWrtShell::SelWrd(const Point *pPt, sal_Bool )
2000-09-18 16:15:01 +00:00
{
sal_Bool bRet;
2000-09-18 16:15:01 +00:00
{
SwMvContext aMvContext(this);
2000-09-18 16:15:01 +00:00
SttSelect();
bRet = SwCrsrShell::SelectWord( pPt );
}
EndSelect();
if( bRet )
{
bSelWrd = sal_True;
2000-09-18 16:15:01 +00:00
if(pPt)
aStart = *pPt;
}
return bRet;
}
void SwWrtShell::SelSentence(const Point *pPt, sal_Bool )
2000-09-18 16:15:01 +00:00
{
{
SwMvContext aMvContext(this);
2000-09-18 16:15:01 +00:00
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 = sal_True;
bSelWrd = sal_False; // disable SelWord, otherwise no SelLine goes on
2000-09-18 16:15:01 +00:00
}
void SwWrtShell::SelPara(const Point *pPt, sal_Bool )
2000-09-18 16:15:01 +00:00
{
{
SwMvContext aMvContext(this);
2000-09-18 16:15:01 +00:00
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 = sal_False;
bSelWrd = sal_False; // disable SelWord, otherwise no SelLine goes on
2000-09-18 16:15:01 +00:00
}
long SwWrtShell::SelAll()
{
const sal_Bool bLockedView = IsViewLocked();
LockView( sal_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();
SwMvContext aMvContext(this);
sal_Bool bMoveTable = sal_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();
sal_Bool bIsFullSel = !MoveSection( fnSectionCurr, fnSectionStart);
2000-09-18 16:15:01 +00:00
SwapPam();
bIsFullSel &= !MoveSection( fnSectionCurr, fnSectionEnd);
Pop(sal_False);
GoStart(sal_True, &bMoveTable, sal_False, !bIsFullSel);
2000-09-18 16:15:01 +00:00
}
else
{
EnterStdMode();
SttEndDoc(sal_True);
2000-09-18 16:15:01 +00:00
}
SttSelect();
GoEnd(sal_True, &bMoveTable);
if (StartsWithTable())
ExtendedSelectAll();
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(sal_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
}
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;
}
// Desciption: Text search
2000-09-18 16:15:01 +00:00
sal_uLong SwWrtShell::SearchPattern( const SearchOptions& rSearchOpt, sal_Bool bSearchInNotes,
2000-09-18 16:15:01 +00:00
SwDocPositions eStt, SwDocPositions eEnd,
FindRanges eFlags, int bReplace )
{
// no enhancement of existing selections
2000-09-18 16:15:01 +00:00
if(!(eFlags & FND_IN_SEL))
ClearMark();
sal_Bool bCancel = sal_False;
sal_uLong nRet = Find( rSearchOpt, bSearchInNotes, eStt, eEnd, bCancel, eFlags, bReplace );
if(bCancel)
{
Undo(1);
nRet = ULONG_MAX;
}
return nRet;
2000-09-18 16:15:01 +00:00
}
// Description: search for templates
2000-09-18 16:15:01 +00:00
sal_uLong SwWrtShell::SearchTempl( const String &rTempl,
2000-09-18 16:15:01 +00:00
SwDocPositions eStt, SwDocPositions eEnd,
FindRanges eFlags, const String* pReplTempl )
{
// no enhancement of existing selections
2000-09-18 16:15:01 +00:00
if(!(eFlags & FND_IN_SEL))
ClearMark();
SwTxtFmtColl *pColl = GetParaStyle(rTempl, SwWrtShell::GETSTYLE_CREATESOME);
SwTxtFmtColl *pReplaceColl = 0;
if( pReplTempl )
pReplaceColl = GetParaStyle(*pReplTempl, SwWrtShell::GETSTYLE_CREATESOME );
sal_Bool bCancel = sal_False;
sal_uLong nRet = Find(pColl? *pColl: GetDfltTxtFmtColl(),
eStt,eEnd, bCancel, eFlags, pReplaceColl);
if(bCancel)
{
Undo(1);
nRet = ULONG_MAX;
}
return nRet;
2000-09-18 16:15:01 +00:00
}
// search for attributes
2000-09-18 16:15:01 +00:00
sal_uLong SwWrtShell::SearchAttr( const SfxItemSet& rFindSet, sal_Bool bNoColls,
2000-09-18 16:15:01 +00:00
SwDocPositions eStart, SwDocPositions eEnde,
FindRanges eFlags, const SearchOptions* pSearchOpt,
2000-09-18 16:15:01 +00:00
const SfxItemSet* pReplaceSet )
{
// no enhancement of existing selections
2000-09-18 16:15:01 +00:00
if (!(eFlags & FND_IN_SEL))
ClearMark();
// Searching
sal_Bool bCancel = sal_False;
sal_uLong nRet = Find( rFindSet, bNoColls, eStart, eEnde, bCancel, eFlags, pSearchOpt, pReplaceSet);
if(bCancel)
{
Undo(1);
nRet = ULONG_MAX;
}
return nRet;
2000-09-18 16:15:01 +00:00
}
// Selection modes
2000-09-18 16:15:01 +00:00
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;
}
// Two methodes for setting cursors: the first maps at the
// eponymous methodes in the CursorShell, the second removes
// all selections at first.
2000-09-18 16:15:01 +00:00
long SwWrtShell::SetCrsr(const Point *pPt, sal_Bool bTextOnly)
2000-09-18 16:15:01 +00:00
{
// Remove a possibly present selection at the position
// of the mouseclick
2000-09-18 16:15:01 +00:00
if(!IsInSelect() && ChgCurrPam(*pPt)) {
ClearMark();
}
2000-09-18 16:15:01 +00:00
return SwCrsrShell::SetCrsr(*pPt, bTextOnly);
}
long SwWrtShell::SetCrsrKillSel(const Point *pPt, sal_Bool bTextOnly )
2000-09-18 16:15:01 +00:00
{
SwActContext aActContext(this);
ResetSelect(pPt,sal_False);
2000-09-18 16:15:01 +00:00
return SwCrsrShell::SetCrsr(*pPt, bTextOnly);
}
void SwWrtShell::UnSelectFrm()
{
// Remove Frame selection with guaranteed invalid 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
}
// Remove of all selections
2000-09-18 16:15:01 +00:00
long SwWrtShell::ResetSelect(const Point *,sal_Bool)
2000-09-18 16:15:01 +00:00
{
if(IsSelFrmMode())
{
UnSelectFrm();
LeaveSelFrmMode();
}
else
{
// SwActContext opens an Action -
// to avoid problems in the basic process with the
// shell switching, GetChgLnk().Call() may be called
// after EndAction().
2000-09-18 16:15:01 +00:00
{
SwActContext aActContext(this);
bSelWrd = bSelLn = sal_False;
2000-09-18 16:15:01 +00:00
KillPams();
ClearMark();
fnKillSel = &SwWrtShell::Ignore;
fnSetCrsr = &SwWrtShell::SetCrsr;
}
// After canceling of all selections an update of Attr-Controls
// could be necessary.
2000-09-18 16:15:01 +00:00
GetChgLnk().Call(this);
}
Invalidate();
SwTransferable::ClearSelection( *this );
2000-09-18 16:15:01 +00:00
return 1;
}
// Do nothing
2000-09-18 16:15:01 +00:00
long SwWrtShell::Ignore(const Point *, sal_Bool ) {
2000-09-18 16:15:01 +00:00
return 1;
}
// Begin of a selection process.
2000-09-18 16:15:01 +00:00
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 = sal_True;
Invalidate();
SwTransferable::CreateSelection( *this );
2000-09-18 16:15:01 +00:00
}
// End of a selection process.
2000-09-18 16:15:01 +00:00
void SwWrtShell::EndSelect()
{
if(bInSelect && !bExtMode)
{
bInSelect = sal_False;
if (bAddMode)
{
AddLeaveSelect(0, sal_False);
}
else
{
SttLeaveSelect(0, sal_False);
fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
fnKillSel = &SwWrtShell::ResetSelect;
}
2000-09-18 16:15:01 +00:00
}
SwWordCountWrapper *pWrdCnt = (SwWordCountWrapper*)GetView().GetViewFrame()->GetChildWindow(SwWordCountWrapper::GetChildWindowId());
if (pWrdCnt)
pWrdCnt->UpdateCounts();
2000-09-18 16:15:01 +00:00
}
// Methode to enhance a selecton word by word or line by line.
2000-09-18 16:15:01 +00:00
inline bool operator<(const Point &rP1,const Point &rP2)
2000-09-18 16:15:01 +00:00
{
return rP1.Y() < rP2.Y() || (rP1.Y() == rP2.Y() && rP1.X() < rP2.X());
}
long SwWrtShell::ExtSelWrd(const Point *pPt, sal_Bool )
2000-09-18 16:15:01 +00:00
{
SwMvContext aMvContext(this);
2000-09-18 16:15:01 +00:00
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() )
{
sal_Bool bHasMark = HasMark(); // thats wrong!
2000-09-18 16:15:01 +00:00
GoNextCrsr();
if( bHasMark )
{
DestroyCrsr();
GoPrevCrsr();
}
}
// check the direction of the selection with the new point
sal_Bool bRet = sal_False, bMoveCrsr = sal_True, bToTop = sal_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 = sal_False; break;
case 1: bToTop = sal_True; break;
default: bMoveCrsr = sal_False; break;
2000-09-18 16:15:01 +00:00
}
SwCrsrShell::Pop( sal_False ); // retore the saved cursor
2000-09-18 16:15:01 +00:00
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 = sal_True;
2000-09-18 16:15:01 +00:00
}
else
{
SwCrsrShell::Pop( sal_False );
2000-09-18 16:15:01 +00:00
if( bToTop )
SwapPam();
}
}
else
bRet = sal_True;
2000-09-18 16:15:01 +00:00
return bRet;
}
long SwWrtShell::ExtSelLn(const Point *pPt, sal_Bool )
2000-09-18 16:15:01 +00:00
{
SwMvContext aMvContext(this);
2000-09-18 16:15:01 +00:00
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() )
{
sal_Bool bHasMark = HasMark(); // thats wrong!
2000-09-18 16:15:01 +00:00
GoNextCrsr();
if( bHasMark )
{
DestroyCrsr();
GoPrevCrsr();
}
}
// if applicable fit the selection to the "Mark"
sal_Bool bToTop = !IsCrsrPtAtEnd();
2000-09-18 16:15:01 +00:00
SwapPam();
// The "Mark" has to be at the end or the beginning of the line.
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
}
// Back into the standard mode: no mode, no selections.
2000-09-18 16:15:01 +00:00
void SwWrtShell::EnterStdMode()
{
if(bAddMode)
LeaveAddMode();
if(bBlockMode)
LeaveBlockMode();
bBlockMode = sal_False;
bExtMode = sal_False;
bInSelect = sal_False;
if(IsSelFrmMode())
{
UnSelectFrm();
LeaveSelFrmMode();
}
else
{
// SwActContext opens and action which has to be
// closed prior to the call of
// GetChgLnk().Call()
{
SwActContext aActContext(this);
bSelWrd = bSelLn = sal_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
2000-09-18 16:15:01 +00:00
void SwWrtShell::EnterExtMode()
{
if(bBlockMode)
{
LeaveBlockMode();
KillPams();
ClearMark();
}
bExtMode = sal_True;
bAddMode = sal_False;
bBlockMode = sal_False;
2000-09-18 16:15:01 +00:00
SttSelect();
}
void SwWrtShell::LeaveExtMode()
{
bExtMode = sal_False;
2000-09-18 16:15:01 +00:00
EndSelect();
}
// End of a selection; if the selection is empty,
// ClearMark().
2000-09-18 16:15:01 +00:00
long SwWrtShell::SttLeaveSelect(const Point *, sal_Bool )
2000-09-18 16:15:01 +00:00
{
if(SwCrsrShell::HasSelection() && !IsSelTblCells() && bClearMark) {
return 0;
}
ClearMark();
return 1;
}
// Leaving of the selection mode in additional mode
2000-09-18 16:15:01 +00:00
long SwWrtShell::AddLeaveSelect(const Point *, sal_Bool )
2000-09-18 16:15:01 +00:00
{
if(IsTableMode()) LeaveAddMode();
else if(SwCrsrShell::HasSelection())
CreateCrsr();
return 1;
}
// Additional Mode
2000-09-18 16:15:01 +00:00
void SwWrtShell::EnterAddMode()
{
if(IsTableMode()) return;
if(bBlockMode)
LeaveBlockMode();
2000-09-18 16:15:01 +00:00
fnKillSel = &SwWrtShell::Ignore;
fnSetCrsr = &SwWrtShell::SetCrsr;
bAddMode = sal_True;
bBlockMode = sal_False;
bExtMode = sal_False;
2000-09-18 16:15:01 +00:00
if(SwCrsrShell::HasSelection())
CreateCrsr();
Invalidate();
2000-09-18 16:15:01 +00:00
}
void SwWrtShell::LeaveAddMode()
{
fnKillSel = &SwWrtShell::ResetSelect;
fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
bAddMode = sal_False;
Invalidate();
2000-09-18 16:15:01 +00:00
}
// Block Mode
void SwWrtShell::EnterBlockMode()
{
bBlockMode = sal_False;
EnterStdMode();
bBlockMode = sal_True;
CrsrToBlockCrsr();
Invalidate();
}
void SwWrtShell::LeaveBlockMode()
{
bBlockMode = sal_False;
BlockCrsrToCrsr();
EndSelect();
Invalidate();
}
// Insert mode
2000-09-18 16:15:01 +00:00
void SwWrtShell::SetInsMode( sal_Bool bOn )
2000-09-18 16:15:01 +00:00
{
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( sal_uInt16 eMode )
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
{
SetRedlineMode( eMode );
if (IsRedlineOn())
SetInsMode( true );
}
2000-09-18 16:15:01 +00:00
// Edit frame
2000-09-18 16:15:01 +00:00
long SwWrtShell::BeginFrmDrag(const Point *pPt, sal_Bool)
2000-09-18 16:15:01 +00:00
{
fnDrag = &SwFEShell::Drag;
if(bStartDrag)
{
Point aTmp( nStartDragX, nStartDragY );
SwFEShell::BeginDrag( &aTmp, sal_False );
2000-09-18 16:15:01 +00:00
}
else
SwFEShell::BeginDrag( pPt, sal_False );
2000-09-18 16:15:01 +00:00
return 1;
}
void SwWrtShell::EnterSelFrmMode(const Point *pPos)
{
if(pPos)
{
nStartDragX = pPos->X();
nStartDragY = pPos->Y();
bStartDrag = true;
2000-09-18 16:15:01 +00:00
}
bLayoutMode = sal_True;
2000-09-18 16:15:01 +00:00
HideCrsr();
// equal call of BeginDrag in the SwFEShell
2000-09-18 16:15:01 +00:00
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 = sal_False;
bStartDrag = false;
2000-09-18 16:15:01 +00:00
Edit();
SwBaseShell::SetFrmMode( FLY_DRAG_END, this );
Invalidate();
2000-09-18 16:15:01 +00:00
}
// Description: execute framebound macro
2000-09-18 16:15:01 +00:00
IMPL_LINK( SwWrtShell, ExecFlyMac, void *, pFlyFmt )
{
const SwFrmFmt *pFmt = pFlyFmt ? (SwFrmFmt*)pFlyFmt : GetFlyFrmFmt();
OSL_ENSURE(pFmt, "no frame format");
2000-09-18 16:15:01 +00:00
const SvxMacroItem &rFmtMac = pFmt->GetMacro();
if(rFmtMac.HasMacro(SW_EVENT_OBJECT_SELECT))
{
const SvxMacro &rMac = rFmtMac.GetMacro(SW_EVENT_OBJECT_SELECT);
if( IsFrmSelected() )
bLayoutMode = sal_True;
2000-09-18 16:15:01 +00:00
CallChgLnk();
ExecMacro( rMac );
}
return 0;
}
long SwWrtShell::UpdateLayoutFrm(const Point *pPt, sal_Bool )
2000-09-18 16:15:01 +00:00
{
// still a dummy
SwFEShell::EndDrag( pPt, sal_False );
2000-09-18 16:15:01 +00:00
fnDrag = &SwWrtShell::BeginFrmDrag;
return 1;
}
// Handler for toggling the modes. Returns back the old mode.
2000-09-18 16:15:01 +00:00
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;
}
// Dragging in standard mode (Selecting of content)
2000-09-18 16:15:01 +00:00
long SwWrtShell::BeginDrag(const Point * /*pPt*/, sal_Bool )
2000-09-18 16:15:01 +00:00
{
if(bSelWrd)
{
bInSelect = sal_True;
2000-09-18 16:15:01 +00:00
if( !IsCrsrPtAtEnd() )
SwapPam();
fnDrag = &SwWrtShell::ExtSelWrd;
fnSetCrsr = &SwWrtShell::Ignore;
}
else if(bSelLn)
{
bInSelect = sal_True;
2000-09-18 16:15:01 +00:00
fnDrag = &SwWrtShell::ExtSelLn;
fnSetCrsr = &SwWrtShell::Ignore;
}
else
{
fnDrag = &SwWrtShell::Drag;
SttSelect();
}
return 1;
}
long SwWrtShell::Drag(const Point *, sal_Bool )
2000-09-18 16:15:01 +00:00
{
if( IsSelTblCells() )
aSelTblLink.Call(this);
return 1;
}
long SwWrtShell::EndDrag(const Point * /*pPt*/, sal_Bool )
2000-09-18 16:15:01 +00:00
{
fnDrag = &SwWrtShell::BeginDrag;
if( IsExtSel() )
LeaveExtSel();
if( IsSelTblCells() )
aSelTblLink.Call(this);
EndSelect();
return 1;
}
// #i32329# Enhanced table selection
sal_Bool SwWrtShell::SelectTableRowCol( const Point& rPt, const Point* pEnd, bool bRowDrag )
{
SwMvContext aMvContext(this);
SttSelect();
if(SelTblRowCol( rPt, pEnd, bRowDrag ))
{
fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
fnKillSel = &SwWrtShell::ResetSelect;
return sal_True;
}
return sal_False;
}
// Description: Selection of a table line or column
2000-09-18 16:15:01 +00:00
sal_Bool SwWrtShell::SelectTableRow()
2000-09-18 16:15:01 +00:00
{
if ( SelTblRow() )
{
fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
fnKillSel = &SwWrtShell::ResetSelect;
return sal_True;
2000-09-18 16:15:01 +00:00
}
return sal_False;
2000-09-18 16:15:01 +00:00
}
sal_Bool SwWrtShell::SelectTableCol()
2000-09-18 16:15:01 +00:00
{
if ( SelTblCol() )
{
fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
fnKillSel = &SwWrtShell::ResetSelect;
return sal_True;
2000-09-18 16:15:01 +00:00
}
return sal_False;
2000-09-18 16:15:01 +00:00
}
sal_Bool SwWrtShell::SelectTableCell()
{
if ( SelTblBox() )
{
fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
fnKillSel = &SwWrtShell::ResetSelect;
return sal_True;
}
return sal_False;
}
2000-09-18 16:15:01 +00:00
// Description: Check if a word selection is present.
// According to the rules for intelligent cut / paste
// surrounding spaces are cut out.
// Return: Delivers the type of the word selection.
2000-09-18 16:15:01 +00:00
int SwWrtShell::IntelligentCut(int nSelection, sal_Bool bCut)
2000-09-18 16:15:01 +00:00
{
// On multiple selection no intelligent drag and drop
// there are multiple cursors, since a second was placed
// already at the target postion.
if( IsAddMode() || !(nSelection & nsSelectionType::SEL_TXT) )
return sal_False;
2000-09-18 16:15:01 +00:00
String sTxt;
CharClass& rCC = GetAppCharClass();
// If the first character is no word character,
// no word selected.
sal_Unicode cPrev = GetChar(sal_False);
sal_Unicode cNext = GetChar(sal_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(sal_False, -1);
cNext = GetChar(sal_True);
2000-09-18 16:15:01 +00:00
int cWord = NO_WORD;
// is a word seleced?
2000-09-18 16:15:01 +00:00
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;
// delete the space before
2000-09-18 16:15:01 +00:00
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( sal_False );
2000-09-18 16:15:01 +00:00
}
}
else if(cWord == WORD_NO_SPACE && cNext == ' ')
{
cWord = WORD_SPACE_AFTER;
// delete the space behind
2000-09-18 16:15:01 +00:00
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( sal_False );
2000-09-18 16:15:01 +00:00
}
}
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(sal_True);
else
SttEndDoc(sal_False);
bRet = SwCrsrShell::SelectNxtPrvHyperlink( bNext );
}
EndAction();
bool bCreateXSelection = false;
const bool bFrmSelected = IsFrmSelected() || IsObjSelected();
if( IsSelection() )
{
if ( bFrmSelected )
UnSelectFrm();
// Set the function pointer for the canceling of the selection
// set at cursor
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;
}
// For the preservation of the selection the cursor will be moved left
// after SetMark(), so that the cursor is not moved by inserting text.
// Because a present selection at the CORE page is cleared at the
// current cursor position, the cursor will be pushed on the stack.
// After moving, they will again resummarized.
2000-09-18 16:15:01 +00:00
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */