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