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