xref: /aoo42x/main/editeng/source/outliner/outlvw.cxx (revision af89ca6e)
1190118d0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3190118d0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4190118d0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5190118d0SAndrew Rist  * distributed with this work for additional information
6190118d0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7190118d0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8190118d0SAndrew Rist  * "License"); you may not use this file except in compliance
9190118d0SAndrew Rist  * with the License.  You may obtain a copy of the License at
10190118d0SAndrew Rist  *
11190118d0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12190118d0SAndrew Rist  *
13190118d0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14190118d0SAndrew Rist  * software distributed under the License is distributed on an
15190118d0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16190118d0SAndrew Rist  * KIND, either express or implied.  See the License for the
17190118d0SAndrew Rist  * specific language governing permissions and limitations
18190118d0SAndrew Rist  * under the License.
19190118d0SAndrew Rist  *
20190118d0SAndrew Rist  *************************************************************/
21190118d0SAndrew Rist 
22190118d0SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include "precompiled_editeng.hxx"
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include <com/sun/star/i18n/WordType.hpp>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include <svl/intitem.hxx>
31cdf0e10cSrcweir #include <editeng/editeng.hxx>
32cdf0e10cSrcweir #include <editeng/editview.hxx>
33cdf0e10cSrcweir #include <editeng/editdata.hxx>
34cdf0e10cSrcweir #include <editeng/eerdll.hxx>
35cdf0e10cSrcweir #include <editeng/lrspitem.hxx>
36cdf0e10cSrcweir #include <editeng/fhgtitem.hxx>
37cdf0e10cSrcweir 
38cdf0e10cSrcweir #include <svl/style.hxx>
39cdf0e10cSrcweir #include <i18npool/mslangid.hxx>
40cdf0e10cSrcweir 
41cdf0e10cSrcweir #define _OUTLINER_CXX
42cdf0e10cSrcweir #include <editeng/outliner.hxx>
43cdf0e10cSrcweir #include <outleeng.hxx>
44cdf0e10cSrcweir #include <paralist.hxx>
45cdf0e10cSrcweir #include <outlundo.hxx>
46cdf0e10cSrcweir #include <editeng/outlobj.hxx>
47cdf0e10cSrcweir #include <editeng/flditem.hxx>
48cdf0e10cSrcweir #include <editeng/flditem.hxx>
49cdf0e10cSrcweir #include <editeng/eeitem.hxx>
50cdf0e10cSrcweir #include <editeng/numitem.hxx>
51cdf0e10cSrcweir #include <vcl/window.hxx>
52cdf0e10cSrcweir #include <svl/itemset.hxx>
53766ce4d0SZheng Fan #include <svl/eitem.hxx>
54cdf0e10cSrcweir #include <editeng/editstat.hxx>
55cdf0e10cSrcweir 
56cdf0e10cSrcweir 
57cdf0e10cSrcweir // Breite der Randzonen innerhalb derer beim D&D gescrollt wird
58cdf0e10cSrcweir #define OL_SCROLL_LRBORDERWIDTHPIX	10
59cdf0e10cSrcweir #define OL_SCROLL_TBBORDERWIDTHPIX	10
60cdf0e10cSrcweir 
61cdf0e10cSrcweir // Wert, um den Fensterinhalt beim D&D gescrollt wird
62cdf0e10cSrcweir #define OL_SCROLL_HOROFFSET			20  /* in % von VisibleSize.Width */
63cdf0e10cSrcweir #define OL_SCROLL_VEROFFSET			20  /* in % von VisibleSize.Height */
64cdf0e10cSrcweir 
65cdf0e10cSrcweir using namespace ::com::sun::star;
66cdf0e10cSrcweir 
67cdf0e10cSrcweir DBG_NAME(OutlinerView)
68cdf0e10cSrcweir 
69cdf0e10cSrcweir 
70cdf0e10cSrcweir OutlinerView::OutlinerView( Outliner* pOut, Window* pWin )
71cdf0e10cSrcweir {
72cdf0e10cSrcweir 	DBG_CTOR( OutlinerView, 0 );
73cdf0e10cSrcweir 
74cdf0e10cSrcweir 	pOwner						= pOut;
75cdf0e10cSrcweir 	bDDCursorVisible			= sal_False;
76cdf0e10cSrcweir 	bInDragMode 				= sal_False;
77cdf0e10cSrcweir 	nDDScrollLRBorderWidthWin 	= 0;
78cdf0e10cSrcweir 	nDDScrollTBBorderWidthWin 	= 0;
79cdf0e10cSrcweir 	pHorTabArrDoc				= 0;
80cdf0e10cSrcweir 
81cdf0e10cSrcweir 	pEditView = new EditView( pOut->pEditEngine, pWin );
82cdf0e10cSrcweir 	pEditView->SetSelectionMode( EE_SELMODE_TXTONLY );
83cdf0e10cSrcweir }
84cdf0e10cSrcweir 
85cdf0e10cSrcweir OutlinerView::~OutlinerView()
86cdf0e10cSrcweir {
87cdf0e10cSrcweir 	DBG_DTOR(OutlinerView,0);
88cdf0e10cSrcweir 	delete pEditView;
89cdf0e10cSrcweir }
90cdf0e10cSrcweir 
91a56bd57bSArmin Le Grand void OutlinerView::Paint( const Rectangle& rRect, OutputDevice* pTargetDevice )
92cdf0e10cSrcweir {
93cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
94cdf0e10cSrcweir 
95cdf0e10cSrcweir 	// beim ersten Paint/KeyInput/Drop wird aus einem leeren Outliner ein
96cdf0e10cSrcweir 	// Outliner mit genau einem Absatz
97cdf0e10cSrcweir 	if( pOwner->bFirstParaIsEmpty )
98cdf0e10cSrcweir 		pOwner->Insert( String() );
99cdf0e10cSrcweir 
100a56bd57bSArmin Le Grand 	pEditView->Paint( rRect, pTargetDevice );
101cdf0e10cSrcweir }
102cdf0e10cSrcweir 
103cdf0e10cSrcweir sal_Bool OutlinerView::PostKeyEvent( const KeyEvent& rKEvt )
104cdf0e10cSrcweir {
105cdf0e10cSrcweir 	DBG_CHKTHIS( OutlinerView, 0 );
106cdf0e10cSrcweir 
107cdf0e10cSrcweir 	// beim ersten Paint/KeyInput/Drop wird aus einem leeren Outliner ein
108cdf0e10cSrcweir 	// Outliner mit genau einem Absatz
109cdf0e10cSrcweir 	if( pOwner->bFirstParaIsEmpty )
110cdf0e10cSrcweir 		pOwner->Insert( String() );
111cdf0e10cSrcweir 
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 	sal_Bool bKeyProcessed = sal_False;
114cdf0e10cSrcweir 	ESelection aSel( pEditView->GetSelection() );
115cdf0e10cSrcweir 	sal_Bool bSelection = aSel.HasRange();
116cdf0e10cSrcweir 	KeyCode aKeyCode = rKEvt.GetKeyCode();
117cdf0e10cSrcweir 	KeyFuncType eFunc = aKeyCode.GetFunction();
118cdf0e10cSrcweir 	sal_uInt16 nCode = aKeyCode.GetCode();
119cdf0e10cSrcweir 	sal_Bool bReadOnly = IsReadOnly();
120cdf0e10cSrcweir 
121cdf0e10cSrcweir 	if( bSelection && ( nCode != KEY_TAB ) && EditEngine::DoesKeyChangeText( rKEvt ) )
122cdf0e10cSrcweir 	{
123cdf0e10cSrcweir 		if ( ImpCalcSelectedPages( sal_False ) && !pOwner->ImpCanDeleteSelectedPages( this ) )
124cdf0e10cSrcweir 			return sal_True;
125cdf0e10cSrcweir 	}
126cdf0e10cSrcweir 
127cdf0e10cSrcweir 	if ( eFunc != KEYFUNC_DONTKNOW )
128cdf0e10cSrcweir 	{
129cdf0e10cSrcweir 		switch ( eFunc )
130cdf0e10cSrcweir 		{
131cdf0e10cSrcweir 			case KEYFUNC_CUT:
132cdf0e10cSrcweir 			{
133cdf0e10cSrcweir 				if ( !bReadOnly )
134cdf0e10cSrcweir 				{
135cdf0e10cSrcweir 					Cut();
136cdf0e10cSrcweir 					bKeyProcessed = sal_True;
137cdf0e10cSrcweir 				}
138cdf0e10cSrcweir 			}
139cdf0e10cSrcweir 			break;
140cdf0e10cSrcweir 			case KEYFUNC_COPY:
141cdf0e10cSrcweir 			{
142cdf0e10cSrcweir 				Copy();
143cdf0e10cSrcweir 				bKeyProcessed = sal_True;
144cdf0e10cSrcweir 			}
145cdf0e10cSrcweir 			break;
146cdf0e10cSrcweir 			case KEYFUNC_PASTE:
147cdf0e10cSrcweir 			{
148cdf0e10cSrcweir 				if ( !bReadOnly )
149cdf0e10cSrcweir 				{
150cdf0e10cSrcweir                     PasteSpecial();
151cdf0e10cSrcweir 					bKeyProcessed = sal_True;
152cdf0e10cSrcweir 				}
153cdf0e10cSrcweir 			}
154cdf0e10cSrcweir 			break;
155cdf0e10cSrcweir 			case KEYFUNC_DELETE:
156cdf0e10cSrcweir 			{
157cdf0e10cSrcweir 				if( !bReadOnly && !bSelection && ( pOwner->ImplGetOutlinerMode() != OUTLINERMODE_TEXTOBJECT ) )
158cdf0e10cSrcweir 				{
159cdf0e10cSrcweir 					if( aSel.nEndPos == pOwner->pEditEngine->GetTextLen( aSel.nEndPara ) )
160cdf0e10cSrcweir 					{
161cdf0e10cSrcweir 						Paragraph* pNext = pOwner->pParaList->GetParagraph( aSel.nEndPara+1 );
162cdf0e10cSrcweir 						if( pNext && pNext->HasFlag(PARAFLAG_ISPAGE) )
163cdf0e10cSrcweir 						{
164cdf0e10cSrcweir 							if( !pOwner->ImpCanDeleteSelectedPages( this, aSel.nEndPara, 1 ) )
165cdf0e10cSrcweir 								return sal_False;
166cdf0e10cSrcweir 						}
167cdf0e10cSrcweir 					}
168cdf0e10cSrcweir 				}
169cdf0e10cSrcweir 			}
170cdf0e10cSrcweir 			break;
171cdf0e10cSrcweir 			default:	// wird dann evtl. unten bearbeitet.
172cdf0e10cSrcweir 						eFunc = KEYFUNC_DONTKNOW;
173cdf0e10cSrcweir 		}
174cdf0e10cSrcweir 	}
175cdf0e10cSrcweir 	if ( eFunc == KEYFUNC_DONTKNOW )
176cdf0e10cSrcweir 	{
177cdf0e10cSrcweir 		switch ( nCode )
178cdf0e10cSrcweir 		{
179cdf0e10cSrcweir 			case KEY_TAB:
180cdf0e10cSrcweir 			{
181cdf0e10cSrcweir 				if ( !bReadOnly && !aKeyCode.IsMod1() && !aKeyCode.IsMod2() )
182cdf0e10cSrcweir 				{
183cdf0e10cSrcweir 					if ( ( pOwner->ImplGetOutlinerMode() != OUTLINERMODE_TEXTOBJECT ) &&
184cdf0e10cSrcweir 						 ( pOwner->ImplGetOutlinerMode() != OUTLINERMODE_TITLEOBJECT ) &&
185cdf0e10cSrcweir 						 ( bSelection || !aSel.nStartPos ) )
186cdf0e10cSrcweir 					{
187cdf0e10cSrcweir 						Indent( aKeyCode.IsShift() ? (-1) : (+1) );
188cdf0e10cSrcweir 						bKeyProcessed = sal_True;
189cdf0e10cSrcweir 					}
190cdf0e10cSrcweir 					else if ( ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_TEXTOBJECT ) &&
191*af89ca6eSOliver-Rainer Wittmann 							  !bSelection && !aSel.nEndPos && pOwner->ImplHasNumberFormat( aSel.nEndPara ) )
192cdf0e10cSrcweir 					{
193cdf0e10cSrcweir 						Indent( aKeyCode.IsShift() ? (-1) : (+1) );
194cdf0e10cSrcweir 						bKeyProcessed = sal_True;
195cdf0e10cSrcweir 					}
196cdf0e10cSrcweir 				}
197cdf0e10cSrcweir 			}
198cdf0e10cSrcweir 			break;
199cdf0e10cSrcweir 			case KEY_BACKSPACE:
200cdf0e10cSrcweir 			{
201cdf0e10cSrcweir 				if( !bReadOnly && !bSelection && aSel.nEndPara && !aSel.nEndPos )
202cdf0e10cSrcweir 				{
203cdf0e10cSrcweir 					Paragraph* pPara = pOwner->pParaList->GetParagraph( aSel.nEndPara );
204cdf0e10cSrcweir 					Paragraph* pPrev = pOwner->pParaList->GetParagraph( aSel.nEndPara-1 );
205cdf0e10cSrcweir 					if( !pPrev->IsVisible()  )
206cdf0e10cSrcweir 						return sal_True;
207cdf0e10cSrcweir 					if( !pPara->GetDepth() )
208cdf0e10cSrcweir 					{
209cdf0e10cSrcweir 						if(!pOwner->ImpCanDeleteSelectedPages(this, aSel.nEndPara , 1 ) )
210cdf0e10cSrcweir 							return sal_True;
211cdf0e10cSrcweir 					}
212cdf0e10cSrcweir 				}
213cdf0e10cSrcweir 			}
214cdf0e10cSrcweir 			break;
215cdf0e10cSrcweir 			case KEY_RETURN:
216cdf0e10cSrcweir 			{
217cdf0e10cSrcweir 				if ( !bReadOnly )
218cdf0e10cSrcweir 				{
219cdf0e10cSrcweir 					// Sonderbehandlung: Hartes Return am Ende eines Absatzes,
220cdf0e10cSrcweir 					// der eingeklappte Unterabsaetze besitzt
221cdf0e10cSrcweir 					Paragraph* pPara = pOwner->pParaList->GetParagraph( aSel.nEndPara );
222cdf0e10cSrcweir 
223cdf0e10cSrcweir 					if( !aKeyCode.IsShift() )
224cdf0e10cSrcweir 					{
225cdf0e10cSrcweir 						// Nochmal ImpGetCursor ???
226cdf0e10cSrcweir 						if( !bSelection &&
227cdf0e10cSrcweir 								aSel.nEndPos == pOwner->pEditEngine->GetTextLen( aSel.nEndPara ) )
228cdf0e10cSrcweir 						{
229cdf0e10cSrcweir 							sal_uLong nChilds =	pOwner->pParaList->GetChildCount(pPara);
230cdf0e10cSrcweir 							if( nChilds && !pOwner->pParaList->HasVisibleChilds(pPara))
231cdf0e10cSrcweir 							{
232cdf0e10cSrcweir 								pOwner->UndoActionStart( OLUNDO_INSERT );
233cdf0e10cSrcweir 								sal_uLong nTemp = aSel.nEndPara;
234cdf0e10cSrcweir 								nTemp += nChilds;
235cdf0e10cSrcweir 								nTemp++; // einfuegen ueber naechstem Non-Child
236cdf0e10cSrcweir 								pOwner->Insert( String(),nTemp,pPara->GetDepth());
237cdf0e10cSrcweir 								// Cursor positionieren
238cdf0e10cSrcweir 								ESelection aTmpSel((sal_uInt16)nTemp,0,(sal_uInt16)nTemp,0);
239cdf0e10cSrcweir 								pEditView->SetSelection( aTmpSel );
240cdf0e10cSrcweir 								pEditView->ShowCursor( sal_True, sal_True );
241cdf0e10cSrcweir 								pOwner->UndoActionEnd( OLUNDO_INSERT );
242cdf0e10cSrcweir 								bKeyProcessed = sal_True;
243cdf0e10cSrcweir 							}
244cdf0e10cSrcweir 						}
245cdf0e10cSrcweir 					}
246cdf0e10cSrcweir 					if( !bKeyProcessed && !bSelection &&
247cdf0e10cSrcweir 								!aKeyCode.IsShift() && aKeyCode.IsMod1() &&
248cdf0e10cSrcweir 							( aSel.nEndPos == pOwner->pEditEngine->GetTextLen(aSel.nEndPara) ) )
249cdf0e10cSrcweir 					{
250cdf0e10cSrcweir 						pOwner->UndoActionStart( OLUNDO_INSERT );
251cdf0e10cSrcweir 						sal_uLong nTemp = aSel.nEndPara;
252cdf0e10cSrcweir 						nTemp++;
253cdf0e10cSrcweir 						pOwner->Insert( String(), nTemp, pPara->GetDepth()+1 );
254cdf0e10cSrcweir 
255cdf0e10cSrcweir 						// Cursor positionieren
256cdf0e10cSrcweir 						ESelection aTmpSel((sal_uInt16)nTemp,0,(sal_uInt16)nTemp,0);
257cdf0e10cSrcweir 						pEditView->SetSelection( aTmpSel );
258cdf0e10cSrcweir 						pEditView->ShowCursor( sal_True, sal_True );
259cdf0e10cSrcweir 						pOwner->UndoActionEnd( OLUNDO_INSERT );
260cdf0e10cSrcweir 						bKeyProcessed = sal_True;
261cdf0e10cSrcweir 					}
262cdf0e10cSrcweir 				}
263cdf0e10cSrcweir 			}
264cdf0e10cSrcweir 			break;
265cdf0e10cSrcweir 		}
266cdf0e10cSrcweir 	}
267cdf0e10cSrcweir 
268cdf0e10cSrcweir 	return bKeyProcessed ? sal_True : pEditView->PostKeyEvent( rKEvt );
269cdf0e10cSrcweir }
270cdf0e10cSrcweir 
271cdf0e10cSrcweir 
272cdf0e10cSrcweir sal_uLong OutlinerView::ImpCheckMousePos(const Point& rPosPix, MouseTarget& reTarget)
273cdf0e10cSrcweir {
274cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
275cdf0e10cSrcweir 	sal_uLong nPara = EE_PARA_NOT_FOUND;
276cdf0e10cSrcweir 
277cdf0e10cSrcweir 	Point aMousePosWin = pEditView->GetWindow()->PixelToLogic( rPosPix );
278cdf0e10cSrcweir 	if( !pEditView->GetOutputArea().IsInside( aMousePosWin ) )
279cdf0e10cSrcweir     {
280cdf0e10cSrcweir 		reTarget = MouseOutside;
281cdf0e10cSrcweir     }
282cdf0e10cSrcweir 	else
283cdf0e10cSrcweir 	{
284cdf0e10cSrcweir 		reTarget = MouseText;
285cdf0e10cSrcweir 
286cdf0e10cSrcweir 		Point aPaperPos( aMousePosWin );
287cdf0e10cSrcweir 		Rectangle aOutArea = pEditView->GetOutputArea();
288cdf0e10cSrcweir 		Rectangle aVisArea = pEditView->GetVisArea();
289cdf0e10cSrcweir 		aPaperPos.X() -= aOutArea.Left();
290cdf0e10cSrcweir 		aPaperPos.X() += aVisArea.Left();
291cdf0e10cSrcweir 		aPaperPos.Y() -= aOutArea.Top();
292cdf0e10cSrcweir 		aPaperPos.Y() += aVisArea.Top();
293cdf0e10cSrcweir 
294cdf0e10cSrcweir         sal_Bool bBullet;
295cdf0e10cSrcweir         if ( pOwner->IsTextPos( aPaperPos, 0, &bBullet ) )
296cdf0e10cSrcweir         {
297cdf0e10cSrcweir 		    Point aDocPos = pOwner->GetDocPos( aPaperPos );
298cdf0e10cSrcweir 		    nPara = pOwner->pEditEngine->FindParagraph( aDocPos.Y() );
299cdf0e10cSrcweir 
300cdf0e10cSrcweir             if ( bBullet )
301cdf0e10cSrcweir             {
302cdf0e10cSrcweir                 reTarget = MouseBullet;
303cdf0e10cSrcweir             }
304cdf0e10cSrcweir             else
305cdf0e10cSrcweir             {
306cdf0e10cSrcweir                 // Check for hyperlink
307cdf0e10cSrcweir 	            const SvxFieldItem* pFieldItem = pEditView->GetField( aMousePosWin );
308cdf0e10cSrcweir 	            if ( pFieldItem && pFieldItem->GetField() && pFieldItem->GetField()->ISA( SvxURLField ) )
309cdf0e10cSrcweir 		            reTarget = MouseHypertext;
310cdf0e10cSrcweir             }
311cdf0e10cSrcweir         }
312cdf0e10cSrcweir     }
313cdf0e10cSrcweir 	return nPara;
314cdf0e10cSrcweir }
315cdf0e10cSrcweir 
316cdf0e10cSrcweir sal_Bool __EXPORT OutlinerView::MouseMove( const MouseEvent& rMEvt )
317cdf0e10cSrcweir {
318cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
319cdf0e10cSrcweir 
320cdf0e10cSrcweir     if( ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_TEXTOBJECT ) || pEditView->GetEditEngine()->IsInSelectionMode())
321cdf0e10cSrcweir 		return pEditView->MouseMove( rMEvt );
322cdf0e10cSrcweir 
323cdf0e10cSrcweir 	Point aMousePosWin( pEditView->GetWindow()->PixelToLogic( rMEvt.GetPosPixel() ) );
324cdf0e10cSrcweir 	if( !pEditView->GetOutputArea().IsInside( aMousePosWin ) )
325cdf0e10cSrcweir         return sal_False;
326cdf0e10cSrcweir 
327cdf0e10cSrcweir     Pointer aPointer = GetPointer( rMEvt.GetPosPixel() );
328cdf0e10cSrcweir     pEditView->GetWindow()->SetPointer( aPointer );
329cdf0e10cSrcweir     return pEditView->MouseMove( rMEvt );
330cdf0e10cSrcweir }
331cdf0e10cSrcweir 
332cdf0e10cSrcweir 
333cdf0e10cSrcweir sal_Bool __EXPORT OutlinerView::MouseButtonDown( const MouseEvent& rMEvt )
334cdf0e10cSrcweir {
335cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
336cdf0e10cSrcweir 	if ( ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_TEXTOBJECT ) || pEditView->GetEditEngine()->IsInSelectionMode() )
337cdf0e10cSrcweir 		return pEditView->MouseButtonDown( rMEvt );
338cdf0e10cSrcweir 
339cdf0e10cSrcweir 	Point aMousePosWin( pEditView->GetWindow()->PixelToLogic( rMEvt.GetPosPixel() ) );
340cdf0e10cSrcweir 	if( !pEditView->GetOutputArea().IsInside( aMousePosWin ) )
341cdf0e10cSrcweir         return sal_False;
342cdf0e10cSrcweir 
343cdf0e10cSrcweir 	Pointer aPointer = GetPointer( rMEvt.GetPosPixel() );
344cdf0e10cSrcweir     pEditView->GetWindow()->SetPointer( aPointer );
345cdf0e10cSrcweir 
346cdf0e10cSrcweir 	MouseTarget eTarget;
347cdf0e10cSrcweir 	sal_uLong nPara = ImpCheckMousePos( rMEvt.GetPosPixel(), eTarget );
348cdf0e10cSrcweir     if ( eTarget == MouseBullet )
349cdf0e10cSrcweir 	{
350cdf0e10cSrcweir 		Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
351cdf0e10cSrcweir 		sal_Bool bHasChilds = (pPara && pOwner->pParaList->HasChilds(pPara));
352cdf0e10cSrcweir 		if( rMEvt.GetClicks() == 1 )
353cdf0e10cSrcweir 		{
354cdf0e10cSrcweir 			sal_uLong nEndPara = nPara;
355cdf0e10cSrcweir 			if ( bHasChilds && pOwner->pParaList->HasVisibleChilds(pPara) )
356cdf0e10cSrcweir 				nEndPara += pOwner->pParaList->GetChildCount( pPara );
357cdf0e10cSrcweir 			// umgekehrt rum selektieren, damit EditEngine nicht scrollt
358cdf0e10cSrcweir 			ESelection aSel((sal_uInt16)nEndPara, 0xffff,(sal_uInt16)nPara, 0 );
359cdf0e10cSrcweir 			pEditView->SetSelection( aSel );
360cdf0e10cSrcweir         }
361cdf0e10cSrcweir 		else if( rMEvt.GetClicks() == 2 && bHasChilds )
362cdf0e10cSrcweir 			ImpToggleExpand( pPara );
363cdf0e10cSrcweir 
364cdf0e10cSrcweir 		aDDStartPosPix = rMEvt.GetPosPixel();
365cdf0e10cSrcweir 		aDDStartPosRef=pEditView->GetWindow()->PixelToLogic( aDDStartPosPix,pOwner->GetRefMapMode());
366cdf0e10cSrcweir 		return sal_True;
367cdf0e10cSrcweir 	}
368cdf0e10cSrcweir 
369cdf0e10cSrcweir 	// special case for outliner view in impress, check if double click hits the page icon for toggle
370cdf0e10cSrcweir 	if( (nPara == EE_PARA_NOT_FOUND) && (pOwner->ImplGetOutlinerMode() == OUTLINERMODE_OUTLINEVIEW) && (eTarget == MouseText) && (rMEvt.GetClicks() == 2) )
371cdf0e10cSrcweir 	{
372cdf0e10cSrcweir         ESelection aSel( pEditView->GetSelection() );
373cdf0e10cSrcweir 	    nPara = aSel.nStartPara;
374cdf0e10cSrcweir 	    Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
375cdf0e10cSrcweir 	    if( (pPara && pOwner->pParaList->HasChilds(pPara)) && pPara->HasFlag(PARAFLAG_ISPAGE) )
376cdf0e10cSrcweir 	    {
377cdf0e10cSrcweir 	        ImpToggleExpand( pPara );
378cdf0e10cSrcweir 	    }
379cdf0e10cSrcweir 	}
380cdf0e10cSrcweir 	return pEditView->MouseButtonDown( rMEvt );
381cdf0e10cSrcweir }
382cdf0e10cSrcweir 
383cdf0e10cSrcweir 
384cdf0e10cSrcweir sal_Bool __EXPORT OutlinerView::MouseButtonUp( const MouseEvent& rMEvt )
385cdf0e10cSrcweir {
386cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
387cdf0e10cSrcweir 	if ( ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_TEXTOBJECT ) || pEditView->GetEditEngine()->IsInSelectionMode() )
388cdf0e10cSrcweir 		return pEditView->MouseButtonUp( rMEvt );
389cdf0e10cSrcweir 
390cdf0e10cSrcweir 	Point aMousePosWin( pEditView->GetWindow()->PixelToLogic( rMEvt.GetPosPixel() ) );
391cdf0e10cSrcweir 	if( !pEditView->GetOutputArea().IsInside( aMousePosWin ) )
392cdf0e10cSrcweir         return sal_False;
393cdf0e10cSrcweir 
394cdf0e10cSrcweir     Pointer aPointer = GetPointer( rMEvt.GetPosPixel() );
395cdf0e10cSrcweir     pEditView->GetWindow()->SetPointer( aPointer );
396cdf0e10cSrcweir 
397cdf0e10cSrcweir     return pEditView->MouseButtonUp( rMEvt );
398cdf0e10cSrcweir }
399cdf0e10cSrcweir 
400cdf0e10cSrcweir void OutlinerView::ImpHideDDCursor()
401cdf0e10cSrcweir {
402cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
403cdf0e10cSrcweir 	if ( bDDCursorVisible )
404cdf0e10cSrcweir 	{
405cdf0e10cSrcweir 		bDDCursorVisible = sal_False;
406cdf0e10cSrcweir 		ImpPaintDDCursor();
407cdf0e10cSrcweir 	}
408cdf0e10cSrcweir }
409cdf0e10cSrcweir 
410cdf0e10cSrcweir void OutlinerView::ImpShowDDCursor()
411cdf0e10cSrcweir {
412cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
413cdf0e10cSrcweir 	if ( !bDDCursorVisible )
414cdf0e10cSrcweir 	{
415cdf0e10cSrcweir 		bDDCursorVisible = sal_True;
416cdf0e10cSrcweir 		ImpPaintDDCursor();
417cdf0e10cSrcweir 	}
418cdf0e10cSrcweir }
419cdf0e10cSrcweir 
420cdf0e10cSrcweir void OutlinerView::ImpPaintDDCursor()
421cdf0e10cSrcweir {
422cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
423cdf0e10cSrcweir 
424cdf0e10cSrcweir 	Window* pWindow = pEditView->GetWindow();
425cdf0e10cSrcweir 	RasterOp eOldOp = pWindow->GetRasterOp();
426cdf0e10cSrcweir 	pWindow->SetRasterOp( ROP_INVERT );
427cdf0e10cSrcweir 
428cdf0e10cSrcweir 	const Color& rOldLineColor = pWindow->GetLineColor();
429cdf0e10cSrcweir 	pWindow->SetLineColor( Color( COL_BLACK ) );
430cdf0e10cSrcweir 
431cdf0e10cSrcweir 	Point aStartPointWin, aEndPointWin;
432cdf0e10cSrcweir 	Rectangle aOutputArWin = pEditView->GetOutputArea();
433cdf0e10cSrcweir 	Rectangle aVisAreaRef = pEditView->GetVisArea();
434cdf0e10cSrcweir 
435cdf0e10cSrcweir 	if( bDDChangingDepth )
436cdf0e10cSrcweir 	{
437cdf0e10cSrcweir 		aStartPointWin.X() = pHorTabArrDoc[ nDDCurDepth ];
438cdf0e10cSrcweir 		aStartPointWin.X() += aOutputArWin.Left();
439cdf0e10cSrcweir 		aStartPointWin.Y() = aOutputArWin.Top();
440cdf0e10cSrcweir 		aEndPointWin.X() = aStartPointWin.X();
441cdf0e10cSrcweir 		aEndPointWin.Y() = aOutputArWin.Bottom();
442cdf0e10cSrcweir 	}
443cdf0e10cSrcweir 	else
444cdf0e10cSrcweir 	{
445cdf0e10cSrcweir 		sal_uLong nPara = nDDCurPara;
446cdf0e10cSrcweir 		if ( nDDCurPara == LIST_APPEND )
447cdf0e10cSrcweir 		{
448cdf0e10cSrcweir 			Paragraph* pTemp = pOwner->pParaList->LastVisible();
449cdf0e10cSrcweir 			nPara = pOwner->pParaList->GetAbsPos( pTemp );
450cdf0e10cSrcweir 		}
451cdf0e10cSrcweir 		aStartPointWin = pEditView->GetWindowPosTopLeft((sal_uInt16) nPara );
452cdf0e10cSrcweir 		if ( nDDCurPara == LIST_APPEND )
453cdf0e10cSrcweir 		{
454cdf0e10cSrcweir 			long nHeight = pOwner->pEditEngine->GetTextHeight((sal_uInt16)nPara );
455cdf0e10cSrcweir 			aStartPointWin.Y() += nHeight;
456cdf0e10cSrcweir 		}
457cdf0e10cSrcweir 		aStartPointWin.X() = aOutputArWin.Left();
458cdf0e10cSrcweir 		aEndPointWin.Y() = aStartPointWin.Y();
459cdf0e10cSrcweir 		aEndPointWin.X() = aOutputArWin.Right();
460cdf0e10cSrcweir 	}
461cdf0e10cSrcweir 
462cdf0e10cSrcweir 	pWindow->DrawLine( aStartPointWin, aEndPointWin );
463cdf0e10cSrcweir 	pWindow->SetLineColor( rOldLineColor );
464cdf0e10cSrcweir 	pWindow->SetRasterOp( eOldOp );
465cdf0e10cSrcweir }
466cdf0e10cSrcweir 
467cdf0e10cSrcweir // Berechnet, ueber welchem Absatz eingefuegt werden muss
468cdf0e10cSrcweir 
469cdf0e10cSrcweir sal_uLong OutlinerView::ImpGetInsertionPara( const Point& rPosPixel  )
470cdf0e10cSrcweir {
471cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
472cdf0e10cSrcweir 	sal_uLong nCurPara = pEditView->GetParagraph( rPosPixel );
473cdf0e10cSrcweir 	ParagraphList* pParaList = pOwner->pParaList;
474cdf0e10cSrcweir 
475cdf0e10cSrcweir 	if ( nCurPara == EE_PARA_NOT_FOUND )
476cdf0e10cSrcweir 		nCurPara = LIST_APPEND;
477cdf0e10cSrcweir 	else
478cdf0e10cSrcweir 	{
479cdf0e10cSrcweir 		Point aPosWin = pEditView->GetWindow()->PixelToLogic( rPosPixel );
480cdf0e10cSrcweir 		Point aParaPosWin = pEditView->GetWindowPosTopLeft((sal_uInt16)nCurPara);
481cdf0e10cSrcweir 		long nHeightRef = pOwner->pEditEngine->GetTextHeight((sal_uInt16)nCurPara);
482cdf0e10cSrcweir 		long nParaYOffs = aPosWin.Y() - aParaPosWin.Y();
483cdf0e10cSrcweir 
484cdf0e10cSrcweir 		if ( nParaYOffs > nHeightRef / 2  )
485cdf0e10cSrcweir 		{
486cdf0e10cSrcweir 			Paragraph* p = pParaList->GetParagraph( nCurPara );
487cdf0e10cSrcweir 			p = pParaList->NextVisible( p );
488cdf0e10cSrcweir 			nCurPara = p ? pParaList->GetAbsPos( p ) : LIST_APPEND;
489cdf0e10cSrcweir 		}
490cdf0e10cSrcweir 	}
491cdf0e10cSrcweir 	return nCurPara;
492cdf0e10cSrcweir }
493cdf0e10cSrcweir 
494cdf0e10cSrcweir 
495cdf0e10cSrcweir void OutlinerView::ImpToggleExpand( Paragraph* pPara )
496cdf0e10cSrcweir {
497cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
498cdf0e10cSrcweir 
499cdf0e10cSrcweir 	sal_uInt16 nPara = (sal_uInt16) pOwner->pParaList->GetAbsPos( pPara );
500cdf0e10cSrcweir 	pEditView->SetSelection( ESelection( nPara, 0, nPara, 0 ) );
501cdf0e10cSrcweir 	ImplExpandOrCollaps( nPara, nPara, !pOwner->pParaList->HasVisibleChilds( pPara ) );
502cdf0e10cSrcweir 	pEditView->ShowCursor();
503cdf0e10cSrcweir }
504cdf0e10cSrcweir 
505cdf0e10cSrcweir 
506cdf0e10cSrcweir void OutlinerView::SetOutliner( Outliner* pOutliner )
507cdf0e10cSrcweir {
508cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
509cdf0e10cSrcweir 	pOwner = pOutliner;
510cdf0e10cSrcweir 	pEditView->SetEditEngine( pOutliner->pEditEngine );
511cdf0e10cSrcweir }
512cdf0e10cSrcweir 
513cdf0e10cSrcweir 
514cdf0e10cSrcweir 
515cdf0e10cSrcweir sal_uLong OutlinerView::Select( Paragraph* pParagraph, sal_Bool bSelect,
516cdf0e10cSrcweir 	sal_Bool bWithChilds )
517cdf0e10cSrcweir {
518cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
519cdf0e10cSrcweir 
520cdf0e10cSrcweir 	sal_uLong nPara = pOwner->pParaList->GetAbsPos( pParagraph );
521cdf0e10cSrcweir 	sal_uInt16 nEnd = 0;
522cdf0e10cSrcweir 	if ( bSelect )
523cdf0e10cSrcweir 		nEnd = 0xffff;
524cdf0e10cSrcweir 
525cdf0e10cSrcweir 	sal_uLong nChildCount = 0;
526cdf0e10cSrcweir 	if ( bWithChilds )
527cdf0e10cSrcweir 		nChildCount = pOwner->pParaList->GetChildCount( pParagraph );
528cdf0e10cSrcweir 
529cdf0e10cSrcweir 	ESelection aSel( (sal_uInt16)nPara, 0,(sal_uInt16)(nPara+nChildCount), nEnd );
530cdf0e10cSrcweir 	pEditView->SetSelection( aSel );
531cdf0e10cSrcweir 	return nChildCount+1;
532cdf0e10cSrcweir }
533cdf0e10cSrcweir 
534cdf0e10cSrcweir 
535cdf0e10cSrcweir void OutlinerView::SetAttribs( const SfxItemSet& rAttrs )
536cdf0e10cSrcweir {
537cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
538cdf0e10cSrcweir 
539cdf0e10cSrcweir 	sal_Bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
540cdf0e10cSrcweir 	pOwner->pEditEngine->SetUpdateMode( sal_False );
541cdf0e10cSrcweir 
542cdf0e10cSrcweir 	if( !pOwner->IsInUndo() && pOwner->IsUndoEnabled() )
543cdf0e10cSrcweir 		pOwner->UndoActionStart( OLUNDO_ATTR );
544cdf0e10cSrcweir 
545cdf0e10cSrcweir 	ParaRange aSel = ImpGetSelectedParagraphs( sal_False );
546cdf0e10cSrcweir 
547cdf0e10cSrcweir 	pEditView->SetAttribs( rAttrs );
548cdf0e10cSrcweir 
549cdf0e10cSrcweir 	// Bullet-Texte aktualisieren
550cdf0e10cSrcweir 	for( sal_uInt16 nPara= aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
551cdf0e10cSrcweir 	{
552cdf0e10cSrcweir 		pOwner->ImplCheckNumBulletItem( nPara );
553cdf0e10cSrcweir 		pOwner->ImplCalcBulletText( nPara, sal_False, sal_False );
554cdf0e10cSrcweir 
555cdf0e10cSrcweir 		if( !pOwner->IsInUndo() && pOwner->IsUndoEnabled() )
556cdf0e10cSrcweir 			pOwner->InsertUndo( new OutlinerUndoCheckPara( pOwner, nPara ) );
557cdf0e10cSrcweir 	}
558cdf0e10cSrcweir 
559cdf0e10cSrcweir 	if( !pOwner->IsInUndo() && pOwner->IsUndoEnabled() )
560cdf0e10cSrcweir 		pOwner->UndoActionEnd( OLUNDO_ATTR );
561cdf0e10cSrcweir 
562cdf0e10cSrcweir 	pEditView->SetEditEngineUpdateMode( bUpdate );
563cdf0e10cSrcweir }
564cdf0e10cSrcweir 
565cdf0e10cSrcweir ParaRange OutlinerView::ImpGetSelectedParagraphs( sal_Bool bIncludeHiddenChilds )
566cdf0e10cSrcweir {
567cdf0e10cSrcweir 	DBG_CHKTHIS( OutlinerView, 0 );
568cdf0e10cSrcweir 
569cdf0e10cSrcweir 	ESelection aSel = pEditView->GetSelection();
570cdf0e10cSrcweir 	ParaRange aParas( aSel.nStartPara, aSel.nEndPara );
571cdf0e10cSrcweir 	aParas.Adjust();
572cdf0e10cSrcweir 
573cdf0e10cSrcweir 	// unsichtbare Childs des letzten Parents in Selektion mit aufnehmen
574cdf0e10cSrcweir 	if ( bIncludeHiddenChilds )
575cdf0e10cSrcweir 	{
576cdf0e10cSrcweir 		Paragraph* pLast = pOwner->pParaList->GetParagraph( aParas.nEndPara );
577cdf0e10cSrcweir 		if ( pOwner->pParaList->HasHiddenChilds( pLast ) )
578cdf0e10cSrcweir 			aParas.nEndPara =
579cdf0e10cSrcweir                 sal::static_int_cast< sal_uInt16 >(
580cdf0e10cSrcweir                     aParas.nEndPara +
581cdf0e10cSrcweir                     pOwner->pParaList->GetChildCount( pLast ) );
582cdf0e10cSrcweir 	}
583cdf0e10cSrcweir 	return aParas;
584cdf0e10cSrcweir }
585cdf0e10cSrcweir 
586cdf0e10cSrcweir // MT: Name sollte mal geaendert werden!
587cdf0e10cSrcweir void OutlinerView::AdjustDepth( short nDX )
588cdf0e10cSrcweir {
589cdf0e10cSrcweir 	Indent( nDX );
590cdf0e10cSrcweir }
591cdf0e10cSrcweir 
592cdf0e10cSrcweir void OutlinerView::Indent( short nDiff )
593cdf0e10cSrcweir {
594cdf0e10cSrcweir 	DBG_CHKTHIS( OutlinerView, 0 );
595cdf0e10cSrcweir 
596cdf0e10cSrcweir 	if( !nDiff || ( ( nDiff > 0 ) && ImpCalcSelectedPages( sal_True ) && !pOwner->ImpCanIndentSelectedPages( this ) ) )
597cdf0e10cSrcweir 		return;
598cdf0e10cSrcweir 
599cdf0e10cSrcweir 	const bool bOutlinerView = pOwner->pEditEngine->GetControlWord() & EE_CNTRL_OUTLINER;
600cdf0e10cSrcweir 	sal_Bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
601cdf0e10cSrcweir 	pOwner->pEditEngine->SetUpdateMode( sal_False );
602cdf0e10cSrcweir 
603cdf0e10cSrcweir 	sal_Bool bUndo = !pOwner->IsInUndo() && pOwner->IsUndoEnabled();
604cdf0e10cSrcweir 
605cdf0e10cSrcweir 	if( bUndo )
606cdf0e10cSrcweir 		pOwner->UndoActionStart( OLUNDO_DEPTH );
607cdf0e10cSrcweir 
608cdf0e10cSrcweir 	sal_Int16 nMinDepth = -1;	// Optimierung: Nicht unnoetig viele Absatze neu berechnen
609cdf0e10cSrcweir 
610cdf0e10cSrcweir 	ParaRange aSel = ImpGetSelectedParagraphs( sal_True );
611cdf0e10cSrcweir 	for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
612cdf0e10cSrcweir 	{
613cdf0e10cSrcweir 		Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
614cdf0e10cSrcweir 
615cdf0e10cSrcweir 		sal_Int16 nOldDepth = pPara->GetDepth();
616cdf0e10cSrcweir 		sal_Int16 nNewDepth = nOldDepth + nDiff;
617cdf0e10cSrcweir 
618cdf0e10cSrcweir 		if( bOutlinerView && nPara )
619cdf0e10cSrcweir 		{
620cdf0e10cSrcweir 			const bool bPage = pPara->HasFlag(PARAFLAG_ISPAGE);
621cdf0e10cSrcweir 			if( (bPage && (nDiff == +1)) || (!bPage && (nDiff == -1) && (nOldDepth <= 0))  )
622cdf0e10cSrcweir 			{
623cdf0e10cSrcweir 				// App benachrichtigen
624cdf0e10cSrcweir 				pOwner->nDepthChangedHdlPrevDepth = (sal_Int16)nOldDepth;
625cdf0e10cSrcweir 				pOwner->mnDepthChangeHdlPrevFlags = pPara->nFlags;
626cdf0e10cSrcweir 				pOwner->pHdlParagraph = pPara;
627cdf0e10cSrcweir 
628cdf0e10cSrcweir 				if( bPage )
629cdf0e10cSrcweir 					pPara->RemoveFlag( PARAFLAG_ISPAGE );
630cdf0e10cSrcweir 				else
631cdf0e10cSrcweir 					pPara->SetFlag( PARAFLAG_ISPAGE );
632cdf0e10cSrcweir 
633cdf0e10cSrcweir 				pOwner->DepthChangedHdl();
634cdf0e10cSrcweir 				pOwner->pEditEngine->QuickMarkInvalid( ESelection( nPara, 0, nPara, 0 ) );
635cdf0e10cSrcweir 
636cdf0e10cSrcweir 				if( bUndo )
637cdf0e10cSrcweir 					pOwner->InsertUndo( new OutlinerUndoChangeParaFlags( pOwner, nPara, pOwner->mnDepthChangeHdlPrevFlags, pPara->nFlags ) );
638cdf0e10cSrcweir 
639cdf0e10cSrcweir 				continue;
640cdf0e10cSrcweir 			}
641cdf0e10cSrcweir 		}
642cdf0e10cSrcweir 
643cdf0e10cSrcweir         // do not switch off numeration with tab
644cdf0e10cSrcweir         if( (nOldDepth == 0) && (nNewDepth == -1) )
645cdf0e10cSrcweir             continue;
646cdf0e10cSrcweir 
647cdf0e10cSrcweir 		// do not indent if there is no numeration enabled
648cdf0e10cSrcweir 		if( nOldDepth == -1 )
649cdf0e10cSrcweir 			continue;
650cdf0e10cSrcweir 
651cdf0e10cSrcweir 		if ( nNewDepth < pOwner->nMinDepth )
652cdf0e10cSrcweir 			nNewDepth = pOwner->nMinDepth;
653cdf0e10cSrcweir 		if ( nNewDepth > pOwner->nMaxDepth )
654cdf0e10cSrcweir 			nNewDepth = pOwner->nMaxDepth;
655cdf0e10cSrcweir 
656cdf0e10cSrcweir 		if( nOldDepth < nMinDepth )
657cdf0e10cSrcweir 			nMinDepth = nOldDepth;
658cdf0e10cSrcweir 		if( nNewDepth < nMinDepth )
659cdf0e10cSrcweir 			nMinDepth = nNewDepth;
660cdf0e10cSrcweir 
661cdf0e10cSrcweir 		if( nOldDepth != nNewDepth )
662cdf0e10cSrcweir 		{
663cdf0e10cSrcweir 			if ( ( nPara == aSel.nStartPara ) && aSel.nStartPara && ( pOwner->ImplGetOutlinerMode() != OUTLINERMODE_TEXTOBJECT ))
664cdf0e10cSrcweir 			{
665cdf0e10cSrcweir 				// Sonderfall: Der Vorgaenger eines eingerueckten Absatzes ist
666cdf0e10cSrcweir 				// unsichtbar und steht jetzt auf der gleichen Ebene wie der
667cdf0e10cSrcweir 				// sichtbare Absatz. In diesem Fall wird der naechste sichtbare
668cdf0e10cSrcweir 				// Absatz gesucht und aufgeplustert.
669cdf0e10cSrcweir #ifdef DBG_UTIL
670cdf0e10cSrcweir 				Paragraph* _pPara = pOwner->pParaList->GetParagraph( aSel.nStartPara );
671cdf0e10cSrcweir 				DBG_ASSERT(_pPara->IsVisible(),"Selected Paragraph invisible ?!");
672cdf0e10cSrcweir #endif
673cdf0e10cSrcweir 				Paragraph* pPrev= pOwner->pParaList->GetParagraph( aSel.nStartPara-1 );
674cdf0e10cSrcweir 
675cdf0e10cSrcweir 				if( !pPrev->IsVisible() && ( pPrev->GetDepth() == nNewDepth ) )
676cdf0e10cSrcweir 				{
677cdf0e10cSrcweir 					// Vorgaenger ist eingeklappt und steht auf gleicher Ebene
678cdf0e10cSrcweir 					// => naechsten sichtbaren Absatz suchen und expandieren
679cdf0e10cSrcweir 					pPrev = pOwner->pParaList->GetParent( pPrev );
680cdf0e10cSrcweir 					while( !pPrev->IsVisible() )
681cdf0e10cSrcweir 						pPrev = pOwner->pParaList->GetParent( pPrev );
682cdf0e10cSrcweir 
683cdf0e10cSrcweir 					pOwner->Expand( pPrev );
684cdf0e10cSrcweir 					pOwner->InvalidateBullet( pPrev, pOwner->pParaList->GetAbsPos( pPrev ) );
685cdf0e10cSrcweir 				}
686cdf0e10cSrcweir 			}
687cdf0e10cSrcweir 
688cdf0e10cSrcweir 			pOwner->nDepthChangedHdlPrevDepth = (sal_Int16)nOldDepth;
689cdf0e10cSrcweir 			pOwner->mnDepthChangeHdlPrevFlags = pPara->nFlags;
690cdf0e10cSrcweir 			pOwner->pHdlParagraph = pPara;
691cdf0e10cSrcweir 
692cdf0e10cSrcweir 			pOwner->ImplInitDepth( nPara, nNewDepth, sal_True, sal_False );
693cdf0e10cSrcweir 			pOwner->ImplCalcBulletText( nPara, sal_False, sal_False );
694cdf0e10cSrcweir 
695cdf0e10cSrcweir 			if ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_OUTLINEOBJECT )
696cdf0e10cSrcweir 				pOwner->ImplSetLevelDependendStyleSheet( nPara );
697cdf0e10cSrcweir 
698cdf0e10cSrcweir 			// App benachrichtigen
699cdf0e10cSrcweir 			pOwner->DepthChangedHdl();
700cdf0e10cSrcweir 		}
701cdf0e10cSrcweir         else
702cdf0e10cSrcweir         {
703cdf0e10cSrcweir             // Needs at least a repaint...
704cdf0e10cSrcweir             pOwner->pEditEngine->QuickMarkInvalid( ESelection( nPara, 0, nPara, 0 ) );
705cdf0e10cSrcweir         }
706cdf0e10cSrcweir 	}
707cdf0e10cSrcweir 
708cdf0e10cSrcweir 	// MT 19.08.99: War mal fuer Optimierung (outliner.cxx#1.193),
709cdf0e10cSrcweir 	// hat aber zu zuviel Wartungsaufwand / doppelten Funktionen gefuehrt
710cdf0e10cSrcweir 	// und zu wenig gebracht:
711cdf0e10cSrcweir 	// pOwner->ImpSetBulletTextsFrom( aSel.nStartPara+1, nMinDepth );
712cdf0e10cSrcweir 	// Wird jetzt direkt in Schleife mit ImplCalcBulletText() erledigt.
713cdf0e10cSrcweir 	// Jetzt fehlen nur noch die folgenden Ansaetze, die davon betroffen sind.
714cdf0e10cSrcweir 	sal_uInt16 nParas = (sal_uInt16)pOwner->pParaList->GetParagraphCount();
715cdf0e10cSrcweir 	for ( sal_uInt16 n = aSel.nEndPara+1; n < nParas; n++ )
716cdf0e10cSrcweir 	{
717cdf0e10cSrcweir 		Paragraph* pPara = pOwner->pParaList->GetParagraph( n );
718cdf0e10cSrcweir 		if ( pPara->GetDepth() < nMinDepth )
719cdf0e10cSrcweir 			break;
720cdf0e10cSrcweir 		pOwner->ImplCalcBulletText( n, sal_False, sal_False );
721cdf0e10cSrcweir 	}
722cdf0e10cSrcweir 
723cdf0e10cSrcweir 	if ( bUpdate )
724cdf0e10cSrcweir 	{
725cdf0e10cSrcweir 		pEditView->SetEditEngineUpdateMode( sal_True );
726cdf0e10cSrcweir 		pEditView->ShowCursor();
727cdf0e10cSrcweir 	}
728cdf0e10cSrcweir 
729cdf0e10cSrcweir 	if( bUndo )
730cdf0e10cSrcweir 		pOwner->UndoActionEnd( OLUNDO_DEPTH );
731cdf0e10cSrcweir }
732cdf0e10cSrcweir 
733cdf0e10cSrcweir sal_Bool OutlinerView::AdjustHeight( long nDY )
734cdf0e10cSrcweir {
735cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
736cdf0e10cSrcweir     pEditView->MoveParagraphs( nDY );
737cdf0e10cSrcweir     return sal_True;    // remove return value...
738cdf0e10cSrcweir }
739cdf0e10cSrcweir 
740cdf0e10cSrcweir void OutlinerView::AdjustDepth( Paragraph* pPara, short nDX, sal_Bool bWithChilds)
741cdf0e10cSrcweir {
742cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
743cdf0e10cSrcweir 	sal_uLong nStartPara = pOwner->pParaList->GetAbsPos( pPara );
744cdf0e10cSrcweir 	sal_uLong nEndPara = nStartPara;
745cdf0e10cSrcweir 	if ( bWithChilds )
746cdf0e10cSrcweir 		nEndPara += pOwner->pParaList->GetChildCount( pPara );
747cdf0e10cSrcweir 	ESelection aSel((sal_uInt16)nStartPara, 0,(sal_uInt16)nEndPara, 0xffff );
748cdf0e10cSrcweir 	pEditView->SetSelection( aSel );
749cdf0e10cSrcweir 	AdjustDepth( nDX );
750cdf0e10cSrcweir }
751cdf0e10cSrcweir 
752cdf0e10cSrcweir void OutlinerView::AdjustHeight( Paragraph* pPara, long nDY, sal_Bool bWithChilds )
753cdf0e10cSrcweir {
754cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
755cdf0e10cSrcweir 	sal_uLong nStartPara = pOwner->pParaList->GetAbsPos( pPara );
756cdf0e10cSrcweir 	sal_uLong nEndPara = nStartPara;
757cdf0e10cSrcweir 	if ( bWithChilds )
758cdf0e10cSrcweir 		nEndPara += pOwner->pParaList->GetChildCount( pPara );
759cdf0e10cSrcweir 	ESelection aSel( (sal_uInt16)nStartPara, 0, (sal_uInt16)nEndPara, 0xffff );
760cdf0e10cSrcweir 	pEditView->SetSelection( aSel );
761cdf0e10cSrcweir 	AdjustHeight( nDY );
762cdf0e10cSrcweir }
763cdf0e10cSrcweir 
764cdf0e10cSrcweir 
765cdf0e10cSrcweir Rectangle OutlinerView::GetVisArea() const
766cdf0e10cSrcweir {
767cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
768cdf0e10cSrcweir 	return pEditView->GetVisArea();
769cdf0e10cSrcweir }
770cdf0e10cSrcweir 
771cdf0e10cSrcweir 
772cdf0e10cSrcweir Point OutlinerView::ImpGetDocPos( const Point& rPosPixel )
773cdf0e10cSrcweir {
774cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
775cdf0e10cSrcweir 	Rectangle aOutArWin = GetOutputArea();
776cdf0e10cSrcweir 	// Position in der OutputArea berechnen
777cdf0e10cSrcweir 	Point aCurPosDoc( rPosPixel );
778cdf0e10cSrcweir 	aCurPosDoc = pEditView->GetWindow()->PixelToLogic( aCurPosDoc );
779cdf0e10cSrcweir 	aCurPosDoc -= aOutArWin.TopLeft();
780cdf0e10cSrcweir 	aCurPosDoc += pEditView->GetVisArea().TopLeft();
781cdf0e10cSrcweir 	return aCurPosDoc;
782cdf0e10cSrcweir }
783cdf0e10cSrcweir 
784cdf0e10cSrcweir // MT 05/00: Wofuer dies ImpXXXScroll, sollte das nicht die EditEngine machen???
785cdf0e10cSrcweir 
786cdf0e10cSrcweir void OutlinerView::ImpDragScroll( const Point& rPosPix )
787cdf0e10cSrcweir {
788cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
789cdf0e10cSrcweir 	Point aPosWin = pEditView->GetWindow()->PixelToLogic( rPosPix );
790cdf0e10cSrcweir 	Rectangle aOutputArWin = pEditView->GetOutputArea();
791cdf0e10cSrcweir 	if ( aPosWin.X() <= aOutputArWin.Left() + nDDScrollLRBorderWidthWin)
792cdf0e10cSrcweir 		ImpScrollLeft();
793cdf0e10cSrcweir 	else if( aPosWin.X() >= aOutputArWin.Right()- nDDScrollLRBorderWidthWin)
794cdf0e10cSrcweir 		ImpScrollRight();
795cdf0e10cSrcweir 	else if( aPosWin.Y() <= aOutputArWin.Top() + nDDScrollTBBorderWidthWin)
796cdf0e10cSrcweir 		ImpScrollUp();
797cdf0e10cSrcweir 	else if(aPosWin.Y() >= aOutputArWin.Bottom() - nDDScrollTBBorderWidthWin)
798cdf0e10cSrcweir 		ImpScrollDown();
799cdf0e10cSrcweir }
800cdf0e10cSrcweir 
801cdf0e10cSrcweir 
802cdf0e10cSrcweir void OutlinerView::ImpScrollLeft()
803cdf0e10cSrcweir {
804cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
805cdf0e10cSrcweir 	Rectangle aVisArea( pEditView->GetVisArea() );
806cdf0e10cSrcweir 	long nMaxScrollOffs = aVisArea.Left();
807cdf0e10cSrcweir 	if ( !nMaxScrollOffs )
808cdf0e10cSrcweir 		return;
809cdf0e10cSrcweir 	long nScrollOffsRef = (aVisArea.GetWidth() * OL_SCROLL_HOROFFSET) / 100;
810cdf0e10cSrcweir 	if ( !nScrollOffsRef )
811cdf0e10cSrcweir 		nScrollOffsRef = 1;
812cdf0e10cSrcweir 	if ( nScrollOffsRef > nMaxScrollOffs )
813cdf0e10cSrcweir 		nScrollOffsRef = nMaxScrollOffs;
814cdf0e10cSrcweir 
815cdf0e10cSrcweir 	ImpHideDDCursor();
816cdf0e10cSrcweir 	Scroll( -nScrollOffsRef, 0 );
817cdf0e10cSrcweir 
818cdf0e10cSrcweir 	EditStatus aScrollStat;
819cdf0e10cSrcweir 	aScrollStat.GetStatusWord() = EE_STAT_HSCROLL;
820cdf0e10cSrcweir 	pOwner->pEditEngine->GetStatusEventHdl().Call( &aScrollStat );
821cdf0e10cSrcweir }
822cdf0e10cSrcweir 
823cdf0e10cSrcweir 
824cdf0e10cSrcweir void OutlinerView::ImpScrollRight()
825cdf0e10cSrcweir {
826cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
827cdf0e10cSrcweir 	Rectangle aVisArea( pEditView->GetVisArea() );
828cdf0e10cSrcweir 	long nMaxScrollOffs = pOwner->pEditEngine->GetPaperSize().Width() -
829cdf0e10cSrcweir 						  aVisArea.Right();
830cdf0e10cSrcweir 	if ( !nMaxScrollOffs )
831cdf0e10cSrcweir 		return;
832cdf0e10cSrcweir 	long nScrollOffsRef = (aVisArea.GetWidth() * OL_SCROLL_HOROFFSET) / 100;
833cdf0e10cSrcweir 	if ( !nScrollOffsRef )
834cdf0e10cSrcweir 		nScrollOffsRef = 1;
835cdf0e10cSrcweir 	if ( nScrollOffsRef > nMaxScrollOffs )
836cdf0e10cSrcweir 		nScrollOffsRef = nMaxScrollOffs;
837cdf0e10cSrcweir 
838cdf0e10cSrcweir 	ImpHideDDCursor();
839cdf0e10cSrcweir 	Scroll( nScrollOffsRef, 0 );
840cdf0e10cSrcweir 
841cdf0e10cSrcweir 	EditStatus aScrollStat;
842cdf0e10cSrcweir 	aScrollStat.GetStatusWord() = EE_STAT_HSCROLL;
843cdf0e10cSrcweir 	pOwner->pEditEngine->GetStatusEventHdl().Call( &aScrollStat );
844cdf0e10cSrcweir }
845cdf0e10cSrcweir 
846cdf0e10cSrcweir 
847cdf0e10cSrcweir void OutlinerView::ImpScrollDown()
848cdf0e10cSrcweir {
849cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
850cdf0e10cSrcweir 	Rectangle aVisArea( pEditView->GetVisArea() );
851cdf0e10cSrcweir 	Size aDocSize( 0, (long)pOwner->pEditEngine->GetTextHeight() );
852cdf0e10cSrcweir 
853cdf0e10cSrcweir 	long nMaxScrollOffs = aDocSize.Height();
854cdf0e10cSrcweir 	nMaxScrollOffs -= aVisArea.Top();
855cdf0e10cSrcweir 	nMaxScrollOffs -= aVisArea.GetHeight();
856cdf0e10cSrcweir 	if ( !nMaxScrollOffs )
857cdf0e10cSrcweir 		return;
858cdf0e10cSrcweir 
859cdf0e10cSrcweir 	long nScrollOffsRef = (aVisArea.GetHeight() * OL_SCROLL_VEROFFSET) / 100;
860cdf0e10cSrcweir 
861cdf0e10cSrcweir 	if ( nScrollOffsRef > nMaxScrollOffs )
862cdf0e10cSrcweir 		nScrollOffsRef = nMaxScrollOffs;
863cdf0e10cSrcweir 	if ( !nScrollOffsRef )
864cdf0e10cSrcweir 		nScrollOffsRef = 1;
865cdf0e10cSrcweir 
866cdf0e10cSrcweir 	ImpHideDDCursor();
867cdf0e10cSrcweir 	Scroll( 0, -nScrollOffsRef );
868cdf0e10cSrcweir 
869cdf0e10cSrcweir 	EditStatus aScrollStat;
870cdf0e10cSrcweir 	aScrollStat.GetStatusWord() = EE_STAT_VSCROLL;
871cdf0e10cSrcweir 	pOwner->pEditEngine->GetStatusEventHdl().Call( &aScrollStat );
872cdf0e10cSrcweir }
873cdf0e10cSrcweir 
874cdf0e10cSrcweir 
875cdf0e10cSrcweir void OutlinerView::ImpScrollUp()
876cdf0e10cSrcweir {
877cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
878cdf0e10cSrcweir 	Rectangle aVisArea( pEditView->GetVisArea() );
879cdf0e10cSrcweir 	long nMaxScrollOffs = aVisArea.Top();
880cdf0e10cSrcweir 	if ( !nMaxScrollOffs )
881cdf0e10cSrcweir 		return;
882cdf0e10cSrcweir 	long nScrollOffsRef = (aVisArea.GetHeight() * OL_SCROLL_VEROFFSET) / 100;
883cdf0e10cSrcweir 
884cdf0e10cSrcweir 
885cdf0e10cSrcweir 	if ( nScrollOffsRef > nMaxScrollOffs )
886cdf0e10cSrcweir 		nScrollOffsRef = nMaxScrollOffs;
887cdf0e10cSrcweir 	if ( !nScrollOffsRef )
888cdf0e10cSrcweir 		nScrollOffsRef = 1;
889cdf0e10cSrcweir 
890cdf0e10cSrcweir 	ImpHideDDCursor();
891cdf0e10cSrcweir 	Scroll( 0, nScrollOffsRef );
892cdf0e10cSrcweir 
893cdf0e10cSrcweir 	EditStatus aScrollStat;
894cdf0e10cSrcweir 	aScrollStat.GetStatusWord() = EE_STAT_VSCROLL;
895cdf0e10cSrcweir 	pOwner->pEditEngine->GetStatusEventHdl().Call( &aScrollStat );
896cdf0e10cSrcweir }
897cdf0e10cSrcweir 
898cdf0e10cSrcweir 
899cdf0e10cSrcweir void OutlinerView::Expand()
900cdf0e10cSrcweir {
901cdf0e10cSrcweir 	DBG_CHKTHIS( OutlinerView, 0 );
902cdf0e10cSrcweir 	ParaRange aParas = ImpGetSelectedParagraphs( sal_False );
903cdf0e10cSrcweir 	ImplExpandOrCollaps( aParas.nStartPara, aParas.nEndPara, sal_True );
904cdf0e10cSrcweir }
905cdf0e10cSrcweir 
906cdf0e10cSrcweir 
907cdf0e10cSrcweir void OutlinerView::Collapse()
908cdf0e10cSrcweir {
909cdf0e10cSrcweir 	DBG_CHKTHIS( OutlinerView, 0 );
910cdf0e10cSrcweir 	ParaRange aParas = ImpGetSelectedParagraphs( sal_False );
911cdf0e10cSrcweir 	ImplExpandOrCollaps( aParas.nStartPara, aParas.nEndPara, sal_False );
912cdf0e10cSrcweir }
913cdf0e10cSrcweir 
914cdf0e10cSrcweir 
915cdf0e10cSrcweir void OutlinerView::ExpandAll()
916cdf0e10cSrcweir {
917cdf0e10cSrcweir 	DBG_CHKTHIS( OutlinerView, 0 );
918cdf0e10cSrcweir 	ImplExpandOrCollaps( 0, (sal_uInt16)(pOwner->pParaList->GetParagraphCount()-1), sal_True );
919cdf0e10cSrcweir }
920cdf0e10cSrcweir 
921cdf0e10cSrcweir 
922cdf0e10cSrcweir void OutlinerView::CollapseAll()
923cdf0e10cSrcweir {
924cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
925cdf0e10cSrcweir 	ImplExpandOrCollaps( 0, (sal_uInt16)(pOwner->pParaList->GetParagraphCount()-1), sal_False );
926cdf0e10cSrcweir }
927cdf0e10cSrcweir 
928cdf0e10cSrcweir void OutlinerView::ImplExpandOrCollaps( sal_uInt16 nStartPara, sal_uInt16 nEndPara, sal_Bool bExpand )
929cdf0e10cSrcweir {
930cdf0e10cSrcweir 	DBG_CHKTHIS( OutlinerView, 0 );
931cdf0e10cSrcweir 
932cdf0e10cSrcweir 	sal_Bool bUpdate = pOwner->GetUpdateMode();
933cdf0e10cSrcweir 	pOwner->SetUpdateMode( sal_False );
934cdf0e10cSrcweir 
935cdf0e10cSrcweir 	sal_Bool bUndo = !pOwner->IsInUndo() && pOwner->IsUndoEnabled();
936cdf0e10cSrcweir 	if( bUndo )
937cdf0e10cSrcweir 		pOwner->UndoActionStart( bExpand ? OLUNDO_EXPAND : OLUNDO_COLLAPSE );
938cdf0e10cSrcweir 
939cdf0e10cSrcweir 	for ( sal_uInt16 nPara = nStartPara; nPara <= nEndPara; nPara++ )
940cdf0e10cSrcweir 	{
941cdf0e10cSrcweir 		Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
942cdf0e10cSrcweir 		sal_Bool bDone = bExpand ? pOwner->Expand( pPara ) : pOwner->Collapse( pPara );
943cdf0e10cSrcweir 		if( bDone )
944cdf0e10cSrcweir 		{
945cdf0e10cSrcweir 			// Der Strich unter dem Absatz muss verschwinden...
946cdf0e10cSrcweir 			pOwner->pEditEngine->QuickMarkToBeRepainted( nPara );
947cdf0e10cSrcweir 		}
948cdf0e10cSrcweir 	}
949cdf0e10cSrcweir 
950cdf0e10cSrcweir 	if( bUndo )
951cdf0e10cSrcweir 		pOwner->UndoActionEnd( bExpand ? OLUNDO_EXPAND : OLUNDO_COLLAPSE );
952cdf0e10cSrcweir 
953cdf0e10cSrcweir 	if ( bUpdate )
954cdf0e10cSrcweir 	{
955cdf0e10cSrcweir 		pOwner->SetUpdateMode( sal_True );
956cdf0e10cSrcweir 		pEditView->ShowCursor();
957cdf0e10cSrcweir 	}
958cdf0e10cSrcweir }
959cdf0e10cSrcweir 
960cdf0e10cSrcweir 
961cdf0e10cSrcweir void OutlinerView::Expand( Paragraph* pPara)
962cdf0e10cSrcweir {
963cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
964cdf0e10cSrcweir 	pOwner->Expand( pPara );
965cdf0e10cSrcweir }
966cdf0e10cSrcweir 
967cdf0e10cSrcweir 
968cdf0e10cSrcweir void OutlinerView::Collapse( Paragraph* pPara)
969cdf0e10cSrcweir {
970cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
971cdf0e10cSrcweir 	pOwner->Collapse( pPara );
972cdf0e10cSrcweir }
973cdf0e10cSrcweir 
974cdf0e10cSrcweir void OutlinerView::InsertText( const OutlinerParaObject& rParaObj )
975cdf0e10cSrcweir {
976cdf0e10cSrcweir 	// MT: Wie Paste, nur EditView::Insert, statt EditView::Paste.
977cdf0e10cSrcweir 	// Eigentlich nicht ganz richtig, das evtl. Einrueckungen
978cdf0e10cSrcweir 	// korrigiert werden muessen, aber das kommt spaeter durch ein
979cdf0e10cSrcweir 	// allgemeingueltiges Import.
980cdf0e10cSrcweir 	// Dann wird im Inserted gleich ermittelt, was f�r eine Einrueckebene
981cdf0e10cSrcweir 	// Moegliche Struktur:
982cdf0e10cSrcweir 	// pImportInfo mit DestPara, DestPos, nFormat, pParaObj...
983cdf0e10cSrcweir 	// Evtl. Problematisch:
984cdf0e10cSrcweir 	// EditEngine, RTF => Absplittung des Bereichs, spaeter
985cdf0e10cSrcweir 	// zusammenfuehrung
986cdf0e10cSrcweir 
987cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
988cdf0e10cSrcweir 
989cdf0e10cSrcweir 	if ( ImpCalcSelectedPages( sal_False ) && !pOwner->ImpCanDeleteSelectedPages( this ) )
990cdf0e10cSrcweir 		return;
991cdf0e10cSrcweir 
992cdf0e10cSrcweir 	pOwner->UndoActionStart( OLUNDO_INSERT );
993cdf0e10cSrcweir 
994cdf0e10cSrcweir 	pOwner->pEditEngine->SetUpdateMode( sal_False );
995cdf0e10cSrcweir 	sal_uLong nStart, nParaCount;
996cdf0e10cSrcweir 	nParaCount = pOwner->pEditEngine->GetParagraphCount();
997cdf0e10cSrcweir 	sal_uInt16 nSize = ImpInitPaste( nStart );
998cdf0e10cSrcweir 	pEditView->InsertText( rParaObj.GetTextObject() );
999cdf0e10cSrcweir 	ImpPasted( nStart, nParaCount, nSize);
1000cdf0e10cSrcweir 	pEditView->SetEditEngineUpdateMode( sal_True );
1001cdf0e10cSrcweir 
1002cdf0e10cSrcweir 	pOwner->UndoActionEnd( OLUNDO_INSERT );
1003cdf0e10cSrcweir 
1004cdf0e10cSrcweir 	pEditView->ShowCursor( sal_True, sal_True );
1005cdf0e10cSrcweir }
1006cdf0e10cSrcweir 
1007cdf0e10cSrcweir 
1008cdf0e10cSrcweir 
1009cdf0e10cSrcweir void OutlinerView::Cut()
1010cdf0e10cSrcweir {
1011cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1012cdf0e10cSrcweir 	if ( !ImpCalcSelectedPages( sal_False ) || pOwner->ImpCanDeleteSelectedPages( this ) )
1013cdf0e10cSrcweir 		pEditView->Cut();
1014cdf0e10cSrcweir }
1015cdf0e10cSrcweir 
1016cdf0e10cSrcweir void OutlinerView::Paste()
1017cdf0e10cSrcweir {
1018cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1019cdf0e10cSrcweir     PasteSpecial(); // HACK(SD ruft nicht PasteSpecial auf)
1020cdf0e10cSrcweir }
1021cdf0e10cSrcweir 
1022cdf0e10cSrcweir void OutlinerView::PasteSpecial()
1023cdf0e10cSrcweir {
1024cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1025cdf0e10cSrcweir 	if ( !ImpCalcSelectedPages( sal_False ) || pOwner->ImpCanDeleteSelectedPages( this ) )
1026cdf0e10cSrcweir 	{
1027cdf0e10cSrcweir 		pOwner->UndoActionStart( OLUNDO_INSERT );
1028cdf0e10cSrcweir 
1029cdf0e10cSrcweir 		pOwner->pEditEngine->SetUpdateMode( sal_False );
1030cdf0e10cSrcweir         pOwner->bPasting = sal_True;
1031cdf0e10cSrcweir         pEditView->PasteSpecial();
1032cdf0e10cSrcweir 
1033cdf0e10cSrcweir 		if ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_OUTLINEOBJECT )
1034cdf0e10cSrcweir 		{
1035cdf0e10cSrcweir         	const sal_uInt16 nParaCount = pOwner->pEditEngine->GetParagraphCount();
1036cdf0e10cSrcweir 
1037cdf0e10cSrcweir 		    for( sal_uInt16 nPara = 0; nPara < nParaCount; nPara++ )
1038cdf0e10cSrcweir 			    pOwner->ImplSetLevelDependendStyleSheet( nPara );
1039cdf0e10cSrcweir 	    }
1040cdf0e10cSrcweir 
1041cdf0e10cSrcweir         pEditView->SetEditEngineUpdateMode( sal_True );
1042cdf0e10cSrcweir 		pOwner->UndoActionEnd( OLUNDO_INSERT );
1043cdf0e10cSrcweir 		pEditView->ShowCursor( sal_True, sal_True );
1044cdf0e10cSrcweir 	}
1045cdf0e10cSrcweir }
1046cdf0e10cSrcweir 
1047cdf0e10cSrcweir List* OutlinerView::CreateSelectionList()
1048cdf0e10cSrcweir {
1049cdf0e10cSrcweir 	DBG_CHKTHIS( OutlinerView, 0 );
1050cdf0e10cSrcweir 
1051cdf0e10cSrcweir 	ParaRange aParas = ImpGetSelectedParagraphs( sal_True );
1052cdf0e10cSrcweir 	List* pSelList = new List;
1053cdf0e10cSrcweir 	for ( sal_uInt16 nPara = aParas.nStartPara; nPara <= aParas.nEndPara; nPara++ )
1054cdf0e10cSrcweir 	{
1055cdf0e10cSrcweir 		Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
1056cdf0e10cSrcweir 		pSelList->Insert( pPara, LIST_APPEND );
1057cdf0e10cSrcweir 	}
1058cdf0e10cSrcweir 	return pSelList;
1059cdf0e10cSrcweir }
1060cdf0e10cSrcweir 
1061cdf0e10cSrcweir SfxStyleSheet* OutlinerView::GetStyleSheet() const
1062cdf0e10cSrcweir {
1063cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1064cdf0e10cSrcweir 	return pEditView->GetStyleSheet();
1065cdf0e10cSrcweir }
1066cdf0e10cSrcweir 
1067cdf0e10cSrcweir void OutlinerView::SetStyleSheet( SfxStyleSheet* pStyle )
1068cdf0e10cSrcweir {
1069cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1070cdf0e10cSrcweir 	pEditView->SetStyleSheet( pStyle );
1071cdf0e10cSrcweir 
1072cdf0e10cSrcweir 	ParaRange aSel = ImpGetSelectedParagraphs( sal_True );
1073cdf0e10cSrcweir 	for( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
1074cdf0e10cSrcweir 	{
1075cdf0e10cSrcweir 		pOwner->ImplCheckNumBulletItem( nPara );
1076cdf0e10cSrcweir 		pOwner->ImplCalcBulletText( nPara, sal_False, sal_False );
1077cdf0e10cSrcweir 	}
1078cdf0e10cSrcweir }
1079cdf0e10cSrcweir 
1080cdf0e10cSrcweir Pointer OutlinerView::GetPointer( const Point& rPosPixel )
1081cdf0e10cSrcweir {
1082cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1083cdf0e10cSrcweir 
1084cdf0e10cSrcweir     MouseTarget eTarget;
1085cdf0e10cSrcweir 	ImpCheckMousePos( rPosPixel, eTarget );
1086cdf0e10cSrcweir 
1087cdf0e10cSrcweir     PointerStyle ePointerStyle = POINTER_ARROW;
1088cdf0e10cSrcweir     if ( eTarget == MouseText )
1089cdf0e10cSrcweir     {
1090cdf0e10cSrcweir         ePointerStyle = GetOutliner()->IsVertical() ? POINTER_TEXT_VERTICAL : POINTER_TEXT;
1091cdf0e10cSrcweir     }
1092cdf0e10cSrcweir     else if ( eTarget == MouseHypertext )
1093cdf0e10cSrcweir     {
1094cdf0e10cSrcweir         ePointerStyle = POINTER_REFHAND;
1095cdf0e10cSrcweir     }
1096cdf0e10cSrcweir     else if ( eTarget == MouseBullet )
1097cdf0e10cSrcweir     {
1098cdf0e10cSrcweir         ePointerStyle = POINTER_MOVE;
1099cdf0e10cSrcweir     }
1100cdf0e10cSrcweir 
1101cdf0e10cSrcweir     return Pointer( ePointerStyle );
1102cdf0e10cSrcweir }
1103cdf0e10cSrcweir 
1104cdf0e10cSrcweir 
1105cdf0e10cSrcweir sal_uInt16 OutlinerView::ImpInitPaste( sal_uLong& rStart )
1106cdf0e10cSrcweir {
1107cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1108cdf0e10cSrcweir 	pOwner->bPasting = sal_True;
1109cdf0e10cSrcweir 	ESelection aSelection( pEditView->GetSelection() );
1110cdf0e10cSrcweir 	aSelection.Adjust();
1111cdf0e10cSrcweir 	rStart = aSelection.nStartPara;
1112cdf0e10cSrcweir 	sal_uInt16 nSize = aSelection.nEndPara - aSelection.nStartPara + 1;
1113cdf0e10cSrcweir 	return nSize;
1114cdf0e10cSrcweir }
1115cdf0e10cSrcweir 
1116cdf0e10cSrcweir 
1117cdf0e10cSrcweir void OutlinerView::ImpPasted( sal_uLong nStart, sal_uLong nPrevParaCount, sal_uInt16 nSize)
1118cdf0e10cSrcweir {
1119cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1120cdf0e10cSrcweir 	pOwner->bPasting = sal_False;
1121cdf0e10cSrcweir 	sal_uLong nCurParaCount = (sal_uLong)pOwner->pEditEngine->GetParagraphCount();
1122cdf0e10cSrcweir 	if( nCurParaCount < nPrevParaCount )
1123cdf0e10cSrcweir 		nSize = sal::static_int_cast< sal_uInt16 >(
1124cdf0e10cSrcweir             nSize - ( nPrevParaCount - nCurParaCount ) );
1125cdf0e10cSrcweir 	else
1126cdf0e10cSrcweir 		nSize = sal::static_int_cast< sal_uInt16 >(
1127cdf0e10cSrcweir             nSize + ( nCurParaCount - nPrevParaCount ) );
1128cdf0e10cSrcweir 	pOwner->ImpTextPasted( nStart, nSize );
1129cdf0e10cSrcweir }
1130cdf0e10cSrcweir 
1131cdf0e10cSrcweir 
1132cdf0e10cSrcweir void OutlinerView::Command( const CommandEvent& rCEvt )
1133cdf0e10cSrcweir {
1134cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1135cdf0e10cSrcweir 	pEditView->Command( rCEvt );
1136cdf0e10cSrcweir }
1137cdf0e10cSrcweir 
1138cdf0e10cSrcweir 
1139cdf0e10cSrcweir void OutlinerView::SelectRange( sal_uLong nFirst, sal_uInt16 nCount )
1140cdf0e10cSrcweir {
1141cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1142cdf0e10cSrcweir 	sal_uLong nLast = nFirst+nCount;
1143cdf0e10cSrcweir 	nCount = (sal_uInt16)pOwner->pParaList->GetParagraphCount();
1144cdf0e10cSrcweir 	if( nLast <= nCount )
1145cdf0e10cSrcweir 		nLast = nCount - 1;
1146cdf0e10cSrcweir 	ESelection aSel( (sal_uInt16)nFirst, 0, (sal_uInt16)nLast, 0xffff );
1147cdf0e10cSrcweir 	pEditView->SetSelection( aSel );
1148cdf0e10cSrcweir }
1149cdf0e10cSrcweir 
1150cdf0e10cSrcweir 
1151cdf0e10cSrcweir sal_uInt16 OutlinerView::ImpCalcSelectedPages( sal_Bool bIncludeFirstSelected )
1152cdf0e10cSrcweir {
1153cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1154cdf0e10cSrcweir 
1155cdf0e10cSrcweir 	ESelection aSel( pEditView->GetSelection() );
1156cdf0e10cSrcweir 	aSel.Adjust();
1157cdf0e10cSrcweir 
1158cdf0e10cSrcweir 	sal_uInt16 nPages = 0;
1159cdf0e10cSrcweir 	sal_uInt16 nFirstPage = 0xFFFF;
1160cdf0e10cSrcweir 	sal_uInt16 nStartPara = aSel.nStartPara;
1161cdf0e10cSrcweir 	if ( !bIncludeFirstSelected )
1162cdf0e10cSrcweir 		nStartPara++;	// alle nach StartPara kommenden Absaetze werden geloescht
1163cdf0e10cSrcweir 	for ( sal_uInt16 nPara = nStartPara; nPara <= aSel.nEndPara; nPara++ )
1164cdf0e10cSrcweir 	{
1165cdf0e10cSrcweir 		Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
1166cdf0e10cSrcweir 		DBG_ASSERT(pPara, "ImpCalcSelectedPages: ungueltige Selection? ");
1167cdf0e10cSrcweir 		if( pPara->HasFlag(PARAFLAG_ISPAGE) )
1168cdf0e10cSrcweir 		{
1169cdf0e10cSrcweir 			nPages++;
1170cdf0e10cSrcweir 			if( nFirstPage == 0xFFFF )
1171cdf0e10cSrcweir 				nFirstPage = nPara;
1172cdf0e10cSrcweir 		}
1173cdf0e10cSrcweir 	}
1174cdf0e10cSrcweir 
1175cdf0e10cSrcweir 	if( nPages )
1176cdf0e10cSrcweir 	{
1177cdf0e10cSrcweir 		pOwner->nDepthChangedHdlPrevDepth = nPages;
1178cdf0e10cSrcweir 		pOwner->pHdlParagraph = 0;
1179cdf0e10cSrcweir 		pOwner->mnFirstSelPage = nFirstPage;
1180cdf0e10cSrcweir 	}
1181cdf0e10cSrcweir 
1182cdf0e10cSrcweir 	return nPages;
1183cdf0e10cSrcweir }
1184cdf0e10cSrcweir 
1185cdf0e10cSrcweir 
1186cdf0e10cSrcweir void OutlinerView::ToggleBullets()
1187cdf0e10cSrcweir {
1188*af89ca6eSOliver-Rainer Wittmann     pOwner->UndoActionStart( OLUNDO_DEPTH );
1189cdf0e10cSrcweir 
1190*af89ca6eSOliver-Rainer Wittmann     ESelection aSel( pEditView->GetSelection() );
1191*af89ca6eSOliver-Rainer Wittmann     aSel.Adjust();
1192cdf0e10cSrcweir 
1193*af89ca6eSOliver-Rainer Wittmann     const bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
1194*af89ca6eSOliver-Rainer Wittmann     pOwner->pEditEngine->SetUpdateMode( sal_False );
1195cdf0e10cSrcweir 
1196*af89ca6eSOliver-Rainer Wittmann     sal_Int16 nNewDepth = -2;
1197*af89ca6eSOliver-Rainer Wittmann     const SvxNumRule* pDefaultBulletNumRule = 0;
1198cdf0e10cSrcweir 
1199*af89ca6eSOliver-Rainer Wittmann     for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
1200*af89ca6eSOliver-Rainer Wittmann     {
1201*af89ca6eSOliver-Rainer Wittmann         Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
1202*af89ca6eSOliver-Rainer Wittmann         DBG_ASSERT(pPara, "OutlinerView::ToggleBullets(), illegal selection?");
1203cdf0e10cSrcweir 
1204*af89ca6eSOliver-Rainer Wittmann         if( pPara )
1205*af89ca6eSOliver-Rainer Wittmann         {
1206*af89ca6eSOliver-Rainer Wittmann             if( nNewDepth == -2 )
1207*af89ca6eSOliver-Rainer Wittmann             {
1208*af89ca6eSOliver-Rainer Wittmann                 nNewDepth = (pOwner->GetDepth(nPara) == -1) ? 0 : -1;
1209*af89ca6eSOliver-Rainer Wittmann                 if ( nNewDepth == 0 )
1210*af89ca6eSOliver-Rainer Wittmann                 {
1211*af89ca6eSOliver-Rainer Wittmann                     // determine default numbering rule for bullets
1212*af89ca6eSOliver-Rainer Wittmann                     const ESelection aSelection(nPara, 0);
1213*af89ca6eSOliver-Rainer Wittmann                     const SfxItemSet aTmpSet(pOwner->pEditEngine->GetAttribs(aSelection));
1214*af89ca6eSOliver-Rainer Wittmann                     const SfxPoolItem& rPoolItem = aTmpSet.GetPool()->GetDefaultItem( EE_PARA_NUMBULLET );
1215*af89ca6eSOliver-Rainer Wittmann                     const SvxNumBulletItem* pNumBulletItem = dynamic_cast< const SvxNumBulletItem* >(&rPoolItem);
1216*af89ca6eSOliver-Rainer Wittmann                     pDefaultBulletNumRule =  pNumBulletItem ? pNumBulletItem->GetNumRule() : 0;
1217*af89ca6eSOliver-Rainer Wittmann                 }
1218*af89ca6eSOliver-Rainer Wittmann             }
1219cdf0e10cSrcweir 
1220*af89ca6eSOliver-Rainer Wittmann             pOwner->SetDepth( pPara, nNewDepth );
1221cdf0e10cSrcweir 
1222*af89ca6eSOliver-Rainer Wittmann             if( nNewDepth == -1 )
1223cdf0e10cSrcweir             {
1224*af89ca6eSOliver-Rainer Wittmann                 const SfxItemSet& rAttrs = pOwner->GetParaAttribs( nPara );
1225*af89ca6eSOliver-Rainer Wittmann                 if ( rAttrs.GetItemState( EE_PARA_BULLETSTATE ) == SFX_ITEM_SET )
1226cdf0e10cSrcweir                 {
1227cdf0e10cSrcweir                     SfxItemSet aAttrs(rAttrs);
1228cdf0e10cSrcweir                     aAttrs.ClearItem( EE_PARA_BULLETSTATE );
1229cdf0e10cSrcweir                     pOwner->SetParaAttribs( nPara, aAttrs );
1230cdf0e10cSrcweir                 }
1231cdf0e10cSrcweir             }
1232*af89ca6eSOliver-Rainer Wittmann             else
1233*af89ca6eSOliver-Rainer Wittmann             {
1234*af89ca6eSOliver-Rainer Wittmann                 if ( pDefaultBulletNumRule )
1235*af89ca6eSOliver-Rainer Wittmann                 {
1236*af89ca6eSOliver-Rainer Wittmann                     const SvxNumberFormat* pFmt = pOwner ->GetNumberFormat( nPara );
1237*af89ca6eSOliver-Rainer Wittmann                     if ( !pFmt
1238*af89ca6eSOliver-Rainer Wittmann                          || ( pFmt->GetNumberingType() != SVX_NUM_BITMAP
1239*af89ca6eSOliver-Rainer Wittmann                               && pFmt->GetNumberingType() != SVX_NUM_CHAR_SPECIAL ) )
1240*af89ca6eSOliver-Rainer Wittmann                     {
1241*af89ca6eSOliver-Rainer Wittmann                         SfxItemSet aAttrs( pOwner->GetParaAttribs( nPara ) );
1242*af89ca6eSOliver-Rainer Wittmann                         SvxNumRule aNewNumRule( *pDefaultBulletNumRule );
1243*af89ca6eSOliver-Rainer Wittmann                         aAttrs.Put( SvxNumBulletItem( aNewNumRule ), EE_PARA_NUMBULLET );
1244*af89ca6eSOliver-Rainer Wittmann                         pOwner->SetParaAttribs( nPara, aAttrs );
1245*af89ca6eSOliver-Rainer Wittmann                     }
1246*af89ca6eSOliver-Rainer Wittmann                 }
1247*af89ca6eSOliver-Rainer Wittmann             }
1248*af89ca6eSOliver-Rainer Wittmann         }
1249*af89ca6eSOliver-Rainer Wittmann     }
1250cdf0e10cSrcweir 
1251*af89ca6eSOliver-Rainer Wittmann     const sal_uInt16 nParaCount = (sal_uInt16) (pOwner->pParaList->GetParagraphCount());
1252cdf0e10cSrcweir     pOwner->ImplCheckParagraphs( aSel.nStartPara, nParaCount );
1253cdf0e10cSrcweir     pOwner->pEditEngine->QuickMarkInvalid( ESelection( aSel.nStartPara, 0, nParaCount, 0 ) );
1254cdf0e10cSrcweir 
1255*af89ca6eSOliver-Rainer Wittmann     pOwner->pEditEngine->SetUpdateMode( bUpdate );
1256cdf0e10cSrcweir 
1257*af89ca6eSOliver-Rainer Wittmann     pOwner->UndoActionEnd( OLUNDO_DEPTH );
1258cdf0e10cSrcweir }
1259cdf0e10cSrcweir 
1260766ce4d0SZheng Fan 
1261*af89ca6eSOliver-Rainer Wittmann void OutlinerView::ToggleBulletsNumbering(
1262*af89ca6eSOliver-Rainer Wittmann     const bool bToggle,
1263*af89ca6eSOliver-Rainer Wittmann     const bool bHandleBullets,
1264*af89ca6eSOliver-Rainer Wittmann     const SvxNumRule* pNumRule )
1265*af89ca6eSOliver-Rainer Wittmann {
1266*af89ca6eSOliver-Rainer Wittmann     ESelection aSel( pEditView->GetSelection() );
1267*af89ca6eSOliver-Rainer Wittmann     aSel.Adjust();
1268766ce4d0SZheng Fan 
1269*af89ca6eSOliver-Rainer Wittmann     bool bToggleOn = true;
1270*af89ca6eSOliver-Rainer Wittmann     if ( bToggle )
1271*af89ca6eSOliver-Rainer Wittmann     {
1272*af89ca6eSOliver-Rainer Wittmann         bToggleOn = false;
1273*af89ca6eSOliver-Rainer Wittmann         const sal_Int16 nBulletNumberingStatus( pOwner->GetBulletsNumberingStatus( aSel.nStartPara, aSel.nEndPara ) );
1274*af89ca6eSOliver-Rainer Wittmann         if ( nBulletNumberingStatus != 0 && bHandleBullets )
1275*af89ca6eSOliver-Rainer Wittmann         {
1276*af89ca6eSOliver-Rainer Wittmann             // not all paragraphs have bullets and method called to toggle bullets --> bullets on
1277*af89ca6eSOliver-Rainer Wittmann             bToggleOn = true;
1278*af89ca6eSOliver-Rainer Wittmann         }
1279*af89ca6eSOliver-Rainer Wittmann         else if ( nBulletNumberingStatus != 1 && !bHandleBullets )
1280*af89ca6eSOliver-Rainer Wittmann         {
1281*af89ca6eSOliver-Rainer Wittmann             // not all paragraphs have numbering and method called to toggle numberings --> numberings on
1282*af89ca6eSOliver-Rainer Wittmann             bToggleOn = true;
1283*af89ca6eSOliver-Rainer Wittmann         }
1284*af89ca6eSOliver-Rainer Wittmann     }
1285*af89ca6eSOliver-Rainer Wittmann     if ( bToggleOn )
1286*af89ca6eSOliver-Rainer Wittmann     {
1287*af89ca6eSOliver-Rainer Wittmann         // apply bullets/numbering for selected paragraphs
1288*af89ca6eSOliver-Rainer Wittmann         ApplyBulletsNumbering( bHandleBullets, pNumRule, bToggle, true );
1289*af89ca6eSOliver-Rainer Wittmann     }
1290*af89ca6eSOliver-Rainer Wittmann     else
1291*af89ca6eSOliver-Rainer Wittmann     {
1292*af89ca6eSOliver-Rainer Wittmann         // switch off bullets/numbering for selected paragraphs
1293*af89ca6eSOliver-Rainer Wittmann         SwitchOffBulletsNumbering( true );
1294*af89ca6eSOliver-Rainer Wittmann     }
1295766ce4d0SZheng Fan 
1296*af89ca6eSOliver-Rainer Wittmann     return;
1297*af89ca6eSOliver-Rainer Wittmann }
1298766ce4d0SZheng Fan 
1299766ce4d0SZheng Fan 
1300*af89ca6eSOliver-Rainer Wittmann void OutlinerView::EnableBullets()
1301*af89ca6eSOliver-Rainer Wittmann {
1302*af89ca6eSOliver-Rainer Wittmann     pOwner->UndoActionStart( OLUNDO_DEPTH );
1303766ce4d0SZheng Fan 
1304*af89ca6eSOliver-Rainer Wittmann     ESelection aSel( pEditView->GetSelection() );
1305*af89ca6eSOliver-Rainer Wittmann     aSel.Adjust();
1306766ce4d0SZheng Fan 
1307*af89ca6eSOliver-Rainer Wittmann     const bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
1308*af89ca6eSOliver-Rainer Wittmann     pOwner->pEditEngine->SetUpdateMode( sal_False );
1309766ce4d0SZheng Fan 
1310*af89ca6eSOliver-Rainer Wittmann     for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
1311*af89ca6eSOliver-Rainer Wittmann     {
1312*af89ca6eSOliver-Rainer Wittmann         Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
1313*af89ca6eSOliver-Rainer Wittmann         DBG_ASSERT(pPara, "OutlinerView::EnableBullets(), illegal selection?");
1314766ce4d0SZheng Fan 
1315*af89ca6eSOliver-Rainer Wittmann         if( pPara && (pOwner->GetDepth(nPara) == -1) )
1316*af89ca6eSOliver-Rainer Wittmann         {
1317*af89ca6eSOliver-Rainer Wittmann             pOwner->SetDepth( pPara, 0 );
1318*af89ca6eSOliver-Rainer Wittmann         }
1319*af89ca6eSOliver-Rainer Wittmann     }
1320766ce4d0SZheng Fan 
1321766ce4d0SZheng Fan     sal_uInt16 nParaCount = (sal_uInt16) (pOwner->pParaList->GetParagraphCount());
1322766ce4d0SZheng Fan     pOwner->ImplCheckParagraphs( aSel.nStartPara, nParaCount );
1323766ce4d0SZheng Fan     pOwner->pEditEngine->QuickMarkInvalid( ESelection( aSel.nStartPara, 0, nParaCount, 0 ) );
1324766ce4d0SZheng Fan 
1325*af89ca6eSOliver-Rainer Wittmann     pOwner->pEditEngine->SetUpdateMode( bUpdate );
1326766ce4d0SZheng Fan 
1327*af89ca6eSOliver-Rainer Wittmann     pOwner->UndoActionEnd( OLUNDO_DEPTH );
1328766ce4d0SZheng Fan }
1329766ce4d0SZheng Fan 
1330*af89ca6eSOliver-Rainer Wittmann 
1331*af89ca6eSOliver-Rainer Wittmann void OutlinerView::ApplyBulletsNumbering(
1332*af89ca6eSOliver-Rainer Wittmann     const bool bHandleBullets,
1333*af89ca6eSOliver-Rainer Wittmann     const SvxNumRule* pNewNumRule,
1334*af89ca6eSOliver-Rainer Wittmann     const bool bCheckCurrentNumRuleBeforeApplyingNewNumRule,
1335*af89ca6eSOliver-Rainer Wittmann     const bool bAtSelection )
1336cdf0e10cSrcweir {
1337*af89ca6eSOliver-Rainer Wittmann     if (!pOwner || !pOwner->pEditEngine || !pOwner->pParaList)
1338*af89ca6eSOliver-Rainer Wittmann     {
1339*af89ca6eSOliver-Rainer Wittmann         return;
1340*af89ca6eSOliver-Rainer Wittmann     }
1341cdf0e10cSrcweir 
1342*af89ca6eSOliver-Rainer Wittmann     pOwner->UndoActionStart(OLUNDO_DEPTH);
1343*af89ca6eSOliver-Rainer Wittmann     const sal_Bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
1344*af89ca6eSOliver-Rainer Wittmann     pOwner->pEditEngine->SetUpdateMode(sal_False);
1345cdf0e10cSrcweir 
1346*af89ca6eSOliver-Rainer Wittmann     sal_uInt16 nStartPara = 0;
1347*af89ca6eSOliver-Rainer Wittmann     sal_uInt16 nEndPara = 0;
1348*af89ca6eSOliver-Rainer Wittmann     if ( bAtSelection )
1349*af89ca6eSOliver-Rainer Wittmann     {
1350*af89ca6eSOliver-Rainer Wittmann         ESelection aSel( pEditView->GetSelection() );
1351*af89ca6eSOliver-Rainer Wittmann         aSel.Adjust();
1352*af89ca6eSOliver-Rainer Wittmann         nStartPara = aSel.nStartPara;
1353*af89ca6eSOliver-Rainer Wittmann         nEndPara = aSel.nEndPara;
1354*af89ca6eSOliver-Rainer Wittmann     }
1355*af89ca6eSOliver-Rainer Wittmann     else
1356*af89ca6eSOliver-Rainer Wittmann     {
1357*af89ca6eSOliver-Rainer Wittmann         nStartPara = 0;
1358*af89ca6eSOliver-Rainer Wittmann         nEndPara = pOwner->pParaList->GetParagraphCount() - 1;
1359*af89ca6eSOliver-Rainer Wittmann     }
1360cdf0e10cSrcweir 
1361*af89ca6eSOliver-Rainer Wittmann     for (sal_uInt16 nPara = nStartPara; nPara <= nEndPara; nPara++)
1362*af89ca6eSOliver-Rainer Wittmann     {
1363*af89ca6eSOliver-Rainer Wittmann         Paragraph* pPara = pOwner->pParaList->GetParagraph(nPara);
1364*af89ca6eSOliver-Rainer Wittmann         DBG_ASSERT(pPara, "OutlinerView::ApplyBulletsNumbering(..), illegal selection?");
1365cdf0e10cSrcweir 
1366*af89ca6eSOliver-Rainer Wittmann         if (pPara)
1367*af89ca6eSOliver-Rainer Wittmann         {
1368*af89ca6eSOliver-Rainer Wittmann             const sal_Int16 nDepth = pOwner->GetDepth(nPara);
1369*af89ca6eSOliver-Rainer Wittmann             if ( nDepth == -1 )
1370*af89ca6eSOliver-Rainer Wittmann             {
1371*af89ca6eSOliver-Rainer Wittmann                 pOwner->SetDepth( pPara, 0 );
1372*af89ca6eSOliver-Rainer Wittmann             }
1373cdf0e10cSrcweir 
1374*af89ca6eSOliver-Rainer Wittmann             const SfxItemSet& rAttrs = pOwner->GetParaAttribs(nPara);
1375*af89ca6eSOliver-Rainer Wittmann             SfxItemSet aAttrs(rAttrs);
1376*af89ca6eSOliver-Rainer Wittmann             aAttrs.Put(SfxBoolItem(EE_PARA_BULLETSTATE, true));
1377cdf0e10cSrcweir 
1378*af89ca6eSOliver-Rainer Wittmann             // apply new numbering rule
1379*af89ca6eSOliver-Rainer Wittmann             if ( pNewNumRule )
1380*af89ca6eSOliver-Rainer Wittmann             {
1381*af89ca6eSOliver-Rainer Wittmann                 bool bApplyNumRule = false;
1382*af89ca6eSOliver-Rainer Wittmann                 if ( !bCheckCurrentNumRuleBeforeApplyingNewNumRule )
1383*af89ca6eSOliver-Rainer Wittmann                 {
1384*af89ca6eSOliver-Rainer Wittmann                     bApplyNumRule = true;
1385*af89ca6eSOliver-Rainer Wittmann                 }
1386*af89ca6eSOliver-Rainer Wittmann                 else
1387*af89ca6eSOliver-Rainer Wittmann                 {
1388*af89ca6eSOliver-Rainer Wittmann                     const SvxNumberFormat* pFmt = pOwner ->GetNumberFormat(nPara);
1389*af89ca6eSOliver-Rainer Wittmann                     if (!pFmt)
1390*af89ca6eSOliver-Rainer Wittmann                     {
1391*af89ca6eSOliver-Rainer Wittmann                         bApplyNumRule = true;
1392*af89ca6eSOliver-Rainer Wittmann                     }
1393*af89ca6eSOliver-Rainer Wittmann                     else
1394*af89ca6eSOliver-Rainer Wittmann                     {
1395*af89ca6eSOliver-Rainer Wittmann                         sal_Int16 nNumType = pFmt->GetNumberingType();
1396*af89ca6eSOliver-Rainer Wittmann                         if ( bHandleBullets
1397*af89ca6eSOliver-Rainer Wittmann                              && nNumType != SVX_NUM_BITMAP && nNumType != SVX_NUM_CHAR_SPECIAL)
1398*af89ca6eSOliver-Rainer Wittmann                         {
1399*af89ca6eSOliver-Rainer Wittmann                             // Set to Normal bullet, old bullet type is Numbering bullet.
1400*af89ca6eSOliver-Rainer Wittmann                             bApplyNumRule = true;
1401*af89ca6eSOliver-Rainer Wittmann                         }
1402*af89ca6eSOliver-Rainer Wittmann                         else if ( !bHandleBullets
1403*af89ca6eSOliver-Rainer Wittmann                                   && (nNumType == SVX_NUM_BITMAP || nNumType == SVX_NUM_CHAR_SPECIAL))
1404*af89ca6eSOliver-Rainer Wittmann                         {
1405*af89ca6eSOliver-Rainer Wittmann                             // Set to Numbering bullet, old bullet type is Normal bullet.
1406*af89ca6eSOliver-Rainer Wittmann                             bApplyNumRule = true;
1407*af89ca6eSOliver-Rainer Wittmann                         }
1408*af89ca6eSOliver-Rainer Wittmann                     }
1409*af89ca6eSOliver-Rainer Wittmann                 }
1410cdf0e10cSrcweir 
1411*af89ca6eSOliver-Rainer Wittmann                 if ( bApplyNumRule )
1412*af89ca6eSOliver-Rainer Wittmann                 {
1413*af89ca6eSOliver-Rainer Wittmann                     SvxNumRule aNewRule(*pNewNumRule);
1414*af89ca6eSOliver-Rainer Wittmann 
1415*af89ca6eSOliver-Rainer Wittmann                     // Get old bullet space.
1416*af89ca6eSOliver-Rainer Wittmann                     {
1417*af89ca6eSOliver-Rainer Wittmann                         const SfxPoolItem* pPoolItem=NULL;
1418*af89ca6eSOliver-Rainer Wittmann                         SfxItemState eState = rAttrs.GetItemState(EE_PARA_NUMBULLET, sal_False, &pPoolItem);
1419*af89ca6eSOliver-Rainer Wittmann                         if (eState != SFX_ITEM_SET)
1420*af89ca6eSOliver-Rainer Wittmann                         {
1421*af89ca6eSOliver-Rainer Wittmann                             // Use default value when has not contain bullet item.
1422*af89ca6eSOliver-Rainer Wittmann                             ESelection aSelection(nPara, 0);
1423*af89ca6eSOliver-Rainer Wittmann                             SfxItemSet aTmpSet(pOwner->pEditEngine->GetAttribs(aSelection));
1424*af89ca6eSOliver-Rainer Wittmann                             pPoolItem = aTmpSet.GetItem(EE_PARA_NUMBULLET);
1425*af89ca6eSOliver-Rainer Wittmann                         }
1426*af89ca6eSOliver-Rainer Wittmann 
1427*af89ca6eSOliver-Rainer Wittmann                         const SvxNumBulletItem* pNumBulletItem = dynamic_cast< const SvxNumBulletItem* >(pPoolItem);
1428*af89ca6eSOliver-Rainer Wittmann                         if (pNumBulletItem)
1429*af89ca6eSOliver-Rainer Wittmann                         {
1430*af89ca6eSOliver-Rainer Wittmann                             const sal_uInt16 nLevelCnt = Min(pNumBulletItem->GetNumRule()->GetLevelCount(), aNewRule.GetLevelCount());
1431*af89ca6eSOliver-Rainer Wittmann                             for ( sal_uInt16 nLevel = 0; nLevel < nLevelCnt; ++nLevel )
1432*af89ca6eSOliver-Rainer Wittmann                             {
1433*af89ca6eSOliver-Rainer Wittmann                                 const SvxNumberFormat* pOldFmt = pNumBulletItem->GetNumRule()->Get(nLevel);
1434*af89ca6eSOliver-Rainer Wittmann                                 const SvxNumberFormat* pNewFmt = aNewRule.Get(nLevel);
1435*af89ca6eSOliver-Rainer Wittmann                                 if (pOldFmt && pNewFmt && (pOldFmt->GetFirstLineOffset() != pNewFmt->GetFirstLineOffset() || pOldFmt->GetAbsLSpace() != pNewFmt->GetAbsLSpace()))
1436*af89ca6eSOliver-Rainer Wittmann                                 {
1437*af89ca6eSOliver-Rainer Wittmann                                     SvxNumberFormat* pNewFmtClone = new SvxNumberFormat(*pNewFmt);
1438*af89ca6eSOliver-Rainer Wittmann                                     pNewFmtClone->SetFirstLineOffset(pOldFmt->GetFirstLineOffset());
1439*af89ca6eSOliver-Rainer Wittmann                                     pNewFmtClone->SetAbsLSpace(pOldFmt->GetAbsLSpace());
1440*af89ca6eSOliver-Rainer Wittmann                                     aNewRule.SetLevel(nLevel, pNewFmtClone);
1441*af89ca6eSOliver-Rainer Wittmann                                     delete pNewFmtClone;
1442*af89ca6eSOliver-Rainer Wittmann                                 }
1443*af89ca6eSOliver-Rainer Wittmann                             }
1444*af89ca6eSOliver-Rainer Wittmann                         }
1445*af89ca6eSOliver-Rainer Wittmann                     }
1446*af89ca6eSOliver-Rainer Wittmann 
1447*af89ca6eSOliver-Rainer Wittmann                     aAttrs.Put(SvxNumBulletItem(aNewRule), EE_PARA_NUMBULLET);
1448*af89ca6eSOliver-Rainer Wittmann                 }
1449*af89ca6eSOliver-Rainer Wittmann             }
1450*af89ca6eSOliver-Rainer Wittmann             pOwner->SetParaAttribs(nPara, aAttrs);
1451*af89ca6eSOliver-Rainer Wittmann         }
1452*af89ca6eSOliver-Rainer Wittmann     }
1453cdf0e10cSrcweir 
1454*af89ca6eSOliver-Rainer Wittmann     const sal_uInt16 nParaCount = (sal_uInt16) (pOwner->pParaList->GetParagraphCount());
1455*af89ca6eSOliver-Rainer Wittmann     pOwner->ImplCheckParagraphs( nStartPara, nParaCount );
1456*af89ca6eSOliver-Rainer Wittmann     pOwner->pEditEngine->QuickMarkInvalid( ESelection( nStartPara, 0, nParaCount, 0 ) );
1457766ce4d0SZheng Fan 
1458*af89ca6eSOliver-Rainer Wittmann     pOwner->pEditEngine->SetUpdateMode( bUpdate );
1459766ce4d0SZheng Fan 
1460*af89ca6eSOliver-Rainer Wittmann     pOwner->UndoActionEnd( OLUNDO_DEPTH );
1461766ce4d0SZheng Fan 
1462*af89ca6eSOliver-Rainer Wittmann     return;
1463*af89ca6eSOliver-Rainer Wittmann }
1464766ce4d0SZheng Fan 
1465766ce4d0SZheng Fan 
1466*af89ca6eSOliver-Rainer Wittmann void OutlinerView::SwitchOffBulletsNumbering(
1467*af89ca6eSOliver-Rainer Wittmann     const bool bAtSelection )
1468*af89ca6eSOliver-Rainer Wittmann {
1469*af89ca6eSOliver-Rainer Wittmann     sal_uInt16 nStartPara = 0;
1470*af89ca6eSOliver-Rainer Wittmann     sal_uInt16 nEndPara = 0;
1471*af89ca6eSOliver-Rainer Wittmann     if ( bAtSelection )
1472*af89ca6eSOliver-Rainer Wittmann     {
1473*af89ca6eSOliver-Rainer Wittmann         ESelection aSel( pEditView->GetSelection() );
1474*af89ca6eSOliver-Rainer Wittmann         aSel.Adjust();
1475*af89ca6eSOliver-Rainer Wittmann         nStartPara = aSel.nStartPara;
1476*af89ca6eSOliver-Rainer Wittmann         nEndPara = aSel.nEndPara;
1477*af89ca6eSOliver-Rainer Wittmann     }
1478*af89ca6eSOliver-Rainer Wittmann     else
1479*af89ca6eSOliver-Rainer Wittmann     {
1480*af89ca6eSOliver-Rainer Wittmann         nStartPara = 0;
1481*af89ca6eSOliver-Rainer Wittmann         nEndPara = pOwner->pParaList->GetParagraphCount() - 1;
1482*af89ca6eSOliver-Rainer Wittmann     }
1483766ce4d0SZheng Fan 
1484*af89ca6eSOliver-Rainer Wittmann     pOwner->UndoActionStart( OLUNDO_DEPTH );
1485*af89ca6eSOliver-Rainer Wittmann     const bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
1486*af89ca6eSOliver-Rainer Wittmann     pOwner->pEditEngine->SetUpdateMode( sal_False );
1487766ce4d0SZheng Fan 
1488*af89ca6eSOliver-Rainer Wittmann     for ( sal_uInt16 nPara = nStartPara; nPara <= nEndPara; ++nPara )
1489*af89ca6eSOliver-Rainer Wittmann     {
1490*af89ca6eSOliver-Rainer Wittmann         Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
1491*af89ca6eSOliver-Rainer Wittmann         DBG_ASSERT(pPara, "OutlinerView::SwitchOffBulletsNumbering(...), illegal paragraph index?");
1492766ce4d0SZheng Fan 
1493*af89ca6eSOliver-Rainer Wittmann         if( pPara )
1494*af89ca6eSOliver-Rainer Wittmann         {
1495*af89ca6eSOliver-Rainer Wittmann             pOwner->SetDepth( pPara, -1 );
1496766ce4d0SZheng Fan 
1497*af89ca6eSOliver-Rainer Wittmann             const SfxItemSet& rAttrs = pOwner->GetParaAttribs( nPara );
1498*af89ca6eSOliver-Rainer Wittmann             if (rAttrs.GetItemState( EE_PARA_BULLETSTATE ) == SFX_ITEM_SET)
1499*af89ca6eSOliver-Rainer Wittmann             {
1500*af89ca6eSOliver-Rainer Wittmann                 SfxItemSet aAttrs(rAttrs);
1501*af89ca6eSOliver-Rainer Wittmann                 aAttrs.ClearItem( EE_PARA_BULLETSTATE );
1502*af89ca6eSOliver-Rainer Wittmann                 pOwner->SetParaAttribs( nPara, aAttrs );
1503*af89ca6eSOliver-Rainer Wittmann             }
1504*af89ca6eSOliver-Rainer Wittmann         }
1505*af89ca6eSOliver-Rainer Wittmann     }
1506766ce4d0SZheng Fan 
1507*af89ca6eSOliver-Rainer Wittmann     const sal_uInt16 nParaCount = (sal_uInt16) (pOwner->pParaList->GetParagraphCount());
1508*af89ca6eSOliver-Rainer Wittmann     pOwner->ImplCheckParagraphs( nStartPara, nParaCount );
1509*af89ca6eSOliver-Rainer Wittmann     pOwner->pEditEngine->QuickMarkInvalid( ESelection( nStartPara, 0, nParaCount, 0 ) );
1510766ce4d0SZheng Fan 
1511*af89ca6eSOliver-Rainer Wittmann     pOwner->pEditEngine->SetUpdateMode( bUpdate );
1512*af89ca6eSOliver-Rainer Wittmann     pOwner->UndoActionEnd( OLUNDO_DEPTH );
1513766ce4d0SZheng Fan }
1514cdf0e10cSrcweir 
1515*af89ca6eSOliver-Rainer Wittmann 
1516cdf0e10cSrcweir void OutlinerView::RemoveAttribsKeepLanguages( sal_Bool bRemoveParaAttribs )
1517cdf0e10cSrcweir {
1518cdf0e10cSrcweir     RemoveAttribs( bRemoveParaAttribs, 0, sal_True /*keep language attribs*/ );
1519cdf0e10cSrcweir }
1520cdf0e10cSrcweir 
1521cdf0e10cSrcweir void OutlinerView::RemoveAttribs( sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich, sal_Bool bKeepLanguages )
1522cdf0e10cSrcweir {
1523cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1524cdf0e10cSrcweir 	sal_Bool bUpdate = pOwner->GetUpdateMode();
1525cdf0e10cSrcweir 	pOwner->SetUpdateMode( sal_False );
1526cdf0e10cSrcweir 	pOwner->UndoActionStart( OLUNDO_ATTR );
1527cdf0e10cSrcweir     if (bKeepLanguages)
1528cdf0e10cSrcweir         pEditView->RemoveAttribsKeepLanguages( bRemoveParaAttribs );
1529cdf0e10cSrcweir     else
1530cdf0e10cSrcweir         pEditView->RemoveAttribs( bRemoveParaAttribs, nWhich );
1531cdf0e10cSrcweir 	if ( bRemoveParaAttribs )
1532cdf0e10cSrcweir 	{
1533cdf0e10cSrcweir 		// Ueber alle Absaetze, und Einrueckung und Level einstellen
1534cdf0e10cSrcweir 		ESelection aSel = pEditView->GetSelection();
1535cdf0e10cSrcweir 		aSel.Adjust();
1536cdf0e10cSrcweir 		for ( sal_uInt16 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
1537cdf0e10cSrcweir 		{
1538cdf0e10cSrcweir 			Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
1539cdf0e10cSrcweir             pOwner->ImplInitDepth( nPara, pPara->GetDepth(), sal_False, sal_False );
1540cdf0e10cSrcweir 		}
1541cdf0e10cSrcweir 	}
1542cdf0e10cSrcweir 	pOwner->UndoActionEnd( OLUNDO_ATTR );
1543cdf0e10cSrcweir 	pOwner->SetUpdateMode( bUpdate );
1544cdf0e10cSrcweir }
1545cdf0e10cSrcweir 
1546cdf0e10cSrcweir 
1547cdf0e10cSrcweir 
1548cdf0e10cSrcweir // =====================================================================
1549cdf0e10cSrcweir // ======================   Einfache Durchreicher =======================
1550cdf0e10cSrcweir // ======================================================================
1551cdf0e10cSrcweir 
1552cdf0e10cSrcweir 
1553cdf0e10cSrcweir void OutlinerView::InsertText( const XubString& rNew, sal_Bool bSelect )
1554cdf0e10cSrcweir {
1555cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1556cdf0e10cSrcweir 	if( pOwner->bFirstParaIsEmpty )
1557cdf0e10cSrcweir 		pOwner->Insert( String() );
1558cdf0e10cSrcweir 	pEditView->InsertText( rNew, bSelect );
1559cdf0e10cSrcweir }
1560cdf0e10cSrcweir 
1561cdf0e10cSrcweir void OutlinerView::SetVisArea( const Rectangle& rRec )
1562cdf0e10cSrcweir {
1563cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1564cdf0e10cSrcweir 	pEditView->SetVisArea( rRec );
1565cdf0e10cSrcweir }
1566cdf0e10cSrcweir 
1567cdf0e10cSrcweir 
1568cdf0e10cSrcweir void OutlinerView::SetSelection( const ESelection& rSel )
1569cdf0e10cSrcweir {
1570cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1571cdf0e10cSrcweir 	pEditView->SetSelection( rSel );
1572cdf0e10cSrcweir }
1573cdf0e10cSrcweir 
1574cdf0e10cSrcweir void OutlinerView::SetReadOnly( sal_Bool bReadOnly )
1575cdf0e10cSrcweir {
1576cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1577cdf0e10cSrcweir 	pEditView->SetReadOnly( bReadOnly );
1578cdf0e10cSrcweir }
1579cdf0e10cSrcweir 
1580cdf0e10cSrcweir sal_Bool OutlinerView::IsReadOnly() const
1581cdf0e10cSrcweir {
1582cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1583cdf0e10cSrcweir 	return pEditView->IsReadOnly();
1584cdf0e10cSrcweir }
1585cdf0e10cSrcweir 
1586cdf0e10cSrcweir sal_Bool OutlinerView::HasSelection() const
1587cdf0e10cSrcweir {
1588cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1589cdf0e10cSrcweir 	return pEditView->HasSelection();
1590cdf0e10cSrcweir }
1591cdf0e10cSrcweir 
1592cdf0e10cSrcweir 
1593cdf0e10cSrcweir void OutlinerView::ShowCursor( sal_Bool bGotoCursor )
1594cdf0e10cSrcweir {
1595cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1596cdf0e10cSrcweir 	pEditView->ShowCursor( bGotoCursor );
1597cdf0e10cSrcweir }
1598cdf0e10cSrcweir 
1599cdf0e10cSrcweir 
1600cdf0e10cSrcweir void OutlinerView::HideCursor()
1601cdf0e10cSrcweir {
1602cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1603cdf0e10cSrcweir 	pEditView->HideCursor();
1604cdf0e10cSrcweir }
1605cdf0e10cSrcweir 
1606cdf0e10cSrcweir 
1607cdf0e10cSrcweir void OutlinerView::SetWindow( Window* pWin )
1608cdf0e10cSrcweir {
1609cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1610cdf0e10cSrcweir 	pEditView->SetWindow( pWin );
1611cdf0e10cSrcweir }
1612cdf0e10cSrcweir 
1613cdf0e10cSrcweir 
1614cdf0e10cSrcweir Window* OutlinerView::GetWindow() const
1615cdf0e10cSrcweir {
1616cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1617cdf0e10cSrcweir 	return pEditView->GetWindow();
1618cdf0e10cSrcweir }
1619cdf0e10cSrcweir 
1620cdf0e10cSrcweir 
1621cdf0e10cSrcweir void OutlinerView::SetOutputArea( const Rectangle& rRect )
1622cdf0e10cSrcweir {
1623cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1624cdf0e10cSrcweir 	pEditView->SetOutputArea( rRect );
1625cdf0e10cSrcweir }
1626cdf0e10cSrcweir 
1627cdf0e10cSrcweir 
1628cdf0e10cSrcweir Rectangle OutlinerView::GetOutputArea() const
1629cdf0e10cSrcweir {
1630cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1631cdf0e10cSrcweir 	return pEditView->GetOutputArea();
1632cdf0e10cSrcweir }
1633cdf0e10cSrcweir 
1634cdf0e10cSrcweir 
1635cdf0e10cSrcweir XubString OutlinerView::GetSelected() const
1636cdf0e10cSrcweir {
1637cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1638cdf0e10cSrcweir 	return pEditView->GetSelected();
1639cdf0e10cSrcweir }
1640cdf0e10cSrcweir 
1641cdf0e10cSrcweir 
1642cdf0e10cSrcweir void OutlinerView::RemoveCharAttribs( sal_uLong nPara, sal_uInt16 nWhich)
1643cdf0e10cSrcweir {
1644cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1645cdf0e10cSrcweir 	pEditView->RemoveCharAttribs( (sal_uInt16)nPara, nWhich);
1646cdf0e10cSrcweir }
1647cdf0e10cSrcweir 
1648cdf0e10cSrcweir 
1649cdf0e10cSrcweir void OutlinerView::CompleteAutoCorrect()
1650cdf0e10cSrcweir {
1651cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1652cdf0e10cSrcweir 	pEditView->CompleteAutoCorrect();
1653cdf0e10cSrcweir }
1654cdf0e10cSrcweir 
1655cdf0e10cSrcweir 
1656cdf0e10cSrcweir EESpellState OutlinerView::StartSpeller( sal_Bool bMultiDoc )
1657cdf0e10cSrcweir {
1658cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1659cdf0e10cSrcweir 	return pEditView->StartSpeller( bMultiDoc );
1660cdf0e10cSrcweir }
1661cdf0e10cSrcweir 
1662cdf0e10cSrcweir 
1663cdf0e10cSrcweir EESpellState OutlinerView::StartThesaurus()
1664cdf0e10cSrcweir {
1665cdf0e10cSrcweir     DBG_CHKTHIS(OutlinerView,0);
1666cdf0e10cSrcweir     return pEditView->StartThesaurus();
1667cdf0e10cSrcweir }
1668cdf0e10cSrcweir 
1669cdf0e10cSrcweir 
1670cdf0e10cSrcweir void OutlinerView::StartTextConversion(
1671cdf0e10cSrcweir     LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont,
1672cdf0e10cSrcweir     sal_Int32 nOptions, sal_Bool bIsInteractive, sal_Bool bMultipleDoc )
1673cdf0e10cSrcweir {
1674cdf0e10cSrcweir     DBG_CHKTHIS(OutlinerView,0);
1675cdf0e10cSrcweir     if (
1676cdf0e10cSrcweir         (LANGUAGE_KOREAN == nSrcLang && LANGUAGE_KOREAN == nDestLang) ||
1677cdf0e10cSrcweir         (LANGUAGE_CHINESE_SIMPLIFIED  == nSrcLang && LANGUAGE_CHINESE_TRADITIONAL == nDestLang) ||
1678cdf0e10cSrcweir         (LANGUAGE_CHINESE_TRADITIONAL == nSrcLang && LANGUAGE_CHINESE_SIMPLIFIED  == nDestLang)
1679cdf0e10cSrcweir        )
1680cdf0e10cSrcweir     {
1681cdf0e10cSrcweir         pEditView->StartTextConversion( nSrcLang, nDestLang, pDestFont, nOptions, bIsInteractive, bMultipleDoc );
1682cdf0e10cSrcweir     }
1683cdf0e10cSrcweir     else
1684cdf0e10cSrcweir     {
1685cdf0e10cSrcweir         DBG_ERROR( "unexpected language" );
1686cdf0e10cSrcweir     }
1687cdf0e10cSrcweir }
1688cdf0e10cSrcweir 
1689cdf0e10cSrcweir 
1690cdf0e10cSrcweir sal_uInt16 OutlinerView::StartSearchAndReplace( const SvxSearchItem& rSearchItem )
1691cdf0e10cSrcweir {
1692cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1693cdf0e10cSrcweir 	return pEditView->StartSearchAndReplace( rSearchItem );
1694cdf0e10cSrcweir }
1695cdf0e10cSrcweir 
1696cdf0e10cSrcweir void OutlinerView::TransliterateText( sal_Int32 nTransliterationMode )
1697cdf0e10cSrcweir {
1698cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1699cdf0e10cSrcweir 	pEditView->TransliterateText( nTransliterationMode );
1700cdf0e10cSrcweir }
1701cdf0e10cSrcweir 
1702cdf0e10cSrcweir 
1703cdf0e10cSrcweir 
1704cdf0e10cSrcweir ESelection OutlinerView::GetSelection()
1705cdf0e10cSrcweir {
1706cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1707cdf0e10cSrcweir 	return pEditView->GetSelection();
1708cdf0e10cSrcweir }
1709cdf0e10cSrcweir 
1710cdf0e10cSrcweir 
1711cdf0e10cSrcweir void OutlinerView::Scroll( long nHorzScroll, long nVertScroll )
1712cdf0e10cSrcweir {
1713cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1714cdf0e10cSrcweir 	pEditView->Scroll( nHorzScroll, nVertScroll );
1715cdf0e10cSrcweir }
1716cdf0e10cSrcweir 
1717cdf0e10cSrcweir 
1718cdf0e10cSrcweir void OutlinerView::SetControlWord( sal_uLong nWord )
1719cdf0e10cSrcweir {
1720cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1721cdf0e10cSrcweir 	pEditView->SetControlWord( nWord );
1722cdf0e10cSrcweir }
1723cdf0e10cSrcweir 
1724cdf0e10cSrcweir 
1725cdf0e10cSrcweir sal_uLong OutlinerView::GetControlWord() const
1726cdf0e10cSrcweir {
1727cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1728cdf0e10cSrcweir 	return pEditView->GetControlWord();
1729cdf0e10cSrcweir }
1730cdf0e10cSrcweir 
1731cdf0e10cSrcweir 
1732cdf0e10cSrcweir void OutlinerView::SetAnchorMode( EVAnchorMode eMode )
1733cdf0e10cSrcweir {
1734cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1735cdf0e10cSrcweir 	pEditView->SetAnchorMode( eMode );
1736cdf0e10cSrcweir }
1737cdf0e10cSrcweir 
1738cdf0e10cSrcweir 
1739cdf0e10cSrcweir EVAnchorMode OutlinerView::GetAnchorMode() const
1740cdf0e10cSrcweir {
1741cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1742cdf0e10cSrcweir 	return pEditView->GetAnchorMode();
1743cdf0e10cSrcweir }
1744cdf0e10cSrcweir 
1745cdf0e10cSrcweir 
1746cdf0e10cSrcweir void OutlinerView::Undo()
1747cdf0e10cSrcweir {
1748cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1749cdf0e10cSrcweir 	pEditView->Undo();
1750cdf0e10cSrcweir }
1751cdf0e10cSrcweir 
1752cdf0e10cSrcweir 
1753cdf0e10cSrcweir void OutlinerView::Redo()
1754cdf0e10cSrcweir {
1755cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1756cdf0e10cSrcweir 	pEditView->Redo();
1757cdf0e10cSrcweir }
1758cdf0e10cSrcweir 
1759cdf0e10cSrcweir 
1760cdf0e10cSrcweir void OutlinerView::EnablePaste( sal_Bool bEnable )
1761cdf0e10cSrcweir {
1762cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1763cdf0e10cSrcweir 	pEditView->EnablePaste( bEnable );
1764cdf0e10cSrcweir }
1765cdf0e10cSrcweir 
1766cdf0e10cSrcweir 
1767cdf0e10cSrcweir void OutlinerView::Copy()
1768cdf0e10cSrcweir {
1769cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1770cdf0e10cSrcweir 	pEditView->Copy();
1771cdf0e10cSrcweir }
1772cdf0e10cSrcweir 
1773cdf0e10cSrcweir 
1774cdf0e10cSrcweir void OutlinerView::InsertField( const SvxFieldItem& rFld )
1775cdf0e10cSrcweir {
1776cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1777cdf0e10cSrcweir 	pEditView->InsertField( rFld );
1778cdf0e10cSrcweir }
1779cdf0e10cSrcweir 
1780cdf0e10cSrcweir 
1781cdf0e10cSrcweir const SvxFieldItem* OutlinerView::GetFieldUnderMousePointer() const
1782cdf0e10cSrcweir {
1783cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1784cdf0e10cSrcweir 	return pEditView->GetFieldUnderMousePointer();
1785cdf0e10cSrcweir }
1786cdf0e10cSrcweir 
1787cdf0e10cSrcweir 
1788cdf0e10cSrcweir const SvxFieldItem* OutlinerView::GetFieldUnderMousePointer( sal_uInt16& nPara, sal_uInt16& nPos ) const
1789cdf0e10cSrcweir {
1790cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1791cdf0e10cSrcweir 	return pEditView->GetFieldUnderMousePointer( nPara, nPos );
1792cdf0e10cSrcweir }
1793cdf0e10cSrcweir 
1794cdf0e10cSrcweir 
1795cdf0e10cSrcweir const SvxFieldItem* OutlinerView::GetFieldAtSelection() const
1796cdf0e10cSrcweir {
1797cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1798cdf0e10cSrcweir 	return pEditView->GetFieldAtSelection();
1799cdf0e10cSrcweir }
1800cdf0e10cSrcweir 
1801cdf0e10cSrcweir void OutlinerView::SetInvalidateMore( sal_uInt16 nPixel )
1802cdf0e10cSrcweir {
1803cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1804cdf0e10cSrcweir 	pEditView->SetInvalidateMore( nPixel );
1805cdf0e10cSrcweir }
1806cdf0e10cSrcweir 
1807cdf0e10cSrcweir 
1808cdf0e10cSrcweir sal_uInt16 OutlinerView::GetInvalidateMore() const
1809cdf0e10cSrcweir {
1810cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1811cdf0e10cSrcweir 	return pEditView->GetInvalidateMore();
1812cdf0e10cSrcweir }
1813cdf0e10cSrcweir 
1814cdf0e10cSrcweir 
1815cdf0e10cSrcweir sal_Bool OutlinerView::IsCursorAtWrongSpelledWord( sal_Bool bMarkIfWrong )
1816cdf0e10cSrcweir {
1817cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1818cdf0e10cSrcweir 	return pEditView->IsCursorAtWrongSpelledWord( bMarkIfWrong );
1819cdf0e10cSrcweir }
1820cdf0e10cSrcweir 
1821cdf0e10cSrcweir 
1822cdf0e10cSrcweir sal_Bool OutlinerView::IsWrongSpelledWordAtPos( const Point& rPosPixel, sal_Bool bMarkIfWrong )
1823cdf0e10cSrcweir {
1824cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1825cdf0e10cSrcweir 	return pEditView->IsWrongSpelledWordAtPos( rPosPixel, bMarkIfWrong );
1826cdf0e10cSrcweir }
1827cdf0e10cSrcweir 
1828cdf0e10cSrcweir 
1829cdf0e10cSrcweir void OutlinerView::SpellIgnoreWord()
1830cdf0e10cSrcweir {
1831cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1832cdf0e10cSrcweir 	pEditView->SpellIgnoreWord();
1833cdf0e10cSrcweir }
1834cdf0e10cSrcweir 
1835cdf0e10cSrcweir 
1836cdf0e10cSrcweir void OutlinerView::ExecuteSpellPopup( const Point& rPosPixel, Link* pStartDlg )
1837cdf0e10cSrcweir {
1838cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1839cdf0e10cSrcweir 	pEditView->ExecuteSpellPopup( rPosPixel, pStartDlg );
1840cdf0e10cSrcweir }
1841cdf0e10cSrcweir 
1842cdf0e10cSrcweir sal_uLong OutlinerView::Read( SvStream& rInput,  const String& rBaseURL, EETextFormat eFormat, sal_Bool bSelect, SvKeyValueIterator* pHTTPHeaderAttrs )
1843cdf0e10cSrcweir {
1844cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1845cdf0e10cSrcweir 	sal_uInt16 nOldParaCount = pEditView->GetEditEngine()->GetParagraphCount();
1846cdf0e10cSrcweir 	ESelection aOldSel = pEditView->GetSelection();
1847cdf0e10cSrcweir 	aOldSel.Adjust();
1848cdf0e10cSrcweir 
1849cdf0e10cSrcweir     sal_uLong nRet = pEditView->Read( rInput, rBaseURL, eFormat, bSelect, pHTTPHeaderAttrs );
1850cdf0e10cSrcweir 
1851cdf0e10cSrcweir 	// MT 08/00: Hier sollte eigentlich das gleiche wie in PasteSpecial passieren!
1852cdf0e10cSrcweir 	// Mal anpassen, wenn dieses ImplInitPaste und ImpPasted-Geraffel ueberarbeitet ist.
1853cdf0e10cSrcweir 
1854cdf0e10cSrcweir 	long nParaDiff = pEditView->GetEditEngine()->GetParagraphCount() - nOldParaCount;
1855cdf0e10cSrcweir 	sal_uInt16 nChangesStart = aOldSel.nStartPara;
1856cdf0e10cSrcweir 	sal_uInt16 nChangesEnd = sal::static_int_cast< sal_uInt16 >(nChangesStart + nParaDiff + (aOldSel.nEndPara-aOldSel.nStartPara));
1857cdf0e10cSrcweir 
1858cdf0e10cSrcweir 	for ( sal_uInt16 n = nChangesStart; n <= nChangesEnd; n++ )
1859cdf0e10cSrcweir 	{
1860cdf0e10cSrcweir 		if ( eFormat == EE_FORMAT_BIN )
1861cdf0e10cSrcweir 		{
1862cdf0e10cSrcweir 			sal_uInt16 nDepth = 0;
1863cdf0e10cSrcweir 			const SfxItemSet& rAttrs = pOwner->GetParaAttribs( n );
1864cdf0e10cSrcweir 			const SfxInt16Item& rLevel = (const SfxInt16Item&) rAttrs.Get( EE_PARA_OUTLLEVEL );
1865cdf0e10cSrcweir 			nDepth = rLevel.GetValue();
1866cdf0e10cSrcweir 			pOwner->ImplInitDepth( n, nDepth, sal_False );
1867cdf0e10cSrcweir 		}
1868cdf0e10cSrcweir 
1869cdf0e10cSrcweir 		if ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_OUTLINEOBJECT )
1870cdf0e10cSrcweir 			pOwner->ImplSetLevelDependendStyleSheet( n );
1871cdf0e10cSrcweir 	}
1872cdf0e10cSrcweir 
1873cdf0e10cSrcweir 	if ( eFormat != EE_FORMAT_BIN )
1874cdf0e10cSrcweir 	{
1875cdf0e10cSrcweir 		pOwner->ImpFilterIndents( nChangesStart, nChangesEnd );
1876cdf0e10cSrcweir 	}
1877cdf0e10cSrcweir 
1878cdf0e10cSrcweir 	return nRet;
1879cdf0e10cSrcweir }
1880cdf0e10cSrcweir 
1881cdf0e10cSrcweir sal_uLong OutlinerView::Write( SvStream& rOutput, EETextFormat eFormat )
1882cdf0e10cSrcweir {
1883cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1884cdf0e10cSrcweir 	return pEditView->Write( rOutput, eFormat );
1885cdf0e10cSrcweir }
1886cdf0e10cSrcweir 
1887cdf0e10cSrcweir void OutlinerView::SetBackgroundColor( const Color& rColor )
1888cdf0e10cSrcweir {
1889cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1890cdf0e10cSrcweir 	pEditView->SetBackgroundColor( rColor );
1891cdf0e10cSrcweir }
1892cdf0e10cSrcweir 
1893cdf0e10cSrcweir 
1894cdf0e10cSrcweir Color OutlinerView::GetBackgroundColor()
1895cdf0e10cSrcweir {
1896cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1897cdf0e10cSrcweir 	return pEditView->GetBackgroundColor();
1898cdf0e10cSrcweir }
1899cdf0e10cSrcweir 
1900cdf0e10cSrcweir SfxItemSet OutlinerView::GetAttribs()
1901cdf0e10cSrcweir {
1902cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1903cdf0e10cSrcweir 	return pEditView->GetAttribs();
1904cdf0e10cSrcweir }
1905cdf0e10cSrcweir 
1906cdf0e10cSrcweir sal_uInt16 OutlinerView::GetSelectedScriptType() const
1907cdf0e10cSrcweir {
1908cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1909cdf0e10cSrcweir 	return pEditView->GetSelectedScriptType();
1910cdf0e10cSrcweir }
1911cdf0e10cSrcweir 
1912cdf0e10cSrcweir String OutlinerView::GetSurroundingText() const
1913cdf0e10cSrcweir {
1914cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1915cdf0e10cSrcweir 	return pEditView->GetSurroundingText();
1916cdf0e10cSrcweir }
1917cdf0e10cSrcweir 
1918cdf0e10cSrcweir Selection OutlinerView::GetSurroundingTextSelection() const
1919cdf0e10cSrcweir {
1920cdf0e10cSrcweir 	DBG_CHKTHIS(OutlinerView,0);
1921cdf0e10cSrcweir 	return pEditView->GetSurroundingTextSelection();
1922cdf0e10cSrcweir }
1923cdf0e10cSrcweir 
1924cdf0e10cSrcweir 
1925cdf0e10cSrcweir // ======================================================================
1926cdf0e10cSrcweir // ===== some code for thesaurus sub menu within context menu
1927cdf0e10cSrcweir // ======================================================================
1928cdf0e10cSrcweir 
1929cdf0e10cSrcweir // returns: true if a word for thesaurus look-up was found at the current cursor position.
1930cdf0e10cSrcweir // The status string will be word + iso language string (e.g. "light#en-US")
1931cdf0e10cSrcweir bool EDITENG_DLLPUBLIC GetStatusValueForThesaurusFromContext(
1932cdf0e10cSrcweir     String &rStatusVal,
1933cdf0e10cSrcweir     LanguageType &rLang,
1934cdf0e10cSrcweir     const EditView &rEditView )
1935cdf0e10cSrcweir {
1936cdf0e10cSrcweir     // get text and locale for thesaurus look up
1937cdf0e10cSrcweir     String aText;
1938cdf0e10cSrcweir     EditEngine *pEditEngine = rEditView.GetEditEngine();
1939cdf0e10cSrcweir     ESelection aTextSel( rEditView.GetSelection() );
1940cdf0e10cSrcweir     if (!aTextSel.HasRange())
1941cdf0e10cSrcweir         aTextSel = pEditEngine->GetWord( aTextSel, i18n::WordType::DICTIONARY_WORD );
1942cdf0e10cSrcweir     aText = pEditEngine->GetText( aTextSel );
1943cdf0e10cSrcweir     aTextSel.Adjust();
1944cdf0e10cSrcweir     LanguageType nLang = pEditEngine->GetLanguage( aTextSel.nStartPara, aTextSel.nStartPos );
1945cdf0e10cSrcweir     String aLangText( MsLangId::convertLanguageToIsoString( nLang ) );
1946cdf0e10cSrcweir 
1947cdf0e10cSrcweir     // set word and locale to look up as status value
1948cdf0e10cSrcweir     String aStatusVal( aText );
1949cdf0e10cSrcweir     aStatusVal.AppendAscii( "#" );
1950cdf0e10cSrcweir     aStatusVal += aLangText;
1951cdf0e10cSrcweir 
1952cdf0e10cSrcweir     rStatusVal  = aStatusVal;
1953cdf0e10cSrcweir     rLang       = nLang;
1954cdf0e10cSrcweir 
1955cdf0e10cSrcweir     return aText.Len() > 0;
1956cdf0e10cSrcweir }
1957cdf0e10cSrcweir 
1958cdf0e10cSrcweir 
1959cdf0e10cSrcweir void EDITENG_DLLPUBLIC ReplaceTextWithSynonym( EditView &rEditView, const String &rSynonmText )
1960cdf0e10cSrcweir {
1961cdf0e10cSrcweir     // get selection to use
1962cdf0e10cSrcweir     ESelection aCurSel( rEditView.GetSelection() );
1963cdf0e10cSrcweir     if (!rEditView.HasSelection())
1964cdf0e10cSrcweir     {
1965cdf0e10cSrcweir         // select the same word that was used in GetStatusValueForThesaurusFromContext by calling GetWord.
1966cdf0e10cSrcweir         // (In the end both functions will call ImpEditEngine::SelectWord)
1967cdf0e10cSrcweir         rEditView.SelectCurrentWord( i18n::WordType::DICTIONARY_WORD );
1968cdf0e10cSrcweir         aCurSel = rEditView.GetSelection();
1969cdf0e10cSrcweir     }
1970cdf0e10cSrcweir 
1971cdf0e10cSrcweir     // replace word ...
1972cdf0e10cSrcweir     rEditView.InsertText( rSynonmText );
1973cdf0e10cSrcweir     rEditView.ShowCursor( sal_True, sal_False );
1974cdf0e10cSrcweir }
1975cdf0e10cSrcweir 
1976cdf0e10cSrcweir 
1977