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