summaryrefslogtreecommitdiff
path: root/sw/source/ui/wrtsh
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/ui/wrtsh')
-rw-r--r--sw/source/ui/wrtsh/select.cxx26
-rw-r--r--sw/source/ui/wrtsh/wrtsh1.cxx95
-rw-r--r--sw/source/ui/wrtsh/wrtsh2.cxx7
3 files changed, 90 insertions, 38 deletions
diff --git a/sw/source/ui/wrtsh/select.cxx b/sw/source/ui/wrtsh/select.cxx
index f45c68ef7ec9..b46cbdb3a1a5 100644
--- a/sw/source/ui/wrtsh/select.cxx
+++ b/sw/source/ui/wrtsh/select.cxx
@@ -73,6 +73,13 @@ using namespace ::com::sun::star::util;
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 );
+}
+
BOOL SwWrtShell::SelNearestWrd()
{
MV_KONTEXT(this);
@@ -140,8 +147,9 @@ long SwWrtShell::SelAll()
{
const BOOL bLockedView = IsViewLocked();
LockView( TRUE );
-
{
+ if(bBlockMode)
+ LeaveBlockMode();
MV_KONTEXT(this);
BOOL bMoveTable = FALSE;
SwPosition *pStartPos = 0;
@@ -191,9 +199,7 @@ long SwWrtShell::SelAll()
}
}
EndSelect();
-
LockView( bLockedView );
-
return 1;
}
@@ -337,6 +343,7 @@ void SwWrtShell::UnSelectFrm()
// Rahmenselektion aufheben mit garantiert ungueltiger Position
Point aPt(LONG_MIN, LONG_MIN);
SelectObj(aPt, 0);
+ GetView().LeaveDrawCreate();
SwTransferable::ClearSelection( *this );
}
@@ -375,6 +382,7 @@ long SwWrtShell::ResetSelect(const Point *,BOOL)
*/
GetChgLnk().Call(this);
}
+ Invalidate();
SwTransferable::ClearSelection( *this );
return 1;
}
@@ -409,6 +417,7 @@ void SwWrtShell::SttSelect()
fnKillSel = &SwWrtShell::Ignore;
fnSetCrsr = &SwWrtShell::SetCrsr;
bInSelect = TRUE;
+ Invalidate();
SwTransferable::CreateSelection( *this );
}
/*
@@ -577,6 +586,7 @@ void SwWrtShell::EnterStdMode()
fnKillSel = &SwWrtShell::ResetSelect;
}
}
+ Invalidate();
SwTransferable::ClearSelection( *this );
}
@@ -655,6 +665,7 @@ void SwWrtShell::EnterAddMode()
bExtMode = FALSE;
if(SwCrsrShell::HasSelection())
CreateCrsr();
+ Invalidate();
}
@@ -665,6 +676,7 @@ void SwWrtShell::LeaveAddMode()
fnKillSel = &SwWrtShell::ResetSelect;
fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
bAddMode = FALSE;
+ Invalidate();
}
/*
@@ -677,6 +689,7 @@ void SwWrtShell::EnterBlockMode()
EnterStdMode();
bBlockMode = TRUE;
CrsrToBlockCrsr();
+ Invalidate();
}
@@ -686,6 +699,7 @@ void SwWrtShell::LeaveBlockMode()
bBlockMode = FALSE;
BlockCrsrToCrsr();
EndSelect();
+ Invalidate();
}
// Einfuegemodus
@@ -700,6 +714,7 @@ void SwWrtShell::SetInsMode( BOOL bOn )
GetView().GetViewFrame()->GetBindings().SetState( aTmp );
StartAction();
EndAction();
+ Invalidate();
}
//Overwrite mode is incompatible with red-lining
void SwWrtShell::SetRedlineModeAndCheckInsMode( USHORT eMode )
@@ -744,6 +759,7 @@ void SwWrtShell::EnterSelFrmMode(const Point *pPos)
fnDrag = &SwWrtShell::BeginFrmDrag;
fnEndDrag = &SwWrtShell::UpdateLayoutFrm;
SwBaseShell::SetFrmMode( FLY_DRAG_START, this );
+ Invalidate();
}
@@ -756,6 +772,7 @@ void SwWrtShell::LeaveSelFrmMode()
bStartDrag = FALSE;
Edit();
SwBaseShell::SetFrmMode( FLY_DRAG_END, this );
+ Invalidate();
}
/*------------------------------------------------------------------------
Beschreibung: Rahmengebundenes Macro ausfuehren
@@ -799,6 +816,7 @@ long SwWrtShell::UpdateLayoutFrm(const Point *pPt, BOOL )
long SwWrtShell::ToggleAddMode()
{
bAddMode ? LeaveAddMode(): EnterAddMode();
+ Invalidate();
return !bAddMode;
}
@@ -806,6 +824,7 @@ long SwWrtShell::ToggleAddMode()
long SwWrtShell::ToggleBlockMode()
{
bBlockMode ? LeaveBlockMode(): EnterBlockMode();
+ Invalidate();
return !bBlockMode;
}
@@ -813,6 +832,7 @@ long SwWrtShell::ToggleBlockMode()
long SwWrtShell::ToggleExtMode()
{
bExtMode ? LeaveExtMode() : EnterExtMode();
+ Invalidate();
return !bExtMode;
}
/*
diff --git a/sw/source/ui/wrtsh/wrtsh1.cxx b/sw/source/ui/wrtsh/wrtsh1.cxx
index a98e8ade9824..cd6bb82739ca 100644
--- a/sw/source/ui/wrtsh/wrtsh1.cxx
+++ b/sw/source/ui/wrtsh/wrtsh1.cxx
@@ -70,7 +70,6 @@
#include <svx/extrusionbar.hxx>
#include <svx/fontworkbar.hxx>
#include <fmtftn.hxx>
-#include <fmthbsh.hxx>
#include <fmtpdsc.hxx>
#ifndef _WDOCSH_HXX
#include <wdocsh.hxx>
@@ -245,6 +244,7 @@ void SwWrtShell::Insert( const String &rStr )
BOOL bStarted = FALSE, bHasSel = HasSelection(),
bCallIns = bIns /*|| bHasSel*/;
+ bool bDeleted = false;
if( bHasSel || ( !bIns && SelectHiddenRange() ) )
{
@@ -268,7 +268,7 @@ void SwWrtShell::Insert( const String &rStr )
StartUndo(UNDO_REPLACE, &aRewriter);
bStarted = TRUE;
- DelRight();
+ bDeleted = DelRight() != 0;
}
/*
@@ -283,7 +283,8 @@ JP 21.01.98: Ueberschreiben ueberschreibt nur die Selektion, nicht das
}
else
*/
- bCallIns ? SwEditShell::Insert( rStr ) : SwEditShell::Overwrite( rStr );
+ bCallIns ?
+ SwEditShell::Insert2( rStr, bDeleted ) : SwEditShell::Overwrite( rStr );
if( bStarted )
@@ -1103,7 +1104,7 @@ void SwWrtShell::NumOrBulletOn(BOOL bNum)
pDoc->FindNumRulePtr(pColl->GetNumRule( FALSE ).GetValue());
if ( !pDirectCollRule )
{
- pCollRule = 0L;
+ pCollRule = 0;
}
}
// --> OD 2006-11-20 #i71764#
@@ -1141,12 +1142,9 @@ void SwWrtShell::NumOrBulletOn(BOOL bNum)
{
// check, if numbering of the outline level of the pararaph
// style is active. If not, activate this outline level.
- //nActivateOutlineLvl = pColl->GetOutlineLevel(); //#outline level,zhaojianwei
- //ASSERT( /*nActivateOutlineLvl >= 0 &&*/ nActivateOutlineLvl < MAXLEVEL,
nActivateOutlineLvl = pColl->GetAssignedOutlineStyleLevel();
ASSERT( pColl->IsAssignedToListLevelOfOutlineStyle(), //<-end,zhaojianwei
"<SwWrtShell::NumOrBulletOn(..)> - paragraph style with outline rule, but no outline level" );
- //if ( /*nActivateOutlineLvl >= 0 &&*/ nActivateOutlineLvl < MAXLEVEL && //#outline level,zhaojianwei
if ( pColl->IsAssignedToListLevelOfOutlineStyle() && //<-end,zhaojianwei
pCollRule->Get( static_cast<USHORT>(nActivateOutlineLvl) ).GetNumberingType()
== SVX_NUM_NUMBER_NONE )
@@ -1162,31 +1160,40 @@ void SwWrtShell::NumOrBulletOn(BOOL bNum)
}
else
{
+ // --> OD 2009-08-27 #i101234#
// activate outline numbering, because from the precondition
// it's known, that <SwEdit::HasNumber()> == FALSE
bActivateOutlineRule = true;
- //nActivateOutlineLvl = pColl->GetOutlineLevel(); //#outline level,zhaojianwei
nActivateOutlineLvl = pColl->GetAssignedOutlineStyleLevel();//<-end,zhaojianwei
}
}
else if ( !pNumRule )
{
- // activate outline numbering, because from the precondition
- // it's known, that <SwEdit::HasNumber()> == FALSE
- bActivateOutlineRule = true;
- //nActivateOutlineLvl = pColl->GetOutlineLevel(); //#outline level,zhaojianwei
+ // --> OD 2009-08-27 #i101234#
+ // Check, if corresponding list level of the outline numbering
+ // has already a numbering format set.
nActivateOutlineLvl = pColl->GetAssignedOutlineStyleLevel();//<-end,zhaojianwei,need further consideration
+ if ( pCollRule->Get( static_cast<USHORT>(nActivateOutlineLvl) ).GetNumberingType()
+ == SVX_NUM_NUMBER_NONE )
+ {
+ // activate outline numbering, because from the precondition
+ // it's known, that <SwEdit::HasNumber()> == FALSE
+ bActivateOutlineRule = true;
+ }
+ else
+ {
+ // turning on outline numbering at current cursor position
+ bContinueFoundNumRule = true;
+ }
+ // <--
}
else
{
// check, if numbering of the outline level of the pararaph
// style is active. If not, activate this outline level.
- //nActivateOutlineLvl = pColl->GetOutlineLevel();
nActivateOutlineLvl = pColl->GetAssignedOutlineStyleLevel();//#outline level,zhaojianwei
- //ASSERT( /*nActivateOutlineLvl >= 0 &&*/ nActivateOutlineLvl < MAXLEVEL,
ASSERT( pColl->IsAssignedToListLevelOfOutlineStyle(),//#outline level,zhaojianwei
"<SwWrtShell::NumOrBulletOn(..)> - paragraph style with outline rule, but no outline level" );
- //if ( /*nActivateOutlineLvl >= 0 &&*/ nActivateOutlineLvl < MAXLEVEL &&
if ( pColl->IsAssignedToListLevelOfOutlineStyle() &&//#outline level,zhaojianwei
pCollRule->Get( static_cast<USHORT>(nActivateOutlineLvl) ).GetNumberingType()
== SVX_NUM_NUMBER_NONE )
@@ -1212,12 +1219,12 @@ void SwWrtShell::NumOrBulletOn(BOOL bNum)
{
if ( !pNumRule->IsAutoRule() )
{
- pNumRule = 0L;
+ pNumRule = 0;
}
else if ( pNumRule == GetDoc()->GetOutlineNumRule() &&
!bActivateOutlineRule && !bContinueFoundNumRule )
{
- pNumRule = 0L;
+ pNumRule = 0;
}
}
// <--
@@ -1229,7 +1236,7 @@ void SwWrtShell::NumOrBulletOn(BOOL bNum)
if ( !pNumRule )
{
pNumRule = GetDoc()->SearchNumRule( *GetCrsr()->GetPoint(),
- FALSE, bNum, FALSE, 0,
+ false, bNum, false, 0,
sContinuedListId );
bContinueFoundNumRule = pNumRule != 0;
}
@@ -1290,11 +1297,12 @@ void SwWrtShell::NumOrBulletOn(BOOL bNum)
}
else
{
+ // --> OD 2009-08-27 #i95907#
+ const SvxNumberFormat::SvxNumPositionAndSpaceMode ePosAndSpaceMode(
+ numfunc::GetDefaultPositionAndSpaceMode() );
// --> OD 2008-02-11 #newlistlevelattrs#
- SwNumRule aNumRule( GetUniqueNumRuleName(),
- // --> OD 2008-06-06 #i89178#
- numfunc::GetDefaultPositionAndSpaceMode() );
- // <--
+ SwNumRule aNumRule( GetUniqueNumRuleName(), ePosAndSpaceMode );
+ // <--
// <--
// Zeichenvorlage an die Numerierung haengen
SwCharFmt* pChrFmt;
@@ -1315,9 +1323,10 @@ void SwWrtShell::NumOrBulletOn(BOOL bNum)
pChrFmt = GetCharFmtFromPool( RES_POOLCHR_BUL_LEVEL );
}
- SwTxtNode * pTxtNode =
- GetCrsr()->GetPoint()->nNode.GetNode().GetTxtNode();
- USHORT nWidthOfTabs = pTxtNode->GetWidthOfLeadingTabs();
+ const SwTxtNode* pTxtNode = GetCrsr()->GetPoint()->nNode.GetNode().GetTxtNode();
+ const SwTwips nWidthOfTabs = pTxtNode
+ ? pTxtNode->GetWidthOfLeadingTabs()
+ : 0;
GetDoc()->RemoveLeadingWhiteSpace( *GetCrsr()->GetPoint() );
const bool bHtml = 0 != PTR_CAST(SwWebDocShell, pDocSh);
@@ -1339,16 +1348,21 @@ void SwWrtShell::NumOrBulletOn(BOOL bNum)
aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
}
- if(bHtml && nLvl)
- {
- // 1/2" fuer HTML
- aFmt.SetLSpace(720);
- aFmt.SetAbsLSpace(nLvl * 720);
- }
- else if ( nWidthOfTabs > 0 )
+ // --> OD 2009-08-26 #i95907#
+ if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
{
- aFmt.SetAbsLSpace(nWidthOfTabs + nLvl * 720);
+ if(bHtml && nLvl)
+ {
+ // 1/2" fuer HTML
+ aFmt.SetLSpace(720);
+ aFmt.SetAbsLSpace(nLvl * 720);
+ }
+ else if ( nWidthOfTabs > 0 )
+ {
+ aFmt.SetAbsLSpace(nWidthOfTabs + nLvl * 720);
+ }
}
+ // <--
// --> FME 2005-01-21 #i38904# Default alignment for
// numbering/bullet should be rtl in rtl paragraph:
@@ -1361,6 +1375,21 @@ void SwWrtShell::NumOrBulletOn(BOOL bNum)
aNumRule.Set( nLvl, aFmt );
}
+ // --> OD 2009-08-26 #i95907#
+ if ( pTxtNode &&
+ ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ short nTxtNodeFirstLineOffset( 0 );
+ pTxtNode->GetFirstLineOfsWithNum( nTxtNodeFirstLineOffset );
+ const SwTwips nTxtNodeIndent = pTxtNode->GetLeftMarginForTabCalculation() +
+ nTxtNodeFirstLineOffset;
+ if ( ( nTxtNodeIndent + nWidthOfTabs ) != 0 )
+ {
+ const SwTwips nIndentChange = nTxtNodeIndent + nWidthOfTabs;
+ aNumRule.ChangeIndent( nIndentChange );
+ }
+ }
+ // <--
// --> OD 2008-02-08 #newlistlevelattrs#
// reset indent attribute on applying list style
// --> OD 2008-03-17 #refactorlists#
diff --git a/sw/source/ui/wrtsh/wrtsh2.cxx b/sw/source/ui/wrtsh/wrtsh2.cxx
index 42cfb1c3d64d..9141279f141b 100644
--- a/sw/source/ui/wrtsh/wrtsh2.cxx
+++ b/sw/source/ui/wrtsh/wrtsh2.cxx
@@ -93,10 +93,13 @@ void SwWrtShell::Insert(SwField &rFld)
StartUndo(UNDO_INSERT, &aRewriter);
+ bool bDeleted = false;
if( HasSelection() )
- DelRight();
+ {
+ bDeleted = DelRight() != 0;
+ }
- SwEditShell::Insert(rFld);
+ SwEditShell::Insert2(rFld, bDeleted);
EndUndo(UNDO_INSERT);
EndAllAction();
}