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