xref: /aoo42x/main/sd/source/ui/view/viewshel.cxx (revision 7a32b0c8)
15b190011SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
35b190011SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
45b190011SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
55b190011SAndrew Rist  * distributed with this work for additional information
65b190011SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
75b190011SAndrew Rist  * to you under the Apache License, Version 2.0 (the
85b190011SAndrew Rist  * "License"); you may not use this file except in compliance
95b190011SAndrew Rist  * with the License.  You may obtain a copy of the License at
105b190011SAndrew Rist  *
115b190011SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
125b190011SAndrew Rist  *
135b190011SAndrew Rist  * Unless required by applicable law or agreed to in writing,
145b190011SAndrew Rist  * software distributed under the License is distributed on an
155b190011SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
165b190011SAndrew Rist  * KIND, either express or implied.  See the License for the
175b190011SAndrew Rist  * specific language governing permissions and limitations
185b190011SAndrew Rist  * under the License.
195b190011SAndrew Rist  *
205b190011SAndrew Rist  *************************************************************/
215b190011SAndrew Rist 
225b190011SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sd.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "ViewShell.hxx"
28cdf0e10cSrcweir #include "ViewShellImplementation.hxx"
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #ifndef _COM_SUN_STAR_EMBED_EMBEDSTATE_HPP_
31cdf0e10cSrcweir #include <com/sun/star/embed/EmbedStates.hpp>
32cdf0e10cSrcweir #endif
33cdf0e10cSrcweir #include "ViewShellBase.hxx"
34cdf0e10cSrcweir #include "ShellFactory.hxx"
35cdf0e10cSrcweir #include "DrawController.hxx"
36cdf0e10cSrcweir #include "LayerTabBar.hxx"
37cdf0e10cSrcweir 
38cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
39cdf0e10cSrcweir #include <sfx2/bindings.hxx>
40cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
41cdf0e10cSrcweir #ifndef _SCRBAR_HXX //autogen
42cdf0e10cSrcweir #include <vcl/scrbar.hxx>
43cdf0e10cSrcweir #endif
44cdf0e10cSrcweir #include <svl/eitem.hxx>
45cdf0e10cSrcweir #include <svx/ruler.hxx>
46cdf0e10cSrcweir #ifndef _SVXIDS_HXX
47cdf0e10cSrcweir #include <svx/svxids.hrc>
48cdf0e10cSrcweir #endif
49cdf0e10cSrcweir #include <svx/fmshell.hxx>
50cdf0e10cSrcweir #ifndef SD_WINDOW_UPDATER_HXX
51cdf0e10cSrcweir #include "WindowUpdater.hxx"
52cdf0e10cSrcweir #endif
53cdf0e10cSrcweir #include "GraphicViewShell.hxx"
54cdf0e10cSrcweir #include <sfx2/childwin.hxx>
55cdf0e10cSrcweir #include <sdxfer.hxx>
56cdf0e10cSrcweir #include "GraphicViewShell.hxx"
57cdf0e10cSrcweir #include <sfx2/childwin.hxx>
58cdf0e10cSrcweir 
59cdf0e10cSrcweir #include "app.hrc"
60cdf0e10cSrcweir #include "helpids.h"
61cdf0e10cSrcweir #include "strings.hrc"
62cdf0e10cSrcweir #include "res_bmp.hrc"
63cdf0e10cSrcweir #include "OutlineView.hxx"
64cdf0e10cSrcweir #include "Client.hxx"
65cdf0e10cSrcweir #include "sdresid.hxx"
66cdf0e10cSrcweir #include "DrawDocShell.hxx"
67cdf0e10cSrcweir #include "slideshow.hxx"
68cdf0e10cSrcweir #include "drawdoc.hxx"
69cdf0e10cSrcweir #include "sdpage.hxx"
70cdf0e10cSrcweir #include "zoomlist.hxx"
71cdf0e10cSrcweir #include "FrameView.hxx"
72cdf0e10cSrcweir #include "optsitem.hxx"
73cdf0e10cSrcweir #include "BezierObjectBar.hxx"
74cdf0e10cSrcweir #include "TextObjectBar.hxx"
75cdf0e10cSrcweir #include "GraphicObjectBar.hxx"
76cdf0e10cSrcweir #include "MediaObjectBar.hxx"
77cdf0e10cSrcweir #include "ViewShellManager.hxx"
78cdf0e10cSrcweir #include "FormShellManager.hxx"
79cdf0e10cSrcweir #include <svx/fmshell.hxx>
80cdf0e10cSrcweir #include <svx/dialogs.hrc>
81cdf0e10cSrcweir #include <svx/extrusionbar.hxx>
82cdf0e10cSrcweir #include <svx/fontworkbar.hxx>
83cdf0e10cSrcweir #include <svx/svdoutl.hxx>
84cdf0e10cSrcweir #include <tools/diagnose_ex.h>
85cdf0e10cSrcweir 
86cdf0e10cSrcweir // #96090#
87cdf0e10cSrcweir #include <svl/slstitm.hxx>
88cdf0e10cSrcweir #include <sfx2/request.hxx>
89cdf0e10cSrcweir #include "SpellDialogChildWindow.hxx"
90cdf0e10cSrcweir 
91cdf0e10cSrcweir #include "Window.hxx"
92cdf0e10cSrcweir #include "fupoor.hxx"
93cdf0e10cSrcweir 
94cdf0e10cSrcweir #ifndef SO2_DECL_SVINPLACEOBJECT_DEFINED
95cdf0e10cSrcweir #define SO2_DECL_SVINPLACEOBJECT_DEFINED
96cdf0e10cSrcweir SO2_DECL_REF(SvInPlaceObject)
97cdf0e10cSrcweir #endif
98cdf0e10cSrcweir 
99cdf0e10cSrcweir namespace sd { namespace ui { namespace table {
100cdf0e10cSrcweir 	extern SfxShell* CreateTableObjectBar( ViewShell& rShell, ::sd::View* pView );
101cdf0e10cSrcweir } } }
102cdf0e10cSrcweir 
103cdf0e10cSrcweir using namespace ::com::sun::star;
104cdf0e10cSrcweir using namespace ::com::sun::star::uno;
105cdf0e10cSrcweir using namespace ::com::sun::star::presentation;
106cdf0e10cSrcweir 
107cdf0e10cSrcweir namespace {
108cdf0e10cSrcweir 
109cdf0e10cSrcweir class ViewShellObjectBarFactory
110cdf0e10cSrcweir     : public ::sd::ShellFactory<SfxShell>
111cdf0e10cSrcweir {
112cdf0e10cSrcweir public:
113cdf0e10cSrcweir     ViewShellObjectBarFactory (::sd::ViewShell& rViewShell);
114cdf0e10cSrcweir     virtual ~ViewShellObjectBarFactory (void);
115cdf0e10cSrcweir     virtual SfxShell* CreateShell (
116cdf0e10cSrcweir         ::sd::ShellId nId,
117cdf0e10cSrcweir         ::Window* pParentWindow,
118cdf0e10cSrcweir         ::sd::FrameView* pFrameView);
119cdf0e10cSrcweir     virtual void ReleaseShell (SfxShell* pShell);
120cdf0e10cSrcweir private:
121cdf0e10cSrcweir     ::sd::ViewShell& mrViewShell;
122cdf0e10cSrcweir     /** This cache holds the already created object bars.
123cdf0e10cSrcweir     */
124cdf0e10cSrcweir     typedef ::std::map< ::sd::ShellId,SfxShell*> ShellCache;
125cdf0e10cSrcweir     ShellCache maShellCache;
126cdf0e10cSrcweir };
127cdf0e10cSrcweir 
128cdf0e10cSrcweir 
129cdf0e10cSrcweir } // end of anonymous namespace
130cdf0e10cSrcweir 
131cdf0e10cSrcweir 
132cdf0e10cSrcweir namespace sd {
133cdf0e10cSrcweir 
134cdf0e10cSrcweir static const int DELTA_ZOOM = 10;
135cdf0e10cSrcweir 
136cdf0e10cSrcweir sal_Bool ViewShell::IsPageFlipMode(void) const
137cdf0e10cSrcweir {
138cdf0e10cSrcweir 	return this->ISA(DrawViewShell) && mpContentWindow.get() != NULL &&
139cdf0e10cSrcweir 		mpContentWindow->GetVisibleHeight() >= 1.0;
140cdf0e10cSrcweir }
141cdf0e10cSrcweir 
142cdf0e10cSrcweir SfxViewFrame* ViewShell::GetViewFrame (void) const
143cdf0e10cSrcweir {
144cdf0e10cSrcweir     const SfxViewShell* pViewShell = GetViewShell();
145cdf0e10cSrcweir     if (pViewShell != NULL)
146cdf0e10cSrcweir     {
147cdf0e10cSrcweir         return pViewShell->GetViewFrame();
148cdf0e10cSrcweir     }
149cdf0e10cSrcweir     else
150cdf0e10cSrcweir     {
151cdf0e10cSrcweir         OSL_ASSERT (GetViewShell()!=NULL);
152cdf0e10cSrcweir         return NULL;
153cdf0e10cSrcweir     }
154cdf0e10cSrcweir }
155cdf0e10cSrcweir 
156cdf0e10cSrcweir 
157cdf0e10cSrcweir /*************************************************************************
158cdf0e10cSrcweir |*
159cdf0e10cSrcweir |* SFX-Slotmap und Standardinterface deklarieren
160cdf0e10cSrcweir |*
161cdf0e10cSrcweir \************************************************************************/
162cdf0e10cSrcweir TYPEINIT1(ViewShell, SfxShell);
163cdf0e10cSrcweir 
164cdf0e10cSrcweir 
165cdf0e10cSrcweir ViewShell::ViewShell( SfxViewFrame*, ::Window* pParentWindow, ViewShellBase& rViewShellBase, bool bAllowCenter)
166cdf0e10cSrcweir :	SfxShell(&rViewShellBase)
167cdf0e10cSrcweir ,	mbCenterAllowed(bAllowCenter)
168cdf0e10cSrcweir ,	mpParentWindow(pParentWindow)
169cdf0e10cSrcweir {
170cdf0e10cSrcweir 	construct();
171cdf0e10cSrcweir }
172cdf0e10cSrcweir 
173cdf0e10cSrcweir ViewShell::~ViewShell()
174cdf0e10cSrcweir {
175cdf0e10cSrcweir     // Keep the content window from accessing in its destructor the
176cdf0e10cSrcweir     // WindowUpdater.
177*7a32b0c8SAndre Fischer     if (mpContentWindow)
178*7a32b0c8SAndre Fischer         mpContentWindow->SetViewShell(NULL);
179cdf0e10cSrcweir 
180cdf0e10cSrcweir 	delete mpZoomList;
181cdf0e10cSrcweir 
182cdf0e10cSrcweir     mpLayerTabBar.reset();
183cdf0e10cSrcweir 
184cdf0e10cSrcweir     if (mpImpl->mpSubShellFactory.get() != NULL)
185cdf0e10cSrcweir         GetViewShellBase().GetViewShellManager()->RemoveSubShellFactory(
186cdf0e10cSrcweir             this,mpImpl->mpSubShellFactory);
187*7a32b0c8SAndre Fischer 
188*7a32b0c8SAndre Fischer     if (mpContentWindow)
189*7a32b0c8SAndre Fischer     {
190*7a32b0c8SAndre Fischer         OSL_TRACE("destroying mpContentWindow at %x with parent %x", mpContentWindow.get(),
191*7a32b0c8SAndre Fischer             mpContentWindow->GetParent());
192*7a32b0c8SAndre Fischer         mpContentWindow.reset();
193*7a32b0c8SAndre Fischer     }
194cdf0e10cSrcweir }
195cdf0e10cSrcweir 
196cdf0e10cSrcweir 
197cdf0e10cSrcweir /*************************************************************************
198cdf0e10cSrcweir |*
199cdf0e10cSrcweir |* gemeinsamer Initialiserungsanteil der beiden Konstruktoren
200cdf0e10cSrcweir |*
201cdf0e10cSrcweir \************************************************************************/
202cdf0e10cSrcweir 
203cdf0e10cSrcweir void ViewShell::construct(void)
204cdf0e10cSrcweir {
205cdf0e10cSrcweir 	mbHasRulers = false;
206cdf0e10cSrcweir 	mpActiveWindow = 0;
207cdf0e10cSrcweir 	mpView = 0;
208cdf0e10cSrcweir 	mpFrameView = 0;
209cdf0e10cSrcweir 	mpZoomList = 0;
210cdf0e10cSrcweir 	mbStartShowWithDialog = sal_False;
211cdf0e10cSrcweir 	mnPrintedHandoutPageNum = 1;
212cdf0e10cSrcweir     mnPrintedHandoutPageCount = 0;
213cdf0e10cSrcweir 	mpWindowUpdater.reset( new ::sd::WindowUpdater() );
214cdf0e10cSrcweir 	mpImpl.reset(new Implementation(*this));
215cdf0e10cSrcweir 	meShellType = ST_NONE;
216cdf0e10cSrcweir 
217cdf0e10cSrcweir     OSL_ASSERT (GetViewShell()!=NULL);
218cdf0e10cSrcweir 
219cdf0e10cSrcweir     if (IsMainViewShell())
220cdf0e10cSrcweir         GetDocSh()->Connect (this);
221cdf0e10cSrcweir 
222cdf0e10cSrcweir 	mpZoomList = new ZoomList( this );
223cdf0e10cSrcweir 
224cdf0e10cSrcweir 	mpContentWindow.reset(new ::sd::Window(GetParentWindow()));
225cdf0e10cSrcweir     SetActiveWindow (mpContentWindow.get());
226cdf0e10cSrcweir 
227cdf0e10cSrcweir     GetParentWindow()->SetBackground (Wallpaper());
228cdf0e10cSrcweir     mpContentWindow->SetBackground (Wallpaper());
229cdf0e10cSrcweir 	mpContentWindow->SetCenterAllowed(mbCenterAllowed);
230cdf0e10cSrcweir 	mpContentWindow->SetViewShell(this);
231cdf0e10cSrcweir     mpContentWindow->SetPosSizePixel(
232cdf0e10cSrcweir         GetParentWindow()->GetPosPixel(),GetParentWindow()->GetSizePixel());
233cdf0e10cSrcweir     mpContentWindow->Show();
234cdf0e10cSrcweir     static_cast< ::Window*>(mpContentWindow.get())->Resize();
235cdf0e10cSrcweir     OSL_TRACE("content window has size %d %d",
236cdf0e10cSrcweir         mpContentWindow->GetSizePixel().Width(),
237cdf0e10cSrcweir         mpContentWindow->GetSizePixel().Height());
238cdf0e10cSrcweir 
239cdf0e10cSrcweir     if ( ! GetDocSh()->IsPreview())
240cdf0e10cSrcweir     {
241cdf0e10cSrcweir         // Create scroll bars and the filler between the scroll bars.
242cdf0e10cSrcweir         mpHorizontalScrollBar.reset (new ScrollBar(GetParentWindow(), WinBits(WB_HSCROLL | WB_DRAG)));
243cdf0e10cSrcweir         mpHorizontalScrollBar->EnableRTL (sal_False);
244cdf0e10cSrcweir         mpHorizontalScrollBar->SetRange(Range(0, 32000));
245cdf0e10cSrcweir         mpHorizontalScrollBar->SetScrollHdl(LINK(this, ViewShell, HScrollHdl));
246cdf0e10cSrcweir         mpHorizontalScrollBar->Show();
247cdf0e10cSrcweir 
248cdf0e10cSrcweir         mpVerticalScrollBar.reset (new ScrollBar(GetParentWindow(), WinBits(WB_VSCROLL | WB_DRAG)));
249cdf0e10cSrcweir         mpVerticalScrollBar->SetRange(Range(0, 32000));
250cdf0e10cSrcweir         mpVerticalScrollBar->SetScrollHdl(LINK(this, ViewShell, VScrollHdl));
251cdf0e10cSrcweir         mpVerticalScrollBar->Show();
252cdf0e10cSrcweir         maScrBarWH = Size(
253cdf0e10cSrcweir             mpVerticalScrollBar->GetSizePixel().Width(),
254cdf0e10cSrcweir             mpHorizontalScrollBar->GetSizePixel().Height());
255cdf0e10cSrcweir 
256cdf0e10cSrcweir         mpScrollBarBox.reset(new ScrollBarBox(GetParentWindow(), WB_SIZEABLE));
257cdf0e10cSrcweir         mpScrollBarBox->Show();
258cdf0e10cSrcweir     }
259cdf0e10cSrcweir 
260cdf0e10cSrcweir 	String aName( RTL_CONSTASCII_USTRINGPARAM( "ViewShell" ));
261cdf0e10cSrcweir 	SetName (aName);
262cdf0e10cSrcweir 
263cdf0e10cSrcweir 	GetDoc()->StartOnlineSpelling(sal_False);
264cdf0e10cSrcweir 
265cdf0e10cSrcweir     mpWindowUpdater->SetViewShell (*this);
266cdf0e10cSrcweir     mpWindowUpdater->SetDocument (GetDoc());
267cdf0e10cSrcweir 
268cdf0e10cSrcweir     // Re-initialize the spell dialog.
269cdf0e10cSrcweir     ::sd::SpellDialogChildWindow* pSpellDialog =
270cdf0e10cSrcweir           static_cast< ::sd::SpellDialogChildWindow*> (
271cdf0e10cSrcweir               GetViewFrame()->GetChildWindow (
272cdf0e10cSrcweir                   ::sd::SpellDialogChildWindow::GetChildWindowId()));
273cdf0e10cSrcweir     if (pSpellDialog != NULL)
274cdf0e10cSrcweir         pSpellDialog->InvalidateSpellDialog();
275cdf0e10cSrcweir 
276cdf0e10cSrcweir     // Register the sub shell factory.
277cdf0e10cSrcweir     mpImpl->mpSubShellFactory.reset(new ViewShellObjectBarFactory(*this));
278cdf0e10cSrcweir     GetViewShellBase().GetViewShellManager()->AddSubShellFactory(this,mpImpl->mpSubShellFactory);
279cdf0e10cSrcweir 
280cdf0e10cSrcweir     GetParentWindow()->Show();
281cdf0e10cSrcweir }
282cdf0e10cSrcweir 
283cdf0e10cSrcweir 
284cdf0e10cSrcweir 
285cdf0e10cSrcweir 
286cdf0e10cSrcweir void ViewShell::Init (bool bIsMainViewShell)
287cdf0e10cSrcweir {
288cdf0e10cSrcweir     mpImpl->mbIsInitialized = true;
289cdf0e10cSrcweir     SetIsMainViewShell(bIsMainViewShell);
290cdf0e10cSrcweir     if (bIsMainViewShell)
291cdf0e10cSrcweir         SetActiveWindow (mpContentWindow.get());
292cdf0e10cSrcweir }
293cdf0e10cSrcweir 
294cdf0e10cSrcweir 
295cdf0e10cSrcweir 
296cdf0e10cSrcweir 
297cdf0e10cSrcweir void ViewShell::Exit (void)
298cdf0e10cSrcweir {
299cdf0e10cSrcweir     sd::View* pView = GetView();
300cdf0e10cSrcweir     if (pView!=NULL && pView->IsTextEdit())
301cdf0e10cSrcweir     {
302cdf0e10cSrcweir         pView->SdrEndTextEdit();
303cdf0e10cSrcweir         pView->UnmarkAll();
304cdf0e10cSrcweir     }
305cdf0e10cSrcweir 
306cdf0e10cSrcweir     Deactivate (sal_True);
307cdf0e10cSrcweir 
308cdf0e10cSrcweir     if (IsMainViewShell())
309cdf0e10cSrcweir     {
310cdf0e10cSrcweir         GetDocSh()->Disconnect(this);
311cdf0e10cSrcweir     }
312cdf0e10cSrcweir 
313cdf0e10cSrcweir     SetIsMainViewShell(false);
314cdf0e10cSrcweir }
315cdf0e10cSrcweir 
316cdf0e10cSrcweir 
317cdf0e10cSrcweir 
318cdf0e10cSrcweir 
319cdf0e10cSrcweir /*************************************************************************
320cdf0e10cSrcweir |*
321cdf0e10cSrcweir |* Aktivierung: Arbeitsfenster den Fokus zuweisen
322cdf0e10cSrcweir |*
323cdf0e10cSrcweir \************************************************************************/
324cdf0e10cSrcweir 
325cdf0e10cSrcweir void ViewShell::Activate(sal_Bool bIsMDIActivate)
326cdf0e10cSrcweir {
327cdf0e10cSrcweir     SfxShell::Activate(bIsMDIActivate);
328cdf0e10cSrcweir 
329cdf0e10cSrcweir 	// Laut MI darf keiner GrabFocus rufen, der nicht genau weiss von
330cdf0e10cSrcweir 	// welchem Window der Focus gegrabt wird. Da Activate() vom SFX teilweise
331cdf0e10cSrcweir 	// asynchron verschickt wird, kann es sein, dass ein falsches Window
332cdf0e10cSrcweir 	// den Focus hat (#29682#):
333cdf0e10cSrcweir 	//GetViewFrame()->GetWindow().GrabFocus();
334cdf0e10cSrcweir 
335cdf0e10cSrcweir     if (mpHorizontalRuler.get() != NULL)
336cdf0e10cSrcweir         mpHorizontalRuler->SetActive(sal_True);
337cdf0e10cSrcweir     if (mpVerticalRuler.get() != NULL)
338cdf0e10cSrcweir         mpVerticalRuler->SetActive(sal_True);
339cdf0e10cSrcweir 
340cdf0e10cSrcweir     if (bIsMDIActivate)
341cdf0e10cSrcweir     {
342cdf0e10cSrcweir         // Damit der Navigator auch einen aktuellen Status bekommt
343cdf0e10cSrcweir         SfxBoolItem aItem( SID_NAVIGATOR_INIT, sal_True );
344cdf0e10cSrcweir         if (GetDispatcher() != NULL)
345cdf0e10cSrcweir             GetDispatcher()->Execute(
346cdf0e10cSrcweir                 SID_NAVIGATOR_INIT,
347cdf0e10cSrcweir                 SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
348cdf0e10cSrcweir                 &aItem,
349cdf0e10cSrcweir                 0L);
350cdf0e10cSrcweir 
351cdf0e10cSrcweir         SfxViewShell* pViewShell = GetViewShell();
352cdf0e10cSrcweir         OSL_ASSERT (pViewShell!=NULL);
353cdf0e10cSrcweir 		SfxBindings& rBindings = pViewShell->GetViewFrame()->GetBindings();
354cdf0e10cSrcweir 		rBindings.Invalidate( SID_3D_STATE, sal_True, sal_False );
355cdf0e10cSrcweir 
356cdf0e10cSrcweir 		rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) );
357cdf0e10cSrcweir 		if(xSlideShow.is() && xSlideShow->isRunning() )
358cdf0e10cSrcweir 		{
359cdf0e10cSrcweir 			xSlideShow->activate(GetViewShellBase());
360cdf0e10cSrcweir 		}
361cdf0e10cSrcweir 		if(HasCurrentFunction())
362cdf0e10cSrcweir 		{
363cdf0e10cSrcweir 			GetCurrentFunction()->Activate();
364cdf0e10cSrcweir 		}
365cdf0e10cSrcweir 
366cdf0e10cSrcweir 		if(!GetDocSh()->IsUIActive())
367cdf0e10cSrcweir 			UpdatePreview( GetActualPage(), sal_True );
368cdf0e10cSrcweir 
369cdf0e10cSrcweir 		//HMH::sd::View* pView = GetView();
370cdf0e10cSrcweir 
371cdf0e10cSrcweir 		//HMHif (pView)
372cdf0e10cSrcweir 		//HMH{
373cdf0e10cSrcweir 		//HMH	pView->ShowMarkHdl();
374cdf0e10cSrcweir 		//HMH}
375cdf0e10cSrcweir 	}
376cdf0e10cSrcweir 
377cdf0e10cSrcweir 	ReadFrameViewData( mpFrameView );
378cdf0e10cSrcweir 
379cdf0e10cSrcweir     if (IsMainViewShell())
380cdf0e10cSrcweir         GetDocSh()->Connect(this);
381cdf0e10cSrcweir }
382cdf0e10cSrcweir 
383cdf0e10cSrcweir void ViewShell::UIActivating( SfxInPlaceClient*  )
384cdf0e10cSrcweir {
385cdf0e10cSrcweir     OSL_ASSERT (GetViewShell()!=NULL);
386cdf0e10cSrcweir     GetViewShellBase().GetToolBarManager()->ToolBarsDestroyed();
387cdf0e10cSrcweir }
388cdf0e10cSrcweir 
389cdf0e10cSrcweir 
390cdf0e10cSrcweir 
391cdf0e10cSrcweir void ViewShell::UIDeactivated( SfxInPlaceClient*  )
392cdf0e10cSrcweir {
393cdf0e10cSrcweir     OSL_ASSERT (GetViewShell()!=NULL);
394cdf0e10cSrcweir     GetViewShellBase().GetToolBarManager()->ToolBarsDestroyed();
395cdf0e10cSrcweir     if ( GetDrawView() )
396cdf0e10cSrcweir         GetViewShellBase().GetToolBarManager()->SelectionHasChanged(*this, *GetDrawView());
397cdf0e10cSrcweir }
398cdf0e10cSrcweir 
399cdf0e10cSrcweir /*************************************************************************
400cdf0e10cSrcweir |*
401cdf0e10cSrcweir |* Deaktivierung
402cdf0e10cSrcweir |*
403cdf0e10cSrcweir \************************************************************************/
404cdf0e10cSrcweir 
405cdf0e10cSrcweir void ViewShell::Deactivate(sal_Bool bIsMDIActivate)
406cdf0e10cSrcweir {
407cdf0e10cSrcweir 	// remove view from a still active drag'n'drop session
408cdf0e10cSrcweir 	SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag;
409cdf0e10cSrcweir 
410cdf0e10cSrcweir     if (IsMainViewShell())
411cdf0e10cSrcweir         GetDocSh()->Disconnect(this);
412cdf0e10cSrcweir 
413cdf0e10cSrcweir 	if( pDragTransferable )
414cdf0e10cSrcweir 		pDragTransferable->SetView( NULL );
415cdf0e10cSrcweir 
416cdf0e10cSrcweir     OSL_ASSERT (GetViewShell()!=NULL);
417cdf0e10cSrcweir 
418cdf0e10cSrcweir 	// View-Attribute an der FrameView merken
419cdf0e10cSrcweir 	WriteFrameViewData();
420cdf0e10cSrcweir 
421cdf0e10cSrcweir 	if (bIsMDIActivate)
422cdf0e10cSrcweir 	{
423cdf0e10cSrcweir 		rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) );
424cdf0e10cSrcweir 		if(xSlideShow.is() && xSlideShow->isRunning() )
425cdf0e10cSrcweir 		{
426cdf0e10cSrcweir 			xSlideShow->deactivate(GetViewShellBase());
427cdf0e10cSrcweir 		}
428cdf0e10cSrcweir 		if(HasCurrentFunction())
429cdf0e10cSrcweir 		{
430cdf0e10cSrcweir 			GetCurrentFunction()->Deactivate();
431cdf0e10cSrcweir 		}
432cdf0e10cSrcweir 	}
433cdf0e10cSrcweir 
434cdf0e10cSrcweir     if (mpHorizontalRuler.get() != NULL)
435cdf0e10cSrcweir         mpHorizontalRuler->SetActive(sal_False);
436cdf0e10cSrcweir     if (mpVerticalRuler.get() != NULL)
437cdf0e10cSrcweir         mpVerticalRuler->SetActive(sal_False);
438cdf0e10cSrcweir 
439cdf0e10cSrcweir 	SfxShell::Deactivate(bIsMDIActivate);
440cdf0e10cSrcweir }
441cdf0e10cSrcweir 
442cdf0e10cSrcweir 
443cdf0e10cSrcweir 
444cdf0e10cSrcweir 
445cdf0e10cSrcweir void ViewShell::Shutdown (void)
446cdf0e10cSrcweir {
447cdf0e10cSrcweir     Exit ();
448cdf0e10cSrcweir }
449cdf0e10cSrcweir 
450cdf0e10cSrcweir 
451cdf0e10cSrcweir 
452cdf0e10cSrcweir 
453cdf0e10cSrcweir /*************************************************************************
454cdf0e10cSrcweir |*
455cdf0e10cSrcweir |* Keyboard event
456cdf0e10cSrcweir |*
457cdf0e10cSrcweir \************************************************************************/
458cdf0e10cSrcweir 
459cdf0e10cSrcweir sal_Bool ViewShell::KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin)
460cdf0e10cSrcweir {
461cdf0e10cSrcweir 	sal_Bool bReturn(sal_False);
462cdf0e10cSrcweir 
463cdf0e10cSrcweir 	if(pWin)
464cdf0e10cSrcweir 	{
465cdf0e10cSrcweir 		SetActiveWindow(pWin);
466cdf0e10cSrcweir 	}
467cdf0e10cSrcweir 
468cdf0e10cSrcweir 	if(!bReturn)
469cdf0e10cSrcweir 	{
470cdf0e10cSrcweir 		// #76008#
471cdf0e10cSrcweir 		// give key input first to SfxViewShell to give CTRL+Key
472cdf0e10cSrcweir 		// (e.g. CTRL+SHIFT+'+', to front) priority.
473cdf0e10cSrcweir         OSL_ASSERT (GetViewShell()!=NULL);
474cdf0e10cSrcweir 		bReturn = (sal_Bool)GetViewShell()->KeyInput(rKEvt);
475cdf0e10cSrcweir 	}
476cdf0e10cSrcweir 
477cdf0e10cSrcweir 	if(!bReturn)
478cdf0e10cSrcweir 	{
479cdf0e10cSrcweir 		rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) );
480cdf0e10cSrcweir 		if(xSlideShow.is() && xSlideShow->isRunning())
481cdf0e10cSrcweir 		{
482cdf0e10cSrcweir 			bReturn = xSlideShow->keyInput(rKEvt);
483cdf0e10cSrcweir 		}
484cdf0e10cSrcweir 		else
485cdf0e10cSrcweir 		{
486cdf0e10cSrcweir 			bool bConsumed = false;
487cdf0e10cSrcweir 			if( GetView() )
488cdf0e10cSrcweir 				bConsumed = GetView()->getSmartTags().KeyInput(rKEvt);
489cdf0e10cSrcweir 
490cdf0e10cSrcweir 
491cdf0e10cSrcweir 			if( !bConsumed )
492cdf0e10cSrcweir 			{
493cdf0e10cSrcweir 				rtl::Reference< sdr::SelectionController > xSelectionController( GetView()->getSelectionController() );
494cdf0e10cSrcweir 				if( !xSelectionController.is() || !xSelectionController->onKeyInput( rKEvt, pWin ) )
495cdf0e10cSrcweir 				{
496cdf0e10cSrcweir 					if(HasCurrentFunction())
497cdf0e10cSrcweir 						bReturn = GetCurrentFunction()->KeyInput(rKEvt);
498cdf0e10cSrcweir 				}
499cdf0e10cSrcweir 				else
500cdf0e10cSrcweir 				{
501cdf0e10cSrcweir 					bReturn = sal_True;
502cdf0e10cSrcweir 				}
503cdf0e10cSrcweir 			}
504cdf0e10cSrcweir 		}
505cdf0e10cSrcweir 	}
506cdf0e10cSrcweir 
507cdf0e10cSrcweir 	if(!bReturn && GetActiveWindow())
508cdf0e10cSrcweir 	{
509cdf0e10cSrcweir 		KeyCode aKeyCode = rKEvt.GetKeyCode();
510cdf0e10cSrcweir 
511cdf0e10cSrcweir 		if (aKeyCode.IsMod1() && aKeyCode.IsShift()
512cdf0e10cSrcweir 			&& aKeyCode.GetCode() == KEY_R)
513cdf0e10cSrcweir 		{
514cdf0e10cSrcweir 			InvalidateWindows();
515cdf0e10cSrcweir 			bReturn = sal_True;
516cdf0e10cSrcweir 		}
517cdf0e10cSrcweir 	}
518cdf0e10cSrcweir 
519cdf0e10cSrcweir 	return(bReturn);
520cdf0e10cSrcweir }
521cdf0e10cSrcweir 
522cdf0e10cSrcweir /*************************************************************************
523cdf0e10cSrcweir |*
524cdf0e10cSrcweir |* MouseButtonDown event
525cdf0e10cSrcweir |*
526cdf0e10cSrcweir \************************************************************************/
527cdf0e10cSrcweir 
528cdf0e10cSrcweir void ViewShell::MouseButtonDown(const MouseEvent& rMEvt, ::sd::Window* pWin)
529cdf0e10cSrcweir {
530cdf0e10cSrcweir     // We have to lock tool bar updates while the mouse button is pressed in
531cdf0e10cSrcweir     // order to prevent the shape under the mouse to be moved (this happens
532cdf0e10cSrcweir     // when the number of docked tool bars changes as result of a changed
533cdf0e10cSrcweir     // selection;  this changes the window size and thus the mouse position
534cdf0e10cSrcweir     // in model coordinates: with respect to model coordinates the mouse
535cdf0e10cSrcweir     // moves.)
536cdf0e10cSrcweir     OSL_ASSERT(mpImpl->mpUpdateLockForMouse.expired());
537cdf0e10cSrcweir     mpImpl->mpUpdateLockForMouse = ViewShell::Implementation::ToolBarManagerLock::Create(
538cdf0e10cSrcweir         GetViewShellBase().GetToolBarManager());
539cdf0e10cSrcweir 
540cdf0e10cSrcweir 	if ( pWin && !pWin->HasFocus() )
541cdf0e10cSrcweir 	{
542cdf0e10cSrcweir         pWin->GrabFocus();
543cdf0e10cSrcweir         SetActiveWindow(pWin);
544cdf0e10cSrcweir //		  GetViewFrame()->GetWindow().GrabFocus();
545cdf0e10cSrcweir 	}
546cdf0e10cSrcweir 
547cdf0e10cSrcweir 	// MouseEvent in E3dView eintragen
548cdf0e10cSrcweir     if (GetView() != NULL)
549cdf0e10cSrcweir         GetView()->SetMouseEvent(rMEvt);
550cdf0e10cSrcweir 
551cdf0e10cSrcweir 	bool bConsumed = false;
552cdf0e10cSrcweir 	if( GetView() )
553cdf0e10cSrcweir 		bConsumed = GetView()->getSmartTags().MouseButtonDown( rMEvt );
554cdf0e10cSrcweir 
555cdf0e10cSrcweir 	if( !bConsumed )
556cdf0e10cSrcweir 	{
557cdf0e10cSrcweir 		rtl::Reference< sdr::SelectionController > xSelectionController( GetView()->getSelectionController() );
558cdf0e10cSrcweir 		if( !xSelectionController.is() || !xSelectionController->onMouseButtonDown( rMEvt, pWin ) )
559cdf0e10cSrcweir 		{
560cdf0e10cSrcweir 			if(HasCurrentFunction())
561cdf0e10cSrcweir 			{
562cdf0e10cSrcweir 				GetCurrentFunction()->MouseButtonDown(rMEvt);
563cdf0e10cSrcweir 			}
564cdf0e10cSrcweir 		}
565cdf0e10cSrcweir 	}
566cdf0e10cSrcweir }
567cdf0e10cSrcweir 
568cdf0e10cSrcweir /*************************************************************************
569cdf0e10cSrcweir |*
570cdf0e10cSrcweir |* MouseMove event
571cdf0e10cSrcweir |*
572cdf0e10cSrcweir \************************************************************************/
573cdf0e10cSrcweir 
574cdf0e10cSrcweir void ViewShell::MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin)
575cdf0e10cSrcweir {
576cdf0e10cSrcweir     if (rMEvt.IsLeaveWindow())
577cdf0e10cSrcweir     {
578cdf0e10cSrcweir         if ( ! mpImpl->mpUpdateLockForMouse.expired())
579cdf0e10cSrcweir         {
580cdf0e10cSrcweir             ::boost::shared_ptr<ViewShell::Implementation::ToolBarManagerLock> pLock(
581cdf0e10cSrcweir                 mpImpl->mpUpdateLockForMouse);
582cdf0e10cSrcweir             if (pLock.get() != NULL)
583cdf0e10cSrcweir                 pLock->Release();
584cdf0e10cSrcweir         }
585cdf0e10cSrcweir     }
586cdf0e10cSrcweir 
587cdf0e10cSrcweir 	if ( pWin )
588cdf0e10cSrcweir 	{
589cdf0e10cSrcweir 		SetActiveWindow(pWin);
590cdf0e10cSrcweir 	}
591cdf0e10cSrcweir 
592cdf0e10cSrcweir 	// MouseEvent in E3dView eintragen
593cdf0e10cSrcweir     if (GetView() != NULL)
594cdf0e10cSrcweir         GetView()->SetMouseEvent(rMEvt);
595cdf0e10cSrcweir 
596cdf0e10cSrcweir 	if(HasCurrentFunction())
597cdf0e10cSrcweir 	{
598cdf0e10cSrcweir 		rtl::Reference< sdr::SelectionController > xSelectionController( GetView()->getSelectionController() );
599cdf0e10cSrcweir 		if( !xSelectionController.is() || !xSelectionController->onMouseMove( rMEvt, pWin ) )
600cdf0e10cSrcweir 		{
601cdf0e10cSrcweir 			if(HasCurrentFunction())
602cdf0e10cSrcweir 				GetCurrentFunction()->MouseMove(rMEvt);
603cdf0e10cSrcweir 		}
604cdf0e10cSrcweir 	}
605cdf0e10cSrcweir }
606cdf0e10cSrcweir 
607cdf0e10cSrcweir /*************************************************************************
608cdf0e10cSrcweir |*
609cdf0e10cSrcweir |* MouseButtonUp event
610cdf0e10cSrcweir |*
611cdf0e10cSrcweir \************************************************************************/
612cdf0e10cSrcweir 
613cdf0e10cSrcweir void ViewShell::MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin)
614cdf0e10cSrcweir {
615cdf0e10cSrcweir 	if ( pWin )
616cdf0e10cSrcweir 	{
617cdf0e10cSrcweir 		SetActiveWindow(pWin);
618cdf0e10cSrcweir 	}
619cdf0e10cSrcweir 
620cdf0e10cSrcweir 	// MouseEvent in E3dView eintragen
621cdf0e10cSrcweir     if (GetView() != NULL)
622cdf0e10cSrcweir         GetView()->SetMouseEvent(rMEvt);
623cdf0e10cSrcweir 
624cdf0e10cSrcweir 	if( HasCurrentFunction())
625cdf0e10cSrcweir 	{
626cdf0e10cSrcweir 		rtl::Reference< sdr::SelectionController > xSelectionController( GetView()->getSelectionController() );
627cdf0e10cSrcweir 		if( !xSelectionController.is() || !xSelectionController->onMouseButtonUp( rMEvt, pWin ) )
628cdf0e10cSrcweir 		{
629cdf0e10cSrcweir 			if(HasCurrentFunction())
630cdf0e10cSrcweir 				GetCurrentFunction()->MouseButtonUp(rMEvt);
631cdf0e10cSrcweir 		}
632cdf0e10cSrcweir 	}
633cdf0e10cSrcweir 
634cdf0e10cSrcweir     if ( ! mpImpl->mpUpdateLockForMouse.expired())
635cdf0e10cSrcweir     {
636cdf0e10cSrcweir         ::boost::shared_ptr<ViewShell::Implementation::ToolBarManagerLock> pLock(
637cdf0e10cSrcweir             mpImpl->mpUpdateLockForMouse);
638cdf0e10cSrcweir         if (pLock.get() != NULL)
639cdf0e10cSrcweir             pLock->Release();
640cdf0e10cSrcweir     }
641cdf0e10cSrcweir }
642cdf0e10cSrcweir 
643cdf0e10cSrcweir 
644cdf0e10cSrcweir /*************************************************************************
645cdf0e10cSrcweir |*
646cdf0e10cSrcweir |* Command event
647cdf0e10cSrcweir |*
648cdf0e10cSrcweir \************************************************************************/
649cdf0e10cSrcweir 
650cdf0e10cSrcweir void ViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin)
651cdf0e10cSrcweir {
652cdf0e10cSrcweir 	sal_Bool bDone = HandleScrollCommand (rCEvt, pWin);
653cdf0e10cSrcweir 
654cdf0e10cSrcweir 	if( !bDone )
655cdf0e10cSrcweir 	{
656cdf0e10cSrcweir 		if( rCEvt.GetCommand() == COMMAND_INPUTLANGUAGECHANGE )
657cdf0e10cSrcweir 		{
658cdf0e10cSrcweir             //#i42732# update state of fontname if input language changes
659cdf0e10cSrcweir             GetViewFrame()->GetBindings().Invalidate( SID_ATTR_CHAR_FONT );
660cdf0e10cSrcweir             GetViewFrame()->GetBindings().Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
661cdf0e10cSrcweir 		}
662cdf0e10cSrcweir 		else
663cdf0e10cSrcweir 		{
664cdf0e10cSrcweir 		    bool bConsumed = false;
665cdf0e10cSrcweir    			if( GetView() )
666cdf0e10cSrcweir    			{
667cdf0e10cSrcweir 				bConsumed = GetView()->getSmartTags().Command(rCEvt);
668cdf0e10cSrcweir 		    }
669cdf0e10cSrcweir 
670cdf0e10cSrcweir 			if( !bConsumed && HasCurrentFunction())
671cdf0e10cSrcweir 		    {
672cdf0e10cSrcweir 		        GetCurrentFunction()->Command(rCEvt);
673cdf0e10cSrcweir             }
674cdf0e10cSrcweir 		}
675cdf0e10cSrcweir 	}
676cdf0e10cSrcweir }
677cdf0e10cSrcweir 
678cdf0e10cSrcweir long ViewShell::Notify(NotifyEvent& rNEvt, ::sd::Window* pWin)
679cdf0e10cSrcweir {
680cdf0e10cSrcweir     // handle scroll commands when they arrived at child windows
681cdf0e10cSrcweir     long nRet = sal_False;
682cdf0e10cSrcweir     if( rNEvt.GetType() == EVENT_COMMAND )
683cdf0e10cSrcweir     {
684cdf0e10cSrcweir         // note: dynamic_cast is not possible as GetData() returns a void*
685cdf0e10cSrcweir         CommandEvent* pCmdEvent = reinterpret_cast< CommandEvent* >(rNEvt.GetData());
686cdf0e10cSrcweir         nRet = HandleScrollCommand(*pCmdEvent, pWin);
687cdf0e10cSrcweir     }
688cdf0e10cSrcweir     return nRet;
689cdf0e10cSrcweir }
690cdf0e10cSrcweir 
691cdf0e10cSrcweir 
692cdf0e10cSrcweir bool ViewShell::HandleScrollCommand(const CommandEvent& rCEvt, ::sd::Window* pWin)
693cdf0e10cSrcweir {
694cdf0e10cSrcweir     bool bDone = false;
695cdf0e10cSrcweir 
696cdf0e10cSrcweir     switch( rCEvt.GetCommand() )
697cdf0e10cSrcweir     {
698cdf0e10cSrcweir         case COMMAND_WHEEL:
699cdf0e10cSrcweir 			{
700cdf0e10cSrcweir 				Reference< XSlideShowController > xSlideShowController( SlideShow::GetSlideShowController(GetViewShellBase() ) );
701cdf0e10cSrcweir 				if( xSlideShowController.is() )
702cdf0e10cSrcweir 				{
703cdf0e10cSrcweir 					// We ignore zooming with control+mouse wheel.
704cdf0e10cSrcweir 					const CommandWheelData* pData = rCEvt.GetWheelData();
705cdf0e10cSrcweir 					if( pData && !pData->GetModifier() && ( pData->GetMode() == COMMAND_WHEEL_SCROLL ) && !pData->IsHorz() )
706cdf0e10cSrcweir 					{
707cdf0e10cSrcweir 						long nDelta = pData->GetDelta();
708cdf0e10cSrcweir 						if( nDelta > 0 )
709cdf0e10cSrcweir 						{
710cdf0e10cSrcweir 							xSlideShowController->gotoPreviousSlide();
711cdf0e10cSrcweir 						}
712cdf0e10cSrcweir 						else if( nDelta < 0 )
713cdf0e10cSrcweir 						{
714cdf0e10cSrcweir 							xSlideShowController->gotoNextEffect();
715cdf0e10cSrcweir 						}
716cdf0e10cSrcweir 					}
717cdf0e10cSrcweir 					break;
718cdf0e10cSrcweir 				}
719cdf0e10cSrcweir 			}
720cdf0e10cSrcweir 			// fall through when not running slideshow
721cdf0e10cSrcweir         case COMMAND_STARTAUTOSCROLL:
722cdf0e10cSrcweir         case COMMAND_AUTOSCROLL:
723cdf0e10cSrcweir         {
724cdf0e10cSrcweir             const CommandWheelData* pData = rCEvt.GetWheelData();
725cdf0e10cSrcweir 
726cdf0e10cSrcweir             if (pData != NULL)
727cdf0e10cSrcweir             {
728cdf0e10cSrcweir                 if (pData->IsMod1())
729cdf0e10cSrcweir                 {
730cdf0e10cSrcweir                     if( !GetDocSh()->IsUIActive() )
731cdf0e10cSrcweir                     {
732cdf0e10cSrcweir                         const long  nOldZoom = GetActiveWindow()->GetZoom();
733cdf0e10cSrcweir                         long        nNewZoom;
734cdf0e10cSrcweir 
735cdf0e10cSrcweir                         if( pData->GetDelta() < 0L )
736cdf0e10cSrcweir                             nNewZoom = Max( (long) pWin->GetMinZoom(), (long)(nOldZoom - DELTA_ZOOM) );
737cdf0e10cSrcweir                         else
738cdf0e10cSrcweir                             nNewZoom = Min( (long) pWin->GetMaxZoom(), (long)(nOldZoom + DELTA_ZOOM) );
739cdf0e10cSrcweir 
740cdf0e10cSrcweir                         SetZoom( nNewZoom );
741cdf0e10cSrcweir                         Invalidate( SID_ATTR_ZOOM );
742cdf0e10cSrcweir 						Invalidate( SID_ATTR_ZOOMSLIDER );
743cdf0e10cSrcweir 
744cdf0e10cSrcweir                         bDone = true;
745cdf0e10cSrcweir                     }
746cdf0e10cSrcweir                 }
747cdf0e10cSrcweir                 else
748cdf0e10cSrcweir                 {
749cdf0e10cSrcweir                     if( mpContentWindow.get() == pWin )
750cdf0e10cSrcweir                     {
751cdf0e10cSrcweir                         sal_uLong nScrollLines = pData->GetScrollLines();
752cdf0e10cSrcweir                         if(IsPageFlipMode())
753cdf0e10cSrcweir                             nScrollLines = COMMAND_WHEEL_PAGESCROLL;
754cdf0e10cSrcweir                         CommandWheelData aWheelData( pData->GetDelta(),pData->GetNotchDelta(),
755cdf0e10cSrcweir                             nScrollLines,pData->GetMode(),pData->GetModifier(),pData->IsHorz() );
756cdf0e10cSrcweir                         CommandEvent aReWrite( rCEvt.GetMousePosPixel(),rCEvt.GetCommand(),
757cdf0e10cSrcweir                             rCEvt.IsMouseEvent(),(const void *) &aWheelData );
758cdf0e10cSrcweir                         bDone = pWin->HandleScrollCommand( aReWrite,
759cdf0e10cSrcweir                             mpHorizontalScrollBar.get(),
760cdf0e10cSrcweir                             mpVerticalScrollBar.get()) == sal_True;
761cdf0e10cSrcweir                     }
762cdf0e10cSrcweir                 }
763cdf0e10cSrcweir             }
764cdf0e10cSrcweir         }
765cdf0e10cSrcweir         break;
766cdf0e10cSrcweir 
767cdf0e10cSrcweir         default:
768cdf0e10cSrcweir         break;
769cdf0e10cSrcweir     }
770cdf0e10cSrcweir 
771cdf0e10cSrcweir     return bDone;
772cdf0e10cSrcweir }
773cdf0e10cSrcweir 
774cdf0e10cSrcweir 
775cdf0e10cSrcweir 
776cdf0e10cSrcweir void ViewShell::SetupRulers (void)
777cdf0e10cSrcweir {
778cdf0e10cSrcweir 	if(mbHasRulers && (mpContentWindow.get() != NULL) && !SlideShow::IsRunning(GetViewShellBase()))
779cdf0e10cSrcweir 	{
780cdf0e10cSrcweir 		long nHRulerOfs = 0;
781cdf0e10cSrcweir 
782cdf0e10cSrcweir 		if ( mpVerticalRuler.get() == NULL )
783cdf0e10cSrcweir 		{
784cdf0e10cSrcweir 			mpVerticalRuler.reset(CreateVRuler(GetActiveWindow()));
785cdf0e10cSrcweir 			if ( mpVerticalRuler.get() != NULL )
786cdf0e10cSrcweir 			{
787cdf0e10cSrcweir 				nHRulerOfs = mpVerticalRuler->GetSizePixel().Width();
788cdf0e10cSrcweir 				mpVerticalRuler->SetActive(sal_True);
789cdf0e10cSrcweir 				mpVerticalRuler->Show();
790cdf0e10cSrcweir 			}
791cdf0e10cSrcweir 		}
792cdf0e10cSrcweir 		if ( mpHorizontalRuler.get() == NULL )
793cdf0e10cSrcweir 		{
794cdf0e10cSrcweir 			mpHorizontalRuler.reset(CreateHRuler(GetActiveWindow(), sal_True));
795cdf0e10cSrcweir 			if ( mpHorizontalRuler.get() != NULL )
796cdf0e10cSrcweir 			{
797cdf0e10cSrcweir 				mpHorizontalRuler->SetWinPos(nHRulerOfs);
798cdf0e10cSrcweir 				mpHorizontalRuler->SetActive(sal_True);
799cdf0e10cSrcweir 				mpHorizontalRuler->Show();
800cdf0e10cSrcweir 			}
801cdf0e10cSrcweir 		}
802cdf0e10cSrcweir 	}
803cdf0e10cSrcweir }
804cdf0e10cSrcweir 
805cdf0e10cSrcweir 
806cdf0e10cSrcweir 
807cdf0e10cSrcweir 
808cdf0e10cSrcweir sal_Bool ViewShell::HasRuler (void)
809cdf0e10cSrcweir {
810cdf0e10cSrcweir     return mbHasRulers;
811cdf0e10cSrcweir }
812cdf0e10cSrcweir 
813cdf0e10cSrcweir 
814cdf0e10cSrcweir 
815cdf0e10cSrcweir 
816cdf0e10cSrcweir void ViewShell::Resize (void)
817cdf0e10cSrcweir {
818cdf0e10cSrcweir 	SetupRulers ();
819cdf0e10cSrcweir 
820cdf0e10cSrcweir     if (mpParentWindow == NULL)
821cdf0e10cSrcweir         return;
822cdf0e10cSrcweir 
823cdf0e10cSrcweir     // Make sure that the new size is not degenerate.
824cdf0e10cSrcweir     const Size aSize (mpParentWindow->GetSizePixel());
825cdf0e10cSrcweir 	if (aSize.Width()==0 || aSize.Height()==0)
826cdf0e10cSrcweir 		return;
827cdf0e10cSrcweir 
828cdf0e10cSrcweir     // Remember the new position and size.
829cdf0e10cSrcweir 	maViewPos = Point(0,0); //mpParentWindow->GetPosPixel();
830cdf0e10cSrcweir 	maViewSize = aSize;
831cdf0e10cSrcweir 
832cdf0e10cSrcweir     // Rearrange the UI elements to take care of the new position and size.
833cdf0e10cSrcweir     ArrangeGUIElements ();
834cdf0e10cSrcweir     // end of included AdjustPosSizePixel.
835cdf0e10cSrcweir 
836cdf0e10cSrcweir     Size aS (GetParentWindow()->GetOutputSizePixel());
837cdf0e10cSrcweir 	Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
838cdf0e10cSrcweir 	Rectangle aVisArea = GetParentWindow()->PixelToLogic(
839cdf0e10cSrcweir         Rectangle( Point(0,0), aVisSizePixel));
840cdf0e10cSrcweir     Rectangle aCurrentVisArea (GetDocSh()->GetVisArea(ASPECT_CONTENT));
841cdf0e10cSrcweir     Rectangle aWindowRect = GetActiveWindow()->LogicToPixel(aCurrentVisArea);
842cdf0e10cSrcweir 	if (GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED
843cdf0e10cSrcweir         && IsMainViewShell())
844cdf0e10cSrcweir 	{
845cdf0e10cSrcweir         //        GetDocSh()->SetVisArea(aVisArea);
846cdf0e10cSrcweir 	}
847cdf0e10cSrcweir 
848cdf0e10cSrcweir     //	VisAreaChanged(aVisArea);
849cdf0e10cSrcweir 
850cdf0e10cSrcweir 	::sd::View* pView = GetView();
851cdf0e10cSrcweir 
852cdf0e10cSrcweir 	if (pView)
853cdf0e10cSrcweir 	{
854cdf0e10cSrcweir 		pView->VisAreaChanged(GetActiveWindow());
855cdf0e10cSrcweir 	}
856cdf0e10cSrcweir }
857cdf0e10cSrcweir 
858cdf0e10cSrcweir SvBorder ViewShell::GetBorder (bool )
859cdf0e10cSrcweir {
860cdf0e10cSrcweir     SvBorder aBorder;
861cdf0e10cSrcweir 
862cdf0e10cSrcweir 	// Horizontal scrollbar.
863cdf0e10cSrcweir     if (mpHorizontalScrollBar.get()!=NULL
864cdf0e10cSrcweir         && mpHorizontalScrollBar->IsVisible())
865cdf0e10cSrcweir     {
866cdf0e10cSrcweir         aBorder.Bottom() = maScrBarWH.Height();
867cdf0e10cSrcweir     }
868cdf0e10cSrcweir 
869cdf0e10cSrcweir 	// Vertical scrollbar.
870cdf0e10cSrcweir     if (mpVerticalScrollBar.get()!=NULL
871cdf0e10cSrcweir         && mpVerticalScrollBar->IsVisible())
872cdf0e10cSrcweir     {
873cdf0e10cSrcweir         aBorder.Right() = maScrBarWH.Width();
874cdf0e10cSrcweir     }
875cdf0e10cSrcweir 
876cdf0e10cSrcweir     // Place horizontal ruler below tab bar.
877cdf0e10cSrcweir     if (mbHasRulers && mpContentWindow.get() != NULL)
878cdf0e10cSrcweir     {
879cdf0e10cSrcweir         SetupRulers();
880cdf0e10cSrcweir         if (mpHorizontalRuler.get() != NULL)
881cdf0e10cSrcweir             aBorder.Top() = mpHorizontalRuler->GetSizePixel().Height();
882cdf0e10cSrcweir         if (mpVerticalRuler.get() != NULL)
883cdf0e10cSrcweir             aBorder.Left() = mpVerticalRuler->GetSizePixel().Width();
884cdf0e10cSrcweir     }
885cdf0e10cSrcweir 
886cdf0e10cSrcweir     return aBorder;
887cdf0e10cSrcweir }
888cdf0e10cSrcweir 
889cdf0e10cSrcweir 
890cdf0e10cSrcweir 
891cdf0e10cSrcweir 
892cdf0e10cSrcweir void ViewShell::ArrangeGUIElements (void)
893cdf0e10cSrcweir {
894cdf0e10cSrcweir     if (mpImpl->mbArrangeActive)
895cdf0e10cSrcweir         return;
896cdf0e10cSrcweir     mpImpl->mbArrangeActive = true;
897cdf0e10cSrcweir 
898cdf0e10cSrcweir     // Calculate border for in-place editing.
899cdf0e10cSrcweir 	long nLeft = maViewPos.X();
900cdf0e10cSrcweir 	long nTop  = maViewPos.Y();
901cdf0e10cSrcweir 	long nRight = maViewPos.X() + maViewSize.Width();
902cdf0e10cSrcweir 	long nBottom = maViewPos.Y() + maViewSize.Height();
903cdf0e10cSrcweir 
904cdf0e10cSrcweir 	// Horizontal scrollbar.
905cdf0e10cSrcweir     if (mpHorizontalScrollBar.get()!=NULL
906cdf0e10cSrcweir         && mpHorizontalScrollBar->IsVisible())
907cdf0e10cSrcweir     {
908cdf0e10cSrcweir         int nLocalLeft = nLeft;
909cdf0e10cSrcweir         if (mpLayerTabBar.get()!=NULL && mpLayerTabBar->IsVisible())
910cdf0e10cSrcweir             nLocalLeft += mpLayerTabBar->GetSizePixel().Width();
911cdf0e10cSrcweir         nBottom -= maScrBarWH.Height();
912cdf0e10cSrcweir         mpHorizontalScrollBar->SetPosSizePixel (
913cdf0e10cSrcweir             Point(nLocalLeft,nBottom),
914cdf0e10cSrcweir             Size(nRight-nLocalLeft-maScrBarWH.Width(),maScrBarWH.Height()));
915cdf0e10cSrcweir     }
916cdf0e10cSrcweir 
917cdf0e10cSrcweir 	// Vertical scrollbar.
918cdf0e10cSrcweir     if (mpVerticalScrollBar.get()!=NULL
919cdf0e10cSrcweir         && mpVerticalScrollBar->IsVisible())
920cdf0e10cSrcweir     {
921cdf0e10cSrcweir         nRight -= maScrBarWH.Width();
922cdf0e10cSrcweir         mpVerticalScrollBar->SetPosSizePixel (
923cdf0e10cSrcweir             Point(nRight,nTop),
924cdf0e10cSrcweir             Size (maScrBarWH.Width(),nBottom-nTop));
925cdf0e10cSrcweir     }
926cdf0e10cSrcweir 
927cdf0e10cSrcweir     // Filler in the lower right corner.
928cdf0e10cSrcweir     if (mpScrollBarBox.get() != NULL)
929cdf0e10cSrcweir     {
930cdf0e10cSrcweir         if (mpHorizontalScrollBar.get()!=NULL
931cdf0e10cSrcweir             && mpHorizontalScrollBar->IsVisible()
932cdf0e10cSrcweir             && mpVerticalScrollBar.get()!=NULL
933cdf0e10cSrcweir             && mpVerticalScrollBar->IsVisible())
934cdf0e10cSrcweir         {
935cdf0e10cSrcweir             mpScrollBarBox->Show();
936cdf0e10cSrcweir             mpScrollBarBox->SetPosSizePixel(Point(nRight, nBottom), maScrBarWH);
937cdf0e10cSrcweir         }
938cdf0e10cSrcweir         else
939cdf0e10cSrcweir             mpScrollBarBox->Hide();
940cdf0e10cSrcweir     }
941cdf0e10cSrcweir 
942cdf0e10cSrcweir     // Place horizontal ruler below tab bar.
943cdf0e10cSrcweir     if (mbHasRulers && mpContentWindow.get() != NULL)
944cdf0e10cSrcweir     {
945cdf0e10cSrcweir         if (mpHorizontalRuler.get() != NULL)
946cdf0e10cSrcweir         {
947cdf0e10cSrcweir             Size aRulerSize = mpHorizontalRuler->GetSizePixel();
948cdf0e10cSrcweir             aRulerSize.Width() = nRight - nLeft;
949cdf0e10cSrcweir             mpHorizontalRuler->SetPosSizePixel (
950cdf0e10cSrcweir                 Point(nLeft,nTop), aRulerSize);
951cdf0e10cSrcweir             if (mpVerticalRuler.get() != NULL)
952cdf0e10cSrcweir                 mpHorizontalRuler->SetBorderPos(
953cdf0e10cSrcweir                     mpVerticalRuler->GetSizePixel().Width()-1);
954cdf0e10cSrcweir             nTop += aRulerSize.Height();
955cdf0e10cSrcweir         }
956cdf0e10cSrcweir         if (mpVerticalRuler.get() != NULL)
957cdf0e10cSrcweir         {
958cdf0e10cSrcweir             Size aRulerSize = mpVerticalRuler->GetSizePixel();
959cdf0e10cSrcweir             aRulerSize.Height() = nBottom  - nTop;
960cdf0e10cSrcweir             mpVerticalRuler->SetPosSizePixel (
961cdf0e10cSrcweir                 Point (nLeft,nTop), aRulerSize);
962cdf0e10cSrcweir             nLeft += aRulerSize.Width();
963cdf0e10cSrcweir         }
964cdf0e10cSrcweir     }
965cdf0e10cSrcweir 
966cdf0e10cSrcweir 	rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) );
967cdf0e10cSrcweir 
968cdf0e10cSrcweir     // The size of the window of the center pane is set differently from
969cdf0e10cSrcweir     // that of the windows in the docking windows.
970cdf0e10cSrcweir     bool bSlideShowActive = (xSlideShow.is() && xSlideShow->isRunning()) && !xSlideShow->isFullScreen() && xSlideShow->getAnimationMode() == ANIMATIONMODE_SHOW;
971cdf0e10cSrcweir     if ( !bSlideShowActive)
972cdf0e10cSrcweir     {
973cdf0e10cSrcweir         OSL_ASSERT (GetViewShell()!=NULL);
974cdf0e10cSrcweir 
975*7a32b0c8SAndre Fischer         if (mpContentWindow)
976*7a32b0c8SAndre Fischer             mpContentWindow->SetPosSizePixel(
977*7a32b0c8SAndre Fischer                 Point(nLeft,nTop),
978*7a32b0c8SAndre Fischer                 Size(nRight-nLeft,nBottom-nTop));
979cdf0e10cSrcweir     }
980cdf0e10cSrcweir 
981cdf0e10cSrcweir     // Windows in the center and rulers at the left and top side.
982cdf0e10cSrcweir 	maAllWindowRectangle = Rectangle(
983cdf0e10cSrcweir         maViewPos,
984cdf0e10cSrcweir         Size(maViewSize.Width()-maScrBarWH.Width(),
985cdf0e10cSrcweir             maViewSize.Height()-maScrBarWH.Height()));
986cdf0e10cSrcweir 
987cdf0e10cSrcweir     if (mpContentWindow.get() != NULL)
988cdf0e10cSrcweir     {
989cdf0e10cSrcweir         mpContentWindow->UpdateMapOrigin();
990cdf0e10cSrcweir     }
991cdf0e10cSrcweir 
992cdf0e10cSrcweir     UpdateScrollBars();
993cdf0e10cSrcweir 
994cdf0e10cSrcweir     mpImpl->mbArrangeActive = false;
995cdf0e10cSrcweir }
996cdf0e10cSrcweir 
997cdf0e10cSrcweir 
998cdf0e10cSrcweir 
999cdf0e10cSrcweir 
1000cdf0e10cSrcweir void ViewShell::SetUIUnit(FieldUnit eUnit)
1001cdf0e10cSrcweir {
1002cdf0e10cSrcweir     // Set unit at horizontal and vertical rulers.
1003cdf0e10cSrcweir     if (mpHorizontalRuler.get() != NULL)
1004cdf0e10cSrcweir         mpHorizontalRuler->SetUnit(eUnit);
1005cdf0e10cSrcweir 
1006cdf0e10cSrcweir 
1007cdf0e10cSrcweir 	if (mpVerticalRuler.get() != NULL)
1008cdf0e10cSrcweir         mpVerticalRuler->SetUnit(eUnit);
1009cdf0e10cSrcweir }
1010cdf0e10cSrcweir 
1011cdf0e10cSrcweir /*************************************************************************
1012cdf0e10cSrcweir |*
1013cdf0e10cSrcweir |* DefTab an den horizontalen Linealen setzen
1014cdf0e10cSrcweir |*
1015cdf0e10cSrcweir \************************************************************************/
1016cdf0e10cSrcweir void ViewShell::SetDefTabHRuler( sal_uInt16 nDefTab )
1017cdf0e10cSrcweir {
1018cdf0e10cSrcweir     if (mpHorizontalRuler.get() != NULL)
1019cdf0e10cSrcweir         mpHorizontalRuler->SetDefTabDist( nDefTab );
1020cdf0e10cSrcweir }
1021cdf0e10cSrcweir 
1022cdf0e10cSrcweir 
1023cdf0e10cSrcweir 
1024cdf0e10cSrcweir 
1025cdf0e10cSrcweir /** Tell the FmFormShell that the view shell is closing.  Give it the
1026cdf0e10cSrcweir     oportunity to prevent that.
1027cdf0e10cSrcweir */
1028cdf0e10cSrcweir sal_uInt16 ViewShell::PrepareClose (sal_Bool bUI, sal_Bool bForBrowsing)
1029cdf0e10cSrcweir {
1030cdf0e10cSrcweir     sal_uInt16 nResult = sal_True;
1031cdf0e10cSrcweir 
1032cdf0e10cSrcweir     FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell();
1033cdf0e10cSrcweir     if (pFormShell != NULL)
1034cdf0e10cSrcweir         nResult = pFormShell->PrepareClose (bUI, bForBrowsing);
1035cdf0e10cSrcweir 
1036cdf0e10cSrcweir 	return nResult;
1037cdf0e10cSrcweir }
1038cdf0e10cSrcweir 
1039cdf0e10cSrcweir 
1040cdf0e10cSrcweir 
1041cdf0e10cSrcweir 
1042cdf0e10cSrcweir void ViewShell::UpdatePreview (SdPage*, sal_Bool )
1043cdf0e10cSrcweir {
1044cdf0e10cSrcweir     // Do nothing.  After the actual preview has been removed,
1045cdf0e10cSrcweir     // OutlineViewShell::UpdatePreview() is the place where something
1046cdf0e10cSrcweir     // usefull is still done.
1047cdf0e10cSrcweir }
1048cdf0e10cSrcweir 
1049cdf0e10cSrcweir ::svl::IUndoManager* ViewShell::ImpGetUndoManager (void) const
1050cdf0e10cSrcweir {
1051cdf0e10cSrcweir 	const ViewShell* pMainViewShell = GetViewShellBase().GetMainViewShell().get();
1052cdf0e10cSrcweir 
1053cdf0e10cSrcweir 	if( pMainViewShell == 0 )
1054cdf0e10cSrcweir 		pMainViewShell = this;
1055cdf0e10cSrcweir 
1056cdf0e10cSrcweir 	::sd::View* pView = pMainViewShell->GetView();
1057cdf0e10cSrcweir 
1058cdf0e10cSrcweir 	// check for text edit our outline view
1059cdf0e10cSrcweir 	if( pView )
1060cdf0e10cSrcweir 	{
1061cdf0e10cSrcweir 		if( pMainViewShell->GetShellType() == ViewShell::ST_OUTLINE )
1062cdf0e10cSrcweir 		{
1063cdf0e10cSrcweir 			OutlineView* pOlView = dynamic_cast< OutlineView* >( pView );
1064cdf0e10cSrcweir 			if( pOlView )
1065cdf0e10cSrcweir 			{
1066cdf0e10cSrcweir 				::Outliner* pOutl = pOlView->GetOutliner();
1067cdf0e10cSrcweir 				if( pOutl )
1068cdf0e10cSrcweir 					return &pOutl->GetUndoManager();
1069cdf0e10cSrcweir 			}
1070cdf0e10cSrcweir 		}
1071cdf0e10cSrcweir 		else if( pView->IsTextEdit() )
1072cdf0e10cSrcweir 		{
1073cdf0e10cSrcweir 			SdrOutliner* pOL = pView->GetTextEditOutliner();
1074cdf0e10cSrcweir 			if( pOL )
1075cdf0e10cSrcweir 				return &pOL->GetUndoManager();
1076cdf0e10cSrcweir 		}
1077cdf0e10cSrcweir 	}
1078cdf0e10cSrcweir 
1079cdf0e10cSrcweir 	if( GetDocSh() )
1080cdf0e10cSrcweir 		return GetDocSh()->GetUndoManager();
1081cdf0e10cSrcweir 
1082cdf0e10cSrcweir 	return NULL;
1083cdf0e10cSrcweir }
1084cdf0e10cSrcweir 
1085cdf0e10cSrcweir 
1086cdf0e10cSrcweir 
1087cdf0e10cSrcweir 
1088cdf0e10cSrcweir void ViewShell::ImpGetUndoStrings(SfxItemSet &rSet) const
1089cdf0e10cSrcweir {
1090cdf0e10cSrcweir 	::svl::IUndoManager* pUndoManager = ImpGetUndoManager();
1091cdf0e10cSrcweir 	if(pUndoManager)
1092cdf0e10cSrcweir 	{
1093cdf0e10cSrcweir 		sal_uInt16 nCount(pUndoManager->GetUndoActionCount());
1094cdf0e10cSrcweir 		if(nCount)
1095cdf0e10cSrcweir 		{
1096cdf0e10cSrcweir 			// prepare list
1097cdf0e10cSrcweir 			List aStringList;
1098cdf0e10cSrcweir 			sal_uInt16 a;
1099cdf0e10cSrcweir 
1100cdf0e10cSrcweir 			for( a = 0; a < nCount; a++)
1101cdf0e10cSrcweir 			{
1102cdf0e10cSrcweir 				// generate one String in list per undo step
1103cdf0e10cSrcweir 				String* pInsertString = new String(pUndoManager->GetUndoActionComment(a));
1104cdf0e10cSrcweir 				aStringList.Insert(pInsertString, LIST_APPEND);
1105cdf0e10cSrcweir 			}
1106cdf0e10cSrcweir 
1107cdf0e10cSrcweir 			// set item
1108cdf0e10cSrcweir 			rSet.Put(SfxStringListItem(SID_GETUNDOSTRINGS, &aStringList));
1109cdf0e10cSrcweir 
1110cdf0e10cSrcweir 			// delete Strings again
1111cdf0e10cSrcweir 			for(a = 0; a < nCount; a++)
1112cdf0e10cSrcweir 				delete (String*)aStringList.GetObject(a);
1113cdf0e10cSrcweir 		}
1114cdf0e10cSrcweir 		else
1115cdf0e10cSrcweir 		{
1116cdf0e10cSrcweir 			rSet.DisableItem(SID_GETUNDOSTRINGS);
1117cdf0e10cSrcweir 		}
1118cdf0e10cSrcweir 	}
1119cdf0e10cSrcweir }
1120cdf0e10cSrcweir 
1121cdf0e10cSrcweir // -----------------------------------------------------------------------------
1122cdf0e10cSrcweir 
1123cdf0e10cSrcweir void ViewShell::ImpGetRedoStrings(SfxItemSet &rSet) const
1124cdf0e10cSrcweir {
1125cdf0e10cSrcweir 	::svl::IUndoManager* pUndoManager = ImpGetUndoManager();
1126cdf0e10cSrcweir 	if(pUndoManager)
1127cdf0e10cSrcweir 	{
1128cdf0e10cSrcweir 		sal_uInt16 nCount(pUndoManager->GetRedoActionCount());
1129cdf0e10cSrcweir 		if(nCount)
1130cdf0e10cSrcweir 		{
1131cdf0e10cSrcweir 			// prepare list
1132cdf0e10cSrcweir 			List aStringList;
1133cdf0e10cSrcweir 			sal_uInt16 a;
1134cdf0e10cSrcweir 
1135cdf0e10cSrcweir 			for( a = 0; a < nCount; a++)
1136cdf0e10cSrcweir 			{
1137cdf0e10cSrcweir 				// generate one String in list per undo step
1138cdf0e10cSrcweir 				String* pInsertString = new String(pUndoManager->GetRedoActionComment(a));
1139cdf0e10cSrcweir 				aStringList.Insert(pInsertString, LIST_APPEND);
1140cdf0e10cSrcweir 			}
1141cdf0e10cSrcweir 
1142cdf0e10cSrcweir 			// set item
1143cdf0e10cSrcweir 			rSet.Put(SfxStringListItem(SID_GETREDOSTRINGS, &aStringList));
1144cdf0e10cSrcweir 
1145cdf0e10cSrcweir 			// delete Strings again
1146cdf0e10cSrcweir 			for(a = 0; a < nCount; a++)
1147cdf0e10cSrcweir 				delete (String*)aStringList.GetObject(a);
1148cdf0e10cSrcweir 		}
1149cdf0e10cSrcweir 		else
1150cdf0e10cSrcweir 		{
1151cdf0e10cSrcweir 			rSet.DisableItem(SID_GETREDOSTRINGS);
1152cdf0e10cSrcweir 		}
1153cdf0e10cSrcweir 	}
1154cdf0e10cSrcweir }
1155cdf0e10cSrcweir 
1156cdf0e10cSrcweir // -----------------------------------------------------------------------------
1157cdf0e10cSrcweir 
1158cdf0e10cSrcweir void ViewShell::ImpSidUndo(sal_Bool, SfxRequest& rReq)
1159cdf0e10cSrcweir {
1160cdf0e10cSrcweir 	::svl::IUndoManager* pUndoManager = ImpGetUndoManager();
1161cdf0e10cSrcweir 	sal_uInt16 nNumber(1);
1162cdf0e10cSrcweir 	const SfxItemSet* pReqArgs = rReq.GetArgs();
1163cdf0e10cSrcweir 
1164cdf0e10cSrcweir 	if(pReqArgs)
1165cdf0e10cSrcweir 	{
1166cdf0e10cSrcweir 		SfxUInt16Item* pUIntItem = (SfxUInt16Item*)&pReqArgs->Get(SID_UNDO);
1167cdf0e10cSrcweir 		nNumber = pUIntItem->GetValue();
1168cdf0e10cSrcweir 	}
1169cdf0e10cSrcweir 
1170cdf0e10cSrcweir 	if(nNumber && pUndoManager)
1171cdf0e10cSrcweir 	{
1172cdf0e10cSrcweir 		sal_uInt16 nCount(pUndoManager->GetUndoActionCount());
1173cdf0e10cSrcweir 		if(nCount >= nNumber)
1174cdf0e10cSrcweir 		{
1175cdf0e10cSrcweir             try
1176cdf0e10cSrcweir             {
1177cdf0e10cSrcweir 			    // #94637# when UndoStack is cleared by ModifyPageUndoAction
1178cdf0e10cSrcweir 			    // the nCount may have changed, so test GetUndoActionCount()
1179cdf0e10cSrcweir 			    while(nNumber-- && pUndoManager->GetUndoActionCount())
1180cdf0e10cSrcweir 			    {
1181cdf0e10cSrcweir 				    pUndoManager->Undo();
1182cdf0e10cSrcweir 			    }
1183cdf0e10cSrcweir             }
1184cdf0e10cSrcweir             catch( const Exception& e )
1185cdf0e10cSrcweir             {
1186cdf0e10cSrcweir                 // no need to handle. By definition, the UndoManager handled this by clearing the
1187cdf0e10cSrcweir                 // Undo/Redo stacks
1188cdf0e10cSrcweir             }
1189cdf0e10cSrcweir 		}
1190cdf0e10cSrcweir 
1191cdf0e10cSrcweir 		// #91081# refresh rulers, maybe UNDO was move of TAB marker in ruler
1192cdf0e10cSrcweir 		if (mbHasRulers)
1193cdf0e10cSrcweir 		{
1194cdf0e10cSrcweir 			Invalidate(SID_ATTR_TABSTOP);
1195cdf0e10cSrcweir 		}
1196cdf0e10cSrcweir 	}
1197cdf0e10cSrcweir 
1198cdf0e10cSrcweir 	// This one is corresponding to the default handling
1199cdf0e10cSrcweir 	// of SID_UNDO in sfx2
1200cdf0e10cSrcweir 	GetViewFrame()->GetBindings().InvalidateAll(sal_False);
1201cdf0e10cSrcweir 
1202cdf0e10cSrcweir 	rReq.Done();
1203cdf0e10cSrcweir }
1204cdf0e10cSrcweir 
1205cdf0e10cSrcweir // -----------------------------------------------------------------------------
1206cdf0e10cSrcweir 
1207cdf0e10cSrcweir void ViewShell::ImpSidRedo(sal_Bool, SfxRequest& rReq)
1208cdf0e10cSrcweir {
1209cdf0e10cSrcweir 	::svl::IUndoManager* pUndoManager = ImpGetUndoManager();
1210cdf0e10cSrcweir 	sal_uInt16 nNumber(1);
1211cdf0e10cSrcweir 	const SfxItemSet* pReqArgs = rReq.GetArgs();
1212cdf0e10cSrcweir 
1213cdf0e10cSrcweir 	if(pReqArgs)
1214cdf0e10cSrcweir 	{
1215cdf0e10cSrcweir 		SfxUInt16Item* pUIntItem = (SfxUInt16Item*)&pReqArgs->Get(SID_REDO);
1216cdf0e10cSrcweir 		nNumber = pUIntItem->GetValue();
1217cdf0e10cSrcweir 	}
1218cdf0e10cSrcweir 
1219cdf0e10cSrcweir 	if(nNumber && pUndoManager)
1220cdf0e10cSrcweir 	{
1221cdf0e10cSrcweir 		sal_uInt16 nCount(pUndoManager->GetRedoActionCount());
1222cdf0e10cSrcweir 		if(nCount >= nNumber)
1223cdf0e10cSrcweir 		{
1224cdf0e10cSrcweir             try
1225cdf0e10cSrcweir             {
1226cdf0e10cSrcweir 			    // #94637# when UndoStack is cleared by ModifyPageRedoAction
1227cdf0e10cSrcweir 			    // the nCount may have changed, so test GetRedoActionCount()
1228cdf0e10cSrcweir 			    while(nNumber-- && pUndoManager->GetRedoActionCount())
1229cdf0e10cSrcweir 			    {
1230cdf0e10cSrcweir 				    pUndoManager->Redo();
1231cdf0e10cSrcweir 			    }
1232cdf0e10cSrcweir             }
1233cdf0e10cSrcweir             catch( const Exception& e )
1234cdf0e10cSrcweir             {
1235cdf0e10cSrcweir                 // no need to handle. By definition, the UndoManager handled this by clearing the
1236cdf0e10cSrcweir                 // Undo/Redo stacks
1237cdf0e10cSrcweir             }
1238cdf0e10cSrcweir 		}
1239cdf0e10cSrcweir 
1240cdf0e10cSrcweir 		// #91081# refresh rulers, maybe REDO was move of TAB marker in ruler
1241cdf0e10cSrcweir 		if (mbHasRulers)
1242cdf0e10cSrcweir 		{
1243cdf0e10cSrcweir 			Invalidate(SID_ATTR_TABSTOP);
1244cdf0e10cSrcweir 		}
1245cdf0e10cSrcweir 	}
1246cdf0e10cSrcweir 
1247cdf0e10cSrcweir 	// This one is corresponding to the default handling
1248cdf0e10cSrcweir 	// of SID_UNDO in sfx2
1249cdf0e10cSrcweir 	GetViewFrame()->GetBindings().InvalidateAll(sal_False);
1250cdf0e10cSrcweir 
1251cdf0e10cSrcweir 	rReq.Done();
1252cdf0e10cSrcweir }
1253cdf0e10cSrcweir 
1254cdf0e10cSrcweir // -----------------------------------------------------------------------------
1255cdf0e10cSrcweir 
1256cdf0e10cSrcweir void ViewShell::ExecReq( SfxRequest& rReq )
1257cdf0e10cSrcweir {
1258cdf0e10cSrcweir     sal_uInt16 nSlot = rReq.GetSlot();
1259cdf0e10cSrcweir     switch( nSlot )
1260cdf0e10cSrcweir     {
1261cdf0e10cSrcweir 		case SID_MAIL_SCROLLBODY_PAGEDOWN:
1262cdf0e10cSrcweir 		{
1263cdf0e10cSrcweir 			FunctionReference xFunc( GetCurrentFunction() );
1264cdf0e10cSrcweir 			if( xFunc.is() )
1265cdf0e10cSrcweir 			{
1266cdf0e10cSrcweir 				xFunc->ScrollStart();
1267cdf0e10cSrcweir 				ScrollLines( 0, -1 );
1268cdf0e10cSrcweir 				xFunc->ScrollEnd();
1269cdf0e10cSrcweir 			}
1270cdf0e10cSrcweir 
1271cdf0e10cSrcweir             rReq.Done();
1272cdf0e10cSrcweir 		}
1273cdf0e10cSrcweir 		break;
1274cdf0e10cSrcweir 
1275cdf0e10cSrcweir 		case SID_OUTPUT_QUALITY_COLOR:
1276cdf0e10cSrcweir 		case SID_OUTPUT_QUALITY_GRAYSCALE:
1277cdf0e10cSrcweir 		case SID_OUTPUT_QUALITY_BLACKWHITE:
1278cdf0e10cSrcweir 		case SID_OUTPUT_QUALITY_CONTRAST:
1279cdf0e10cSrcweir 		{
1280cdf0e10cSrcweir 			sal_uLong nMode = OUTPUT_DRAWMODE_COLOR;
1281cdf0e10cSrcweir 
1282cdf0e10cSrcweir             switch( nSlot )
1283cdf0e10cSrcweir 			{
1284cdf0e10cSrcweir 			    case SID_OUTPUT_QUALITY_COLOR: nMode = OUTPUT_DRAWMODE_COLOR; break;
1285cdf0e10cSrcweir 			    case SID_OUTPUT_QUALITY_GRAYSCALE: nMode = OUTPUT_DRAWMODE_GRAYSCALE; break;
1286cdf0e10cSrcweir 			    case SID_OUTPUT_QUALITY_BLACKWHITE: nMode = OUTPUT_DRAWMODE_BLACKWHITE; break;
1287cdf0e10cSrcweir 			    case SID_OUTPUT_QUALITY_CONTRAST: nMode = OUTPUT_DRAWMODE_CONTRAST; break;
1288cdf0e10cSrcweir 			}
1289cdf0e10cSrcweir 
1290cdf0e10cSrcweir 			GetActiveWindow()->SetDrawMode( nMode );
1291cdf0e10cSrcweir             mpFrameView->SetDrawMode( nMode );
1292cdf0e10cSrcweir // #110094#-7
1293cdf0e10cSrcweir //            GetView()->ReleaseMasterPagePaintCache();
1294cdf0e10cSrcweir 			GetActiveWindow()->Invalidate();
1295cdf0e10cSrcweir 
1296cdf0e10cSrcweir 			Invalidate();
1297cdf0e10cSrcweir 			rReq.Done();
1298cdf0e10cSrcweir 			break;
1299cdf0e10cSrcweir 		}
1300cdf0e10cSrcweir     }
1301cdf0e10cSrcweir }
1302cdf0e10cSrcweir 
1303cdf0e10cSrcweir 
1304cdf0e10cSrcweir 
1305cdf0e10cSrcweir 
1306cdf0e10cSrcweir /** This default implemenation returns only an empty reference.  See derived
1307cdf0e10cSrcweir     classes for more interesting examples.
1308cdf0e10cSrcweir */
1309cdf0e10cSrcweir ::com::sun::star::uno::Reference<
1310cdf0e10cSrcweir     ::com::sun::star::accessibility::XAccessible>
1311cdf0e10cSrcweir ViewShell::CreateAccessibleDocumentView (::sd::Window* )
1312cdf0e10cSrcweir {
1313cdf0e10cSrcweir     return ::com::sun::star::uno::Reference<
1314cdf0e10cSrcweir         ::com::sun::star::accessibility::XAccessible> ();
1315cdf0e10cSrcweir }
1316cdf0e10cSrcweir 
1317cdf0e10cSrcweir 
1318cdf0e10cSrcweir 
1319cdf0e10cSrcweir ::sd::WindowUpdater* ViewShell::GetWindowUpdater (void) const
1320cdf0e10cSrcweir {
1321cdf0e10cSrcweir     return mpWindowUpdater.get();
1322cdf0e10cSrcweir }
1323cdf0e10cSrcweir 
1324cdf0e10cSrcweir 
1325cdf0e10cSrcweir 
1326cdf0e10cSrcweir 
1327cdf0e10cSrcweir ViewShellBase& ViewShell::GetViewShellBase (void) const
1328cdf0e10cSrcweir {
1329cdf0e10cSrcweir     return *static_cast<ViewShellBase*>(GetViewShell());
1330cdf0e10cSrcweir }
1331cdf0e10cSrcweir 
1332cdf0e10cSrcweir 
1333cdf0e10cSrcweir 
1334cdf0e10cSrcweir 
1335cdf0e10cSrcweir ViewShell::ShellType ViewShell::GetShellType (void) const
1336cdf0e10cSrcweir {
1337cdf0e10cSrcweir     return meShellType;
1338cdf0e10cSrcweir }
1339cdf0e10cSrcweir 
1340cdf0e10cSrcweir 
1341cdf0e10cSrcweir 
1342cdf0e10cSrcweir 
1343cdf0e10cSrcweir DrawDocShell* ViewShell::GetDocSh (void) const
1344cdf0e10cSrcweir {
1345cdf0e10cSrcweir     return GetViewShellBase().GetDocShell();
1346cdf0e10cSrcweir }
1347cdf0e10cSrcweir 
1348cdf0e10cSrcweir 
1349cdf0e10cSrcweir 
1350cdf0e10cSrcweir 
1351cdf0e10cSrcweir SdDrawDocument* ViewShell::GetDoc (void) const
1352cdf0e10cSrcweir {
1353cdf0e10cSrcweir     return GetViewShellBase().GetDocument();
1354cdf0e10cSrcweir }
1355cdf0e10cSrcweir 
1356cdf0e10cSrcweir ErrCode ViewShell::DoVerb (long )
1357cdf0e10cSrcweir {
1358cdf0e10cSrcweir     return ERRCODE_NONE;
1359cdf0e10cSrcweir }
1360cdf0e10cSrcweir 
1361cdf0e10cSrcweir void ViewShell::SetCurrentFunction( const FunctionReference& xFunction)
1362cdf0e10cSrcweir {
1363cdf0e10cSrcweir 	if( mxCurrentFunction.is() && (mxOldFunction != mxCurrentFunction) )
1364cdf0e10cSrcweir 		mxCurrentFunction->Dispose();
1365cdf0e10cSrcweir 	FunctionReference xTemp( mxCurrentFunction );
1366cdf0e10cSrcweir     mxCurrentFunction = xFunction;
1367cdf0e10cSrcweir }
1368cdf0e10cSrcweir 
1369cdf0e10cSrcweir void ViewShell::SetOldFunction(const FunctionReference& xFunction)
1370cdf0e10cSrcweir {
1371cdf0e10cSrcweir 	if( mxOldFunction.is() && (xFunction != mxOldFunction) && (mxCurrentFunction != mxOldFunction) )
1372cdf0e10cSrcweir 		mxOldFunction->Dispose();
1373cdf0e10cSrcweir 
1374cdf0e10cSrcweir 	FunctionReference xTemp( mxOldFunction );
1375cdf0e10cSrcweir     mxOldFunction = xFunction;
1376cdf0e10cSrcweir }
1377cdf0e10cSrcweir 
1378cdf0e10cSrcweir /** this method deactivates the current function. If an old function is
1379cdf0e10cSrcweir 	saved, this will become activated and current function.
1380cdf0e10cSrcweir */
1381cdf0e10cSrcweir void ViewShell::Cancel()
1382cdf0e10cSrcweir {
1383cdf0e10cSrcweir 	if(mxCurrentFunction.is() && (mxCurrentFunction != mxOldFunction ))
1384cdf0e10cSrcweir 	{
1385cdf0e10cSrcweir 		FunctionReference xTemp( mxCurrentFunction );
1386cdf0e10cSrcweir 		mxCurrentFunction.clear();
1387cdf0e10cSrcweir 		xTemp->Deactivate();
1388cdf0e10cSrcweir 		xTemp->Dispose();
1389cdf0e10cSrcweir 	}
1390cdf0e10cSrcweir 
1391cdf0e10cSrcweir 	if(mxOldFunction.is())
1392cdf0e10cSrcweir 	{
1393cdf0e10cSrcweir 		mxCurrentFunction = mxOldFunction;
1394cdf0e10cSrcweir 		mxCurrentFunction->Activate();
1395cdf0e10cSrcweir 	}
1396cdf0e10cSrcweir }
1397cdf0e10cSrcweir 
1398cdf0e10cSrcweir void ViewShell::DeactivateCurrentFunction( bool bPermanent /* == false */ )
1399cdf0e10cSrcweir {
1400cdf0e10cSrcweir 	if( mxCurrentFunction.is() )
1401cdf0e10cSrcweir 	{
1402cdf0e10cSrcweir 		if(bPermanent && (mxOldFunction == mxCurrentFunction))
1403cdf0e10cSrcweir 			mxOldFunction.clear();
1404cdf0e10cSrcweir 
1405cdf0e10cSrcweir 		mxCurrentFunction->Deactivate();
1406cdf0e10cSrcweir 		if( mxCurrentFunction != mxOldFunction )
1407cdf0e10cSrcweir 			mxCurrentFunction->Dispose();
1408cdf0e10cSrcweir 
1409cdf0e10cSrcweir 		FunctionReference xTemp( mxCurrentFunction );
1410cdf0e10cSrcweir 		mxCurrentFunction.clear();
1411cdf0e10cSrcweir 	}
1412cdf0e10cSrcweir }
1413cdf0e10cSrcweir 
1414cdf0e10cSrcweir void ViewShell::DisposeFunctions()
1415cdf0e10cSrcweir {
1416cdf0e10cSrcweir 	if(mxCurrentFunction.is())
1417cdf0e10cSrcweir 	{
1418cdf0e10cSrcweir 		FunctionReference xTemp( mxCurrentFunction );
1419cdf0e10cSrcweir 		mxCurrentFunction.clear();
1420cdf0e10cSrcweir 		xTemp->Deactivate();
1421cdf0e10cSrcweir 		xTemp->Dispose();
1422cdf0e10cSrcweir 	}
1423cdf0e10cSrcweir 
1424cdf0e10cSrcweir 	if(mxOldFunction.is())
1425cdf0e10cSrcweir 	{
1426cdf0e10cSrcweir 		FunctionReference xTemp( mxOldFunction );
1427cdf0e10cSrcweir 		mxOldFunction->Dispose();
1428cdf0e10cSrcweir 		mxOldFunction.clear();
1429cdf0e10cSrcweir 	}
1430cdf0e10cSrcweir }
1431cdf0e10cSrcweir 
1432cdf0e10cSrcweir bool ViewShell::IsMainViewShell (void) const
1433cdf0e10cSrcweir {
1434cdf0e10cSrcweir     return mpImpl->mbIsMainViewShell;
1435cdf0e10cSrcweir     //    return GetViewShellBase().GetMainViewShell() == this;
1436cdf0e10cSrcweir }
1437cdf0e10cSrcweir 
1438cdf0e10cSrcweir void ViewShell::SetIsMainViewShell (bool bIsMainViewShell)
1439cdf0e10cSrcweir {
1440cdf0e10cSrcweir     if (bIsMainViewShell != mpImpl->mbIsMainViewShell)
1441cdf0e10cSrcweir     {
1442cdf0e10cSrcweir         mpImpl->mbIsMainViewShell = bIsMainViewShell;
1443cdf0e10cSrcweir         if (bIsMainViewShell)
1444cdf0e10cSrcweir         {
1445cdf0e10cSrcweir             GetDocSh()->Connect (this);
1446cdf0e10cSrcweir         }
1447cdf0e10cSrcweir         else
1448cdf0e10cSrcweir         {
1449cdf0e10cSrcweir             GetDocSh()->Disconnect (this);
1450cdf0e10cSrcweir         }
1451cdf0e10cSrcweir     }
1452cdf0e10cSrcweir }
1453cdf0e10cSrcweir 
1454cdf0e10cSrcweir 
1455cdf0e10cSrcweir 
1456cdf0e10cSrcweir 
1457cdf0e10cSrcweir ::sd::Window* ViewShell::GetActiveWindow (void) const
1458cdf0e10cSrcweir {
1459cdf0e10cSrcweir     return mpActiveWindow;
1460cdf0e10cSrcweir }
1461cdf0e10cSrcweir 
1462cdf0e10cSrcweir 
1463cdf0e10cSrcweir 
1464cdf0e10cSrcweir 
1465cdf0e10cSrcweir void ViewShell::PrePaint()
1466cdf0e10cSrcweir {
1467cdf0e10cSrcweir }
1468cdf0e10cSrcweir 
1469cdf0e10cSrcweir 
1470cdf0e10cSrcweir 
1471cdf0e10cSrcweir 
1472cdf0e10cSrcweir void ViewShell::Paint (const Rectangle&, ::sd::Window* )
1473cdf0e10cSrcweir {
1474cdf0e10cSrcweir }
1475cdf0e10cSrcweir 
1476cdf0e10cSrcweir 
1477cdf0e10cSrcweir 
1478cdf0e10cSrcweir 
1479cdf0e10cSrcweir void ViewShell::Draw(OutputDevice &, const Region &)
1480cdf0e10cSrcweir {
1481cdf0e10cSrcweir }
1482cdf0e10cSrcweir 
1483cdf0e10cSrcweir 
1484cdf0e10cSrcweir 
1485cdf0e10cSrcweir 
1486cdf0e10cSrcweir ZoomList* ViewShell::GetZoomList (void)
1487cdf0e10cSrcweir {
1488cdf0e10cSrcweir     return mpZoomList;
1489cdf0e10cSrcweir }
1490cdf0e10cSrcweir 
1491cdf0e10cSrcweir 
1492cdf0e10cSrcweir 
1493cdf0e10cSrcweir 
1494cdf0e10cSrcweir void ViewShell::ShowUIControls (bool bVisible)
1495cdf0e10cSrcweir {
1496cdf0e10cSrcweir     mpImpl->mbIsShowingUIControls = bVisible;
1497cdf0e10cSrcweir 
1498cdf0e10cSrcweir 	if (mbHasRulers)
1499cdf0e10cSrcweir 	{
1500cdf0e10cSrcweir 		if (mpHorizontalRuler.get() != NULL)
1501cdf0e10cSrcweir 			mpHorizontalRuler->Show( bVisible );
1502cdf0e10cSrcweir 
1503cdf0e10cSrcweir 		if (mpVerticalRuler.get() != NULL)
1504cdf0e10cSrcweir             mpVerticalRuler->Show( bVisible );
1505cdf0e10cSrcweir 	}
1506cdf0e10cSrcweir 
1507cdf0e10cSrcweir 	if (mpVerticalScrollBar.get() != NULL)
1508cdf0e10cSrcweir 		mpVerticalScrollBar->Show( bVisible );
1509cdf0e10cSrcweir 
1510cdf0e10cSrcweir 	if (mpHorizontalScrollBar.get() != NULL)
1511cdf0e10cSrcweir 		mpHorizontalScrollBar->Show( bVisible );
1512cdf0e10cSrcweir 
1513cdf0e10cSrcweir 	if (mpScrollBarBox.get() != NULL)
1514cdf0e10cSrcweir         mpScrollBarBox->Show(bVisible);
1515cdf0e10cSrcweir 
1516cdf0e10cSrcweir     if (mpContentWindow.get() != NULL)
1517cdf0e10cSrcweir         mpContentWindow->Show( bVisible );
1518cdf0e10cSrcweir }
1519cdf0e10cSrcweir 
1520cdf0e10cSrcweir 
1521cdf0e10cSrcweir 
1522cdf0e10cSrcweir 
1523cdf0e10cSrcweir 
1524cdf0e10cSrcweir bool ViewShell::RelocateToParentWindow (::Window* pParentWindow)
1525cdf0e10cSrcweir {
1526cdf0e10cSrcweir     mpParentWindow = pParentWindow;
1527cdf0e10cSrcweir 
1528cdf0e10cSrcweir     mpParentWindow->SetBackground (Wallpaper());
1529cdf0e10cSrcweir 
1530cdf0e10cSrcweir     if (mpContentWindow.get() != NULL)
1531cdf0e10cSrcweir         mpContentWindow->SetParent(pParentWindow);
1532cdf0e10cSrcweir 
1533cdf0e10cSrcweir     if (mpHorizontalScrollBar.get() != NULL)
1534cdf0e10cSrcweir         mpHorizontalScrollBar->SetParent(mpParentWindow);
1535cdf0e10cSrcweir     if (mpVerticalScrollBar.get() != NULL)
1536cdf0e10cSrcweir         mpVerticalScrollBar->SetParent(mpParentWindow);
1537cdf0e10cSrcweir     if (mpScrollBarBox.get() != NULL)
1538cdf0e10cSrcweir         mpScrollBarBox->SetParent(mpParentWindow);
1539cdf0e10cSrcweir 
1540cdf0e10cSrcweir     return true;
1541cdf0e10cSrcweir }
1542cdf0e10cSrcweir 
1543cdf0e10cSrcweir 
1544cdf0e10cSrcweir 
1545cdf0e10cSrcweir } // end of namespace sd
1546cdf0e10cSrcweir 
1547cdf0e10cSrcweir 
1548cdf0e10cSrcweir 
1549cdf0e10cSrcweir 
1550cdf0e10cSrcweir 
1551cdf0e10cSrcweir //===== ViewShellObjectBarFactory =============================================
1552cdf0e10cSrcweir 
1553cdf0e10cSrcweir namespace {
1554cdf0e10cSrcweir 
1555cdf0e10cSrcweir ViewShellObjectBarFactory::ViewShellObjectBarFactory (
1556cdf0e10cSrcweir     ::sd::ViewShell& rViewShell)
1557cdf0e10cSrcweir     : mrViewShell (rViewShell)
1558cdf0e10cSrcweir {
1559cdf0e10cSrcweir }
1560cdf0e10cSrcweir 
1561cdf0e10cSrcweir 
1562cdf0e10cSrcweir 
1563cdf0e10cSrcweir 
1564cdf0e10cSrcweir ViewShellObjectBarFactory::~ViewShellObjectBarFactory (void)
1565cdf0e10cSrcweir {
1566cdf0e10cSrcweir     for (ShellCache::iterator aI(maShellCache.begin());
1567cdf0e10cSrcweir          aI!=maShellCache.end();
1568cdf0e10cSrcweir          aI++)
1569cdf0e10cSrcweir     {
1570cdf0e10cSrcweir         delete aI->second;
1571cdf0e10cSrcweir     }
1572cdf0e10cSrcweir }
1573cdf0e10cSrcweir 
1574cdf0e10cSrcweir 
1575cdf0e10cSrcweir 
1576cdf0e10cSrcweir 
1577cdf0e10cSrcweir SfxShell* ViewShellObjectBarFactory::CreateShell (
1578cdf0e10cSrcweir     ::sd::ShellId nId,
1579cdf0e10cSrcweir     ::Window*,
1580cdf0e10cSrcweir     ::sd::FrameView* )
1581cdf0e10cSrcweir {
1582cdf0e10cSrcweir     SfxShell* pShell = NULL;
1583cdf0e10cSrcweir 
1584cdf0e10cSrcweir     ShellCache::iterator aI (maShellCache.find(nId));
1585cdf0e10cSrcweir     if (aI == maShellCache.end() || aI->second==NULL)
1586cdf0e10cSrcweir     {
1587cdf0e10cSrcweir         ::sd::View* pView = mrViewShell.GetView();
1588cdf0e10cSrcweir         switch (nId)
1589cdf0e10cSrcweir         {
1590cdf0e10cSrcweir             case RID_BEZIER_TOOLBOX:
1591cdf0e10cSrcweir                 pShell = new ::sd::BezierObjectBar(&mrViewShell, pView);
1592cdf0e10cSrcweir                 break;
1593cdf0e10cSrcweir 
1594cdf0e10cSrcweir             case RID_DRAW_TEXT_TOOLBOX:
1595cdf0e10cSrcweir                 pShell = new ::sd::TextObjectBar(
1596cdf0e10cSrcweir                     &mrViewShell, mrViewShell.GetDoc()->GetPool(), pView);
1597cdf0e10cSrcweir                 break;
1598cdf0e10cSrcweir 
1599cdf0e10cSrcweir             case RID_DRAW_GRAF_TOOLBOX:
1600cdf0e10cSrcweir                 pShell = new ::sd::GraphicObjectBar(&mrViewShell, pView);
1601cdf0e10cSrcweir                 break;
1602cdf0e10cSrcweir 
1603cdf0e10cSrcweir             case RID_DRAW_MEDIA_TOOLBOX:
1604cdf0e10cSrcweir                 pShell = new ::sd::MediaObjectBar(&mrViewShell, pView);
1605cdf0e10cSrcweir                 break;
1606cdf0e10cSrcweir 
1607cdf0e10cSrcweir 			case RID_DRAW_TABLE_TOOLBOX:
1608cdf0e10cSrcweir 				pShell = ::sd::ui::table::CreateTableObjectBar( mrViewShell, pView );
1609cdf0e10cSrcweir 				break;
1610cdf0e10cSrcweir 
1611cdf0e10cSrcweir             case RID_SVX_EXTRUSION_BAR:
1612cdf0e10cSrcweir                 pShell = new ::svx::ExtrusionBar(
1613cdf0e10cSrcweir                     &mrViewShell.GetViewShellBase());
1614cdf0e10cSrcweir                 break;
1615cdf0e10cSrcweir 
1616cdf0e10cSrcweir             case RID_SVX_FONTWORK_BAR:
1617cdf0e10cSrcweir                 pShell = new ::svx::FontworkBar(
1618cdf0e10cSrcweir                     &mrViewShell.GetViewShellBase());
1619cdf0e10cSrcweir                 break;
1620cdf0e10cSrcweir 
1621cdf0e10cSrcweir             default:
1622cdf0e10cSrcweir                 pShell = NULL;
1623cdf0e10cSrcweir                 break;
1624cdf0e10cSrcweir         }
1625cdf0e10cSrcweir     }
1626cdf0e10cSrcweir     else
1627cdf0e10cSrcweir         pShell = aI->second;
1628cdf0e10cSrcweir 
1629cdf0e10cSrcweir     return pShell;
1630cdf0e10cSrcweir }
1631cdf0e10cSrcweir 
1632cdf0e10cSrcweir 
1633cdf0e10cSrcweir 
1634cdf0e10cSrcweir 
1635cdf0e10cSrcweir void ViewShellObjectBarFactory::ReleaseShell (SfxShell* pShell)
1636cdf0e10cSrcweir {
1637cdf0e10cSrcweir     if (pShell != NULL)
1638cdf0e10cSrcweir         delete pShell;
1639cdf0e10cSrcweir }
1640cdf0e10cSrcweir 
1641cdf0e10cSrcweir } // end of anonymous namespace
1642