xref: /aoo42x/main/sd/source/ui/view/viewshel.cxx (revision cc69f169)
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 
94*cc69f169SZheng Fan #include <editeng/numitem.hxx>
95*cc69f169SZheng Fan #include <editeng/eeitem.hxx>
96*cc69f169SZheng Fan #include <svl/poolitem.hxx>
97*cc69f169SZheng Fan #include <glob.hrc>
98*cc69f169SZheng Fan 
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 
141cdf0e10cSrcweir sal_Bool ViewShell::IsPageFlipMode(void) const
142cdf0e10cSrcweir {
143cdf0e10cSrcweir 	return this->ISA(DrawViewShell) && mpContentWindow.get() != NULL &&
144cdf0e10cSrcweir 		mpContentWindow->GetVisibleHeight() >= 1.0;
145cdf0e10cSrcweir }
146cdf0e10cSrcweir 
147cdf0e10cSrcweir 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 
170cdf0e10cSrcweir ViewShell::ViewShell( SfxViewFrame*, ::Window* pParentWindow, ViewShellBase& rViewShellBase, bool bAllowCenter)
171cdf0e10cSrcweir :	SfxShell(&rViewShellBase)
172cdf0e10cSrcweir ,	mbCenterAllowed(bAllowCenter)
173cdf0e10cSrcweir ,	mpParentWindow(pParentWindow)
174cdf0e10cSrcweir {
175cdf0e10cSrcweir 	construct();
176cdf0e10cSrcweir }
177cdf0e10cSrcweir 
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 
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 
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 
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 
330cdf0e10cSrcweir void ViewShell::Activate(sal_Bool bIsMDIActivate)
331cdf0e10cSrcweir {
332cdf0e10cSrcweir     SfxShell::Activate(bIsMDIActivate);
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 
388cdf0e10cSrcweir void ViewShell::UIActivating( SfxInPlaceClient*  )
389cdf0e10cSrcweir {
390cdf0e10cSrcweir     OSL_ASSERT (GetViewShell()!=NULL);
391cdf0e10cSrcweir     GetViewShellBase().GetToolBarManager()->ToolBarsDestroyed();
392cdf0e10cSrcweir }
393cdf0e10cSrcweir 
394cdf0e10cSrcweir 
395cdf0e10cSrcweir 
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 
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 
450cdf0e10cSrcweir void ViewShell::Shutdown (void)
451cdf0e10cSrcweir {
452cdf0e10cSrcweir     Exit ();
453cdf0e10cSrcweir }
454cdf0e10cSrcweir 
455cdf0e10cSrcweir 
456cdf0e10cSrcweir 
457cdf0e10cSrcweir 
458cdf0e10cSrcweir /*************************************************************************
459cdf0e10cSrcweir |*
460cdf0e10cSrcweir |* Keyboard event
461cdf0e10cSrcweir |*
462cdf0e10cSrcweir \************************************************************************/
463cdf0e10cSrcweir 
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 
482cdf0e10cSrcweir 	if(!bReturn)
483cdf0e10cSrcweir 	{
484cdf0e10cSrcweir 		rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) );
485cdf0e10cSrcweir 		if(xSlideShow.is() && xSlideShow->isRunning())
486cdf0e10cSrcweir 		{
487cdf0e10cSrcweir 			bReturn = xSlideShow->keyInput(rKEvt);
488cdf0e10cSrcweir 		}
489cdf0e10cSrcweir 		else
490cdf0e10cSrcweir 		{
491cdf0e10cSrcweir 			bool bConsumed = false;
492cdf0e10cSrcweir 			if( GetView() )
493cdf0e10cSrcweir 				bConsumed = GetView()->getSmartTags().KeyInput(rKEvt);
494cdf0e10cSrcweir 
495cdf0e10cSrcweir 
496cdf0e10cSrcweir 			if( !bConsumed )
497cdf0e10cSrcweir 			{
498cdf0e10cSrcweir 				rtl::Reference< sdr::SelectionController > xSelectionController( GetView()->getSelectionController() );
499cdf0e10cSrcweir 				if( !xSelectionController.is() || !xSelectionController->onKeyInput( rKEvt, pWin ) )
500cdf0e10cSrcweir 				{
501cdf0e10cSrcweir 					if(HasCurrentFunction())
502cdf0e10cSrcweir 						bReturn = GetCurrentFunction()->KeyInput(rKEvt);
503cdf0e10cSrcweir 				}
504cdf0e10cSrcweir 				else
505cdf0e10cSrcweir 				{
506cdf0e10cSrcweir 					bReturn = sal_True;
507cdf0e10cSrcweir 				}
508cdf0e10cSrcweir 			}
509cdf0e10cSrcweir 		}
510cdf0e10cSrcweir 	}
511cdf0e10cSrcweir 
512cdf0e10cSrcweir 	if(!bReturn && GetActiveWindow())
513cdf0e10cSrcweir 	{
514cdf0e10cSrcweir 		KeyCode aKeyCode = rKEvt.GetKeyCode();
515cdf0e10cSrcweir 
516cdf0e10cSrcweir 		if (aKeyCode.IsMod1() && aKeyCode.IsShift()
517cdf0e10cSrcweir 			&& aKeyCode.GetCode() == KEY_R)
518cdf0e10cSrcweir 		{
519cdf0e10cSrcweir 			InvalidateWindows();
520cdf0e10cSrcweir 			bReturn = sal_True;
521cdf0e10cSrcweir 		}
522cdf0e10cSrcweir 	}
523cdf0e10cSrcweir 
524cdf0e10cSrcweir 	return(bReturn);
525cdf0e10cSrcweir }
526cdf0e10cSrcweir 
527cdf0e10cSrcweir /*************************************************************************
528cdf0e10cSrcweir |*
529cdf0e10cSrcweir |* MouseButtonDown event
530cdf0e10cSrcweir |*
531cdf0e10cSrcweir \************************************************************************/
532cdf0e10cSrcweir 
533cdf0e10cSrcweir void ViewShell::MouseButtonDown(const MouseEvent& rMEvt, ::sd::Window* pWin)
534cdf0e10cSrcweir {
535cdf0e10cSrcweir     // We have to lock tool bar updates while the mouse button is pressed in
536cdf0e10cSrcweir     // order to prevent the shape under the mouse to be moved (this happens
537cdf0e10cSrcweir     // when the number of docked tool bars changes as result of a changed
538cdf0e10cSrcweir     // selection;  this changes the window size and thus the mouse position
539cdf0e10cSrcweir     // in model coordinates: with respect to model coordinates the mouse
540cdf0e10cSrcweir     // moves.)
541cdf0e10cSrcweir     OSL_ASSERT(mpImpl->mpUpdateLockForMouse.expired());
542cdf0e10cSrcweir     mpImpl->mpUpdateLockForMouse = ViewShell::Implementation::ToolBarManagerLock::Create(
543cdf0e10cSrcweir         GetViewShellBase().GetToolBarManager());
544cdf0e10cSrcweir 
545cdf0e10cSrcweir 	if ( pWin && !pWin->HasFocus() )
546cdf0e10cSrcweir 	{
547cdf0e10cSrcweir         pWin->GrabFocus();
548cdf0e10cSrcweir         SetActiveWindow(pWin);
549cdf0e10cSrcweir //		  GetViewFrame()->GetWindow().GrabFocus();
550cdf0e10cSrcweir 	}
551cdf0e10cSrcweir 
552cdf0e10cSrcweir 	// MouseEvent in E3dView eintragen
553cdf0e10cSrcweir     if (GetView() != NULL)
554cdf0e10cSrcweir         GetView()->SetMouseEvent(rMEvt);
555cdf0e10cSrcweir 
556cdf0e10cSrcweir 	bool bConsumed = false;
557cdf0e10cSrcweir 	if( GetView() )
558cdf0e10cSrcweir 		bConsumed = GetView()->getSmartTags().MouseButtonDown( rMEvt );
559cdf0e10cSrcweir 
560cdf0e10cSrcweir 	if( !bConsumed )
561cdf0e10cSrcweir 	{
562cdf0e10cSrcweir 		rtl::Reference< sdr::SelectionController > xSelectionController( GetView()->getSelectionController() );
563cdf0e10cSrcweir 		if( !xSelectionController.is() || !xSelectionController->onMouseButtonDown( rMEvt, pWin ) )
564cdf0e10cSrcweir 		{
565cdf0e10cSrcweir 			if(HasCurrentFunction())
566cdf0e10cSrcweir 			{
567cdf0e10cSrcweir 				GetCurrentFunction()->MouseButtonDown(rMEvt);
568cdf0e10cSrcweir 			}
569cdf0e10cSrcweir 		}
570cdf0e10cSrcweir 	}
571cdf0e10cSrcweir }
572cdf0e10cSrcweir 
573cdf0e10cSrcweir /*************************************************************************
574cdf0e10cSrcweir |*
575cdf0e10cSrcweir |* MouseMove event
576cdf0e10cSrcweir |*
577cdf0e10cSrcweir \************************************************************************/
578cdf0e10cSrcweir 
579cdf0e10cSrcweir void ViewShell::MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin)
580cdf0e10cSrcweir {
581cdf0e10cSrcweir     if (rMEvt.IsLeaveWindow())
582cdf0e10cSrcweir     {
583cdf0e10cSrcweir         if ( ! mpImpl->mpUpdateLockForMouse.expired())
584cdf0e10cSrcweir         {
585cdf0e10cSrcweir             ::boost::shared_ptr<ViewShell::Implementation::ToolBarManagerLock> pLock(
586cdf0e10cSrcweir                 mpImpl->mpUpdateLockForMouse);
587cdf0e10cSrcweir             if (pLock.get() != NULL)
588cdf0e10cSrcweir                 pLock->Release();
589cdf0e10cSrcweir         }
590cdf0e10cSrcweir     }
591cdf0e10cSrcweir 
592cdf0e10cSrcweir 	if ( pWin )
593cdf0e10cSrcweir 	{
594cdf0e10cSrcweir 		SetActiveWindow(pWin);
595cdf0e10cSrcweir 	}
596cdf0e10cSrcweir 
597cdf0e10cSrcweir 	// MouseEvent in E3dView eintragen
598cdf0e10cSrcweir     if (GetView() != NULL)
599cdf0e10cSrcweir         GetView()->SetMouseEvent(rMEvt);
600cdf0e10cSrcweir 
601cdf0e10cSrcweir 	if(HasCurrentFunction())
602cdf0e10cSrcweir 	{
603cdf0e10cSrcweir 		rtl::Reference< sdr::SelectionController > xSelectionController( GetView()->getSelectionController() );
604cdf0e10cSrcweir 		if( !xSelectionController.is() || !xSelectionController->onMouseMove( rMEvt, pWin ) )
605cdf0e10cSrcweir 		{
606cdf0e10cSrcweir 			if(HasCurrentFunction())
607cdf0e10cSrcweir 				GetCurrentFunction()->MouseMove(rMEvt);
608cdf0e10cSrcweir 		}
609cdf0e10cSrcweir 	}
610cdf0e10cSrcweir }
611cdf0e10cSrcweir 
612cdf0e10cSrcweir /*************************************************************************
613cdf0e10cSrcweir |*
614cdf0e10cSrcweir |* MouseButtonUp event
615cdf0e10cSrcweir |*
616cdf0e10cSrcweir \************************************************************************/
617cdf0e10cSrcweir 
618cdf0e10cSrcweir void ViewShell::MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin)
619cdf0e10cSrcweir {
620cdf0e10cSrcweir 	if ( pWin )
621cdf0e10cSrcweir 	{
622cdf0e10cSrcweir 		SetActiveWindow(pWin);
623cdf0e10cSrcweir 	}
624cdf0e10cSrcweir 
625cdf0e10cSrcweir 	// MouseEvent in E3dView eintragen
626cdf0e10cSrcweir     if (GetView() != NULL)
627cdf0e10cSrcweir         GetView()->SetMouseEvent(rMEvt);
628cdf0e10cSrcweir 
629cdf0e10cSrcweir 	if( HasCurrentFunction())
630cdf0e10cSrcweir 	{
631cdf0e10cSrcweir 		rtl::Reference< sdr::SelectionController > xSelectionController( GetView()->getSelectionController() );
632cdf0e10cSrcweir 		if( !xSelectionController.is() || !xSelectionController->onMouseButtonUp( rMEvt, pWin ) )
633cdf0e10cSrcweir 		{
634cdf0e10cSrcweir 			if(HasCurrentFunction())
635cdf0e10cSrcweir 				GetCurrentFunction()->MouseButtonUp(rMEvt);
636cdf0e10cSrcweir 		}
637cdf0e10cSrcweir 	}
638cdf0e10cSrcweir 
639cdf0e10cSrcweir     if ( ! mpImpl->mpUpdateLockForMouse.expired())
640cdf0e10cSrcweir     {
641cdf0e10cSrcweir         ::boost::shared_ptr<ViewShell::Implementation::ToolBarManagerLock> pLock(
642cdf0e10cSrcweir             mpImpl->mpUpdateLockForMouse);
643cdf0e10cSrcweir         if (pLock.get() != NULL)
644cdf0e10cSrcweir             pLock->Release();
645cdf0e10cSrcweir     }
646cdf0e10cSrcweir }
647cdf0e10cSrcweir 
648cdf0e10cSrcweir 
649cdf0e10cSrcweir /*************************************************************************
650cdf0e10cSrcweir |*
651cdf0e10cSrcweir |* Command event
652cdf0e10cSrcweir |*
653cdf0e10cSrcweir \************************************************************************/
654cdf0e10cSrcweir 
655cdf0e10cSrcweir void ViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin)
656cdf0e10cSrcweir {
657cdf0e10cSrcweir 	sal_Bool bDone = HandleScrollCommand (rCEvt, pWin);
658cdf0e10cSrcweir 
659cdf0e10cSrcweir 	if( !bDone )
660cdf0e10cSrcweir 	{
661cdf0e10cSrcweir 		if( rCEvt.GetCommand() == COMMAND_INPUTLANGUAGECHANGE )
662cdf0e10cSrcweir 		{
663cdf0e10cSrcweir             //#i42732# update state of fontname if input language changes
664cdf0e10cSrcweir             GetViewFrame()->GetBindings().Invalidate( SID_ATTR_CHAR_FONT );
665cdf0e10cSrcweir             GetViewFrame()->GetBindings().Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
666cdf0e10cSrcweir 		}
667cdf0e10cSrcweir 		else
668cdf0e10cSrcweir 		{
669cdf0e10cSrcweir 		    bool bConsumed = false;
670cdf0e10cSrcweir    			if( GetView() )
671cdf0e10cSrcweir    			{
672cdf0e10cSrcweir 				bConsumed = GetView()->getSmartTags().Command(rCEvt);
673cdf0e10cSrcweir 		    }
674cdf0e10cSrcweir 
675cdf0e10cSrcweir 			if( !bConsumed && HasCurrentFunction())
676cdf0e10cSrcweir 		    {
677cdf0e10cSrcweir 		        GetCurrentFunction()->Command(rCEvt);
678cdf0e10cSrcweir             }
679cdf0e10cSrcweir 		}
680cdf0e10cSrcweir 	}
681cdf0e10cSrcweir }
682cdf0e10cSrcweir 
683cdf0e10cSrcweir long ViewShell::Notify(NotifyEvent& rNEvt, ::sd::Window* pWin)
684cdf0e10cSrcweir {
685cdf0e10cSrcweir     // handle scroll commands when they arrived at child windows
686cdf0e10cSrcweir     long nRet = sal_False;
687cdf0e10cSrcweir     if( rNEvt.GetType() == EVENT_COMMAND )
688cdf0e10cSrcweir     {
689cdf0e10cSrcweir         // note: dynamic_cast is not possible as GetData() returns a void*
690cdf0e10cSrcweir         CommandEvent* pCmdEvent = reinterpret_cast< CommandEvent* >(rNEvt.GetData());
691cdf0e10cSrcweir         nRet = HandleScrollCommand(*pCmdEvent, pWin);
692cdf0e10cSrcweir     }
693cdf0e10cSrcweir     return nRet;
694cdf0e10cSrcweir }
695cdf0e10cSrcweir 
696cdf0e10cSrcweir 
697cdf0e10cSrcweir bool ViewShell::HandleScrollCommand(const CommandEvent& rCEvt, ::sd::Window* pWin)
698cdf0e10cSrcweir {
699cdf0e10cSrcweir     bool bDone = false;
700cdf0e10cSrcweir 
701cdf0e10cSrcweir     switch( rCEvt.GetCommand() )
702cdf0e10cSrcweir     {
703cdf0e10cSrcweir         case COMMAND_WHEEL:
704cdf0e10cSrcweir 			{
705cdf0e10cSrcweir 				Reference< XSlideShowController > xSlideShowController( SlideShow::GetSlideShowController(GetViewShellBase() ) );
706cdf0e10cSrcweir 				if( xSlideShowController.is() )
707cdf0e10cSrcweir 				{
708cdf0e10cSrcweir 					// We ignore zooming with control+mouse wheel.
709cdf0e10cSrcweir 					const CommandWheelData* pData = rCEvt.GetWheelData();
710cdf0e10cSrcweir 					if( pData && !pData->GetModifier() && ( pData->GetMode() == COMMAND_WHEEL_SCROLL ) && !pData->IsHorz() )
711cdf0e10cSrcweir 					{
712cdf0e10cSrcweir 						long nDelta = pData->GetDelta();
713cdf0e10cSrcweir 						if( nDelta > 0 )
714cdf0e10cSrcweir 						{
715cdf0e10cSrcweir 							xSlideShowController->gotoPreviousSlide();
716cdf0e10cSrcweir 						}
717cdf0e10cSrcweir 						else if( nDelta < 0 )
718cdf0e10cSrcweir 						{
719cdf0e10cSrcweir 							xSlideShowController->gotoNextEffect();
720cdf0e10cSrcweir 						}
721cdf0e10cSrcweir 					}
722cdf0e10cSrcweir 					break;
723cdf0e10cSrcweir 				}
724cdf0e10cSrcweir 			}
725cdf0e10cSrcweir 			// fall through when not running slideshow
726cdf0e10cSrcweir         case COMMAND_STARTAUTOSCROLL:
727cdf0e10cSrcweir         case COMMAND_AUTOSCROLL:
728cdf0e10cSrcweir         {
729cdf0e10cSrcweir             const CommandWheelData* pData = rCEvt.GetWheelData();
730cdf0e10cSrcweir 
731cdf0e10cSrcweir             if (pData != NULL)
732cdf0e10cSrcweir             {
733cdf0e10cSrcweir                 if (pData->IsMod1())
734cdf0e10cSrcweir                 {
735cdf0e10cSrcweir                     if( !GetDocSh()->IsUIActive() )
736cdf0e10cSrcweir                     {
737cdf0e10cSrcweir                         const long  nOldZoom = GetActiveWindow()->GetZoom();
738cdf0e10cSrcweir                         long        nNewZoom;
739cdf0e10cSrcweir 
740cdf0e10cSrcweir                         if( pData->GetDelta() < 0L )
741cdf0e10cSrcweir                             nNewZoom = Max( (long) pWin->GetMinZoom(), (long)(nOldZoom - DELTA_ZOOM) );
742cdf0e10cSrcweir                         else
743cdf0e10cSrcweir                             nNewZoom = Min( (long) pWin->GetMaxZoom(), (long)(nOldZoom + DELTA_ZOOM) );
744cdf0e10cSrcweir 
745cdf0e10cSrcweir                         SetZoom( nNewZoom );
746cdf0e10cSrcweir                         Invalidate( SID_ATTR_ZOOM );
747cdf0e10cSrcweir 						Invalidate( SID_ATTR_ZOOMSLIDER );
748cdf0e10cSrcweir 
749cdf0e10cSrcweir                         bDone = true;
750cdf0e10cSrcweir                     }
751cdf0e10cSrcweir                 }
752cdf0e10cSrcweir                 else
753cdf0e10cSrcweir                 {
754cdf0e10cSrcweir                     if( mpContentWindow.get() == pWin )
755cdf0e10cSrcweir                     {
756cdf0e10cSrcweir                         sal_uLong nScrollLines = pData->GetScrollLines();
757cdf0e10cSrcweir                         if(IsPageFlipMode())
758cdf0e10cSrcweir                             nScrollLines = COMMAND_WHEEL_PAGESCROLL;
759cdf0e10cSrcweir                         CommandWheelData aWheelData( pData->GetDelta(),pData->GetNotchDelta(),
760cdf0e10cSrcweir                             nScrollLines,pData->GetMode(),pData->GetModifier(),pData->IsHorz() );
761cdf0e10cSrcweir                         CommandEvent aReWrite( rCEvt.GetMousePosPixel(),rCEvt.GetCommand(),
762cdf0e10cSrcweir                             rCEvt.IsMouseEvent(),(const void *) &aWheelData );
763cdf0e10cSrcweir                         bDone = pWin->HandleScrollCommand( aReWrite,
764cdf0e10cSrcweir                             mpHorizontalScrollBar.get(),
765cdf0e10cSrcweir                             mpVerticalScrollBar.get()) == sal_True;
766cdf0e10cSrcweir                     }
767cdf0e10cSrcweir                 }
768cdf0e10cSrcweir             }
769cdf0e10cSrcweir         }
770cdf0e10cSrcweir         break;
771cdf0e10cSrcweir 
772cdf0e10cSrcweir         default:
773cdf0e10cSrcweir         break;
774cdf0e10cSrcweir     }
775cdf0e10cSrcweir 
776cdf0e10cSrcweir     return bDone;
777cdf0e10cSrcweir }
778cdf0e10cSrcweir 
779cdf0e10cSrcweir 
780cdf0e10cSrcweir 
781cdf0e10cSrcweir void ViewShell::SetupRulers (void)
782cdf0e10cSrcweir {
783cdf0e10cSrcweir 	if(mbHasRulers && (mpContentWindow.get() != NULL) && !SlideShow::IsRunning(GetViewShellBase()))
784cdf0e10cSrcweir 	{
785cdf0e10cSrcweir 		long nHRulerOfs = 0;
786cdf0e10cSrcweir 
787cdf0e10cSrcweir 		if ( mpVerticalRuler.get() == NULL )
788cdf0e10cSrcweir 		{
789cdf0e10cSrcweir 			mpVerticalRuler.reset(CreateVRuler(GetActiveWindow()));
790cdf0e10cSrcweir 			if ( mpVerticalRuler.get() != NULL )
791cdf0e10cSrcweir 			{
792cdf0e10cSrcweir 				nHRulerOfs = mpVerticalRuler->GetSizePixel().Width();
793cdf0e10cSrcweir 				mpVerticalRuler->SetActive(sal_True);
794cdf0e10cSrcweir 				mpVerticalRuler->Show();
795cdf0e10cSrcweir 			}
796cdf0e10cSrcweir 		}
797cdf0e10cSrcweir 		if ( mpHorizontalRuler.get() == NULL )
798cdf0e10cSrcweir 		{
799cdf0e10cSrcweir 			mpHorizontalRuler.reset(CreateHRuler(GetActiveWindow(), sal_True));
800cdf0e10cSrcweir 			if ( mpHorizontalRuler.get() != NULL )
801cdf0e10cSrcweir 			{
802cdf0e10cSrcweir 				mpHorizontalRuler->SetWinPos(nHRulerOfs);
803cdf0e10cSrcweir 				mpHorizontalRuler->SetActive(sal_True);
804cdf0e10cSrcweir 				mpHorizontalRuler->Show();
805cdf0e10cSrcweir 			}
806cdf0e10cSrcweir 		}
807cdf0e10cSrcweir 	}
808cdf0e10cSrcweir }
809cdf0e10cSrcweir 
810*cc69f169SZheng Fan const SfxPoolItem* ViewShell::GetNumBulletItem(SfxItemSet& aNewAttr, sal_uInt16& nNumItemId)
811*cc69f169SZheng Fan {
812*cc69f169SZheng Fan 	const SfxPoolItem* pTmpItem = NULL;
813*cc69f169SZheng Fan 
814*cc69f169SZheng Fan 	if(aNewAttr.GetItemState(nNumItemId, sal_False, &pTmpItem) == SFX_ITEM_SET)
815*cc69f169SZheng Fan 	{
816*cc69f169SZheng Fan 		return pTmpItem;
817*cc69f169SZheng Fan 	}
818*cc69f169SZheng Fan 	else
819*cc69f169SZheng Fan 	{
820*cc69f169SZheng Fan 		nNumItemId = aNewAttr.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
821*cc69f169SZheng Fan 		SfxItemState eState = aNewAttr.GetItemState(nNumItemId, sal_False, &pTmpItem);
822*cc69f169SZheng Fan 		if (eState == SFX_ITEM_SET)
823*cc69f169SZheng Fan 			return pTmpItem;
824*cc69f169SZheng Fan 		else
825*cc69f169SZheng Fan 		{
826*cc69f169SZheng Fan 			sal_Bool bOutliner = sal_False;
827*cc69f169SZheng Fan 			sal_Bool bTitle = sal_False;
828*cc69f169SZheng Fan 
829*cc69f169SZheng Fan 			if( mpView )
830*cc69f169SZheng Fan      			{
831*cc69f169SZheng Fan 				const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
832*cc69f169SZheng Fan 				const sal_uInt32 nCount = rMarkList.GetMarkCount();
833*cc69f169SZheng Fan 
834*cc69f169SZheng Fan 				for(sal_uInt32 nNum = 0; nNum < nCount; nNum++)
835*cc69f169SZheng Fan 				{
836*cc69f169SZheng Fan 					SdrObject* pObj = rMarkList.GetMark(nNum)->GetMarkedSdrObj();
837*cc69f169SZheng Fan 					if( pObj->GetObjInventor() == SdrInventor )
838*cc69f169SZheng Fan 					{
839*cc69f169SZheng Fan 						switch(pObj->GetObjIdentifier())
840*cc69f169SZheng Fan 						{
841*cc69f169SZheng Fan 						case OBJ_TITLETEXT:
842*cc69f169SZheng Fan 							bTitle = sal_True;
843*cc69f169SZheng Fan 							break;
844*cc69f169SZheng Fan 						case OBJ_OUTLINETEXT:
845*cc69f169SZheng Fan 							bOutliner = sal_True;
846*cc69f169SZheng Fan 							break;
847*cc69f169SZheng Fan 						}
848*cc69f169SZheng Fan 					}
849*cc69f169SZheng Fan 				}
850*cc69f169SZheng Fan 			}
851*cc69f169SZheng Fan 
852*cc69f169SZheng Fan 			const SvxNumBulletItem *pItem = NULL;
853*cc69f169SZheng Fan 			if(bOutliner)
854*cc69f169SZheng Fan 			{
855*cc69f169SZheng Fan 				SfxStyleSheetBasePool* pSSPool = mpView->GetDocSh()->GetStyleSheetPool();
856*cc69f169SZheng Fan 				String aStyleName((SdResId(STR_LAYOUT_OUTLINE)));
857*cc69f169SZheng Fan 				aStyleName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " 1" ) );
858*cc69f169SZheng Fan 				SfxStyleSheetBase* pFirstStyleSheet = pSSPool->Find( aStyleName, SD_STYLE_FAMILY_PSEUDO);
859*cc69f169SZheng Fan 				if( pFirstStyleSheet )
860*cc69f169SZheng Fan 					pFirstStyleSheet->GetItemSet().GetItemState(EE_PARA_NUMBULLET, sal_False, (const SfxPoolItem**)&pItem);
861*cc69f169SZheng Fan 			}
862*cc69f169SZheng Fan 
863*cc69f169SZheng Fan 			if( pItem == NULL )
864*cc69f169SZheng Fan 				pItem = (SvxNumBulletItem*) aNewAttr.GetPool()->GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET);
865cdf0e10cSrcweir 
866*cc69f169SZheng Fan 			aNewAttr.Put(*pItem, EE_PARA_NUMBULLET);
867*cc69f169SZheng Fan 
868*cc69f169SZheng Fan 			if(bTitle && aNewAttr.GetItemState(EE_PARA_NUMBULLET,sal_True) == SFX_ITEM_ON )
869*cc69f169SZheng Fan 			{
870*cc69f169SZheng Fan 				SvxNumBulletItem* pItem = (SvxNumBulletItem*)aNewAttr.GetItem(EE_PARA_NUMBULLET,sal_True);
871*cc69f169SZheng Fan 				SvxNumRule* pRule = pItem->GetNumRule();
872*cc69f169SZheng Fan 				if(pRule)
873*cc69f169SZheng Fan 				{
874*cc69f169SZheng Fan 					SvxNumRule aNewRule( *pRule );
875*cc69f169SZheng Fan 					aNewRule.SetFeatureFlag( NUM_NO_NUMBERS, sal_True );
876*cc69f169SZheng Fan 
877*cc69f169SZheng Fan 					SvxNumBulletItem aNewItem( aNewRule, EE_PARA_NUMBULLET );
878*cc69f169SZheng Fan 					aNewAttr.Put(aNewItem);
879*cc69f169SZheng Fan 				}
880*cc69f169SZheng Fan 			}
881*cc69f169SZheng Fan 
882*cc69f169SZheng Fan 			SfxItemState eState = aNewAttr.GetItemState(nNumItemId, sal_False, &pTmpItem);
883*cc69f169SZheng Fan 			if (eState == SFX_ITEM_SET)
884*cc69f169SZheng Fan 				return pTmpItem;
885*cc69f169SZheng Fan 
886*cc69f169SZheng Fan 		}
887*cc69f169SZheng Fan 	}
888*cc69f169SZheng Fan 	return pTmpItem;
889*cc69f169SZheng Fan }
890cdf0e10cSrcweir 
891cdf0e10cSrcweir 
892cdf0e10cSrcweir sal_Bool ViewShell::HasRuler (void)
893cdf0e10cSrcweir {
894cdf0e10cSrcweir     return mbHasRulers;
895cdf0e10cSrcweir }
896cdf0e10cSrcweir 
897cdf0e10cSrcweir 
898cdf0e10cSrcweir 
899cdf0e10cSrcweir 
900cdf0e10cSrcweir void ViewShell::Resize (void)
901cdf0e10cSrcweir {
902cdf0e10cSrcweir 	SetupRulers ();
903cdf0e10cSrcweir 
904cdf0e10cSrcweir     if (mpParentWindow == NULL)
905cdf0e10cSrcweir         return;
906cdf0e10cSrcweir 
907cdf0e10cSrcweir     // Make sure that the new size is not degenerate.
908cdf0e10cSrcweir     const Size aSize (mpParentWindow->GetSizePixel());
909cdf0e10cSrcweir 	if (aSize.Width()==0 || aSize.Height()==0)
910cdf0e10cSrcweir 		return;
911cdf0e10cSrcweir 
912cdf0e10cSrcweir     // Remember the new position and size.
913cdf0e10cSrcweir 	maViewPos = Point(0,0); //mpParentWindow->GetPosPixel();
914cdf0e10cSrcweir 	maViewSize = aSize;
915cdf0e10cSrcweir 
916cdf0e10cSrcweir     // Rearrange the UI elements to take care of the new position and size.
917cdf0e10cSrcweir     ArrangeGUIElements ();
918cdf0e10cSrcweir     // end of included AdjustPosSizePixel.
919cdf0e10cSrcweir 
920cdf0e10cSrcweir     Size aS (GetParentWindow()->GetOutputSizePixel());
921cdf0e10cSrcweir 	Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
922cdf0e10cSrcweir 	Rectangle aVisArea = GetParentWindow()->PixelToLogic(
923cdf0e10cSrcweir         Rectangle( Point(0,0), aVisSizePixel));
924cdf0e10cSrcweir     Rectangle aCurrentVisArea (GetDocSh()->GetVisArea(ASPECT_CONTENT));
925cdf0e10cSrcweir     Rectangle aWindowRect = GetActiveWindow()->LogicToPixel(aCurrentVisArea);
926cdf0e10cSrcweir 	if (GetDocSh()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED
927cdf0e10cSrcweir         && IsMainViewShell())
928cdf0e10cSrcweir 	{
929cdf0e10cSrcweir         //        GetDocSh()->SetVisArea(aVisArea);
930cdf0e10cSrcweir 	}
931cdf0e10cSrcweir 
932cdf0e10cSrcweir     //	VisAreaChanged(aVisArea);
933cdf0e10cSrcweir 
934cdf0e10cSrcweir 	::sd::View* pView = GetView();
935cdf0e10cSrcweir 
936cdf0e10cSrcweir 	if (pView)
937cdf0e10cSrcweir 	{
938cdf0e10cSrcweir 		pView->VisAreaChanged(GetActiveWindow());
939cdf0e10cSrcweir 	}
940cdf0e10cSrcweir }
941cdf0e10cSrcweir 
942cdf0e10cSrcweir SvBorder ViewShell::GetBorder (bool )
943cdf0e10cSrcweir {
944cdf0e10cSrcweir     SvBorder aBorder;
945cdf0e10cSrcweir 
946cdf0e10cSrcweir 	// Horizontal scrollbar.
947cdf0e10cSrcweir     if (mpHorizontalScrollBar.get()!=NULL
948cdf0e10cSrcweir         && mpHorizontalScrollBar->IsVisible())
949cdf0e10cSrcweir     {
950cdf0e10cSrcweir         aBorder.Bottom() = maScrBarWH.Height();
951cdf0e10cSrcweir     }
952cdf0e10cSrcweir 
953cdf0e10cSrcweir 	// Vertical scrollbar.
954cdf0e10cSrcweir     if (mpVerticalScrollBar.get()!=NULL
955cdf0e10cSrcweir         && mpVerticalScrollBar->IsVisible())
956cdf0e10cSrcweir     {
957cdf0e10cSrcweir         aBorder.Right() = maScrBarWH.Width();
958cdf0e10cSrcweir     }
959cdf0e10cSrcweir 
960cdf0e10cSrcweir     // Place horizontal ruler below tab bar.
961cdf0e10cSrcweir     if (mbHasRulers && mpContentWindow.get() != NULL)
962cdf0e10cSrcweir     {
963cdf0e10cSrcweir         SetupRulers();
964cdf0e10cSrcweir         if (mpHorizontalRuler.get() != NULL)
965cdf0e10cSrcweir             aBorder.Top() = mpHorizontalRuler->GetSizePixel().Height();
966cdf0e10cSrcweir         if (mpVerticalRuler.get() != NULL)
967cdf0e10cSrcweir             aBorder.Left() = mpVerticalRuler->GetSizePixel().Width();
968cdf0e10cSrcweir     }
969cdf0e10cSrcweir 
970cdf0e10cSrcweir     return aBorder;
971cdf0e10cSrcweir }
972cdf0e10cSrcweir 
973cdf0e10cSrcweir 
974cdf0e10cSrcweir 
975cdf0e10cSrcweir 
976cdf0e10cSrcweir void ViewShell::ArrangeGUIElements (void)
977cdf0e10cSrcweir {
978cdf0e10cSrcweir     if (mpImpl->mbArrangeActive)
979cdf0e10cSrcweir         return;
980cdf0e10cSrcweir     mpImpl->mbArrangeActive = true;
981cdf0e10cSrcweir 
982cdf0e10cSrcweir     // Calculate border for in-place editing.
983cdf0e10cSrcweir 	long nLeft = maViewPos.X();
984cdf0e10cSrcweir 	long nTop  = maViewPos.Y();
985cdf0e10cSrcweir 	long nRight = maViewPos.X() + maViewSize.Width();
986cdf0e10cSrcweir 	long nBottom = maViewPos.Y() + maViewSize.Height();
987cdf0e10cSrcweir 
988cdf0e10cSrcweir 	// Horizontal scrollbar.
989cdf0e10cSrcweir     if (mpHorizontalScrollBar.get()!=NULL
990cdf0e10cSrcweir         && mpHorizontalScrollBar->IsVisible())
991cdf0e10cSrcweir     {
992cdf0e10cSrcweir         int nLocalLeft = nLeft;
993cdf0e10cSrcweir         if (mpLayerTabBar.get()!=NULL && mpLayerTabBar->IsVisible())
994cdf0e10cSrcweir             nLocalLeft += mpLayerTabBar->GetSizePixel().Width();
995cdf0e10cSrcweir         nBottom -= maScrBarWH.Height();
996cdf0e10cSrcweir         mpHorizontalScrollBar->SetPosSizePixel (
997cdf0e10cSrcweir             Point(nLocalLeft,nBottom),
998cdf0e10cSrcweir             Size(nRight-nLocalLeft-maScrBarWH.Width(),maScrBarWH.Height()));
999cdf0e10cSrcweir     }
1000cdf0e10cSrcweir 
1001cdf0e10cSrcweir 	// Vertical scrollbar.
1002cdf0e10cSrcweir     if (mpVerticalScrollBar.get()!=NULL
1003cdf0e10cSrcweir         && mpVerticalScrollBar->IsVisible())
1004cdf0e10cSrcweir     {
1005cdf0e10cSrcweir         nRight -= maScrBarWH.Width();
1006cdf0e10cSrcweir         mpVerticalScrollBar->SetPosSizePixel (
1007cdf0e10cSrcweir             Point(nRight,nTop),
1008cdf0e10cSrcweir             Size (maScrBarWH.Width(),nBottom-nTop));
1009cdf0e10cSrcweir     }
1010cdf0e10cSrcweir 
1011cdf0e10cSrcweir     // Filler in the lower right corner.
1012cdf0e10cSrcweir     if (mpScrollBarBox.get() != NULL)
1013cdf0e10cSrcweir     {
1014cdf0e10cSrcweir         if (mpHorizontalScrollBar.get()!=NULL
1015cdf0e10cSrcweir             && mpHorizontalScrollBar->IsVisible()
1016cdf0e10cSrcweir             && mpVerticalScrollBar.get()!=NULL
1017cdf0e10cSrcweir             && mpVerticalScrollBar->IsVisible())
1018cdf0e10cSrcweir         {
1019cdf0e10cSrcweir             mpScrollBarBox->Show();
1020cdf0e10cSrcweir             mpScrollBarBox->SetPosSizePixel(Point(nRight, nBottom), maScrBarWH);
1021cdf0e10cSrcweir         }
1022cdf0e10cSrcweir         else
1023cdf0e10cSrcweir             mpScrollBarBox->Hide();
1024cdf0e10cSrcweir     }
1025cdf0e10cSrcweir 
1026cdf0e10cSrcweir     // Place horizontal ruler below tab bar.
1027cdf0e10cSrcweir     if (mbHasRulers && mpContentWindow.get() != NULL)
1028cdf0e10cSrcweir     {
1029cdf0e10cSrcweir         if (mpHorizontalRuler.get() != NULL)
1030cdf0e10cSrcweir         {
1031cdf0e10cSrcweir             Size aRulerSize = mpHorizontalRuler->GetSizePixel();
1032cdf0e10cSrcweir             aRulerSize.Width() = nRight - nLeft;
1033cdf0e10cSrcweir             mpHorizontalRuler->SetPosSizePixel (
1034cdf0e10cSrcweir                 Point(nLeft,nTop), aRulerSize);
1035cdf0e10cSrcweir             if (mpVerticalRuler.get() != NULL)
1036cdf0e10cSrcweir                 mpHorizontalRuler->SetBorderPos(
1037cdf0e10cSrcweir                     mpVerticalRuler->GetSizePixel().Width()-1);
1038cdf0e10cSrcweir             nTop += aRulerSize.Height();
1039cdf0e10cSrcweir         }
1040cdf0e10cSrcweir         if (mpVerticalRuler.get() != NULL)
1041cdf0e10cSrcweir         {
1042cdf0e10cSrcweir             Size aRulerSize = mpVerticalRuler->GetSizePixel();
1043cdf0e10cSrcweir             aRulerSize.Height() = nBottom  - nTop;
1044cdf0e10cSrcweir             mpVerticalRuler->SetPosSizePixel (
1045cdf0e10cSrcweir                 Point (nLeft,nTop), aRulerSize);
1046cdf0e10cSrcweir             nLeft += aRulerSize.Width();
1047cdf0e10cSrcweir         }
1048cdf0e10cSrcweir     }
1049cdf0e10cSrcweir 
1050cdf0e10cSrcweir 	rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) );
1051cdf0e10cSrcweir 
1052cdf0e10cSrcweir     // The size of the window of the center pane is set differently from
1053cdf0e10cSrcweir     // that of the windows in the docking windows.
1054cdf0e10cSrcweir     bool bSlideShowActive = (xSlideShow.is() && xSlideShow->isRunning()) && !xSlideShow->isFullScreen() && xSlideShow->getAnimationMode() == ANIMATIONMODE_SHOW;
1055cdf0e10cSrcweir     if ( !bSlideShowActive)
1056cdf0e10cSrcweir     {
1057cdf0e10cSrcweir         OSL_ASSERT (GetViewShell()!=NULL);
1058cdf0e10cSrcweir 
10597a32b0c8SAndre Fischer         if (mpContentWindow)
10607a32b0c8SAndre Fischer             mpContentWindow->SetPosSizePixel(
10617a32b0c8SAndre Fischer                 Point(nLeft,nTop),
10627a32b0c8SAndre Fischer                 Size(nRight-nLeft,nBottom-nTop));
1063cdf0e10cSrcweir     }
1064cdf0e10cSrcweir 
1065cdf0e10cSrcweir     // Windows in the center and rulers at the left and top side.
1066cdf0e10cSrcweir 	maAllWindowRectangle = Rectangle(
1067cdf0e10cSrcweir         maViewPos,
1068cdf0e10cSrcweir         Size(maViewSize.Width()-maScrBarWH.Width(),
1069cdf0e10cSrcweir             maViewSize.Height()-maScrBarWH.Height()));
1070cdf0e10cSrcweir 
1071cdf0e10cSrcweir     if (mpContentWindow.get() != NULL)
1072cdf0e10cSrcweir     {
1073cdf0e10cSrcweir         mpContentWindow->UpdateMapOrigin();
1074cdf0e10cSrcweir     }
1075cdf0e10cSrcweir 
1076cdf0e10cSrcweir     UpdateScrollBars();
1077cdf0e10cSrcweir 
1078cdf0e10cSrcweir     mpImpl->mbArrangeActive = false;
1079cdf0e10cSrcweir }
1080cdf0e10cSrcweir 
1081cdf0e10cSrcweir 
1082cdf0e10cSrcweir 
1083cdf0e10cSrcweir 
1084cdf0e10cSrcweir void ViewShell::SetUIUnit(FieldUnit eUnit)
1085cdf0e10cSrcweir {
1086cdf0e10cSrcweir     // Set unit at horizontal and vertical rulers.
1087cdf0e10cSrcweir     if (mpHorizontalRuler.get() != NULL)
1088cdf0e10cSrcweir         mpHorizontalRuler->SetUnit(eUnit);
1089cdf0e10cSrcweir 
1090cdf0e10cSrcweir 
1091cdf0e10cSrcweir 	if (mpVerticalRuler.get() != NULL)
1092cdf0e10cSrcweir         mpVerticalRuler->SetUnit(eUnit);
1093cdf0e10cSrcweir }
1094cdf0e10cSrcweir 
1095cdf0e10cSrcweir /*************************************************************************
1096cdf0e10cSrcweir |*
1097cdf0e10cSrcweir |* DefTab an den horizontalen Linealen setzen
1098cdf0e10cSrcweir |*
1099cdf0e10cSrcweir \************************************************************************/
1100cdf0e10cSrcweir void ViewShell::SetDefTabHRuler( sal_uInt16 nDefTab )
1101cdf0e10cSrcweir {
1102cdf0e10cSrcweir     if (mpHorizontalRuler.get() != NULL)
1103cdf0e10cSrcweir         mpHorizontalRuler->SetDefTabDist( nDefTab );
1104cdf0e10cSrcweir }
1105cdf0e10cSrcweir 
1106cdf0e10cSrcweir 
1107cdf0e10cSrcweir 
1108cdf0e10cSrcweir 
1109cdf0e10cSrcweir /** Tell the FmFormShell that the view shell is closing.  Give it the
1110cdf0e10cSrcweir     oportunity to prevent that.
1111cdf0e10cSrcweir */
1112cdf0e10cSrcweir sal_uInt16 ViewShell::PrepareClose (sal_Bool bUI, sal_Bool bForBrowsing)
1113cdf0e10cSrcweir {
1114cdf0e10cSrcweir     sal_uInt16 nResult = sal_True;
1115cdf0e10cSrcweir 
1116cdf0e10cSrcweir     FmFormShell* pFormShell = GetViewShellBase().GetFormShellManager()->GetFormShell();
1117cdf0e10cSrcweir     if (pFormShell != NULL)
1118cdf0e10cSrcweir         nResult = pFormShell->PrepareClose (bUI, bForBrowsing);
1119cdf0e10cSrcweir 
1120cdf0e10cSrcweir 	return nResult;
1121cdf0e10cSrcweir }
1122cdf0e10cSrcweir 
1123cdf0e10cSrcweir 
1124cdf0e10cSrcweir 
1125cdf0e10cSrcweir 
1126cdf0e10cSrcweir void ViewShell::UpdatePreview (SdPage*, sal_Bool )
1127cdf0e10cSrcweir {
1128cdf0e10cSrcweir     // Do nothing.  After the actual preview has been removed,
1129cdf0e10cSrcweir     // OutlineViewShell::UpdatePreview() is the place where something
1130cdf0e10cSrcweir     // usefull is still done.
1131cdf0e10cSrcweir }
1132cdf0e10cSrcweir 
1133cdf0e10cSrcweir ::svl::IUndoManager* ViewShell::ImpGetUndoManager (void) const
1134cdf0e10cSrcweir {
1135cdf0e10cSrcweir 	const ViewShell* pMainViewShell = GetViewShellBase().GetMainViewShell().get();
1136cdf0e10cSrcweir 
1137cdf0e10cSrcweir 	if( pMainViewShell == 0 )
1138cdf0e10cSrcweir 		pMainViewShell = this;
1139cdf0e10cSrcweir 
1140cdf0e10cSrcweir 	::sd::View* pView = pMainViewShell->GetView();
1141cdf0e10cSrcweir 
1142cdf0e10cSrcweir 	// check for text edit our outline view
1143cdf0e10cSrcweir 	if( pView )
1144cdf0e10cSrcweir 	{
1145cdf0e10cSrcweir 		if( pMainViewShell->GetShellType() == ViewShell::ST_OUTLINE )
1146cdf0e10cSrcweir 		{
1147cdf0e10cSrcweir 			OutlineView* pOlView = dynamic_cast< OutlineView* >( pView );
1148cdf0e10cSrcweir 			if( pOlView )
1149cdf0e10cSrcweir 			{
1150cdf0e10cSrcweir 				::Outliner* pOutl = pOlView->GetOutliner();
1151cdf0e10cSrcweir 				if( pOutl )
1152cdf0e10cSrcweir 					return &pOutl->GetUndoManager();
1153cdf0e10cSrcweir 			}
1154cdf0e10cSrcweir 		}
1155cdf0e10cSrcweir 		else if( pView->IsTextEdit() )
1156cdf0e10cSrcweir 		{
1157cdf0e10cSrcweir 			SdrOutliner* pOL = pView->GetTextEditOutliner();
1158cdf0e10cSrcweir 			if( pOL )
1159cdf0e10cSrcweir 				return &pOL->GetUndoManager();
1160cdf0e10cSrcweir 		}
1161cdf0e10cSrcweir 	}
1162cdf0e10cSrcweir 
1163cdf0e10cSrcweir 	if( GetDocSh() )
1164cdf0e10cSrcweir 		return GetDocSh()->GetUndoManager();
1165cdf0e10cSrcweir 
1166cdf0e10cSrcweir 	return NULL;
1167cdf0e10cSrcweir }
1168cdf0e10cSrcweir 
1169cdf0e10cSrcweir 
1170cdf0e10cSrcweir 
1171cdf0e10cSrcweir 
1172cdf0e10cSrcweir void ViewShell::ImpGetUndoStrings(SfxItemSet &rSet) const
1173cdf0e10cSrcweir {
1174cdf0e10cSrcweir 	::svl::IUndoManager* pUndoManager = ImpGetUndoManager();
1175cdf0e10cSrcweir 	if(pUndoManager)
1176cdf0e10cSrcweir 	{
1177cdf0e10cSrcweir 		sal_uInt16 nCount(pUndoManager->GetUndoActionCount());
1178cdf0e10cSrcweir 		if(nCount)
1179cdf0e10cSrcweir 		{
1180cdf0e10cSrcweir 			// prepare list
1181cdf0e10cSrcweir 			List aStringList;
1182cdf0e10cSrcweir 			sal_uInt16 a;
1183cdf0e10cSrcweir 
1184cdf0e10cSrcweir 			for( a = 0; a < nCount; a++)
1185cdf0e10cSrcweir 			{
1186cdf0e10cSrcweir 				// generate one String in list per undo step
1187cdf0e10cSrcweir 				String* pInsertString = new String(pUndoManager->GetUndoActionComment(a));
1188cdf0e10cSrcweir 				aStringList.Insert(pInsertString, LIST_APPEND);
1189cdf0e10cSrcweir 			}
1190cdf0e10cSrcweir 
1191cdf0e10cSrcweir 			// set item
1192cdf0e10cSrcweir 			rSet.Put(SfxStringListItem(SID_GETUNDOSTRINGS, &aStringList));
1193cdf0e10cSrcweir 
1194cdf0e10cSrcweir 			// delete Strings again
1195cdf0e10cSrcweir 			for(a = 0; a < nCount; a++)
1196cdf0e10cSrcweir 				delete (String*)aStringList.GetObject(a);
1197cdf0e10cSrcweir 		}
1198cdf0e10cSrcweir 		else
1199cdf0e10cSrcweir 		{
1200cdf0e10cSrcweir 			rSet.DisableItem(SID_GETUNDOSTRINGS);
1201cdf0e10cSrcweir 		}
1202cdf0e10cSrcweir 	}
1203cdf0e10cSrcweir }
1204cdf0e10cSrcweir 
1205cdf0e10cSrcweir // -----------------------------------------------------------------------------
1206cdf0e10cSrcweir 
1207cdf0e10cSrcweir void ViewShell::ImpGetRedoStrings(SfxItemSet &rSet) const
1208cdf0e10cSrcweir {
1209cdf0e10cSrcweir 	::svl::IUndoManager* pUndoManager = ImpGetUndoManager();
1210cdf0e10cSrcweir 	if(pUndoManager)
1211cdf0e10cSrcweir 	{
1212cdf0e10cSrcweir 		sal_uInt16 nCount(pUndoManager->GetRedoActionCount());
1213cdf0e10cSrcweir 		if(nCount)
1214cdf0e10cSrcweir 		{
1215cdf0e10cSrcweir 			// prepare list
1216cdf0e10cSrcweir 			List aStringList;
1217cdf0e10cSrcweir 			sal_uInt16 a;
1218cdf0e10cSrcweir 
1219cdf0e10cSrcweir 			for( a = 0; a < nCount; a++)
1220cdf0e10cSrcweir 			{
1221cdf0e10cSrcweir 				// generate one String in list per undo step
1222cdf0e10cSrcweir 				String* pInsertString = new String(pUndoManager->GetRedoActionComment(a));
1223cdf0e10cSrcweir 				aStringList.Insert(pInsertString, LIST_APPEND);
1224cdf0e10cSrcweir 			}
1225cdf0e10cSrcweir 
1226cdf0e10cSrcweir 			// set item
1227cdf0e10cSrcweir 			rSet.Put(SfxStringListItem(SID_GETREDOSTRINGS, &aStringList));
1228cdf0e10cSrcweir 
1229cdf0e10cSrcweir 			// delete Strings again
1230cdf0e10cSrcweir 			for(a = 0; a < nCount; a++)
1231cdf0e10cSrcweir 				delete (String*)aStringList.GetObject(a);
1232cdf0e10cSrcweir 		}
1233cdf0e10cSrcweir 		else
1234cdf0e10cSrcweir 		{
1235cdf0e10cSrcweir 			rSet.DisableItem(SID_GETREDOSTRINGS);
1236cdf0e10cSrcweir 		}
1237cdf0e10cSrcweir 	}
1238cdf0e10cSrcweir }
1239cdf0e10cSrcweir 
1240cdf0e10cSrcweir // -----------------------------------------------------------------------------
1241cdf0e10cSrcweir 
1242cdf0e10cSrcweir void ViewShell::ImpSidUndo(sal_Bool, SfxRequest& rReq)
1243cdf0e10cSrcweir {
1244cdf0e10cSrcweir 	::svl::IUndoManager* pUndoManager = ImpGetUndoManager();
1245cdf0e10cSrcweir 	sal_uInt16 nNumber(1);
1246cdf0e10cSrcweir 	const SfxItemSet* pReqArgs = rReq.GetArgs();
1247cdf0e10cSrcweir 
1248cdf0e10cSrcweir 	if(pReqArgs)
1249cdf0e10cSrcweir 	{
1250cdf0e10cSrcweir 		SfxUInt16Item* pUIntItem = (SfxUInt16Item*)&pReqArgs->Get(SID_UNDO);
1251cdf0e10cSrcweir 		nNumber = pUIntItem->GetValue();
1252cdf0e10cSrcweir 	}
1253cdf0e10cSrcweir 
1254cdf0e10cSrcweir 	if(nNumber && pUndoManager)
1255cdf0e10cSrcweir 	{
1256cdf0e10cSrcweir 		sal_uInt16 nCount(pUndoManager->GetUndoActionCount());
1257cdf0e10cSrcweir 		if(nCount >= nNumber)
1258cdf0e10cSrcweir 		{
1259cdf0e10cSrcweir             try
1260cdf0e10cSrcweir             {
1261cdf0e10cSrcweir 			    // #94637# when UndoStack is cleared by ModifyPageUndoAction
1262cdf0e10cSrcweir 			    // the nCount may have changed, so test GetUndoActionCount()
1263cdf0e10cSrcweir 			    while(nNumber-- && pUndoManager->GetUndoActionCount())
1264cdf0e10cSrcweir 			    {
1265cdf0e10cSrcweir 				    pUndoManager->Undo();
1266cdf0e10cSrcweir 			    }
1267cdf0e10cSrcweir             }
1268cdf0e10cSrcweir             catch( const Exception& e )
1269cdf0e10cSrcweir             {
1270cdf0e10cSrcweir                 // no need to handle. By definition, the UndoManager handled this by clearing the
1271cdf0e10cSrcweir                 // Undo/Redo stacks
1272cdf0e10cSrcweir             }
1273cdf0e10cSrcweir 		}
1274cdf0e10cSrcweir 
1275cdf0e10cSrcweir 		// #91081# refresh rulers, maybe UNDO was move of TAB marker in ruler
1276cdf0e10cSrcweir 		if (mbHasRulers)
1277cdf0e10cSrcweir 		{
1278cdf0e10cSrcweir 			Invalidate(SID_ATTR_TABSTOP);
1279cdf0e10cSrcweir 		}
1280cdf0e10cSrcweir 	}
1281cdf0e10cSrcweir 
1282cdf0e10cSrcweir 	// This one is corresponding to the default handling
1283cdf0e10cSrcweir 	// of SID_UNDO in sfx2
1284cdf0e10cSrcweir 	GetViewFrame()->GetBindings().InvalidateAll(sal_False);
1285cdf0e10cSrcweir 
1286cdf0e10cSrcweir 	rReq.Done();
1287cdf0e10cSrcweir }
1288cdf0e10cSrcweir 
1289cdf0e10cSrcweir // -----------------------------------------------------------------------------
1290cdf0e10cSrcweir 
1291cdf0e10cSrcweir void ViewShell::ImpSidRedo(sal_Bool, SfxRequest& rReq)
1292cdf0e10cSrcweir {
1293cdf0e10cSrcweir 	::svl::IUndoManager* pUndoManager = ImpGetUndoManager();
1294cdf0e10cSrcweir 	sal_uInt16 nNumber(1);
1295cdf0e10cSrcweir 	const SfxItemSet* pReqArgs = rReq.GetArgs();
1296cdf0e10cSrcweir 
1297cdf0e10cSrcweir 	if(pReqArgs)
1298cdf0e10cSrcweir 	{
1299cdf0e10cSrcweir 		SfxUInt16Item* pUIntItem = (SfxUInt16Item*)&pReqArgs->Get(SID_REDO);
1300cdf0e10cSrcweir 		nNumber = pUIntItem->GetValue();
1301cdf0e10cSrcweir 	}
1302cdf0e10cSrcweir 
1303cdf0e10cSrcweir 	if(nNumber && pUndoManager)
1304cdf0e10cSrcweir 	{
1305cdf0e10cSrcweir 		sal_uInt16 nCount(pUndoManager->GetRedoActionCount());
1306cdf0e10cSrcweir 		if(nCount >= nNumber)
1307cdf0e10cSrcweir 		{
1308cdf0e10cSrcweir             try
1309cdf0e10cSrcweir             {
1310cdf0e10cSrcweir 			    // #94637# when UndoStack is cleared by ModifyPageRedoAction
1311cdf0e10cSrcweir 			    // the nCount may have changed, so test GetRedoActionCount()
1312cdf0e10cSrcweir 			    while(nNumber-- && pUndoManager->GetRedoActionCount())
1313cdf0e10cSrcweir 			    {
1314cdf0e10cSrcweir 				    pUndoManager->Redo();
1315cdf0e10cSrcweir 			    }
1316cdf0e10cSrcweir             }
1317cdf0e10cSrcweir             catch( const Exception& e )
1318cdf0e10cSrcweir             {
1319cdf0e10cSrcweir                 // no need to handle. By definition, the UndoManager handled this by clearing the
1320cdf0e10cSrcweir                 // Undo/Redo stacks
1321cdf0e10cSrcweir             }
1322cdf0e10cSrcweir 		}
1323cdf0e10cSrcweir 
1324cdf0e10cSrcweir 		// #91081# refresh rulers, maybe REDO was move of TAB marker in ruler
1325cdf0e10cSrcweir 		if (mbHasRulers)
1326cdf0e10cSrcweir 		{
1327cdf0e10cSrcweir 			Invalidate(SID_ATTR_TABSTOP);
1328cdf0e10cSrcweir 		}
1329cdf0e10cSrcweir 	}
1330cdf0e10cSrcweir 
1331cdf0e10cSrcweir 	// This one is corresponding to the default handling
1332cdf0e10cSrcweir 	// of SID_UNDO in sfx2
1333cdf0e10cSrcweir 	GetViewFrame()->GetBindings().InvalidateAll(sal_False);
1334cdf0e10cSrcweir 
1335cdf0e10cSrcweir 	rReq.Done();
1336cdf0e10cSrcweir }
1337cdf0e10cSrcweir 
1338cdf0e10cSrcweir // -----------------------------------------------------------------------------
1339cdf0e10cSrcweir 
1340cdf0e10cSrcweir void ViewShell::ExecReq( SfxRequest& rReq )
1341cdf0e10cSrcweir {
1342cdf0e10cSrcweir     sal_uInt16 nSlot = rReq.GetSlot();
1343cdf0e10cSrcweir     switch( nSlot )
1344cdf0e10cSrcweir     {
1345cdf0e10cSrcweir 		case SID_MAIL_SCROLLBODY_PAGEDOWN:
1346cdf0e10cSrcweir 		{
1347cdf0e10cSrcweir 			FunctionReference xFunc( GetCurrentFunction() );
1348cdf0e10cSrcweir 			if( xFunc.is() )
1349cdf0e10cSrcweir 			{
1350cdf0e10cSrcweir 				xFunc->ScrollStart();
1351cdf0e10cSrcweir 				ScrollLines( 0, -1 );
1352cdf0e10cSrcweir 				xFunc->ScrollEnd();
1353cdf0e10cSrcweir 			}
1354cdf0e10cSrcweir 
1355cdf0e10cSrcweir             rReq.Done();
1356cdf0e10cSrcweir 		}
1357cdf0e10cSrcweir 		break;
1358cdf0e10cSrcweir 
1359cdf0e10cSrcweir 		case SID_OUTPUT_QUALITY_COLOR:
1360cdf0e10cSrcweir 		case SID_OUTPUT_QUALITY_GRAYSCALE:
1361cdf0e10cSrcweir 		case SID_OUTPUT_QUALITY_BLACKWHITE:
1362cdf0e10cSrcweir 		case SID_OUTPUT_QUALITY_CONTRAST:
1363cdf0e10cSrcweir 		{
1364cdf0e10cSrcweir 			sal_uLong nMode = OUTPUT_DRAWMODE_COLOR;
1365cdf0e10cSrcweir 
1366cdf0e10cSrcweir             switch( nSlot )
1367cdf0e10cSrcweir 			{
1368cdf0e10cSrcweir 			    case SID_OUTPUT_QUALITY_COLOR: nMode = OUTPUT_DRAWMODE_COLOR; break;
1369cdf0e10cSrcweir 			    case SID_OUTPUT_QUALITY_GRAYSCALE: nMode = OUTPUT_DRAWMODE_GRAYSCALE; break;
1370cdf0e10cSrcweir 			    case SID_OUTPUT_QUALITY_BLACKWHITE: nMode = OUTPUT_DRAWMODE_BLACKWHITE; break;
1371cdf0e10cSrcweir 			    case SID_OUTPUT_QUALITY_CONTRAST: nMode = OUTPUT_DRAWMODE_CONTRAST; break;
1372cdf0e10cSrcweir 			}
1373cdf0e10cSrcweir 
1374cdf0e10cSrcweir 			GetActiveWindow()->SetDrawMode( nMode );
1375cdf0e10cSrcweir             mpFrameView->SetDrawMode( nMode );
1376cdf0e10cSrcweir // #110094#-7
1377cdf0e10cSrcweir //            GetView()->ReleaseMasterPagePaintCache();
1378cdf0e10cSrcweir 			GetActiveWindow()->Invalidate();
1379cdf0e10cSrcweir 
1380cdf0e10cSrcweir 			Invalidate();
1381cdf0e10cSrcweir 			rReq.Done();
1382cdf0e10cSrcweir 			break;
1383cdf0e10cSrcweir 		}
1384cdf0e10cSrcweir     }
1385cdf0e10cSrcweir }
1386cdf0e10cSrcweir 
1387cdf0e10cSrcweir 
1388cdf0e10cSrcweir 
1389cdf0e10cSrcweir 
1390cdf0e10cSrcweir /** This default implemenation returns only an empty reference.  See derived
1391cdf0e10cSrcweir     classes for more interesting examples.
1392cdf0e10cSrcweir */
1393cdf0e10cSrcweir ::com::sun::star::uno::Reference<
1394cdf0e10cSrcweir     ::com::sun::star::accessibility::XAccessible>
1395cdf0e10cSrcweir ViewShell::CreateAccessibleDocumentView (::sd::Window* )
1396cdf0e10cSrcweir {
1397cdf0e10cSrcweir     return ::com::sun::star::uno::Reference<
1398cdf0e10cSrcweir         ::com::sun::star::accessibility::XAccessible> ();
1399cdf0e10cSrcweir }
1400cdf0e10cSrcweir 
1401cdf0e10cSrcweir 
1402cdf0e10cSrcweir 
1403cdf0e10cSrcweir ::sd::WindowUpdater* ViewShell::GetWindowUpdater (void) const
1404cdf0e10cSrcweir {
1405cdf0e10cSrcweir     return mpWindowUpdater.get();
1406cdf0e10cSrcweir }
1407cdf0e10cSrcweir 
1408cdf0e10cSrcweir 
1409cdf0e10cSrcweir 
1410cdf0e10cSrcweir 
1411cdf0e10cSrcweir ViewShellBase& ViewShell::GetViewShellBase (void) const
1412cdf0e10cSrcweir {
1413cdf0e10cSrcweir     return *static_cast<ViewShellBase*>(GetViewShell());
1414cdf0e10cSrcweir }
1415cdf0e10cSrcweir 
1416cdf0e10cSrcweir 
1417cdf0e10cSrcweir 
1418cdf0e10cSrcweir 
1419cdf0e10cSrcweir ViewShell::ShellType ViewShell::GetShellType (void) const
1420cdf0e10cSrcweir {
1421cdf0e10cSrcweir     return meShellType;
1422cdf0e10cSrcweir }
1423cdf0e10cSrcweir 
1424cdf0e10cSrcweir 
1425cdf0e10cSrcweir 
1426cdf0e10cSrcweir 
1427cdf0e10cSrcweir DrawDocShell* ViewShell::GetDocSh (void) const
1428cdf0e10cSrcweir {
1429cdf0e10cSrcweir     return GetViewShellBase().GetDocShell();
1430cdf0e10cSrcweir }
1431cdf0e10cSrcweir 
1432cdf0e10cSrcweir 
1433cdf0e10cSrcweir 
1434cdf0e10cSrcweir 
1435cdf0e10cSrcweir SdDrawDocument* ViewShell::GetDoc (void) const
1436cdf0e10cSrcweir {
1437cdf0e10cSrcweir     return GetViewShellBase().GetDocument();
1438cdf0e10cSrcweir }
1439cdf0e10cSrcweir 
1440cdf0e10cSrcweir ErrCode ViewShell::DoVerb (long )
1441cdf0e10cSrcweir {
1442cdf0e10cSrcweir     return ERRCODE_NONE;
1443cdf0e10cSrcweir }
1444cdf0e10cSrcweir 
1445cdf0e10cSrcweir void ViewShell::SetCurrentFunction( const FunctionReference& xFunction)
1446cdf0e10cSrcweir {
1447cdf0e10cSrcweir 	if( mxCurrentFunction.is() && (mxOldFunction != mxCurrentFunction) )
1448cdf0e10cSrcweir 		mxCurrentFunction->Dispose();
1449cdf0e10cSrcweir 	FunctionReference xTemp( mxCurrentFunction );
1450cdf0e10cSrcweir     mxCurrentFunction = xFunction;
1451cdf0e10cSrcweir }
1452cdf0e10cSrcweir 
1453cdf0e10cSrcweir void ViewShell::SetOldFunction(const FunctionReference& xFunction)
1454cdf0e10cSrcweir {
1455cdf0e10cSrcweir 	if( mxOldFunction.is() && (xFunction != mxOldFunction) && (mxCurrentFunction != mxOldFunction) )
1456cdf0e10cSrcweir 		mxOldFunction->Dispose();
1457cdf0e10cSrcweir 
1458cdf0e10cSrcweir 	FunctionReference xTemp( mxOldFunction );
1459cdf0e10cSrcweir     mxOldFunction = xFunction;
1460cdf0e10cSrcweir }
1461cdf0e10cSrcweir 
1462cdf0e10cSrcweir /** this method deactivates the current function. If an old function is
1463cdf0e10cSrcweir 	saved, this will become activated and current function.
1464cdf0e10cSrcweir */
1465cdf0e10cSrcweir void ViewShell::Cancel()
1466cdf0e10cSrcweir {
1467cdf0e10cSrcweir 	if(mxCurrentFunction.is() && (mxCurrentFunction != mxOldFunction ))
1468cdf0e10cSrcweir 	{
1469cdf0e10cSrcweir 		FunctionReference xTemp( mxCurrentFunction );
1470cdf0e10cSrcweir 		mxCurrentFunction.clear();
1471cdf0e10cSrcweir 		xTemp->Deactivate();
1472cdf0e10cSrcweir 		xTemp->Dispose();
1473cdf0e10cSrcweir 	}
1474cdf0e10cSrcweir 
1475cdf0e10cSrcweir 	if(mxOldFunction.is())
1476cdf0e10cSrcweir 	{
1477cdf0e10cSrcweir 		mxCurrentFunction = mxOldFunction;
1478cdf0e10cSrcweir 		mxCurrentFunction->Activate();
1479cdf0e10cSrcweir 	}
1480cdf0e10cSrcweir }
1481cdf0e10cSrcweir 
1482cdf0e10cSrcweir void ViewShell::DeactivateCurrentFunction( bool bPermanent /* == false */ )
1483cdf0e10cSrcweir {
1484cdf0e10cSrcweir 	if( mxCurrentFunction.is() )
1485cdf0e10cSrcweir 	{
1486cdf0e10cSrcweir 		if(bPermanent && (mxOldFunction == mxCurrentFunction))
1487cdf0e10cSrcweir 			mxOldFunction.clear();
1488cdf0e10cSrcweir 
1489cdf0e10cSrcweir 		mxCurrentFunction->Deactivate();
1490cdf0e10cSrcweir 		if( mxCurrentFunction != mxOldFunction )
1491cdf0e10cSrcweir 			mxCurrentFunction->Dispose();
1492cdf0e10cSrcweir 
1493cdf0e10cSrcweir 		FunctionReference xTemp( mxCurrentFunction );
1494cdf0e10cSrcweir 		mxCurrentFunction.clear();
1495cdf0e10cSrcweir 	}
1496cdf0e10cSrcweir }
1497cdf0e10cSrcweir 
1498cdf0e10cSrcweir void ViewShell::DisposeFunctions()
1499cdf0e10cSrcweir {
1500cdf0e10cSrcweir 	if(mxCurrentFunction.is())
1501cdf0e10cSrcweir 	{
1502cdf0e10cSrcweir 		FunctionReference xTemp( mxCurrentFunction );
1503cdf0e10cSrcweir 		mxCurrentFunction.clear();
1504cdf0e10cSrcweir 		xTemp->Deactivate();
1505cdf0e10cSrcweir 		xTemp->Dispose();
1506cdf0e10cSrcweir 	}
1507cdf0e10cSrcweir 
1508cdf0e10cSrcweir 	if(mxOldFunction.is())
1509cdf0e10cSrcweir 	{
1510cdf0e10cSrcweir 		FunctionReference xTemp( mxOldFunction );
1511cdf0e10cSrcweir 		mxOldFunction->Dispose();
1512cdf0e10cSrcweir 		mxOldFunction.clear();
1513cdf0e10cSrcweir 	}
1514cdf0e10cSrcweir }
1515cdf0e10cSrcweir 
1516cdf0e10cSrcweir bool ViewShell::IsMainViewShell (void) const
1517cdf0e10cSrcweir {
1518cdf0e10cSrcweir     return mpImpl->mbIsMainViewShell;
1519cdf0e10cSrcweir     //    return GetViewShellBase().GetMainViewShell() == this;
1520cdf0e10cSrcweir }
1521cdf0e10cSrcweir 
1522cdf0e10cSrcweir void ViewShell::SetIsMainViewShell (bool bIsMainViewShell)
1523cdf0e10cSrcweir {
1524cdf0e10cSrcweir     if (bIsMainViewShell != mpImpl->mbIsMainViewShell)
1525cdf0e10cSrcweir     {
1526cdf0e10cSrcweir         mpImpl->mbIsMainViewShell = bIsMainViewShell;
1527cdf0e10cSrcweir         if (bIsMainViewShell)
1528cdf0e10cSrcweir         {
1529cdf0e10cSrcweir             GetDocSh()->Connect (this);
1530cdf0e10cSrcweir         }
1531cdf0e10cSrcweir         else
1532cdf0e10cSrcweir         {
1533cdf0e10cSrcweir             GetDocSh()->Disconnect (this);
1534cdf0e10cSrcweir         }
1535cdf0e10cSrcweir     }
1536cdf0e10cSrcweir }
1537cdf0e10cSrcweir 
1538cdf0e10cSrcweir 
1539cdf0e10cSrcweir 
1540cdf0e10cSrcweir 
1541cdf0e10cSrcweir ::sd::Window* ViewShell::GetActiveWindow (void) const
1542cdf0e10cSrcweir {
1543cdf0e10cSrcweir     return mpActiveWindow;
1544cdf0e10cSrcweir }
1545cdf0e10cSrcweir 
1546cdf0e10cSrcweir 
1547cdf0e10cSrcweir 
1548cdf0e10cSrcweir 
1549cdf0e10cSrcweir void ViewShell::PrePaint()
1550cdf0e10cSrcweir {
1551cdf0e10cSrcweir }
1552cdf0e10cSrcweir 
1553cdf0e10cSrcweir 
1554cdf0e10cSrcweir 
1555cdf0e10cSrcweir 
1556cdf0e10cSrcweir void ViewShell::Paint (const Rectangle&, ::sd::Window* )
1557cdf0e10cSrcweir {
1558cdf0e10cSrcweir }
1559cdf0e10cSrcweir 
1560cdf0e10cSrcweir 
1561cdf0e10cSrcweir 
1562cdf0e10cSrcweir 
1563cdf0e10cSrcweir void ViewShell::Draw(OutputDevice &, const Region &)
1564cdf0e10cSrcweir {
1565cdf0e10cSrcweir }
1566cdf0e10cSrcweir 
1567cdf0e10cSrcweir 
1568cdf0e10cSrcweir 
1569cdf0e10cSrcweir 
1570cdf0e10cSrcweir ZoomList* ViewShell::GetZoomList (void)
1571cdf0e10cSrcweir {
1572cdf0e10cSrcweir     return mpZoomList;
1573cdf0e10cSrcweir }
1574cdf0e10cSrcweir 
1575cdf0e10cSrcweir 
1576cdf0e10cSrcweir 
1577cdf0e10cSrcweir 
1578cdf0e10cSrcweir void ViewShell::ShowUIControls (bool bVisible)
1579cdf0e10cSrcweir {
1580cdf0e10cSrcweir     mpImpl->mbIsShowingUIControls = bVisible;
1581cdf0e10cSrcweir 
1582cdf0e10cSrcweir 	if (mbHasRulers)
1583cdf0e10cSrcweir 	{
1584cdf0e10cSrcweir 		if (mpHorizontalRuler.get() != NULL)
1585cdf0e10cSrcweir 			mpHorizontalRuler->Show( bVisible );
1586cdf0e10cSrcweir 
1587cdf0e10cSrcweir 		if (mpVerticalRuler.get() != NULL)
1588cdf0e10cSrcweir             mpVerticalRuler->Show( bVisible );
1589cdf0e10cSrcweir 	}
1590cdf0e10cSrcweir 
1591cdf0e10cSrcweir 	if (mpVerticalScrollBar.get() != NULL)
1592cdf0e10cSrcweir 		mpVerticalScrollBar->Show( bVisible );
1593cdf0e10cSrcweir 
1594cdf0e10cSrcweir 	if (mpHorizontalScrollBar.get() != NULL)
1595cdf0e10cSrcweir 		mpHorizontalScrollBar->Show( bVisible );
1596cdf0e10cSrcweir 
1597cdf0e10cSrcweir 	if (mpScrollBarBox.get() != NULL)
1598cdf0e10cSrcweir         mpScrollBarBox->Show(bVisible);
1599cdf0e10cSrcweir 
1600cdf0e10cSrcweir     if (mpContentWindow.get() != NULL)
1601cdf0e10cSrcweir         mpContentWindow->Show( bVisible );
1602cdf0e10cSrcweir }
1603cdf0e10cSrcweir 
1604cdf0e10cSrcweir 
1605cdf0e10cSrcweir 
1606cdf0e10cSrcweir 
1607cdf0e10cSrcweir 
1608cdf0e10cSrcweir bool ViewShell::RelocateToParentWindow (::Window* pParentWindow)
1609cdf0e10cSrcweir {
1610cdf0e10cSrcweir     mpParentWindow = pParentWindow;
1611cdf0e10cSrcweir 
1612cdf0e10cSrcweir     mpParentWindow->SetBackground (Wallpaper());
1613cdf0e10cSrcweir 
1614cdf0e10cSrcweir     if (mpContentWindow.get() != NULL)
1615cdf0e10cSrcweir         mpContentWindow->SetParent(pParentWindow);
1616cdf0e10cSrcweir 
1617cdf0e10cSrcweir     if (mpHorizontalScrollBar.get() != NULL)
1618cdf0e10cSrcweir         mpHorizontalScrollBar->SetParent(mpParentWindow);
1619cdf0e10cSrcweir     if (mpVerticalScrollBar.get() != NULL)
1620cdf0e10cSrcweir         mpVerticalScrollBar->SetParent(mpParentWindow);
1621cdf0e10cSrcweir     if (mpScrollBarBox.get() != NULL)
1622cdf0e10cSrcweir         mpScrollBarBox->SetParent(mpParentWindow);
1623cdf0e10cSrcweir 
1624cdf0e10cSrcweir     return true;
1625cdf0e10cSrcweir }
1626cdf0e10cSrcweir 
1627cdf0e10cSrcweir 
1628cdf0e10cSrcweir 
1629cdf0e10cSrcweir } // end of namespace sd
1630cdf0e10cSrcweir 
1631cdf0e10cSrcweir 
1632cdf0e10cSrcweir 
1633cdf0e10cSrcweir 
1634cdf0e10cSrcweir 
1635cdf0e10cSrcweir //===== ViewShellObjectBarFactory =============================================
1636cdf0e10cSrcweir 
1637cdf0e10cSrcweir namespace {
1638cdf0e10cSrcweir 
1639cdf0e10cSrcweir ViewShellObjectBarFactory::ViewShellObjectBarFactory (
1640cdf0e10cSrcweir     ::sd::ViewShell& rViewShell)
1641cdf0e10cSrcweir     : mrViewShell (rViewShell)
1642cdf0e10cSrcweir {
1643cdf0e10cSrcweir }
1644cdf0e10cSrcweir 
1645cdf0e10cSrcweir 
1646cdf0e10cSrcweir 
1647cdf0e10cSrcweir 
1648cdf0e10cSrcweir ViewShellObjectBarFactory::~ViewShellObjectBarFactory (void)
1649cdf0e10cSrcweir {
1650cdf0e10cSrcweir     for (ShellCache::iterator aI(maShellCache.begin());
1651cdf0e10cSrcweir          aI!=maShellCache.end();
1652cdf0e10cSrcweir          aI++)
1653cdf0e10cSrcweir     {
1654cdf0e10cSrcweir         delete aI->second;
1655cdf0e10cSrcweir     }
1656cdf0e10cSrcweir }
1657cdf0e10cSrcweir 
1658cdf0e10cSrcweir 
1659cdf0e10cSrcweir 
1660cdf0e10cSrcweir 
1661cdf0e10cSrcweir SfxShell* ViewShellObjectBarFactory::CreateShell (
1662cdf0e10cSrcweir     ::sd::ShellId nId,
1663cdf0e10cSrcweir     ::Window*,
1664cdf0e10cSrcweir     ::sd::FrameView* )
1665cdf0e10cSrcweir {
1666cdf0e10cSrcweir     SfxShell* pShell = NULL;
1667cdf0e10cSrcweir 
1668cdf0e10cSrcweir     ShellCache::iterator aI (maShellCache.find(nId));
1669cdf0e10cSrcweir     if (aI == maShellCache.end() || aI->second==NULL)
1670cdf0e10cSrcweir     {
1671cdf0e10cSrcweir         ::sd::View* pView = mrViewShell.GetView();
1672cdf0e10cSrcweir         switch (nId)
1673cdf0e10cSrcweir         {
1674cdf0e10cSrcweir             case RID_BEZIER_TOOLBOX:
1675cdf0e10cSrcweir                 pShell = new ::sd::BezierObjectBar(&mrViewShell, pView);
1676cdf0e10cSrcweir                 break;
1677cdf0e10cSrcweir 
1678cdf0e10cSrcweir             case RID_DRAW_TEXT_TOOLBOX:
1679cdf0e10cSrcweir                 pShell = new ::sd::TextObjectBar(
1680cdf0e10cSrcweir                     &mrViewShell, mrViewShell.GetDoc()->GetPool(), pView);
1681cdf0e10cSrcweir                 break;
1682cdf0e10cSrcweir 
1683cdf0e10cSrcweir             case RID_DRAW_GRAF_TOOLBOX:
1684cdf0e10cSrcweir                 pShell = new ::sd::GraphicObjectBar(&mrViewShell, pView);
1685cdf0e10cSrcweir                 break;
1686cdf0e10cSrcweir 
1687cdf0e10cSrcweir             case RID_DRAW_MEDIA_TOOLBOX:
1688cdf0e10cSrcweir                 pShell = new ::sd::MediaObjectBar(&mrViewShell, pView);
1689cdf0e10cSrcweir                 break;
1690cdf0e10cSrcweir 
1691cdf0e10cSrcweir 			case RID_DRAW_TABLE_TOOLBOX:
1692cdf0e10cSrcweir 				pShell = ::sd::ui::table::CreateTableObjectBar( mrViewShell, pView );
1693cdf0e10cSrcweir 				break;
1694cdf0e10cSrcweir 
1695cdf0e10cSrcweir             case RID_SVX_EXTRUSION_BAR:
1696cdf0e10cSrcweir                 pShell = new ::svx::ExtrusionBar(
1697cdf0e10cSrcweir                     &mrViewShell.GetViewShellBase());
1698cdf0e10cSrcweir                 break;
1699cdf0e10cSrcweir 
1700cdf0e10cSrcweir             case RID_SVX_FONTWORK_BAR:
1701cdf0e10cSrcweir                 pShell = new ::svx::FontworkBar(
1702cdf0e10cSrcweir                     &mrViewShell.GetViewShellBase());
1703cdf0e10cSrcweir                 break;
1704cdf0e10cSrcweir 
1705cdf0e10cSrcweir             default:
1706cdf0e10cSrcweir                 pShell = NULL;
1707cdf0e10cSrcweir                 break;
1708cdf0e10cSrcweir         }
1709cdf0e10cSrcweir     }
1710cdf0e10cSrcweir     else
1711cdf0e10cSrcweir         pShell = aI->second;
1712cdf0e10cSrcweir 
1713cdf0e10cSrcweir     return pShell;
1714cdf0e10cSrcweir }
1715cdf0e10cSrcweir 
1716cdf0e10cSrcweir 
1717cdf0e10cSrcweir 
1718cdf0e10cSrcweir 
1719cdf0e10cSrcweir void ViewShellObjectBarFactory::ReleaseShell (SfxShell* pShell)
1720cdf0e10cSrcweir {
1721cdf0e10cSrcweir     if (pShell != NULL)
1722cdf0e10cSrcweir         delete pShell;
1723cdf0e10cSrcweir }
1724cdf0e10cSrcweir 
1725cdf0e10cSrcweir } // end of anonymous namespace
1726