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>
550bbd9100SArmin Le Grand #include <svl/itempool.hxx>
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
DBG_NAME(OutlinerView)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
~OutlinerView()85cdf0e10cSrcweir OutlinerView::~OutlinerView()
86cdf0e10cSrcweir {
87cdf0e10cSrcweir DBG_DTOR(OutlinerView,0);
88cdf0e10cSrcweir delete pEditView;
89cdf0e10cSrcweir }
90cdf0e10cSrcweir
Paint(const Rectangle & rRect,OutputDevice * pTargetDevice)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
PostKeyEvent(const KeyEvent & rKEvt)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 ) &&
191af89ca6eSOliver-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 );
233*7a980842SDamjanJovanovic sal_uInt32 nTemp = aSel.nEndPara;
234cdf0e10cSrcweir nTemp += nChilds;
235cdf0e10cSrcweir nTemp++; // einfuegen ueber naechstem Non-Child
236cdf0e10cSrcweir pOwner->Insert( String(),nTemp,pPara->GetDepth());
237cdf0e10cSrcweir // Cursor positionieren
238*7a980842SDamjanJovanovic ESelection aTmpSel(nTemp,0,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
256*7a980842SDamjanJovanovic ESelection aTmpSel(nTemp,0,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
ImpCheckMousePos(const Point & rPosPix,MouseTarget & reTarget)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
MouseMove(const MouseEvent & rMEvt)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
MouseButtonDown(const MouseEvent & rMEvt)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;
347*7a980842SDamjanJovanovic sal_uInt32 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 {
354*7a980842SDamjanJovanovic sal_uInt32 nEndPara = nPara;
355cdf0e10cSrcweir if ( bHasChilds && pOwner->pParaList->HasVisibleChilds(pPara) )
356cdf0e10cSrcweir nEndPara += pOwner->pParaList->GetChildCount( pPara );
357cdf0e10cSrcweir // umgekehrt rum selektieren, damit EditEngine nicht scrollt
358*7a980842SDamjanJovanovic ESelection aSel(nEndPara, EE_INDEX_MAX, 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
MouseButtonUp(const MouseEvent & rMEvt)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
ImpHideDDCursor()400cdf0e10cSrcweir void OutlinerView::ImpHideDDCursor()
401cdf0e10cSrcweir {
402cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
403cdf0e10cSrcweir if ( bDDCursorVisible )
404cdf0e10cSrcweir {
405cdf0e10cSrcweir bDDCursorVisible = sal_False;
406cdf0e10cSrcweir ImpPaintDDCursor();
407cdf0e10cSrcweir }
408cdf0e10cSrcweir }
409cdf0e10cSrcweir
ImpShowDDCursor()410cdf0e10cSrcweir void OutlinerView::ImpShowDDCursor()
411cdf0e10cSrcweir {
412cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
413cdf0e10cSrcweir if ( !bDDCursorVisible )
414cdf0e10cSrcweir {
415cdf0e10cSrcweir bDDCursorVisible = sal_True;
416cdf0e10cSrcweir ImpPaintDDCursor();
417cdf0e10cSrcweir }
418cdf0e10cSrcweir }
419cdf0e10cSrcweir
ImpPaintDDCursor()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 {
445*7a980842SDamjanJovanovic sal_uInt32 nPara = nDDCurPara;
446cdf0e10cSrcweir if ( nDDCurPara == LIST_APPEND )
447cdf0e10cSrcweir {
448cdf0e10cSrcweir Paragraph* pTemp = pOwner->pParaList->LastVisible();
449cdf0e10cSrcweir nPara = pOwner->pParaList->GetAbsPos( pTemp );
450cdf0e10cSrcweir }
451*7a980842SDamjanJovanovic aStartPointWin = pEditView->GetWindowPosTopLeft( nPara );
452cdf0e10cSrcweir if ( nDDCurPara == LIST_APPEND )
453cdf0e10cSrcweir {
454*7a980842SDamjanJovanovic long nHeight = pOwner->pEditEngine->GetTextHeight( 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
ImpGetInsertionPara(const Point & rPosPixel)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 );
480*7a980842SDamjanJovanovic Point aParaPosWin = pEditView->GetWindowPosTopLeft(nCurPara);
481*7a980842SDamjanJovanovic long nHeightRef = pOwner->pEditEngine->GetTextHeight(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
ImpToggleExpand(Paragraph * pPara)495cdf0e10cSrcweir void OutlinerView::ImpToggleExpand( Paragraph* pPara )
496cdf0e10cSrcweir {
497cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
498cdf0e10cSrcweir
499*7a980842SDamjanJovanovic sal_uInt32 nPara = 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
SetOutliner(Outliner * pOutliner)506cdf0e10cSrcweir void OutlinerView::SetOutliner( Outliner* pOutliner )
507cdf0e10cSrcweir {
508cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
509cdf0e10cSrcweir pOwner = pOutliner;
510cdf0e10cSrcweir pEditView->SetEditEngine( pOutliner->pEditEngine );
511cdf0e10cSrcweir }
512cdf0e10cSrcweir
513cdf0e10cSrcweir
514cdf0e10cSrcweir
Select(Paragraph * pParagraph,sal_Bool bSelect,sal_Bool bWithChilds)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 )
523*7a980842SDamjanJovanovic nEnd = EE_INDEX_MAX;
524cdf0e10cSrcweir
525cdf0e10cSrcweir sal_uLong nChildCount = 0;
526cdf0e10cSrcweir if ( bWithChilds )
527cdf0e10cSrcweir nChildCount = pOwner->pParaList->GetChildCount( pParagraph );
528cdf0e10cSrcweir
529*7a980842SDamjanJovanovic ESelection aSel( nPara, 0, nPara+nChildCount, nEnd );
530cdf0e10cSrcweir pEditView->SetSelection( aSel );
531cdf0e10cSrcweir return nChildCount+1;
532cdf0e10cSrcweir }
533cdf0e10cSrcweir
534cdf0e10cSrcweir
SetAttribs(const SfxItemSet & rAttrs)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
550*7a980842SDamjanJovanovic for( sal_uInt32 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
ImpGetSelectedParagraphs(sal_Bool bIncludeHiddenChilds)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 =
579*7a980842SDamjanJovanovic sal::static_int_cast< sal_uInt32 >(
580cdf0e10cSrcweir aParas.nEndPara +
581cdf0e10cSrcweir pOwner->pParaList->GetChildCount( pLast ) );
582cdf0e10cSrcweir }
583cdf0e10cSrcweir return aParas;
584cdf0e10cSrcweir }
585cdf0e10cSrcweir
586cdf0e10cSrcweir // MT: Name sollte mal geaendert werden!
AdjustDepth(short nDX)587cdf0e10cSrcweir void OutlinerView::AdjustDepth( short nDX )
588cdf0e10cSrcweir {
589cdf0e10cSrcweir Indent( nDX );
590cdf0e10cSrcweir }
591cdf0e10cSrcweir
Indent(short nDiff)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 );
611*7a980842SDamjanJovanovic for ( sal_uInt32 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.
714*7a980842SDamjanJovanovic sal_uInt32 nParas = pOwner->pParaList->GetParagraphCount();
715*7a980842SDamjanJovanovic for ( sal_uInt32 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
AdjustHeight(long nDY)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
AdjustDepth(Paragraph * pPara,short nDX,sal_Bool bWithChilds)740cdf0e10cSrcweir void OutlinerView::AdjustDepth( Paragraph* pPara, short nDX, sal_Bool bWithChilds)
741cdf0e10cSrcweir {
742cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
743*7a980842SDamjanJovanovic sal_uInt32 nStartPara = pOwner->pParaList->GetAbsPos( pPara );
744*7a980842SDamjanJovanovic sal_uInt32 nEndPara = nStartPara;
745cdf0e10cSrcweir if ( bWithChilds )
746cdf0e10cSrcweir nEndPara += pOwner->pParaList->GetChildCount( pPara );
747*7a980842SDamjanJovanovic ESelection aSel(nStartPara, 0, nEndPara, EE_INDEX_MAX );
748cdf0e10cSrcweir pEditView->SetSelection( aSel );
749cdf0e10cSrcweir AdjustDepth( nDX );
750cdf0e10cSrcweir }
751cdf0e10cSrcweir
AdjustHeight(Paragraph * pPara,long nDY,sal_Bool bWithChilds)752cdf0e10cSrcweir void OutlinerView::AdjustHeight( Paragraph* pPara, long nDY, sal_Bool bWithChilds )
753cdf0e10cSrcweir {
754cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
755*7a980842SDamjanJovanovic sal_uInt32 nStartPara = pOwner->pParaList->GetAbsPos( pPara );
756*7a980842SDamjanJovanovic sal_uInt32 nEndPara = nStartPara;
757cdf0e10cSrcweir if ( bWithChilds )
758cdf0e10cSrcweir nEndPara += pOwner->pParaList->GetChildCount( pPara );
759*7a980842SDamjanJovanovic ESelection aSel( nStartPara, 0, nEndPara, EE_INDEX_MAX );
760cdf0e10cSrcweir pEditView->SetSelection( aSel );
761cdf0e10cSrcweir AdjustHeight( nDY );
762cdf0e10cSrcweir }
763cdf0e10cSrcweir
764cdf0e10cSrcweir
GetVisArea() const765cdf0e10cSrcweir Rectangle OutlinerView::GetVisArea() const
766cdf0e10cSrcweir {
767cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
768cdf0e10cSrcweir return pEditView->GetVisArea();
769cdf0e10cSrcweir }
770cdf0e10cSrcweir
771cdf0e10cSrcweir
ImpGetDocPos(const Point & rPosPixel)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
ImpDragScroll(const Point & rPosPix)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
ImpScrollLeft()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
ImpScrollRight()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
ImpScrollDown()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
ImpScrollUp()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
Expand()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
Collapse()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
ExpandAll()915cdf0e10cSrcweir void OutlinerView::ExpandAll()
916cdf0e10cSrcweir {
917cdf0e10cSrcweir DBG_CHKTHIS( OutlinerView, 0 );
918*7a980842SDamjanJovanovic ImplExpandOrCollaps( 0, pOwner->pParaList->GetParagraphCount()-1, sal_True );
919cdf0e10cSrcweir }
920cdf0e10cSrcweir
921cdf0e10cSrcweir
CollapseAll()922cdf0e10cSrcweir void OutlinerView::CollapseAll()
923cdf0e10cSrcweir {
924cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
925*7a980842SDamjanJovanovic ImplExpandOrCollaps( 0, pOwner->pParaList->GetParagraphCount()-1, sal_False );
926cdf0e10cSrcweir }
927cdf0e10cSrcweir
ImplExpandOrCollaps(sal_uInt32 nStartPara,sal_uInt32 nEndPara,sal_Bool bExpand)928*7a980842SDamjanJovanovic void OutlinerView::ImplExpandOrCollaps( sal_uInt32 nStartPara, sal_uInt32 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
939*7a980842SDamjanJovanovic for ( sal_uInt32 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
Expand(Paragraph * pPara)961cdf0e10cSrcweir void OutlinerView::Expand( Paragraph* pPara)
962cdf0e10cSrcweir {
963cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
964cdf0e10cSrcweir pOwner->Expand( pPara );
965cdf0e10cSrcweir }
966cdf0e10cSrcweir
967cdf0e10cSrcweir
Collapse(Paragraph * pPara)968cdf0e10cSrcweir void OutlinerView::Collapse( Paragraph* pPara)
969cdf0e10cSrcweir {
970cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
971cdf0e10cSrcweir pOwner->Collapse( pPara );
972cdf0e10cSrcweir }
973cdf0e10cSrcweir
InsertText(const OutlinerParaObject & rParaObj)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 );
995*7a980842SDamjanJovanovic sal_uInt32 nStart, nParaCount;
996cdf0e10cSrcweir nParaCount = pOwner->pEditEngine->GetParagraphCount();
997*7a980842SDamjanJovanovic sal_uInt32 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
Cut()1009cdf0e10cSrcweir void OutlinerView::Cut()
1010cdf0e10cSrcweir {
1011cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1012cdf0e10cSrcweir if ( !ImpCalcSelectedPages( sal_False ) || pOwner->ImpCanDeleteSelectedPages( this ) )
1013cdf0e10cSrcweir pEditView->Cut();
1014cdf0e10cSrcweir }
1015cdf0e10cSrcweir
Paste()1016cdf0e10cSrcweir void OutlinerView::Paste()
1017cdf0e10cSrcweir {
1018cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1019cdf0e10cSrcweir PasteSpecial(); // HACK(SD ruft nicht PasteSpecial auf)
1020cdf0e10cSrcweir }
1021cdf0e10cSrcweir
PasteSpecial()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 {
1035*7a980842SDamjanJovanovic const sal_uInt32 nParaCount = pOwner->pEditEngine->GetParagraphCount();
1036cdf0e10cSrcweir
1037*7a980842SDamjanJovanovic for( sal_uInt32 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
CreateSelectionList()1047cdf0e10cSrcweir List* OutlinerView::CreateSelectionList()
1048cdf0e10cSrcweir {
1049cdf0e10cSrcweir DBG_CHKTHIS( OutlinerView, 0 );
1050cdf0e10cSrcweir
1051cdf0e10cSrcweir ParaRange aParas = ImpGetSelectedParagraphs( sal_True );
1052cdf0e10cSrcweir List* pSelList = new List;
1053*7a980842SDamjanJovanovic for ( sal_uInt32 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
GetStyleSheet() const1061cdf0e10cSrcweir SfxStyleSheet* OutlinerView::GetStyleSheet() const
1062cdf0e10cSrcweir {
1063cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1064cdf0e10cSrcweir return pEditView->GetStyleSheet();
1065cdf0e10cSrcweir }
1066cdf0e10cSrcweir
SetStyleSheet(SfxStyleSheet * pStyle)1067cdf0e10cSrcweir void OutlinerView::SetStyleSheet( SfxStyleSheet* pStyle )
1068cdf0e10cSrcweir {
1069cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1070cdf0e10cSrcweir pEditView->SetStyleSheet( pStyle );
1071cdf0e10cSrcweir
1072cdf0e10cSrcweir ParaRange aSel = ImpGetSelectedParagraphs( sal_True );
1073*7a980842SDamjanJovanovic for( sal_uInt32 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
1074cdf0e10cSrcweir {
1075cdf0e10cSrcweir pOwner->ImplCheckNumBulletItem( nPara );
1076cdf0e10cSrcweir pOwner->ImplCalcBulletText( nPara, sal_False, sal_False );
1077cdf0e10cSrcweir }
1078cdf0e10cSrcweir }
1079cdf0e10cSrcweir
GetPointer(const Point & rPosPixel)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
ImpInitPaste(sal_uInt32 & rStart)1105*7a980842SDamjanJovanovic sal_uInt32 OutlinerView::ImpInitPaste( sal_uInt32& rStart )
1106cdf0e10cSrcweir {
1107cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1108cdf0e10cSrcweir pOwner->bPasting = sal_True;
1109cdf0e10cSrcweir ESelection aSelection( pEditView->GetSelection() );
1110cdf0e10cSrcweir aSelection.Adjust();
1111cdf0e10cSrcweir rStart = aSelection.nStartPara;
1112*7a980842SDamjanJovanovic sal_uInt32 nSize = aSelection.nEndPara - aSelection.nStartPara + 1;
1113cdf0e10cSrcweir return nSize;
1114cdf0e10cSrcweir }
1115cdf0e10cSrcweir
1116cdf0e10cSrcweir
ImpPasted(sal_uInt32 nStart,sal_uInt32 nPrevParaCount,sal_uInt32 nSize)1117*7a980842SDamjanJovanovic void OutlinerView::ImpPasted( sal_uInt32 nStart, sal_uInt32 nPrevParaCount, sal_uInt32 nSize)
1118cdf0e10cSrcweir {
1119cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1120cdf0e10cSrcweir pOwner->bPasting = sal_False;
1121*7a980842SDamjanJovanovic sal_uInt32 nCurParaCount = pOwner->pEditEngine->GetParagraphCount();
1122cdf0e10cSrcweir if( nCurParaCount < nPrevParaCount )
1123*7a980842SDamjanJovanovic nSize = nSize - ( nPrevParaCount - nCurParaCount );
1124cdf0e10cSrcweir else
1125*7a980842SDamjanJovanovic nSize = nSize + ( nCurParaCount - nPrevParaCount );
1126cdf0e10cSrcweir pOwner->ImpTextPasted( nStart, nSize );
1127cdf0e10cSrcweir }
1128cdf0e10cSrcweir
1129cdf0e10cSrcweir
Command(const CommandEvent & rCEvt)1130cdf0e10cSrcweir void OutlinerView::Command( const CommandEvent& rCEvt )
1131cdf0e10cSrcweir {
1132cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1133cdf0e10cSrcweir pEditView->Command( rCEvt );
1134cdf0e10cSrcweir }
1135cdf0e10cSrcweir
1136cdf0e10cSrcweir
SelectRange(sal_uInt32 nFirst,sal_uInt32 nCount)1137*7a980842SDamjanJovanovic void OutlinerView::SelectRange( sal_uInt32 nFirst, sal_uInt32 nCount )
1138cdf0e10cSrcweir {
1139cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1140*7a980842SDamjanJovanovic sal_uInt32 nLast = nFirst+nCount;
1141*7a980842SDamjanJovanovic nCount = pOwner->pParaList->GetParagraphCount();
1142cdf0e10cSrcweir if( nLast <= nCount )
1143cdf0e10cSrcweir nLast = nCount - 1;
1144*7a980842SDamjanJovanovic ESelection aSel( nFirst, 0, nLast, EE_INDEX_MAX );
1145cdf0e10cSrcweir pEditView->SetSelection( aSel );
1146cdf0e10cSrcweir }
1147cdf0e10cSrcweir
1148cdf0e10cSrcweir
ImpCalcSelectedPages(sal_Bool bIncludeFirstSelected)1149cdf0e10cSrcweir sal_uInt16 OutlinerView::ImpCalcSelectedPages( sal_Bool bIncludeFirstSelected )
1150cdf0e10cSrcweir {
1151cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1152cdf0e10cSrcweir
1153cdf0e10cSrcweir ESelection aSel( pEditView->GetSelection() );
1154cdf0e10cSrcweir aSel.Adjust();
1155cdf0e10cSrcweir
1156cdf0e10cSrcweir sal_uInt16 nPages = 0;
1157cdf0e10cSrcweir sal_uInt16 nFirstPage = 0xFFFF;
1158cdf0e10cSrcweir sal_uInt16 nStartPara = aSel.nStartPara;
1159cdf0e10cSrcweir if ( !bIncludeFirstSelected )
1160cdf0e10cSrcweir nStartPara++; // alle nach StartPara kommenden Absaetze werden geloescht
1161*7a980842SDamjanJovanovic for ( sal_uInt32 nPara = nStartPara; nPara <= aSel.nEndPara; nPara++ )
1162cdf0e10cSrcweir {
1163cdf0e10cSrcweir Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
1164cdf0e10cSrcweir DBG_ASSERT(pPara, "ImpCalcSelectedPages: ungueltige Selection? ");
1165cdf0e10cSrcweir if( pPara->HasFlag(PARAFLAG_ISPAGE) )
1166cdf0e10cSrcweir {
1167cdf0e10cSrcweir nPages++;
1168cdf0e10cSrcweir if( nFirstPage == 0xFFFF )
1169cdf0e10cSrcweir nFirstPage = nPara;
1170cdf0e10cSrcweir }
1171cdf0e10cSrcweir }
1172cdf0e10cSrcweir
1173cdf0e10cSrcweir if( nPages )
1174cdf0e10cSrcweir {
1175cdf0e10cSrcweir pOwner->nDepthChangedHdlPrevDepth = nPages;
1176cdf0e10cSrcweir pOwner->pHdlParagraph = 0;
1177cdf0e10cSrcweir pOwner->mnFirstSelPage = nFirstPage;
1178cdf0e10cSrcweir }
1179cdf0e10cSrcweir
1180cdf0e10cSrcweir return nPages;
1181cdf0e10cSrcweir }
1182cdf0e10cSrcweir
1183cdf0e10cSrcweir
ToggleBullets()1184cdf0e10cSrcweir void OutlinerView::ToggleBullets()
1185cdf0e10cSrcweir {
1186af89ca6eSOliver-Rainer Wittmann pOwner->UndoActionStart( OLUNDO_DEPTH );
1187cdf0e10cSrcweir
1188af89ca6eSOliver-Rainer Wittmann ESelection aSel( pEditView->GetSelection() );
1189af89ca6eSOliver-Rainer Wittmann aSel.Adjust();
1190cdf0e10cSrcweir
1191af89ca6eSOliver-Rainer Wittmann const bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
1192af89ca6eSOliver-Rainer Wittmann pOwner->pEditEngine->SetUpdateMode( sal_False );
1193cdf0e10cSrcweir
1194af89ca6eSOliver-Rainer Wittmann sal_Int16 nNewDepth = -2;
1195af89ca6eSOliver-Rainer Wittmann const SvxNumRule* pDefaultBulletNumRule = 0;
1196cdf0e10cSrcweir
1197*7a980842SDamjanJovanovic for ( sal_uInt32 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
1198af89ca6eSOliver-Rainer Wittmann {
1199af89ca6eSOliver-Rainer Wittmann Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
1200af89ca6eSOliver-Rainer Wittmann DBG_ASSERT(pPara, "OutlinerView::ToggleBullets(), illegal selection?");
1201cdf0e10cSrcweir
1202af89ca6eSOliver-Rainer Wittmann if( pPara )
1203af89ca6eSOliver-Rainer Wittmann {
1204af89ca6eSOliver-Rainer Wittmann if( nNewDepth == -2 )
1205af89ca6eSOliver-Rainer Wittmann {
1206af89ca6eSOliver-Rainer Wittmann nNewDepth = (pOwner->GetDepth(nPara) == -1) ? 0 : -1;
1207af89ca6eSOliver-Rainer Wittmann if ( nNewDepth == 0 )
1208af89ca6eSOliver-Rainer Wittmann {
1209af89ca6eSOliver-Rainer Wittmann // determine default numbering rule for bullets
1210af89ca6eSOliver-Rainer Wittmann const ESelection aSelection(nPara, 0);
1211af89ca6eSOliver-Rainer Wittmann const SfxItemSet aTmpSet(pOwner->pEditEngine->GetAttribs(aSelection));
1212af89ca6eSOliver-Rainer Wittmann const SfxPoolItem& rPoolItem = aTmpSet.GetPool()->GetDefaultItem( EE_PARA_NUMBULLET );
1213af89ca6eSOliver-Rainer Wittmann const SvxNumBulletItem* pNumBulletItem = dynamic_cast< const SvxNumBulletItem* >(&rPoolItem);
1214af89ca6eSOliver-Rainer Wittmann pDefaultBulletNumRule = pNumBulletItem ? pNumBulletItem->GetNumRule() : 0;
1215af89ca6eSOliver-Rainer Wittmann }
1216af89ca6eSOliver-Rainer Wittmann }
1217cdf0e10cSrcweir
1218af89ca6eSOliver-Rainer Wittmann pOwner->SetDepth( pPara, nNewDepth );
1219cdf0e10cSrcweir
1220af89ca6eSOliver-Rainer Wittmann if( nNewDepth == -1 )
1221cdf0e10cSrcweir {
1222af89ca6eSOliver-Rainer Wittmann const SfxItemSet& rAttrs = pOwner->GetParaAttribs( nPara );
1223af89ca6eSOliver-Rainer Wittmann if ( rAttrs.GetItemState( EE_PARA_BULLETSTATE ) == SFX_ITEM_SET )
1224cdf0e10cSrcweir {
1225cdf0e10cSrcweir SfxItemSet aAttrs(rAttrs);
1226cdf0e10cSrcweir aAttrs.ClearItem( EE_PARA_BULLETSTATE );
1227cdf0e10cSrcweir pOwner->SetParaAttribs( nPara, aAttrs );
1228cdf0e10cSrcweir }
1229cdf0e10cSrcweir }
1230af89ca6eSOliver-Rainer Wittmann else
1231af89ca6eSOliver-Rainer Wittmann {
1232af89ca6eSOliver-Rainer Wittmann if ( pDefaultBulletNumRule )
1233af89ca6eSOliver-Rainer Wittmann {
1234af89ca6eSOliver-Rainer Wittmann const SvxNumberFormat* pFmt = pOwner ->GetNumberFormat( nPara );
1235af89ca6eSOliver-Rainer Wittmann if ( !pFmt
1236af89ca6eSOliver-Rainer Wittmann || ( pFmt->GetNumberingType() != SVX_NUM_BITMAP
1237af89ca6eSOliver-Rainer Wittmann && pFmt->GetNumberingType() != SVX_NUM_CHAR_SPECIAL ) )
1238af89ca6eSOliver-Rainer Wittmann {
1239af89ca6eSOliver-Rainer Wittmann SfxItemSet aAttrs( pOwner->GetParaAttribs( nPara ) );
1240af89ca6eSOliver-Rainer Wittmann SvxNumRule aNewNumRule( *pDefaultBulletNumRule );
1241af89ca6eSOliver-Rainer Wittmann aAttrs.Put( SvxNumBulletItem( aNewNumRule ), EE_PARA_NUMBULLET );
1242af89ca6eSOliver-Rainer Wittmann pOwner->SetParaAttribs( nPara, aAttrs );
1243af89ca6eSOliver-Rainer Wittmann }
1244af89ca6eSOliver-Rainer Wittmann }
1245af89ca6eSOliver-Rainer Wittmann }
1246af89ca6eSOliver-Rainer Wittmann }
1247af89ca6eSOliver-Rainer Wittmann }
1248cdf0e10cSrcweir
1249*7a980842SDamjanJovanovic const sal_uInt32 nParaCount = pOwner->pParaList->GetParagraphCount();
1250cdf0e10cSrcweir pOwner->ImplCheckParagraphs( aSel.nStartPara, nParaCount );
1251cdf0e10cSrcweir pOwner->pEditEngine->QuickMarkInvalid( ESelection( aSel.nStartPara, 0, nParaCount, 0 ) );
1252cdf0e10cSrcweir
1253af89ca6eSOliver-Rainer Wittmann pOwner->pEditEngine->SetUpdateMode( bUpdate );
1254cdf0e10cSrcweir
1255af89ca6eSOliver-Rainer Wittmann pOwner->UndoActionEnd( OLUNDO_DEPTH );
1256cdf0e10cSrcweir }
1257cdf0e10cSrcweir
1258766ce4d0SZheng Fan
ToggleBulletsNumbering(const bool bToggle,const bool bHandleBullets,const SvxNumRule * pNumRule)1259af89ca6eSOliver-Rainer Wittmann void OutlinerView::ToggleBulletsNumbering(
1260af89ca6eSOliver-Rainer Wittmann const bool bToggle,
1261af89ca6eSOliver-Rainer Wittmann const bool bHandleBullets,
1262af89ca6eSOliver-Rainer Wittmann const SvxNumRule* pNumRule )
1263af89ca6eSOliver-Rainer Wittmann {
1264af89ca6eSOliver-Rainer Wittmann ESelection aSel( pEditView->GetSelection() );
1265af89ca6eSOliver-Rainer Wittmann aSel.Adjust();
1266766ce4d0SZheng Fan
1267af89ca6eSOliver-Rainer Wittmann bool bToggleOn = true;
1268af89ca6eSOliver-Rainer Wittmann if ( bToggle )
1269af89ca6eSOliver-Rainer Wittmann {
1270af89ca6eSOliver-Rainer Wittmann bToggleOn = false;
1271af89ca6eSOliver-Rainer Wittmann const sal_Int16 nBulletNumberingStatus( pOwner->GetBulletsNumberingStatus( aSel.nStartPara, aSel.nEndPara ) );
1272af89ca6eSOliver-Rainer Wittmann if ( nBulletNumberingStatus != 0 && bHandleBullets )
1273af89ca6eSOliver-Rainer Wittmann {
1274af89ca6eSOliver-Rainer Wittmann // not all paragraphs have bullets and method called to toggle bullets --> bullets on
1275af89ca6eSOliver-Rainer Wittmann bToggleOn = true;
1276af89ca6eSOliver-Rainer Wittmann }
1277af89ca6eSOliver-Rainer Wittmann else if ( nBulletNumberingStatus != 1 && !bHandleBullets )
1278af89ca6eSOliver-Rainer Wittmann {
1279af89ca6eSOliver-Rainer Wittmann // not all paragraphs have numbering and method called to toggle numberings --> numberings on
1280af89ca6eSOliver-Rainer Wittmann bToggleOn = true;
1281af89ca6eSOliver-Rainer Wittmann }
1282af89ca6eSOliver-Rainer Wittmann }
1283af89ca6eSOliver-Rainer Wittmann if ( bToggleOn )
1284af89ca6eSOliver-Rainer Wittmann {
1285af89ca6eSOliver-Rainer Wittmann // apply bullets/numbering for selected paragraphs
1286af89ca6eSOliver-Rainer Wittmann ApplyBulletsNumbering( bHandleBullets, pNumRule, bToggle, true );
1287af89ca6eSOliver-Rainer Wittmann }
1288af89ca6eSOliver-Rainer Wittmann else
1289af89ca6eSOliver-Rainer Wittmann {
1290af89ca6eSOliver-Rainer Wittmann // switch off bullets/numbering for selected paragraphs
1291af89ca6eSOliver-Rainer Wittmann SwitchOffBulletsNumbering( true );
1292af89ca6eSOliver-Rainer Wittmann }
1293766ce4d0SZheng Fan
1294af89ca6eSOliver-Rainer Wittmann return;
1295af89ca6eSOliver-Rainer Wittmann }
1296766ce4d0SZheng Fan
1297766ce4d0SZheng Fan
EnableBullets()1298af89ca6eSOliver-Rainer Wittmann void OutlinerView::EnableBullets()
1299af89ca6eSOliver-Rainer Wittmann {
1300af89ca6eSOliver-Rainer Wittmann pOwner->UndoActionStart( OLUNDO_DEPTH );
1301766ce4d0SZheng Fan
1302af89ca6eSOliver-Rainer Wittmann ESelection aSel( pEditView->GetSelection() );
1303af89ca6eSOliver-Rainer Wittmann aSel.Adjust();
1304766ce4d0SZheng Fan
1305af89ca6eSOliver-Rainer Wittmann const bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
1306af89ca6eSOliver-Rainer Wittmann pOwner->pEditEngine->SetUpdateMode( sal_False );
1307766ce4d0SZheng Fan
1308*7a980842SDamjanJovanovic for ( sal_uInt32 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
1309af89ca6eSOliver-Rainer Wittmann {
1310af89ca6eSOliver-Rainer Wittmann Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
1311af89ca6eSOliver-Rainer Wittmann DBG_ASSERT(pPara, "OutlinerView::EnableBullets(), illegal selection?");
1312766ce4d0SZheng Fan
1313af89ca6eSOliver-Rainer Wittmann if( pPara && (pOwner->GetDepth(nPara) == -1) )
1314af89ca6eSOliver-Rainer Wittmann {
1315af89ca6eSOliver-Rainer Wittmann pOwner->SetDepth( pPara, 0 );
1316af89ca6eSOliver-Rainer Wittmann }
1317af89ca6eSOliver-Rainer Wittmann }
1318766ce4d0SZheng Fan
1319*7a980842SDamjanJovanovic sal_uInt32 nParaCount = pOwner->pParaList->GetParagraphCount();
1320766ce4d0SZheng Fan pOwner->ImplCheckParagraphs( aSel.nStartPara, nParaCount );
1321766ce4d0SZheng Fan pOwner->pEditEngine->QuickMarkInvalid( ESelection( aSel.nStartPara, 0, nParaCount, 0 ) );
1322766ce4d0SZheng Fan
1323af89ca6eSOliver-Rainer Wittmann pOwner->pEditEngine->SetUpdateMode( bUpdate );
1324766ce4d0SZheng Fan
1325af89ca6eSOliver-Rainer Wittmann pOwner->UndoActionEnd( OLUNDO_DEPTH );
1326766ce4d0SZheng Fan }
1327766ce4d0SZheng Fan
1328af89ca6eSOliver-Rainer Wittmann
ApplyBulletsNumbering(const bool bHandleBullets,const SvxNumRule * pNewNumRule,const bool bCheckCurrentNumRuleBeforeApplyingNewNumRule,const bool bAtSelection)1329af89ca6eSOliver-Rainer Wittmann void OutlinerView::ApplyBulletsNumbering(
1330af89ca6eSOliver-Rainer Wittmann const bool bHandleBullets,
1331af89ca6eSOliver-Rainer Wittmann const SvxNumRule* pNewNumRule,
1332af89ca6eSOliver-Rainer Wittmann const bool bCheckCurrentNumRuleBeforeApplyingNewNumRule,
1333af89ca6eSOliver-Rainer Wittmann const bool bAtSelection )
1334cdf0e10cSrcweir {
1335af89ca6eSOliver-Rainer Wittmann if (!pOwner || !pOwner->pEditEngine || !pOwner->pParaList)
1336af89ca6eSOliver-Rainer Wittmann {
1337af89ca6eSOliver-Rainer Wittmann return;
1338af89ca6eSOliver-Rainer Wittmann }
1339cdf0e10cSrcweir
1340af89ca6eSOliver-Rainer Wittmann pOwner->UndoActionStart(OLUNDO_DEPTH);
1341af89ca6eSOliver-Rainer Wittmann const sal_Bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
1342af89ca6eSOliver-Rainer Wittmann pOwner->pEditEngine->SetUpdateMode(sal_False);
1343cdf0e10cSrcweir
1344*7a980842SDamjanJovanovic sal_uInt32 nStartPara = 0;
1345*7a980842SDamjanJovanovic sal_uInt32 nEndPara = 0;
1346af89ca6eSOliver-Rainer Wittmann if ( bAtSelection )
1347af89ca6eSOliver-Rainer Wittmann {
1348af89ca6eSOliver-Rainer Wittmann ESelection aSel( pEditView->GetSelection() );
1349af89ca6eSOliver-Rainer Wittmann aSel.Adjust();
1350af89ca6eSOliver-Rainer Wittmann nStartPara = aSel.nStartPara;
1351af89ca6eSOliver-Rainer Wittmann nEndPara = aSel.nEndPara;
1352af89ca6eSOliver-Rainer Wittmann }
1353af89ca6eSOliver-Rainer Wittmann else
1354af89ca6eSOliver-Rainer Wittmann {
1355af89ca6eSOliver-Rainer Wittmann nStartPara = 0;
1356af89ca6eSOliver-Rainer Wittmann nEndPara = pOwner->pParaList->GetParagraphCount() - 1;
1357af89ca6eSOliver-Rainer Wittmann }
1358cdf0e10cSrcweir
1359*7a980842SDamjanJovanovic for (sal_uInt32 nPara = nStartPara; nPara <= nEndPara; nPara++)
1360af89ca6eSOliver-Rainer Wittmann {
1361af89ca6eSOliver-Rainer Wittmann Paragraph* pPara = pOwner->pParaList->GetParagraph(nPara);
1362af89ca6eSOliver-Rainer Wittmann DBG_ASSERT(pPara, "OutlinerView::ApplyBulletsNumbering(..), illegal selection?");
1363cdf0e10cSrcweir
1364af89ca6eSOliver-Rainer Wittmann if (pPara)
1365af89ca6eSOliver-Rainer Wittmann {
1366af89ca6eSOliver-Rainer Wittmann const sal_Int16 nDepth = pOwner->GetDepth(nPara);
1367af89ca6eSOliver-Rainer Wittmann if ( nDepth == -1 )
1368af89ca6eSOliver-Rainer Wittmann {
1369af89ca6eSOliver-Rainer Wittmann pOwner->SetDepth( pPara, 0 );
1370af89ca6eSOliver-Rainer Wittmann }
1371cdf0e10cSrcweir
1372af89ca6eSOliver-Rainer Wittmann const SfxItemSet& rAttrs = pOwner->GetParaAttribs(nPara);
1373af89ca6eSOliver-Rainer Wittmann SfxItemSet aAttrs(rAttrs);
1374af89ca6eSOliver-Rainer Wittmann aAttrs.Put(SfxBoolItem(EE_PARA_BULLETSTATE, true));
1375cdf0e10cSrcweir
1376af89ca6eSOliver-Rainer Wittmann // apply new numbering rule
1377af89ca6eSOliver-Rainer Wittmann if ( pNewNumRule )
1378af89ca6eSOliver-Rainer Wittmann {
1379af89ca6eSOliver-Rainer Wittmann bool bApplyNumRule = false;
1380af89ca6eSOliver-Rainer Wittmann if ( !bCheckCurrentNumRuleBeforeApplyingNewNumRule )
1381af89ca6eSOliver-Rainer Wittmann {
1382af89ca6eSOliver-Rainer Wittmann bApplyNumRule = true;
1383af89ca6eSOliver-Rainer Wittmann }
1384af89ca6eSOliver-Rainer Wittmann else
1385af89ca6eSOliver-Rainer Wittmann {
1386af89ca6eSOliver-Rainer Wittmann const SvxNumberFormat* pFmt = pOwner ->GetNumberFormat(nPara);
1387af89ca6eSOliver-Rainer Wittmann if (!pFmt)
1388af89ca6eSOliver-Rainer Wittmann {
1389af89ca6eSOliver-Rainer Wittmann bApplyNumRule = true;
1390af89ca6eSOliver-Rainer Wittmann }
1391af89ca6eSOliver-Rainer Wittmann else
1392af89ca6eSOliver-Rainer Wittmann {
1393af89ca6eSOliver-Rainer Wittmann sal_Int16 nNumType = pFmt->GetNumberingType();
1394af89ca6eSOliver-Rainer Wittmann if ( bHandleBullets
1395af89ca6eSOliver-Rainer Wittmann && nNumType != SVX_NUM_BITMAP && nNumType != SVX_NUM_CHAR_SPECIAL)
1396af89ca6eSOliver-Rainer Wittmann {
1397af89ca6eSOliver-Rainer Wittmann // Set to Normal bullet, old bullet type is Numbering bullet.
1398af89ca6eSOliver-Rainer Wittmann bApplyNumRule = true;
1399af89ca6eSOliver-Rainer Wittmann }
1400af89ca6eSOliver-Rainer Wittmann else if ( !bHandleBullets
1401af89ca6eSOliver-Rainer Wittmann && (nNumType == SVX_NUM_BITMAP || nNumType == SVX_NUM_CHAR_SPECIAL))
1402af89ca6eSOliver-Rainer Wittmann {
1403af89ca6eSOliver-Rainer Wittmann // Set to Numbering bullet, old bullet type is Normal bullet.
1404af89ca6eSOliver-Rainer Wittmann bApplyNumRule = true;
1405af89ca6eSOliver-Rainer Wittmann }
1406af89ca6eSOliver-Rainer Wittmann }
1407af89ca6eSOliver-Rainer Wittmann }
1408cdf0e10cSrcweir
1409af89ca6eSOliver-Rainer Wittmann if ( bApplyNumRule )
1410af89ca6eSOliver-Rainer Wittmann {
1411af89ca6eSOliver-Rainer Wittmann SvxNumRule aNewRule(*pNewNumRule);
1412af89ca6eSOliver-Rainer Wittmann
1413af89ca6eSOliver-Rainer Wittmann // Get old bullet space.
1414af89ca6eSOliver-Rainer Wittmann {
1415af89ca6eSOliver-Rainer Wittmann const SfxPoolItem* pPoolItem=NULL;
1416af89ca6eSOliver-Rainer Wittmann SfxItemState eState = rAttrs.GetItemState(EE_PARA_NUMBULLET, sal_False, &pPoolItem);
1417af89ca6eSOliver-Rainer Wittmann if (eState != SFX_ITEM_SET)
1418af89ca6eSOliver-Rainer Wittmann {
1419af89ca6eSOliver-Rainer Wittmann // Use default value when has not contain bullet item.
1420af89ca6eSOliver-Rainer Wittmann ESelection aSelection(nPara, 0);
1421af89ca6eSOliver-Rainer Wittmann SfxItemSet aTmpSet(pOwner->pEditEngine->GetAttribs(aSelection));
1422af89ca6eSOliver-Rainer Wittmann pPoolItem = aTmpSet.GetItem(EE_PARA_NUMBULLET);
1423af89ca6eSOliver-Rainer Wittmann }
1424af89ca6eSOliver-Rainer Wittmann
1425af89ca6eSOliver-Rainer Wittmann const SvxNumBulletItem* pNumBulletItem = dynamic_cast< const SvxNumBulletItem* >(pPoolItem);
1426af89ca6eSOliver-Rainer Wittmann if (pNumBulletItem)
1427af89ca6eSOliver-Rainer Wittmann {
1428af89ca6eSOliver-Rainer Wittmann const sal_uInt16 nLevelCnt = Min(pNumBulletItem->GetNumRule()->GetLevelCount(), aNewRule.GetLevelCount());
1429af89ca6eSOliver-Rainer Wittmann for ( sal_uInt16 nLevel = 0; nLevel < nLevelCnt; ++nLevel )
1430af89ca6eSOliver-Rainer Wittmann {
1431af89ca6eSOliver-Rainer Wittmann const SvxNumberFormat* pOldFmt = pNumBulletItem->GetNumRule()->Get(nLevel);
1432af89ca6eSOliver-Rainer Wittmann const SvxNumberFormat* pNewFmt = aNewRule.Get(nLevel);
1433af89ca6eSOliver-Rainer Wittmann if (pOldFmt && pNewFmt && (pOldFmt->GetFirstLineOffset() != pNewFmt->GetFirstLineOffset() || pOldFmt->GetAbsLSpace() != pNewFmt->GetAbsLSpace()))
1434af89ca6eSOliver-Rainer Wittmann {
1435af89ca6eSOliver-Rainer Wittmann SvxNumberFormat* pNewFmtClone = new SvxNumberFormat(*pNewFmt);
1436af89ca6eSOliver-Rainer Wittmann pNewFmtClone->SetFirstLineOffset(pOldFmt->GetFirstLineOffset());
1437af89ca6eSOliver-Rainer Wittmann pNewFmtClone->SetAbsLSpace(pOldFmt->GetAbsLSpace());
1438af89ca6eSOliver-Rainer Wittmann aNewRule.SetLevel(nLevel, pNewFmtClone);
1439af89ca6eSOliver-Rainer Wittmann delete pNewFmtClone;
1440af89ca6eSOliver-Rainer Wittmann }
1441af89ca6eSOliver-Rainer Wittmann }
1442af89ca6eSOliver-Rainer Wittmann }
1443af89ca6eSOliver-Rainer Wittmann }
1444af89ca6eSOliver-Rainer Wittmann
1445af89ca6eSOliver-Rainer Wittmann aAttrs.Put(SvxNumBulletItem(aNewRule), EE_PARA_NUMBULLET);
1446af89ca6eSOliver-Rainer Wittmann }
1447af89ca6eSOliver-Rainer Wittmann }
1448af89ca6eSOliver-Rainer Wittmann pOwner->SetParaAttribs(nPara, aAttrs);
1449af89ca6eSOliver-Rainer Wittmann }
1450af89ca6eSOliver-Rainer Wittmann }
1451cdf0e10cSrcweir
1452*7a980842SDamjanJovanovic const sal_uInt32 nParaCount = pOwner->pParaList->GetParagraphCount();
1453af89ca6eSOliver-Rainer Wittmann pOwner->ImplCheckParagraphs( nStartPara, nParaCount );
1454af89ca6eSOliver-Rainer Wittmann pOwner->pEditEngine->QuickMarkInvalid( ESelection( nStartPara, 0, nParaCount, 0 ) );
1455766ce4d0SZheng Fan
1456af89ca6eSOliver-Rainer Wittmann pOwner->pEditEngine->SetUpdateMode( bUpdate );
1457766ce4d0SZheng Fan
1458af89ca6eSOliver-Rainer Wittmann pOwner->UndoActionEnd( OLUNDO_DEPTH );
1459766ce4d0SZheng Fan
1460af89ca6eSOliver-Rainer Wittmann return;
1461af89ca6eSOliver-Rainer Wittmann }
1462766ce4d0SZheng Fan
1463766ce4d0SZheng Fan
SwitchOffBulletsNumbering(const bool bAtSelection)1464af89ca6eSOliver-Rainer Wittmann void OutlinerView::SwitchOffBulletsNumbering(
1465af89ca6eSOliver-Rainer Wittmann const bool bAtSelection )
1466af89ca6eSOliver-Rainer Wittmann {
1467*7a980842SDamjanJovanovic sal_uInt32 nStartPara = 0;
1468*7a980842SDamjanJovanovic sal_uInt32 nEndPara = 0;
1469af89ca6eSOliver-Rainer Wittmann if ( bAtSelection )
1470af89ca6eSOliver-Rainer Wittmann {
1471af89ca6eSOliver-Rainer Wittmann ESelection aSel( pEditView->GetSelection() );
1472af89ca6eSOliver-Rainer Wittmann aSel.Adjust();
1473af89ca6eSOliver-Rainer Wittmann nStartPara = aSel.nStartPara;
1474af89ca6eSOliver-Rainer Wittmann nEndPara = aSel.nEndPara;
1475af89ca6eSOliver-Rainer Wittmann }
1476af89ca6eSOliver-Rainer Wittmann else
1477af89ca6eSOliver-Rainer Wittmann {
1478af89ca6eSOliver-Rainer Wittmann nStartPara = 0;
1479af89ca6eSOliver-Rainer Wittmann nEndPara = pOwner->pParaList->GetParagraphCount() - 1;
1480af89ca6eSOliver-Rainer Wittmann }
1481766ce4d0SZheng Fan
1482af89ca6eSOliver-Rainer Wittmann pOwner->UndoActionStart( OLUNDO_DEPTH );
1483af89ca6eSOliver-Rainer Wittmann const bool bUpdate = pOwner->pEditEngine->GetUpdateMode();
1484af89ca6eSOliver-Rainer Wittmann pOwner->pEditEngine->SetUpdateMode( sal_False );
1485766ce4d0SZheng Fan
1486*7a980842SDamjanJovanovic for ( sal_uInt32 nPara = nStartPara; nPara <= nEndPara; ++nPara )
1487af89ca6eSOliver-Rainer Wittmann {
1488af89ca6eSOliver-Rainer Wittmann Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
1489af89ca6eSOliver-Rainer Wittmann DBG_ASSERT(pPara, "OutlinerView::SwitchOffBulletsNumbering(...), illegal paragraph index?");
1490766ce4d0SZheng Fan
1491af89ca6eSOliver-Rainer Wittmann if( pPara )
1492af89ca6eSOliver-Rainer Wittmann {
1493af89ca6eSOliver-Rainer Wittmann pOwner->SetDepth( pPara, -1 );
1494766ce4d0SZheng Fan
1495af89ca6eSOliver-Rainer Wittmann const SfxItemSet& rAttrs = pOwner->GetParaAttribs( nPara );
1496af89ca6eSOliver-Rainer Wittmann if (rAttrs.GetItemState( EE_PARA_BULLETSTATE ) == SFX_ITEM_SET)
1497af89ca6eSOliver-Rainer Wittmann {
1498af89ca6eSOliver-Rainer Wittmann SfxItemSet aAttrs(rAttrs);
1499af89ca6eSOliver-Rainer Wittmann aAttrs.ClearItem( EE_PARA_BULLETSTATE );
1500af89ca6eSOliver-Rainer Wittmann pOwner->SetParaAttribs( nPara, aAttrs );
1501af89ca6eSOliver-Rainer Wittmann }
1502af89ca6eSOliver-Rainer Wittmann }
1503af89ca6eSOliver-Rainer Wittmann }
1504766ce4d0SZheng Fan
1505*7a980842SDamjanJovanovic const sal_uInt32 nParaCount = pOwner->pParaList->GetParagraphCount();
1506af89ca6eSOliver-Rainer Wittmann pOwner->ImplCheckParagraphs( nStartPara, nParaCount );
1507af89ca6eSOliver-Rainer Wittmann pOwner->pEditEngine->QuickMarkInvalid( ESelection( nStartPara, 0, nParaCount, 0 ) );
1508766ce4d0SZheng Fan
1509af89ca6eSOliver-Rainer Wittmann pOwner->pEditEngine->SetUpdateMode( bUpdate );
1510af89ca6eSOliver-Rainer Wittmann pOwner->UndoActionEnd( OLUNDO_DEPTH );
1511766ce4d0SZheng Fan }
1512cdf0e10cSrcweir
1513af89ca6eSOliver-Rainer Wittmann
RemoveAttribsKeepLanguages(sal_Bool bRemoveParaAttribs)1514cdf0e10cSrcweir void OutlinerView::RemoveAttribsKeepLanguages( sal_Bool bRemoveParaAttribs )
1515cdf0e10cSrcweir {
1516cdf0e10cSrcweir RemoveAttribs( bRemoveParaAttribs, 0, sal_True /*keep language attribs*/ );
1517cdf0e10cSrcweir }
1518cdf0e10cSrcweir
RemoveAttribs(sal_Bool bRemoveParaAttribs,sal_uInt16 nWhich,sal_Bool bKeepLanguages)1519cdf0e10cSrcweir void OutlinerView::RemoveAttribs( sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich, sal_Bool bKeepLanguages )
1520cdf0e10cSrcweir {
1521cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1522cdf0e10cSrcweir sal_Bool bUpdate = pOwner->GetUpdateMode();
1523cdf0e10cSrcweir pOwner->SetUpdateMode( sal_False );
1524cdf0e10cSrcweir pOwner->UndoActionStart( OLUNDO_ATTR );
1525cdf0e10cSrcweir if (bKeepLanguages)
1526cdf0e10cSrcweir pEditView->RemoveAttribsKeepLanguages( bRemoveParaAttribs );
1527cdf0e10cSrcweir else
1528cdf0e10cSrcweir pEditView->RemoveAttribs( bRemoveParaAttribs, nWhich );
1529cdf0e10cSrcweir if ( bRemoveParaAttribs )
1530cdf0e10cSrcweir {
1531cdf0e10cSrcweir // Ueber alle Absaetze, und Einrueckung und Level einstellen
1532cdf0e10cSrcweir ESelection aSel = pEditView->GetSelection();
1533cdf0e10cSrcweir aSel.Adjust();
1534*7a980842SDamjanJovanovic for ( sal_uInt32 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++ )
1535cdf0e10cSrcweir {
1536cdf0e10cSrcweir Paragraph* pPara = pOwner->pParaList->GetParagraph( nPara );
1537cdf0e10cSrcweir pOwner->ImplInitDepth( nPara, pPara->GetDepth(), sal_False, sal_False );
1538cdf0e10cSrcweir }
1539cdf0e10cSrcweir }
1540cdf0e10cSrcweir pOwner->UndoActionEnd( OLUNDO_ATTR );
1541cdf0e10cSrcweir pOwner->SetUpdateMode( bUpdate );
1542cdf0e10cSrcweir }
1543cdf0e10cSrcweir
1544cdf0e10cSrcweir
1545cdf0e10cSrcweir
1546cdf0e10cSrcweir // =====================================================================
1547cdf0e10cSrcweir // ====================== Einfache Durchreicher =======================
1548cdf0e10cSrcweir // ======================================================================
1549cdf0e10cSrcweir
1550cdf0e10cSrcweir
InsertText(const XubString & rNew,sal_Bool bSelect)1551cdf0e10cSrcweir void OutlinerView::InsertText( const XubString& rNew, sal_Bool bSelect )
1552cdf0e10cSrcweir {
1553cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1554cdf0e10cSrcweir if( pOwner->bFirstParaIsEmpty )
1555cdf0e10cSrcweir pOwner->Insert( String() );
1556cdf0e10cSrcweir pEditView->InsertText( rNew, bSelect );
1557cdf0e10cSrcweir }
1558cdf0e10cSrcweir
SetVisArea(const Rectangle & rRec)1559cdf0e10cSrcweir void OutlinerView::SetVisArea( const Rectangle& rRec )
1560cdf0e10cSrcweir {
1561cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1562cdf0e10cSrcweir pEditView->SetVisArea( rRec );
1563cdf0e10cSrcweir }
1564cdf0e10cSrcweir
1565cdf0e10cSrcweir
SetSelection(const ESelection & rSel)1566cdf0e10cSrcweir void OutlinerView::SetSelection( const ESelection& rSel )
1567cdf0e10cSrcweir {
1568cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1569cdf0e10cSrcweir pEditView->SetSelection( rSel );
1570cdf0e10cSrcweir }
1571cdf0e10cSrcweir
SetReadOnly(sal_Bool bReadOnly)1572cdf0e10cSrcweir void OutlinerView::SetReadOnly( sal_Bool bReadOnly )
1573cdf0e10cSrcweir {
1574cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1575cdf0e10cSrcweir pEditView->SetReadOnly( bReadOnly );
1576cdf0e10cSrcweir }
1577cdf0e10cSrcweir
IsReadOnly() const1578cdf0e10cSrcweir sal_Bool OutlinerView::IsReadOnly() const
1579cdf0e10cSrcweir {
1580cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1581cdf0e10cSrcweir return pEditView->IsReadOnly();
1582cdf0e10cSrcweir }
1583cdf0e10cSrcweir
HasSelection() const1584cdf0e10cSrcweir sal_Bool OutlinerView::HasSelection() const
1585cdf0e10cSrcweir {
1586cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1587cdf0e10cSrcweir return pEditView->HasSelection();
1588cdf0e10cSrcweir }
1589cdf0e10cSrcweir
1590cdf0e10cSrcweir
ShowCursor(sal_Bool bGotoCursor)1591cdf0e10cSrcweir void OutlinerView::ShowCursor( sal_Bool bGotoCursor )
1592cdf0e10cSrcweir {
1593cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1594cdf0e10cSrcweir pEditView->ShowCursor( bGotoCursor );
1595cdf0e10cSrcweir }
1596cdf0e10cSrcweir
1597cdf0e10cSrcweir
HideCursor()1598cdf0e10cSrcweir void OutlinerView::HideCursor()
1599cdf0e10cSrcweir {
1600cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1601cdf0e10cSrcweir pEditView->HideCursor();
1602cdf0e10cSrcweir }
1603cdf0e10cSrcweir
1604cdf0e10cSrcweir
SetWindow(Window * pWin)1605cdf0e10cSrcweir void OutlinerView::SetWindow( Window* pWin )
1606cdf0e10cSrcweir {
1607cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1608cdf0e10cSrcweir pEditView->SetWindow( pWin );
1609cdf0e10cSrcweir }
1610cdf0e10cSrcweir
1611cdf0e10cSrcweir
GetWindow() const1612cdf0e10cSrcweir Window* OutlinerView::GetWindow() const
1613cdf0e10cSrcweir {
1614cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1615cdf0e10cSrcweir return pEditView->GetWindow();
1616cdf0e10cSrcweir }
1617cdf0e10cSrcweir
1618cdf0e10cSrcweir
SetOutputArea(const Rectangle & rRect)1619cdf0e10cSrcweir void OutlinerView::SetOutputArea( const Rectangle& rRect )
1620cdf0e10cSrcweir {
1621cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1622cdf0e10cSrcweir pEditView->SetOutputArea( rRect );
1623cdf0e10cSrcweir }
1624cdf0e10cSrcweir
1625cdf0e10cSrcweir
GetOutputArea() const1626cdf0e10cSrcweir Rectangle OutlinerView::GetOutputArea() const
1627cdf0e10cSrcweir {
1628cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1629cdf0e10cSrcweir return pEditView->GetOutputArea();
1630cdf0e10cSrcweir }
1631cdf0e10cSrcweir
1632cdf0e10cSrcweir
GetSelected() const1633cdf0e10cSrcweir XubString OutlinerView::GetSelected() const
1634cdf0e10cSrcweir {
1635cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1636cdf0e10cSrcweir return pEditView->GetSelected();
1637cdf0e10cSrcweir }
1638cdf0e10cSrcweir
1639cdf0e10cSrcweir
RemoveCharAttribs(sal_uLong nPara,sal_uInt16 nWhich)1640cdf0e10cSrcweir void OutlinerView::RemoveCharAttribs( sal_uLong nPara, sal_uInt16 nWhich)
1641cdf0e10cSrcweir {
1642cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1643*7a980842SDamjanJovanovic pEditView->RemoveCharAttribs( nPara, nWhich);
1644cdf0e10cSrcweir }
1645cdf0e10cSrcweir
1646cdf0e10cSrcweir
CompleteAutoCorrect()1647cdf0e10cSrcweir void OutlinerView::CompleteAutoCorrect()
1648cdf0e10cSrcweir {
1649cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1650cdf0e10cSrcweir pEditView->CompleteAutoCorrect();
1651cdf0e10cSrcweir }
1652cdf0e10cSrcweir
1653cdf0e10cSrcweir
StartSpeller(sal_Bool bMultiDoc)1654cdf0e10cSrcweir EESpellState OutlinerView::StartSpeller( sal_Bool bMultiDoc )
1655cdf0e10cSrcweir {
1656cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1657cdf0e10cSrcweir return pEditView->StartSpeller( bMultiDoc );
1658cdf0e10cSrcweir }
1659cdf0e10cSrcweir
1660cdf0e10cSrcweir
StartThesaurus()1661cdf0e10cSrcweir EESpellState OutlinerView::StartThesaurus()
1662cdf0e10cSrcweir {
1663cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1664cdf0e10cSrcweir return pEditView->StartThesaurus();
1665cdf0e10cSrcweir }
1666cdf0e10cSrcweir
1667cdf0e10cSrcweir
StartTextConversion(LanguageType nSrcLang,LanguageType nDestLang,const Font * pDestFont,sal_Int32 nOptions,sal_Bool bIsInteractive,sal_Bool bMultipleDoc)1668cdf0e10cSrcweir void OutlinerView::StartTextConversion(
1669cdf0e10cSrcweir LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont,
1670cdf0e10cSrcweir sal_Int32 nOptions, sal_Bool bIsInteractive, sal_Bool bMultipleDoc )
1671cdf0e10cSrcweir {
1672cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1673cdf0e10cSrcweir if (
1674cdf0e10cSrcweir (LANGUAGE_KOREAN == nSrcLang && LANGUAGE_KOREAN == nDestLang) ||
1675cdf0e10cSrcweir (LANGUAGE_CHINESE_SIMPLIFIED == nSrcLang && LANGUAGE_CHINESE_TRADITIONAL == nDestLang) ||
1676cdf0e10cSrcweir (LANGUAGE_CHINESE_TRADITIONAL == nSrcLang && LANGUAGE_CHINESE_SIMPLIFIED == nDestLang)
1677cdf0e10cSrcweir )
1678cdf0e10cSrcweir {
1679cdf0e10cSrcweir pEditView->StartTextConversion( nSrcLang, nDestLang, pDestFont, nOptions, bIsInteractive, bMultipleDoc );
1680cdf0e10cSrcweir }
1681cdf0e10cSrcweir else
1682cdf0e10cSrcweir {
1683cdf0e10cSrcweir DBG_ERROR( "unexpected language" );
1684cdf0e10cSrcweir }
1685cdf0e10cSrcweir }
1686cdf0e10cSrcweir
1687cdf0e10cSrcweir
StartSearchAndReplace(const SvxSearchItem & rSearchItem)1688cdf0e10cSrcweir sal_uInt16 OutlinerView::StartSearchAndReplace( const SvxSearchItem& rSearchItem )
1689cdf0e10cSrcweir {
1690cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1691cdf0e10cSrcweir return pEditView->StartSearchAndReplace( rSearchItem );
1692cdf0e10cSrcweir }
1693cdf0e10cSrcweir
TransliterateText(sal_Int32 nTransliterationMode)1694cdf0e10cSrcweir void OutlinerView::TransliterateText( sal_Int32 nTransliterationMode )
1695cdf0e10cSrcweir {
1696cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1697cdf0e10cSrcweir pEditView->TransliterateText( nTransliterationMode );
1698cdf0e10cSrcweir }
1699cdf0e10cSrcweir
1700cdf0e10cSrcweir
1701cdf0e10cSrcweir
GetSelection()1702cdf0e10cSrcweir ESelection OutlinerView::GetSelection()
1703cdf0e10cSrcweir {
1704cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1705cdf0e10cSrcweir return pEditView->GetSelection();
1706cdf0e10cSrcweir }
1707cdf0e10cSrcweir
1708cdf0e10cSrcweir
Scroll(long nHorzScroll,long nVertScroll)1709cdf0e10cSrcweir void OutlinerView::Scroll( long nHorzScroll, long nVertScroll )
1710cdf0e10cSrcweir {
1711cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1712cdf0e10cSrcweir pEditView->Scroll( nHorzScroll, nVertScroll );
1713cdf0e10cSrcweir }
1714cdf0e10cSrcweir
1715cdf0e10cSrcweir
SetControlWord(sal_uLong nWord)1716cdf0e10cSrcweir void OutlinerView::SetControlWord( sal_uLong nWord )
1717cdf0e10cSrcweir {
1718cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1719cdf0e10cSrcweir pEditView->SetControlWord( nWord );
1720cdf0e10cSrcweir }
1721cdf0e10cSrcweir
1722cdf0e10cSrcweir
GetControlWord() const1723cdf0e10cSrcweir sal_uLong OutlinerView::GetControlWord() const
1724cdf0e10cSrcweir {
1725cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1726cdf0e10cSrcweir return pEditView->GetControlWord();
1727cdf0e10cSrcweir }
1728cdf0e10cSrcweir
1729cdf0e10cSrcweir
SetAnchorMode(EVAnchorMode eMode)1730cdf0e10cSrcweir void OutlinerView::SetAnchorMode( EVAnchorMode eMode )
1731cdf0e10cSrcweir {
1732cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1733cdf0e10cSrcweir pEditView->SetAnchorMode( eMode );
1734cdf0e10cSrcweir }
1735cdf0e10cSrcweir
1736cdf0e10cSrcweir
GetAnchorMode() const1737cdf0e10cSrcweir EVAnchorMode OutlinerView::GetAnchorMode() const
1738cdf0e10cSrcweir {
1739cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1740cdf0e10cSrcweir return pEditView->GetAnchorMode();
1741cdf0e10cSrcweir }
1742cdf0e10cSrcweir
1743cdf0e10cSrcweir
Undo()1744cdf0e10cSrcweir void OutlinerView::Undo()
1745cdf0e10cSrcweir {
1746cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1747cdf0e10cSrcweir pEditView->Undo();
1748cdf0e10cSrcweir }
1749cdf0e10cSrcweir
1750cdf0e10cSrcweir
Redo()1751cdf0e10cSrcweir void OutlinerView::Redo()
1752cdf0e10cSrcweir {
1753cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1754cdf0e10cSrcweir pEditView->Redo();
1755cdf0e10cSrcweir }
1756cdf0e10cSrcweir
1757cdf0e10cSrcweir
EnablePaste(sal_Bool bEnable)1758cdf0e10cSrcweir void OutlinerView::EnablePaste( sal_Bool bEnable )
1759cdf0e10cSrcweir {
1760cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1761cdf0e10cSrcweir pEditView->EnablePaste( bEnable );
1762cdf0e10cSrcweir }
1763cdf0e10cSrcweir
1764cdf0e10cSrcweir
Copy()1765cdf0e10cSrcweir void OutlinerView::Copy()
1766cdf0e10cSrcweir {
1767cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1768cdf0e10cSrcweir pEditView->Copy();
1769cdf0e10cSrcweir }
1770cdf0e10cSrcweir
1771cdf0e10cSrcweir
InsertField(const SvxFieldItem & rFld)1772cdf0e10cSrcweir void OutlinerView::InsertField( const SvxFieldItem& rFld )
1773cdf0e10cSrcweir {
1774cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1775cdf0e10cSrcweir pEditView->InsertField( rFld );
1776cdf0e10cSrcweir }
1777cdf0e10cSrcweir
1778cdf0e10cSrcweir
GetFieldUnderMousePointer() const1779cdf0e10cSrcweir const SvxFieldItem* OutlinerView::GetFieldUnderMousePointer() const
1780cdf0e10cSrcweir {
1781cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1782cdf0e10cSrcweir return pEditView->GetFieldUnderMousePointer();
1783cdf0e10cSrcweir }
1784cdf0e10cSrcweir
1785cdf0e10cSrcweir
GetFieldUnderMousePointer(sal_uInt32 & nPara,sal_uInt16 & nPos) const1786*7a980842SDamjanJovanovic const SvxFieldItem* OutlinerView::GetFieldUnderMousePointer( sal_uInt32& nPara, sal_uInt16& nPos ) const
1787cdf0e10cSrcweir {
1788cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1789cdf0e10cSrcweir return pEditView->GetFieldUnderMousePointer( nPara, nPos );
1790cdf0e10cSrcweir }
1791cdf0e10cSrcweir
1792cdf0e10cSrcweir
GetFieldAtSelection() const1793cdf0e10cSrcweir const SvxFieldItem* OutlinerView::GetFieldAtSelection() const
1794cdf0e10cSrcweir {
1795cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1796cdf0e10cSrcweir return pEditView->GetFieldAtSelection();
1797cdf0e10cSrcweir }
1798cdf0e10cSrcweir
SetInvalidateMore(sal_uInt16 nPixel)1799cdf0e10cSrcweir void OutlinerView::SetInvalidateMore( sal_uInt16 nPixel )
1800cdf0e10cSrcweir {
1801cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1802cdf0e10cSrcweir pEditView->SetInvalidateMore( nPixel );
1803cdf0e10cSrcweir }
1804cdf0e10cSrcweir
1805cdf0e10cSrcweir
GetInvalidateMore() const1806cdf0e10cSrcweir sal_uInt16 OutlinerView::GetInvalidateMore() const
1807cdf0e10cSrcweir {
1808cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1809cdf0e10cSrcweir return pEditView->GetInvalidateMore();
1810cdf0e10cSrcweir }
1811cdf0e10cSrcweir
1812cdf0e10cSrcweir
IsCursorAtWrongSpelledWord(sal_Bool bMarkIfWrong)1813cdf0e10cSrcweir sal_Bool OutlinerView::IsCursorAtWrongSpelledWord( sal_Bool bMarkIfWrong )
1814cdf0e10cSrcweir {
1815cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1816cdf0e10cSrcweir return pEditView->IsCursorAtWrongSpelledWord( bMarkIfWrong );
1817cdf0e10cSrcweir }
1818cdf0e10cSrcweir
1819cdf0e10cSrcweir
IsWrongSpelledWordAtPos(const Point & rPosPixel,sal_Bool bMarkIfWrong)1820cdf0e10cSrcweir sal_Bool OutlinerView::IsWrongSpelledWordAtPos( const Point& rPosPixel, sal_Bool bMarkIfWrong )
1821cdf0e10cSrcweir {
1822cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1823cdf0e10cSrcweir return pEditView->IsWrongSpelledWordAtPos( rPosPixel, bMarkIfWrong );
1824cdf0e10cSrcweir }
1825cdf0e10cSrcweir
SpellIgnoreWord()1826cdf0e10cSrcweir void OutlinerView::SpellIgnoreWord()
1827cdf0e10cSrcweir {
1828cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1829cdf0e10cSrcweir pEditView->SpellIgnoreWord();
1830cdf0e10cSrcweir }
1831cdf0e10cSrcweir
1832cdf0e10cSrcweir
ExecuteSpellPopup(const Point & rPosPixel,Link * pStartDlg)1833cdf0e10cSrcweir void OutlinerView::ExecuteSpellPopup( const Point& rPosPixel, Link* pStartDlg )
1834cdf0e10cSrcweir {
1835cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1836cdf0e10cSrcweir pEditView->ExecuteSpellPopup( rPosPixel, pStartDlg );
1837cdf0e10cSrcweir }
1838cdf0e10cSrcweir
Read(SvStream & rInput,const String & rBaseURL,EETextFormat eFormat,sal_Bool bSelect,SvKeyValueIterator * pHTTPHeaderAttrs)1839cdf0e10cSrcweir sal_uLong OutlinerView::Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, sal_Bool bSelect, SvKeyValueIterator* pHTTPHeaderAttrs )
1840cdf0e10cSrcweir {
1841cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1842*7a980842SDamjanJovanovic sal_uInt32 nOldParaCount = pEditView->GetEditEngine()->GetParagraphCount();
1843cdf0e10cSrcweir ESelection aOldSel = pEditView->GetSelection();
1844cdf0e10cSrcweir aOldSel.Adjust();
1845cdf0e10cSrcweir
1846cdf0e10cSrcweir sal_uLong nRet = pEditView->Read( rInput, rBaseURL, eFormat, bSelect, pHTTPHeaderAttrs );
1847cdf0e10cSrcweir
1848cdf0e10cSrcweir // MT 08/00: Hier sollte eigentlich das gleiche wie in PasteSpecial passieren!
1849cdf0e10cSrcweir // Mal anpassen, wenn dieses ImplInitPaste und ImpPasted-Geraffel ueberarbeitet ist.
1850cdf0e10cSrcweir
1851cdf0e10cSrcweir long nParaDiff = pEditView->GetEditEngine()->GetParagraphCount() - nOldParaCount;
1852*7a980842SDamjanJovanovic sal_uInt32 nChangesStart = aOldSel.nStartPara;
1853*7a980842SDamjanJovanovic sal_uInt32 nChangesEnd = nChangesStart + nParaDiff + (aOldSel.nEndPara-aOldSel.nStartPara);
1854cdf0e10cSrcweir
1855*7a980842SDamjanJovanovic for ( sal_uInt32 n = nChangesStart; n <= nChangesEnd; n++ )
1856cdf0e10cSrcweir {
1857cdf0e10cSrcweir if ( eFormat == EE_FORMAT_BIN )
1858cdf0e10cSrcweir {
1859cdf0e10cSrcweir sal_uInt16 nDepth = 0;
1860cdf0e10cSrcweir const SfxItemSet& rAttrs = pOwner->GetParaAttribs( n );
1861cdf0e10cSrcweir const SfxInt16Item& rLevel = (const SfxInt16Item&) rAttrs.Get( EE_PARA_OUTLLEVEL );
1862cdf0e10cSrcweir nDepth = rLevel.GetValue();
1863cdf0e10cSrcweir pOwner->ImplInitDepth( n, nDepth, sal_False );
1864cdf0e10cSrcweir }
1865cdf0e10cSrcweir
1866cdf0e10cSrcweir if ( pOwner->ImplGetOutlinerMode() == OUTLINERMODE_OUTLINEOBJECT )
1867cdf0e10cSrcweir pOwner->ImplSetLevelDependendStyleSheet( n );
1868cdf0e10cSrcweir }
1869cdf0e10cSrcweir
1870cdf0e10cSrcweir if ( eFormat != EE_FORMAT_BIN )
1871cdf0e10cSrcweir {
1872cdf0e10cSrcweir pOwner->ImpFilterIndents( nChangesStart, nChangesEnd );
1873cdf0e10cSrcweir }
1874cdf0e10cSrcweir
1875cdf0e10cSrcweir return nRet;
1876cdf0e10cSrcweir }
1877cdf0e10cSrcweir
Write(SvStream & rOutput,EETextFormat eFormat)1878cdf0e10cSrcweir sal_uLong OutlinerView::Write( SvStream& rOutput, EETextFormat eFormat )
1879cdf0e10cSrcweir {
1880cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1881cdf0e10cSrcweir return pEditView->Write( rOutput, eFormat );
1882cdf0e10cSrcweir }
1883cdf0e10cSrcweir
SetBackgroundColor(const Color & rColor)1884cdf0e10cSrcweir void OutlinerView::SetBackgroundColor( const Color& rColor )
1885cdf0e10cSrcweir {
1886cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1887cdf0e10cSrcweir pEditView->SetBackgroundColor( rColor );
1888cdf0e10cSrcweir }
1889cdf0e10cSrcweir
1890cdf0e10cSrcweir
GetBackgroundColor()1891cdf0e10cSrcweir Color OutlinerView::GetBackgroundColor()
1892cdf0e10cSrcweir {
1893cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1894cdf0e10cSrcweir return pEditView->GetBackgroundColor();
1895cdf0e10cSrcweir }
1896cdf0e10cSrcweir
GetAttribs()1897cdf0e10cSrcweir SfxItemSet OutlinerView::GetAttribs()
1898cdf0e10cSrcweir {
1899cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1900cdf0e10cSrcweir return pEditView->GetAttribs();
1901cdf0e10cSrcweir }
1902cdf0e10cSrcweir
GetSelectedScriptType() const1903cdf0e10cSrcweir sal_uInt16 OutlinerView::GetSelectedScriptType() const
1904cdf0e10cSrcweir {
1905cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1906cdf0e10cSrcweir return pEditView->GetSelectedScriptType();
1907cdf0e10cSrcweir }
1908cdf0e10cSrcweir
GetSurroundingText() const1909cdf0e10cSrcweir String OutlinerView::GetSurroundingText() const
1910cdf0e10cSrcweir {
1911cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1912cdf0e10cSrcweir return pEditView->GetSurroundingText();
1913cdf0e10cSrcweir }
1914cdf0e10cSrcweir
GetSurroundingTextSelection() const1915cdf0e10cSrcweir Selection OutlinerView::GetSurroundingTextSelection() const
1916cdf0e10cSrcweir {
1917cdf0e10cSrcweir DBG_CHKTHIS(OutlinerView,0);
1918cdf0e10cSrcweir return pEditView->GetSurroundingTextSelection();
1919cdf0e10cSrcweir }
1920cdf0e10cSrcweir
1921cdf0e10cSrcweir
1922cdf0e10cSrcweir // ======================================================================
1923cdf0e10cSrcweir // ===== some code for thesaurus sub menu within context menu
1924cdf0e10cSrcweir // ======================================================================
1925cdf0e10cSrcweir
1926cdf0e10cSrcweir // returns: true if a word for thesaurus look-up was found at the current cursor position.
1927cdf0e10cSrcweir // The status string will be word + iso language string (e.g. "light#en-US")
GetStatusValueForThesaurusFromContext(String & rStatusVal,LanguageType & rLang,const EditView & rEditView)1928cdf0e10cSrcweir bool EDITENG_DLLPUBLIC GetStatusValueForThesaurusFromContext(
1929cdf0e10cSrcweir String &rStatusVal,
1930cdf0e10cSrcweir LanguageType &rLang,
1931cdf0e10cSrcweir const EditView &rEditView )
1932cdf0e10cSrcweir {
1933cdf0e10cSrcweir // get text and locale for thesaurus look up
1934cdf0e10cSrcweir String aText;
1935cdf0e10cSrcweir EditEngine *pEditEngine = rEditView.GetEditEngine();
1936cdf0e10cSrcweir ESelection aTextSel( rEditView.GetSelection() );
1937cdf0e10cSrcweir if (!aTextSel.HasRange())
1938cdf0e10cSrcweir aTextSel = pEditEngine->GetWord( aTextSel, i18n::WordType::DICTIONARY_WORD );
1939cdf0e10cSrcweir aText = pEditEngine->GetText( aTextSel );
1940cdf0e10cSrcweir aTextSel.Adjust();
1941cdf0e10cSrcweir LanguageType nLang = pEditEngine->GetLanguage( aTextSel.nStartPara, aTextSel.nStartPos );
1942cdf0e10cSrcweir String aLangText( MsLangId::convertLanguageToIsoString( nLang ) );
1943cdf0e10cSrcweir
1944cdf0e10cSrcweir // set word and locale to look up as status value
1945cdf0e10cSrcweir String aStatusVal( aText );
1946cdf0e10cSrcweir aStatusVal.AppendAscii( "#" );
1947cdf0e10cSrcweir aStatusVal += aLangText;
1948cdf0e10cSrcweir
1949cdf0e10cSrcweir rStatusVal = aStatusVal;
1950cdf0e10cSrcweir rLang = nLang;
1951cdf0e10cSrcweir
1952cdf0e10cSrcweir return aText.Len() > 0;
1953cdf0e10cSrcweir }
1954cdf0e10cSrcweir
1955cdf0e10cSrcweir
ReplaceTextWithSynonym(EditView & rEditView,const String & rSynonmText)1956cdf0e10cSrcweir void EDITENG_DLLPUBLIC ReplaceTextWithSynonym( EditView &rEditView, const String &rSynonmText )
1957cdf0e10cSrcweir {
1958cdf0e10cSrcweir // get selection to use
1959cdf0e10cSrcweir ESelection aCurSel( rEditView.GetSelection() );
1960cdf0e10cSrcweir if (!rEditView.HasSelection())
1961cdf0e10cSrcweir {
1962cdf0e10cSrcweir // select the same word that was used in GetStatusValueForThesaurusFromContext by calling GetWord.
1963cdf0e10cSrcweir // (In the end both functions will call ImpEditEngine::SelectWord)
1964cdf0e10cSrcweir rEditView.SelectCurrentWord( i18n::WordType::DICTIONARY_WORD );
1965cdf0e10cSrcweir aCurSel = rEditView.GetSelection();
1966cdf0e10cSrcweir }
1967cdf0e10cSrcweir
1968cdf0e10cSrcweir // replace word ...
1969cdf0e10cSrcweir rEditView.InsertText( rSynonmText );
1970cdf0e10cSrcweir rEditView.ShowCursor( sal_True, sal_False );
1971cdf0e10cSrcweir }
1972cdf0e10cSrcweir
1973cdf0e10cSrcweir
1974