xref: /AOO41X/main/sd/source/ui/view/outlnvsh.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_sd.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include "OutlineViewShell.hxx"
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir #include "ViewShellImplementation.hxx"
34*cdf0e10cSrcweir #include <memory>
35*cdf0e10cSrcweir #include "helpids.h"
36*cdf0e10cSrcweir #include "app.hrc"
37*cdf0e10cSrcweir #include <svx/hyprlink.hxx>
38*cdf0e10cSrcweir #include <svx/hyperdlg.hxx>
39*cdf0e10cSrcweir #include <svx/zoomslideritem.hxx>
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir #include <sfx2/objface.hxx>
42*cdf0e10cSrcweir #include <sot/exchange.hxx>
43*cdf0e10cSrcweir #include <svx/ruler.hxx>
44*cdf0e10cSrcweir #include <svx/zoomitem.hxx>
45*cdf0e10cSrcweir #include <editeng/eeitem.hxx>
46*cdf0e10cSrcweir #include <editeng/flditem.hxx>
47*cdf0e10cSrcweir #include <sfx2/shell.hxx>
48*cdf0e10cSrcweir #include <sfx2/templdlg.hxx>
49*cdf0e10cSrcweir #include <sfx2/viewfac.hxx>
50*cdf0e10cSrcweir #include <sfx2/request.hxx>
51*cdf0e10cSrcweir #include <svx/hlnkitem.hxx>
52*cdf0e10cSrcweir #include <svx/svdotext.hxx>
53*cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
54*cdf0e10cSrcweir #include <vcl/scrbar.hxx>
55*cdf0e10cSrcweir #include <svl/whiter.hxx>
56*cdf0e10cSrcweir #include <editeng/editstat.hxx>
57*cdf0e10cSrcweir #include <svl/itempool.hxx>
58*cdf0e10cSrcweir #include <sfx2/tplpitem.hxx>
59*cdf0e10cSrcweir #include <svx/svdorect.hxx>
60*cdf0e10cSrcweir #include <sot/formats.hxx>
61*cdf0e10cSrcweir #include <com/sun/star/linguistic2/XThesaurus.hpp>
62*cdf0e10cSrcweir #include <com/sun/star/i18n/TransliterationModules.hpp>
63*cdf0e10cSrcweir #include <com/sun/star/i18n/TransliterationModulesExtra.hpp>
64*cdf0e10cSrcweir #include <editeng/unolingu.hxx>
65*cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
66*cdf0e10cSrcweir #include <editeng/outlobj.hxx>
67*cdf0e10cSrcweir #include <svl/cjkoptions.hxx>
68*cdf0e10cSrcweir #include <svtools/cliplistener.hxx>
69*cdf0e10cSrcweir #include <svl/srchitem.hxx>
70*cdf0e10cSrcweir #include <editeng/editobj.hxx>
71*cdf0e10cSrcweir #include "fubullet.hxx"
72*cdf0e10cSrcweir #include "optsitem.hxx"
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir #include "strings.hrc"
75*cdf0e10cSrcweir #include "glob.hrc"
76*cdf0e10cSrcweir #include "res_bmp.hrc"
77*cdf0e10cSrcweir #include "Outliner.hxx"
78*cdf0e10cSrcweir #include "Window.hxx"
79*cdf0e10cSrcweir #include "TextObjectBar.hxx"
80*cdf0e10cSrcweir #include "drawdoc.hxx"
81*cdf0e10cSrcweir #include "sdresid.hxx"
82*cdf0e10cSrcweir #include "sdpage.hxx"
83*cdf0e10cSrcweir #include "fuoltext.hxx"
84*cdf0e10cSrcweir #include "FrameView.hxx"
85*cdf0e10cSrcweir #include "zoomlist.hxx"
86*cdf0e10cSrcweir #include "stlsheet.hxx"
87*cdf0e10cSrcweir #include "slideshow.hxx"
88*cdf0e10cSrcweir #include "SdUnoOutlineView.hxx"
89*cdf0e10cSrcweir #include "SpellDialogChildWindow.hxx"
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir #include "AccessibleOutlineView.hxx"
92*cdf0e10cSrcweir #include "ViewShellBase.hxx"
93*cdf0e10cSrcweir #include "ViewShellManager.hxx"
94*cdf0e10cSrcweir #include "DrawController.hxx"
95*cdf0e10cSrcweir #include "framework/FrameworkHelper.hxx"
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir using ::rtl::OUString;
98*cdf0e10cSrcweir using namespace ::com::sun::star;
99*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
100*cdf0e10cSrcweir using namespace ::com::sun::star::lang;
101*cdf0e10cSrcweir using namespace ::com::sun::star::linguistic2;
102*cdf0e10cSrcweir 
103*cdf0e10cSrcweir using namespace sd;
104*cdf0e10cSrcweir #define OutlineViewShell
105*cdf0e10cSrcweir #include "sdslots.hxx"
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir namespace sd {
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir #define MIN_ZOOM	       10       // Minimaler Zoomfaktor
110*cdf0e10cSrcweir #define MAX_ZOOM	     1000	    // Maximaler Zoomfaktor
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir /************************************************************************/
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir /*************************************************************************
116*cdf0e10cSrcweir |*
117*cdf0e10cSrcweir |* SFX-Slotmap und Standardinterface deklarieren
118*cdf0e10cSrcweir |*
119*cdf0e10cSrcweir \************************************************************************/
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir SFX_IMPL_INTERFACE(OutlineViewShell, SfxShell, SdResId(STR_OUTLINEVIEWSHELL))
123*cdf0e10cSrcweir {
124*cdf0e10cSrcweir 	SFX_POPUPMENU_REGISTRATION( SdResId(RID_OUTLINE_POPUP) );
125*cdf0e10cSrcweir 	SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_TOOLS | SFX_VISIBILITY_STANDARD |
126*cdf0e10cSrcweir 								SFX_VISIBILITY_FULLSCREEN | SFX_VISIBILITY_SERVER,
127*cdf0e10cSrcweir 								SdResId(RID_OUTLINE_TOOLBOX) );
128*cdf0e10cSrcweir     SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_APPLICATION | SFX_VISIBILITY_DESKTOP | SFX_VISIBILITY_STANDARD | SFX_VISIBILITY_CLIENT | SFX_VISIBILITY_VIEWER | SFX_VISIBILITY_READONLYDOC,
129*cdf0e10cSrcweir             					SdResId(RID_DRAW_VIEWER_TOOLBOX) );
130*cdf0e10cSrcweir 	SFX_CHILDWINDOW_REGISTRATION( SfxTemplateDialogWrapper::GetChildWindowId() );
131*cdf0e10cSrcweir 	SFX_CHILDWINDOW_REGISTRATION( SvxHyperlinkDlgWrapper::GetChildWindowId() );
132*cdf0e10cSrcweir 	SFX_CHILDWINDOW_REGISTRATION( SvxHlinkDlgWrapper::GetChildWindowId() );
133*cdf0e10cSrcweir 	SFX_CHILDWINDOW_REGISTRATION( ::sd::SpellDialogChildWindow::GetChildWindowId() );
134*cdf0e10cSrcweir 	SFX_CHILDWINDOW_REGISTRATION( SID_SEARCH_DLG );
135*cdf0e10cSrcweir }
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir TYPEINIT1( OutlineViewShell, ViewShell );
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir /*************************************************************************
142*cdf0e10cSrcweir |*
143*cdf0e10cSrcweir |* gemeinsamer Initialiserungsanteil der beiden Konstruktoren
144*cdf0e10cSrcweir |*
145*cdf0e10cSrcweir \************************************************************************/
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir void OutlineViewShell::Construct(DrawDocShell* )
148*cdf0e10cSrcweir {
149*cdf0e10cSrcweir 	sal_Bool bModified = GetDoc()->IsChanged();
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir     meShellType = ST_OUTLINE;
152*cdf0e10cSrcweir 	Size aSize(29700, 21000);
153*cdf0e10cSrcweir 	Point aWinPos (0, 0);
154*cdf0e10cSrcweir 	Point aViewOrigin(0, 0);
155*cdf0e10cSrcweir 	GetActiveWindow()->SetMinZoomAutoCalc(sal_False);
156*cdf0e10cSrcweir 	GetActiveWindow()->SetMinZoom( MIN_ZOOM );
157*cdf0e10cSrcweir 	GetActiveWindow()->SetMaxZoom( MAX_ZOOM );
158*cdf0e10cSrcweir 	InitWindows(aViewOrigin, aSize, aWinPos);
159*cdf0e10cSrcweir 	pOlView = new OutlineView(GetDocSh(), GetActiveWindow(), this);
160*cdf0e10cSrcweir 	mpView = pOlView;			 // Pointer der Basisklasse ViewShell
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir 	SetPool( &GetDoc()->GetPool() );
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir 	SetZoom(69);
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir 	// Einstellungen der FrameView uebernehmen
167*cdf0e10cSrcweir 	ReadFrameViewData(mpFrameView);
168*cdf0e10cSrcweir 
169*cdf0e10cSrcweir 	::Outliner* pOutl = pOlView->GetOutliner();
170*cdf0e10cSrcweir 	pOutl->SetUpdateMode(sal_True);
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir 	if (!bModified)
173*cdf0e10cSrcweir 	{
174*cdf0e10cSrcweir 		pOutl->ClearModifyFlag();
175*cdf0e10cSrcweir 	}
176*cdf0e10cSrcweir 
177*cdf0e10cSrcweir 	pLastPage = GetActualPage();
178*cdf0e10cSrcweir 
179*cdf0e10cSrcweir 	String aName( RTL_CONSTASCII_USTRINGPARAM( "OutlineViewShell" ));
180*cdf0e10cSrcweir 	SetName (aName);
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir 	SetHelpId( SD_IF_SDOUTLINEVIEWSHELL );
183*cdf0e10cSrcweir 	GetActiveWindow()->SetHelpId( HID_SDOUTLINEVIEWSHELL );
184*cdf0e10cSrcweir 	GetActiveWindow()->SetUniqueId( HID_SDOUTLINEVIEWSHELL );
185*cdf0e10cSrcweir }
186*cdf0e10cSrcweir 
187*cdf0e10cSrcweir 
188*cdf0e10cSrcweir 
189*cdf0e10cSrcweir 
190*cdf0e10cSrcweir Reference<drawing::XDrawSubController> OutlineViewShell::CreateSubController (void)
191*cdf0e10cSrcweir {
192*cdf0e10cSrcweir     Reference<drawing::XDrawSubController> xSubController;
193*cdf0e10cSrcweir 
194*cdf0e10cSrcweir     if (IsMainViewShell())
195*cdf0e10cSrcweir     {
196*cdf0e10cSrcweir         // Create uno sub controller for the main view shell.
197*cdf0e10cSrcweir         xSubController = Reference<drawing::XDrawSubController>(
198*cdf0e10cSrcweir             new SdUnoOutlineView (
199*cdf0e10cSrcweir                 GetViewShellBase().GetDrawController(),
200*cdf0e10cSrcweir                 *this,
201*cdf0e10cSrcweir                 *GetView()));
202*cdf0e10cSrcweir     }
203*cdf0e10cSrcweir 
204*cdf0e10cSrcweir     return xSubController;
205*cdf0e10cSrcweir }
206*cdf0e10cSrcweir 
207*cdf0e10cSrcweir 
208*cdf0e10cSrcweir 
209*cdf0e10cSrcweir 
210*cdf0e10cSrcweir /*************************************************************************
211*cdf0e10cSrcweir |*
212*cdf0e10cSrcweir |* Standard-Konstruktor, Fenster duerfen nicht automatisch zentrieren
213*cdf0e10cSrcweir |*
214*cdf0e10cSrcweir \************************************************************************/
215*cdf0e10cSrcweir 
216*cdf0e10cSrcweir OutlineViewShell::OutlineViewShell (
217*cdf0e10cSrcweir     SfxViewFrame* pFrame,
218*cdf0e10cSrcweir     ViewShellBase& rViewShellBase,
219*cdf0e10cSrcweir     ::Window* pParentWindow,
220*cdf0e10cSrcweir     FrameView* pFrameViewArgument)
221*cdf0e10cSrcweir     : ViewShell(pFrame, pParentWindow, rViewShellBase),
222*cdf0e10cSrcweir       pOlView(NULL),
223*cdf0e10cSrcweir       pLastPage( NULL ),
224*cdf0e10cSrcweir       pClipEvtLstnr(NULL),
225*cdf0e10cSrcweir       bPastePossible(false),
226*cdf0e10cSrcweir       mbInitialized(false)
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir {
229*cdf0e10cSrcweir 	if (pFrameViewArgument != NULL)
230*cdf0e10cSrcweir 		mpFrameView = pFrameViewArgument;
231*cdf0e10cSrcweir 	else
232*cdf0e10cSrcweir         mpFrameView = new FrameView(GetDoc());
233*cdf0e10cSrcweir 
234*cdf0e10cSrcweir 	mpFrameView->Connect();
235*cdf0e10cSrcweir 
236*cdf0e10cSrcweir 	Construct(GetDocSh());
237*cdf0e10cSrcweir }
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir /*************************************************************************
240*cdf0e10cSrcweir |*
241*cdf0e10cSrcweir |* Destruktor
242*cdf0e10cSrcweir |*
243*cdf0e10cSrcweir \************************************************************************/
244*cdf0e10cSrcweir 
245*cdf0e10cSrcweir OutlineViewShell::~OutlineViewShell()
246*cdf0e10cSrcweir {
247*cdf0e10cSrcweir 	DisposeFunctions();
248*cdf0e10cSrcweir 
249*cdf0e10cSrcweir 	delete pOlView;
250*cdf0e10cSrcweir 
251*cdf0e10cSrcweir 	mpFrameView->Disconnect();
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir 	if ( pClipEvtLstnr )
254*cdf0e10cSrcweir 	{
255*cdf0e10cSrcweir 		pClipEvtLstnr->AddRemoveListener( GetActiveWindow(), sal_False );
256*cdf0e10cSrcweir 		pClipEvtLstnr->ClearCallbackLink();		// #103849# prevent callback if another thread is waiting
257*cdf0e10cSrcweir 		pClipEvtLstnr->release();
258*cdf0e10cSrcweir 	}
259*cdf0e10cSrcweir }
260*cdf0e10cSrcweir 
261*cdf0e10cSrcweir 
262*cdf0e10cSrcweir 
263*cdf0e10cSrcweir 
264*cdf0e10cSrcweir void OutlineViewShell::Shutdown (void)
265*cdf0e10cSrcweir {
266*cdf0e10cSrcweir     ViewShell::Shutdown();
267*cdf0e10cSrcweir 
268*cdf0e10cSrcweir     PrepareClose();
269*cdf0e10cSrcweir }
270*cdf0e10cSrcweir 
271*cdf0e10cSrcweir 
272*cdf0e10cSrcweir 
273*cdf0e10cSrcweir 
274*cdf0e10cSrcweir /*************************************************************************
275*cdf0e10cSrcweir |*
276*cdf0e10cSrcweir |* Paint-Methode: das Ereignis wird vom Fenster pWindow an
277*cdf0e10cSrcweir |* die Viewshell und die aktuelle Funktion weitergeleitet
278*cdf0e10cSrcweir |*
279*cdf0e10cSrcweir \************************************************************************/
280*cdf0e10cSrcweir 
281*cdf0e10cSrcweir void OutlineViewShell::Paint(const Rectangle& rRect, ::sd::Window* pWin)
282*cdf0e10cSrcweir {
283*cdf0e10cSrcweir 	if (pOlView)
284*cdf0e10cSrcweir 	{
285*cdf0e10cSrcweir 		pOlView->Paint(rRect, pWin);
286*cdf0e10cSrcweir 	}
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir 	if(HasCurrentFunction())
289*cdf0e10cSrcweir 	{
290*cdf0e10cSrcweir 		GetCurrentFunction()->Paint(rRect, pWin);
291*cdf0e10cSrcweir 	}
292*cdf0e10cSrcweir }
293*cdf0e10cSrcweir 
294*cdf0e10cSrcweir void OutlineViewShell::ArrangeGUIElements ()
295*cdf0e10cSrcweir {
296*cdf0e10cSrcweir     // Retrieve the current size (thickness) of the scroll bars.  That is
297*cdf0e10cSrcweir     // the width of the vertical and the height of the horizontal scroll
298*cdf0e10cSrcweir     // bar.
299*cdf0e10cSrcweir     int nScrollBarSize =
300*cdf0e10cSrcweir         GetParentWindow()->GetSettings().GetStyleSettings().GetScrollBarSize();
301*cdf0e10cSrcweir 	maScrBarWH = Size (nScrollBarSize, nScrollBarSize);
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir 	ViewShell::ArrangeGUIElements ();
304*cdf0e10cSrcweir 
305*cdf0e10cSrcweir     ::sd::Window* pWindow = mpContentWindow.get();
306*cdf0e10cSrcweir     if (pWindow != NULL)
307*cdf0e10cSrcweir     {
308*cdf0e10cSrcweir         pWindow->SetMinZoomAutoCalc(sal_False);
309*cdf0e10cSrcweir 
310*cdf0e10cSrcweir         // pWindow->SetPosSizePixel(rNewPos, Size(nSizeX, nSizeY));
311*cdf0e10cSrcweir 
312*cdf0e10cSrcweir         // OutputArea der OutlinerView aendern
313*cdf0e10cSrcweir         OutlinerView* pOutlinerView = pOlView->GetViewByWindow(pWindow);
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir         Rectangle aWin(Point(0,0), pWindow->GetOutputSizePixel());
316*cdf0e10cSrcweir //		aWin.nLeft = pOlView->GetPageNumberWidthPixel();
317*cdf0e10cSrcweir 
318*cdf0e10cSrcweir         aWin = pWindow->PixelToLogic(aWin);
319*cdf0e10cSrcweir         pOutlinerView->SetOutputArea(aWin);
320*cdf0e10cSrcweir 
321*cdf0e10cSrcweir         Rectangle aVis = pOutlinerView->GetVisArea();
322*cdf0e10cSrcweir 
323*cdf0e10cSrcweir         Rectangle aText = Rectangle(Point(0,0),
324*cdf0e10cSrcweir             Size(pOlView->GetPaperWidth(),
325*cdf0e10cSrcweir                 pOlView->GetOutliner()->GetTextHeight()));
326*cdf0e10cSrcweir         aText.Bottom() += aWin.GetHeight();
327*cdf0e10cSrcweir 
328*cdf0e10cSrcweir         if (!aWin.IsEmpty())			// nicht beim Oeffnen
329*cdf0e10cSrcweir         {
330*cdf0e10cSrcweir             InitWindows(Point(0,0), aText.GetSize(), Point(aVis.TopLeft()));
331*cdf0e10cSrcweir             UpdateScrollBars();
332*cdf0e10cSrcweir         }
333*cdf0e10cSrcweir     }
334*cdf0e10cSrcweir }
335*cdf0e10cSrcweir 
336*cdf0e10cSrcweir /*************************************************************************
337*cdf0e10cSrcweir |*
338*cdf0e10cSrcweir |* SfxRequests fuer Controller bearbeiten
339*cdf0e10cSrcweir |*
340*cdf0e10cSrcweir \************************************************************************/
341*cdf0e10cSrcweir 
342*cdf0e10cSrcweir void OutlineViewShell::ExecCtrl(SfxRequest &rReq)
343*cdf0e10cSrcweir {
344*cdf0e10cSrcweir 	sal_uInt16 nSlot = rReq.GetSlot();
345*cdf0e10cSrcweir 	switch ( nSlot )
346*cdf0e10cSrcweir 	{
347*cdf0e10cSrcweir 		case SID_MAIL_SCROLLBODY_PAGEDOWN:
348*cdf0e10cSrcweir 		{
349*cdf0e10cSrcweir             ExecReq( rReq );
350*cdf0e10cSrcweir 			break;
351*cdf0e10cSrcweir 		}
352*cdf0e10cSrcweir 
353*cdf0e10cSrcweir 		case SID_OPT_LOCALE_CHANGED:
354*cdf0e10cSrcweir 		{
355*cdf0e10cSrcweir 			pOlView->GetOutliner()->UpdateFields();
356*cdf0e10cSrcweir 			UpdatePreview( GetActualPage() );
357*cdf0e10cSrcweir 			rReq.Done();
358*cdf0e10cSrcweir             break;
359*cdf0e10cSrcweir 		}
360*cdf0e10cSrcweir 
361*cdf0e10cSrcweir 		default:
362*cdf0e10cSrcweir 		break;
363*cdf0e10cSrcweir 	}
364*cdf0e10cSrcweir }
365*cdf0e10cSrcweir 
366*cdf0e10cSrcweir 
367*cdf0e10cSrcweir 
368*cdf0e10cSrcweir 
369*cdf0e10cSrcweir void OutlineViewShell::AddWindow (::sd::Window* pWin)
370*cdf0e10cSrcweir {
371*cdf0e10cSrcweir     pOlView->AddWindowToPaintView(pWin);
372*cdf0e10cSrcweir }
373*cdf0e10cSrcweir 
374*cdf0e10cSrcweir 
375*cdf0e10cSrcweir 
376*cdf0e10cSrcweir 
377*cdf0e10cSrcweir void OutlineViewShell::RemoveWindow (::sd::Window* pWin)
378*cdf0e10cSrcweir {
379*cdf0e10cSrcweir     pOlView->DeleteWindowFromPaintView(pWin);
380*cdf0e10cSrcweir }
381*cdf0e10cSrcweir 
382*cdf0e10cSrcweir 
383*cdf0e10cSrcweir 
384*cdf0e10cSrcweir 
385*cdf0e10cSrcweir /*************************************************************************
386*cdf0e10cSrcweir |*
387*cdf0e10cSrcweir |* Activate(), beim ersten Aufruf erfolgt ein Update der Felder
388*cdf0e10cSrcweir |*
389*cdf0e10cSrcweir \************************************************************************/
390*cdf0e10cSrcweir void OutlineViewShell::Activate( sal_Bool bIsMDIActivate )
391*cdf0e10cSrcweir {
392*cdf0e10cSrcweir     if ( ! mbInitialized)
393*cdf0e10cSrcweir     {
394*cdf0e10cSrcweir         mbInitialized = true;
395*cdf0e10cSrcweir     	SfxRequest aRequest (SID_EDIT_OUTLINER, 0, GetDoc()->GetItemPool());
396*cdf0e10cSrcweir         FuPermanent (aRequest);
397*cdf0e10cSrcweir     }
398*cdf0e10cSrcweir 
399*cdf0e10cSrcweir     ViewShell::Activate( bIsMDIActivate );
400*cdf0e10cSrcweir     pOlView->SetLinks();
401*cdf0e10cSrcweir     pOlView->ConnectToApplication();
402*cdf0e10cSrcweir 
403*cdf0e10cSrcweir     if( bIsMDIActivate )
404*cdf0e10cSrcweir     {
405*cdf0e10cSrcweir         OutlinerView* pOutlinerView = pOlView->GetViewByWindow( GetActiveWindow() );
406*cdf0e10cSrcweir         ::Outliner* pOutl = pOutlinerView->GetOutliner();
407*cdf0e10cSrcweir         pOutl->UpdateFields();
408*cdf0e10cSrcweir     }
409*cdf0e10cSrcweir }
410*cdf0e10cSrcweir 
411*cdf0e10cSrcweir /*************************************************************************
412*cdf0e10cSrcweir |*
413*cdf0e10cSrcweir |* Deactivate()
414*cdf0e10cSrcweir |*
415*cdf0e10cSrcweir \************************************************************************/
416*cdf0e10cSrcweir void OutlineViewShell::Deactivate( sal_Bool bIsMDIActivate )
417*cdf0e10cSrcweir {
418*cdf0e10cSrcweir     pOlView->DisconnectFromApplication();
419*cdf0e10cSrcweir 
420*cdf0e10cSrcweir     // #96416# Links must be kept also on deactivated viewshell, to allow drag'n'drop
421*cdf0e10cSrcweir     // to function properly
422*cdf0e10cSrcweir     // pOlView->ResetLinks();
423*cdf0e10cSrcweir 
424*cdf0e10cSrcweir     ViewShell::Deactivate( bIsMDIActivate );
425*cdf0e10cSrcweir }
426*cdf0e10cSrcweir 
427*cdf0e10cSrcweir /*************************************************************************
428*cdf0e10cSrcweir |*
429*cdf0e10cSrcweir |* Status von Controller-SfxSlots setzen
430*cdf0e10cSrcweir |*
431*cdf0e10cSrcweir \************************************************************************/
432*cdf0e10cSrcweir void OutlineViewShell::GetCtrlState(SfxItemSet &rSet)
433*cdf0e10cSrcweir {
434*cdf0e10cSrcweir 	if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_HYPERLINK_GETLINK))
435*cdf0e10cSrcweir 	{
436*cdf0e10cSrcweir 		SvxHyperlinkItem aHLinkItem;
437*cdf0e10cSrcweir 
438*cdf0e10cSrcweir 		OutlinerView* pOLV = pOlView->GetViewByWindow(GetActiveWindow());
439*cdf0e10cSrcweir 		if (pOLV)
440*cdf0e10cSrcweir 		{
441*cdf0e10cSrcweir 			const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
442*cdf0e10cSrcweir 			if (pFieldItem)
443*cdf0e10cSrcweir 			{
444*cdf0e10cSrcweir                 ESelection aSel = pOLV->GetSelection();
445*cdf0e10cSrcweir                 if ( abs( aSel.nEndPos - aSel.nStartPos ) == 1 )
446*cdf0e10cSrcweir                 {
447*cdf0e10cSrcweir 				    const SvxFieldData* pField = pFieldItem->GetField();
448*cdf0e10cSrcweir 				    if ( pField->ISA(SvxURLField) )
449*cdf0e10cSrcweir 				    {
450*cdf0e10cSrcweir 					    aHLinkItem.SetName(((const SvxURLField*) pField)->GetRepresentation());
451*cdf0e10cSrcweir 					    aHLinkItem.SetURL(((const SvxURLField*) pField)->GetURL());
452*cdf0e10cSrcweir 					    aHLinkItem.SetTargetFrame(((const SvxURLField*) pField)->GetTargetFrame());
453*cdf0e10cSrcweir 				    }
454*cdf0e10cSrcweir                 }
455*cdf0e10cSrcweir 			}
456*cdf0e10cSrcweir 		}
457*cdf0e10cSrcweir 		rSet.Put(aHLinkItem);
458*cdf0e10cSrcweir 	}
459*cdf0e10cSrcweir     rSet.Put( SfxBoolItem( SID_READONLY_MODE, GetDocSh()->IsReadOnly() ) );
460*cdf0e10cSrcweir 
461*cdf0e10cSrcweir 	if ( SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_MAIL_SCROLLBODY_PAGEDOWN) )
462*cdf0e10cSrcweir 		rSet.Put( SfxBoolItem( SID_MAIL_SCROLLBODY_PAGEDOWN, sal_True ) );
463*cdf0e10cSrcweir 
464*cdf0e10cSrcweir 	if ( SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_TRANSLITERATE_HALFWIDTH) ||
465*cdf0e10cSrcweir 		 SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_TRANSLITERATE_FULLWIDTH) ||
466*cdf0e10cSrcweir 		 SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_TRANSLITERATE_HIRAGANA) ||
467*cdf0e10cSrcweir 		 SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_TRANSLITERATE_KATAGANA) )
468*cdf0e10cSrcweir 	{
469*cdf0e10cSrcweir         SvtCJKOptions aCJKOptions;
470*cdf0e10cSrcweir 		if( !aCJKOptions.IsChangeCaseMapEnabled() )
471*cdf0e10cSrcweir 		{
472*cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_False );
473*cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_False );
474*cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_False );
475*cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_False );
476*cdf0e10cSrcweir 			rSet.DisableItem( SID_TRANSLITERATE_HALFWIDTH );
477*cdf0e10cSrcweir 			rSet.DisableItem( SID_TRANSLITERATE_FULLWIDTH );
478*cdf0e10cSrcweir 			rSet.DisableItem( SID_TRANSLITERATE_HIRAGANA );
479*cdf0e10cSrcweir 			rSet.DisableItem( SID_TRANSLITERATE_KATAGANA );
480*cdf0e10cSrcweir 		}
481*cdf0e10cSrcweir         else
482*cdf0e10cSrcweir         {
483*cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, sal_True );
484*cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, sal_True );
485*cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HIRAGANA, sal_True );
486*cdf0e10cSrcweir             GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_KATAGANA, sal_True );
487*cdf0e10cSrcweir         }
488*cdf0e10cSrcweir 	}
489*cdf0e10cSrcweir }
490*cdf0e10cSrcweir 
491*cdf0e10cSrcweir /*************************************************************************
492*cdf0e10cSrcweir |*
493*cdf0e10cSrcweir |* SfxRequests fuer Support-Funktionen
494*cdf0e10cSrcweir |*
495*cdf0e10cSrcweir \************************************************************************/
496*cdf0e10cSrcweir 
497*cdf0e10cSrcweir void OutlineViewShell::FuSupport(SfxRequest &rReq)
498*cdf0e10cSrcweir {
499*cdf0e10cSrcweir 	if( rReq.GetSlot() == SID_STYLE_FAMILY && rReq.GetArgs())
500*cdf0e10cSrcweir 		GetDocSh()->SetStyleFamily(((SfxUInt16Item&)rReq.GetArgs()->Get( SID_STYLE_FAMILY )).GetValue());
501*cdf0e10cSrcweir 
502*cdf0e10cSrcweir 	sal_Bool bPreviewState = sal_False;
503*cdf0e10cSrcweir 	sal_uLong nSlot = rReq.GetSlot();
504*cdf0e10cSrcweir 
505*cdf0e10cSrcweir 	std::auto_ptr< OutlineViewModelChangeGuard > aGuard;
506*cdf0e10cSrcweir 	if( pOlView && (
507*cdf0e10cSrcweir         (nSlot == SID_TRANSLITERATE_SENTENCE_CASE) ||
508*cdf0e10cSrcweir         (nSlot == SID_TRANSLITERATE_TITLE_CASE) ||
509*cdf0e10cSrcweir         (nSlot == SID_TRANSLITERATE_TOGGLE_CASE) ||
510*cdf0e10cSrcweir 		(nSlot == SID_TRANSLITERATE_UPPER) ||
511*cdf0e10cSrcweir 		(nSlot == SID_TRANSLITERATE_LOWER) ||
512*cdf0e10cSrcweir 		(nSlot == SID_TRANSLITERATE_HALFWIDTH) ||
513*cdf0e10cSrcweir 		(nSlot == SID_TRANSLITERATE_FULLWIDTH) ||
514*cdf0e10cSrcweir 		(nSlot == SID_TRANSLITERATE_HIRAGANA) ||
515*cdf0e10cSrcweir 		(nSlot == SID_TRANSLITERATE_KATAGANA) ||
516*cdf0e10cSrcweir 		(nSlot == SID_CUT) ||
517*cdf0e10cSrcweir //		(nSlot == SID_COPY) ||
518*cdf0e10cSrcweir 		(nSlot == SID_PASTE) ||
519*cdf0e10cSrcweir 		(nSlot == SID_DELETE)))
520*cdf0e10cSrcweir 	{
521*cdf0e10cSrcweir 		aGuard.reset( new OutlineViewModelChangeGuard( *pOlView ) );
522*cdf0e10cSrcweir 	}
523*cdf0e10cSrcweir 
524*cdf0e10cSrcweir 	switch ( nSlot )
525*cdf0e10cSrcweir 	{
526*cdf0e10cSrcweir 		case SID_CUT:
527*cdf0e10cSrcweir 		{
528*cdf0e10cSrcweir 			if(HasCurrentFunction())
529*cdf0e10cSrcweir 			{
530*cdf0e10cSrcweir 				GetCurrentFunction()->DoCut();
531*cdf0e10cSrcweir 			}
532*cdf0e10cSrcweir 			else if (pOlView)
533*cdf0e10cSrcweir 			{
534*cdf0e10cSrcweir 				pOlView->DoCut();
535*cdf0e10cSrcweir 			}
536*cdf0e10cSrcweir 			rReq.Done();
537*cdf0e10cSrcweir 			bPreviewState = sal_True;
538*cdf0e10cSrcweir 		}
539*cdf0e10cSrcweir 		break;
540*cdf0e10cSrcweir 
541*cdf0e10cSrcweir 		case SID_COPY:
542*cdf0e10cSrcweir 		{
543*cdf0e10cSrcweir 			if(HasCurrentFunction())
544*cdf0e10cSrcweir 			{
545*cdf0e10cSrcweir 				GetCurrentFunction()->DoCopy();
546*cdf0e10cSrcweir 			}
547*cdf0e10cSrcweir 			else if (pOlView)
548*cdf0e10cSrcweir 			{
549*cdf0e10cSrcweir 				pOlView->DoCopy();
550*cdf0e10cSrcweir 			}
551*cdf0e10cSrcweir 			rReq.Done();
552*cdf0e10cSrcweir 			bPreviewState = sal_True;
553*cdf0e10cSrcweir 		}
554*cdf0e10cSrcweir 		break;
555*cdf0e10cSrcweir 
556*cdf0e10cSrcweir 		case SID_PASTE:
557*cdf0e10cSrcweir 		{
558*cdf0e10cSrcweir             OutlineViewPageChangesGuard aGuard2(pOlView);
559*cdf0e10cSrcweir 
560*cdf0e10cSrcweir 			if(HasCurrentFunction())
561*cdf0e10cSrcweir 			{
562*cdf0e10cSrcweir 				GetCurrentFunction()->DoPaste();
563*cdf0e10cSrcweir 			}
564*cdf0e10cSrcweir 			else if (pOlView)
565*cdf0e10cSrcweir 			{
566*cdf0e10cSrcweir 				pOlView->DoPaste();
567*cdf0e10cSrcweir 			}
568*cdf0e10cSrcweir 			rReq.Done();
569*cdf0e10cSrcweir 			bPreviewState = sal_True;
570*cdf0e10cSrcweir 		}
571*cdf0e10cSrcweir 		break;
572*cdf0e10cSrcweir 
573*cdf0e10cSrcweir 		case SID_DELETE:
574*cdf0e10cSrcweir 		{
575*cdf0e10cSrcweir 			if( pOlView )
576*cdf0e10cSrcweir 			{
577*cdf0e10cSrcweir 				OutlinerView* pOutlView = pOlView->GetViewByWindow(GetActiveWindow());
578*cdf0e10cSrcweir 				if (pOutlView)
579*cdf0e10cSrcweir 				{
580*cdf0e10cSrcweir 					OutlineViewPageChangesGuard aGuard2(pOlView);
581*cdf0e10cSrcweir 
582*cdf0e10cSrcweir 					KeyCode  aKCode(KEY_DELETE);
583*cdf0e10cSrcweir 					KeyEvent aKEvt( 0, aKCode );
584*cdf0e10cSrcweir 					pOutlView->PostKeyEvent(aKEvt);
585*cdf0e10cSrcweir 
586*cdf0e10cSrcweir 					FunctionReference xFunc( GetCurrentFunction() );
587*cdf0e10cSrcweir 					FuOutlineText* pFuOutlineText = dynamic_cast< FuOutlineText* >( xFunc.get() );
588*cdf0e10cSrcweir                     if( pFuOutlineText )
589*cdf0e10cSrcweir                         pFuOutlineText->UpdateForKeyPress (aKEvt);
590*cdf0e10cSrcweir 				}
591*cdf0e10cSrcweir 			}
592*cdf0e10cSrcweir 			rReq.Done();
593*cdf0e10cSrcweir 			bPreviewState = sal_True;
594*cdf0e10cSrcweir 		}
595*cdf0e10cSrcweir 		break;
596*cdf0e10cSrcweir 
597*cdf0e10cSrcweir 		case SID_DRAWINGMODE:
598*cdf0e10cSrcweir 		case SID_NOTESMODE:
599*cdf0e10cSrcweir 		case SID_HANDOUTMODE:
600*cdf0e10cSrcweir 		case SID_DIAMODE:
601*cdf0e10cSrcweir 		case SID_OUTLINEMODE:
602*cdf0e10cSrcweir             framework::FrameworkHelper::Instance(GetViewShellBase())->HandleModeChangeSlot(
603*cdf0e10cSrcweir                 nSlot,
604*cdf0e10cSrcweir                 rReq);
605*cdf0e10cSrcweir 			rReq.Done();
606*cdf0e10cSrcweir 			break;
607*cdf0e10cSrcweir 
608*cdf0e10cSrcweir 		case SID_RULER:
609*cdf0e10cSrcweir 			SetRuler( !HasRuler() );
610*cdf0e10cSrcweir 			Invalidate( SID_RULER );
611*cdf0e10cSrcweir 			rReq.Done();
612*cdf0e10cSrcweir 		break;
613*cdf0e10cSrcweir 
614*cdf0e10cSrcweir 		case SID_ZOOM_PREV:
615*cdf0e10cSrcweir 		{
616*cdf0e10cSrcweir 			if (mpZoomList->IsPreviousPossible())
617*cdf0e10cSrcweir 			{
618*cdf0e10cSrcweir 				// Vorheriges ZoomRect einstellen
619*cdf0e10cSrcweir 				SetZoomRect(mpZoomList->GetPreviousZoomRect());
620*cdf0e10cSrcweir 			}
621*cdf0e10cSrcweir 			rReq.Done ();
622*cdf0e10cSrcweir 		}
623*cdf0e10cSrcweir 		break;
624*cdf0e10cSrcweir 
625*cdf0e10cSrcweir 		case SID_ZOOM_NEXT:
626*cdf0e10cSrcweir 		{
627*cdf0e10cSrcweir 			if (mpZoomList->IsNextPossible())
628*cdf0e10cSrcweir 			{
629*cdf0e10cSrcweir 				// Naechstes ZoomRect einstellen
630*cdf0e10cSrcweir 				SetZoomRect(mpZoomList->GetNextZoomRect());
631*cdf0e10cSrcweir 			}
632*cdf0e10cSrcweir 			rReq.Done ();
633*cdf0e10cSrcweir 		}
634*cdf0e10cSrcweir 		break;
635*cdf0e10cSrcweir 
636*cdf0e10cSrcweir 		case SID_AUTOSPELL_CHECK:
637*cdf0e10cSrcweir 		{
638*cdf0e10cSrcweir 			GetDoc()->SetOnlineSpell(!GetDoc()->GetOnlineSpell());
639*cdf0e10cSrcweir 			rReq.Done ();
640*cdf0e10cSrcweir 		}
641*cdf0e10cSrcweir 		break;
642*cdf0e10cSrcweir 
643*cdf0e10cSrcweir         case SID_TRANSLITERATE_SENTENCE_CASE:
644*cdf0e10cSrcweir         case SID_TRANSLITERATE_TITLE_CASE:
645*cdf0e10cSrcweir         case SID_TRANSLITERATE_TOGGLE_CASE:
646*cdf0e10cSrcweir 		case SID_TRANSLITERATE_UPPER:
647*cdf0e10cSrcweir 		case SID_TRANSLITERATE_LOWER:
648*cdf0e10cSrcweir 		case SID_TRANSLITERATE_HALFWIDTH:
649*cdf0e10cSrcweir 		case SID_TRANSLITERATE_FULLWIDTH:
650*cdf0e10cSrcweir 		case SID_TRANSLITERATE_HIRAGANA:
651*cdf0e10cSrcweir 		case SID_TRANSLITERATE_KATAGANA:
652*cdf0e10cSrcweir 		{
653*cdf0e10cSrcweir 			OutlinerView* pOLV = pOlView->GetViewByWindow( GetActiveWindow() );
654*cdf0e10cSrcweir 			if( pOLV )
655*cdf0e10cSrcweir 			{
656*cdf0e10cSrcweir 				using namespace ::com::sun::star::i18n;
657*cdf0e10cSrcweir 				sal_Int32 nType = 0;
658*cdf0e10cSrcweir 
659*cdf0e10cSrcweir 				switch( nSlot )
660*cdf0e10cSrcweir 				{
661*cdf0e10cSrcweir                     case SID_TRANSLITERATE_SENTENCE_CASE:
662*cdf0e10cSrcweir                         nType = TransliterationModulesExtra::SENTENCE_CASE;
663*cdf0e10cSrcweir                         break;
664*cdf0e10cSrcweir                     case SID_TRANSLITERATE_TITLE_CASE:
665*cdf0e10cSrcweir                         nType = TransliterationModulesExtra::TITLE_CASE;
666*cdf0e10cSrcweir                         break;
667*cdf0e10cSrcweir                     case SID_TRANSLITERATE_TOGGLE_CASE:
668*cdf0e10cSrcweir                         nType = TransliterationModulesExtra::TOGGLE_CASE;
669*cdf0e10cSrcweir                         break;
670*cdf0e10cSrcweir                     case SID_TRANSLITERATE_UPPER:
671*cdf0e10cSrcweir 						nType = TransliterationModules_LOWERCASE_UPPERCASE;
672*cdf0e10cSrcweir 						break;
673*cdf0e10cSrcweir 					case SID_TRANSLITERATE_LOWER:
674*cdf0e10cSrcweir 						nType = TransliterationModules_UPPERCASE_LOWERCASE;
675*cdf0e10cSrcweir 						break;
676*cdf0e10cSrcweir 					case SID_TRANSLITERATE_HALFWIDTH:
677*cdf0e10cSrcweir 						nType = TransliterationModules_FULLWIDTH_HALFWIDTH;
678*cdf0e10cSrcweir 						break;
679*cdf0e10cSrcweir 					case SID_TRANSLITERATE_FULLWIDTH:
680*cdf0e10cSrcweir 						nType = TransliterationModules_HALFWIDTH_FULLWIDTH;
681*cdf0e10cSrcweir 						break;
682*cdf0e10cSrcweir 					case SID_TRANSLITERATE_HIRAGANA:
683*cdf0e10cSrcweir 						nType = TransliterationModules_KATAKANA_HIRAGANA;
684*cdf0e10cSrcweir 						break;
685*cdf0e10cSrcweir 					case SID_TRANSLITERATE_KATAGANA:
686*cdf0e10cSrcweir 						nType = TransliterationModules_HIRAGANA_KATAKANA;
687*cdf0e10cSrcweir 						break;
688*cdf0e10cSrcweir 				}
689*cdf0e10cSrcweir 
690*cdf0e10cSrcweir 				pOLV->TransliterateText( nType );
691*cdf0e10cSrcweir 			}
692*cdf0e10cSrcweir 
693*cdf0e10cSrcweir 			rReq.Done();
694*cdf0e10cSrcweir 			bPreviewState = sal_True;
695*cdf0e10cSrcweir 		}
696*cdf0e10cSrcweir 		break;
697*cdf0e10cSrcweir 
698*cdf0e10cSrcweir 		// #96090# added Undo/Redo handling
699*cdf0e10cSrcweir 		case SID_UNDO :
700*cdf0e10cSrcweir 		{
701*cdf0e10cSrcweir 			OutlineViewPageChangesGuard aGuard2(pOlView);
702*cdf0e10cSrcweir 			ImpSidUndo(sal_False, rReq);
703*cdf0e10cSrcweir 		}
704*cdf0e10cSrcweir 		break;
705*cdf0e10cSrcweir 		case SID_REDO :
706*cdf0e10cSrcweir 		{
707*cdf0e10cSrcweir 			OutlineViewPageChangesGuard aGuard2(pOlView);
708*cdf0e10cSrcweir 			ImpSidRedo(sal_False, rReq);
709*cdf0e10cSrcweir 		}
710*cdf0e10cSrcweir 		break;
711*cdf0e10cSrcweir 
712*cdf0e10cSrcweir 		default:
713*cdf0e10cSrcweir 		break;
714*cdf0e10cSrcweir 	}
715*cdf0e10cSrcweir 
716*cdf0e10cSrcweir 	if( bPreviewState )
717*cdf0e10cSrcweir 		Invalidate( SID_PREVIEW_STATE );
718*cdf0e10cSrcweir 
719*cdf0e10cSrcweir 	Invalidate(SID_CUT);
720*cdf0e10cSrcweir 	Invalidate(SID_COPY);
721*cdf0e10cSrcweir 	Invalidate(SID_PASTE);
722*cdf0e10cSrcweir }
723*cdf0e10cSrcweir 
724*cdf0e10cSrcweir /*************************************************************************
725*cdf0e10cSrcweir |*
726*cdf0e10cSrcweir |* SfxRequests fuer permanente Funktionen
727*cdf0e10cSrcweir |*
728*cdf0e10cSrcweir \************************************************************************/
729*cdf0e10cSrcweir 
730*cdf0e10cSrcweir void OutlineViewShell::FuPermanent(SfxRequest &rReq)
731*cdf0e10cSrcweir {
732*cdf0e10cSrcweir 	if(HasCurrentFunction())
733*cdf0e10cSrcweir 	{
734*cdf0e10cSrcweir 		DeactivateCurrentFunction(true);
735*cdf0e10cSrcweir 	}
736*cdf0e10cSrcweir 
737*cdf0e10cSrcweir 	switch ( rReq.GetSlot() )
738*cdf0e10cSrcweir 	{
739*cdf0e10cSrcweir 		case SID_EDIT_OUTLINER:
740*cdf0e10cSrcweir 		{
741*cdf0e10cSrcweir 			::Outliner* pOutl = pOlView->GetOutliner();
742*cdf0e10cSrcweir 			if( pOutl )
743*cdf0e10cSrcweir 			{
744*cdf0e10cSrcweir 				pOutl->GetUndoManager().Clear();
745*cdf0e10cSrcweir 				pOutl->UpdateFields();
746*cdf0e10cSrcweir 			}
747*cdf0e10cSrcweir 
748*cdf0e10cSrcweir 			SetCurrentFunction( FuOutlineText::Create(this,GetActiveWindow(),pOlView,GetDoc(),rReq) );
749*cdf0e10cSrcweir 
750*cdf0e10cSrcweir 			rReq.Done();
751*cdf0e10cSrcweir 		}
752*cdf0e10cSrcweir 		break;
753*cdf0e10cSrcweir 
754*cdf0e10cSrcweir 	  default:
755*cdf0e10cSrcweir 	  break;
756*cdf0e10cSrcweir 	}
757*cdf0e10cSrcweir 
758*cdf0e10cSrcweir 	if(HasOldFunction())
759*cdf0e10cSrcweir 	{
760*cdf0e10cSrcweir 		GetOldFunction()->Deactivate();
761*cdf0e10cSrcweir 		SetOldFunction(0);
762*cdf0e10cSrcweir 	}
763*cdf0e10cSrcweir 
764*cdf0e10cSrcweir 	if(HasCurrentFunction())
765*cdf0e10cSrcweir 	{
766*cdf0e10cSrcweir 		GetCurrentFunction()->Activate();
767*cdf0e10cSrcweir 		SetOldFunction(GetCurrentFunction());
768*cdf0e10cSrcweir 	}
769*cdf0e10cSrcweir }
770*cdf0e10cSrcweir 
771*cdf0e10cSrcweir 
772*cdf0e10cSrcweir IMPL_LINK( OutlineViewShell, ClipboardChanged, TransferableDataHelper*, pDataHelper )
773*cdf0e10cSrcweir {
774*cdf0e10cSrcweir 	if ( pDataHelper )
775*cdf0e10cSrcweir 	{
776*cdf0e10cSrcweir 		bPastePossible = ( pDataHelper->GetFormatCount() != 0 &&
777*cdf0e10cSrcweir 							( pDataHelper->HasFormat( FORMAT_STRING ) ||
778*cdf0e10cSrcweir 							  pDataHelper->HasFormat( FORMAT_RTF ) ||
779*cdf0e10cSrcweir 							  pDataHelper->HasFormat( SOT_FORMATSTR_ID_HTML ) ) );
780*cdf0e10cSrcweir 
781*cdf0e10cSrcweir 		SfxBindings& rBindings = GetViewFrame()->GetBindings();
782*cdf0e10cSrcweir 		rBindings.Invalidate( SID_PASTE );
783*cdf0e10cSrcweir         rBindings.Invalidate( SID_PASTE_SPECIAL );
784*cdf0e10cSrcweir 		rBindings.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS );
785*cdf0e10cSrcweir 	}
786*cdf0e10cSrcweir 	return 0;
787*cdf0e10cSrcweir }
788*cdf0e10cSrcweir 
789*cdf0e10cSrcweir /*************************************************************************
790*cdf0e10cSrcweir |*
791*cdf0e10cSrcweir |* Status (Enabled/Disabled) von Menue-SfxSlots setzen
792*cdf0e10cSrcweir |*
793*cdf0e10cSrcweir \************************************************************************/
794*cdf0e10cSrcweir 
795*cdf0e10cSrcweir void OutlineViewShell::GetMenuState( SfxItemSet &rSet )
796*cdf0e10cSrcweir {
797*cdf0e10cSrcweir 	ViewShell::GetMenuState(rSet);
798*cdf0e10cSrcweir 
799*cdf0e10cSrcweir 	// Vorlagenkatalog darf nicht aufgerufen werden
800*cdf0e10cSrcweir 	rSet.DisableItem( SID_STYLE_CATALOG );
801*cdf0e10cSrcweir 
802*cdf0e10cSrcweir 	rSet.Put(SfxBoolItem(SID_DIAMODE, sal_False));
803*cdf0e10cSrcweir 	rSet.Put(SfxBoolItem(SID_DRAWINGMODE, sal_False));
804*cdf0e10cSrcweir 	rSet.Put(SfxBoolItem(SID_OUTLINEMODE, sal_True));
805*cdf0e10cSrcweir 	rSet.Put(SfxBoolItem(SID_NOTESMODE, sal_False));
806*cdf0e10cSrcweir 	rSet.Put(SfxBoolItem(SID_HANDOUTMODE, sal_False));
807*cdf0e10cSrcweir 
808*cdf0e10cSrcweir 	if (!mpZoomList->IsNextPossible())
809*cdf0e10cSrcweir 	{
810*cdf0e10cSrcweir 	   rSet.DisableItem(SID_ZOOM_NEXT);
811*cdf0e10cSrcweir 	}
812*cdf0e10cSrcweir 	if (!mpZoomList->IsPreviousPossible())
813*cdf0e10cSrcweir 	{
814*cdf0e10cSrcweir 	   rSet.DisableItem(SID_ZOOM_PREV);
815*cdf0e10cSrcweir 	}
816*cdf0e10cSrcweir 
817*cdf0e10cSrcweir 	if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ZOOM_IN ) ||
818*cdf0e10cSrcweir 		SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ZOOM_OUT ) )
819*cdf0e10cSrcweir 	{
820*cdf0e10cSrcweir 		if( GetActiveWindow()->GetZoom() <= GetActiveWindow()->GetMinZoom() || GetDocSh()->IsUIActive() )
821*cdf0e10cSrcweir 			rSet.DisableItem( SID_ZOOM_IN );
822*cdf0e10cSrcweir 		if( GetActiveWindow()->GetZoom() >= GetActiveWindow()->GetMaxZoom() || GetDocSh()->IsUIActive() )
823*cdf0e10cSrcweir 			rSet.DisableItem( SID_ZOOM_OUT );
824*cdf0e10cSrcweir 	}
825*cdf0e10cSrcweir 
826*cdf0e10cSrcweir 	::Outliner* pOutl = pOlView->GetOutliner();
827*cdf0e10cSrcweir 	DBG_ASSERT(pOutl, "OutlineViewShell::GetMenuState(), no outliner? Fatality!");
828*cdf0e10cSrcweir 	if( !pOutl )
829*cdf0e10cSrcweir 		return;
830*cdf0e10cSrcweir 
831*cdf0e10cSrcweir 	// 'Alles auswaehlen' zulassen?
832*cdf0e10cSrcweir 	if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_SELECTALL ) )
833*cdf0e10cSrcweir 	{
834*cdf0e10cSrcweir 		sal_uLong nParaCount = pOutl->GetParagraphCount();
835*cdf0e10cSrcweir 		sal_Bool bDisable = nParaCount == 0;
836*cdf0e10cSrcweir 		if (!bDisable && nParaCount == 1)
837*cdf0e10cSrcweir 		{
838*cdf0e10cSrcweir 			String aTest( pOutl->GetText( pOutl->GetParagraph( 0 ) ) );
839*cdf0e10cSrcweir 			if (aTest.Len() == 0)
840*cdf0e10cSrcweir 			{
841*cdf0e10cSrcweir 				bDisable = sal_True;
842*cdf0e10cSrcweir 			}
843*cdf0e10cSrcweir 		}
844*cdf0e10cSrcweir 		if (bDisable)
845*cdf0e10cSrcweir 			rSet.DisableItem(SID_SELECTALL);
846*cdf0e10cSrcweir 	}
847*cdf0e10cSrcweir 
848*cdf0e10cSrcweir 	// Status des Lineals setzen
849*cdf0e10cSrcweir 	rSet.Put( SfxBoolItem( SID_RULER, HasRuler() ) );
850*cdf0e10cSrcweir 
851*cdf0e10cSrcweir 	// Formatierung ein oder aus?
852*cdf0e10cSrcweir 	rSet.Put( SfxBoolItem( SID_OUTLINE_FORMAT, !pOutl->IsFlatMode() ) );
853*cdf0e10cSrcweir 
854*cdf0e10cSrcweir 	if( pOutl->IsFlatMode() )
855*cdf0e10cSrcweir 		rSet.DisableItem( SID_COLORVIEW );
856*cdf0e10cSrcweir 	else
857*cdf0e10cSrcweir 	{
858*cdf0e10cSrcweir 		// Farbansicht ein/aus
859*cdf0e10cSrcweir 		sal_uLong nCntrl = pOutl->GetControlWord();
860*cdf0e10cSrcweir 		sal_Bool bNoColor = sal_False;
861*cdf0e10cSrcweir 		if (nCntrl & EE_CNTRL_NOCOLORS)
862*cdf0e10cSrcweir 			bNoColor = sal_True;
863*cdf0e10cSrcweir 
864*cdf0e10cSrcweir 		rSet.Put( SfxBoolItem( SID_COLORVIEW, bNoColor ) );
865*cdf0e10cSrcweir 	}
866*cdf0e10cSrcweir 
867*cdf0e10cSrcweir 	// Buttons der Werkzeugleiste
868*cdf0e10cSrcweir 	// zunaechst selektionsabhaengige: COLLAPSE, EXPAND
869*cdf0e10cSrcweir 	sal_Bool bDisableCollapse = sal_True;
870*cdf0e10cSrcweir 	sal_Bool bDisableExpand   = sal_True;
871*cdf0e10cSrcweir 	sal_Bool bUnique		  = sal_True;
872*cdf0e10cSrcweir 	OutlinerView* pOutlinerView = pOlView->GetViewByWindow(GetActiveWindow());
873*cdf0e10cSrcweir 	List* pList = pOutlinerView->CreateSelectionList();
874*cdf0e10cSrcweir 	Paragraph* pPara = (Paragraph*)pList->First();
875*cdf0e10cSrcweir 
876*cdf0e10cSrcweir 	sal_Int16 nDepth;
877*cdf0e10cSrcweir 	sal_Int16 nTmpDepth = pOutl->GetDepth( (sal_uInt16) pOutl->GetAbsPos( pPara ) );
878*cdf0e10cSrcweir 	bool bPage = pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE );
879*cdf0e10cSrcweir 	while (pPara)
880*cdf0e10cSrcweir 	{
881*cdf0e10cSrcweir 		nDepth = pOutl->GetDepth( (sal_uInt16) pOutl->GetAbsPos( pPara ) );
882*cdf0e10cSrcweir 
883*cdf0e10cSrcweir 		if( nDepth != nTmpDepth )
884*cdf0e10cSrcweir 			bUnique = sal_False;
885*cdf0e10cSrcweir 		if( bPage != pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE ) )
886*cdf0e10cSrcweir 			bUnique = sal_False;
887*cdf0e10cSrcweir 		if (!pOutl->IsExpanded(pPara) && pOutl->HasChilds(pPara))
888*cdf0e10cSrcweir 			bDisableExpand = sal_False;
889*cdf0e10cSrcweir 		if (pOutl->IsExpanded(pPara) && pOutl->HasChilds(pPara))
890*cdf0e10cSrcweir 			bDisableCollapse = sal_False;
891*cdf0e10cSrcweir 
892*cdf0e10cSrcweir 		pPara = (Paragraph*)pList->Next();
893*cdf0e10cSrcweir 	}
894*cdf0e10cSrcweir 
895*cdf0e10cSrcweir 	delete pList;
896*cdf0e10cSrcweir 
897*cdf0e10cSrcweir 	if (bDisableExpand)
898*cdf0e10cSrcweir 		rSet.DisableItem(SID_OUTLINE_EXPAND);
899*cdf0e10cSrcweir 	if (bDisableCollapse)
900*cdf0e10cSrcweir 		rSet.DisableItem(SID_OUTLINE_COLLAPSE);
901*cdf0e10cSrcweir 
902*cdf0e10cSrcweir 	// ergibt die Selektion ein eindeutiges Praesentationslayout?
903*cdf0e10cSrcweir 	// wenn nicht, duerfen die Vorlagen nicht bearbeitet werden
904*cdf0e10cSrcweir 	SfxItemSet aSet(*rSet.GetPool(), SID_STATUS_LAYOUT, SID_STATUS_LAYOUT);
905*cdf0e10cSrcweir 	GetStatusBarState(aSet);
906*cdf0e10cSrcweir 	String aTest(((SfxStringItem&)aSet.Get(SID_STATUS_LAYOUT)).GetValue());
907*cdf0e10cSrcweir 	if (aTest.Len() == 0)
908*cdf0e10cSrcweir 	{
909*cdf0e10cSrcweir 		bUnique = sal_False;
910*cdf0e10cSrcweir 		rSet.DisableItem(SID_PRESENTATION_TEMPLATES);
911*cdf0e10cSrcweir 	}
912*cdf0e10cSrcweir 
913*cdf0e10cSrcweir 	if (!bUnique)
914*cdf0e10cSrcweir 		rSet.DisableItem( SID_PRESENTATIONOBJECT );
915*cdf0e10cSrcweir 
916*cdf0e10cSrcweir 	// jetzt die selektionsunabhaengigen: COLLAPSE_ALL, EXPAND_ALL
917*cdf0e10cSrcweir 	sal_Bool bDisableCollapseAll = sal_True;
918*cdf0e10cSrcweir 	sal_Bool bDisableExpandAll	 = sal_True;
919*cdf0e10cSrcweir 
920*cdf0e10cSrcweir 	// wenn schon die Selektion etwas kollabierbares/expandierbares enthaelt
921*cdf0e10cSrcweir 	if (!bDisableCollapse)
922*cdf0e10cSrcweir 		bDisableCollapseAll = sal_False;
923*cdf0e10cSrcweir 	if (!bDisableExpand)
924*cdf0e10cSrcweir 		bDisableExpandAll = sal_False;
925*cdf0e10cSrcweir 
926*cdf0e10cSrcweir 	// schade, so billig kommen wir nicht davon; alle Absaetze durchsuchen
927*cdf0e10cSrcweir 	if (bDisableCollapseAll || bDisableExpandAll)
928*cdf0e10cSrcweir 	{
929*cdf0e10cSrcweir 		sal_uLong nParaPos = 0;
930*cdf0e10cSrcweir 		pPara = pOutl->GetParagraph( nParaPos );
931*cdf0e10cSrcweir 		while (pPara && (bDisableCollapseAll || bDisableExpandAll))
932*cdf0e10cSrcweir 		{
933*cdf0e10cSrcweir 			if (!pOutl->IsExpanded(pPara) && pOutl->HasChilds(pPara))
934*cdf0e10cSrcweir 				bDisableExpandAll = sal_False;
935*cdf0e10cSrcweir 
936*cdf0e10cSrcweir 			if (pOutl->IsExpanded(pPara) && pOutl->HasChilds(pPara))
937*cdf0e10cSrcweir 				bDisableCollapseAll = sal_False;
938*cdf0e10cSrcweir 
939*cdf0e10cSrcweir 			pPara = pOutl->GetParagraph( ++nParaPos );
940*cdf0e10cSrcweir 		}
941*cdf0e10cSrcweir 	}
942*cdf0e10cSrcweir 
943*cdf0e10cSrcweir 	if (bDisableExpandAll)
944*cdf0e10cSrcweir 		rSet.DisableItem(SID_OUTLINE_EXPAND_ALL);
945*cdf0e10cSrcweir 	if (bDisableCollapseAll)
946*cdf0e10cSrcweir 		rSet.DisableItem(SID_OUTLINE_COLLAPSE_ALL);
947*cdf0e10cSrcweir 
948*cdf0e10cSrcweir 	if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_PASTE ) )
949*cdf0e10cSrcweir 	{
950*cdf0e10cSrcweir 		if ( !pClipEvtLstnr )
951*cdf0e10cSrcweir 		{
952*cdf0e10cSrcweir 			// create listener
953*cdf0e10cSrcweir 			pClipEvtLstnr = new TransferableClipboardListener( LINK( this, OutlineViewShell, ClipboardChanged ) );
954*cdf0e10cSrcweir 			pClipEvtLstnr->acquire();
955*cdf0e10cSrcweir 			pClipEvtLstnr->AddRemoveListener( GetActiveWindow(), sal_True );
956*cdf0e10cSrcweir 
957*cdf0e10cSrcweir 			// get initial state
958*cdf0e10cSrcweir 			TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( GetActiveWindow() ) );
959*cdf0e10cSrcweir 			bPastePossible = ( aDataHelper.GetFormatCount() != 0 &&
960*cdf0e10cSrcweir 								( aDataHelper.HasFormat( FORMAT_STRING ) ||
961*cdf0e10cSrcweir 								  aDataHelper.HasFormat( FORMAT_RTF ) ||
962*cdf0e10cSrcweir 								  aDataHelper.HasFormat( SOT_FORMATSTR_ID_HTML ) ) );
963*cdf0e10cSrcweir 		}
964*cdf0e10cSrcweir 
965*cdf0e10cSrcweir 		if( !bPastePossible )
966*cdf0e10cSrcweir 		{
967*cdf0e10cSrcweir 			rSet.DisableItem( SID_PASTE );
968*cdf0e10cSrcweir 		}
969*cdf0e10cSrcweir 	}
970*cdf0e10cSrcweir 
971*cdf0e10cSrcweir 	if (!pOlView->GetViewByWindow(GetActiveWindow())->HasSelection())
972*cdf0e10cSrcweir 	{
973*cdf0e10cSrcweir 		rSet.DisableItem(SID_CUT);
974*cdf0e10cSrcweir 		rSet.DisableItem(SID_COPY);
975*cdf0e10cSrcweir 	}
976*cdf0e10cSrcweir 
977*cdf0e10cSrcweir 	if (pOlView->GetOutliner()->IsModified())
978*cdf0e10cSrcweir 	{
979*cdf0e10cSrcweir 		GetDoc()->SetChanged(sal_True);
980*cdf0e10cSrcweir 	}
981*cdf0e10cSrcweir 
982*cdf0e10cSrcweir 	// Da �berladen, muss hier der Status gesetzt werden
983*cdf0e10cSrcweir 	if( !GetDocSh()->IsModified() )
984*cdf0e10cSrcweir 	{
985*cdf0e10cSrcweir 		rSet.DisableItem( SID_SAVEDOC );
986*cdf0e10cSrcweir 	}
987*cdf0e10cSrcweir 
988*cdf0e10cSrcweir 	if ( GetDocSh()->IsReadOnly() )
989*cdf0e10cSrcweir 	{
990*cdf0e10cSrcweir 		rSet.DisableItem( SID_AUTOSPELL_CHECK );
991*cdf0e10cSrcweir 	}
992*cdf0e10cSrcweir 	else
993*cdf0e10cSrcweir 	{
994*cdf0e10cSrcweir 		if (GetDoc()->GetOnlineSpell())
995*cdf0e10cSrcweir 		{
996*cdf0e10cSrcweir 			rSet.Put(SfxBoolItem(SID_AUTOSPELL_CHECK, sal_True));
997*cdf0e10cSrcweir 		}
998*cdf0e10cSrcweir 		else
999*cdf0e10cSrcweir 		{
1000*cdf0e10cSrcweir 			rSet.Put(SfxBoolItem(SID_AUTOSPELL_CHECK, sal_False));
1001*cdf0e10cSrcweir 		}
1002*cdf0e10cSrcweir 	}
1003*cdf0e10cSrcweir 
1004*cdf0e10cSrcweir 	// Feldbefehle
1005*cdf0e10cSrcweir 	if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_MODIFY_FIELD ) )
1006*cdf0e10cSrcweir 	{
1007*cdf0e10cSrcweir 		const SvxFieldItem* pFldItem = pOutlinerView->GetFieldAtSelection();
1008*cdf0e10cSrcweir 
1009*cdf0e10cSrcweir 		if( !( pFldItem && (pFldItem->GetField()->ISA( SvxDateField ) ||
1010*cdf0e10cSrcweir 							pFldItem->GetField()->ISA( SvxAuthorField ) ||
1011*cdf0e10cSrcweir 							pFldItem->GetField()->ISA( SvxExtFileField ) ||
1012*cdf0e10cSrcweir 							pFldItem->GetField()->ISA( SvxExtTimeField ) ) ) )
1013*cdf0e10cSrcweir 		{
1014*cdf0e10cSrcweir 			rSet.DisableItem( SID_MODIFY_FIELD );
1015*cdf0e10cSrcweir 		}
1016*cdf0e10cSrcweir 	}
1017*cdf0e10cSrcweir 
1018*cdf0e10cSrcweir 	if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_EXPAND_PAGE))
1019*cdf0e10cSrcweir 	{
1020*cdf0e10cSrcweir 		sal_Bool bDisable = sal_True;
1021*cdf0e10cSrcweir 		sal_uInt16 i = 0;
1022*cdf0e10cSrcweir 		sal_uInt16 nCount = GetDoc()->GetSdPageCount(PK_STANDARD);
1023*cdf0e10cSrcweir 		pOlView->SetSelectedPages();
1024*cdf0e10cSrcweir 
1025*cdf0e10cSrcweir 		while (i < nCount && bDisable)
1026*cdf0e10cSrcweir 		{
1027*cdf0e10cSrcweir 			SdPage* pPage = GetDoc()->GetSdPage(i, PK_STANDARD);
1028*cdf0e10cSrcweir 
1029*cdf0e10cSrcweir 			if (pPage->IsSelected())
1030*cdf0e10cSrcweir 			{
1031*cdf0e10cSrcweir 				SdrObject* pObj = pPage->GetPresObj(PRESOBJ_OUTLINE);
1032*cdf0e10cSrcweir 
1033*cdf0e10cSrcweir                 if (pObj!=NULL )
1034*cdf0e10cSrcweir 				{
1035*cdf0e10cSrcweir 					if( !pObj->IsEmptyPresObj() )
1036*cdf0e10cSrcweir 					{
1037*cdf0e10cSrcweir 						bDisable = false;
1038*cdf0e10cSrcweir 					}
1039*cdf0e10cSrcweir 					else
1040*cdf0e10cSrcweir 					{
1041*cdf0e10cSrcweir 						// check if the object is in edit, than its temporarely not empty
1042*cdf0e10cSrcweir 						SdrTextObj* pTextObj = dynamic_cast< SdrTextObj* >( pObj );
1043*cdf0e10cSrcweir 						if( pTextObj )
1044*cdf0e10cSrcweir 						{
1045*cdf0e10cSrcweir 							OutlinerParaObject* pParaObj = pTextObj->GetEditOutlinerParaObject();
1046*cdf0e10cSrcweir 							if( pParaObj )
1047*cdf0e10cSrcweir 							{
1048*cdf0e10cSrcweir 								delete pParaObj;
1049*cdf0e10cSrcweir 								bDisable = false;
1050*cdf0e10cSrcweir 							}
1051*cdf0e10cSrcweir 						}
1052*cdf0e10cSrcweir 					}
1053*cdf0e10cSrcweir 				}
1054*cdf0e10cSrcweir 			}
1055*cdf0e10cSrcweir 
1056*cdf0e10cSrcweir 			i++;
1057*cdf0e10cSrcweir 		}
1058*cdf0e10cSrcweir 
1059*cdf0e10cSrcweir 		if (bDisable)
1060*cdf0e10cSrcweir 		{
1061*cdf0e10cSrcweir 			rSet.DisableItem(SID_EXPAND_PAGE);
1062*cdf0e10cSrcweir 		}
1063*cdf0e10cSrcweir 	}
1064*cdf0e10cSrcweir 
1065*cdf0e10cSrcweir 	if (SFX_ITEM_AVAILABLE == rSet.GetItemState(SID_SUMMARY_PAGE))
1066*cdf0e10cSrcweir 	{
1067*cdf0e10cSrcweir 		sal_Bool bDisable = sal_True;
1068*cdf0e10cSrcweir 		sal_uInt16 i = 0;
1069*cdf0e10cSrcweir 		sal_uInt16 nCount = GetDoc()->GetSdPageCount(PK_STANDARD);
1070*cdf0e10cSrcweir 		pOlView->SetSelectedPages();
1071*cdf0e10cSrcweir 
1072*cdf0e10cSrcweir 		while (i < nCount && bDisable)
1073*cdf0e10cSrcweir 		{
1074*cdf0e10cSrcweir 			SdPage* pPage = GetDoc()->GetSdPage(i, PK_STANDARD);
1075*cdf0e10cSrcweir 
1076*cdf0e10cSrcweir 			if (pPage->IsSelected())
1077*cdf0e10cSrcweir 			{
1078*cdf0e10cSrcweir 				SdrObject* pObj = pPage->GetPresObj(PRESOBJ_TITLE);
1079*cdf0e10cSrcweir 
1080*cdf0e10cSrcweir 				if (pObj && !pObj->IsEmptyPresObj())
1081*cdf0e10cSrcweir 				{
1082*cdf0e10cSrcweir 					bDisable = sal_False;
1083*cdf0e10cSrcweir 				}
1084*cdf0e10cSrcweir 			}
1085*cdf0e10cSrcweir 
1086*cdf0e10cSrcweir 			i++;
1087*cdf0e10cSrcweir 		}
1088*cdf0e10cSrcweir 
1089*cdf0e10cSrcweir 		if (bDisable)
1090*cdf0e10cSrcweir 		{
1091*cdf0e10cSrcweir 			rSet.DisableItem(SID_SUMMARY_PAGE);
1092*cdf0e10cSrcweir 		}
1093*cdf0e10cSrcweir 	}
1094*cdf0e10cSrcweir 
1095*cdf0e10cSrcweir     if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_THESAURUS ) )
1096*cdf0e10cSrcweir 	{
1097*cdf0e10cSrcweir 		if ( !pOlView->IsTextEdit() )
1098*cdf0e10cSrcweir 		{
1099*cdf0e10cSrcweir 			rSet.DisableItem( SID_THESAURUS );
1100*cdf0e10cSrcweir 		}
1101*cdf0e10cSrcweir 		else
1102*cdf0e10cSrcweir 		{
1103*cdf0e10cSrcweir 			LanguageType            eLang = GetDoc()->GetLanguage( EE_CHAR_LANGUAGE );
1104*cdf0e10cSrcweir 	        Reference< XThesaurus > xThesaurus( LinguMgr::GetThesaurus() );
1105*cdf0e10cSrcweir 			Locale                  aLocale;
1106*cdf0e10cSrcweir 
1107*cdf0e10cSrcweir 			SvxLanguageToLocale( aLocale, eLang );
1108*cdf0e10cSrcweir 
1109*cdf0e10cSrcweir             if (!xThesaurus.is() || eLang == LANGUAGE_NONE || !xThesaurus->hasLocale(aLocale))
1110*cdf0e10cSrcweir 				rSet.DisableItem( SID_THESAURUS );
1111*cdf0e10cSrcweir 		}
1112*cdf0e10cSrcweir 	}
1113*cdf0e10cSrcweir 
1114*cdf0e10cSrcweir 	// Starten der Praesentation moeglich?
1115*cdf0e10cSrcweir 	if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_PRESENTATION ) )
1116*cdf0e10cSrcweir 	{
1117*cdf0e10cSrcweir 		sal_Bool bDisable = sal_True;
1118*cdf0e10cSrcweir 		sal_uInt16 nCount = GetDoc()->GetSdPageCount( PK_STANDARD );
1119*cdf0e10cSrcweir 
1120*cdf0e10cSrcweir 		for( sal_uInt16 i = 0; i < nCount && bDisable; i++ )
1121*cdf0e10cSrcweir 		{
1122*cdf0e10cSrcweir 			SdPage* pPage = GetDoc()->GetSdPage(i, PK_STANDARD);
1123*cdf0e10cSrcweir 
1124*cdf0e10cSrcweir 			if( !pPage->IsExcluded() )
1125*cdf0e10cSrcweir 				bDisable = sal_False;
1126*cdf0e10cSrcweir 		}
1127*cdf0e10cSrcweir 		if( bDisable || GetDocSh()->IsPreview())
1128*cdf0e10cSrcweir 		{
1129*cdf0e10cSrcweir 			rSet.DisableItem( SID_PRESENTATION );
1130*cdf0e10cSrcweir 		}
1131*cdf0e10cSrcweir 	}
1132*cdf0e10cSrcweir 
1133*cdf0e10cSrcweir 	FuBullet::GetSlotState( rSet, this, GetViewFrame() );
1134*cdf0e10cSrcweir 
1135*cdf0e10cSrcweir 	//rSet.DisableItem( SID_PRINTDOC );
1136*cdf0e10cSrcweir 	//rSet.DisableItem( SID_PRINTDOCDIRECT );
1137*cdf0e10cSrcweir 	//rSet.DisableItem( SID_SETUPPRINTER );
1138*cdf0e10cSrcweir }
1139*cdf0e10cSrcweir 
1140*cdf0e10cSrcweir /*************************************************************************
1141*cdf0e10cSrcweir |*
1142*cdf0e10cSrcweir |* wird gerufen, wenn ScrollBar benutzt wird
1143*cdf0e10cSrcweir |*
1144*cdf0e10cSrcweir \************************************************************************/
1145*cdf0e10cSrcweir 
1146*cdf0e10cSrcweir long OutlineViewShell::VirtHScrollHdl(ScrollBar* pHScroll)
1147*cdf0e10cSrcweir {
1148*cdf0e10cSrcweir 	long   nThumb = pHScroll->GetThumbPos();
1149*cdf0e10cSrcweir 	long   nRange = pHScroll->GetRange().Len();
1150*cdf0e10cSrcweir 	double fX	  = (double) nThumb / nRange;
1151*cdf0e10cSrcweir 
1152*cdf0e10cSrcweir     Window* 	  pWin			= mpContentWindow.get();
1153*cdf0e10cSrcweir     OutlinerView* pOutlinerView = pOlView->GetViewByWindow(pWin);
1154*cdf0e10cSrcweir     long		  nViewWidth	= pWin->PixelToLogic(
1155*cdf0e10cSrcweir         pWin->GetSizePixel()).Width();
1156*cdf0e10cSrcweir     long		  nTextWidth	= pOlView->GetPaperWidth();
1157*cdf0e10cSrcweir     nViewWidth					= Max(nViewWidth, nTextWidth);
1158*cdf0e10cSrcweir     long		  nCurrentPos	= pOutlinerView->GetVisArea().Left();
1159*cdf0e10cSrcweir     long		  nTargetPos	= (long)(fX * nViewWidth);
1160*cdf0e10cSrcweir     long		  nDelta		= nTargetPos - nCurrentPos;
1161*cdf0e10cSrcweir 
1162*cdf0e10cSrcweir     pOutlinerView->HideCursor();
1163*cdf0e10cSrcweir     pOutlinerView->Scroll(-nDelta, 0);
1164*cdf0e10cSrcweir     pOutlinerView->ShowCursor(sal_False);
1165*cdf0e10cSrcweir 
1166*cdf0e10cSrcweir     pOlView->InvalidateSlideNumberArea();
1167*cdf0e10cSrcweir 	return 0;
1168*cdf0e10cSrcweir }
1169*cdf0e10cSrcweir 
1170*cdf0e10cSrcweir /*************************************************************************
1171*cdf0e10cSrcweir |*
1172*cdf0e10cSrcweir |* wird gerufen, wenn ScrollBar benutzt wird
1173*cdf0e10cSrcweir |*
1174*cdf0e10cSrcweir \************************************************************************/
1175*cdf0e10cSrcweir 
1176*cdf0e10cSrcweir long OutlineViewShell::VirtVScrollHdl(ScrollBar* pVScroll)
1177*cdf0e10cSrcweir {
1178*cdf0e10cSrcweir 	long nThumb = pVScroll->GetThumbPos();
1179*cdf0e10cSrcweir 	long nRange = pVScroll->GetRange().Len();
1180*cdf0e10cSrcweir 	double fY = (double) nThumb / nRange;
1181*cdf0e10cSrcweir 
1182*cdf0e10cSrcweir     Window* 	  pWin			= mpContentWindow.get();
1183*cdf0e10cSrcweir     OutlinerView* pOutlinerView = pOlView->GetViewByWindow(pWin);
1184*cdf0e10cSrcweir     long		  nViewHeight	= pWin->PixelToLogic(
1185*cdf0e10cSrcweir         pWin->GetSizePixel()).Height();
1186*cdf0e10cSrcweir     long		  nTextHeight	= pOlView->GetOutliner()->GetTextHeight();
1187*cdf0e10cSrcweir     nViewHeight 			   += nTextHeight;
1188*cdf0e10cSrcweir     long		  nCurrentPos	= pOutlinerView->GetVisArea().Top();
1189*cdf0e10cSrcweir     long		  nTargetPos	= (long)(fY * nViewHeight);
1190*cdf0e10cSrcweir     long		  nDelta		= nTargetPos - nCurrentPos;
1191*cdf0e10cSrcweir 
1192*cdf0e10cSrcweir     pOutlinerView->HideCursor();
1193*cdf0e10cSrcweir     pOutlinerView->Scroll(0, -nDelta);
1194*cdf0e10cSrcweir     pOutlinerView->ShowCursor(sal_False);
1195*cdf0e10cSrcweir 
1196*cdf0e10cSrcweir     pOlView->InvalidateSlideNumberArea();
1197*cdf0e10cSrcweir 
1198*cdf0e10cSrcweir 	return 0;
1199*cdf0e10cSrcweir }
1200*cdf0e10cSrcweir 
1201*cdf0e10cSrcweir /*************************************************************************
1202*cdf0e10cSrcweir |*
1203*cdf0e10cSrcweir |* PrepareClose, wird gerufen, wenn die Shell zestoert werden soll,
1204*cdf0e10cSrcweir |* leitet den Aufruf an die View weiter
1205*cdf0e10cSrcweir |*
1206*cdf0e10cSrcweir \************************************************************************/
1207*cdf0e10cSrcweir 
1208*cdf0e10cSrcweir sal_uInt16 OutlineViewShell::PrepareClose( sal_Bool bUI, sal_Bool bForBrowsing )
1209*cdf0e10cSrcweir {
1210*cdf0e10cSrcweir 	if( ViewShell::PrepareClose(bUI, bForBrowsing) != sal_True )
1211*cdf0e10cSrcweir 		return sal_False;
1212*cdf0e10cSrcweir 
1213*cdf0e10cSrcweir 	return pOlView == NULL || pOlView->PrepareClose(bUI);
1214*cdf0e10cSrcweir }
1215*cdf0e10cSrcweir 
1216*cdf0e10cSrcweir 
1217*cdf0e10cSrcweir /*************************************************************************
1218*cdf0e10cSrcweir |*
1219*cdf0e10cSrcweir |* Zoomen mit Zoomfaktor, OutlinerView informieren
1220*cdf0e10cSrcweir |*
1221*cdf0e10cSrcweir \************************************************************************/
1222*cdf0e10cSrcweir 
1223*cdf0e10cSrcweir void OutlineViewShell::SetZoom(long nZoom)
1224*cdf0e10cSrcweir {
1225*cdf0e10cSrcweir 	ViewShell::SetZoom(nZoom);
1226*cdf0e10cSrcweir 
1227*cdf0e10cSrcweir     ::sd::Window* pWindow = mpContentWindow.get();
1228*cdf0e10cSrcweir     if (pWindow)
1229*cdf0e10cSrcweir     {
1230*cdf0e10cSrcweir         // OutputArea der OutlinerView aendern
1231*cdf0e10cSrcweir         OutlinerView* pOutlinerView = pOlView->GetViewByWindow(pWindow);
1232*cdf0e10cSrcweir         Rectangle aWin(Point(0,0), pWindow->GetOutputSizePixel());
1233*cdf0e10cSrcweir         aWin = pWindow->PixelToLogic(aWin);
1234*cdf0e10cSrcweir         pOutlinerView->SetOutputArea(aWin);
1235*cdf0e10cSrcweir     }
1236*cdf0e10cSrcweir 
1237*cdf0e10cSrcweir 	// #106268#
1238*cdf0e10cSrcweir 	GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM );
1239*cdf0e10cSrcweir 	GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER );
1240*cdf0e10cSrcweir }
1241*cdf0e10cSrcweir 
1242*cdf0e10cSrcweir /*************************************************************************
1243*cdf0e10cSrcweir |*
1244*cdf0e10cSrcweir |* Zoomen mit Zoomrechteck, OutlinerView informieren
1245*cdf0e10cSrcweir |*
1246*cdf0e10cSrcweir \************************************************************************/
1247*cdf0e10cSrcweir 
1248*cdf0e10cSrcweir void OutlineViewShell::SetZoomRect(const Rectangle& rZoomRect)
1249*cdf0e10cSrcweir {
1250*cdf0e10cSrcweir 	ViewShell::SetZoomRect(rZoomRect);
1251*cdf0e10cSrcweir 
1252*cdf0e10cSrcweir     ::sd::Window* pWindow = mpContentWindow.get();
1253*cdf0e10cSrcweir     if (pWindow)
1254*cdf0e10cSrcweir     {
1255*cdf0e10cSrcweir         // OutputArea der OutlinerView aendern
1256*cdf0e10cSrcweir         OutlinerView* pOutlinerView = pOlView->GetViewByWindow(pWindow);
1257*cdf0e10cSrcweir         Rectangle aWin(Point(0,0), pWindow->GetOutputSizePixel());
1258*cdf0e10cSrcweir         aWin = pWindow->PixelToLogic(aWin);
1259*cdf0e10cSrcweir         pOutlinerView->SetOutputArea(aWin);
1260*cdf0e10cSrcweir     }
1261*cdf0e10cSrcweir 
1262*cdf0e10cSrcweir 	// #106268#
1263*cdf0e10cSrcweir 	GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM );
1264*cdf0e10cSrcweir 	GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER );
1265*cdf0e10cSrcweir }
1266*cdf0e10cSrcweir 
1267*cdf0e10cSrcweir /*************************************************************************
1268*cdf0e10cSrcweir |*
1269*cdf0e10cSrcweir |* Vorm Speichern das Model der Drawing Engine aktualisieren, dann den
1270*cdf0e10cSrcweir |* Call weiterleiten an die ObjectShell.
1271*cdf0e10cSrcweir |*
1272*cdf0e10cSrcweir \************************************************************************/
1273*cdf0e10cSrcweir 
1274*cdf0e10cSrcweir void OutlineViewShell::Execute(SfxRequest& rReq)
1275*cdf0e10cSrcweir {
1276*cdf0e10cSrcweir     bool bForwardCall = true;
1277*cdf0e10cSrcweir 
1278*cdf0e10cSrcweir 	switch(rReq.GetSlot())
1279*cdf0e10cSrcweir 	{
1280*cdf0e10cSrcweir 		case SID_SAVEDOC:
1281*cdf0e10cSrcweir 		case SID_SAVEASDOC:
1282*cdf0e10cSrcweir 			PrepareClose();
1283*cdf0e10cSrcweir             break;
1284*cdf0e10cSrcweir 
1285*cdf0e10cSrcweir 		case SID_SEARCH_ITEM:
1286*cdf0e10cSrcweir             // Forward this request to the the common (old) code of the
1287*cdf0e10cSrcweir             // document shell.
1288*cdf0e10cSrcweir             GetDocSh()->Execute (rReq);
1289*cdf0e10cSrcweir             bForwardCall = false;
1290*cdf0e10cSrcweir             break;
1291*cdf0e10cSrcweir 
1292*cdf0e10cSrcweir         case SID_SPELL_DIALOG:
1293*cdf0e10cSrcweir         {
1294*cdf0e10cSrcweir             SfxViewFrame* pViewFrame = GetViewFrame();
1295*cdf0e10cSrcweir             if (rReq.GetArgs() != NULL)
1296*cdf0e10cSrcweir                 pViewFrame->SetChildWindow (SID_SPELL_DIALOG,
1297*cdf0e10cSrcweir                     ((const SfxBoolItem&) (rReq.GetArgs()->
1298*cdf0e10cSrcweir                         Get(SID_SPELL_DIALOG))).GetValue());
1299*cdf0e10cSrcweir             else
1300*cdf0e10cSrcweir                 pViewFrame->ToggleChildWindow(SID_SPELL_DIALOG);
1301*cdf0e10cSrcweir 
1302*cdf0e10cSrcweir             pViewFrame->GetBindings().Invalidate(SID_SPELL_DIALOG);
1303*cdf0e10cSrcweir             rReq.Done ();
1304*cdf0e10cSrcweir 
1305*cdf0e10cSrcweir             bForwardCall = false;
1306*cdf0e10cSrcweir         }
1307*cdf0e10cSrcweir         break;
1308*cdf0e10cSrcweir 
1309*cdf0e10cSrcweir 		default:
1310*cdf0e10cSrcweir             OSL_TRACE ("OutlineViewShell::Execute(): can not handle slot %d", rReq.GetSlot());
1311*cdf0e10cSrcweir             break;
1312*cdf0e10cSrcweir 
1313*cdf0e10cSrcweir 	}
1314*cdf0e10cSrcweir 
1315*cdf0e10cSrcweir     if (bForwardCall)
1316*cdf0e10cSrcweir         ((DrawDocShell*)GetViewFrame()->GetObjectShell())->ExecuteSlot( rReq );
1317*cdf0e10cSrcweir }
1318*cdf0e10cSrcweir 
1319*cdf0e10cSrcweir /*************************************************************************
1320*cdf0e10cSrcweir |*
1321*cdf0e10cSrcweir |* Read FrameViews data and set actual views data
1322*cdf0e10cSrcweir |*
1323*cdf0e10cSrcweir \************************************************************************/
1324*cdf0e10cSrcweir 
1325*cdf0e10cSrcweir void OutlineViewShell::ReadFrameViewData(FrameView* pView)
1326*cdf0e10cSrcweir {
1327*cdf0e10cSrcweir 	::Outliner* pOutl = pOlView->GetOutliner();
1328*cdf0e10cSrcweir 
1329*cdf0e10cSrcweir 	if ( pView->IsNoAttribs() )
1330*cdf0e10cSrcweir 		pOutl->SetFlatMode( sal_True );   // Attribut-Darstellung ausschalten
1331*cdf0e10cSrcweir 	else
1332*cdf0e10cSrcweir 		pOutl->SetFlatMode( sal_False );  // Attribut-Darstellung einschalten
1333*cdf0e10cSrcweir 
1334*cdf0e10cSrcweir 	sal_uLong nCntrl = pOutl->GetControlWord();
1335*cdf0e10cSrcweir 
1336*cdf0e10cSrcweir 	if ( pView->IsNoColors() )
1337*cdf0e10cSrcweir 		pOutl->SetControlWord(nCntrl | EE_CNTRL_NOCOLORS);   // Farbansicht ausschalten
1338*cdf0e10cSrcweir 	else
1339*cdf0e10cSrcweir 		pOutl->SetControlWord(nCntrl & ~EE_CNTRL_NOCOLORS);  // Farbansicht einschalten
1340*cdf0e10cSrcweir 
1341*cdf0e10cSrcweir 	sal_uInt16 nPage = mpFrameView->GetSelectedPage();
1342*cdf0e10cSrcweir 	pLastPage = GetDoc()->GetSdPage( nPage, PK_STANDARD );
1343*cdf0e10cSrcweir     pOlView->SetActualPage(pLastPage);
1344*cdf0e10cSrcweir }
1345*cdf0e10cSrcweir 
1346*cdf0e10cSrcweir 
1347*cdf0e10cSrcweir 
1348*cdf0e10cSrcweir /*************************************************************************
1349*cdf0e10cSrcweir |*
1350*cdf0e10cSrcweir |* Write actual views data to FrameView
1351*cdf0e10cSrcweir |*
1352*cdf0e10cSrcweir \************************************************************************/
1353*cdf0e10cSrcweir 
1354*cdf0e10cSrcweir void OutlineViewShell::WriteFrameViewData()
1355*cdf0e10cSrcweir {
1356*cdf0e10cSrcweir 	::Outliner* pOutl = pOlView->GetOutliner();
1357*cdf0e10cSrcweir 
1358*cdf0e10cSrcweir 	sal_uLong nCntrl = pOutl->GetControlWord();
1359*cdf0e10cSrcweir 	sal_Bool bNoColor = sal_False;
1360*cdf0e10cSrcweir 	if (nCntrl & EE_CNTRL_NOCOLORS)
1361*cdf0e10cSrcweir 		bNoColor = sal_True;
1362*cdf0e10cSrcweir 	mpFrameView->SetNoColors(bNoColor);
1363*cdf0e10cSrcweir 	mpFrameView->SetNoAttribs( pOutl->IsFlatMode() );
1364*cdf0e10cSrcweir 	SdPage* pActualPage = pOlView->GetActualPage();
1365*cdf0e10cSrcweir     DBG_ASSERT(pActualPage, "No current page");
1366*cdf0e10cSrcweir 	if( pActualPage )
1367*cdf0e10cSrcweir         mpFrameView->SetSelectedPage((pActualPage->GetPageNum() - 1) / 2);
1368*cdf0e10cSrcweir }
1369*cdf0e10cSrcweir 
1370*cdf0e10cSrcweir 
1371*cdf0e10cSrcweir /*************************************************************************
1372*cdf0e10cSrcweir |*
1373*cdf0e10cSrcweir |* SfxRequests fuer StatusBar bearbeiten
1374*cdf0e10cSrcweir |*
1375*cdf0e10cSrcweir \************************************************************************/
1376*cdf0e10cSrcweir 
1377*cdf0e10cSrcweir void OutlineViewShell::ExecStatusBar(SfxRequest&)
1378*cdf0e10cSrcweir {
1379*cdf0e10cSrcweir }
1380*cdf0e10cSrcweir 
1381*cdf0e10cSrcweir /*************************************************************************
1382*cdf0e10cSrcweir |*
1383*cdf0e10cSrcweir |* Statuswerte der Statusbar zurueckgeben
1384*cdf0e10cSrcweir |*
1385*cdf0e10cSrcweir \************************************************************************/
1386*cdf0e10cSrcweir 
1387*cdf0e10cSrcweir void OutlineViewShell::GetStatusBarState(SfxItemSet& rSet)
1388*cdf0e10cSrcweir {
1389*cdf0e10cSrcweir 	// Zoom-Item
1390*cdf0e10cSrcweir 	if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ATTR_ZOOM ) )
1391*cdf0e10cSrcweir 	{
1392*cdf0e10cSrcweir 		SvxZoomItem* pZoomItem;
1393*cdf0e10cSrcweir 		sal_uInt16 nZoom = (sal_uInt16) GetActiveWindow()->GetZoom();
1394*cdf0e10cSrcweir 
1395*cdf0e10cSrcweir 		pZoomItem = new SvxZoomItem( SVX_ZOOM_PERCENT, nZoom );
1396*cdf0e10cSrcweir 
1397*cdf0e10cSrcweir 		// Bereich einschraenken
1398*cdf0e10cSrcweir 		sal_uInt16 nZoomValues = SVX_ZOOM_ENABLE_ALL;
1399*cdf0e10cSrcweir 		nZoomValues &= ~SVX_ZOOM_ENABLE_OPTIMAL;
1400*cdf0e10cSrcweir 		nZoomValues &= ~SVX_ZOOM_ENABLE_WHOLEPAGE;
1401*cdf0e10cSrcweir 		nZoomValues &= ~SVX_ZOOM_ENABLE_PAGEWIDTH;
1402*cdf0e10cSrcweir 
1403*cdf0e10cSrcweir 		pZoomItem->SetValueSet( nZoomValues );
1404*cdf0e10cSrcweir 		rSet.Put( *pZoomItem );
1405*cdf0e10cSrcweir 		delete pZoomItem;
1406*cdf0e10cSrcweir 	}
1407*cdf0e10cSrcweir 
1408*cdf0e10cSrcweir 	if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_ATTR_ZOOMSLIDER ) )
1409*cdf0e10cSrcweir 	{
1410*cdf0e10cSrcweir 		if (GetDocSh()->IsUIActive() || !GetActiveWindow() )
1411*cdf0e10cSrcweir 		{
1412*cdf0e10cSrcweir 			rSet.DisableItem( SID_ATTR_ZOOMSLIDER );
1413*cdf0e10cSrcweir 		}
1414*cdf0e10cSrcweir 		else
1415*cdf0e10cSrcweir 		{
1416*cdf0e10cSrcweir 			sd::Window * pActiveWindow = GetActiveWindow();
1417*cdf0e10cSrcweir 			SvxZoomSliderItem aZoomItem( (sal_uInt16) pActiveWindow->GetZoom(), (sal_uInt16)pActiveWindow->GetMinZoom(), (sal_uInt16)pActiveWindow->GetMaxZoom() ) ;
1418*cdf0e10cSrcweir 			aZoomItem.AddSnappingPoint(100);
1419*cdf0e10cSrcweir 			rSet.Put( aZoomItem );
1420*cdf0e10cSrcweir 		}
1421*cdf0e10cSrcweir 	}
1422*cdf0e10cSrcweir 
1423*cdf0e10cSrcweir 
1424*cdf0e10cSrcweir 	// Seitenanzeige und Layout
1425*cdf0e10cSrcweir 	/*
1426*cdf0e10cSrcweir 	if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_STATUS_PAGE ) ||
1427*cdf0e10cSrcweir 		SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_STATUS_LAYOUT ) )
1428*cdf0e10cSrcweir 	*/
1429*cdf0e10cSrcweir 	sal_uInt16	nPageCount = GetDoc()->GetSdPageCount( PK_STANDARD );
1430*cdf0e10cSrcweir 	String	aPageStr, aLayoutStr;
1431*cdf0e10cSrcweir 
1432*cdf0e10cSrcweir 	::sd::Window*		pWin		= GetActiveWindow();
1433*cdf0e10cSrcweir 	OutlinerView*	pActiveView = pOlView->GetViewByWindow( pWin );
1434*cdf0e10cSrcweir 	::Outliner*     pOutliner   = pOlView->GetOutliner();
1435*cdf0e10cSrcweir 	List*			pSelList	= (List*)pActiveView->CreateSelectionList();
1436*cdf0e10cSrcweir 	Paragraph*		pFirstPara	= (Paragraph*)pSelList->First();
1437*cdf0e10cSrcweir 	Paragraph*		pLastPara	= (Paragraph*)pSelList->Last();
1438*cdf0e10cSrcweir 
1439*cdf0e10cSrcweir 	if( !pOutliner->HasParaFlag(pFirstPara,PARAFLAG_ISPAGE) )
1440*cdf0e10cSrcweir 		pFirstPara = pOlView->GetPrevTitle( pFirstPara );
1441*cdf0e10cSrcweir 
1442*cdf0e10cSrcweir 	if( !pOutliner->HasParaFlag(pLastPara, PARAFLAG_ISPAGE) )
1443*cdf0e10cSrcweir 		pLastPara = pOlView->GetPrevTitle( pLastPara );
1444*cdf0e10cSrcweir 
1445*cdf0e10cSrcweir 	delete pSelList;				// die wurde extra fuer uns erzeugt
1446*cdf0e10cSrcweir 
1447*cdf0e10cSrcweir 	// nur eine Seite selektiert?
1448*cdf0e10cSrcweir 	if( pFirstPara == pLastPara )
1449*cdf0e10cSrcweir 	{
1450*cdf0e10cSrcweir 		// wieviele Seiten sind vor der selektierten Seite?
1451*cdf0e10cSrcweir 		sal_uLong nPos = 0L;
1452*cdf0e10cSrcweir 		while( pFirstPara )
1453*cdf0e10cSrcweir 		{
1454*cdf0e10cSrcweir 			pFirstPara = pOlView->GetPrevTitle( pFirstPara );
1455*cdf0e10cSrcweir 			if( pFirstPara )
1456*cdf0e10cSrcweir 				nPos++;
1457*cdf0e10cSrcweir 		}
1458*cdf0e10cSrcweir 
1459*cdf0e10cSrcweir 		if( nPos >= GetDoc()->GetSdPageCount( PK_STANDARD ) )
1460*cdf0e10cSrcweir 			nPos = 0;
1461*cdf0e10cSrcweir 
1462*cdf0e10cSrcweir 		SdrPage* pPage = GetDoc()->GetSdPage( (sal_uInt16) nPos, PK_STANDARD );
1463*cdf0e10cSrcweir 
1464*cdf0e10cSrcweir 		aPageStr = String(SdResId( STR_SD_PAGE ));
1465*cdf0e10cSrcweir 		aPageStr += sal_Unicode(' ');
1466*cdf0e10cSrcweir 		aPageStr += String::CreateFromInt32( (sal_Int32)(nPos + 1) );	// sal_uLong -> sal_Int32
1467*cdf0e10cSrcweir 		aPageStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " / " ));
1468*cdf0e10cSrcweir 		aPageStr += String::CreateFromInt32( nPageCount );
1469*cdf0e10cSrcweir 
1470*cdf0e10cSrcweir 		aLayoutStr = pPage->GetLayoutName();
1471*cdf0e10cSrcweir 		aLayoutStr.Erase( aLayoutStr.SearchAscii( SD_LT_SEPARATOR ) );
1472*cdf0e10cSrcweir 	}
1473*cdf0e10cSrcweir 	rSet.Put( SfxStringItem( SID_STATUS_PAGE, aPageStr ) );
1474*cdf0e10cSrcweir 	rSet.Put( SfxStringItem( SID_STATUS_LAYOUT, aLayoutStr ) );
1475*cdf0e10cSrcweir }
1476*cdf0e10cSrcweir 
1477*cdf0e10cSrcweir /*************************************************************************
1478*cdf0e10cSrcweir |*
1479*cdf0e10cSrcweir |* Command event
1480*cdf0e10cSrcweir |*
1481*cdf0e10cSrcweir \************************************************************************/
1482*cdf0e10cSrcweir 
1483*cdf0e10cSrcweir void OutlineViewShell::Command( const CommandEvent& rCEvt, ::sd::Window* pWin )
1484*cdf0e10cSrcweir {
1485*cdf0e10cSrcweir 	if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
1486*cdf0e10cSrcweir 	{
1487*cdf0e10cSrcweir 		GetActiveWindow()->ReleaseMouse();
1488*cdf0e10cSrcweir 
1489*cdf0e10cSrcweir 		OutlinerView* pOLV = pOlView->GetViewByWindow(GetActiveWindow());
1490*cdf0e10cSrcweir 		Point aPos(rCEvt.GetMousePosPixel());
1491*cdf0e10cSrcweir 
1492*cdf0e10cSrcweir 		if (pOLV && pOLV->IsWrongSpelledWordAtPos(aPos))
1493*cdf0e10cSrcweir 		{
1494*cdf0e10cSrcweir 			// #91457# Popup for Online-Spelling now handled by DrawDocShell
1495*cdf0e10cSrcweir 			// Link aLink = LINK(GetDoc(), SdDrawDocument, OnlineSpellCallback);
1496*cdf0e10cSrcweir 			Link aLink = LINK(GetDocSh(), DrawDocShell, OnlineSpellCallback);
1497*cdf0e10cSrcweir 
1498*cdf0e10cSrcweir 			pOLV->ExecuteSpellPopup(aPos, &aLink);
1499*cdf0e10cSrcweir 		}
1500*cdf0e10cSrcweir 		else
1501*cdf0e10cSrcweir 		{
1502*cdf0e10cSrcweir 		   GetViewFrame()->GetDispatcher()->ExecutePopup(SdResId(RID_OUTLINE_POPUP));
1503*cdf0e10cSrcweir 		}
1504*cdf0e10cSrcweir 	}
1505*cdf0e10cSrcweir 	else
1506*cdf0e10cSrcweir 	{
1507*cdf0e10cSrcweir 		ViewShell::Command( rCEvt, pWin );
1508*cdf0e10cSrcweir 
1509*cdf0e10cSrcweir 		// ggfs. Preview den neuen Kontext mitteilen
1510*cdf0e10cSrcweir 		Invalidate( SID_PREVIEW_STATE );
1511*cdf0e10cSrcweir 
1512*cdf0e10cSrcweir 	}
1513*cdf0e10cSrcweir }
1514*cdf0e10cSrcweir 
1515*cdf0e10cSrcweir 
1516*cdf0e10cSrcweir /*************************************************************************
1517*cdf0e10cSrcweir |*
1518*cdf0e10cSrcweir |* Keyboard event
1519*cdf0e10cSrcweir |*
1520*cdf0e10cSrcweir \************************************************************************/
1521*cdf0e10cSrcweir 
1522*cdf0e10cSrcweir sal_Bool OutlineViewShell::KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin)
1523*cdf0e10cSrcweir {
1524*cdf0e10cSrcweir 	sal_Bool bReturn = sal_False;
1525*cdf0e10cSrcweir 	OutlineViewPageChangesGuard aGuard(pOlView);
1526*cdf0e10cSrcweir 
1527*cdf0e10cSrcweir 	if (pWin == NULL && HasCurrentFunction())
1528*cdf0e10cSrcweir 	{
1529*cdf0e10cSrcweir 		bReturn = GetCurrentFunction()->KeyInput(rKEvt);
1530*cdf0e10cSrcweir 	}
1531*cdf0e10cSrcweir 
1532*cdf0e10cSrcweir 	// nein, weiterleiten an Basisklasse
1533*cdf0e10cSrcweir 	else
1534*cdf0e10cSrcweir 	{
1535*cdf0e10cSrcweir 		bReturn = ViewShell::KeyInput(rKEvt, pWin);
1536*cdf0e10cSrcweir 	}
1537*cdf0e10cSrcweir 
1538*cdf0e10cSrcweir 	Invalidate(SID_STYLE_EDIT);
1539*cdf0e10cSrcweir 	Invalidate(SID_STYLE_NEW);
1540*cdf0e10cSrcweir 	Invalidate(SID_STYLE_DELETE);
1541*cdf0e10cSrcweir 	Invalidate(SID_STYLE_UPDATE_BY_EXAMPLE);
1542*cdf0e10cSrcweir 	Invalidate(SID_STYLE_NEW_BY_EXAMPLE);
1543*cdf0e10cSrcweir 	Invalidate(SID_STYLE_WATERCAN);
1544*cdf0e10cSrcweir 	Invalidate(SID_STYLE_FAMILY5);
1545*cdf0e10cSrcweir 
1546*cdf0e10cSrcweir 	// Pruefen und Unterscheiden von CursorBewegungs- oder Eingabe-Keys
1547*cdf0e10cSrcweir 	KeyCode aKeyGroup( rKEvt.GetKeyCode().GetGroup() );
1548*cdf0e10cSrcweir 	if( (aKeyGroup != KEYGROUP_CURSOR && aKeyGroup != KEYGROUP_FKEYS) ||
1549*cdf0e10cSrcweir 		(GetActualPage() != pLastPage) )
1550*cdf0e10cSrcweir 	{
1551*cdf0e10cSrcweir 		Invalidate( SID_PREVIEW_STATE );
1552*cdf0e10cSrcweir 	}
1553*cdf0e10cSrcweir 
1554*cdf0e10cSrcweir 	return(bReturn);
1555*cdf0e10cSrcweir }
1556*cdf0e10cSrcweir 
1557*cdf0e10cSrcweir 
1558*cdf0e10cSrcweir /*************************************************************************
1559*cdf0e10cSrcweir |*
1560*cdf0e10cSrcweir |* Optimale Groesse zurueckgeben
1561*cdf0e10cSrcweir |*
1562*cdf0e10cSrcweir \************************************************************************/
1563*cdf0e10cSrcweir 
1564*cdf0e10cSrcweir Size OutlineViewShell::GetOptimalSizePixel() const
1565*cdf0e10cSrcweir {
1566*cdf0e10cSrcweir 	Size aResult(200, 200);
1567*cdf0e10cSrcweir 	if (pOlView)
1568*cdf0e10cSrcweir 	{
1569*cdf0e10cSrcweir 		::Outliner* pOutliner = pOlView->GetOutliner();
1570*cdf0e10cSrcweir 		if (pOutliner)
1571*cdf0e10cSrcweir 		{
1572*cdf0e10cSrcweir 			Size aTemp = pOutliner->CalcTextSize();
1573*cdf0e10cSrcweir 			aTemp = GetActiveWindow()->LogicToPixel(aTemp);
1574*cdf0e10cSrcweir 			aResult.Width() = Max(aResult.Width(), aTemp.Width());
1575*cdf0e10cSrcweir 			aResult.Height() = Max(aResult.Height(), aTemp.Height());
1576*cdf0e10cSrcweir 			if (4 * aResult.Height() > 3 * aResult.Width())
1577*cdf0e10cSrcweir 			{
1578*cdf0e10cSrcweir 				aResult.Height() = 3 * aResult.Width() / 4;
1579*cdf0e10cSrcweir 			}
1580*cdf0e10cSrcweir 		}
1581*cdf0e10cSrcweir 	}
1582*cdf0e10cSrcweir 
1583*cdf0e10cSrcweir 	// und jetzt jetzt das Standardgelumpe draufaddieren
1584*cdf0e10cSrcweir 	aResult.Width()  += mpVerticalScrollBar->GetSizePixel().Width();
1585*cdf0e10cSrcweir 	aResult.Height() += mpHorizontalScrollBar->GetSizePixel().Height();
1586*cdf0e10cSrcweir 		//!!! +	System::GetMenuBarHeightPixel();  // statt Titlebar
1587*cdf0e10cSrcweir 	return aResult;
1588*cdf0e10cSrcweir }
1589*cdf0e10cSrcweir 
1590*cdf0e10cSrcweir 
1591*cdf0e10cSrcweir /*************************************************************************
1592*cdf0e10cSrcweir |*
1593*cdf0e10cSrcweir |* Text der Selektion zurueckgeben
1594*cdf0e10cSrcweir |*
1595*cdf0e10cSrcweir \************************************************************************/
1596*cdf0e10cSrcweir 
1597*cdf0e10cSrcweir String OutlineViewShell::GetSelectionText(sal_Bool bCompleteWords)
1598*cdf0e10cSrcweir {
1599*cdf0e10cSrcweir 	String aStrSelection;
1600*cdf0e10cSrcweir 	::Outliner* pOl = pOlView->GetOutliner();
1601*cdf0e10cSrcweir 	OutlinerView* pOutlinerView = pOlView->GetViewByWindow( GetActiveWindow() );
1602*cdf0e10cSrcweir 
1603*cdf0e10cSrcweir 	if (pOl && pOlView)
1604*cdf0e10cSrcweir 	{
1605*cdf0e10cSrcweir 		if (bCompleteWords)
1606*cdf0e10cSrcweir 		{
1607*cdf0e10cSrcweir 			ESelection aSel = pOutlinerView->GetSelection();
1608*cdf0e10cSrcweir 			String aStrCurrentDelimiters = pOl->GetWordDelimiters();
1609*cdf0e10cSrcweir 
1610*cdf0e10cSrcweir 			pOl->SetWordDelimiters( String( RTL_CONSTASCII_USTRINGPARAM( " .,;\"'" )));
1611*cdf0e10cSrcweir 			aStrSelection = pOl->GetWord( aSel.nEndPara, aSel.nEndPos );
1612*cdf0e10cSrcweir 			pOl->SetWordDelimiters( aStrCurrentDelimiters );
1613*cdf0e10cSrcweir 		}
1614*cdf0e10cSrcweir 		else
1615*cdf0e10cSrcweir 		{
1616*cdf0e10cSrcweir 			aStrSelection = pOutlinerView->GetSelected();
1617*cdf0e10cSrcweir 		}
1618*cdf0e10cSrcweir 	}
1619*cdf0e10cSrcweir 
1620*cdf0e10cSrcweir 	return (aStrSelection);
1621*cdf0e10cSrcweir }
1622*cdf0e10cSrcweir 
1623*cdf0e10cSrcweir 
1624*cdf0e10cSrcweir /*************************************************************************
1625*cdf0e10cSrcweir |*
1626*cdf0e10cSrcweir |* Ist etwas selektiert?
1627*cdf0e10cSrcweir |*
1628*cdf0e10cSrcweir \************************************************************************/
1629*cdf0e10cSrcweir 
1630*cdf0e10cSrcweir sal_Bool OutlineViewShell::HasSelection(sal_Bool bText) const
1631*cdf0e10cSrcweir {
1632*cdf0e10cSrcweir 	sal_Bool bReturn = sal_False;
1633*cdf0e10cSrcweir 
1634*cdf0e10cSrcweir 	if (bText)
1635*cdf0e10cSrcweir 	{
1636*cdf0e10cSrcweir 		OutlinerView* pOutlinerView = pOlView->GetViewByWindow( GetActiveWindow() );
1637*cdf0e10cSrcweir 
1638*cdf0e10cSrcweir 		if (pOutlinerView && pOutlinerView->GetSelected().Len() != 0)
1639*cdf0e10cSrcweir 		{
1640*cdf0e10cSrcweir 			bReturn = sal_True;
1641*cdf0e10cSrcweir 		}
1642*cdf0e10cSrcweir 	}
1643*cdf0e10cSrcweir 
1644*cdf0e10cSrcweir 	return bReturn;
1645*cdf0e10cSrcweir }
1646*cdf0e10cSrcweir 
1647*cdf0e10cSrcweir 
1648*cdf0e10cSrcweir /*************************************************************************
1649*cdf0e10cSrcweir |*
1650*cdf0e10cSrcweir |* Status der Attribut-Items
1651*cdf0e10cSrcweir |*
1652*cdf0e10cSrcweir \************************************************************************/
1653*cdf0e10cSrcweir 
1654*cdf0e10cSrcweir void OutlineViewShell::GetAttrState( SfxItemSet& rSet )
1655*cdf0e10cSrcweir {
1656*cdf0e10cSrcweir 	SfxWhichIter  aIter( rSet );
1657*cdf0e10cSrcweir 	sal_uInt16        nWhich = aIter.FirstWhich();
1658*cdf0e10cSrcweir 	SfxAllItemSet aAllSet( *rSet.GetPool() );
1659*cdf0e10cSrcweir 
1660*cdf0e10cSrcweir 	while ( nWhich )
1661*cdf0e10cSrcweir 	{
1662*cdf0e10cSrcweir 		sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich)
1663*cdf0e10cSrcweir 			? GetPool().GetSlotId(nWhich)
1664*cdf0e10cSrcweir 			: nWhich;
1665*cdf0e10cSrcweir 
1666*cdf0e10cSrcweir 		switch ( nSlotId )
1667*cdf0e10cSrcweir 		{
1668*cdf0e10cSrcweir 			case SID_STYLE_FAMILY2:
1669*cdf0e10cSrcweir 			case SID_STYLE_FAMILY3:
1670*cdf0e10cSrcweir 			{
1671*cdf0e10cSrcweir 				rSet.DisableItem( nWhich );
1672*cdf0e10cSrcweir 			}
1673*cdf0e10cSrcweir 			break;
1674*cdf0e10cSrcweir 
1675*cdf0e10cSrcweir 			case SID_STYLE_FAMILY5:
1676*cdf0e10cSrcweir 			{
1677*cdf0e10cSrcweir 				SfxStyleSheet* pStyleSheet = pOlView->GetViewByWindow(GetActiveWindow())->GetStyleSheet();
1678*cdf0e10cSrcweir 
1679*cdf0e10cSrcweir 				if( pStyleSheet )
1680*cdf0e10cSrcweir 				{
1681*cdf0e10cSrcweir 					pStyleSheet = ((SdStyleSheet*)pStyleSheet)->GetPseudoStyleSheet();
1682*cdf0e10cSrcweir 
1683*cdf0e10cSrcweir 					if (pStyleSheet)
1684*cdf0e10cSrcweir 					{
1685*cdf0e10cSrcweir 						SfxTemplateItem aItem( nWhich, pStyleSheet->GetName() );
1686*cdf0e10cSrcweir 						aAllSet.Put( aItem, aItem.Which()  );
1687*cdf0e10cSrcweir 					}
1688*cdf0e10cSrcweir 				}
1689*cdf0e10cSrcweir 
1690*cdf0e10cSrcweir 				if( !pStyleSheet )
1691*cdf0e10cSrcweir 				{
1692*cdf0e10cSrcweir 					SfxTemplateItem aItem( nWhich, String() );
1693*cdf0e10cSrcweir 					aAllSet.Put( aItem, aItem.Which() );
1694*cdf0e10cSrcweir 					// rSet.DisableItem( nWhich );
1695*cdf0e10cSrcweir 				}
1696*cdf0e10cSrcweir 			}
1697*cdf0e10cSrcweir 			break;
1698*cdf0e10cSrcweir 
1699*cdf0e10cSrcweir 			case SID_STYLE_EDIT:
1700*cdf0e10cSrcweir 			{
1701*cdf0e10cSrcweir 				ISfxTemplateCommon* pTmplCommon = SFX_APP()->GetCurrentTemplateCommon(GetViewFrame()->GetBindings());
1702*cdf0e10cSrcweir 
1703*cdf0e10cSrcweir 				if (pTmplCommon && pTmplCommon->GetActualFamily() == SD_STYLE_FAMILY_PSEUDO)
1704*cdf0e10cSrcweir 				{
1705*cdf0e10cSrcweir 					SfxItemSet aSet(*rSet.GetPool(), SID_STATUS_LAYOUT, SID_STATUS_LAYOUT);
1706*cdf0e10cSrcweir 					GetStatusBarState(aSet);
1707*cdf0e10cSrcweir 					String aRealStyle(((SfxStringItem&) aSet.Get(SID_STATUS_LAYOUT)).GetValue());
1708*cdf0e10cSrcweir 
1709*cdf0e10cSrcweir 					if (!aRealStyle.Len())
1710*cdf0e10cSrcweir 					{
1711*cdf0e10cSrcweir 						// Kein eindeutiger Layoutname gefunden
1712*cdf0e10cSrcweir 						rSet.DisableItem(nWhich);
1713*cdf0e10cSrcweir 					}
1714*cdf0e10cSrcweir 				}
1715*cdf0e10cSrcweir 			}
1716*cdf0e10cSrcweir 			break;
1717*cdf0e10cSrcweir 
1718*cdf0e10cSrcweir 			case SID_STYLE_UPDATE_BY_EXAMPLE:
1719*cdf0e10cSrcweir 			{
1720*cdf0e10cSrcweir 				::sd::Window*     pActWin = GetActiveWindow();
1721*cdf0e10cSrcweir 				OutlinerView* pOV = pOlView->GetViewByWindow(pActWin);
1722*cdf0e10cSrcweir 				ESelection aESel(pOV->GetSelection());
1723*cdf0e10cSrcweir 
1724*cdf0e10cSrcweir 				if (aESel.nStartPara != aESel.nEndPara ||
1725*cdf0e10cSrcweir 					aESel.nStartPos  != aESel.nEndPos)
1726*cdf0e10cSrcweir 					// aufgespannte Selektion, also StyleSheet und/oder
1727*cdf0e10cSrcweir 					// Attributierung nicht zwingend eindeutig
1728*cdf0e10cSrcweir 					rSet.DisableItem(nWhich);
1729*cdf0e10cSrcweir 			}
1730*cdf0e10cSrcweir 			break;
1731*cdf0e10cSrcweir 
1732*cdf0e10cSrcweir 			case SID_STYLE_NEW:
1733*cdf0e10cSrcweir 			case SID_STYLE_DELETE:
1734*cdf0e10cSrcweir 			case SID_STYLE_NEW_BY_EXAMPLE:
1735*cdf0e10cSrcweir 			case SID_STYLE_WATERCAN:
1736*cdf0e10cSrcweir 			{
1737*cdf0e10cSrcweir 				rSet.DisableItem(nWhich);
1738*cdf0e10cSrcweir 			}
1739*cdf0e10cSrcweir 			break;
1740*cdf0e10cSrcweir 		}
1741*cdf0e10cSrcweir 
1742*cdf0e10cSrcweir 		nWhich = aIter.NextWhich();
1743*cdf0e10cSrcweir 	}
1744*cdf0e10cSrcweir 
1745*cdf0e10cSrcweir 	rSet.Put( aAllSet, sal_False );
1746*cdf0e10cSrcweir }
1747*cdf0e10cSrcweir 
1748*cdf0e10cSrcweir 
1749*cdf0e10cSrcweir 
1750*cdf0e10cSrcweir /*************************************************************************
1751*cdf0e10cSrcweir |*
1752*cdf0e10cSrcweir |* MouseButtonUp event
1753*cdf0e10cSrcweir |*
1754*cdf0e10cSrcweir \************************************************************************/
1755*cdf0e10cSrcweir 
1756*cdf0e10cSrcweir void OutlineViewShell::MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin)
1757*cdf0e10cSrcweir {
1758*cdf0e10cSrcweir 	// Zuerst die Basisklasse
1759*cdf0e10cSrcweir 	ViewShell::MouseButtonUp(rMEvt, pWin);
1760*cdf0e10cSrcweir 
1761*cdf0e10cSrcweir 	Invalidate(SID_STYLE_EDIT);
1762*cdf0e10cSrcweir 	Invalidate(SID_STYLE_NEW);
1763*cdf0e10cSrcweir 	Invalidate(SID_STYLE_DELETE);
1764*cdf0e10cSrcweir 	Invalidate(SID_STYLE_UPDATE_BY_EXAMPLE);
1765*cdf0e10cSrcweir 	Invalidate(SID_STYLE_NEW_BY_EXAMPLE);
1766*cdf0e10cSrcweir 	Invalidate(SID_STYLE_WATERCAN);
1767*cdf0e10cSrcweir 	Invalidate(SID_STYLE_FAMILY5);
1768*cdf0e10cSrcweir 
1769*cdf0e10cSrcweir 	// ggfs. Preview den neuen Kontext mitteilen
1770*cdf0e10cSrcweir 	if( GetActualPage() != pLastPage )
1771*cdf0e10cSrcweir 		Invalidate( SID_PREVIEW_STATE );
1772*cdf0e10cSrcweir }
1773*cdf0e10cSrcweir 
1774*cdf0e10cSrcweir 
1775*cdf0e10cSrcweir 
1776*cdf0e10cSrcweir SdPage* OutlineViewShell::getCurrentPage() const
1777*cdf0e10cSrcweir {
1778*cdf0e10cSrcweir 	// since there are no master pages in outline view, we can
1779*cdf0e10cSrcweir 	// for now use the GetActualPage method
1780*cdf0e10cSrcweir 	return const_cast<OutlineViewShell*>(this)->GetActualPage();
1781*cdf0e10cSrcweir }
1782*cdf0e10cSrcweir 
1783*cdf0e10cSrcweir /*************************************************************************
1784*cdf0e10cSrcweir |*
1785*cdf0e10cSrcweir |* Liefert die erste selektierte Seite zurueck.
1786*cdf0e10cSrcweir |* Wenn nichts selektiert ist, wird die erste Seite zurueckgeliefert.
1787*cdf0e10cSrcweir |*
1788*cdf0e10cSrcweir \************************************************************************/
1789*cdf0e10cSrcweir SdPage* OutlineViewShell::GetActualPage()
1790*cdf0e10cSrcweir {
1791*cdf0e10cSrcweir 	return pOlView->GetActualPage();
1792*cdf0e10cSrcweir }
1793*cdf0e10cSrcweir 
1794*cdf0e10cSrcweir 
1795*cdf0e10cSrcweir void OutlineViewShell::UpdatePreview( SdPage* pPage, sal_Bool )
1796*cdf0e10cSrcweir {
1797*cdf0e10cSrcweir 	const bool bNewPage = pPage != pLastPage;
1798*cdf0e10cSrcweir 	pLastPage = pPage;
1799*cdf0e10cSrcweir 	if (bNewPage)
1800*cdf0e10cSrcweir 	{
1801*cdf0e10cSrcweir 		OutlineViewPageChangesGuard aGuard(pOlView);
1802*cdf0e10cSrcweir         SetCurrentPage(pPage);
1803*cdf0e10cSrcweir     }
1804*cdf0e10cSrcweir }
1805*cdf0e10cSrcweir 
1806*cdf0e10cSrcweir /*************************************************************************
1807*cdf0e10cSrcweir |*
1808*cdf0e10cSrcweir |* Update Title
1809*cdf0e10cSrcweir |*
1810*cdf0e10cSrcweir \************************************************************************/
1811*cdf0e10cSrcweir 
1812*cdf0e10cSrcweir bool OutlineViewShell::UpdateTitleObject( SdPage* pPage, Paragraph* pPara )
1813*cdf0e10cSrcweir {
1814*cdf0e10cSrcweir 	DBG_ASSERT( pPage, "sd::OutlineViewShell::UpdateTitleObject(), pPage == 0?" );
1815*cdf0e10cSrcweir 	DBG_ASSERT( pPara, "sd::OutlineViewShell::UpdateTitleObject(), pPara == 0?" );
1816*cdf0e10cSrcweir 
1817*cdf0e10cSrcweir 	if( !pPage || !pPara )
1818*cdf0e10cSrcweir 		return false;
1819*cdf0e10cSrcweir 
1820*cdf0e10cSrcweir 	::Outliner* 			pOutliner = pOlView->GetOutliner();
1821*cdf0e10cSrcweir 	SdrTextObj* 		pTO  = pOlView->GetTitleTextObject( pPage );
1822*cdf0e10cSrcweir 	OutlinerParaObject* pOPO = NULL;
1823*cdf0e10cSrcweir 
1824*cdf0e10cSrcweir 	String	aTest( pOutliner->GetText( pPara ) );
1825*cdf0e10cSrcweir 	bool 	bText = aTest.Len() > 0;
1826*cdf0e10cSrcweir 	bool 	bNewObject = false;
1827*cdf0e10cSrcweir 
1828*cdf0e10cSrcweir 	if( bText )
1829*cdf0e10cSrcweir 	{
1830*cdf0e10cSrcweir 		// create a title object if we don't have one but have text
1831*cdf0e10cSrcweir 		if( !pTO )
1832*cdf0e10cSrcweir 		{
1833*cdf0e10cSrcweir 			DBG_ASSERT( pOlView->isRecordingUndo(), "sd::OutlineViewShell::UpdateTitleObject(), no undo for model change!?" );
1834*cdf0e10cSrcweir 			pTO = pOlView->CreateTitleTextObject(pPage);
1835*cdf0e10cSrcweir 			bNewObject = sal_True;
1836*cdf0e10cSrcweir 		}
1837*cdf0e10cSrcweir 
1838*cdf0e10cSrcweir 		// if we have a title object and a text, set the text
1839*cdf0e10cSrcweir 		if( pTO )
1840*cdf0e10cSrcweir 		{
1841*cdf0e10cSrcweir 			pOPO = pOutliner->CreateParaObject( (sal_uInt16) pOutliner->GetAbsPos( pPara ), 1 );
1842*cdf0e10cSrcweir 			pOPO->SetOutlinerMode( OUTLINERMODE_TITLEOBJECT );
1843*cdf0e10cSrcweir 			pOPO->SetVertical( pTO->IsVerticalWriting() );
1844*cdf0e10cSrcweir 			if( pTO->GetOutlinerParaObject() && (pOPO->GetTextObject() == pTO->GetOutlinerParaObject()->GetTextObject()) )
1845*cdf0e10cSrcweir 			{
1846*cdf0e10cSrcweir 				// do nothing, same text already set
1847*cdf0e10cSrcweir 				delete pOPO;
1848*cdf0e10cSrcweir 			}
1849*cdf0e10cSrcweir 			else
1850*cdf0e10cSrcweir 			{
1851*cdf0e10cSrcweir 				DBG_ASSERT( pOlView->isRecordingUndo(), "sd::OutlineViewShell::UpdateTitleObject(), no undo for model change!?" );
1852*cdf0e10cSrcweir 				if( !bNewObject && pOlView->isRecordingUndo() )
1853*cdf0e10cSrcweir 					pOlView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoObjectSetText(*pTO,0));
1854*cdf0e10cSrcweir 
1855*cdf0e10cSrcweir 				pTO->SetOutlinerParaObject( pOPO );
1856*cdf0e10cSrcweir 				pTO->SetEmptyPresObj( sal_False );
1857*cdf0e10cSrcweir 				pTO->ActionChanged();
1858*cdf0e10cSrcweir 			}
1859*cdf0e10cSrcweir 		}
1860*cdf0e10cSrcweir 	}
1861*cdf0e10cSrcweir 	else if( pTO )
1862*cdf0e10cSrcweir 	{
1863*cdf0e10cSrcweir 		// no text but object available?
1864*cdf0e10cSrcweir 		// outline object available, but we have no text
1865*cdf0e10cSrcweir 		if(pPage->IsPresObj(pTO))
1866*cdf0e10cSrcweir 		{
1867*cdf0e10cSrcweir 			// if it is not already empty
1868*cdf0e10cSrcweir 			if( !pTO->IsEmptyPresObj() )
1869*cdf0e10cSrcweir 			{
1870*cdf0e10cSrcweir 				DBG_ASSERT( pOlView->isRecordingUndo(), "sd::OutlineViewShell::UpdateTitleObject(), no undo for model change!?" );
1871*cdf0e10cSrcweir 
1872*cdf0e10cSrcweir 				// make it empty
1873*cdf0e10cSrcweir 				if( pOlView->isRecordingUndo() )
1874*cdf0e10cSrcweir 					pOlView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoObjectSetText(*pTO,0));
1875*cdf0e10cSrcweir 				pPage->RestoreDefaultText( pTO );
1876*cdf0e10cSrcweir 				pTO->SetEmptyPresObj(sal_True);
1877*cdf0e10cSrcweir 				pTO->ActionChanged();
1878*cdf0e10cSrcweir 			}
1879*cdf0e10cSrcweir 		}
1880*cdf0e10cSrcweir 		else
1881*cdf0e10cSrcweir 		{
1882*cdf0e10cSrcweir 			DBG_ASSERT( pOlView->isRecordingUndo(), "sd::OutlineViewShell::UpdateTitleObject(), no undo for model change!?" );
1883*cdf0e10cSrcweir 			// outline object is not part of the layout, delete it
1884*cdf0e10cSrcweir 			if( pOlView->isRecordingUndo() )
1885*cdf0e10cSrcweir 				pOlView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoRemoveObject(*pTO));
1886*cdf0e10cSrcweir 			pPage->RemoveObject(pTO->GetOrdNum());
1887*cdf0e10cSrcweir 		}
1888*cdf0e10cSrcweir 	}
1889*cdf0e10cSrcweir 
1890*cdf0e10cSrcweir 	return bNewObject;
1891*cdf0e10cSrcweir }
1892*cdf0e10cSrcweir 
1893*cdf0e10cSrcweir /*************************************************************************
1894*cdf0e10cSrcweir |*
1895*cdf0e10cSrcweir |* Update LayoutObject
1896*cdf0e10cSrcweir |*
1897*cdf0e10cSrcweir \************************************************************************/
1898*cdf0e10cSrcweir 
1899*cdf0e10cSrcweir bool OutlineViewShell::UpdateOutlineObject( SdPage* pPage, Paragraph* pPara )
1900*cdf0e10cSrcweir {
1901*cdf0e10cSrcweir 	DBG_ASSERT( pPage, "sd::OutlineViewShell::UpdateOutlineObject(), pPage == 0?" );
1902*cdf0e10cSrcweir 	DBG_ASSERT( pPara, "sd::OutlineViewShell::UpdateOutlineObject(), pPara == 0?" );
1903*cdf0e10cSrcweir 
1904*cdf0e10cSrcweir 	if( !pPage || !pPara )
1905*cdf0e10cSrcweir 		return false;
1906*cdf0e10cSrcweir 
1907*cdf0e10cSrcweir 	::Outliner* 		pOutliner = pOlView->GetOutliner();
1908*cdf0e10cSrcweir 	OutlinerParaObject* pOPO = NULL;
1909*cdf0e10cSrcweir 	SdrTextObj* 		pTO  = NULL;
1910*cdf0e10cSrcweir 
1911*cdf0e10cSrcweir 	sal_Bool bNewObject = sal_False;
1912*cdf0e10cSrcweir 
1913*cdf0e10cSrcweir 	sal_uInt16 eOutlinerMode = OUTLINERMODE_TITLEOBJECT;
1914*cdf0e10cSrcweir 	pTO = (SdrTextObj*)pPage->GetPresObj( PRESOBJ_TEXT );
1915*cdf0e10cSrcweir 	if( !pTO )
1916*cdf0e10cSrcweir 	{
1917*cdf0e10cSrcweir 		eOutlinerMode = OUTLINERMODE_OUTLINEOBJECT;
1918*cdf0e10cSrcweir 		pTO = pOlView->GetOutlineTextObject( pPage );
1919*cdf0e10cSrcweir 	}
1920*cdf0e10cSrcweir 
1921*cdf0e10cSrcweir 	// wieviele Absaetze in der Gliederung?
1922*cdf0e10cSrcweir 	sal_uLong nTitlePara	 = pOutliner->GetAbsPos( pPara );
1923*cdf0e10cSrcweir 	sal_uLong nPara          = nTitlePara + 1;
1924*cdf0e10cSrcweir 	sal_uLong nParasInLayout = 0L;
1925*cdf0e10cSrcweir 	pPara = pOutliner->GetParagraph( nPara );
1926*cdf0e10cSrcweir 	while( pPara && !pOutliner->HasParaFlag(pPara, PARAFLAG_ISPAGE) )
1927*cdf0e10cSrcweir 	{
1928*cdf0e10cSrcweir 		nParasInLayout++;
1929*cdf0e10cSrcweir 		pPara = pOutliner->GetParagraph( ++nPara );
1930*cdf0e10cSrcweir 	}
1931*cdf0e10cSrcweir 	if( nParasInLayout )
1932*cdf0e10cSrcweir 	{
1933*cdf0e10cSrcweir 		// ein OutlinerParaObject erzeugen
1934*cdf0e10cSrcweir 		pPara = pOutliner->GetParagraph( nTitlePara + 1 );
1935*cdf0e10cSrcweir 		pOPO  = pOutliner->CreateParaObject( (sal_uInt16) nTitlePara + 1, (sal_uInt16) nParasInLayout );
1936*cdf0e10cSrcweir 	}
1937*cdf0e10cSrcweir 
1938*cdf0e10cSrcweir 	if( pOPO )
1939*cdf0e10cSrcweir 	{
1940*cdf0e10cSrcweir 		DBG_ASSERT( pOlView->isRecordingUndo(), "sd::OutlineViewShell::UpdateOutlineObject(), no undo for model change!?" );
1941*cdf0e10cSrcweir 
1942*cdf0e10cSrcweir 		// do we need an outline text object?
1943*cdf0e10cSrcweir 		if( !pTO )
1944*cdf0e10cSrcweir 		{
1945*cdf0e10cSrcweir 			pTO = pOlView->CreateOutlineTextObject( pPage );
1946*cdf0e10cSrcweir 			bNewObject = sal_True;
1947*cdf0e10cSrcweir 		}
1948*cdf0e10cSrcweir 
1949*cdf0e10cSrcweir 		// Seitenobjekt, Gliederungstext im Outliner:
1950*cdf0e10cSrcweir 		// Text uebernehmen
1951*cdf0e10cSrcweir 		if( pTO )
1952*cdf0e10cSrcweir 		{
1953*cdf0e10cSrcweir 			pOPO->SetVertical( pTO->IsVerticalWriting() );
1954*cdf0e10cSrcweir 			pOPO->SetOutlinerMode( eOutlinerMode );
1955*cdf0e10cSrcweir 			if( pTO->GetOutlinerParaObject() && (pOPO->GetTextObject() == pTO->GetOutlinerParaObject()->GetTextObject()) )
1956*cdf0e10cSrcweir 			{
1957*cdf0e10cSrcweir 				// do nothing, same text already set
1958*cdf0e10cSrcweir 				delete pOPO;
1959*cdf0e10cSrcweir 			}
1960*cdf0e10cSrcweir 			else
1961*cdf0e10cSrcweir 			{
1962*cdf0e10cSrcweir 				if( !bNewObject && pOlView->isRecordingUndo() )
1963*cdf0e10cSrcweir 					pOlView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoObjectSetText(*pTO,0));
1964*cdf0e10cSrcweir 
1965*cdf0e10cSrcweir 				pTO->SetOutlinerParaObject( pOPO );
1966*cdf0e10cSrcweir 				pTO->SetEmptyPresObj( sal_False );
1967*cdf0e10cSrcweir 				pTO->ActionChanged();
1968*cdf0e10cSrcweir 			}
1969*cdf0e10cSrcweir 		}
1970*cdf0e10cSrcweir 	}
1971*cdf0e10cSrcweir 	else if( pTO )
1972*cdf0e10cSrcweir 	{
1973*cdf0e10cSrcweir 		// Seitenobjekt, aber kein Gliederungstext:
1974*cdf0e10cSrcweir 		// wenn Objekt in Praesentationsliste der Seite ist -> Defaulttext,
1975*cdf0e10cSrcweir 		// sonst Objekt loeschen
1976*cdf0e10cSrcweir 		if( pPage->IsPresObj(pTO) )
1977*cdf0e10cSrcweir 		{
1978*cdf0e10cSrcweir 			if( !pTO->IsEmptyPresObj() )
1979*cdf0e10cSrcweir 			{
1980*cdf0e10cSrcweir 				DBG_ASSERT( pOlView->isRecordingUndo(), "sd::OutlineViewShell::UpdateOutlineObject(), no undo for model change!?" );
1981*cdf0e10cSrcweir 
1982*cdf0e10cSrcweir 				// loescht auch altes OutlinerParaObject
1983*cdf0e10cSrcweir 				if( pOlView->isRecordingUndo() )
1984*cdf0e10cSrcweir 					pOlView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoObjectSetText(*pTO,0));
1985*cdf0e10cSrcweir 				pPage->RestoreDefaultText( pTO );
1986*cdf0e10cSrcweir 				pTO->SetEmptyPresObj(sal_True);
1987*cdf0e10cSrcweir 				pTO->ActionChanged();
1988*cdf0e10cSrcweir 			}
1989*cdf0e10cSrcweir 		}
1990*cdf0e10cSrcweir 		else
1991*cdf0e10cSrcweir 		{
1992*cdf0e10cSrcweir 			DBG_ASSERT( pOlView->isRecordingUndo(), "sd::OutlineViewShell::UpdateOutlineObject(), no undo for model change!?" );
1993*cdf0e10cSrcweir 			if( pOlView->isRecordingUndo() )
1994*cdf0e10cSrcweir 				pOlView->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoRemoveObject(*pTO));
1995*cdf0e10cSrcweir 			pPage->RemoveObject(pTO->GetOrdNum());
1996*cdf0e10cSrcweir 		}
1997*cdf0e10cSrcweir 	}
1998*cdf0e10cSrcweir 
1999*cdf0e10cSrcweir 	return bNewObject;
2000*cdf0e10cSrcweir }
2001*cdf0e10cSrcweir 
2002*cdf0e10cSrcweir 
2003*cdf0e10cSrcweir /*************************************************************************
2004*cdf0e10cSrcweir |*
2005*cdf0e10cSrcweir |* Outliner aus Stream fuellen
2006*cdf0e10cSrcweir |*
2007*cdf0e10cSrcweir \************************************************************************/
2008*cdf0e10cSrcweir 
2009*cdf0e10cSrcweir sal_uLong OutlineViewShell::Read(SvStream& rInput, const String& rBaseURL, sal_uInt16 eFormat)
2010*cdf0e10cSrcweir {
2011*cdf0e10cSrcweir 	sal_uLong bRet = 0;
2012*cdf0e10cSrcweir 
2013*cdf0e10cSrcweir 	::Outliner* pOutl = pOlView->GetOutliner();
2014*cdf0e10cSrcweir 
2015*cdf0e10cSrcweir 	{
2016*cdf0e10cSrcweir 	OutlineViewPageChangesGuard aGuard( pOlView );
2017*cdf0e10cSrcweir 	OutlineViewModelChangeGuard aGuard2( *pOlView );
2018*cdf0e10cSrcweir 
2019*cdf0e10cSrcweir     bRet = pOutl->Read( rInput, rBaseURL, eFormat, GetDocSh()->GetHeaderAttributes() );
2020*cdf0e10cSrcweir 
2021*cdf0e10cSrcweir 	SdPage* pPage = GetDoc()->GetSdPage( GetDoc()->GetSdPageCount(PK_STANDARD) - 1, PK_STANDARD );;
2022*cdf0e10cSrcweir 	SfxStyleSheet* pTitleSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE );
2023*cdf0e10cSrcweir 	SfxStyleSheet* pOutlSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_OUTLINE );
2024*cdf0e10cSrcweir 
2025*cdf0e10cSrcweir 	sal_uInt16 nParaCount = (sal_uInt16)pOutl->GetParagraphCount();
2026*cdf0e10cSrcweir 	if ( nParaCount > 0 )
2027*cdf0e10cSrcweir 	{
2028*cdf0e10cSrcweir 		for ( sal_uInt16 nPara = 0; nPara < nParaCount; nPara++ )
2029*cdf0e10cSrcweir 		{
2030*cdf0e10cSrcweir 			pOlView->UpdateParagraph( nPara );
2031*cdf0e10cSrcweir 
2032*cdf0e10cSrcweir 			sal_Int16 nDepth = pOutl->GetDepth( nPara );
2033*cdf0e10cSrcweir 
2034*cdf0e10cSrcweir 			if( (nDepth == 0) || !nPara )
2035*cdf0e10cSrcweir 			{
2036*cdf0e10cSrcweir 				Paragraph* pPara = pOutl->GetParagraph( nPara );
2037*cdf0e10cSrcweir 				pOutl->SetDepth(pPara, -1);
2038*cdf0e10cSrcweir 				pOutl->SetParaFlag(pPara, PARAFLAG_ISPAGE);
2039*cdf0e10cSrcweir 
2040*cdf0e10cSrcweir 				pOutl->SetStyleSheet( nPara, pTitleSheet );
2041*cdf0e10cSrcweir 
2042*cdf0e10cSrcweir 				if( nPara ) // first slide already exists
2043*cdf0e10cSrcweir 					pOlView->InsertSlideForParagraph( pPara );
2044*cdf0e10cSrcweir 			}
2045*cdf0e10cSrcweir 			else
2046*cdf0e10cSrcweir 			{
2047*cdf0e10cSrcweir 				pOutl->SetDepth( pOutl->GetParagraph( nPara ), nDepth - 1 );
2048*cdf0e10cSrcweir 				String aStyleSheetName( pOutlSheet->GetName() );
2049*cdf0e10cSrcweir 				aStyleSheetName.Erase( aStyleSheetName.Len() - 1, 1 );
2050*cdf0e10cSrcweir 				aStyleSheetName += String::CreateFromInt32( nDepth );
2051*cdf0e10cSrcweir 				SfxStyleSheetBasePool* pStylePool = GetDoc()->GetStyleSheetPool();
2052*cdf0e10cSrcweir 				SfxStyleSheet* pStyle = (SfxStyleSheet*) pStylePool->Find( aStyleSheetName, pOutlSheet->GetFamily() );
2053*cdf0e10cSrcweir 				DBG_ASSERT( pStyle, "AutoStyleSheetName - Style not found!" );
2054*cdf0e10cSrcweir 				if ( pStyle )
2055*cdf0e10cSrcweir 					pOutl->SetStyleSheet( nPara, pStyle );
2056*cdf0e10cSrcweir 			}
2057*cdf0e10cSrcweir 		}
2058*cdf0e10cSrcweir 	}
2059*cdf0e10cSrcweir 	}
2060*cdf0e10cSrcweir 
2061*cdf0e10cSrcweir 	pOutl->GetUndoManager().Clear();
2062*cdf0e10cSrcweir 
2063*cdf0e10cSrcweir 	return( bRet );
2064*cdf0e10cSrcweir }
2065*cdf0e10cSrcweir 
2066*cdf0e10cSrcweir void OutlineViewShell::WriteUserDataSequence ( ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rSequence, sal_Bool bBrowse )
2067*cdf0e10cSrcweir {
2068*cdf0e10cSrcweir 	WriteFrameViewData();
2069*cdf0e10cSrcweir 
2070*cdf0e10cSrcweir 	ViewShell::WriteUserDataSequence( rSequence, bBrowse );
2071*cdf0e10cSrcweir }
2072*cdf0e10cSrcweir 
2073*cdf0e10cSrcweir void OutlineViewShell::ReadUserDataSequence ( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >& rSequence, sal_Bool bBrowse )
2074*cdf0e10cSrcweir {
2075*cdf0e10cSrcweir 	WriteFrameViewData();
2076*cdf0e10cSrcweir 
2077*cdf0e10cSrcweir 	ViewShell::ReadUserDataSequence( rSequence, bBrowse );
2078*cdf0e10cSrcweir 
2079*cdf0e10cSrcweir 	ReadFrameViewData( mpFrameView );
2080*cdf0e10cSrcweir }
2081*cdf0e10cSrcweir 
2082*cdf0e10cSrcweir void OutlineViewShell::VisAreaChanged(const Rectangle& rRect)
2083*cdf0e10cSrcweir {
2084*cdf0e10cSrcweir 	ViewShell::VisAreaChanged( rRect );
2085*cdf0e10cSrcweir 
2086*cdf0e10cSrcweir 	GetViewShellBase().GetDrawController().FireVisAreaChanged(rRect);
2087*cdf0e10cSrcweir }
2088*cdf0e10cSrcweir 
2089*cdf0e10cSrcweir /** If there is a valid controller then create a new instance of
2090*cdf0e10cSrcweir     <type>AccessibleDrawDocumentView</type>.  Otherwise delegate this call
2091*cdf0e10cSrcweir     to the base class to return a default object (probably an empty
2092*cdf0e10cSrcweir     reference).
2093*cdf0e10cSrcweir */
2094*cdf0e10cSrcweir ::com::sun::star::uno::Reference<
2095*cdf0e10cSrcweir     ::com::sun::star::accessibility::XAccessible>
2096*cdf0e10cSrcweir     OutlineViewShell::CreateAccessibleDocumentView (::sd::Window* pWindow)
2097*cdf0e10cSrcweir {
2098*cdf0e10cSrcweir     OSL_ASSERT (GetViewShell()!=NULL);
2099*cdf0e10cSrcweir     if (GetViewShell()->GetController() != NULL)
2100*cdf0e10cSrcweir     {
2101*cdf0e10cSrcweir         ::accessibility::AccessibleOutlineView* pDocumentView =
2102*cdf0e10cSrcweir             new ::accessibility::AccessibleOutlineView (
2103*cdf0e10cSrcweir                 pWindow,
2104*cdf0e10cSrcweir                 this,
2105*cdf0e10cSrcweir                 GetViewShell()->GetController(),
2106*cdf0e10cSrcweir                 pWindow->GetAccessibleParentWindow()->GetAccessible());
2107*cdf0e10cSrcweir         pDocumentView->Init();
2108*cdf0e10cSrcweir         return ::com::sun::star::uno::Reference<
2109*cdf0e10cSrcweir             ::com::sun::star::accessibility::XAccessible>
2110*cdf0e10cSrcweir             (static_cast< ::com::sun::star::uno::XWeak*>(pDocumentView),
2111*cdf0e10cSrcweir                 ::com::sun::star::uno::UNO_QUERY);
2112*cdf0e10cSrcweir     }
2113*cdf0e10cSrcweir     else
2114*cdf0e10cSrcweir     {
2115*cdf0e10cSrcweir         OSL_TRACE ("OutlineViewShell::CreateAccessibleDocumentView: no controller");
2116*cdf0e10cSrcweir         return ViewShell::CreateAccessibleDocumentView (pWindow);
2117*cdf0e10cSrcweir     }
2118*cdf0e10cSrcweir }
2119*cdf0e10cSrcweir 
2120*cdf0e10cSrcweir 
2121*cdf0e10cSrcweir 
2122*cdf0e10cSrcweir 
2123*cdf0e10cSrcweir void OutlineViewShell::GetState (SfxItemSet& rSet)
2124*cdf0e10cSrcweir {
2125*cdf0e10cSrcweir     // Iterate over all requested items in the set.
2126*cdf0e10cSrcweir 	SfxWhichIter aIter( rSet );
2127*cdf0e10cSrcweir 	sal_uInt16 nWhich = aIter.FirstWhich();
2128*cdf0e10cSrcweir 	while (nWhich)
2129*cdf0e10cSrcweir 	{
2130*cdf0e10cSrcweir 		switch (nWhich)
2131*cdf0e10cSrcweir 		{
2132*cdf0e10cSrcweir 			case SID_SEARCH_ITEM:
2133*cdf0e10cSrcweir 			case SID_SEARCH_OPTIONS:
2134*cdf0e10cSrcweir                 // Call common (old) implementation in the document shell.
2135*cdf0e10cSrcweir                 GetDocSh()->GetState (rSet);
2136*cdf0e10cSrcweir                 break;
2137*cdf0e10cSrcweir 			default:
2138*cdf0e10cSrcweir                 OSL_TRACE ("OutlineViewShell::GetState(): can not handle which id %d", nWhich);
2139*cdf0e10cSrcweir                 break;
2140*cdf0e10cSrcweir         }
2141*cdf0e10cSrcweir 		nWhich = aIter.NextWhich();
2142*cdf0e10cSrcweir 	}
2143*cdf0e10cSrcweir }
2144*cdf0e10cSrcweir 
2145*cdf0e10cSrcweir 
2146*cdf0e10cSrcweir 
2147*cdf0e10cSrcweir 
2148*cdf0e10cSrcweir void OutlineViewShell::SetCurrentPage (SdPage* pPage)
2149*cdf0e10cSrcweir {
2150*cdf0e10cSrcweir     // Adapt the selection of the model.
2151*cdf0e10cSrcweir     for (sal_uInt16 i=0; i<GetDoc()->GetSdPageCount(PK_STANDARD); i++)
2152*cdf0e10cSrcweir         GetDoc()->SetSelected(
2153*cdf0e10cSrcweir             GetDoc()->GetSdPage(i, PK_STANDARD),
2154*cdf0e10cSrcweir             sal_False);
2155*cdf0e10cSrcweir     GetDoc()->SetSelected (pPage, sal_True);
2156*cdf0e10cSrcweir 
2157*cdf0e10cSrcweir     DrawController& rController(GetViewShellBase().GetDrawController());
2158*cdf0e10cSrcweir     rController.FireSelectionChangeListener();
2159*cdf0e10cSrcweir     rController.FireSwitchCurrentPage (pPage);
2160*cdf0e10cSrcweir 
2161*cdf0e10cSrcweir     pOlView->SetActualPage(pPage);
2162*cdf0e10cSrcweir }
2163*cdf0e10cSrcweir 
2164*cdf0e10cSrcweir 
2165*cdf0e10cSrcweir } // end of namespace sd
2166