xref: /aoo41x/main/sd/source/ui/view/outlnvs2.cxx (revision 766ce4d0)
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 
FuTemporary(SfxRequest & rReq)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 
FuTemporaryModify(SfxRequest & rReq)331cdf0e10cSrcweir void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq)
332cdf0e10cSrcweir {
333*766ce4d0SZheng Fan 	sal_uInt16 nSId = rReq.GetSlot();
334*766ce4d0SZheng Fan 	std::auto_ptr< OutlineViewModelChangeGuard > aGuard;
335*766ce4d0SZheng Fan 	if (nSId != SID_OUTLINE_BULLET && nSId != FN_SVX_SET_BULLET && nSId != FN_SVX_SET_NUMBER)
336*766ce4d0SZheng Fan 	{
337*766ce4d0SZheng Fan 		aGuard.reset( new OutlineViewModelChangeGuard(*pOlView) );
338*766ce4d0SZheng Fan 	}
339cdf0e10cSrcweir 	DeactivateCurrentFunction();
340cdf0e10cSrcweir 
341cdf0e10cSrcweir 	OutlinerView* pOutlinerView = pOlView->GetViewByWindow( GetActiveWindow() );
342*766ce4d0SZheng Fan 	//sal_uInt16 nSId = rReq.GetSlot();
343cdf0e10cSrcweir 
344cdf0e10cSrcweir 	switch( nSId )
345cdf0e10cSrcweir 	{
346cdf0e10cSrcweir 		case SID_HYPERLINK_SETLINK:
347cdf0e10cSrcweir 		{
348cdf0e10cSrcweir 			const SfxItemSet* pReqArgs = rReq.GetArgs();
349cdf0e10cSrcweir 
350cdf0e10cSrcweir 			if (pReqArgs)
351cdf0e10cSrcweir 			{
352cdf0e10cSrcweir 				SvxHyperlinkItem* pHLItem =
353cdf0e10cSrcweir                 (SvxHyperlinkItem*) &pReqArgs->Get(SID_HYPERLINK_SETLINK);
354cdf0e10cSrcweir 
355cdf0e10cSrcweir 				SvxFieldItem aURLItem(SvxURLField(pHLItem->GetURL(),
356cdf0e10cSrcweir 												  pHLItem->GetName(),
357cdf0e10cSrcweir                                                   SVXURLFORMAT_REPR), EE_FEATURE_FIELD);
358cdf0e10cSrcweir 				ESelection aSel( pOutlinerView->GetSelection() );
359cdf0e10cSrcweir 				pOutlinerView->InsertField(aURLItem);
360cdf0e10cSrcweir                 if ( aSel.nStartPos <= aSel.nEndPos )
361cdf0e10cSrcweir 		            aSel.nEndPos = aSel.nStartPos + 1;
362cdf0e10cSrcweir                 else
363cdf0e10cSrcweir                     aSel.nStartPos = aSel.nEndPos + 1;
364cdf0e10cSrcweir 				pOutlinerView->SetSelection( aSel );
365cdf0e10cSrcweir 			}
366cdf0e10cSrcweir 
367cdf0e10cSrcweir 			Cancel();
368cdf0e10cSrcweir 			rReq.Ignore ();
369cdf0e10cSrcweir 		}
370cdf0e10cSrcweir 		break;
371cdf0e10cSrcweir 
372cdf0e10cSrcweir 		case FN_INSERT_SOFT_HYPHEN:
373cdf0e10cSrcweir 		case FN_INSERT_HARDHYPHEN:
374cdf0e10cSrcweir 		case FN_INSERT_HARD_SPACE:
375cdf0e10cSrcweir 		case SID_INSERT_RLM :
376cdf0e10cSrcweir 		case SID_INSERT_LRM :
377cdf0e10cSrcweir 		case SID_INSERT_ZWNBSP :
378cdf0e10cSrcweir 		case SID_INSERT_ZWSP:
379cdf0e10cSrcweir 		case SID_CHARMAP:
380cdf0e10cSrcweir 		{
381cdf0e10cSrcweir 			SetCurrentFunction( FuBullet::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
382cdf0e10cSrcweir 			Cancel();
383cdf0e10cSrcweir 		}
384cdf0e10cSrcweir 		break;
385cdf0e10cSrcweir 
386cdf0e10cSrcweir 		case SID_OUTLINE_BULLET:
387*766ce4d0SZheng Fan 		case FN_SVX_SET_BULLET:
388*766ce4d0SZheng Fan 		case FN_SVX_SET_NUMBER:
389cdf0e10cSrcweir 		{
390cdf0e10cSrcweir 			SetCurrentFunction( FuOutlineBullet::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
391cdf0e10cSrcweir 			Cancel();
392cdf0e10cSrcweir 		}
393cdf0e10cSrcweir 		break;
394cdf0e10cSrcweir 
395cdf0e10cSrcweir         case SID_THESAURUS:
396cdf0e10cSrcweir 		{
397cdf0e10cSrcweir 			SetCurrentFunction( FuThesaurus::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
398cdf0e10cSrcweir 			Cancel();
399cdf0e10cSrcweir 			rReq.Ignore ();
400cdf0e10cSrcweir 		}
401cdf0e10cSrcweir 		break;
402cdf0e10cSrcweir 
403c55fa23cSZheng Fan 		case SID_CHAR_DLG_EFFECT:
404cdf0e10cSrcweir 		case SID_CHAR_DLG:
405cdf0e10cSrcweir 		{
406cdf0e10cSrcweir 			SetCurrentFunction( FuChar::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
407cdf0e10cSrcweir 			Cancel();
408cdf0e10cSrcweir 		}
409cdf0e10cSrcweir 		break;
410cdf0e10cSrcweir 
411cdf0e10cSrcweir 		case SID_INSERTFILE:
412cdf0e10cSrcweir 		{
413cdf0e10cSrcweir 			SetCurrentFunction( FuInsertFile::Create(this, GetActiveWindow(), pOlView, GetDoc(), rReq) );
414cdf0e10cSrcweir 			Cancel();
415cdf0e10cSrcweir 		}
416cdf0e10cSrcweir 		break;
417cdf0e10cSrcweir 
418cdf0e10cSrcweir 		case SID_PRESENTATIONOBJECT:
419cdf0e10cSrcweir 		{
420cdf0e10cSrcweir 			SetCurrentFunction( FuPresentationObjects::Create(this, GetActiveWindow(), pOlView, GetDoc(), rReq) );
421cdf0e10cSrcweir 			Cancel();
422cdf0e10cSrcweir 		}
423cdf0e10cSrcweir 		break;
424cdf0e10cSrcweir 
425cdf0e10cSrcweir 		case SID_SET_DEFAULT:
426cdf0e10cSrcweir 		{
427cdf0e10cSrcweir 			// 1. Selektion merken (kriegt die eselige EditEngine nicht selbst
428cdf0e10cSrcweir 			//	  auf die Reihe!)
429cdf0e10cSrcweir 			// 2. Update auf False (sonst flackert's noch staerker
430cdf0e10cSrcweir 			// an allen selektierten Absaetzen:
431cdf0e10cSrcweir 			//	a. deren Vorlage nochmal setzen, um absatzweite harte Attribute
432cdf0e10cSrcweir 			//	   zu entfernen
433cdf0e10cSrcweir 			//	b. harte Zeichenattribute loeschen
434cdf0e10cSrcweir 			// 3. Update auf True und Selektion wieder setzen
435cdf0e10cSrcweir 			/*
436cdf0e10cSrcweir 			ESelection aEsel= pOutlinerView->GetSelection();
437cdf0e10cSrcweir 			Outliner* pOutl = pOutlinerView->GetOutliner();
438cdf0e10cSrcweir 			pOutl->SetUpdateMode(sal_False);
439cdf0e10cSrcweir 			List* pSelectedParas = pOutlinerView->CreateSelectionList();
440cdf0e10cSrcweir 			Paragraph* pPara = (Paragraph*)pSelectedParas->First();
441cdf0e10cSrcweir 			while (pPara)
442cdf0e10cSrcweir 			{
443cdf0e10cSrcweir 				sal_uLong nParaPos = pOutl->GetAbsPos(pPara);
444cdf0e10cSrcweir 				String aName;
445cdf0e10cSrcweir 				SfxStyleFamily aFamily;
446cdf0e10cSrcweir 				pOutl->GetStyleSheet(nParaPos, aName, aFamily);
447cdf0e10cSrcweir 				pOutl->SetStyleSheet(nParaPos, aName, aFamily);
448cdf0e10cSrcweir 				pOutl->QuickRemoveCharAttribs(nParaPos);
449cdf0e10cSrcweir 				pPara = (Paragraph*)pSelectedParas->Next();
450cdf0e10cSrcweir 			}
451cdf0e10cSrcweir 			delete pSelectedParas;
452cdf0e10cSrcweir 			pOutl->SetUpdateMode(sal_True);
453cdf0e10cSrcweir 			pOutlinerView->SetSelection(aEsel);
454cdf0e10cSrcweir 			*/
455cdf0e10cSrcweir 			pOutlinerView->RemoveAttribs(sal_True); // sal_True = auch Absatzattribute
456cdf0e10cSrcweir 			Cancel();
457cdf0e10cSrcweir 			rReq.Done();
458cdf0e10cSrcweir 		}
459cdf0e10cSrcweir 		break;
460cdf0e10cSrcweir 
461cdf0e10cSrcweir 		case SID_SUMMARY_PAGE:
462cdf0e10cSrcweir 		{
463cdf0e10cSrcweir 			pOlView->SetSelectedPages();
464cdf0e10cSrcweir 			SetCurrentFunction( FuSummaryPage::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
465cdf0e10cSrcweir 			pOlView->GetOutliner()->Clear();
466cdf0e10cSrcweir 			pOlView->FillOutliner();
467cdf0e10cSrcweir 			pOlView->GetActualPage();
468cdf0e10cSrcweir 			Cancel();
469cdf0e10cSrcweir 		}
470cdf0e10cSrcweir 		break;
471cdf0e10cSrcweir 
472cdf0e10cSrcweir 		case SID_EXPAND_PAGE:
473cdf0e10cSrcweir 		{
474cdf0e10cSrcweir 			pOlView->SetSelectedPages();
475cdf0e10cSrcweir 			SetCurrentFunction( FuExpandPage::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
476cdf0e10cSrcweir 			pOlView->GetOutliner()->Clear();
477cdf0e10cSrcweir 			pOlView->FillOutliner();
478cdf0e10cSrcweir 			pOlView->GetActualPage();
479cdf0e10cSrcweir 			Cancel();
480cdf0e10cSrcweir 		}
481cdf0e10cSrcweir 		break;
482cdf0e10cSrcweir 
483cdf0e10cSrcweir 		case SID_INSERT_FLD_DATE_FIX:
484cdf0e10cSrcweir 		case SID_INSERT_FLD_DATE_VAR:
485cdf0e10cSrcweir 		case SID_INSERT_FLD_TIME_FIX:
486cdf0e10cSrcweir 		case SID_INSERT_FLD_TIME_VAR:
487cdf0e10cSrcweir 		case SID_INSERT_FLD_AUTHOR:
488cdf0e10cSrcweir 		case SID_INSERT_FLD_PAGE:
489cdf0e10cSrcweir 		case SID_INSERT_FLD_PAGES:
490cdf0e10cSrcweir 		case SID_INSERT_FLD_FILE:
491cdf0e10cSrcweir 		{
492cdf0e10cSrcweir 			SvxFieldItem* pFieldItem = 0;
493cdf0e10cSrcweir 
494cdf0e10cSrcweir 			switch( nSId )
495cdf0e10cSrcweir 			{
496cdf0e10cSrcweir 				case SID_INSERT_FLD_DATE_FIX:
497cdf0e10cSrcweir 					pFieldItem = new SvxFieldItem(
498cdf0e10cSrcweir                         SvxDateField( Date(), SVXDATETYPE_FIX ), EE_FEATURE_FIELD );
499cdf0e10cSrcweir 				break;
500cdf0e10cSrcweir 
501cdf0e10cSrcweir 				case SID_INSERT_FLD_DATE_VAR:
502cdf0e10cSrcweir                     pFieldItem = new SvxFieldItem( SvxDateField(), EE_FEATURE_FIELD );
503cdf0e10cSrcweir 				break;
504cdf0e10cSrcweir 
505cdf0e10cSrcweir 				case SID_INSERT_FLD_TIME_FIX:
506cdf0e10cSrcweir 					pFieldItem = new SvxFieldItem(
507cdf0e10cSrcweir                         SvxExtTimeField( Time(), SVXTIMETYPE_FIX ), EE_FEATURE_FIELD );
508cdf0e10cSrcweir 				break;
509cdf0e10cSrcweir 
510cdf0e10cSrcweir 				case SID_INSERT_FLD_TIME_VAR:
511cdf0e10cSrcweir                     pFieldItem = new SvxFieldItem( SvxExtTimeField(), EE_FEATURE_FIELD );
512cdf0e10cSrcweir 				break;
513cdf0e10cSrcweir 
514cdf0e10cSrcweir 				case SID_INSERT_FLD_AUTHOR:
515cdf0e10cSrcweir 				{
516cdf0e10cSrcweir                     SvtUserOptions aUserOptions;
517cdf0e10cSrcweir                     pFieldItem = new SvxFieldItem(
518cdf0e10cSrcweir                             SvxAuthorField(
519cdf0e10cSrcweir                                 aUserOptions.GetFirstName(), aUserOptions.GetLastName(), aUserOptions.GetID() )
520cdf0e10cSrcweir                                 , EE_FEATURE_FIELD );
521cdf0e10cSrcweir 				}
522cdf0e10cSrcweir 				break;
523cdf0e10cSrcweir 
524cdf0e10cSrcweir 				case SID_INSERT_FLD_PAGE:
525cdf0e10cSrcweir                     pFieldItem = new SvxFieldItem( SvxPageField(), EE_FEATURE_FIELD );
526cdf0e10cSrcweir 				break;
527cdf0e10cSrcweir 
528cdf0e10cSrcweir 				case SID_INSERT_FLD_PAGES:
529cdf0e10cSrcweir                     pFieldItem = new SvxFieldItem( SvxPagesField(), EE_FEATURE_FIELD );
530cdf0e10cSrcweir 				break;
531cdf0e10cSrcweir 
532cdf0e10cSrcweir 				case SID_INSERT_FLD_FILE:
533cdf0e10cSrcweir 				{
534cdf0e10cSrcweir 					String aName;
535cdf0e10cSrcweir 					if( GetDocSh()->HasName() )
536cdf0e10cSrcweir 						aName = GetDocSh()->GetMedium()->GetName();
537cdf0e10cSrcweir 					//else
538cdf0e10cSrcweir 					//	aName = GetDocSh()->GetName();
539cdf0e10cSrcweir                     pFieldItem = new SvxFieldItem( SvxExtFileField( aName ), EE_FEATURE_FIELD );
540cdf0e10cSrcweir 				}
541cdf0e10cSrcweir 				break;
542cdf0e10cSrcweir 			}
543cdf0e10cSrcweir 
544cdf0e10cSrcweir 			const SvxFieldItem* pOldFldItem = pOutlinerView->GetFieldAtSelection();
545cdf0e10cSrcweir 
546cdf0e10cSrcweir 			if( pOldFldItem && ( pOldFldItem->GetField()->ISA( SvxURLField ) ||
547cdf0e10cSrcweir 								pOldFldItem->GetField()->ISA( SvxDateField ) ||
548cdf0e10cSrcweir 								pOldFldItem->GetField()->ISA( SvxTimeField ) ||
549cdf0e10cSrcweir 								pOldFldItem->GetField()->ISA( SvxExtTimeField ) ||
550cdf0e10cSrcweir 								pOldFldItem->GetField()->ISA( SvxExtFileField ) ||
551cdf0e10cSrcweir 								pOldFldItem->GetField()->ISA( SvxAuthorField ) ||
552cdf0e10cSrcweir 								pOldFldItem->GetField()->ISA( SvxPageField ) ||
553cdf0e10cSrcweir                                 pOldFldItem->GetField()->ISA( SvxPagesField )) )
554cdf0e10cSrcweir 			{
555cdf0e10cSrcweir 				// Feld selektieren, so dass es beim Insert geloescht wird
556cdf0e10cSrcweir 				ESelection aSel = pOutlinerView->GetSelection();
557cdf0e10cSrcweir 				if( aSel.nStartPos == aSel.nEndPos )
558cdf0e10cSrcweir 					aSel.nEndPos++;
559cdf0e10cSrcweir 				pOutlinerView->SetSelection( aSel );
560cdf0e10cSrcweir 			}
561cdf0e10cSrcweir 
562cdf0e10cSrcweir 			if( pFieldItem )
563cdf0e10cSrcweir 				pOutlinerView->InsertField( *pFieldItem );
564cdf0e10cSrcweir 
565cdf0e10cSrcweir 			delete pFieldItem;
566cdf0e10cSrcweir 
567cdf0e10cSrcweir 			Cancel();
568cdf0e10cSrcweir 			rReq.Ignore ();
569cdf0e10cSrcweir 		}
570cdf0e10cSrcweir 		break;
571cdf0e10cSrcweir 
572cdf0e10cSrcweir 		case SID_MODIFY_FIELD:
573cdf0e10cSrcweir 		{
574cdf0e10cSrcweir 			const SvxFieldItem* pFldItem = pOutlinerView->GetFieldAtSelection();
575cdf0e10cSrcweir 
576cdf0e10cSrcweir 			if( pFldItem && (pFldItem->GetField()->ISA( SvxDateField ) ||
577cdf0e10cSrcweir 								pFldItem->GetField()->ISA( SvxAuthorField ) ||
578cdf0e10cSrcweir 								pFldItem->GetField()->ISA( SvxExtFileField ) ||
579cdf0e10cSrcweir 								pFldItem->GetField()->ISA( SvxExtTimeField ) ) )
580cdf0e10cSrcweir 			{
581cdf0e10cSrcweir 				// Dialog...
582cdf0e10cSrcweir 				SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
583cdf0e10cSrcweir 				AbstractSdModifyFieldDlg* pDlg = pFact ? pFact->CreateSdModifyFieldDlg(GetActiveWindow(), pFldItem->GetField(), pOutlinerView->GetAttribs() ) : 0;
584cdf0e10cSrcweir 				if( pDlg && (pDlg->Execute() == RET_OK) )
585cdf0e10cSrcweir 				{
586cdf0e10cSrcweir 					SvxFieldData* pField = pDlg->GetField();
587cdf0e10cSrcweir 					if( pField )
588cdf0e10cSrcweir 					{
589cdf0e10cSrcweir                         SvxFieldItem aFieldItem( *pField, EE_FEATURE_FIELD );
590cdf0e10cSrcweir 						//pOLV->DeleteSelected(); <-- fehlt leider !
591cdf0e10cSrcweir 						// Feld selektieren, so dass es beim Insert geloescht wird
592cdf0e10cSrcweir 						ESelection aSel = pOutlinerView->GetSelection();
593cdf0e10cSrcweir 						sal_Bool bSel = sal_True;
594cdf0e10cSrcweir 						if( aSel.nStartPos == aSel.nEndPos )
595cdf0e10cSrcweir 						{
596cdf0e10cSrcweir 							bSel = sal_False;
597cdf0e10cSrcweir 							aSel.nEndPos++;
598cdf0e10cSrcweir 						}
599cdf0e10cSrcweir 						pOutlinerView->SetSelection( aSel );
600cdf0e10cSrcweir 
601cdf0e10cSrcweir 						pOutlinerView->InsertField( aFieldItem );
602cdf0e10cSrcweir 
603cdf0e10cSrcweir 						// Selektion wird wieder in den Ursprungszustand gebracht
604cdf0e10cSrcweir 						if( !bSel )
605cdf0e10cSrcweir 							aSel.nEndPos--;
606cdf0e10cSrcweir 						pOutlinerView->SetSelection( aSel );
607cdf0e10cSrcweir 
608cdf0e10cSrcweir 						delete pField;
609cdf0e10cSrcweir 					}
610cdf0e10cSrcweir 
611cdf0e10cSrcweir 					SfxItemSet aSet( pDlg->GetItemSet() );
612cdf0e10cSrcweir 					if( aSet.Count() )
613cdf0e10cSrcweir 					{
614cdf0e10cSrcweir 						pOutlinerView->SetAttribs( aSet );
615cdf0e10cSrcweir 
616cdf0e10cSrcweir 						::Outliner* pOutliner = pOutlinerView->GetOutliner();
617cdf0e10cSrcweir 						if( pOutliner )
618cdf0e10cSrcweir 							pOutliner->UpdateFields();
619cdf0e10cSrcweir 					}
620cdf0e10cSrcweir 				}
621cdf0e10cSrcweir 				delete pDlg;
622cdf0e10cSrcweir 			}
623cdf0e10cSrcweir 
624cdf0e10cSrcweir 			Cancel();
625cdf0e10cSrcweir 			rReq.Ignore ();
626cdf0e10cSrcweir 		}
627cdf0e10cSrcweir 		break;
628cdf0e10cSrcweir 	}
629cdf0e10cSrcweir 
630cdf0e10cSrcweir 	if(HasCurrentFunction())
631cdf0e10cSrcweir 		GetCurrentFunction()->Activate();
632cdf0e10cSrcweir 
633cdf0e10cSrcweir 	Invalidate( SID_OUTLINE_COLLAPSE_ALL );
634cdf0e10cSrcweir 	Invalidate( SID_OUTLINE_COLLAPSE );
635cdf0e10cSrcweir 	Invalidate( SID_OUTLINE_EXPAND_ALL );
636cdf0e10cSrcweir 	Invalidate( SID_OUTLINE_EXPAND );
637cdf0e10cSrcweir 
638cdf0e10cSrcweir 	SfxBindings& rBindings = GetViewFrame()->GetBindings();
639cdf0e10cSrcweir 	rBindings.Invalidate( SID_OUTLINE_LEFT );
640cdf0e10cSrcweir 	rBindings.Invalidate( SID_OUTLINE_RIGHT );
641cdf0e10cSrcweir 	rBindings.Invalidate( SID_OUTLINE_UP );
642cdf0e10cSrcweir 	rBindings.Invalidate( SID_OUTLINE_DOWN );
643cdf0e10cSrcweir 
644cdf0e10cSrcweir 	Invalidate( SID_OUTLINE_FORMAT );
645cdf0e10cSrcweir 	Invalidate( SID_COLORVIEW );
646cdf0e10cSrcweir 	Invalidate(SID_CUT);
647cdf0e10cSrcweir 	Invalidate(SID_COPY);
648cdf0e10cSrcweir 	Invalidate(SID_PASTE);
649cdf0e10cSrcweir }
650cdf0e10cSrcweir 
651cdf0e10cSrcweir 
652cdf0e10cSrcweir } // end of namespace sd
653