xref: /aoo41x/main/sd/source/ui/view/outlnvs2.cxx (revision c55fa23c)
15b190011SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
35b190011SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
45b190011SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
55b190011SAndrew Rist  * distributed with this work for additional information
65b190011SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
75b190011SAndrew Rist  * to you under the Apache License, Version 2.0 (the
85b190011SAndrew Rist  * "License"); you may not use this file except in compliance
95b190011SAndrew Rist  * with the License.  You may obtain a copy of the License at
105b190011SAndrew Rist  *
115b190011SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
125b190011SAndrew Rist  *
135b190011SAndrew Rist  * Unless required by applicable law or agreed to in writing,
145b190011SAndrew Rist  * software distributed under the License is distributed on an
155b190011SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
165b190011SAndrew Rist  * KIND, either express or implied.  See the License for the
175b190011SAndrew Rist  * specific language governing permissions and limitations
185b190011SAndrew Rist  * under the License.
195b190011SAndrew Rist  *
205b190011SAndrew Rist  *************************************************************/
215b190011SAndrew Rist 
225b190011SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sd.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "OutlineViewShell.hxx"
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <com/sun/star/presentation/XPresentation2.hpp>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include "app.hrc"
32cdf0e10cSrcweir #include <svx/hlnkitem.hxx>
33cdf0e10cSrcweir #include <sfx2/docfile.hxx>
34cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
35cdf0e10cSrcweir #include <sfx2/request.hxx>
36cdf0e10cSrcweir #include <svl/eitem.hxx>
37cdf0e10cSrcweir #ifndef _ZOOMITEM_HXX //autogen
38cdf0e10cSrcweir #include <svx/zoomitem.hxx>
39cdf0e10cSrcweir #endif
40cdf0e10cSrcweir #include <vcl/msgbox.hxx>
41cdf0e10cSrcweir #include <editeng/eeitem.hxx>
42cdf0e10cSrcweir #include <editeng/flditem.hxx>
43cdf0e10cSrcweir #include <editeng/editstat.hxx>
44cdf0e10cSrcweir #include "optsitem.hxx"
45cdf0e10cSrcweir #include <unotools/useroptions.hxx>
46cdf0e10cSrcweir 
47cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
48cdf0e10cSrcweir #include "Outliner.hxx"
49cdf0e10cSrcweir #include "Window.hxx"
50cdf0e10cSrcweir #include "OutlineViewShell.hxx"
51cdf0e10cSrcweir #include "fubullet.hxx"
52cdf0e10cSrcweir #include "fuolbull.hxx"
53cdf0e10cSrcweir #include "FrameView.hxx"
54cdf0e10cSrcweir #include "fuzoom.hxx"
55cdf0e10cSrcweir #include "fuscale.hxx"
56cdf0e10cSrcweir #include "fuchar.hxx"
57cdf0e10cSrcweir #include "fuinsfil.hxx"
58cdf0e10cSrcweir #include "fuprobjs.hxx"
59cdf0e10cSrcweir #include "futhes.hxx"
60cdf0e10cSrcweir #include "futempl.hxx"
61cdf0e10cSrcweir #include "fusldlg.hxx"
62cdf0e10cSrcweir #include "zoomlist.hxx"
63cdf0e10cSrcweir #include "fuexpand.hxx"
64cdf0e10cSrcweir #include "fusumry.hxx"
65cdf0e10cSrcweir #include "fucushow.hxx"
66cdf0e10cSrcweir #include "drawdoc.hxx"
67cdf0e10cSrcweir #include "sdattr.hxx"
68cdf0e10cSrcweir #include "ViewShellBase.hxx"
69cdf0e10cSrcweir #include "sdabstdlg.hxx"
70cdf0e10cSrcweir #include "framework/FrameworkHelper.hxx"
71cdf0e10cSrcweir #include "DrawViewShell.hxx"
72cdf0e10cSrcweir 
73cdf0e10cSrcweir using namespace ::com::sun::star::uno;
74cdf0e10cSrcweir using namespace ::com::sun::star::presentation;
75cdf0e10cSrcweir 
76cdf0e10cSrcweir namespace sd {
77cdf0e10cSrcweir 
78cdf0e10cSrcweir 
79cdf0e10cSrcweir /************************************************************************/
80cdf0e10cSrcweir 
81cdf0e10cSrcweir /*************************************************************************
82cdf0e10cSrcweir |*
83cdf0e10cSrcweir |* SfxRequests fuer temporaere Funktionen
84cdf0e10cSrcweir |*
85cdf0e10cSrcweir \************************************************************************/
86cdf0e10cSrcweir 
87cdf0e10cSrcweir void OutlineViewShell::FuTemporary(SfxRequest &rReq)
88cdf0e10cSrcweir {
89cdf0e10cSrcweir 	DeactivateCurrentFunction();
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 	OutlinerView* pOutlinerView = pOlView->GetViewByWindow( GetActiveWindow() );
92cdf0e10cSrcweir 	sal_uInt16 nSId = rReq.GetSlot();
93cdf0e10cSrcweir 
94cdf0e10cSrcweir 	switch( nSId )
95cdf0e10cSrcweir 	{
96cdf0e10cSrcweir 		case SID_ATTR_ZOOM:
97cdf0e10cSrcweir 		{
98cdf0e10cSrcweir 			const SfxItemSet* pArgs = rReq.GetArgs();
99cdf0e10cSrcweir 
100cdf0e10cSrcweir 			if ( pArgs )
101cdf0e10cSrcweir 			{
102cdf0e10cSrcweir 				SvxZoomType eZT = ( ( const SvxZoomItem& ) pArgs->
103cdf0e10cSrcweir 											Get( SID_ATTR_ZOOM ) ).GetType();
104cdf0e10cSrcweir 				switch( eZT )
105cdf0e10cSrcweir 				{
106cdf0e10cSrcweir 					case SVX_ZOOM_PERCENT:
107cdf0e10cSrcweir 						SetZoom( (long) ( ( const SvxZoomItem& ) pArgs->
108cdf0e10cSrcweir 											Get( SID_ATTR_ZOOM ) ).GetValue() );
109cdf0e10cSrcweir 						Invalidate( SID_ATTR_ZOOM );
110cdf0e10cSrcweir 						Invalidate( SID_ATTR_ZOOMSLIDER );
111cdf0e10cSrcweir 						break;
112cdf0e10cSrcweir 					default:
113cdf0e10cSrcweir 						break;
114cdf0e10cSrcweir 				}
115cdf0e10cSrcweir 				rReq.Done();
116cdf0e10cSrcweir 			}
117cdf0e10cSrcweir 			else
118cdf0e10cSrcweir 			{
119cdf0e10cSrcweir 				// hier den Zoom-Dialog oeffnen
120cdf0e10cSrcweir 				SetCurrentFunction( FuScale::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
121cdf0e10cSrcweir 			}
122cdf0e10cSrcweir 			Cancel();
123cdf0e10cSrcweir 		}
124cdf0e10cSrcweir 		break;
125cdf0e10cSrcweir 
126cdf0e10cSrcweir 		case SID_ATTR_ZOOMSLIDER:
127cdf0e10cSrcweir 		{
128cdf0e10cSrcweir 			const SfxItemSet* pArgs = rReq.GetArgs();
129cdf0e10cSrcweir 
130cdf0e10cSrcweir 			if (pArgs && pArgs->Count () == 1 )
131cdf0e10cSrcweir 			{
132cdf0e10cSrcweir 				SFX_REQUEST_ARG (rReq, pScale, SfxUInt16Item, SID_ATTR_ZOOMSLIDER, sal_False);
133cdf0e10cSrcweir 				if (CHECK_RANGE (5, pScale->GetValue (), 3000))
134cdf0e10cSrcweir 				{
135cdf0e10cSrcweir 					SetZoom (pScale->GetValue ());
136cdf0e10cSrcweir 
137cdf0e10cSrcweir 					SfxBindings& rBindings = GetViewFrame()->GetBindings();
138cdf0e10cSrcweir 					rBindings.Invalidate( SID_ATTR_ZOOM );
139cdf0e10cSrcweir 					rBindings.Invalidate( SID_ZOOM_IN );
140cdf0e10cSrcweir 					rBindings.Invalidate( SID_ZOOM_OUT );
141cdf0e10cSrcweir 					rBindings.Invalidate( SID_ATTR_ZOOMSLIDER );
142cdf0e10cSrcweir 
143cdf0e10cSrcweir 				}
144cdf0e10cSrcweir 			}
145cdf0e10cSrcweir 
146cdf0e10cSrcweir 			Cancel();
147cdf0e10cSrcweir 			rReq.Done ();
148cdf0e10cSrcweir 			break;
149cdf0e10cSrcweir 		}
150cdf0e10cSrcweir 
151cdf0e10cSrcweir 		case SID_ZOOM_OUT:
152cdf0e10cSrcweir 		{
153cdf0e10cSrcweir 			SetCurrentFunction( FuZoom::Create(this, GetActiveWindow(), pOlView, GetDoc(), rReq) );
154cdf0e10cSrcweir 			// Beendet sich selbst, kein Cancel() notwendig!
155cdf0e10cSrcweir 			rReq.Done();
156cdf0e10cSrcweir 		}
157cdf0e10cSrcweir 		break;
158cdf0e10cSrcweir 
159cdf0e10cSrcweir 		case SID_SIZE_REAL:
160cdf0e10cSrcweir 		{
161cdf0e10cSrcweir 			SetZoom( 100 );
162cdf0e10cSrcweir 			Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0),
163cdf0e10cSrcweir 											 GetActiveWindow()->GetOutputSizePixel()) );
164cdf0e10cSrcweir 			mpZoomList->InsertZoomRect(aVisAreaWin);
165cdf0e10cSrcweir 			Invalidate( SID_ATTR_ZOOM );
166cdf0e10cSrcweir 			Invalidate( SID_ATTR_ZOOMSLIDER );
167cdf0e10cSrcweir 			Cancel();
168cdf0e10cSrcweir 			rReq.Done();
169cdf0e10cSrcweir 		}
170cdf0e10cSrcweir 		break;
171cdf0e10cSrcweir 
172cdf0e10cSrcweir 		case SID_ZOOM_IN:
173cdf0e10cSrcweir 		{
174cdf0e10cSrcweir 			SetZoom( Max( (long) ( GetActiveWindow()->GetZoom() / 2 ), (long) GetActiveWindow()->GetMinZoom() ) );
175cdf0e10cSrcweir 			Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0),
176cdf0e10cSrcweir 											 GetActiveWindow()->GetOutputSizePixel()) );
177cdf0e10cSrcweir 			mpZoomList->InsertZoomRect(aVisAreaWin);
178cdf0e10cSrcweir 			Invalidate( SID_ATTR_ZOOM );
179cdf0e10cSrcweir 			Invalidate( SID_ZOOM_OUT);
180cdf0e10cSrcweir 			Invalidate( SID_ZOOM_IN );
181cdf0e10cSrcweir 			Invalidate( SID_ATTR_ZOOMSLIDER );
182cdf0e10cSrcweir 			Cancel();
183cdf0e10cSrcweir 			rReq.Done();
184cdf0e10cSrcweir 		}
185cdf0e10cSrcweir 		break;
186cdf0e10cSrcweir 
187cdf0e10cSrcweir 		case SID_OUTLINE_COLLAPSE_ALL:
188cdf0e10cSrcweir 		{
189cdf0e10cSrcweir 			pOutlinerView->CollapseAll();
190cdf0e10cSrcweir 			Cancel();
191cdf0e10cSrcweir 			rReq.Done();
192cdf0e10cSrcweir 		}
193cdf0e10cSrcweir 		break;
194cdf0e10cSrcweir 
195cdf0e10cSrcweir 		case SID_OUTLINE_COLLAPSE:
196cdf0e10cSrcweir 		{
197cdf0e10cSrcweir 			pOutlinerView->Collapse();
198cdf0e10cSrcweir 			Cancel();
199cdf0e10cSrcweir 			rReq.Done();
200cdf0e10cSrcweir 		}
201cdf0e10cSrcweir 		break;
202cdf0e10cSrcweir 
203cdf0e10cSrcweir 		case SID_OUTLINE_EXPAND_ALL:
204cdf0e10cSrcweir 		{
205cdf0e10cSrcweir 			pOutlinerView->ExpandAll();
206cdf0e10cSrcweir 			Cancel();
207cdf0e10cSrcweir 			rReq.Done();
208cdf0e10cSrcweir 		}
209cdf0e10cSrcweir 		break;
210cdf0e10cSrcweir 
211cdf0e10cSrcweir 		case SID_OUTLINE_EXPAND:
212cdf0e10cSrcweir 		{
213cdf0e10cSrcweir 			pOutlinerView->Expand();
214cdf0e10cSrcweir 			Cancel();
215cdf0e10cSrcweir 			rReq.Done();
216cdf0e10cSrcweir 		}
217cdf0e10cSrcweir 		break;
218cdf0e10cSrcweir 
219cdf0e10cSrcweir 		case SID_OUTLINE_FORMAT:
220cdf0e10cSrcweir 		{
221cdf0e10cSrcweir 			::Outliner* pOutl = pOutlinerView->GetOutliner();
222cdf0e10cSrcweir 			pOutl->SetFlatMode( !pOutl->IsFlatMode() );
223cdf0e10cSrcweir 			Invalidate( SID_COLORVIEW );
224cdf0e10cSrcweir 			Cancel();
225cdf0e10cSrcweir 			rReq.Done();
226cdf0e10cSrcweir 		}
227cdf0e10cSrcweir 		break;
228cdf0e10cSrcweir 
229cdf0e10cSrcweir 		case SID_SELECTALL:
230cdf0e10cSrcweir 		{
231cdf0e10cSrcweir 			::Outliner* pOutl = pOlView->GetOutliner();
232cdf0e10cSrcweir 			sal_uLong nParaCount = pOutl->GetParagraphCount();
233cdf0e10cSrcweir 			if (nParaCount > 0)
234cdf0e10cSrcweir 			{
235cdf0e10cSrcweir 				pOutlinerView->SelectRange( 0, (sal_uInt16) nParaCount );
236cdf0e10cSrcweir 			}
237cdf0e10cSrcweir 			Cancel();
238cdf0e10cSrcweir 		}
239cdf0e10cSrcweir 		break;
240cdf0e10cSrcweir 
241cdf0e10cSrcweir 		case SID_PRESENTATION:
242cdf0e10cSrcweir 		case SID_REHEARSE_TIMINGS:
243cdf0e10cSrcweir 		{
244cdf0e10cSrcweir 			pOlView->PrepareClose();
245cdf0e10cSrcweir 
246cdf0e10cSrcweir 			Reference< XPresentation2 > xPresentation( GetDoc()->getPresentation() );
247cdf0e10cSrcweir 			if( xPresentation.is() )
248cdf0e10cSrcweir             {
249cdf0e10cSrcweir 				if( ( SID_REHEARSE_TIMINGS != rReq.GetSlot() ) )
250cdf0e10cSrcweir 					xPresentation->start();
251cdf0e10cSrcweir 				else
252cdf0e10cSrcweir 					xPresentation->rehearseTimings();
253cdf0e10cSrcweir             }
2549263c1d2SHerbert Dürr 			Cancel();
2559263c1d2SHerbert Dürr 			rReq.Done();
256cdf0e10cSrcweir         }
257cdf0e10cSrcweir         break;
258cdf0e10cSrcweir 
259cdf0e10cSrcweir 		case SID_COLORVIEW:
260cdf0e10cSrcweir 		{
261cdf0e10cSrcweir 			::Outliner* pOutl = pOutlinerView->GetOutliner();
262cdf0e10cSrcweir 			sal_uLong nCntrl = pOutl->GetControlWord();
263cdf0e10cSrcweir 
264cdf0e10cSrcweir 			if ( !(nCntrl & EE_CNTRL_NOCOLORS) )
265cdf0e10cSrcweir 			{
266cdf0e10cSrcweir 				// Farbansicht ist eingeschaltet: ausschalten
267cdf0e10cSrcweir 				pOutl->SetControlWord(nCntrl | EE_CNTRL_NOCOLORS);
268cdf0e10cSrcweir 			}
269cdf0e10cSrcweir 			else
270cdf0e10cSrcweir 			{
271cdf0e10cSrcweir 				// Farbansicht ist ausgeschaltet: einschalten
272cdf0e10cSrcweir 				pOutl->SetControlWord(nCntrl & ~EE_CNTRL_NOCOLORS);
273cdf0e10cSrcweir 			}
274cdf0e10cSrcweir 
275cdf0e10cSrcweir 			InvalidateWindows();
276cdf0e10cSrcweir 			Invalidate( SID_COLORVIEW );
277cdf0e10cSrcweir 			Cancel();
278cdf0e10cSrcweir 			rReq.Done();
279cdf0e10cSrcweir 		}
280cdf0e10cSrcweir 		break;
281cdf0e10cSrcweir 
282cdf0e10cSrcweir 		case SID_STYLE_EDIT:
283cdf0e10cSrcweir 		case SID_STYLE_UPDATE_BY_EXAMPLE:
284cdf0e10cSrcweir 		{
285cdf0e10cSrcweir 			if( rReq.GetArgs() )
286cdf0e10cSrcweir 			{
287cdf0e10cSrcweir 				SetCurrentFunction( FuTemplate::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
288cdf0e10cSrcweir 				Cancel();
289cdf0e10cSrcweir 			}
290cdf0e10cSrcweir 
291cdf0e10cSrcweir 			rReq.Ignore ();
292cdf0e10cSrcweir 		}
293cdf0e10cSrcweir 		break;
294cdf0e10cSrcweir 
295cdf0e10cSrcweir 		case SID_PRESENTATION_DLG:
296cdf0e10cSrcweir 		{
297cdf0e10cSrcweir 			SetCurrentFunction( FuSlideShowDlg::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
298cdf0e10cSrcweir 			Cancel();
299cdf0e10cSrcweir 		}
300cdf0e10cSrcweir 		break;
301cdf0e10cSrcweir 
302cdf0e10cSrcweir 		case SID_CUSTOMSHOW_DLG:
303cdf0e10cSrcweir 		{
304cdf0e10cSrcweir 			SetCurrentFunction( FuCustomShowDlg::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
305cdf0e10cSrcweir 			Cancel();
306cdf0e10cSrcweir 		}
307cdf0e10cSrcweir 		break;
308cdf0e10cSrcweir 	}
309cdf0e10cSrcweir 
310cdf0e10cSrcweir 	if(HasCurrentFunction())
311cdf0e10cSrcweir 		GetCurrentFunction()->Activate();
312cdf0e10cSrcweir 
313cdf0e10cSrcweir 	Invalidate( SID_OUTLINE_COLLAPSE_ALL );
314cdf0e10cSrcweir 	Invalidate( SID_OUTLINE_COLLAPSE );
315cdf0e10cSrcweir 	Invalidate( SID_OUTLINE_EXPAND_ALL );
316cdf0e10cSrcweir 	Invalidate( SID_OUTLINE_EXPAND );
317cdf0e10cSrcweir 
318cdf0e10cSrcweir 	SfxBindings& rBindings = GetViewFrame()->GetBindings();
319cdf0e10cSrcweir 	rBindings.Invalidate( SID_OUTLINE_LEFT );
320cdf0e10cSrcweir 	rBindings.Invalidate( SID_OUTLINE_RIGHT );
321cdf0e10cSrcweir 	rBindings.Invalidate( SID_OUTLINE_UP );
322cdf0e10cSrcweir 	rBindings.Invalidate( SID_OUTLINE_DOWN );
323cdf0e10cSrcweir 
324cdf0e10cSrcweir 	Invalidate( SID_OUTLINE_FORMAT );
325cdf0e10cSrcweir 	Invalidate( SID_COLORVIEW );
326cdf0e10cSrcweir 	Invalidate(SID_CUT);
327cdf0e10cSrcweir 	Invalidate(SID_COPY);
328cdf0e10cSrcweir 	Invalidate(SID_PASTE);
329cdf0e10cSrcweir }
330cdf0e10cSrcweir 
331cdf0e10cSrcweir void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq)
332cdf0e10cSrcweir {
333cdf0e10cSrcweir 	OutlineViewModelChangeGuard aGuard( *pOlView );
334cdf0e10cSrcweir 
335cdf0e10cSrcweir 	DeactivateCurrentFunction();
336cdf0e10cSrcweir 
337cdf0e10cSrcweir 	OutlinerView* pOutlinerView = pOlView->GetViewByWindow( GetActiveWindow() );
338cdf0e10cSrcweir 	sal_uInt16 nSId = rReq.GetSlot();
339cdf0e10cSrcweir 
340cdf0e10cSrcweir 	switch( nSId )
341cdf0e10cSrcweir 	{
342cdf0e10cSrcweir 		case SID_HYPERLINK_SETLINK:
343cdf0e10cSrcweir 		{
344cdf0e10cSrcweir 			const SfxItemSet* pReqArgs = rReq.GetArgs();
345cdf0e10cSrcweir 
346cdf0e10cSrcweir 			if (pReqArgs)
347cdf0e10cSrcweir 			{
348cdf0e10cSrcweir 				SvxHyperlinkItem* pHLItem =
349cdf0e10cSrcweir                 (SvxHyperlinkItem*) &pReqArgs->Get(SID_HYPERLINK_SETLINK);
350cdf0e10cSrcweir 
351cdf0e10cSrcweir 				SvxFieldItem aURLItem(SvxURLField(pHLItem->GetURL(),
352cdf0e10cSrcweir 												  pHLItem->GetName(),
353cdf0e10cSrcweir                                                   SVXURLFORMAT_REPR), EE_FEATURE_FIELD);
354cdf0e10cSrcweir 				ESelection aSel( pOutlinerView->GetSelection() );
355cdf0e10cSrcweir 				pOutlinerView->InsertField(aURLItem);
356cdf0e10cSrcweir                 if ( aSel.nStartPos <= aSel.nEndPos )
357cdf0e10cSrcweir 		            aSel.nEndPos = aSel.nStartPos + 1;
358cdf0e10cSrcweir                 else
359cdf0e10cSrcweir                     aSel.nStartPos = aSel.nEndPos + 1;
360cdf0e10cSrcweir 				pOutlinerView->SetSelection( aSel );
361cdf0e10cSrcweir 			}
362cdf0e10cSrcweir 
363cdf0e10cSrcweir 			Cancel();
364cdf0e10cSrcweir 			rReq.Ignore ();
365cdf0e10cSrcweir 		}
366cdf0e10cSrcweir 		break;
367cdf0e10cSrcweir 
368cdf0e10cSrcweir 		case FN_INSERT_SOFT_HYPHEN:
369cdf0e10cSrcweir 		case FN_INSERT_HARDHYPHEN:
370cdf0e10cSrcweir 		case FN_INSERT_HARD_SPACE:
371cdf0e10cSrcweir 		case SID_INSERT_RLM :
372cdf0e10cSrcweir 		case SID_INSERT_LRM :
373cdf0e10cSrcweir 		case SID_INSERT_ZWNBSP :
374cdf0e10cSrcweir 		case SID_INSERT_ZWSP:
375cdf0e10cSrcweir 		case SID_CHARMAP:
376cdf0e10cSrcweir 		{
377cdf0e10cSrcweir 			SetCurrentFunction( FuBullet::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
378cdf0e10cSrcweir 			Cancel();
379cdf0e10cSrcweir 		}
380cdf0e10cSrcweir 		break;
381cdf0e10cSrcweir 
382cdf0e10cSrcweir 		case SID_OUTLINE_BULLET:
383cdf0e10cSrcweir 		{
384cdf0e10cSrcweir 			SetCurrentFunction( FuOutlineBullet::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
385cdf0e10cSrcweir 			Cancel();
386cdf0e10cSrcweir 		}
387cdf0e10cSrcweir 		break;
388cdf0e10cSrcweir 
389cdf0e10cSrcweir         case SID_THESAURUS:
390cdf0e10cSrcweir 		{
391cdf0e10cSrcweir 			SetCurrentFunction( FuThesaurus::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
392cdf0e10cSrcweir 			Cancel();
393cdf0e10cSrcweir 			rReq.Ignore ();
394cdf0e10cSrcweir 		}
395cdf0e10cSrcweir 		break;
396cdf0e10cSrcweir 
397*c55fa23cSZheng Fan 		case SID_CHAR_DLG_EFFECT:
398cdf0e10cSrcweir 		case SID_CHAR_DLG:
399cdf0e10cSrcweir 		{
400cdf0e10cSrcweir 			SetCurrentFunction( FuChar::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
401cdf0e10cSrcweir 			Cancel();
402cdf0e10cSrcweir 		}
403cdf0e10cSrcweir 		break;
404cdf0e10cSrcweir 
405cdf0e10cSrcweir 		case SID_INSERTFILE:
406cdf0e10cSrcweir 		{
407cdf0e10cSrcweir 			SetCurrentFunction( FuInsertFile::Create(this, GetActiveWindow(), pOlView, GetDoc(), rReq) );
408cdf0e10cSrcweir 			Cancel();
409cdf0e10cSrcweir 		}
410cdf0e10cSrcweir 		break;
411cdf0e10cSrcweir 
412cdf0e10cSrcweir 		case SID_PRESENTATIONOBJECT:
413cdf0e10cSrcweir 		{
414cdf0e10cSrcweir 			SetCurrentFunction( FuPresentationObjects::Create(this, GetActiveWindow(), pOlView, GetDoc(), rReq) );
415cdf0e10cSrcweir 			Cancel();
416cdf0e10cSrcweir 		}
417cdf0e10cSrcweir 		break;
418cdf0e10cSrcweir 
419cdf0e10cSrcweir 		case SID_SET_DEFAULT:
420cdf0e10cSrcweir 		{
421cdf0e10cSrcweir 			// 1. Selektion merken (kriegt die eselige EditEngine nicht selbst
422cdf0e10cSrcweir 			//	  auf die Reihe!)
423cdf0e10cSrcweir 			// 2. Update auf False (sonst flackert's noch staerker
424cdf0e10cSrcweir 			// an allen selektierten Absaetzen:
425cdf0e10cSrcweir 			//	a. deren Vorlage nochmal setzen, um absatzweite harte Attribute
426cdf0e10cSrcweir 			//	   zu entfernen
427cdf0e10cSrcweir 			//	b. harte Zeichenattribute loeschen
428cdf0e10cSrcweir 			// 3. Update auf True und Selektion wieder setzen
429cdf0e10cSrcweir 			/*
430cdf0e10cSrcweir 			ESelection aEsel= pOutlinerView->GetSelection();
431cdf0e10cSrcweir 			Outliner* pOutl = pOutlinerView->GetOutliner();
432cdf0e10cSrcweir 			pOutl->SetUpdateMode(sal_False);
433cdf0e10cSrcweir 			List* pSelectedParas = pOutlinerView->CreateSelectionList();
434cdf0e10cSrcweir 			Paragraph* pPara = (Paragraph*)pSelectedParas->First();
435cdf0e10cSrcweir 			while (pPara)
436cdf0e10cSrcweir 			{
437cdf0e10cSrcweir 				sal_uLong nParaPos = pOutl->GetAbsPos(pPara);
438cdf0e10cSrcweir 				String aName;
439cdf0e10cSrcweir 				SfxStyleFamily aFamily;
440cdf0e10cSrcweir 				pOutl->GetStyleSheet(nParaPos, aName, aFamily);
441cdf0e10cSrcweir 				pOutl->SetStyleSheet(nParaPos, aName, aFamily);
442cdf0e10cSrcweir 				pOutl->QuickRemoveCharAttribs(nParaPos);
443cdf0e10cSrcweir 				pPara = (Paragraph*)pSelectedParas->Next();
444cdf0e10cSrcweir 			}
445cdf0e10cSrcweir 			delete pSelectedParas;
446cdf0e10cSrcweir 			pOutl->SetUpdateMode(sal_True);
447cdf0e10cSrcweir 			pOutlinerView->SetSelection(aEsel);
448cdf0e10cSrcweir 			*/
449cdf0e10cSrcweir 			pOutlinerView->RemoveAttribs(sal_True); // sal_True = auch Absatzattribute
450cdf0e10cSrcweir 			Cancel();
451cdf0e10cSrcweir 			rReq.Done();
452cdf0e10cSrcweir 		}
453cdf0e10cSrcweir 		break;
454cdf0e10cSrcweir 
455cdf0e10cSrcweir 		case SID_SUMMARY_PAGE:
456cdf0e10cSrcweir 		{
457cdf0e10cSrcweir 			pOlView->SetSelectedPages();
458cdf0e10cSrcweir 			SetCurrentFunction( FuSummaryPage::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
459cdf0e10cSrcweir 			pOlView->GetOutliner()->Clear();
460cdf0e10cSrcweir 			pOlView->FillOutliner();
461cdf0e10cSrcweir 			pOlView->GetActualPage();
462cdf0e10cSrcweir 			Cancel();
463cdf0e10cSrcweir 		}
464cdf0e10cSrcweir 		break;
465cdf0e10cSrcweir 
466cdf0e10cSrcweir 		case SID_EXPAND_PAGE:
467cdf0e10cSrcweir 		{
468cdf0e10cSrcweir 			pOlView->SetSelectedPages();
469cdf0e10cSrcweir 			SetCurrentFunction( FuExpandPage::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
470cdf0e10cSrcweir 			pOlView->GetOutliner()->Clear();
471cdf0e10cSrcweir 			pOlView->FillOutliner();
472cdf0e10cSrcweir 			pOlView->GetActualPage();
473cdf0e10cSrcweir 			Cancel();
474cdf0e10cSrcweir 		}
475cdf0e10cSrcweir 		break;
476cdf0e10cSrcweir 
477cdf0e10cSrcweir 		case SID_INSERT_FLD_DATE_FIX:
478cdf0e10cSrcweir 		case SID_INSERT_FLD_DATE_VAR:
479cdf0e10cSrcweir 		case SID_INSERT_FLD_TIME_FIX:
480cdf0e10cSrcweir 		case SID_INSERT_FLD_TIME_VAR:
481cdf0e10cSrcweir 		case SID_INSERT_FLD_AUTHOR:
482cdf0e10cSrcweir 		case SID_INSERT_FLD_PAGE:
483cdf0e10cSrcweir 		case SID_INSERT_FLD_PAGES:
484cdf0e10cSrcweir 		case SID_INSERT_FLD_FILE:
485cdf0e10cSrcweir 		{
486cdf0e10cSrcweir 			SvxFieldItem* pFieldItem = 0;
487cdf0e10cSrcweir 
488cdf0e10cSrcweir 			switch( nSId )
489cdf0e10cSrcweir 			{
490cdf0e10cSrcweir 				case SID_INSERT_FLD_DATE_FIX:
491cdf0e10cSrcweir 					pFieldItem = new SvxFieldItem(
492cdf0e10cSrcweir                         SvxDateField( Date(), SVXDATETYPE_FIX ), EE_FEATURE_FIELD );
493cdf0e10cSrcweir 				break;
494cdf0e10cSrcweir 
495cdf0e10cSrcweir 				case SID_INSERT_FLD_DATE_VAR:
496cdf0e10cSrcweir                     pFieldItem = new SvxFieldItem( SvxDateField(), EE_FEATURE_FIELD );
497cdf0e10cSrcweir 				break;
498cdf0e10cSrcweir 
499cdf0e10cSrcweir 				case SID_INSERT_FLD_TIME_FIX:
500cdf0e10cSrcweir 					pFieldItem = new SvxFieldItem(
501cdf0e10cSrcweir                         SvxExtTimeField( Time(), SVXTIMETYPE_FIX ), EE_FEATURE_FIELD );
502cdf0e10cSrcweir 				break;
503cdf0e10cSrcweir 
504cdf0e10cSrcweir 				case SID_INSERT_FLD_TIME_VAR:
505cdf0e10cSrcweir                     pFieldItem = new SvxFieldItem( SvxExtTimeField(), EE_FEATURE_FIELD );
506cdf0e10cSrcweir 				break;
507cdf0e10cSrcweir 
508cdf0e10cSrcweir 				case SID_INSERT_FLD_AUTHOR:
509cdf0e10cSrcweir 				{
510cdf0e10cSrcweir                     SvtUserOptions aUserOptions;
511cdf0e10cSrcweir                     pFieldItem = new SvxFieldItem(
512cdf0e10cSrcweir                             SvxAuthorField(
513cdf0e10cSrcweir                                 aUserOptions.GetFirstName(), aUserOptions.GetLastName(), aUserOptions.GetID() )
514cdf0e10cSrcweir                                 , EE_FEATURE_FIELD );
515cdf0e10cSrcweir 				}
516cdf0e10cSrcweir 				break;
517cdf0e10cSrcweir 
518cdf0e10cSrcweir 				case SID_INSERT_FLD_PAGE:
519cdf0e10cSrcweir                     pFieldItem = new SvxFieldItem( SvxPageField(), EE_FEATURE_FIELD );
520cdf0e10cSrcweir 				break;
521cdf0e10cSrcweir 
522cdf0e10cSrcweir 				case SID_INSERT_FLD_PAGES:
523cdf0e10cSrcweir                     pFieldItem = new SvxFieldItem( SvxPagesField(), EE_FEATURE_FIELD );
524cdf0e10cSrcweir 				break;
525cdf0e10cSrcweir 
526cdf0e10cSrcweir 				case SID_INSERT_FLD_FILE:
527cdf0e10cSrcweir 				{
528cdf0e10cSrcweir 					String aName;
529cdf0e10cSrcweir 					if( GetDocSh()->HasName() )
530cdf0e10cSrcweir 						aName = GetDocSh()->GetMedium()->GetName();
531cdf0e10cSrcweir 					//else
532cdf0e10cSrcweir 					//	aName = GetDocSh()->GetName();
533cdf0e10cSrcweir                     pFieldItem = new SvxFieldItem( SvxExtFileField( aName ), EE_FEATURE_FIELD );
534cdf0e10cSrcweir 				}
535cdf0e10cSrcweir 				break;
536cdf0e10cSrcweir 			}
537cdf0e10cSrcweir 
538cdf0e10cSrcweir 			const SvxFieldItem* pOldFldItem = pOutlinerView->GetFieldAtSelection();
539cdf0e10cSrcweir 
540cdf0e10cSrcweir 			if( pOldFldItem && ( pOldFldItem->GetField()->ISA( SvxURLField ) ||
541cdf0e10cSrcweir 								pOldFldItem->GetField()->ISA( SvxDateField ) ||
542cdf0e10cSrcweir 								pOldFldItem->GetField()->ISA( SvxTimeField ) ||
543cdf0e10cSrcweir 								pOldFldItem->GetField()->ISA( SvxExtTimeField ) ||
544cdf0e10cSrcweir 								pOldFldItem->GetField()->ISA( SvxExtFileField ) ||
545cdf0e10cSrcweir 								pOldFldItem->GetField()->ISA( SvxAuthorField ) ||
546cdf0e10cSrcweir 								pOldFldItem->GetField()->ISA( SvxPageField ) ||
547cdf0e10cSrcweir                                 pOldFldItem->GetField()->ISA( SvxPagesField )) )
548cdf0e10cSrcweir 			{
549cdf0e10cSrcweir 				// Feld selektieren, so dass es beim Insert geloescht wird
550cdf0e10cSrcweir 				ESelection aSel = pOutlinerView->GetSelection();
551cdf0e10cSrcweir 				if( aSel.nStartPos == aSel.nEndPos )
552cdf0e10cSrcweir 					aSel.nEndPos++;
553cdf0e10cSrcweir 				pOutlinerView->SetSelection( aSel );
554cdf0e10cSrcweir 			}
555cdf0e10cSrcweir 
556cdf0e10cSrcweir 			if( pFieldItem )
557cdf0e10cSrcweir 				pOutlinerView->InsertField( *pFieldItem );
558cdf0e10cSrcweir 
559cdf0e10cSrcweir 			delete pFieldItem;
560cdf0e10cSrcweir 
561cdf0e10cSrcweir 			Cancel();
562cdf0e10cSrcweir 			rReq.Ignore ();
563cdf0e10cSrcweir 		}
564cdf0e10cSrcweir 		break;
565cdf0e10cSrcweir 
566cdf0e10cSrcweir 		case SID_MODIFY_FIELD:
567cdf0e10cSrcweir 		{
568cdf0e10cSrcweir 			const SvxFieldItem* pFldItem = pOutlinerView->GetFieldAtSelection();
569cdf0e10cSrcweir 
570cdf0e10cSrcweir 			if( pFldItem && (pFldItem->GetField()->ISA( SvxDateField ) ||
571cdf0e10cSrcweir 								pFldItem->GetField()->ISA( SvxAuthorField ) ||
572cdf0e10cSrcweir 								pFldItem->GetField()->ISA( SvxExtFileField ) ||
573cdf0e10cSrcweir 								pFldItem->GetField()->ISA( SvxExtTimeField ) ) )
574cdf0e10cSrcweir 			{
575cdf0e10cSrcweir 				// Dialog...
576cdf0e10cSrcweir 				SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
577cdf0e10cSrcweir 				AbstractSdModifyFieldDlg* pDlg = pFact ? pFact->CreateSdModifyFieldDlg(GetActiveWindow(), pFldItem->GetField(), pOutlinerView->GetAttribs() ) : 0;
578cdf0e10cSrcweir 				if( pDlg && (pDlg->Execute() == RET_OK) )
579cdf0e10cSrcweir 				{
580cdf0e10cSrcweir 					SvxFieldData* pField = pDlg->GetField();
581cdf0e10cSrcweir 					if( pField )
582cdf0e10cSrcweir 					{
583cdf0e10cSrcweir                         SvxFieldItem aFieldItem( *pField, EE_FEATURE_FIELD );
584cdf0e10cSrcweir 						//pOLV->DeleteSelected(); <-- fehlt leider !
585cdf0e10cSrcweir 						// Feld selektieren, so dass es beim Insert geloescht wird
586cdf0e10cSrcweir 						ESelection aSel = pOutlinerView->GetSelection();
587cdf0e10cSrcweir 						sal_Bool bSel = sal_True;
588cdf0e10cSrcweir 						if( aSel.nStartPos == aSel.nEndPos )
589cdf0e10cSrcweir 						{
590cdf0e10cSrcweir 							bSel = sal_False;
591cdf0e10cSrcweir 							aSel.nEndPos++;
592cdf0e10cSrcweir 						}
593cdf0e10cSrcweir 						pOutlinerView->SetSelection( aSel );
594cdf0e10cSrcweir 
595cdf0e10cSrcweir 						pOutlinerView->InsertField( aFieldItem );
596cdf0e10cSrcweir 
597cdf0e10cSrcweir 						// Selektion wird wieder in den Ursprungszustand gebracht
598cdf0e10cSrcweir 						if( !bSel )
599cdf0e10cSrcweir 							aSel.nEndPos--;
600cdf0e10cSrcweir 						pOutlinerView->SetSelection( aSel );
601cdf0e10cSrcweir 
602cdf0e10cSrcweir 						delete pField;
603cdf0e10cSrcweir 					}
604cdf0e10cSrcweir 
605cdf0e10cSrcweir 					SfxItemSet aSet( pDlg->GetItemSet() );
606cdf0e10cSrcweir 					if( aSet.Count() )
607cdf0e10cSrcweir 					{
608cdf0e10cSrcweir 						pOutlinerView->SetAttribs( aSet );
609cdf0e10cSrcweir 
610cdf0e10cSrcweir 						::Outliner* pOutliner = pOutlinerView->GetOutliner();
611cdf0e10cSrcweir 						if( pOutliner )
612cdf0e10cSrcweir 							pOutliner->UpdateFields();
613cdf0e10cSrcweir 					}
614cdf0e10cSrcweir 				}
615cdf0e10cSrcweir 				delete pDlg;
616cdf0e10cSrcweir 			}
617cdf0e10cSrcweir 
618cdf0e10cSrcweir 			Cancel();
619cdf0e10cSrcweir 			rReq.Ignore ();
620cdf0e10cSrcweir 		}
621cdf0e10cSrcweir 		break;
622cdf0e10cSrcweir 	}
623cdf0e10cSrcweir 
624cdf0e10cSrcweir 	if(HasCurrentFunction())
625cdf0e10cSrcweir 		GetCurrentFunction()->Activate();
626cdf0e10cSrcweir 
627cdf0e10cSrcweir 	Invalidate( SID_OUTLINE_COLLAPSE_ALL );
628cdf0e10cSrcweir 	Invalidate( SID_OUTLINE_COLLAPSE );
629cdf0e10cSrcweir 	Invalidate( SID_OUTLINE_EXPAND_ALL );
630cdf0e10cSrcweir 	Invalidate( SID_OUTLINE_EXPAND );
631cdf0e10cSrcweir 
632cdf0e10cSrcweir 	SfxBindings& rBindings = GetViewFrame()->GetBindings();
633cdf0e10cSrcweir 	rBindings.Invalidate( SID_OUTLINE_LEFT );
634cdf0e10cSrcweir 	rBindings.Invalidate( SID_OUTLINE_RIGHT );
635cdf0e10cSrcweir 	rBindings.Invalidate( SID_OUTLINE_UP );
636cdf0e10cSrcweir 	rBindings.Invalidate( SID_OUTLINE_DOWN );
637cdf0e10cSrcweir 
638cdf0e10cSrcweir 	Invalidate( SID_OUTLINE_FORMAT );
639cdf0e10cSrcweir 	Invalidate( SID_COLORVIEW );
640cdf0e10cSrcweir 	Invalidate(SID_CUT);
641cdf0e10cSrcweir 	Invalidate(SID_COPY);
642cdf0e10cSrcweir 	Invalidate(SID_PASTE);
643cdf0e10cSrcweir }
644cdf0e10cSrcweir 
645cdf0e10cSrcweir 
646cdf0e10cSrcweir } // end of namespace sd
647