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