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/delete.cxx570
-rw-r--r--sw/source/ui/wrtsh/makefile.mk62
-rw-r--r--sw/source/ui/wrtsh/move.cxx691
-rw-r--r--sw/source/ui/wrtsh/select.cxx1072
-rw-r--r--sw/source/ui/wrtsh/wrtsh.hrc48
-rw-r--r--sw/source/ui/wrtsh/wrtsh.src52
-rw-r--r--sw/source/ui/wrtsh/wrtsh1.cxx1871
-rw-r--r--sw/source/ui/wrtsh/wrtsh2.cxx498
-rw-r--r--sw/source/ui/wrtsh/wrtsh3.cxx247
-rw-r--r--sw/source/ui/wrtsh/wrtsh4.cxx300
-rw-r--r--sw/source/ui/wrtsh/wrtundo.cxx182
11 files changed, 5593 insertions, 0 deletions
diff --git a/sw/source/ui/wrtsh/delete.cxx b/sw/source/ui/wrtsh/delete.cxx
new file mode 100644
index 000000000000..182fb5e37854
--- /dev/null
+++ b/sw/source/ui/wrtsh/delete.cxx
@@ -0,0 +1,570 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * 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.
+ *
+ * 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).
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <wrtsh.hxx>
+#include <crsskip.hxx>
+#include <swcrsr.hxx>
+#include <editeng/lrspitem.hxx> // #i23725#
+// --> OD 2006-07-10 #134369#
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#ifndef _DRAWBASE_HXX
+#include <drawbase.hxx>
+#endif
+// <--
+
+inline void SwWrtShell::OpenMark()
+{
+ StartAllAction();
+ ResetCursorStack();
+ KillPams();
+ SetMark();
+}
+
+inline void SwWrtShell::CloseMark( BOOL bOkFlag )
+{
+ if( bOkFlag )
+ UpdateAttr();
+ else
+ SwapPam();
+
+ ClearMark();
+ EndAllAction();
+}
+
+// #i23725#
+BOOL SwWrtShell::TryRemoveIndent()
+{
+ BOOL bResult = FALSE;
+
+ SfxItemSet aAttrSet(GetAttrPool(), RES_LR_SPACE, RES_LR_SPACE);
+ GetCurAttr(aAttrSet);
+
+ SvxLRSpaceItem aItem = (const SvxLRSpaceItem &)aAttrSet.Get(RES_LR_SPACE);
+ short aOldFirstLineOfst = aItem.GetTxtFirstLineOfst();
+
+ if (aOldFirstLineOfst > 0)
+ {
+ aItem.SetTxtFirstLineOfst(0);
+ bResult = TRUE;
+ }
+ else if (aOldFirstLineOfst < 0)
+ {
+ aItem.SetTxtFirstLineOfst(0);
+ aItem.SetLeft(aItem.GetLeft() + aOldFirstLineOfst);
+
+ bResult = TRUE;
+ }
+ else if (aItem.GetLeft() != 0)
+ {
+ aItem.SetLeft(0);
+ bResult = TRUE;
+ }
+
+ if (bResult)
+ {
+ aAttrSet.Put(aItem);
+ SetAttr(aAttrSet);
+ }
+
+ return bResult;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Zeile loeschen
+------------------------------------------------------------------------*/
+
+
+
+long SwWrtShell::DelLine()
+{
+ ACT_KONTEXT(this);
+ ResetCursorStack();
+ // alten Cursor merken
+ Push();
+ ClearMark();
+ SwCrsrShell::LeftMargin();
+ SetMark();
+ SwCrsrShell::RightMargin();
+//Warum soll hier noch ein Zeichen in der naechsten Zeile geloescht werden?
+// if(!IsEndOfPara())
+// SwCrsrShell::Right();
+ long nRet = Delete();
+ Pop(FALSE);
+ if( nRet )
+ UpdateAttr();
+ return nRet;
+}
+
+
+
+long SwWrtShell::DelToStartOfLine()
+{
+ OpenMark();
+ SwCrsrShell::LeftMargin();
+ long nRet = Delete();
+ CloseMark( 0 != nRet );
+ return nRet;
+}
+
+
+
+long SwWrtShell::DelToEndOfLine()
+{
+ OpenMark();
+ SwCrsrShell::RightMargin();
+ long nRet = Delete();
+ CloseMark( 0 != nRet );
+ return 1;
+}
+
+long SwWrtShell::DelLeft()
+{
+ // wenns denn ein Fly ist, wech damit
+ int nSelType = GetSelectionType();
+ const int nCmp = nsSelectionType::SEL_FRM | nsSelectionType::SEL_GRF | nsSelectionType::SEL_OLE | nsSelectionType::SEL_DRW;
+ if( nCmp & nSelType )
+ {
+ /* #108205# Remember object's position. */
+ Point aTmpPt = GetObjRect().TopLeft();
+
+ DelSelectedObj();
+
+ /* #108205# Set cursor to remembered position. */
+ SetCrsr(&aTmpPt);
+
+ LeaveSelFrmMode();
+ UnSelectFrm();
+
+ nSelType = GetSelectionType();
+ if ( nCmp & nSelType )
+ {
+ EnterSelFrmMode();
+ GotoNextFly();
+ }
+
+ return 1L;
+ }
+
+ // wenn eine Selektion existiert, diese loeschen.
+ if ( IsSelection() )
+ {
+ if( !IsBlockMode() || HasSelection() )
+ {
+ //OS: wieder einmal Basic: ACT_KONTEXT muss vor
+ //EnterStdMode verlassen werden!
+ {
+ ACT_KONTEXT(this);
+ ResetCursorStack();
+ Delete();
+ UpdateAttr();
+ }
+ if( IsBlockMode() )
+ {
+ NormalizePam();
+ ClearMark();
+ EnterBlockMode();
+ }
+ else
+ EnterStdMode();
+ return 1L;
+ }
+ else
+ EnterStdMode();
+ }
+
+ // JP 29.06.95: nie eine davor stehende Tabelle loeschen.
+ BOOL bSwap = FALSE;
+ const SwTableNode * pWasInTblNd = SwCrsrShell::IsCrsrInTbl();
+
+ if( SwCrsrShell::IsSttPara())
+ {
+ // --> FME 2007-02-15 #i4032# Don't actually call a 'delete' if we
+ // changed the table cell, compare DelRight().
+ const SwStartNode * pSNdOld = pWasInTblNd ?
+ GetSwCrsr()->GetNode()->FindTableBoxStartNode() :
+ 0;
+ // <--
+
+ /* If the cursor is at the beginning of a paragraph, try to step
+ backwards. On failure we are done. */
+ if( !SwCrsrShell::Left(1,CRSR_SKIP_CHARS) )
+ return 0;
+
+ /* If the cursor entered or left a table (or both) we are done. No step
+ back. */
+ const SwTableNode* pIsInTblNd = SwCrsrShell::IsCrsrInTbl();
+ if( pIsInTblNd != pWasInTblNd )
+ return 0;
+
+ const SwStartNode* pSNdNew = pIsInTblNd ?
+ GetSwCrsr()->GetNode()->FindTableBoxStartNode() :
+ 0;
+
+ // --> FME 2007-02-15 #i4032# Don't actually call a 'delete' if we
+ // changed the table cell, compare DelRight().
+ if ( pSNdOld != pSNdNew )
+ return 0;
+ // <--
+
+ OpenMark();
+ SwCrsrShell::Right(1,CRSR_SKIP_CHARS);
+ SwCrsrShell::SwapPam();
+ bSwap = TRUE;
+ }
+ else
+ {
+ OpenMark();
+ SwCrsrShell::Left(1,CRSR_SKIP_CHARS);
+ }
+ long nRet = Delete();
+ if( !nRet && bSwap )
+ SwCrsrShell::SwapPam();
+ CloseMark( 0 != nRet );
+ return nRet;
+}
+
+long SwWrtShell::DelRight()
+{
+ // werden verodert, wenn Tabellenselektion vorliegt;
+ // wird hier auf nsSelectionType::SEL_TBL umgesetzt.
+ long nRet = 0;
+ int nSelection = GetSelectionType();
+ if(nSelection & nsSelectionType::SEL_TBL_CELLS)
+ nSelection = nsSelectionType::SEL_TBL;
+ if(nSelection & nsSelectionType::SEL_TXT)
+ nSelection = nsSelectionType::SEL_TXT;
+
+ const SwTableNode * pWasInTblNd = NULL;
+
+ switch( nSelection & ~(nsSelectionType::SEL_BEZ) )
+ {
+ case nsSelectionType::SEL_POSTIT:
+ case nsSelectionType::SEL_TXT:
+ case nsSelectionType::SEL_TBL:
+ case nsSelectionType::SEL_NUM:
+ // wenn eine Selektion existiert, diese loeschen.
+ if( IsSelection() )
+ {
+ if( !IsBlockMode() || HasSelection() )
+ {
+ //OS: wieder einmal Basic: ACT_KONTEXT muss vor
+ //EnterStdMode verlassen werden!
+ {
+ ACT_KONTEXT(this);
+ ResetCursorStack();
+ Delete();
+ UpdateAttr();
+ }
+ if( IsBlockMode() )
+ {
+ NormalizePam();
+ ClearMark();
+ EnterBlockMode();
+ }
+ else
+ EnterStdMode();
+ nRet = 1L;
+ break;
+ }
+ else
+ EnterStdMode();
+ }
+
+ pWasInTblNd = IsCrsrInTbl();
+
+ if( nsSelectionType::SEL_TXT & nSelection && SwCrsrShell::IsSttPara() &&
+ SwCrsrShell::IsEndPara() )
+ {
+ // save cursor
+ SwCrsrShell::Push();
+
+ bool bDelFull = false;
+ if ( SwCrsrShell::Right(1,CRSR_SKIP_CHARS) )
+ {
+ const SwTableNode * pCurrTblNd = IsCrsrInTbl();
+ bDelFull = pCurrTblNd && pCurrTblNd != pWasInTblNd;
+ }
+
+ // restore cursor
+ SwCrsrShell::Pop( FALSE );
+
+ if( bDelFull )
+ {
+ DelFullPara();
+ UpdateAttr();
+ break;
+ }
+ }
+
+ {
+ /* #108049# Save the startnode of the current cell */
+ const SwStartNode * pSNdOld;
+ pSNdOld = GetSwCrsr()->GetNode()->
+ FindTableBoxStartNode();
+
+ if ( SwCrsrShell::IsEndPara() )
+ {
+ // --> FME 2005-01-28 #i41424# Introduced a couple of
+ // Push()-Pop() pairs here. The reason for this is that a
+ // Right()-Left() combination does not make sure, that
+ // the cursor will be in its initial state, because there
+ // may be a numbering in front of the next paragraph.
+ SwCrsrShell::Push();
+ // <--
+
+ if ( SwCrsrShell::Right(1, CRSR_SKIP_CHARS) )
+ {
+ if (IsCrsrInTbl() || (pWasInTblNd != IsCrsrInTbl()))
+ {
+ /* #108049# Save the startnode of the current
+ cell. May be different to pSNdOld as we have
+ moved. */
+ const SwStartNode * pSNdNew = GetSwCrsr()
+ ->GetNode()->FindTableBoxStartNode();
+
+ /* #108049# Only move instead of deleting if we
+ have moved to a different cell */
+ if (pSNdOld != pSNdNew)
+ {
+ SwCrsrShell::Pop( TRUE );
+ break;
+ }
+ }
+ }
+
+ // restore cursor
+ SwCrsrShell::Pop( FALSE );
+ }
+ }
+
+ OpenMark();
+ SwCrsrShell::Right(1,CRSR_SKIP_CELLS);
+ nRet = Delete();
+ CloseMark( 0 != nRet );
+ break;
+
+ case nsSelectionType::SEL_FRM:
+ case nsSelectionType::SEL_GRF:
+ case nsSelectionType::SEL_OLE:
+ case nsSelectionType::SEL_DRW:
+ case nsSelectionType::SEL_DRW_TXT:
+ case nsSelectionType::SEL_DRW_FORM:
+ {
+ /* #108205# Remember object's position. */
+ Point aTmpPt = GetObjRect().TopLeft();
+
+ DelSelectedObj();
+
+ /* #108205# Set cursor to remembered position. */
+ SetCrsr(&aTmpPt);
+
+ LeaveSelFrmMode();
+ UnSelectFrm();
+ // --> OD 2006-07-06 #134369#
+ ASSERT( !IsFrmSelected(),
+ "<SwWrtShell::DelRight(..)> - <SwWrtShell::UnSelectFrm()> should unmark all objects" )
+ // <--
+ // --> OD 2006-07-10 #134369#
+ // leave draw mode, if necessary.
+ {
+ if (GetView().GetDrawFuncPtr())
+ {
+ GetView().GetDrawFuncPtr()->Deactivate();
+ GetView().SetDrawFuncPtr(NULL);
+ }
+ if ( GetView().IsDrawMode() )
+ {
+ GetView().LeaveDrawCreate();
+ }
+ }
+ // <--
+ }
+
+ // --> OD 2006-07-07 #134369#
+ // <IsFrmSelected()> can't be true - see above.
+ // <--
+ {
+ nSelection = GetSelectionType();
+ if ( nsSelectionType::SEL_FRM & nSelection ||
+ nsSelectionType::SEL_GRF & nSelection ||
+ nsSelectionType::SEL_OLE & nSelection ||
+ nsSelectionType::SEL_DRW & nSelection )
+ {
+ EnterSelFrmMode();
+ GotoNextFly();
+ }
+ }
+ nRet = 1;
+ break;
+ }
+ return nRet;
+}
+
+
+
+long SwWrtShell::DelToEndOfPara()
+{
+ ACT_KONTEXT(this);
+ ResetCursorStack();
+ Push();
+ SetMark();
+ if( !MovePara(fnParaCurr,fnParaEnd))
+ {
+ Pop(FALSE);
+ return 0;
+ }
+ long nRet = Delete();
+ Pop(FALSE);
+ if( nRet )
+ UpdateAttr();
+ return nRet;
+}
+
+
+
+long SwWrtShell::DelToStartOfPara()
+{
+ ACT_KONTEXT(this);
+ ResetCursorStack();
+ Push();
+ SetMark();
+ if( !MovePara(fnParaCurr,fnParaStart))
+ {
+ Pop(FALSE);
+ return 0;
+ }
+ long nRet = Delete();
+ Pop(FALSE);
+ if( nRet )
+ UpdateAttr();
+ return nRet;
+}
+/*
+ * alle Loeschoperationen sollten mit Find statt mit
+ * Nxt-/PrvDelim arbeiten, da letzteren mit Wrap Around arbeiten
+ * -- das ist wohl nicht gewuenscht.
+ */
+
+
+
+long SwWrtShell::DelToStartOfSentence()
+{
+ if(IsStartOfDoc())
+ return 0;
+ OpenMark();
+ long nRet = _BwdSentence() ? Delete() : 0;
+ CloseMark( 0 != nRet );
+ return nRet;
+}
+
+
+
+long SwWrtShell::DelToEndOfSentence()
+{
+ if(IsEndOfDoc())
+ return 0;
+ OpenMark();
+ long nRet = _FwdSentence() ? Delete() : 0;
+ CloseMark( 0 != nRet );
+ return nRet;
+}
+
+
+
+long SwWrtShell::DelNxtWord()
+{
+ if(IsEndOfDoc())
+ return 0;
+ ACT_KONTEXT(this);
+ ResetCursorStack();
+ EnterStdMode();
+ SetMark();
+ if(IsEndWrd() && !IsSttWrd())
+ _NxtWrdForDelete(); // --> OD 2008-08-06 #i92468#
+ if(IsSttWrd() || IsEndPara())
+ _NxtWrdForDelete(); // --> OD 2008-08-06 #i92468#
+ else
+ _EndWrd();
+
+ long nRet = Delete();
+ if( nRet )
+ UpdateAttr();
+ else
+ SwapPam();
+ ClearMark();
+ return nRet;
+}
+
+
+
+long SwWrtShell::DelPrvWord()
+{
+ if(IsStartOfDoc())
+ return 0;
+ ACT_KONTEXT(this);
+ ResetCursorStack();
+ EnterStdMode();
+ SetMark();
+ if ( !IsSttWrd() ||
+ !_PrvWrdForDelete() ) // --> OD 2008-08-06 #i92468#
+ {
+ if( IsEndWrd() )
+ {
+ if ( _PrvWrdForDelete() ) // --> OD 2008-08-06 #i92468#
+ {
+ // skip over all-1 spaces
+ short n = -1;
+ while( ' ' == GetChar( FALSE, n ))
+ --n;
+
+ if( ++n )
+ ExtendSelection( FALSE, -n );
+ }
+ }
+ else if( IsSttPara())
+ _PrvWrdForDelete(); // --> OD 2008-08-06 #i92468#
+ else
+ _SttWrd();
+ }
+ long nRet = Delete();
+ if( nRet )
+ UpdateAttr();
+ else
+ SwapPam();
+ ClearMark();
+ return nRet;
+}
+
+
+
+
diff --git a/sw/source/ui/wrtsh/makefile.mk b/sw/source/ui/wrtsh/makefile.mk
new file mode 100644
index 000000000000..baeb3acd25e5
--- /dev/null
+++ b/sw/source/ui/wrtsh/makefile.mk
@@ -0,0 +1,62 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# 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.
+#
+# 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).
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=sw
+TARGET=wrtsh
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : $(PRJ)$/inc$/swpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/inc$/sw.mk
+
+# --- Files --------------------------------------------------------
+
+SRS1NAME=$(TARGET)
+SRC1FILES = \
+ wrtsh.src
+
+SLOFILES = \
+ $(SLO)$/move.obj \
+ $(SLO)$/select.obj \
+ $(SLO)$/wrtsh1.obj \
+ $(SLO)$/wrtsh2.obj \
+ $(SLO)$/wrtsh3.obj \
+ $(SLO)$/wrtsh4.obj \
+ $(SLO)$/delete.obj \
+ $(SLO)$/wrtundo.obj
+
+EXCEPTIONSFILES = \
+ $(SLO)$/wrtsh1.obj \
+ $(SLO)$/wrtsh2.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/sw/source/ui/wrtsh/move.cxx b/sw/source/ui/wrtsh/move.cxx
new file mode 100644
index 000000000000..dc196de9d9da
--- /dev/null
+++ b/sw/source/ui/wrtsh/move.cxx
@@ -0,0 +1,691 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * 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.
+ *
+ * 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).
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <sfx2/bindings.hxx>
+#include <wrtsh.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <viewopt.hxx>
+#include <crsskip.hxx>
+
+/* Immer:
+ - Zuruecksetzen des Cursorstacks
+ - Timer nachtriggern
+ - gfs. GCAttr
+
+ bei Selektion
+ - SttSelect()
+
+ sonst
+ - EndSelect()
+ */
+
+const long nReadOnlyScrollOfst = 10;
+
+class ShellMoveCrsr
+{
+ SwWrtShell* pSh;
+ BOOL bAct;
+public:
+ inline ShellMoveCrsr( SwWrtShell* pWrtSh, BOOL bSel )
+ {
+ bAct = !pWrtSh->ActionPend() && (pWrtSh->GetFrmType(0,FALSE) & FRMTYPE_FLY_ANY);
+ ( pSh = pWrtSh )->MoveCrsr( BOOL(bSel) );
+ pWrtSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_HYPERLINK_GETLINK);
+ }
+ inline ~ShellMoveCrsr()
+ {
+ if( bAct )
+ {
+ //Die Action wird fuer das Scrollen in "einabsaetzigen" Rahmen mit
+ //fester Hoehe gebraucht.
+ pSh->StartAllAction();
+ pSh->EndAllAction();
+ }
+ }
+};
+
+void SwWrtShell::MoveCrsr( BOOL bWithSelect )
+{
+ ResetCursorStack();
+ if ( IsGCAttr() )
+ {
+ GCAttr();
+ ClearGCAttr();
+ }
+ if ( bWithSelect )
+ SttSelect();
+ else
+ {
+ EndSelect();
+ (this->*fnKillSel)( 0, FALSE );
+ }
+}
+
+BOOL SwWrtShell::SimpleMove( FNSimpleMove FnSimpleMove, BOOL bSelect )
+{
+ BOOL nRet;
+ if( bSelect )
+ {
+ SttCrsrMove();
+ MoveCrsr( TRUE );
+ nRet = (this->*FnSimpleMove)();
+ EndCrsrMove();
+ }
+ else if( 0 != ( nRet = (this->*FnSimpleMove)() ) )
+ MoveCrsr( FALSE );
+ return nRet;
+}
+
+
+BOOL SwWrtShell::Left( USHORT nMode, BOOL bSelect,
+ USHORT nCount, BOOL bBasicCall, BOOL bVisual )
+{
+ if ( !bSelect && !bBasicCall && IsCrsrReadonly() && !GetViewOptions()->IsSelectionInReadonly())
+ {
+ Point aTmp( VisArea().Pos() );
+ aTmp.X() -= VisArea().Width() * nReadOnlyScrollOfst / 100;
+ rView.SetVisArea( aTmp );
+ return TRUE;
+ }
+ else
+ {
+ ShellMoveCrsr aTmp( this, bSelect );
+ return SwCrsrShell::Left( nCount, nMode, bVisual );
+ }
+}
+
+
+
+BOOL SwWrtShell::Right( USHORT nMode, BOOL bSelect,
+ USHORT nCount, BOOL bBasicCall, BOOL bVisual )
+{
+ if ( !bSelect && !bBasicCall && IsCrsrReadonly() && !GetViewOptions()->IsSelectionInReadonly() )
+ {
+ Point aTmp( VisArea().Pos() );
+ aTmp.X() += VisArea().Width() * nReadOnlyScrollOfst / 100;
+ aTmp.X() = rView.SetHScrollMax( aTmp.X() );
+ rView.SetVisArea( aTmp );
+ return TRUE;
+ }
+ else
+ {
+ ShellMoveCrsr aTmp( this, bSelect );
+ return SwCrsrShell::Right( nCount, nMode, bVisual );
+ }
+}
+
+
+
+BOOL SwWrtShell::Up( BOOL bSelect, USHORT nCount, BOOL bBasicCall )
+{
+ if ( !bSelect && !bBasicCall && IsCrsrReadonly() && !GetViewOptions()->IsSelectionInReadonly())
+ {
+ Point aTmp( VisArea().Pos() );
+ aTmp.Y() -= VisArea().Height() * nReadOnlyScrollOfst / 100;
+ rView.SetVisArea( aTmp );
+ return TRUE;
+ }
+ else
+ {
+ ShellMoveCrsr aTmp( this, bSelect );
+ return SwCrsrShell::Up( nCount );
+ }
+}
+
+
+
+BOOL SwWrtShell::Down( BOOL bSelect, USHORT nCount, BOOL bBasicCall )
+{
+ if ( !bSelect && !bBasicCall && IsCrsrReadonly() && !GetViewOptions()->IsSelectionInReadonly())
+ {
+ Point aTmp( VisArea().Pos() );
+ aTmp.Y() += VisArea().Height() * nReadOnlyScrollOfst / 100;
+ aTmp.Y() = rView.SetVScrollMax( aTmp.Y() );
+ rView.SetVisArea( aTmp );
+ return TRUE;
+ }
+ else
+ {
+ ShellMoveCrsr aTmp( this, bSelect );
+ return SwCrsrShell::Down( nCount );
+ }
+}
+
+
+
+BOOL SwWrtShell::LeftMargin( BOOL bSelect, BOOL bBasicCall )
+{
+ if ( !bSelect && !bBasicCall && IsCrsrReadonly() )
+ {
+ Point aTmp( VisArea().Pos() );
+ aTmp.X() = DOCUMENTBORDER;
+ rView.SetVisArea( aTmp );
+ return TRUE;
+ }
+ else
+ {
+ ShellMoveCrsr aTmp( this, bSelect );
+ return SwCrsrShell::LeftMargin();
+ }
+}
+
+
+
+BOOL SwWrtShell::RightMargin( BOOL bSelect, BOOL bBasicCall )
+{
+ if ( !bSelect && !bBasicCall && IsCrsrReadonly() )
+ {
+ Point aTmp( VisArea().Pos() );
+ aTmp.X() = GetDocSize().Width() - VisArea().Width() + DOCUMENTBORDER;
+ if( DOCUMENTBORDER > aTmp.X() )
+ aTmp.X() = DOCUMENTBORDER;
+ rView.SetVisArea( aTmp );
+ return TRUE;
+ }
+ else
+ {
+ ShellMoveCrsr aTmp( this, bSelect );
+ return SwCrsrShell::RightMargin(bBasicCall);
+ }
+}
+
+
+
+BOOL SwWrtShell::GoStart( BOOL bKeepArea, BOOL *pMoveTable,
+ BOOL bSelect, BOOL bDontMoveRegion )
+{
+ if ( IsCrsrInTbl() )
+ {
+ const BOOL bBoxSelection = HasBoxSelection();
+ if( !bBlockMode )
+ {
+ if ( !bSelect )
+ EnterStdMode();
+ else
+ SttSelect();
+ }
+ // Tabellenzelle?
+ if ( !bBoxSelection && (MoveSection( fnSectionCurr, fnSectionStart)
+ || bDontMoveRegion))
+ {
+ if ( pMoveTable )
+ *pMoveTable = FALSE;
+ return TRUE;
+ }
+ if( MoveTable( fnTableCurr, fnTableStart ) || bDontMoveRegion )
+ {
+ if ( pMoveTable )
+ *pMoveTable = TRUE;
+ return TRUE;
+ }
+ else if( bBoxSelection && pMoveTable )
+ {
+ // JP 09.01.96: wir haben eine Boxselektion (oder leere Zelle)
+ // und wollen selektieren (pMoveTable wird im
+ // SelAll gesetzt). Dann darf die Tabelle nicht
+ // verlassen werden; sonst ist keine Selektion der
+ // gesamten Tabelle moeglich!
+ *pMoveTable = TRUE;
+ return TRUE;
+ }
+ }
+
+ if( !bBlockMode )
+ {
+ if ( !bSelect )
+ EnterStdMode();
+ else
+ SttSelect();
+ }
+ const USHORT nFrmType = GetFrmType(0,FALSE);
+ if ( FRMTYPE_FLY_ANY & nFrmType )
+ {
+ if( MoveSection( fnSectionCurr, fnSectionStart ) )
+ return TRUE;
+ else if ( FRMTYPE_FLY_FREE & nFrmType || bDontMoveRegion )
+ return FALSE;
+ }
+ if(( FRMTYPE_HEADER | FRMTYPE_FOOTER | FRMTYPE_FOOTNOTE ) & nFrmType )
+ {
+ if ( MoveSection( fnSectionCurr, fnSectionStart ) )
+ return TRUE;
+ else if ( bKeepArea )
+ return TRUE;
+ }
+ // Bereiche ???
+ return SwCrsrShell::MoveRegion( fnRegionCurrAndSkip, fnRegionStart ) ||
+ SwCrsrShell::SttEndDoc(TRUE);
+}
+
+
+
+BOOL SwWrtShell::GoEnd(BOOL bKeepArea, BOOL *pMoveTable)
+{
+ if ( pMoveTable && *pMoveTable )
+ return MoveTable( fnTableCurr, fnTableEnd );
+
+ if ( IsCrsrInTbl() )
+ {
+ if ( MoveSection( fnSectionCurr, fnSectionEnd ) ||
+ MoveTable( fnTableCurr, fnTableEnd ) )
+ return TRUE;
+ }
+ else
+ {
+ const USHORT nFrmType = GetFrmType(0,FALSE);
+ if ( FRMTYPE_FLY_ANY & nFrmType )
+ {
+ if ( MoveSection( fnSectionCurr, fnSectionEnd ) )
+ return TRUE;
+ else if ( FRMTYPE_FLY_FREE & nFrmType )
+ return FALSE;
+ }
+ if(( FRMTYPE_HEADER | FRMTYPE_FOOTER | FRMTYPE_FOOTNOTE ) & nFrmType )
+ {
+ if ( MoveSection( fnSectionCurr, fnSectionEnd) )
+ return TRUE;
+ else if ( bKeepArea )
+ return TRUE;
+ }
+ }
+ // Bereiche ???
+ return SwCrsrShell::MoveRegion( fnRegionCurrAndSkip, fnRegionEnd ) ||
+ SwCrsrShell::SttEndDoc(FALSE);
+}
+
+
+
+BOOL SwWrtShell::SttDoc( BOOL bSelect )
+{
+ ShellMoveCrsr aTmp( this, bSelect );
+ return GoStart(FALSE, 0, bSelect );
+}
+
+
+
+BOOL SwWrtShell::EndDoc( BOOL bSelect)
+{
+ ShellMoveCrsr aTmp( this, bSelect );
+ return GoEnd();
+}
+
+
+BOOL SwWrtShell::SttNxtPg( BOOL bSelect )
+{
+ ShellMoveCrsr aTmp( this, bSelect );
+ return MovePage( fnPageNext, fnPageStart );
+}
+
+
+
+BOOL SwWrtShell::SttPrvPg( BOOL bSelect )
+{
+ ShellMoveCrsr aTmp( this, bSelect );
+ return MovePage( fnPagePrev, fnPageStart );
+}
+
+
+
+BOOL SwWrtShell::EndNxtPg( BOOL bSelect )
+{
+ ShellMoveCrsr aTmp( this, bSelect );
+ return MovePage( fnPageNext, fnPageEnd );
+}
+
+
+
+BOOL SwWrtShell::EndPrvPg( BOOL bSelect )
+{
+ ShellMoveCrsr aTmp( this, bSelect );
+ return MovePage( fnPagePrev, fnPageEnd );
+}
+
+
+
+BOOL SwWrtShell::SttPg( BOOL bSelect )
+{
+ ShellMoveCrsr aTmp( this, bSelect );
+ return MovePage( fnPageCurr, fnPageStart );
+}
+
+
+
+BOOL SwWrtShell::EndPg( BOOL bSelect )
+{
+ ShellMoveCrsr aTmp( this, bSelect );
+ return MovePage( fnPageCurr, fnPageEnd );
+}
+
+
+
+BOOL SwWrtShell::SttPara( BOOL bSelect )
+{
+ ShellMoveCrsr aTmp( this, bSelect );
+ return MovePara( fnParaCurr, fnParaStart );
+}
+
+
+
+BOOL SwWrtShell::EndPara( BOOL bSelect )
+{
+ ShellMoveCrsr aTmp( this, bSelect );
+ return MovePara(fnParaCurr,fnParaEnd);
+}
+
+
+/*------------------------------------------------------------------------
+ Beschreibung: Spaltenweises Springen
+ Parameter: mit oder ohne SSelection
+ Return: Erfolg oder Misserfolg
+------------------------------------------------------------------------*/
+
+
+
+BOOL SwWrtShell::StartOfColumn( BOOL bSelect )
+{
+ ShellMoveCrsr aTmp( this, bSelect);
+ return MoveColumn(fnColumnCurr, fnColumnStart);
+}
+
+
+
+BOOL SwWrtShell::EndOfColumn( BOOL bSelect )
+{
+ ShellMoveCrsr aTmp( this, bSelect);
+ return MoveColumn(fnColumnCurr, fnColumnEnd);
+}
+
+
+
+BOOL SwWrtShell::StartOfNextColumn( BOOL bSelect )
+{
+ ShellMoveCrsr aTmp( this, bSelect);
+ return MoveColumn( fnColumnNext, fnColumnStart);
+}
+
+
+
+BOOL SwWrtShell::EndOfNextColumn( BOOL bSelect )
+{
+ ShellMoveCrsr aTmp( this, bSelect);
+ return MoveColumn(fnColumnNext, fnColumnEnd);
+}
+
+
+
+BOOL SwWrtShell::StartOfPrevColumn( BOOL bSelect )
+{
+ ShellMoveCrsr aTmp( this, bSelect);
+ return MoveColumn(fnColumnPrev, fnColumnStart);
+}
+
+
+
+BOOL SwWrtShell::EndOfPrevColumn( BOOL bSelect )
+{
+ ShellMoveCrsr aTmp( this, bSelect);
+ return MoveColumn(fnColumnPrev, fnColumnEnd);
+}
+
+
+
+BOOL SwWrtShell::PushCrsr(SwTwips lOffset, BOOL bSelect)
+{
+ BOOL bDiff = FALSE;
+ SwRect aOldRect( GetCharRect() ), aTmpArea( VisArea() );
+
+ //bDestOnStack besagt, ob ich den Cursor nicht an die aktuelle Position
+ //setzen konnte, da in diesem Bereich kein Inhalt vorhanden ist.
+ if( !bDestOnStack )
+ {
+ Point aPt( aOldRect.Center() );
+
+ if( !IsCrsrVisible() )
+ // set CrsrPos to top-/bottom left pos. So the pagescroll is not
+ // be dependent on the current cursor, but on the visarea.
+ aPt.Y() = aTmpArea.Top() + aTmpArea.Height() / 2;
+
+ aPt.Y() += lOffset;
+ aDest = GetCntntPos(aPt,lOffset > 0);
+ aDest.X() = aPt.X();
+ bDestOnStack = TRUE;
+ }
+
+ //falls wir eine Rahmenselektion hatten, muss diese nach dem
+ //fnSetCrsr entfernt werden und damit wir da wieder hinkommen
+ //auf dem Stack gemerkt werden.
+ BOOL bIsFrmSel = FALSE;
+
+ BOOL bIsObjSel = FALSE;
+
+ //Zielposition liegt jetzt innerhalb des sichtbaren Bereiches -->
+ //Cursor an die Zielposition setzen; merken, dass keine Ziel-
+ //position mehr auf dem Stack steht.
+ //Der neue sichtbare Bereich wird zuvor ermittelt.
+ aTmpArea.Pos().Y() += lOffset;
+ if( aTmpArea.IsInside(aDest) )
+ {
+ if( bSelect )
+ SttSelect();
+ else
+ EndSelect();
+
+ bIsFrmSel = IsFrmSelected();
+ bIsObjSel = 0 != IsObjSelected();
+
+ // Rahmenselektion aufheben
+ if( bIsFrmSel || bIsObjSel )
+ {
+ UnSelectFrm();
+ LeaveSelFrmMode();
+ if ( bIsObjSel )
+ {
+ GetView().SetDrawFuncPtr( NULL );
+ GetView().LeaveDrawCreate();
+ }
+
+ CallChgLnk();
+ }
+
+ (this->*fnSetCrsr)( &aDest, TRUE );
+
+ bDiff = aOldRect != GetCharRect();
+
+ if( bIsFrmSel )
+ {
+// CallChgLnk();
+ // bei Frames immer nur die obere Ecke nehmen, damit dieser
+ // wieder selektiert werden kann
+ aOldRect.SSize( 5, 5 );
+ }
+
+ // Zuruecksetzen des Dest. SPoint Flags
+ bDestOnStack = FALSE;
+ }
+
+ // Position auf den Stack; bDiff besagt, ob ein Unterschied zwischen
+ // der alten und der neuen Cursorposition besteht.
+ pCrsrStack = new CrsrStack( bDiff, bIsFrmSel, aOldRect.Center(),
+ lOffset, pCrsrStack );
+ return !bDestOnStack && bDiff;
+}
+
+
+
+BOOL SwWrtShell::PopCrsr(BOOL bUpdate, BOOL bSelect)
+{
+ if( 0 == pCrsrStack)
+ return FALSE;
+
+ const BOOL bValidPos = pCrsrStack->bValidCurPos;
+ if( bUpdate && bValidPos )
+ {
+ // falls ein Vorgaenger auf dem Stack steht, dessen Flag fuer eine
+ // gueltige Position verwenden.
+ SwRect aTmpArea(VisArea());
+ aTmpArea.Pos().Y() -= pCrsrStack->lOffset;
+ if( aTmpArea.IsInside( pCrsrStack->aDocPos ) )
+ {
+ if( bSelect )
+ SttSelect();
+ else
+ EndSelect();
+
+ (this->*fnSetCrsr)(&pCrsrStack->aDocPos, !pCrsrStack->bIsFrmSel);
+ if( pCrsrStack->bIsFrmSel && IsObjSelectable(pCrsrStack->aDocPos))
+ {
+ HideCrsr();
+ SelectObj( pCrsrStack->aDocPos );
+ EnterSelFrmMode( &pCrsrStack->aDocPos );
+ }
+ }
+ // Falls eine Verschiebung zwischen dem sichtbaren Bereich
+ // und der gemerkten Cursorpositionen auftritt, werden
+ // alle gemerkten Positionen weggeschmissen
+ else
+ {
+ _ResetCursorStack();
+ return FALSE;
+ }
+ }
+ CrsrStack *pTmp = pCrsrStack;
+ pCrsrStack = pCrsrStack->pNext;
+ delete pTmp;
+ if( 0 == pCrsrStack )
+ {
+ ePageMove = MV_NO;
+ bDestOnStack = FALSE;
+ }
+ return bValidPos;
+}
+
+/*
+ * Zuruecksetzen aller gepushten Cursorpositionen; dieser werden nicht
+ * zur Anzeige gebracht ( --> Kein Start-/EndAction!!)
+ */
+
+
+
+void SwWrtShell::_ResetCursorStack()
+{
+ CrsrStack *pTmp = pCrsrStack;
+ while(pCrsrStack)
+ {
+ pTmp = pCrsrStack->pNext;
+ delete pCrsrStack;
+ pCrsrStack = pTmp;
+ }
+ ePageMove = MV_NO;
+ bDestOnStack = FALSE;
+}
+/**************
+
+ falls kein Stack existiert --> Selektionen aufheben
+ falls Stack && Richtungswechsel
+ --> Cursor poppen und return
+ sonst
+ --> Cursor pushen
+ Cursor umsetzen
+
+***************/
+
+
+
+BOOL SwWrtShell::PageCrsr(SwTwips lOffset, BOOL bSelect)
+{
+ // nichts tun, wenn ein Offset von 0 angegeben wurde
+ if(!lOffset) return FALSE;
+ // Diente mal dazu, eine Neuformatierung fuer das Layout
+ // zu erzwingen.
+ // Hat so nicht funktioniert, da der Cursor nicht gesetzt
+ // wurde, da dies innerhalb einer Start- / EndActionklammerung
+ // nicht geschieht.
+ // Da am Ende nur ViewShell::EndAction() gerufen wird,
+ // findet auch hier keine Aktualisierung der Anzeige
+ // der Cursorposition statt.
+ // Die CrsrShell- Actionklammerung kann nicht verwendet werden,
+ // da sie immer zu einer Anzeige des Cursors fuehrt, also auch,
+ // wenn nach dem Blaettern in einen Bereich ohne gueltige Position
+ // geblaettert wurde.
+ // ViewShell::StartAction();
+ PageMove eDir = lOffset > 0? MV_PAGE_DOWN: MV_PAGE_UP;
+ // Richtungswechsel und Stack vorhanden
+ if( eDir != ePageMove && ePageMove != MV_NO && PopCrsr( TRUE, bSelect ))
+ return TRUE;
+
+ const BOOL bRet = PushCrsr(lOffset, bSelect);
+ ePageMove = eDir;
+ return bRet;
+}
+
+
+
+BOOL SwWrtShell::GotoPage(USHORT nPage, BOOL bRecord)
+{
+ ShellMoveCrsr aTmp( this, FALSE);
+ if( SwCrsrShell::GotoPage(nPage) && bRecord)
+ {
+ if(IsSelFrmMode())
+ {
+ UnSelectFrm();
+ LeaveSelFrmMode();
+ }
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+
+BOOL SwWrtShell::GotoMark( const ::sw::mark::IMark* const pMark, BOOL bSelect, BOOL bStart )
+{
+ ShellMoveCrsr aTmp( this, bSelect );
+ return SwCrsrShell::GotoMark( pMark, bStart );
+}
+
+
+
+BOOL SwWrtShell::SelectTxtAttr( USHORT nWhich, const SwTxtAttr* pAttr )
+{
+ BOOL bRet;
+ {
+ MV_KONTEXT(this);
+ SttSelect();
+ bRet = SwCrsrShell::SelectTxtAttr( nWhich, FALSE, pAttr );
+ }
+ EndSelect();
+ return bRet;
+}
+
+
+
diff --git a/sw/source/ui/wrtsh/select.cxx b/sw/source/ui/wrtsh/select.cxx
new file mode 100644
index 000000000000..9acf40160bc3
--- /dev/null
+++ b/sw/source/ui/wrtsh/select.cxx
@@ -0,0 +1,1072 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * 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.
+ *
+ * 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).
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#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>
+#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> // fuer Undo-Ids
+#include <swevent.hxx>
+#include <swdtflvr.hxx>
+#include <crsskip.hxx>
+
+#if OSL_DEBUG_LEVEL > 1
+#include <pam.hxx>
+#endif
+
+namespace com { namespace sun { namespace star { namespace util {
+ struct SearchOptions;
+} } } }
+
+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);
+ if( !IsInWrd() && !IsEndWrd() && !IsSttWrd() )
+ PrvWrd();
+ if( IsEndWrd() )
+ Left(CRSR_SKIP_CELLS, FALSE, 1, FALSE );
+ 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 )
+{
+ {
+ MV_KONTEXT(this);
+ ClearMark();
+ SwCrsrShell::GoStartSentence();
+ SttSelect();
+ SwCrsrShell::GoEndSentence();
+ }
+ EndSelect();
+ if(pPt)
+ aStart = *pPt;
+ bSelLn = TRUE;
+ bSelWrd = FALSE; // SelWord abschalten, sonst geht kein SelLine weiter
+}
+
+void SwWrtShell::SelPara(const Point *pPt, BOOL )
+{
+ {
+ MV_KONTEXT(this);
+ ClearMark();
+ SwCrsrShell::MovePara( fnParaCurr, fnParaStart );
+ SttSelect();
+ SwCrsrShell::MovePara( fnParaCurr, fnParaEnd );
+ }
+ EndSelect();
+ if(pPt)
+ aStart = *pPt;
+ bSelLn = FALSE;
+ bSelWrd = FALSE; // SelWord abschalten, sonst geht kein SelLine weiter
+}
+
+
+long SwWrtShell::SelAll()
+{
+ const BOOL bLockedView = IsViewLocked();
+ LockView( TRUE );
+ {
+ if(bBlockMode)
+ LeaveBlockMode();
+ MV_KONTEXT(this);
+ BOOL bMoveTable = FALSE;
+ SwPosition *pStartPos = 0;
+ SwPosition *pEndPos = 0;
+ SwShellCrsr* pTmpCrsr = 0;
+ if( !HasWholeTabSelection() )
+ {
+ if ( IsSelection() && IsCrsrPtAtEnd() )
+ SwapPam();
+ pTmpCrsr = getShellCrsr( false );
+ if( pTmpCrsr )
+ {
+ pStartPos = new SwPosition( *pTmpCrsr->GetPoint() );
+ pEndPos = new SwPosition( *pTmpCrsr->GetMark() );
+ }
+ Push();
+ BOOL bIsFullSel = !MoveSection( fnSectionCurr, fnSectionStart);
+ SwapPam();
+ bIsFullSel &= !MoveSection( fnSectionCurr, fnSectionEnd);
+ Pop(FALSE);
+ GoStart(TRUE, &bMoveTable, FALSE, !bIsFullSel);
+ }
+ else
+ {
+ EnterStdMode();
+ SttEndDoc(TRUE);
+ }
+ SttSelect();
+ GoEnd(TRUE, &bMoveTable);
+ 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;
+ }
+ }
+ EndSelect();
+ LockView( bLockedView );
+ return 1;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Textsuche
+------------------------------------------------------------------------*/
+
+
+ULONG SwWrtShell::SearchPattern( const SearchOptions& rSearchOpt, BOOL bSearchInNotes,
+ SwDocPositions eStt, SwDocPositions eEnd,
+ FindRanges eFlags, int bReplace )
+{
+ // keine Erweiterung bestehender Selektionen
+ if(!(eFlags & FND_IN_SEL))
+ ClearMark();
+ BOOL bCancel = FALSE;
+ ULONG nRet = Find( rSearchOpt, bSearchInNotes, eStt, eEnd, bCancel, eFlags, bReplace );
+ if(bCancel)
+ {
+ Undo(UNDO_EMPTY, 1);
+ nRet = ULONG_MAX;
+ }
+ return nRet;
+}
+/*------------------------------------------------------------------------
+ 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;
+}
+
+// Suche nach Attributen ----------------------------------------------------
+
+
+
+ULONG SwWrtShell::SearchAttr( const SfxItemSet& rFindSet, BOOL bNoColls,
+ SwDocPositions eStart, SwDocPositions eEnde,
+ FindRanges eFlags, const SearchOptions* pSearchOpt,
+ 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;
+}
+
+// ---------- Selektionsmodi ----------
+
+
+
+void SwWrtShell::PushMode()
+{
+ pModeStack = new ModeStack( pModeStack, bIns, bExtMode, bAddMode, bBlockMode );
+}
+
+
+
+void SwWrtShell::PopMode()
+{
+ if ( 0 == pModeStack )
+ return;
+
+ if ( bExtMode && !pModeStack->bExt )
+ LeaveExtMode();
+ if ( bAddMode && !pModeStack->bAdd )
+ LeaveAddMode();
+ if ( bBlockMode && !pModeStack->bBlock )
+ LeaveBlockMode();
+ 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();
+ }
+
+ 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
+ Point aPt(LONG_MIN, LONG_MIN);
+ SelectObj(aPt, 0);
+ SwTransferable::ClearSelection( *this );
+}
+
+/*
+ * 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 );
+ 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();
+ }
+ fnKillSel = &SwWrtShell::Ignore;
+ fnSetCrsr = &SwWrtShell::SetCrsr;
+ bInSelect = TRUE;
+ Invalidate();
+ SwTransferable::CreateSelection( *this );
+}
+/*
+ * 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;
+ 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() )
+ {
+ if( bToTop )
+ {
+ if( !IsEndPara() )
+ SwCrsrShell::Right(1,CRSR_SKIP_CHARS);
+ SwCrsrShell::GoEndSentence();
+ }
+ else
+ SwCrsrShell::GoStartSentence();
+ }
+ SwapPam();
+
+ return bToTop ? SwCrsrShell::GoStartSentence() : SwCrsrShell::GoEndSentence();
+}
+
+
+/*
+ * zurueck in den Standard Mode: kein Mode, keine Selektionen.
+ */
+
+void SwWrtShell::EnterStdMode()
+{
+ if(bAddMode)
+ LeaveAddMode();
+ if(bBlockMode)
+ LeaveBlockMode();
+ bBlockMode = FALSE;
+ 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 );
+}
+
+/*
+ * Extended Mode
+ */
+
+
+
+void SwWrtShell::EnterExtMode()
+{
+ if(bBlockMode)
+ {
+ LeaveBlockMode();
+ KillPams();
+ ClearMark();
+ }
+ bExtMode = TRUE;
+ bAddMode = FALSE;
+ bBlockMode = FALSE;
+ 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();
+ fnLeaveSelect = &SwWrtShell::AddLeaveSelect;
+ fnKillSel = &SwWrtShell::Ignore;
+ fnSetCrsr = &SwWrtShell::SetCrsr;
+ bAddMode = TRUE;
+ bBlockMode = FALSE;
+ bExtMode = FALSE;
+ if(SwCrsrShell::HasSelection())
+ CreateCrsr();
+ Invalidate();
+}
+
+
+
+void SwWrtShell::LeaveAddMode()
+{
+ fnLeaveSelect = &SwWrtShell::SttLeaveSelect;
+ fnKillSel = &SwWrtShell::ResetSelect;
+ fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
+ bAddMode = FALSE;
+ Invalidate();
+}
+
+/*
+ * Block Mode
+ */
+
+void SwWrtShell::EnterBlockMode()
+{
+ bBlockMode = FALSE;
+ EnterStdMode();
+ bBlockMode = TRUE;
+ CrsrToBlockCrsr();
+ Invalidate();
+}
+
+
+
+void SwWrtShell::LeaveBlockMode()
+{
+ bBlockMode = FALSE;
+ BlockCrsrToCrsr();
+ EndSelect();
+ Invalidate();
+}
+
+// Einfuegemodus
+
+
+
+void SwWrtShell::SetInsMode( BOOL bOn )
+{
+ bIns = bOn;
+ SwCrsrShell::SetOverwriteCrsr( !bIns );
+ const SfxBoolItem aTmp( SID_ATTR_INSERT, bIns );
+ GetView().GetViewFrame()->GetBindings().SetState( aTmp );
+ StartAction();
+ EndAction();
+ Invalidate();
+}
+//Overwrite mode is incompatible with red-lining
+void SwWrtShell::SetRedlineModeAndCheckInsMode( USHORT eMode )
+{
+ SetRedlineMode( eMode );
+ if (IsRedlineOn())
+ SetInsMode( true );
+}
+
+/*
+ * 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();
+}
+
+
+
+void SwWrtShell::LeaveSelFrmMode()
+{
+ fnDrag = &SwWrtShell::BeginDrag;
+ fnEndDrag = &SwWrtShell::EndDrag;
+ bLayoutMode = FALSE;
+ bStartDrag = FALSE;
+ Edit();
+ SwBaseShell::SetFrmMode( FLY_DRAG_END, this );
+ Invalidate();
+}
+/*------------------------------------------------------------------------
+ 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();
+ return !bAddMode;
+}
+
+
+long SwWrtShell::ToggleBlockMode()
+{
+ bBlockMode ? LeaveBlockMode(): EnterBlockMode();
+ Invalidate();
+ return !bBlockMode;
+}
+
+
+long SwWrtShell::ToggleExtMode()
+{
+ bExtMode ? LeaveExtMode() : EnterExtMode();
+ Invalidate();
+ return !bExtMode;
+}
+/*
+ * Draggen im Standard Modus (Selektieren von Inhalt)
+ */
+
+
+
+long SwWrtShell::BeginDrag(const Point * /*pPt*/, BOOL )
+{
+ 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 )
+{
+ 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;
+}
+// <--
+
+/*------------------------------------------------------------------------
+ Beschreibung: Selektion einer Tabellenzeile / Spalte
+------------------------------------------------------------------------*/
+
+BOOL SwWrtShell::SelectTableRow()
+{
+ if ( SelTblRow() )
+ {
+ fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
+ fnKillSel = &SwWrtShell::ResetSelect;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+
+BOOL SwWrtShell::SelectTableCol()
+{
+ 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;
+}
+/*------------------------------------------------------------------------
+ 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) )
+ return FALSE;
+
+ String sTxt;
+ CharClass& rCC = GetAppCharClass();
+
+ // 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 ) )
+ return NO_WORD;
+
+ cPrev = GetChar(FALSE, -1);
+ cNext = GetChar(TRUE);
+
+ 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 ) )
+ cWord = WORD_NO_SPACE;
+
+ if(cWord == WORD_NO_SPACE && ' ' == cPrev )
+ {
+ cWord = WORD_SPACE_BEFORE;
+ // Space davor loeschen
+ if(bCut)
+ {
+ Push();
+ if(IsCrsrPtAtEnd())
+ SwapPam();
+ ClearMark();
+ SetMark();
+ SwCrsrShell::Left(1,CRSR_SKIP_CHARS);
+ 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);
+ 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;
+}
+
+
+/* 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. */
+
+
+
+
diff --git a/sw/source/ui/wrtsh/wrtsh.hrc b/sw/source/ui/wrtsh/wrtsh.hrc
new file mode 100644
index 000000000000..a82a4c3c1b48
--- /dev/null
+++ b/sw/source/ui/wrtsh/wrtsh.hrc
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * 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.
+ *
+ * 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).
+ *
+ * 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.
+ *
+ ************************************************************************/
+#ifndef _WRTSH_HRC
+#define _WRTSH_HRC
+
+#include "rcid.hrc"
+
+#define DLG_GOTO (RC_WRTSH_BEGIN + 1)
+
+
+#define STR_DDEERROR_APP1 (RC_WRTSH_BEGIN + 2)
+#define STR_DDEERROR_APP2 (RC_WRTSH_BEGIN + 3)
+#define STR_DDEERROR_DATA1 (RC_WRTSH_BEGIN + 4)
+#define STR_DDEERROR_DATA2 (RC_WRTSH_BEGIN + 5)
+#define STR_DDEERROR_LINK1 (RC_WRTSH_BEGIN + 6)
+#define STR_DDEERROR_LINK2 (RC_WRTSH_BEGIN + 7)
+
+#define WRTSH_ACT_END STR_DDEERROR_LINK2
+
+#if WRTSH_ACT_END > RC_WRTSH_END
+#error Resource-Id Ueberlauf
+#endif
+
+#endif
diff --git a/sw/source/ui/wrtsh/wrtsh.src b/sw/source/ui/wrtsh/wrtsh.src
new file mode 100644
index 000000000000..21547d107758
--- /dev/null
+++ b/sw/source/ui/wrtsh/wrtsh.src
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * 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.
+ *
+ * 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).
+ *
+ * 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.
+ *
+ ************************************************************************/
+#include "wrtsh.hrc"
+
+String STR_DDEERROR_APP1
+{
+ Text[ en-US ] = "Application [" ;
+};
+String STR_DDEERROR_APP2
+{
+ Text[ en-US ] = "] is not responding." ;
+};
+String STR_DDEERROR_DATA1
+{
+ Text[ en-US ] = "Data for [" ;
+};
+String STR_DDEERROR_DATA2
+{
+ Text[ en-US ] = "] cannot be obtained" ;
+};
+String STR_DDEERROR_LINK1
+{
+ Text[ en-US ] = "Link to [" ;
+};
+String STR_DDEERROR_LINK2
+{
+ Text[ en-US ] = "] cannot be established" ;
+};
diff --git a/sw/source/ui/wrtsh/wrtsh1.cxx b/sw/source/ui/wrtsh/wrtsh1.cxx
new file mode 100644
index 000000000000..04f87e877aa5
--- /dev/null
+++ b/sw/source/ui/wrtsh/wrtsh1.cxx
@@ -0,0 +1,1871 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * 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.
+ *
+ * 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).
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/embed/XVisualObject.hpp>
+#include <com/sun/star/embed/EmbedMisc.hpp>
+#include <com/sun/star/embed/EmbedStates.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+
+#if STLPORT_VERSION>=321
+#include <math.h> // prevent conflict between exception and std::exception
+#endif
+#include <hintids.hxx>
+#include <svx/svdview.hxx>
+#include <sot/factory.hxx>
+#include <svl/itemiter.hxx>
+#ifndef _SOUND_HXX //autogen
+#include <vcl/sound.hxx>
+#endif
+#include <tools/bigint.hxx>
+#include <sot/storage.hxx>
+#include <svtools/insdlg.hxx>
+#include <sfx2/frmdescr.hxx>
+#include <sfx2/ipclient.hxx>
+#include <svtools/ehdl.hxx>
+#include <svtools/soerr.hxx>
+#include <tools/cachestr.hxx>
+#include <unotools/moduleoptions.hxx>
+#include <editeng/sizeitem.hxx>
+#include <editeng/brkitem.hxx>
+#include <editeng/svxacorr.hxx>
+#include <vcl/graph.hxx>
+#include <sfx2/printer.hxx>
+#include <unotools/charclass.hxx>
+
+#include <comphelper/storagehelper.hxx>
+#include <svx/svxdlg.hxx>
+#include <svx/extrusionbar.hxx>
+#include <svx/fontworkbar.hxx>
+#include <fmtftn.hxx>
+#include <fmtpdsc.hxx>
+#ifndef _WDOCSH_HXX
+#include <wdocsh.hxx>
+#endif
+#ifndef _BASESH_HXX
+#include <basesh.hxx>
+#endif
+#include <swmodule.hxx>
+#include <wrtsh.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <uitool.hxx>
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#include <pagedesc.hxx>
+#include <frmmgr.hxx>
+#include <shellio.hxx>
+#include <uinums.hxx> // fuer Anwenden einer
+#include <swundo.hxx> // fuer Undo-Ids
+#include <swcli.hxx>
+#include <poolfmt.hxx>
+#ifndef _WVIEW_HXX
+#include <wview.hxx>
+#endif
+#include <edtwin.hxx>
+#include <fmtcol.hxx>
+#include <swtable.hxx>
+#include <caption.hxx>
+#include <viscrs.hxx>
+#include <swdtflvr.hxx>
+#include <crsskip.hxx>
+#include <doc.hxx>
+#ifndef _WRTSH_HRC
+#include <wrtsh.hrc>
+#endif
+#include <SwStyleNameMapper.hxx>
+#include <sfx2/request.hxx>
+#include <paratr.hxx>
+#include <ndtxt.hxx>
+#include <editeng/acorrcfg.hxx>
+//#include <svx/acorrcfg.hxx>
+#include <IMark.hxx>
+
+// -> #111827#
+#include <SwRewriter.hxx>
+#include <comcore.hrc>
+#include <undobj.hxx>
+// <- #111827#
+
+#include <toolkit/helper/vclunohelper.hxx>
+#include <sfx2/viewfrm.hxx>
+
+#include <editeng/acorrcfg.hxx>
+
+#include "PostItMgr.hxx"
+
+using namespace sw::mark;
+using namespace com::sun::star;
+
+#define COMMON_INI_LIST \
+ fnDrag(&SwWrtShell::BeginDrag),\
+ fnSetCrsr(&SwWrtShell::SetCrsr),\
+ fnEndDrag(&SwWrtShell::EndDrag),\
+ fnKillSel(&SwWrtShell::Ignore),\
+ pModeStack(0), \
+ ePageMove(MV_NO),\
+ pCrsrStack(0), \
+ rView(rShell),\
+ bDestOnStack(FALSE), \
+ fnLeaveSelect(&SwWrtShell::SttLeaveSelect)
+
+#define BITFLD_INI_LIST \
+ bClearMark = \
+ bIns = TRUE;\
+ bAddMode = \
+ bBlockMode = \
+ bExtMode = \
+ bInSelect = \
+ bCopy = \
+ bLayoutMode = \
+ bNoEdit = \
+ bSelWrd = \
+ bSelLn = \
+ bIsInClickToEdit = \
+ mbRetainSelection = FALSE;
+
+
+SvxAutoCorrect* lcl_IsAutoCorr()
+{
+ SvxAutoCorrect* pACorr = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ if( pACorr && !pACorr->IsAutoCorrFlag( CptlSttSntnc | CptlSttWrd |
+ AddNonBrkSpace | ChgOrdinalNumber |
+ ChgToEnEmDash | SetINetAttr | Autocorrect ))
+ pACorr = 0;
+ return pACorr;
+}
+
+void SwWrtShell::NoEdit(BOOL bHideCrsr)
+{
+ if(bHideCrsr)
+ HideCrsr();
+ bNoEdit = TRUE;
+}
+
+
+
+void SwWrtShell::Edit()
+{
+ if (CanInsert())
+ {
+ ShowCrsr();
+ bNoEdit = FALSE;
+ }
+}
+
+
+
+BOOL SwWrtShell::IsEndWrd()
+{
+ MV_KONTEXT(this);
+ if(IsEndPara() && !IsSttPara())
+ return TRUE;
+
+ return IsEndWord();
+}
+
+
+/*------------------------------------------------------------------------
+ Beschreibung: Abfrage, ob Einfuegen moeglich ist; gfs. Beep
+------------------------------------------------------------------------*/
+
+
+
+BOOL SwWrtShell::_CanInsert()
+{
+ if(!CanInsert())
+ {
+ Sound::Beep();
+ return FALSE;
+ }
+ return TRUE;
+}
+/*------------------------------------------------------------------------
+ Beschreibung: String einfuegen
+------------------------------------------------------------------------*/
+
+void SwWrtShell::InsertByWord( const String & rStr)
+{
+ if( rStr.Len() )
+ {
+ BOOL bDelim = GetAppCharClass().isLetterNumeric( rStr, 0 );
+ xub_StrLen nPos = 0, nStt = 0;
+ for( ; nPos < rStr.Len(); nPos++ )
+ {
+ BOOL bTmpDelim = GetAppCharClass().isLetterNumeric( rStr, nPos );
+ if( bTmpDelim != bDelim )
+ {
+ Insert( rStr.Copy( nStt, nPos - nStt ));
+ nStt = nPos;
+ }
+ }
+ if( nStt != nPos )
+ Insert( rStr.Copy( nStt, nPos - nStt ));
+ }
+}
+
+
+void SwWrtShell::Insert( const String &rStr )
+{
+ ResetCursorStack();
+ if( !_CanInsert() )
+ return;
+
+ BOOL bStarted = FALSE, bHasSel = HasSelection(),
+ bCallIns = bIns /*|| bHasSel*/;
+ bool bDeleted = false;
+
+ if( bHasSel || ( !bIns && SelectHiddenRange() ) )
+ {
+ // nur hier klammern, da das normale Insert schon an der
+ // Editshell geklammert ist
+ StartAllAction();
+
+ // #111827#
+ SwRewriter aRewriter;
+
+ aRewriter.AddRule(UNDO_ARG1, GetCrsrDescr());
+ aRewriter.AddRule(UNDO_ARG2, String(SW_RES(STR_YIELDS)));
+ {
+ String aTmpStr;
+ aTmpStr += String(SW_RES(STR_START_QUOTE));
+ aTmpStr += rStr;
+ aTmpStr += String(SW_RES(STR_END_QUOTE));
+
+ aRewriter.AddRule(UNDO_ARG3, rStr);
+ }
+
+ StartUndo(UNDO_REPLACE, &aRewriter);
+ bStarted = TRUE;
+ bDeleted = DelRight() != 0;
+ }
+
+ /*
+JP 21.01.98: Ueberschreiben ueberschreibt nur die Selektion, nicht das
+ naechste Zeichen.
+ if( bHasSel && !bIns && 1 < rStr.Len() )
+ {
+ // falls mehrere Zeichen anstehen, nur das erste einfuegen,
+ // der Rest muss dann aber Ueberschrieben werden.
+ SwEditShell::Insert( rStr.GetChar( 0 ) );
+ SwEditShell::Overwrite( rStr.Copy( 1 ) );
+ }
+ else
+*/
+ bCallIns ?
+ SwEditShell::Insert2( rStr, bDeleted ) : SwEditShell::Overwrite( rStr );
+
+
+ if( bStarted )
+ {
+ EndAllAction();
+ EndUndo(UNDO_REPLACE);
+ }
+// delete pChgFlg;
+}
+
+/* Begrenzung auf maximale Hoehe geht nicht, da die maximale Hoehe
+ * des aktuellen Frames nicht erfragt werden kann. */
+
+
+
+void SwWrtShell::Insert( const String &rPath, const String &rFilter,
+ const Graphic &rGrf, SwFlyFrmAttrMgr *pFrmMgr,
+ BOOL bRule )
+{
+ ResetCursorStack();
+ if ( !_CanInsert() )
+ return;
+
+ StartAllAction();
+
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UNDO_ARG1, SW_RES(STR_GRAPHIC));
+
+ StartUndo(UNDO_INSERT, &aRewriter);
+
+ if ( HasSelection() )
+ DelRight();
+ // eingefuegte Grafik in eigenen Absatz, falls am Ende
+ // eines nichtleeren Absatzes
+ if ( IsEndPara() && !IsSttPara() )
+ SwFEShell::SplitNode();
+
+ EnterSelFrmMode();
+
+ BOOL bSetGrfSize = TRUE;
+ BOOL bOwnMgr = FALSE;
+
+ if ( !pFrmMgr )
+ {
+ bOwnMgr = TRUE;
+ pFrmMgr = new SwFlyFrmAttrMgr( TRUE, this, FRMMGR_TYPE_GRF );
+
+ // VORSICHT
+ // GetAttrSet nimmt einen Abgleich vor
+ // Beim Einfuegen ist eine SwFrmSize vorhanden wegen der
+ // DEF-Rahmengroesse
+ // Diese muss fuer die optimale Groesse explizit entfernt werden
+ pFrmMgr->DelAttr(RES_FRM_SIZE);
+ }
+ else
+ {
+ Size aSz( pFrmMgr->GetSize() );
+ if ( !aSz.Width() || !aSz.Height() )
+ {
+ aSz.Width() = aSz.Height() = 567;
+ pFrmMgr->SetSize( aSz );
+ }
+ else if ( aSz.Width() != DFLT_WIDTH && aSz.Height() != DFLT_HEIGHT )
+ bSetGrfSize = FALSE;
+
+ pFrmMgr->SetHeightSizeType(ATT_FIX_SIZE);
+
+ }
+
+ // Einfuegen der Grafik
+ SwFEShell::Insert(rPath, rFilter, &rGrf, &pFrmMgr->GetAttrSet());
+ if ( bOwnMgr )
+ pFrmMgr->UpdateAttrMgr();
+
+ if( bSetGrfSize && !bRule )
+ {
+ Size aGrfSize, aBound = GetGraphicDefaultSize();
+ GetGrfSize( aGrfSize );
+
+ //Die GrafikSize noch um die Randattribute vergroessern, denn die
+ //Zaehlen beim Rahmen mit.
+ aGrfSize.Width() += pFrmMgr->CalcWidthBorder();
+ aGrfSize.Height()+= pFrmMgr->CalcHeightBorder();
+
+ const BigInt aTempWidth( aGrfSize.Width() );
+ const BigInt aTempHeight( aGrfSize.Height());
+
+ // ggf. Breite anpassen, Hoehe dann proportional verkleinern
+ if( aGrfSize.Width() > aBound.Width() )
+ {
+ aGrfSize.Width() = aBound.Width();
+ aGrfSize.Height() = ((BigInt)aBound.Width()) * aTempHeight / aTempWidth;
+ }
+ // ggf. Hoehe anpassen, Breite dann proportional verkleinern
+ if( aGrfSize.Height() > aBound.Height() )
+ {
+ aGrfSize.Height() = aBound.Height();
+ aGrfSize.Width() = ((BigInt)aBound.Height()) * aTempWidth / aTempHeight;
+ }
+ pFrmMgr->SetSize( aGrfSize );
+ pFrmMgr->UpdateFlyFrm();
+ }
+ if ( bOwnMgr )
+ delete pFrmMgr;
+
+ EndUndo(UNDO_INSERT);
+ EndAllAction();
+}
+
+
+/*------------------------------------------------------------------------
+ Beschreibung: Fuegt ein OLE-Objekt in die CORE ein.
+ Wenn kein Object uebergeben wird, so wird eins erzeugt.
+------------------------------------------------------------------------*/
+
+
+void SwWrtShell::InsertObject( const svt::EmbeddedObjectRef& xRef, SvGlobalName *pName,
+ BOOL bActivate, USHORT nSlotId )
+{
+ ResetCursorStack();
+ if( !_CanInsert() )
+ return;
+
+ if( !xRef.is() )
+ {
+ // temporary storage
+ svt::EmbeddedObjectRef xObj;
+ uno::Reference < embed::XStorage > xStor = comphelper::OStorageHelper::GetTemporaryStorage();
+ BOOL bDoVerb = TRUE;
+ if ( pName )
+ {
+ comphelper::EmbeddedObjectContainer aCnt( xStor );
+ ::rtl::OUString aName;
+ // TODO/LATER: get aspect?
+ xObj.Assign( aCnt.CreateEmbeddedObject( pName->GetByteSequence(), aName ), embed::Aspects::MSOLE_CONTENT );
+ }
+ else
+ {
+ SvObjectServerList aServerList;
+ switch (nSlotId)
+ {
+ case SID_INSERT_OBJECT:
+ {
+ aServerList.FillInsertObjects();
+ aServerList.Remove( SwDocShell::Factory().GetClassId() );
+ // Intentionally no break!
+ }
+
+ // TODO/LATER: recording! Convert properties to items
+ case SID_INSERT_PLUGIN:
+ /*
+ if(pReq)
+ {
+ INetURLObject* pURL = aDlg.GetURL();
+ if(pURL)
+ pReq->AppendItem(SfxStringItem(FN_PARAM_2, pURL->GetMainURL(INetURLObject::NO_DECODE)));
+ pReq->AppendItem(SfxStringItem(FN_PARAM_3 , aDlg.GetCommands()));
+ } */
+ case SID_INSERT_APPLET:
+ /*
+ if(pReq)
+ {
+ SvAppletObjectRef xApplet ( xIPObj );
+ if(xApplet.Is())
+ pReq->AppendItem(SfxStringItem(FN_PARAM_1 , xApplet->GetCodeBase()));
+ pReq->AppendItem(SfxStringItem(FN_PARAM_2 , aDlg.GetClass()));
+ pReq->AppendItem(SfxStringItem(FN_PARAM_3 , aDlg.GetCommands()));
+ }*/
+ case SID_INSERT_FLOATINGFRAME:
+ /*
+ if(pReq && xFloatingFrame.Is())
+ {
+ const SfxFrameDescriptor* pDescriptor = xFloatingFrame->GetFrameDescriptor();
+ pReq->AppendItem(SfxStringItem(FN_PARAM_1, pDescriptor->GetName()));
+ pReq->AppendItem(
+ SfxStringItem( FN_PARAM_2,
+ pDescriptor->GetURL().GetMainURL(INetURLObject::NO_DECODE)));
+ pReq->AppendItem(SvxSizeItem(FN_PARAM_3, pDescriptor->GetMargin()));
+ pReq->AppendItem(SfxByteItem(FN_PARAM_4, pDescriptor->GetScrollingMode()));
+ pReq->AppendItem(SfxBoolItem(FN_PARAM_5, pDescriptor->HasFrameBorder()));
+ }*/
+ {
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ SfxAbstractInsertObjectDialog* pDlg =
+ pFact->CreateInsertObjectDialog( GetWin(), nSlotId, xStor, &aServerList );
+ if ( pDlg )
+ {
+ pDlg->Execute();
+ bDoVerb = pDlg->IsCreateNew();
+ ::rtl::OUString aIconMediaType;
+ uno::Reference< io::XInputStream > xIconMetaFile = pDlg->GetIconIfIconified( &aIconMediaType );
+ xObj.Assign( pDlg->GetObject(),
+ xIconMetaFile.is() ? embed::Aspects::MSOLE_ICON : embed::Aspects::MSOLE_CONTENT );
+ if ( xIconMetaFile.is() )
+ xObj.SetGraphicStream( xIconMetaFile, aIconMediaType );
+
+ DELETEZ( pDlg );
+ }
+
+ break;
+ }
+
+ default:
+ break;
+ }
+ }
+
+ if ( xObj.is() )
+ {
+ if( InsertOleObject( xObj ) && bActivate && bDoVerb )
+ {
+ SfxInPlaceClient* pClient = GetView().FindIPClient( xObj.GetObject(), &GetView().GetEditWin() );
+ if ( !pClient )
+ {
+ pClient = new SwOleClient( &GetView(), &GetView().GetEditWin(), xObj );
+ SetCheckForOLEInCaption( TRUE );
+ }
+
+ if ( xObj.GetViewAspect() == embed::Aspects::MSOLE_ICON )
+ {
+ SwRect aArea = GetAnyCurRect( RECT_FLY_PRT_EMBEDDED, 0, xObj.GetObject() );
+ aArea.Pos() += GetAnyCurRect( RECT_FLY_EMBEDDED, 0, xObj.GetObject() ).Pos();
+ MapMode aMapMode( MAP_TWIP );
+ Size aSize = xObj.GetSize( &aMapMode );
+ aArea.Width( aSize.Width() );
+ aArea.Height( aSize.Height() );
+ RequestObjectResize( aArea, xObj.GetObject() );
+ }
+ else
+ CalcAndSetScale( xObj );
+
+ //#50270# Error brauchen wir nicht handeln, das erledigt das
+ //DoVerb in der SfxViewShell
+ pClient->DoVerb( SVVERB_SHOW );
+
+ // TODO/LATER: set document name - should be done in Client
+ //if ( !ERRCODE_TOERROR( nErr ) )
+ // xIPObj->SetDocumentName( GetView().GetDocShell()->GetTitle() );
+ }
+ }
+ }
+ else
+ {
+ if( HasSelection() )
+ DelRight();
+ InsertOleObject( xRef );
+ }
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Object in die Core einfuegen.
+ Vom ClipBoard oder Insert
+------------------------------------------------------------------------*/
+
+BOOL SwWrtShell::InsertOleObject( const svt::EmbeddedObjectRef& xRef, SwFlyFrmFmt **pFlyFrmFmt )
+{
+ ResetCursorStack();
+ StartAllAction();
+
+ StartUndo(UNDO_INSERT);
+
+ //Some differences between StarMath and any other objects:
+ //1. Selections should be deleted. For StarMath the Text should be
+ // passed to the Object
+ //2. If the cursor is at the end of an non empty paragraph a paragraph
+ // break should be insertet. StarMath objects are character bound and
+ // no break should be inserted.
+ //3. If an selektion is passed to a StarMath object, this object should
+ // not be activated. FALSE should be returned then.
+ BOOL bStarMath = TRUE;
+ BOOL bActivate = TRUE;
+
+ // set parent to get correct VisArea(in case of object needing parent printer)
+ uno::Reference < container::XChild > xChild( xRef.GetObject(), uno::UNO_QUERY );
+ if ( xChild.is() )
+ xChild->setParent( pDoc->GetDocShell()->GetModel() );
+
+ SvGlobalName aCLSID( xRef->getClassID() );
+ bStarMath = ( SotExchange::IsMath( aCLSID ) != 0 );
+ if( IsSelection() )
+ {
+ if( bStarMath )
+ {
+ String aMathData;
+ GetSelectedText( aMathData, GETSELTXT_PARABRK_TO_ONLYCR );
+
+ if( aMathData.Len() && svt::EmbeddedObjectRef::TryRunningState( xRef.GetObject() ) )
+ {
+ uno::Reference < beans::XPropertySet > xSet( xRef->getComponent(), uno::UNO_QUERY );
+ if ( xSet.is() )
+ {
+ try
+ {
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("Formula"), uno::makeAny( ::rtl::OUString( aMathData ) ) );
+ bActivate = FALSE;
+ }
+ catch ( uno::Exception& )
+ {
+ }
+ }
+ }
+ }
+ DelRight();
+ }
+
+ if ( !bStarMath )
+ SwFEShell::SplitNode( FALSE, FALSE );
+
+ EnterSelFrmMode();
+
+ SwFlyFrmAttrMgr aFrmMgr( TRUE, this, FRMMGR_TYPE_OLE );
+ aFrmMgr.SetHeightSizeType(ATT_FIX_SIZE);
+
+ SwRect aBound;
+ CalcBoundRect( aBound, aFrmMgr.GetAnchor() );
+
+ //The Size should be suggested by the OLE server
+ MapMode aMapMode( MAP_TWIP );
+ Size aSz = xRef.GetSize( &aMapMode );
+
+ //Object size can be limited
+ if ( aSz.Width() > aBound.Width() )
+ {
+ //Immer proportional begrenzen.
+ aSz.Height() = aSz.Height() * aBound.Width() / aSz.Width();
+ aSz.Width() = aBound.Width();
+ }
+ aFrmMgr.SetSize( aSz );
+ SwFlyFrmFmt *pFmt = SwFEShell::InsertObject( xRef, &aFrmMgr.GetAttrSet() );
+
+ if (pFlyFrmFmt)
+ *pFlyFrmFmt = pFmt;
+
+ EndAllAction();
+ GetView().AutoCaption(OLE_CAP, &aCLSID);
+
+ SwRewriter aRewriter;
+
+ if ( bStarMath )
+ aRewriter.AddRule(UNDO_ARG1, SW_RES(STR_MATH_FORMULA));
+ else if ( SotExchange::IsChart( aCLSID ) )
+ aRewriter.AddRule(UNDO_ARG1, SW_RES(STR_CHART));
+ else
+ aRewriter.AddRule(UNDO_ARG1, SW_RES(STR_OLE));
+
+ EndUndo(UNDO_INSERT, &aRewriter);
+
+ return bActivate;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Das aktuelle selektierte OLE-Objekt wird mit dem
+ Verb in den Server geladen.
+------------------------------------------------------------------------*/
+
+
+
+void SwWrtShell::LaunchOLEObj( long nVerb )
+{
+ if ( GetCntType() == CNT_OLE &&
+ !GetView().GetViewFrame()->GetFrame().IsInPlace() )
+ {
+ svt::EmbeddedObjectRef& xRef = GetOLEObject();
+ ASSERT( xRef.is(), "OLE not found" );
+ SfxInPlaceClient* pCli=0;
+
+ pCli = GetView().FindIPClient( xRef.GetObject(), &GetView().GetEditWin() );
+ if ( !pCli )
+ pCli = new SwOleClient( &GetView(), &GetView().GetEditWin(), xRef );
+
+ ((SwOleClient*)pCli)->SetInDoVerb( TRUE );
+
+ CalcAndSetScale( xRef );
+ pCli->DoVerb( nVerb );
+
+ ((SwOleClient*)pCli)->SetInDoVerb( FALSE );
+ CalcAndSetScale( xRef );
+ }
+}
+
+void SwWrtShell::MoveObjectIfActive( svt::EmbeddedObjectRef& xObj, const Point& rOffset )
+{
+ try
+ {
+ sal_Int32 nState = xObj->getCurrentState();
+ if ( nState == ::com::sun::star::embed::EmbedStates::INPLACE_ACTIVE
+ || nState == ::com::sun::star::embed::EmbedStates::UI_ACTIVE )
+ {
+ SfxInPlaceClient* pCli =
+ GetView().FindIPClient( xObj.GetObject(), &(GetView().GetEditWin()) );
+ if ( pCli )
+ {
+ Rectangle aArea = pCli->GetObjArea();
+ aArea += rOffset;
+ pCli->SetObjArea( aArea );
+ }
+ }
+ }
+ catch( uno::Exception& )
+ {}
+}
+
+
+void SwWrtShell::CalcAndSetScale( svt::EmbeddedObjectRef& xObj,
+ const SwRect *pFlyPrtRect,
+ const SwRect *pFlyFrmRect )
+{
+ //Einstellen der Skalierung am Client. Diese ergibt sich aus der Differenz
+ //zwischen der VisArea des Objektes und der ObjArea.
+ ASSERT( xObj.is(), "ObjectRef not valid" );
+
+ sal_Int64 nAspect = xObj.GetViewAspect();
+ if ( nAspect == embed::Aspects::MSOLE_ICON )
+ return; // the replacement image is completely controlled by container in this case
+
+ sal_Int64 nMisc = 0;
+ sal_Bool bLinkingChart = sal_False;
+
+ try
+ {
+ nMisc = xObj->getStatus( nAspect );
+
+ //Das kann ja wohl nur ein nicht aktives Objekt sein. Diese bekommen
+ //auf Wunsch die neue Groesse als VisArea gesetzt (StarChart)
+ if( embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE & nMisc )
+ {
+ // TODO/MBA: testing
+ SwRect aRect( pFlyPrtRect ? *pFlyPrtRect
+ : GetAnyCurRect( RECT_FLY_PRT_EMBEDDED, 0, xObj.GetObject() ));
+ if( !aRect.IsEmpty() )
+ {
+ // TODO/LEAN: getMapUnit can switch object to running state
+ // xObj.TryRunningState();
+
+ MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) );
+
+ // TODO/LATER: needs complete VisArea?!
+ Size aSize( OutputDevice::LogicToLogic( aRect.SVRect(), MAP_TWIP, aUnit ).GetSize() );
+ awt::Size aSz;
+ aSz.Width = aSize.Width();
+ aSz.Height = aSize.Height();
+ xObj->setVisualAreaSize( nAspect, aSz );
+ // --> OD 2005-05-02 #i48419# - action 'UpdateReplacement' doesn't
+ // have to change the modified state of the document.
+ // This is only a workaround for the defect, that this action
+ // modifies a document after load, because unnecessarily the
+ // replacement graphic is updated, in spite of the fact that
+ // nothing has been changed.
+ // If the replacement graphic changes by this action, the document
+ // will be already modified via other mechanisms.
+ {
+ bool bResetEnableSetModified(false);
+ if ( GetDoc()->GetDocShell()->IsEnableSetModified() )
+ {
+ GetDoc()->GetDocShell()->EnableSetModified( FALSE );
+ bResetEnableSetModified = true;
+ }
+
+ //#i79576# don't destroy chart replacement images on load
+ //#i79578# don't request a new replacement image for charts to often
+ //a chart sends a modified call to the framework if it was changed
+ //thus the replacement update is already handled elsewhere
+ if ( !SotExchange::IsChart( xObj->getClassID() ) )
+ xObj.UpdateReplacement();
+
+ if ( bResetEnableSetModified )
+ {
+ GetDoc()->GetDocShell()->EnableSetModified( TRUE );
+ }
+ }
+ // <--
+ }
+
+ // TODO/LATER: this is only a workaround,
+ uno::Reference< chart2::XChartDocument > xChartDocument( xObj->getComponent(), uno::UNO_QUERY );
+ bLinkingChart = ( xChartDocument.is() && !xChartDocument->hasInternalDataProvider() );
+ }
+ }
+ catch ( uno::Exception& )
+ {
+ // TODO/LATER: handle the error
+ return;
+ }
+
+ SfxInPlaceClient* pCli = GetView().FindIPClient( xObj.GetObject(), &GetView().GetEditWin() );
+ if ( !pCli )
+ {
+ if ( (embed::EmbedMisc::EMBED_ACTIVATEIMMEDIATELY & nMisc) || bLinkingChart
+ // TODO/LATER: ResizeOnPrinterChange
+ //|| SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE & xObj->GetMiscStatus()
+ )
+ {
+ pCli = new SwOleClient( &GetView(), &GetView().GetEditWin(), xObj );
+ }
+ else
+ return;
+ }
+
+ // TODO/LEAN: getMapUnit can switch object to running state
+ // xObj.TryRunningState();
+
+ awt::Size aSize;
+ try
+ {
+ aSize = xObj->getVisualAreaSize( nAspect );
+ }
+ catch( embed::NoVisualAreaSizeException& )
+ {
+ DBG_ERROR( "Can't get visual area size!\n" );
+ // the scaling will not be done
+ }
+ catch( uno::Exception& )
+ {
+ // TODO/LATER: handle the error
+ DBG_ERROR( "Can't get visual area size!\n" );
+ return;
+ }
+
+ Size _aVisArea( aSize.Width, aSize.Height );
+
+ Fraction aScaleWidth( 1, 1 );
+ Fraction aScaleHeight( 1, 1 );
+
+ sal_Bool bUseObjectSize = sal_False;
+
+ // solange keine vernuenftige Size vom Object kommt, kann nichts
+ // skaliert werden
+ if( _aVisArea.Width() && _aVisArea.Height() )
+ {
+ const MapMode aTmp( MAP_TWIP );
+ MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) );
+ _aVisArea = OutputDevice::LogicToLogic( _aVisArea, aUnit, aTmp);
+ Size aObjArea;
+ if ( pFlyPrtRect )
+ aObjArea = pFlyPrtRect->SSize();
+ else
+ aObjArea = GetAnyCurRect( RECT_FLY_PRT_EMBEDDED, 0, xObj.GetObject() ).SSize();
+
+ // differ the aObjArea and _aVisArea by 1 Pixel then set new VisArea
+ long nX, nY;
+ SwSelPaintRects::Get1PixelInLogic( *this, &nX, &nY );
+ if( !( _aVisArea.Width() - nX <= aObjArea.Width() &&
+ _aVisArea.Width() + nX >= aObjArea.Width() &&
+ _aVisArea.Height()- nY <= aObjArea.Height()&&
+ _aVisArea.Height()+ nY >= aObjArea.Height() ))
+ {
+ // TODO/LATER: MISCSTATUS_RESIZEONPRINTERCHANGE
+ /*
+ if( SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE & nMisc )
+ {
+ //This type of objects should never be resized.
+ //If this request comes from the Writer core (inaktive Object
+ //ist resized), the Object should be resized too.
+ //If this request comes from the Object itself, the Frame
+ //in the Writer core should be resized.
+ if ( pFlyPrtRect ) //Request from core?
+ {
+ xObj->SetVisArea( OutputDevice::LogicToLogic(
+ pFlyPrtRect->SVRect(), MAP_TWIP, xObj->GetMapUnit() ));
+ }
+ else
+ {
+ SwRect aTmp( Point( LONG_MIN, LONG_MIN ), _aVisArea );
+ RequestObjectResize( aTmp, xObj );
+ }
+ //Der Rest erledigt sich, weil wir eh wiederkommen sollten, evtl.
+ //sogar rekursiv.
+ return;
+ }
+ else*/
+
+ if ( nMisc & embed::EmbedMisc::EMBED_NEVERRESIZE )
+ {
+ // the object must not be scaled, the size stored in object must be used for restoring
+ bUseObjectSize = sal_True;
+ }
+ else
+ {
+ aScaleWidth = Fraction( aObjArea.Width(), _aVisArea.Width() );
+ aScaleHeight = Fraction( aObjArea.Height(), _aVisArea.Height());
+ }
+ }
+ }
+
+ //Jetzt ist auch der guenstige Zeitpunkt die ObjArea einzustellen.
+ //Die Scalierung muss beruecksichtigt werden.
+ SwRect aArea;
+ if ( pFlyPrtRect )
+ {
+ aArea = *pFlyPrtRect;
+ aArea += pFlyFrmRect->Pos();
+ }
+ else
+ {
+ aArea = GetAnyCurRect( RECT_FLY_PRT_EMBEDDED, 0, xObj.GetObject() );
+ aArea.Pos() += GetAnyCurRect( RECT_FLY_EMBEDDED, 0, xObj.GetObject() ).Pos();
+ }
+
+ if ( bUseObjectSize )
+ {
+ aArea.Width ( _aVisArea.Width() );
+ aArea.Height( _aVisArea.Height() );
+ RequestObjectResize( aArea, xObj.GetObject() );
+ }
+ else
+ {
+ aArea.Width ( Fraction( aArea.Width() ) / pCli->GetScaleWidth() );
+ aArea.Height( Fraction( aArea.Height() ) / pCli->GetScaleHeight());
+ }
+
+ pCli->SetObjAreaAndScale( aArea.SVRect(), aScaleWidth, aScaleHeight );
+}
+
+
+
+void SwWrtShell::ConnectObj( svt::EmbeddedObjectRef& xObj, const SwRect &rPrt,
+ const SwRect &rFrm )
+{
+ SfxInPlaceClient* pCli = GetView().FindIPClient( xObj.GetObject(), &GetView().GetEditWin());
+ if ( !pCli )
+ pCli = new SwOleClient( &GetView(), &GetView().GetEditWin(), xObj );
+ CalcAndSetScale( xObj, &rPrt, &rFrm );
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Einfuegen harter Seitenumbruch;
+ Selektionen werden ueberschrieben
+------------------------------------------------------------------------*/
+
+
+
+void SwWrtShell::InsertPageBreak(const String *pPageDesc, USHORT nPgNum )
+{
+ ResetCursorStack();
+ if( _CanInsert() )
+ {
+ ACT_KONTEXT(this);
+ StartUndo(UNDO_UI_INSERT_PAGE_BREAK);
+
+ if ( !IsCrsrInTbl() )
+ {
+ if(HasSelection())
+ DelRight();
+ SwFEShell::SplitNode();
+ }
+
+ const SwPageDesc *pDesc = pPageDesc
+ ? FindPageDescByName( *pPageDesc, TRUE ) : 0;
+ if( pDesc )
+ {
+ SwFmtPageDesc aDesc( pDesc );
+ aDesc.SetNumOffset( nPgNum );
+ SetAttr( aDesc );
+ }
+ else
+ SetAttr( SvxFmtBreakItem(SVX_BREAK_PAGE_BEFORE, RES_BREAK) );
+ EndUndo(UNDO_UI_INSERT_PAGE_BREAK);
+ }
+}
+/*------------------------------------------------------------------------
+ Beschreibung: Einfuegen harter Zeilenumbruch;
+ Selektionen werden ueberschrieben
+------------------------------------------------------------------------*/
+
+
+void SwWrtShell::InsertLineBreak()
+{
+ ResetCursorStack();
+ if( _CanInsert() )
+ {
+ if(HasSelection())
+ DelRight();
+
+ const sal_Unicode cIns = 0x0A;
+ SvxAutoCorrect* pACorr = lcl_IsAutoCorr();
+ if( pACorr )
+ AutoCorrect( *pACorr, cIns );
+ else
+ SwWrtShell::Insert( String( cIns ) );
+ }
+}
+/*------------------------------------------------------------------------
+ Beschreibung: Einfuegen harter Spaltenumbruch;
+ Selektionen werden ueberschrieben
+------------------------------------------------------------------------*/
+
+
+void SwWrtShell::InsertColumnBreak()
+{
+ ACT_KONTEXT(this);
+ ResetCursorStack();
+ if( _CanInsert() )
+ {
+ StartUndo(UNDO_UI_INSERT_COLUMN_BREAK);
+
+ if ( !IsCrsrInTbl() )
+ {
+ if(HasSelection())
+ DelRight();
+ SwFEShell::SplitNode( FALSE, FALSE );
+ }
+ SetAttr(SvxFmtBreakItem(SVX_BREAK_COLUMN_BEFORE, RES_BREAK));
+
+ EndUndo(UNDO_UI_INSERT_COLUMN_BREAK);
+ }
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Einfuegen Fussnote
+ Parameter: rStr -- optionales Fussnotenzeichen
+------------------------------------------------------------------------*/
+
+
+void SwWrtShell::InsertFootnote(const String &rStr, BOOL bEndNote, BOOL bEdit )
+{
+ ResetCursorStack();
+ if( _CanInsert() )
+ {
+ if(HasSelection())
+ {
+ //collapse cursor to the end
+ if(!IsCrsrPtAtEnd())
+ SwapPam();
+ ClearMark();
+ }
+
+ SwFmtFtn aFootNote( bEndNote );
+ if(rStr.Len())
+ aFootNote.SetNumStr( rStr );
+
+ SetAttr(aFootNote);
+
+ if( bEdit )
+ {
+ // zur Bearbeiung des Fussnotentextes
+ Left(CRSR_SKIP_CHARS, FALSE, 1, FALSE );
+ GotoFtnTxt();
+ }
+ }
+}
+/*------------------------------------------------------------------------
+ Beschreibung: SplitNode; hier auch, da
+ - selektierter Inhalt geloescht wird;
+ - der Cursorstack gfs. zurueckgesetzt wird.
+------------------------------------------------------------------------*/
+
+
+void SwWrtShell::SplitNode( BOOL bAutoFmt, BOOL bCheckTableStart )
+{
+ ResetCursorStack();
+ if( _CanInsert() )
+ {
+ ACT_KONTEXT(this);
+
+ rView.GetEditWin().FlushInBuffer();
+ BOOL bHasSel = HasSelection();
+ if( bHasSel )
+ {
+ StartUndo( UNDO_INSERT );
+ DelRight();
+ }
+
+ SwFEShell::SplitNode( bAutoFmt, bCheckTableStart );
+ if( bHasSel )
+ EndUndo( UNDO_INSERT );
+ }
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Numerierung anschalten
+ Parameter: Optionale Angabe eines Namens fuer die benannte Liste;
+ dieser bezeichnet eine Position, wenn er in eine
+ Zahl konvertierbar ist und kleiner ist als nMaxRules.
+-------------------------------------------------------------------------*/
+
+
+// zum Testen der CharFormate an der Numerierung
+// extern void SetNumChrFmt( SwWrtShell*, SwNumRules& );
+
+// -> #i40041#
+// --> OD 2005-10-25 #b6340308#
+// Preconditions (as far as OD has figured out):
+// - <SwEditShell::HasNumber()> is FALSE, if <bNum> is TRUE
+// - <SwEditShell::HasBullet()> is FALSE, if <bNum> is FALSE
+// Behavior of method is determined by the current situation at the current
+// cursor position in the document.
+void SwWrtShell::NumOrBulletOn(BOOL bNum)
+{
+ // determine numbering rule found at current cursor position in the docment.
+ const SwNumRule* pCurRule = GetCurNumRule();
+
+ StartUndo(UNDO_NUMORNONUM);
+
+ const SwNumRule * pNumRule = pCurRule;
+
+ // --> OD 2005-10-25 #b6340308#
+ // - activate outline rule respectively turning on outline rule for
+ // current text node. But, only for turning on a numbering (<bNum> == TRUE).
+ // - overwrite found numbering rule at current cursor position, if
+ // no numbering rule can be retrieved from the paragraph style.
+ bool bContinueFoundNumRule( false );
+ bool bActivateOutlineRule( false );
+ int nActivateOutlineLvl( MAXLEVEL ); // only relevant, if <bActivateOutlineRule> == TRUE
+ SwTxtFmtColl * pColl = GetCurTxtFmtColl();
+ if ( pColl )
+ {
+ // --> OD 2005-10-25 #b6340308# - retrieve numbering rule at paragraph
+ // style, which is found at current cursor position in the document.
+ SwNumRule* pCollRule = pDoc->FindNumRulePtr(pColl->GetNumRule().GetValue());
+ // --> OD 2005-10-25 #125993# - The outline numbering rule isn't allowed
+ // to be derived from a parent paragraph style to a derived one.
+ // Thus check, if the found outline numbering rule is directly
+ // set at the paragraph style <pColl>. If not, set <pCollRule> to NULL
+ if ( pCollRule && pCollRule == GetDoc()->GetOutlineNumRule() )
+ {
+ const SwNumRule* pDirectCollRule =
+ pDoc->FindNumRulePtr(pColl->GetNumRule( FALSE ).GetValue());
+ if ( !pDirectCollRule )
+ {
+ pCollRule = 0;
+ }
+ }
+ // --> OD 2006-11-20 #i71764#
+ // Document setting OUTLINE_LEVEL_YIELDS_OUTLINE_RULE has no influence
+ // any more.
+// if ( pCollRule == NULL &&
+// NO_NUMBERING != pColl->GetOutlineLevel() &&
+// GetDoc()->get(IDocumentSettingAccess::OUTLINE_LEVEL_YIELDS_OUTLINE_RULE) )
+// {
+// pCollRule = GetDoc()->GetOutlineNumRule();
+// }
+ // <--
+
+ // <--
+ // --> OD 2005-10-25 #b6340308#
+ if ( !pCollRule )
+ {
+ pNumRule = pCollRule;
+ }
+ // --> OD 2006-06-12 #b6435904#
+ // no activation or continuation of outline numbering in Writer/Web document
+ else if ( bNum &&
+ !dynamic_cast<SwWebDocShell*>(GetDoc()->GetDocShell()) &&
+ pCollRule == GetDoc()->GetOutlineNumRule() )
+ // <--
+ {
+ if ( pNumRule == pCollRule )
+ {
+ // check, if text node at current cursor positioned is counted.
+ // If not, let it been counted. Then it has to be checked,
+ // of the outline numbering has to be activated or continued.
+ SwTxtNode* pTxtNode =
+ GetCrsr()->GetPoint()->nNode.GetNode().GetTxtNode();
+ if ( pTxtNode && !pTxtNode->IsCountedInList() )
+ {
+ // check, if numbering of the outline level of the pararaph
+ // style is active. If not, activate this outline level.
+ nActivateOutlineLvl = pColl->GetAssignedOutlineStyleLevel();
+ ASSERT( pColl->IsAssignedToListLevelOfOutlineStyle(), //<-end,zhaojianwei
+ "<SwWrtShell::NumOrBulletOn(..)> - paragraph style with outline rule, but no outline level" );
+ if ( pColl->IsAssignedToListLevelOfOutlineStyle() && //<-end,zhaojianwei
+ pCollRule->Get( static_cast<USHORT>(nActivateOutlineLvl) ).GetNumberingType()
+ == SVX_NUM_NUMBER_NONE )
+ {
+ // activate outline numbering
+ bActivateOutlineRule = true;
+ }
+ else
+ {
+ // turning on outline numbering at current cursor position
+ bContinueFoundNumRule = true;
+ }
+ }
+ else
+ {
+ // --> OD 2009-08-27 #i101234#
+ // activate outline numbering, because from the precondition
+ // it's known, that <SwEdit::HasNumber()> == FALSE
+ bActivateOutlineRule = true;
+ nActivateOutlineLvl = pColl->GetAssignedOutlineStyleLevel();//<-end,zhaojianwei
+ }
+ }
+ else if ( !pNumRule )
+ {
+ // --> 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->GetAssignedOutlineStyleLevel();//#outline level,zhaojianwei
+ ASSERT( pColl->IsAssignedToListLevelOfOutlineStyle(),//#outline level,zhaojianwei
+ "<SwWrtShell::NumOrBulletOn(..)> - paragraph style with outline rule, but no outline level" );
+ if ( pColl->IsAssignedToListLevelOfOutlineStyle() &&//#outline level,zhaojianwei
+ pCollRule->Get( static_cast<USHORT>(nActivateOutlineLvl) ).GetNumberingType()
+ == SVX_NUM_NUMBER_NONE )
+ {
+ // activate outline numbering
+ bActivateOutlineRule = true;
+ }
+ else
+ {
+ // turning on outline numbering at current cursor position
+ bContinueFoundNumRule = true;
+ }
+ }
+ pNumRule = pCollRule;
+ }
+ }
+
+ // --> OD 2005-10-25 #b6340308#
+ // Only automatic numbering/bullet rules should be changed.
+ // Note: The outline numbering rule is also an automatic one. It's only
+ // changed, if it has to be activated.
+ if ( pNumRule )
+ {
+ if ( !pNumRule->IsAutoRule() )
+ {
+ pNumRule = 0;
+ }
+ else if ( pNumRule == GetDoc()->GetOutlineNumRule() &&
+ !bActivateOutlineRule && !bContinueFoundNumRule )
+ {
+ pNumRule = 0;
+ }
+ }
+ // <--
+
+ // --> OD 2005-10-25 #b6340308#
+ // Search for a previous numbering/bullet rule to continue it.
+ // --> OD 2008-03-18 #refactorlists#
+ String sContinuedListId;
+ if ( !pNumRule )
+ {
+ pNumRule = GetDoc()->SearchNumRule( *GetCrsr()->GetPoint(),
+ false, bNum, false, 0,
+ sContinuedListId );
+ bContinueFoundNumRule = pNumRule != 0;
+ }
+ // <--
+
+ if (pNumRule)
+ {
+ SwNumRule aNumRule(*pNumRule);
+
+ // --> OD 2005-10-25 #b6340308#
+ // do not change found numbering/bullet rule, if it should only be continued.
+ if ( !bContinueFoundNumRule )
+ {
+ SwTxtNode * pTxtNode = GetCrsr()->GetPoint()->nNode.GetNode().GetTxtNode();
+
+ if (pTxtNode)
+ {
+ // --> OD 2005-10-26 #b6340308# - use above retrieve outline
+ // level, if outline numbering has to be activated.
+ int nLevel = bActivateOutlineRule ////#outline level,zhaojianwei,need more consideration
+ ? nActivateOutlineLvl
+ : pTxtNode->GetActualListLevel();
+ // <--
+
+ if (nLevel < 0)
+ nLevel = 0;
+
+ if (nLevel >= MAXLEVEL)
+ nLevel = MAXLEVEL - 1;
+
+ SwNumFmt aFmt(aNumRule.Get(static_cast<USHORT>(nLevel)));
+
+ if (bNum)
+ aFmt.SetNumberingType(SVX_NUM_ARABIC);
+ else
+ {
+ // --> OD 2008-06-03 #i63395#
+ // Only apply user defined default bullet font
+ if ( numfunc::IsDefBulletFontUserDefined() )
+ {
+ const Font* pFnt = &numfunc::GetDefBulletFont();
+ aFmt.SetBulletFont( pFnt );
+ }
+ // <--
+ aFmt.SetBulletChar( numfunc::GetBulletChar(static_cast<BYTE>(nLevel)));
+ aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
+ }
+ aNumRule.Set(static_cast<USHORT>(nLevel), aFmt);
+ }
+ }
+ // <--
+
+ // --> OD 2008-02-08 #newlistlevelattrs#
+ // reset indent attribute on applying list style
+ // --> OD 2008-03-27 #refactorlists#
+ SetCurNumRule( aNumRule, false, sContinuedListId, true );
+ // <--
+ }
+ else
+ {
+ // --> OD 2009-08-27 #i95907#
+ const SvxNumberFormat::SvxNumPositionAndSpaceMode ePosAndSpaceMode(
+ numfunc::GetDefaultPositionAndSpaceMode() );
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ SwNumRule aNumRule( GetUniqueNumRuleName(), ePosAndSpaceMode );
+ // <--
+ // <--
+ // Zeichenvorlage an die Numerierung haengen
+ SwCharFmt* pChrFmt;
+ SwDocShell* pDocSh = GetView().GetDocShell();
+ // --> OD 2008-06-03 #i63395#
+ // Only apply user defined default bullet font
+ const Font* pFnt = numfunc::IsDefBulletFontUserDefined()
+ ? &numfunc::GetDefBulletFont()
+ : 0;
+ // <--
+
+ if (bNum)
+ {
+ pChrFmt = GetCharFmtFromPool( RES_POOLCHR_NUM_LEVEL );
+ }
+ else
+ {
+ pChrFmt = GetCharFmtFromPool( RES_POOLCHR_BUL_LEVEL );
+ }
+
+ 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);
+ const bool bRightToLeft = IsInRightToLeftText();
+ for( BYTE nLvl = 0; nLvl < MAXLEVEL; ++nLvl )
+ {
+ SwNumFmt aFmt( aNumRule.Get( nLvl ) );
+ aFmt.SetCharFmt( pChrFmt );
+
+ if (! bNum)
+ {
+ // --> OD 2008-06-03 #i63395#
+ // Only apply user defined default bullet font
+ if ( pFnt )
+ {
+ aFmt.SetBulletFont( pFnt );
+ }
+ aFmt.SetBulletChar( numfunc::GetBulletChar(nLvl) );
+ aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
+ }
+
+ // --> OD 2009-08-26 #i95907#
+ if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ 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:
+ if ( bRightToLeft )
+ {
+ aFmt.SetNumAdjust( SVX_ADJUST_RIGHT );
+ }
+ // <--
+
+ aNumRule.Set( nLvl, aFmt );
+ }
+
+ // --> OD 2009-08-26 #i95907#
+ if ( pTxtNode &&
+ ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ // --> OD 2010-01-05 #b6884103#
+// short nTxtNodeFirstLineOffset( 0 );
+// pTxtNode->GetFirstLineOfsWithNum( nTxtNodeFirstLineOffset );
+// const SwTwips nTxtNodeIndent = pTxtNode->GetLeftMarginForTabCalculation() +
+// nTxtNodeFirstLineOffset;
+ const SwTwips nTxtNodeIndent = pTxtNode->GetAdditionalIndentForStartingNewList();
+ // <--
+ if ( ( nTxtNodeIndent + nWidthOfTabs ) != 0 )
+ {
+ // --> OD 2010-05-05 #i111172#
+ // If text node is already inside a list, assure that the indents
+ // are the same. Thus, adjust the indent change value by subtracting
+ // indents of to be applied list style.
+ SwTwips nIndentChange = nTxtNodeIndent + nWidthOfTabs;
+ if ( pTxtNode->GetNumRule() )
+ {
+ const SwNumFmt aFmt( aNumRule.Get( 0 ) );
+ if ( aFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ nIndentChange -= aFmt.GetIndentAt() + aFmt.GetFirstLineIndent();
+ }
+ }
+ // <--
+ aNumRule.ChangeIndent( nIndentChange );
+ }
+ }
+ // <--
+ // --> OD 2008-02-08 #newlistlevelattrs#
+ // reset indent attribute on applying list style
+ // --> OD 2008-03-17 #refactorlists#
+ // start new list
+ SetCurNumRule( aNumRule, true, String(), true );
+ // <--
+ }
+
+ EndUndo(UNDO_NUMORNONUM);
+}
+// <- #i40041#
+
+void SwWrtShell::NumOn()
+{
+ NumOrBulletOn(TRUE);
+}
+
+void SwWrtShell::NumOrBulletOff()
+{
+ const SwNumRule * pCurNumRule = GetCurNumRule();
+
+ if (pCurNumRule)
+ {
+ if (pCurNumRule->IsOutlineRule())
+ {
+ SwNumRule aNumRule(*pCurNumRule);
+
+ SwTxtNode * pTxtNode =
+ GetCrsr()->GetPoint()->nNode.GetNode().GetTxtNode();
+
+ if (pTxtNode)
+ {
+ sal_uInt16 nLevel = sal::static_int_cast<sal_uInt16, sal_Int32>(pTxtNode->GetActualListLevel());
+ SwNumFmt aFmt(aNumRule.Get(nLevel));
+
+ aFmt.SetNumberingType(SVX_NUM_NUMBER_NONE);
+ aNumRule.Set(nLevel, aFmt);
+
+ // --> OD 2008-03-17 #refactorlists#
+ // no start or continuation of a list - the outline style is only changed.
+ SetCurNumRule( aNumRule, false );
+ // <--
+ }
+ }
+ else
+ {
+ DelNumRules();
+ }
+
+ // --> OD 2005-10-24 #126346# - Cursor can not be anymore in front of
+ // a label, because numbering/bullet is switched off.
+ SetInFrontOfLabel( FALSE );
+ // <--
+ }
+}
+// <- #i29560#
+
+/*------------------------------------------------------------------------
+ Beschreibung: Default-Bulletliste erfragen
+------------------------------------------------------------------------*/
+
+void SwWrtShell::BulletOn()
+{
+ NumOrBulletOn(FALSE);
+}
+
+
+/*--------------------------------------------------
+
+--------------------------------------------------*/
+SelectionType SwWrtShell::GetSelectionType() const
+{
+ // ContentType kann nicht ermittelt werden innerhalb einer
+ // Start-/Endactionklammerung.
+ // Da es keinen ungueltigen Wert gibt, wird TEXT geliefert.
+ // Der Wert ist egal, da in EndAction ohnehin aktualisiert wird.
+
+ if ( BasicActionPend() )
+ return IsSelFrmMode() ? nsSelectionType::SEL_FRM : nsSelectionType::SEL_TXT;
+
+// if ( IsTableMode() )
+// return nsSelectionType::SEL_TBL | nsSelectionType::SEL_TBL_CELLS;
+
+ SwView &_rView = ((SwView&)GetView());
+ if (_rView.GetPostItMgr() && _rView.GetPostItMgr()->HasActiveSidebarWin() )
+ return nsSelectionType::SEL_POSTIT;
+ int nCnt;
+
+ // Rahmen einfuegen ist kein DrawMode
+ if ( !_rView.GetEditWin().IsFrmAction() &&
+ (IsObjSelected() || (_rView.IsDrawMode() && !IsFrmSelected()) ))
+ {
+ if (GetDrawView()->IsTextEdit())
+ nCnt = nsSelectionType::SEL_DRW_TXT;
+ else
+ {
+ if (GetView().IsFormMode()) // Nur Forms selektiert
+ nCnt = nsSelectionType::SEL_DRW_FORM;
+ else
+ nCnt = nsSelectionType::SEL_DRW; // Irgendein Draw-Objekt
+
+ if (_rView.IsBezierEditMode())
+ nCnt |= nsSelectionType::SEL_BEZ;
+ else if( GetDrawView()->GetContext() == SDRCONTEXT_MEDIA )
+ nCnt |= nsSelectionType::SEL_MEDIA;
+
+ if (svx::checkForSelectedCustomShapes(
+ const_cast<SdrView *>(GetDrawView()),
+ true /* bOnlyExtruded */ ))
+ {
+ nCnt |= nsSelectionType::SEL_EXTRUDED_CUSTOMSHAPE;
+ }
+ sal_uInt32 nCheckStatus = 0;
+ if (svx::checkForSelectedFontWork(
+ const_cast<SdrView *>(GetDrawView()), nCheckStatus ))
+ {
+ nCnt |= nsSelectionType::SEL_FONTWORK;
+ }
+ }
+
+ return nCnt;
+ }
+
+ nCnt = GetCntType();
+
+ if ( IsFrmSelected() )
+ {
+ if (_rView.IsDrawMode())
+ _rView.LeaveDrawCreate(); // Aufraeumen (Bug #45639)
+ if ( !(nCnt & (CNT_GRF | CNT_OLE)) )
+ return nsSelectionType::SEL_FRM;
+ }
+
+ if ( IsCrsrInTbl() )
+ nCnt |= nsSelectionType::SEL_TBL;
+
+ if ( IsTableMode() )
+ nCnt |= (nsSelectionType::SEL_TBL | nsSelectionType::SEL_TBL_CELLS);
+
+ // --> FME 2005-01-12 #i39855#
+ // Do not pop up numbering toolbar, if the text node has a numbering
+ // of type SVX_NUM_NUMBER_NONE.
+ const SwNumRule* pNumRule = GetCurNumRule();
+ if ( pNumRule )
+ {
+ const SwTxtNode* pTxtNd =
+ GetCrsr()->GetPoint()->nNode.GetNode().GetTxtNode();
+
+ // --> OD 2008-03-19 #refactorlists#
+ if ( pTxtNd && pTxtNd->IsInList() )
+ // <--
+ {
+ const SwNumFmt& rFmt = pNumRule->Get(sal::static_int_cast< sal_uInt8, sal_Int32>(pTxtNd->GetActualListLevel()));
+ if ( SVX_NUM_NUMBER_NONE != rFmt.GetNumberingType() )
+ nCnt |= nsSelectionType::SEL_NUM;
+ }
+ }
+ // <--
+
+ return nCnt;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Finden der TextCollection mit dem Name rCollname
+ Return: Pointer auf die Collection oder 0, wenn keine
+ TextCollection mit diesem Namen existiert oder
+ diese eine Defaultvorlage ist.
+------------------------------------------------------------------------*/
+
+
+SwTxtFmtColl *SwWrtShell::GetParaStyle(const String &rCollName, GetStyle eCreate )
+{
+ SwTxtFmtColl* pColl = FindTxtFmtCollByName( rCollName );
+ if( !pColl && GETSTYLE_NOCREATE != eCreate )
+ {
+ USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName( rCollName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ if( USHRT_MAX != nId || GETSTYLE_CREATEANY == eCreate )
+ pColl = GetTxtCollFromPool( nId );
+ }
+ return pColl;
+}
+/*------------------------------------------------------------------------
+ Beschreibung: Finden der Zeichenvorlage mit dem Name rCollname
+ Return: Pointer auf die Collection oder 0, wenn keine
+ Zeichenvorlage mit diesem Namen existiert oder
+ diese eine Defaultvorlage oder automatische Vorlage ist.
+------------------------------------------------------------------------*/
+
+
+
+SwCharFmt *SwWrtShell::GetCharStyle(const String &rFmtName, GetStyle eCreate )
+{
+ SwCharFmt* pFmt = FindCharFmtByName( rFmtName );
+ if( !pFmt && GETSTYLE_NOCREATE != eCreate )
+ {
+ USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName( rFmtName, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT );
+ if( USHRT_MAX != nId || GETSTYLE_CREATEANY == eCreate )
+ pFmt = (SwCharFmt*)GetFmtFromPool( nId );
+ }
+ return pFmt;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Finden des Tabellenformates mit dem Name rFmtname
+ Return: Pointer auf das Format oder 0, wenn kein
+ Rahmenformat mit diesem Namen existiert oder
+ dieses eine Defaultformat oder automatisches Format ist.
+------------------------------------------------------------------------*/
+
+
+
+SwFrmFmt *SwWrtShell::GetTblStyle(const String &rFmtName)
+{
+ SwFrmFmt *pFmt = 0;
+ for( USHORT i = GetTblFrmFmtCount(); i; )
+ if( !( pFmt = &GetTblFrmFmt( --i ) )->IsDefault() &&
+ pFmt->GetName() == rFmtName && IsUsed( *pFmt ) )
+ return pFmt;
+ return 0;
+}
+
+
+/*------------------------------------------------------------------------
+ Beschreibung: Anwenden der Vorlagen
+------------------------------------------------------------------------*/
+
+
+
+void SwWrtShell::SetPageStyle(const String &rCollName)
+{
+ if( !SwCrsrShell::HasSelection() && !IsSelFrmMode() && !IsObjSelected() )
+ {
+ SwPageDesc* pDesc = FindPageDescByName( rCollName, TRUE );
+ if( pDesc )
+ ChgCurPageDesc( *pDesc );
+ }
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Zugriff Vorlagen
+------------------------------------------------------------------------*/
+
+
+
+String SwWrtShell::GetCurPageStyle( const BOOL bCalcFrm ) const
+{
+ return GetPageDesc(GetCurPageDesc( bCalcFrm )).GetName();
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Aktuelle Vorlage anhand der geltenden Attribute aendern
+------------------------------------------------------------------------*/
+
+
+void SwWrtShell::QuickUpdateStyle()
+{
+ SwTxtFmtColl *pColl = GetCurTxtFmtColl();
+
+ // Standard kann nicht geaendert werden
+ if(pColl && !pColl->IsDefault())
+ {
+ FillByEx(pColl);
+ // Vorlage auch anwenden, um harte Attributierung
+ // zu entfernen
+ SetTxtFmtColl(pColl);
+ }
+}
+
+
+void SwWrtShell::AutoUpdatePara(SwTxtFmtColl* pColl, const SfxItemSet& rStyleSet)
+{
+ SfxItemSet aCoreSet( GetAttrPool(),
+ RES_CHRATR_BEGIN, RES_CHRATR_END - 1,
+ RES_PARATR_BEGIN, RES_PARATR_END - 1,
+ RES_FRMATR_BEGIN, RES_FRMATR_END - 1,
+ SID_ATTR_TABSTOP_POS, SID_ATTR_TABSTOP_POS,
+ SID_ATTR_TABSTOP_DEFAULTS, SID_ATTR_TABSTOP_DEFAULTS,
+ SID_ATTR_TABSTOP_OFFSET, SID_ATTR_TABSTOP_OFFSET,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
+ SID_ATTR_PARA_MODEL, SID_ATTR_PARA_KEEP,
+ SID_ATTR_PARA_PAGENUM, SID_ATTR_PARA_PAGENUM,
+ 0 );
+ GetCurAttr( aCoreSet );
+ BOOL bReset = FALSE;
+ SfxItemIter aParaIter( aCoreSet );
+ const SfxPoolItem* pParaItem = aParaIter.FirstItem();
+ while( pParaItem )
+ {
+ if(!IsInvalidItem(pParaItem))
+ {
+ USHORT nWhich = pParaItem->Which();
+ if(SFX_ITEM_SET == aCoreSet.GetItemState(nWhich) &&
+ SFX_ITEM_SET == rStyleSet.GetItemState(nWhich))
+ {
+ aCoreSet.ClearItem(nWhich);
+ bReset = TRUE;
+ }
+ }
+ pParaItem = aParaIter.NextItem();
+ }
+ StartAction();
+ if(bReset)
+ {
+ ResetAttr();
+ SetAttr(aCoreSet);
+ }
+ pDoc->ChgFmt(*pColl, rStyleSet );
+ EndAction();
+}
+
+/*-----------------12.03.97 12.24-------------------
+
+--------------------------------------------------*/
+
+void SwWrtShell::AutoUpdateFrame( SwFrmFmt* pFmt, const SfxItemSet& rStyleSet )
+{
+ StartAction();
+
+ ResetFlyFrmAttr( 0, &rStyleSet );
+ pFmt->SetFmtAttr( rStyleSet );
+
+ EndAction();
+}
+
+
+void SwWrtShell::AutoCorrect( SvxAutoCorrect& rACorr, sal_Unicode cChar )
+{
+ ResetCursorStack();
+ if(_CanInsert())
+ {
+ BOOL bStarted = FALSE;
+ if(HasSelection())
+ {
+ // nur hier klammern, da das normale Insert schon an der
+ // Editshell geklammert ist
+ StartAllAction();
+ StartUndo(UNDO_INSERT);
+ bStarted = TRUE;
+ DelRight();
+ }
+ SwEditShell::AutoCorrect( rACorr, IsInsMode(), cChar );
+
+ if(bStarted)
+ {
+ EndAllAction();
+ EndUndo(UNDO_INSERT);
+ }
+ }
+}
+
+
+/*
+ * eine Art kontrollierter copy ctor
+ */
+
+SwWrtShell::SwWrtShell( SwWrtShell& rSh, Window *_pWin, SwView &rShell )
+ : SwFEShell( rSh, _pWin ),
+ COMMON_INI_LIST
+{
+ BITFLD_INI_LIST
+ SET_CURR_SHELL( this );
+
+ SetSfxViewShell( (SfxViewShell *)&rShell );
+ SetFlyMacroLnk( LINK(this, SwWrtShell, ExecFlyMac) );
+
+ // place the cursor on the first field...
+ IFieldmark *pBM = NULL;
+ if ( IsFormProtected() && ( pBM = GetFieldmarkAfter( ) ) !=NULL ) {
+ GotoFieldmark(pBM);
+ }
+}
+
+
+SwWrtShell::SwWrtShell( SwDoc& rDoc, Window *_pWin, SwView &rShell,
+ const SwViewOption *pViewOpt )
+ : SwFEShell( rDoc, _pWin, pViewOpt),
+ COMMON_INI_LIST
+{
+ BITFLD_INI_LIST
+ SET_CURR_SHELL( this );
+ SetSfxViewShell( (SfxViewShell *)&rShell );
+ SetFlyMacroLnk( LINK(this, SwWrtShell, ExecFlyMac) );
+}
+
+/*
+ * ctor
+ */
+
+
+
+SwWrtShell::~SwWrtShell()
+{
+ SET_CURR_SHELL( this );
+ while(IsModePushed())
+ PopMode();
+ while(PopCrsr(FALSE))
+ ;
+ SwTransferable::ClearSelection( *this );
+}
+
+BOOL SwWrtShell::Pop( BOOL bOldCrsr )
+{
+ BOOL bRet = SwCrsrShell::Pop( bOldCrsr );
+ if( bRet && IsSelection() )
+ {
+ fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
+ fnKillSel = &SwWrtShell::ResetSelect;
+ }
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+BOOL SwWrtShell::CanInsert()
+{
+ return (!(IsSelFrmMode() | IsObjSelected() | (GetView().GetDrawFuncPtr() != NULL) | (GetView().GetPostItMgr()->GetActiveSidebarWin()!= NULL)));
+}
+
+// die Core erzeugt eine Selektion, das SttSelect muss gerufen werden
+void SwWrtShell::NewCoreSelection()
+{
+ SttSelect();
+}
+
+// --------------
+void SwWrtShell::ChgDBData(const SwDBData& aDBData)
+{
+ SwEditShell::ChgDBData(aDBData);
+ //notify the db-beamer if available
+ GetView().NotifyDBChanged();
+}
+
+String SwWrtShell::GetSelDescr() const
+{
+ String aResult;
+
+ int nSelType = GetSelectionType();
+ switch (nSelType)
+ {
+ case nsSelectionType::SEL_GRF:
+ aResult = SW_RES(STR_GRAPHIC);
+
+ break;
+ case nsSelectionType::SEL_FRM:
+ {
+ const SwFrmFmt * pFrmFmt = GetCurFrmFmt();
+
+ if (pFrmFmt)
+ aResult = pFrmFmt->GetDescription();
+ }
+ break;
+ case nsSelectionType::SEL_DRW:
+ {
+ aResult = SW_RES(STR_DRAWING_OBJECTS);
+ }
+ break;
+ default:
+ if (0 != pDoc)
+ aResult = GetCrsrDescr();
+ }
+
+ return aResult;
+}
diff --git a/sw/source/ui/wrtsh/wrtsh2.cxx b/sw/source/ui/wrtsh/wrtsh2.cxx
new file mode 100644
index 000000000000..17af61be8bad
--- /dev/null
+++ b/sw/source/ui/wrtsh/wrtsh2.cxx
@@ -0,0 +1,498 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * 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.
+ *
+ * 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).
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <hintids.hxx> // define ITEMIDs
+#include <svl/macitem.hxx>
+#include <sfx2/frame.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/urihelper.hxx>
+#include <svl/eitem.hxx>
+#include <svl/stritem.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/linkmgr.hxx>
+#include <fmtinfmt.hxx>
+#include <frmatr.hxx>
+#include <swtypes.hxx> // SET_CURR_SHELL
+#include <wrtsh.hxx>
+#include <docsh.hxx>
+#include <fldbas.hxx> // Felder
+#include <expfld.hxx>
+#include <ddefld.hxx>
+#include <docufld.hxx>
+#include <reffld.hxx>
+#include <swundo.hxx>
+#include <doc.hxx>
+#include <viewopt.hxx> // SwViewOptions
+#include <frmfmt.hxx> // fuer UpdateTable
+#include <swtable.hxx> // fuer UpdateTable
+#include <mdiexp.hxx>
+#include <view.hxx>
+#include <swevent.hxx>
+#include <poolfmt.hxx>
+#include <section.hxx>
+#include <navicont.hxx>
+#include <navipi.hxx>
+#include <crsskip.hxx>
+#include <txtinet.hxx>
+#include <cmdid.h>
+#include <wrtsh.hrc>
+#include "swabstdlg.hxx"
+#include "fldui.hrc"
+
+#include <undobj.hxx>
+
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+void SwWrtShell::Insert(SwField &rFld)
+{
+ ResetCursorStack();
+ if(!_CanInsert())
+ return;
+ StartAllAction();
+
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UNDO_ARG1, rFld.GetDescription());
+
+ StartUndo(UNDO_INSERT, &aRewriter);
+
+ bool bDeleted = false;
+ if( HasSelection() )
+ {
+ bDeleted = DelRight() != 0;
+ }
+
+ SwEditShell::Insert2(rFld, bDeleted);
+ EndUndo(UNDO_INSERT);
+ EndAllAction();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Felder Update anschmeissen
+ --------------------------------------------------------------------*/
+
+
+
+void SwWrtShell::UpdateInputFlds( SwInputFieldList* pLst, BOOL bOnlyInSel )
+{
+ // ueber die Liste der Eingabefelder gehen und Updaten
+ SwInputFieldList* pTmp = pLst;
+ if( !pTmp )
+ pTmp = new SwInputFieldList( this );
+
+ if (bOnlyInSel)
+ pTmp->RemoveUnselectedFlds();
+
+ const USHORT nCnt = pTmp->Count();
+ if(nCnt)
+ {
+ pTmp->PushCrsr();
+
+ BOOL bCancel = FALSE;
+ ByteString aDlgPos;
+ for( USHORT i = 0; i < nCnt && !bCancel; ++i )
+ {
+ pTmp->GotoFieldPos( i );
+ SwField* pField = pTmp->GetField( i );
+ if(pField->GetTyp()->Which() == RES_DROPDOWN)
+ bCancel = StartDropDownFldDlg( pField, TRUE, &aDlgPos );
+ else
+ bCancel = StartInputFldDlg( pField, TRUE, 0, &aDlgPos);
+
+ // Sonst Updatefehler bei Multiselektion:
+ pTmp->GetField( i )->GetTyp()->UpdateFlds();
+ }
+ pTmp->PopCrsr();
+ }
+
+ if( !pLst )
+ delete pTmp;
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: EingabeDialog fuer ein bestimmtes Feld starten
+ --------------------------------------------------------------------*/
+
+
+
+BOOL SwWrtShell::StartInputFldDlg( SwField* pFld, BOOL bNextButton,
+ Window* pParentWin, ByteString* pWindowState )
+{
+//JP 14.08.96: Bug 30332 - nach Umbau der modularietaet im SFX, muss jetzt
+// das TopWindow der Application benutzt werden.
+// SwFldInputDlg* pDlg = new SwFldInputDlg( GetWin(), *this, pFld );
+
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ AbstractFldInputDlg* pDlg = pFact->CreateFldInputDlg( DLG_FLD_INPUT,
+ pParentWin, *this, pFld, bNextButton);
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if(pWindowState && pWindowState->Len())
+ pDlg->SetWindowState(*pWindowState);
+ BOOL bRet = RET_CANCEL == pDlg->Execute();
+ if(pWindowState)
+ *pWindowState = pDlg->GetWindowState();
+
+ delete pDlg;
+ GetWin()->Update();
+ return bRet;
+}
+/* -----------------17.06.2003 10:18-----------------
+
+ --------------------------------------------------*/
+BOOL SwWrtShell::StartDropDownFldDlg(SwField* pFld, BOOL bNextButton, ByteString* pWindowState)
+{
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ AbstractDropDownFieldDialog* pDlg = pFact->CreateDropDownFieldDialog( NULL, *this, pFld, DLG_FLD_DROPDOWN ,bNextButton );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if(pWindowState && pWindowState->Len())
+ pDlg->SetWindowState(*pWindowState);
+ USHORT nRet = pDlg->Execute();
+ if(pWindowState)
+ *pWindowState = pDlg->GetWindowState();
+ delete pDlg;
+ BOOL bRet = RET_CANCEL == nRet;
+ GetWin()->Update();
+ if(RET_YES == nRet)
+ {
+ GetView().GetViewFrame()->GetDispatcher()->Execute(FN_EDIT_FIELD, SFX_CALLMODE_SYNCHRON);
+ }
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Verzeichnis einfuegen Selektion loeschen
+ --------------------------------------------------------------------*/
+
+
+
+void SwWrtShell::InsertTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet)
+{
+ if(!_CanInsert())
+ return;
+
+ if(HasSelection())
+ DelRight();
+
+ SwEditShell::InsertTableOf(rTOX, pSet);
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Verzeichnis Updaten Selektion loeschen
+ --------------------------------------------------------------------*/
+
+BOOL SwWrtShell::UpdateTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet)
+{
+ BOOL bResult = FALSE;
+
+ if(_CanInsert())
+ {
+ bResult = SwEditShell::UpdateTableOf(rTOX, pSet);
+
+ if (pSet == NULL)
+ {
+ SwDoc * _pDoc = GetDoc();
+
+ if (_pDoc != NULL)
+ _pDoc->DelAllUndoObj();
+ }
+ }
+
+ return bResult;
+}
+
+BOOL SwWrtShell::UpdateField( sw::mark::IFieldmark &fieldBM )
+{
+ return SwEditShell::UpdateField(fieldBM);
+}
+
+
+
+ // ein Klick aus das angegebene Feld. Der Cursor steht auf diesem.
+ // Fuehre die vor definierten Aktionen aus.
+
+
+void SwWrtShell::ClickToField( const SwField& rFld )
+{
+ bIsInClickToEdit = TRUE;
+ switch( rFld.GetTyp()->Which() )
+ {
+ case RES_JUMPEDITFLD:
+ {
+ USHORT nSlotId = 0;
+ switch( rFld.GetFormat() )
+ {
+ case JE_FMT_TABLE:
+ nSlotId = FN_INSERT_TABLE;
+ break;
+
+ case JE_FMT_FRAME:
+ nSlotId = FN_INSERT_FRAME;
+ break;
+
+ case JE_FMT_GRAPHIC: nSlotId = SID_INSERT_GRAPHIC; break;
+ case JE_FMT_OLE: nSlotId = SID_INSERT_OBJECT; break;
+
+// case JE_FMT_TEXT:
+ }
+
+ Right( CRSR_SKIP_CHARS, TRUE, 1, FALSE ); // Feld selektieren
+
+ if( nSlotId )
+ {
+ StartUndo( UNDO_START );
+ //#97295# immediately select the right shell
+ GetView().StopShellTimer();
+ GetView().GetViewFrame()->GetDispatcher()->Execute( nSlotId,
+ SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD );
+ EndUndo( UNDO_END );
+ }
+ }
+ break;
+
+ case RES_MACROFLD:
+ {
+ const SwMacroField *pFld = (const SwMacroField*)&rFld;
+ String sText( rFld.GetPar2() );
+ String sRet( sText );
+ ExecMacro( pFld->GetSvxMacro(), &sRet );
+
+ // return Wert veraendert?
+ if( sRet != sText )
+ {
+ StartAllAction();
+ ((SwField&)rFld).SetPar2( sRet );
+ ((SwField&)rFld).GetTyp()->UpdateFlds();
+ EndAllAction();
+ }
+ }
+ break;
+
+ case RES_GETREFFLD:
+ StartAllAction();
+ SwCrsrShell::GotoRefMark( ((SwGetRefField&)rFld).GetSetRefName(),
+ ((SwGetRefField&)rFld).GetSubType(),
+ ((SwGetRefField&)rFld).GetSeqNo() );
+ EndAllAction();
+ break;
+
+ case RES_INPUTFLD:
+ StartInputFldDlg( (SwField*)&rFld, FALSE );
+ break;
+
+ case RES_SETEXPFLD:
+ if( ((SwSetExpField&)rFld).GetInputFlag() )
+ StartInputFldDlg( (SwField*)&rFld, FALSE );
+ break;
+ case RES_DROPDOWN :
+ StartDropDownFldDlg( (SwField*)&rFld, FALSE );
+ break;
+ }
+
+ bIsInClickToEdit = FALSE;
+}
+
+
+
+void SwWrtShell::ClickToINetAttr( const SwFmtINetFmt& rItem, USHORT nFilter )
+{
+ if( !rItem.GetValue().Len() )
+ return ;
+
+ bIsInClickToEdit = TRUE;
+
+ // erstmal das evt. gesetzte ObjectSelect Macro ausfuehren
+ const SvxMacro* pMac = rItem.GetMacro( SFX_EVENT_MOUSECLICK_OBJECT );
+ if( pMac )
+ {
+ SwCallMouseEvent aCallEvent;
+ aCallEvent.Set( &rItem );
+ GetDoc()->CallEvent( SFX_EVENT_MOUSECLICK_OBJECT, aCallEvent, FALSE );
+ }
+
+ // damit die Vorlagenumsetzung sofort angezeigt wird
+ ::LoadURL( rItem.GetValue(), this, nFilter, &rItem.GetTargetFrame() );
+ const SwTxtINetFmt* pTxtAttr = rItem.GetTxtINetFmt();
+ if( pTxtAttr )
+ {
+ const_cast<SwTxtINetFmt*>(pTxtAttr)->SetVisited( true );
+ const_cast<SwTxtINetFmt*>(pTxtAttr)->SetVisitedValid( true );
+ }
+
+ bIsInClickToEdit = FALSE;
+}
+
+
+
+BOOL SwWrtShell::ClickToINetGrf( const Point& rDocPt, USHORT nFilter )
+{
+ BOOL bRet = FALSE;
+ String sURL;
+ String sTargetFrameName;
+ const SwFrmFmt* pFnd = IsURLGrfAtPos( rDocPt, &sURL, &sTargetFrameName );
+ if( pFnd && sURL.Len() )
+ {
+ bRet = TRUE;
+ // erstmal das evt. gesetzte ObjectSelect Macro ausfuehren
+ const SvxMacro* pMac = &pFnd->GetMacro().GetMacro( SFX_EVENT_MOUSECLICK_OBJECT );
+ if( pMac )
+ {
+ SwCallMouseEvent aCallEvent;
+ aCallEvent.Set( EVENT_OBJECT_URLITEM, pFnd );
+ GetDoc()->CallEvent( SFX_EVENT_MOUSECLICK_OBJECT, aCallEvent, FALSE );
+ }
+
+ ::LoadURL( sURL, this, nFilter, &sTargetFrameName);
+ }
+ return bRet;
+}
+
+
+void LoadURL( const String& rURL, ViewShell* pVSh, USHORT nFilter,
+ const String *pTargetFrameName )
+{
+ ASSERT( rURL.Len() && pVSh, "was soll hier geladen werden?" );
+ if( !rURL.Len() || !pVSh )
+ return ;
+
+ // die Shell kann auch 0 sein !!!!!
+ SwWrtShell *pSh = 0;
+ if ( pVSh && pVSh->ISA(SwCrsrShell) )
+ {
+ //Eine CrsrShell ist auch immer eine WrtShell
+ pSh = (SwWrtShell*)pVSh;
+ }
+ else
+ return;
+
+ SwDocShell* pDShell = pSh->GetView().GetDocShell();
+ DBG_ASSERT( pDShell, "No DocShell?!");
+ String sTargetFrame;
+ if( pTargetFrameName && pTargetFrameName->Len() )
+ sTargetFrame = *pTargetFrameName;
+ else if( pDShell ) {
+ using namespace ::com::sun::star;
+ uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
+ pDShell->GetModel(), uno::UNO_QUERY_THROW);
+ uno::Reference<document::XDocumentProperties> xDocProps
+ = xDPS->getDocumentProperties();
+ sTargetFrame = xDocProps->getDefaultTarget();
+ }
+
+ String sReferer;
+ if( pDShell && pDShell->GetMedium() )
+ sReferer = pDShell->GetMedium()->GetName();
+ SfxViewFrame* pViewFrm = pSh->GetView().GetViewFrame();
+ SfxFrameItem aView( SID_DOCFRAME, pViewFrm );
+ SfxStringItem aName( SID_FILE_NAME, rURL );
+ SfxStringItem aTargetFrameName( SID_TARGETNAME, sTargetFrame );
+ SfxStringItem aReferer( SID_REFERER, sReferer );
+
+ SfxBoolItem aNewView( SID_OPEN_NEW_VIEW, FALSE );
+ //#39076# Silent kann lt. SFX entfernt werden.
+// SfxBoolItem aSilent( SID_SILENT, TRUE );
+ SfxBoolItem aBrowse( SID_BROWSE, TRUE );
+
+ if( nFilter & URLLOAD_NEWVIEW )
+ aTargetFrameName.SetValue( String::CreateFromAscii("_blank") );
+
+ const SfxPoolItem* aArr[] = {
+ &aName,
+ &aNewView, /*&aSilent,*/
+ &aReferer,
+ &aView, &aTargetFrameName,
+ &aBrowse,
+ 0L
+ };
+
+ pViewFrm->GetDispatcher()->GetBindings()->Execute( SID_OPENDOC, aArr,
+ SFX_CALLMODE_ASYNCHRON|SFX_CALLMODE_RECORD );
+}
+
+void SwWrtShell::NavigatorPaste( const NaviContentBookmark& rBkmk,
+ const USHORT nAction )
+{
+ if( EXCHG_IN_ACTION_COPY == nAction )
+ {
+ // Einfuegen
+ String sURL = rBkmk.GetURL();
+ //handelt es sich um ein Sprung innerhalb des akt. Docs?
+ const SwDocShell* pDocShell = GetView().GetDocShell();
+ if(pDocShell->HasName())
+ {
+ const String rName = pDocShell->GetMedium()->GetURLObject().GetURLNoMark();
+
+ if(COMPARE_EQUAL == sURL.CompareTo(rName, rName.Len()))
+ sURL.Erase(0, rName.Len());
+ }
+ SwFmtINetFmt aFmt( sURL, aEmptyStr );
+ InsertURL( aFmt, rBkmk.GetDescription() );
+ }
+ else
+ {
+ SwSectionData aSection( FILE_LINK_SECTION, GetUniqueSectionName( 0 ) );
+ String aLinkFile( rBkmk.GetURL().GetToken(0, '#') );
+ aLinkFile += sfx2::cTokenSeperator;
+ aLinkFile += sfx2::cTokenSeperator;
+ aLinkFile += rBkmk.GetURL().GetToken(1, '#');
+ aSection.SetLinkFileName( aLinkFile );
+ aSection.SetProtectFlag( true );
+ const SwSection* pIns = InsertSection( aSection );
+ if( EXCHG_IN_ACTION_MOVE == nAction && pIns )
+ {
+ aSection = SwSectionData(*pIns);
+ aSection.SetLinkFileName( aEmptyStr );
+ aSection.SetType( CONTENT_SECTION );
+ aSection.SetProtectFlag( false );
+
+ // the update of content from linked section at time delete
+ // the undostack. Then the change of the section dont create
+ // any undoobject. - BUG 69145
+ BOOL bDoesUndo = DoesUndo();
+ if( UNDO_INSSECTION != GetUndoIds() )
+ DoUndo( FALSE );
+ UpdateSection( GetSectionFmtPos( *pIns->GetFmt() ), aSection );
+ DoUndo( bDoesUndo );
+ }
+ }
+}
+
+
diff --git a/sw/source/ui/wrtsh/wrtsh3.cxx b/sw/source/ui/wrtsh/wrtsh3.cxx
new file mode 100644
index 000000000000..460d89a07a1c
--- /dev/null
+++ b/sw/source/ui/wrtsh/wrtsh3.cxx
@@ -0,0 +1,247 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * 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.
+ *
+ * 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).
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#ifndef _SVX_SVXIDS_HRC //autogen
+#include <svx/svxids.hrc>
+#endif
+#include <sfx2/app.hxx>
+#include <sfx2/childwin.hxx>
+#include <sfx2/bindings.hxx>
+#include <svx/svdmark.hxx>
+#include <svx/svdview.hxx>
+#include <svx/fmglob.hxx>
+#include <svx/svdouno.hxx>
+#include <com/sun/star/form/FormButtonType.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <svx/htmlmode.hxx>
+#include <tools/urlobj.hxx>
+#include "wrtsh.hxx"
+#include "view.hxx"
+#include "IMark.hxx"
+#include "doc.hxx"
+#include "wrtsh.hrc"
+
+#include <unomid.h>
+
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+extern sal_Bool bNoInterrupt; // in mainwn.cxx
+
+BOOL SwWrtShell::MoveBookMark( BookMarkMove eFuncId, const ::sw::mark::IMark* const pMark)
+{
+//JP 08.03.96: die Wizards brauchen die Selektion !!
+// EndSelect();
+ (this->*fnKillSel)( 0, sal_False );
+
+ BOOL bRet = sal_True;
+ switch(eFuncId)
+ {
+ case BOOKMARK_INDEX:bRet = SwCrsrShell::GotoMark( pMark );break;
+ case BOOKMARK_NEXT: bRet = SwCrsrShell::GoNextBookmark();break;
+ case BOOKMARK_PREV: bRet = SwCrsrShell::GoPrevBookmark();break;
+ default:;//prevent warning
+ }
+
+ if( bRet && IsSelFrmMode() )
+ {
+ UnSelectFrm();
+ LeaveSelFrmMode();
+ }
+ if( IsSelection() )
+ {
+ fnKillSel = &SwWrtShell::ResetSelect;
+ fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
+ }
+ return bRet;
+}
+
+BOOL SwWrtShell::GotoField( const SwFmtFld& rFld )
+{
+ (this->*fnKillSel)( 0, sal_False );
+
+ BOOL bRet = SwCrsrShell::GotoFld( rFld );
+ if( bRet && IsSelFrmMode() )
+ {
+ UnSelectFrm();
+ LeaveSelFrmMode();
+ }
+
+ if( IsSelection() )
+ {
+ fnKillSel = &SwWrtShell::ResetSelect;
+ fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
+ }
+
+ return bRet;
+}
+
+bool SwWrtShell::GotoFieldmark(::sw::mark::IFieldmark const * const pMark)
+{
+ (this->*fnKillSel)( 0, sal_False );
+ bool bRet = SwCrsrShell::GotoFieldmark(pMark);
+ if( bRet && IsSelFrmMode() )
+ {
+ UnSelectFrm();
+ LeaveSelFrmMode();
+ }
+ if( IsSelection() )
+ {
+ fnKillSel = &SwWrtShell::ResetSelect;
+ fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
+ }
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: FontWork-Slots invalidieren
+ --------------------------------------------------------------------*/
+
+
+void SwWrtShell::DrawSelChanged( )
+{
+ static sal_uInt16 __READONLY_DATA aInval[] =
+ {
+ SID_ATTR_FILL_STYLE, SID_ATTR_FILL_COLOR, SID_ATTR_LINE_STYLE,
+ SID_ATTR_LINE_WIDTH, SID_ATTR_LINE_COLOR, 0
+ };
+
+ GetView().GetViewFrame()->GetBindings().Invalidate(aInval);
+
+ sal_Bool bOldVal = bNoInterrupt;
+ bNoInterrupt = sal_True; // Trick, um AttrChangedNotify ueber Timer auszufuehren
+ GetView().AttrChangedNotify(this);
+ bNoInterrupt = bOldVal;
+}
+
+BOOL SwWrtShell::GotoMark( const ::rtl::OUString& rName )
+{
+ IDocumentMarkAccess::const_iterator_t ppMark = getIDocumentMarkAccess()->findMark( rName );
+ if(ppMark == getIDocumentMarkAccess()->getMarksEnd()) return false;
+ return MoveBookMark( BOOKMARK_INDEX, ppMark->get() );
+}
+
+
+BOOL SwWrtShell::GotoMark( const ::sw::mark::IMark* const pMark )
+{
+ return MoveBookMark( BOOKMARK_INDEX, pMark );
+}
+
+
+BOOL SwWrtShell::GoNextBookmark()
+{
+ return MoveBookMark( BOOKMARK_NEXT );
+}
+
+
+BOOL SwWrtShell::GoPrevBookmark()
+{
+ return MoveBookMark( BOOKMARK_PREV );
+}
+
+
+void SwWrtShell::ExecMacro( const SvxMacro& rMacro, String* pRet, SbxArray* pArgs )
+{
+ // OD 11.02.2003 #100556# - execute macro, if it is allowed.
+ if ( IsMacroExecAllowed() )
+ {
+ GetDoc()->ExecMacro( rMacro, pRet, pArgs );
+ }
+}
+
+
+sal_uInt16 SwWrtShell::CallEvent( sal_uInt16 nEvent, const SwCallMouseEvent& rCallEvent,
+ sal_Bool bChkPtr, SbxArray* pArgs,
+ const Link* pCallBack )
+{
+ return GetDoc()->CallEvent( nEvent, rCallEvent, bChkPtr, pArgs, pCallBack );
+}
+
+
+ // fall ein util::URL-Button selektiert ist, dessen util::URL returnen, ansonsten
+ // einen LeerString
+sal_Bool SwWrtShell::GetURLFromButton( String& rURL, String& rDescr ) const
+{
+ sal_Bool bRet = sal_False;
+ const SdrView *pDView = GetDrawView();
+ if( pDView )
+ {
+ // Ein Fly ist genau dann erreichbar, wenn er selektiert ist.
+ const SdrMarkList &rMarkList = pDView->GetMarkedObjectList();
+
+ if (rMarkList.GetMark(0))
+ {
+ SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, rMarkList.GetMark(0)->GetMarkedSdrObj());
+ if (pUnoCtrl && FmFormInventor == pUnoCtrl->GetObjInventor())
+ {
+ uno::Reference< awt::XControlModel > xControlModel = pUnoCtrl->GetUnoControlModel();
+
+ ASSERT( xControlModel.is(), "UNO-Control ohne Model" );
+ if( !xControlModel.is() )
+ return bRet;
+
+ uno::Reference< beans::XPropertySet > xPropSet(xControlModel, uno::UNO_QUERY);
+
+ uno::Any aTmp;
+
+ form::FormButtonType eButtonType = form::FormButtonType_URL;
+ uno::Reference< beans::XPropertySetInfo > xInfo = xPropSet->getPropertySetInfo();
+ if(xInfo->hasPropertyByName( C2U("ButtonType") ))
+ {
+ aTmp = xPropSet->getPropertyValue( C2U("ButtonType") );
+ form::FormButtonType eTmpButtonType;
+ aTmp >>= eTmpButtonType;
+ if( eButtonType == eTmpButtonType)
+ {
+ // Label
+ aTmp = xPropSet->getPropertyValue( C2U("Label") );
+ OUString uTmp;
+ if( (aTmp >>= uTmp) && uTmp.getLength())
+ {
+ rDescr = String(uTmp);
+ }
+
+ // util::URL
+ aTmp = xPropSet->getPropertyValue( C2U("TargetURL") );
+ if( (aTmp >>= uTmp) && uTmp.getLength())
+ {
+ rURL = String(uTmp);
+ }
+ bRet = sal_True;
+ }
+ }
+ }
+ }
+ }
+
+ return bRet;
+}
diff --git a/sw/source/ui/wrtsh/wrtsh4.cxx b/sw/source/ui/wrtsh/wrtsh4.cxx
new file mode 100644
index 000000000000..541674e912a3
--- /dev/null
+++ b/sw/source/ui/wrtsh/wrtsh4.cxx
@@ -0,0 +1,300 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * 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.
+ *
+ * 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).
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <wrtsh.hxx>
+#include <crsskip.hxx>
+
+
+/*
+* private Methoden, die den Cursor ueber Suchen bewegen. Das
+* Aufheben der Selektion muss auf der Ebene darueber erfolgen.
+*/
+
+/*
+* Der Anfang eines Wortes ist das Folgen eines nicht-
+* Trennzeichens auf Trennzeichen. Ferner das Folgen von
+* nicht-Satztrennern auf Satztrenner. Der Absatzanfang ist
+* ebenfalls Wortanfang.
+*/
+
+
+BOOL SwWrtShell::_SttWrd()
+{
+ if ( IsSttPara() )
+ return 1;
+ /*
+ * temporaeren Cursor ohne Selektion erzeugen
+ */
+ Push();
+ ClearMark();
+ if( !GoStartWord() )
+ // nicht gefunden --> an den Absatzanfang
+ SwCrsrShell::MovePara( fnParaCurr, fnParaStart );
+ ClearMark();
+ // falls vorher Mark gesetzt war, zusammenfassen
+ Combine();
+ return 1;
+}
+/*
+ * Das Ende eines Wortes ist das Folgen von Trennzeichen auf
+ * nicht-Trennzeichen. Unter dem Ende eines Wortes wird
+ * ebenfalls die Folge von Worttrennzeichen auf Interpunktions-
+ * zeichen verstanden. Das Absatzende ist ebenfalls Wortende.
+ */
+
+
+
+BOOL SwWrtShell::_EndWrd()
+{
+ if ( IsEndWrd() )
+ return 1;
+ // temporaeren Cursor ohne Selektion erzeugen
+ Push();
+ ClearMark();
+ if( !GoEndWord() )
+ // nicht gefunden --> an das Absatz Ende
+ SwCrsrShell::MovePara(fnParaCurr, fnParaEnd);
+ ClearMark();
+ // falls vorher Mark gesetzt war, zusammenfassen
+ Combine();
+ return 1;
+}
+
+
+
+BOOL SwWrtShell::_NxtWrd()
+{
+ BOOL bRet = FALSE;
+ while( IsEndPara() ) // wenn schon am Ende, dann naechsten ???
+ {
+ if(!SwCrsrShell::Right(1,CRSR_SKIP_CHARS)) // Document - Ende ??
+ {
+ Pop( FALSE );
+ return bRet;
+ }
+ bRet = IsStartWord();
+ }
+ Push();
+ ClearMark();
+ while( !bRet )
+ {
+ if( !GoNextWord() )
+ {
+ if( (!IsEndPara() && !SwCrsrShell::MovePara( fnParaCurr, fnParaEnd ) )
+ || !SwCrsrShell::Right(1,CRSR_SKIP_CHARS) )
+ break;
+ bRet = IsStartWord();
+ }
+ else
+ bRet = TRUE;
+ }
+ ClearMark();
+ Combine();
+ return bRet;
+}
+
+BOOL SwWrtShell::_PrvWrd()
+{
+ BOOL bRet = FALSE;
+ while( IsSttPara() )
+ { // wenn schon am Anfang, dann naechsten ???
+ if(!SwCrsrShell::Left(1,CRSR_SKIP_CHARS))
+ { // Document - Anfang ??
+ Pop( FALSE );
+ return bRet;
+ }
+ bRet = IsStartWord();
+ }
+ Push();
+ ClearMark();
+ while( !bRet )
+ {
+ if( !GoPrevWord() )
+ {
+ if( (!IsSttPara() && !SwCrsrShell::MovePara( fnParaCurr, fnParaStart ) )
+ || !SwCrsrShell::Left(1,CRSR_SKIP_CHARS) )
+ break;
+ bRet = IsStartWord();
+ }
+ else
+ bRet = TRUE;
+ }
+ ClearMark();
+ Combine();
+ return bRet;
+}
+
+// --> OD 2008-08-06 #i92468#
+// method code of <SwWrtShell::_NxtWrd()> before fix for issue i72162
+BOOL SwWrtShell::_NxtWrdForDelete()
+{
+ if ( IsEndPara() )
+ {
+ if ( !SwCrsrShell::Right(1,CRSR_SKIP_CHARS) )
+ {
+ Pop( FALSE );
+ return FALSE;
+ }
+ return TRUE;
+ }
+ Push();
+ ClearMark();
+ if ( !GoNextWord() )
+ {
+ SwCrsrShell::MovePara( fnParaCurr, fnParaEnd );
+ }
+ ClearMark();
+ Combine();
+ return TRUE;
+}
+
+// method code of <SwWrtShell::_PrvWrd()> before fix for issue i72162
+BOOL SwWrtShell::_PrvWrdForDelete()
+{
+ if ( IsSttPara() )
+ {
+ if ( !SwCrsrShell::Left(1,CRSR_SKIP_CHARS) )
+ {
+ Pop( FALSE );
+ return FALSE;
+ }
+ return TRUE;
+ }
+ Push();
+ ClearMark();
+ if( !GoPrevWord() )
+ {
+ SwCrsrShell::MovePara( fnParaCurr, fnParaStart );
+ }
+ ClearMark();
+ Combine();
+ return TRUE;
+}
+// <--
+
+
+BOOL SwWrtShell::_FwdSentence()
+{
+ Push();
+ ClearMark();
+ if(!SwCrsrShell::Right(1,CRSR_SKIP_CHARS))
+ {
+ Pop(FALSE);
+ return 0;
+ }
+ if( !GoNextSentence() && !IsEndPara() )
+ SwCrsrShell::MovePara(fnParaCurr, fnParaEnd);
+
+ ClearMark();
+ Combine();
+ return 1;
+}
+
+
+
+BOOL SwWrtShell::_BwdSentence()
+{
+ Push();
+ ClearMark();
+ if(!SwCrsrShell::Left(1,CRSR_SKIP_CHARS))
+ {
+ Pop(FALSE);
+ return 0;
+ }
+ if(IsSttPara())
+ {
+ Pop();
+ return 1;
+ }
+ if( !GoPrevSentence() && !IsSttPara() )
+ // nicht gefunden --> an den Absatz Anfang
+ SwCrsrShell::MovePara( fnParaCurr, fnParaStart );
+ ClearMark();
+ Combine();
+ return 1;
+}
+
+
+BOOL SwWrtShell::_FwdPara()
+{
+ Push();
+ ClearMark();
+ // --> OD 2009-01-06 #i81824#
+ // going right and back again left not needed and causes too much
+ // accessibility events due to the cursor movements.
+// if(!SwCrsrShell::Right(1,CRSR_SKIP_CHARS))
+// {
+// Pop(FALSE);
+// return 0;
+// }
+// SwCrsrShell::Left(1,CRSR_SKIP_CHARS);
+ // <--
+ BOOL bRet = SwCrsrShell::MovePara(fnParaNext, fnParaStart);
+
+ ClearMark();
+ Combine();
+ return bRet;
+}
+
+
+BOOL SwWrtShell::_BwdPara()
+{
+ Push();
+ ClearMark();
+ // --> OD 2009-01-06 #i81824#
+ // going left and back again right not needed and causes too much
+ // accessibility events due to the cursor movements.
+// if(!SwCrsrShell::Left(1,CRSR_SKIP_CHARS))
+// {
+// Pop(FALSE);
+// return 0;
+// }
+// SwCrsrShell::Right(1,CRSR_SKIP_CHARS);
+ // <--
+ // --> OD 2009-01-06 #i81824#
+ // going to start of paragraph only needed, if move to previous paragraph
+ // does not happen. Otherwise, useless accessibility events are triggered
+ // due to cursor movements.
+// if(!IsSttOfPara())
+// SttPara();
+ BOOL bRet = SwCrsrShell::MovePara(fnParaPrev, fnParaStart);
+ if ( !bRet && !IsSttOfPara() )
+ {
+ SttPara();
+ }
+ // <--
+
+ ClearMark();
+ Combine();
+ return bRet;
+}
+
+
diff --git a/sw/source/ui/wrtsh/wrtundo.cxx b/sw/source/ui/wrtsh/wrtundo.cxx
new file mode 100644
index 000000000000..f3c62f9f9dff
--- /dev/null
+++ b/sw/source/ui/wrtsh/wrtundo.cxx
@@ -0,0 +1,182 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * 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.
+ *
+ * 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).
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+#define _SVSTDARR_STRINGSDTOR
+#include <tools/resid.hxx>
+#include <sfx2/app.hxx>
+#include <svl/slstitm.hxx>
+#include <wrtsh.hxx>
+#include <swundo.hxx> // fuer Undo-Ids
+#include <swdtflvr.hxx>
+
+#ifndef _WRTSH_HRC
+#include <wrtsh.hrc>
+#endif
+#include <sfx2/sfx.hrc>
+
+
+// Undo beendet alle Modi. Falls eine Selektion durch das Undo entstanden
+// ist, muss die fuer die weiteren Aktionen beruecksichtigt werden.
+
+
+void SwWrtShell::Do( DoType eDoType, USHORT nCnt )
+{
+ // #105332# save current state of DoesUndo()
+ sal_Bool bSaveDoesUndo = DoesUndo();
+
+ StartAllAction();
+ switch( eDoType )
+ {
+ case UNDO:
+ DoUndo(sal_False); // #i21739#
+ // Modi zuruecksetzen
+ EnterStdMode();
+ SwEditShell::Undo(UNDO_EMPTY, nCnt );
+ break;
+ case REDO:
+ DoUndo(sal_False); // #i21739#
+ // Modi zuruecksetzen
+ EnterStdMode();
+ SwEditShell::Redo( nCnt );
+ break;
+ case REPEAT:
+ // #i21739# do not touch undo flag here !!!
+ SwEditShell::Repeat( nCnt );
+ break;
+ }
+ EndAllAction();
+ // #105332# restore undo state
+ DoUndo(bSaveDoesUndo);
+
+ 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 );
+
+ // Bug 32918: nach loeschen der Numerierung bleibt die Obj. Leiste stehen
+ // Warum wird hier nicht immer ein CallChgLink gerufen?
+ CallChgLnk();
+}
+
+
+String SwWrtShell::GetDoString( DoType eDoType ) const
+{
+ String aStr, aUndoStr;
+ USHORT nResStr = STR_UNDO;
+ switch( eDoType )
+ {
+ case UNDO:
+ nResStr = STR_UNDO;
+ aUndoStr = GetUndoIdsStr();
+ break;
+ case REDO:
+ nResStr = STR_REDO;
+ aUndoStr = GetRedoIdsStr();
+ break;
+ default:;//prevent warning
+ }
+
+ aStr.Insert( String(ResId( nResStr, *SFX_APP()->GetSfxResManager())), 0 );
+ aStr += aUndoStr;
+
+ return aStr;
+}
+
+USHORT SwWrtShell::GetDoStrings( DoType eDoType, SfxStringListItem& rStrs ) const
+{
+ SwUndoIds aIds;
+ switch( eDoType )
+ {
+ case UNDO:
+ GetUndoIds( NULL, &aIds );
+ break;
+ case REDO:
+ GetRedoIds( NULL, &aIds );
+ break;
+ default:;//prevent warning
+ }
+
+ String sList;
+ for( USHORT n = 0, nEnd = aIds.Count(); n < nEnd; ++n )
+ {
+ const SwUndoIdAndName& rIdNm = *aIds[ n ];
+ if( rIdNm.GetUndoStr() )
+ sList += *rIdNm.GetUndoStr();
+ else
+ {
+ ASSERT( !this, "no Undo/Redo Test set" );
+ }
+ sList += '\n';
+ }
+ rStrs.SetString( sList );
+ return aIds.Count();
+}
+
+
+String SwWrtShell::GetRepeatString() const
+{
+ String aStr;
+ String aUndoStr = GetRepeatIdsStr();
+
+ if (aUndoStr.Len() > 0)
+ {
+ aStr.Insert( ResId( STR_REPEAT, *SFX_APP()->GetSfxResManager()), 0 );
+ aStr += aUndoStr;
+ }
+
+ return aStr;
+}
+
+