1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef SD_FRAMEWORK_BASIC_VIEW_FACTORY_HXX 29 #define SD_FRAMEWORK_BASIC_VIEW_FACTORY_HXX 30 31 #include "MutexOwner.hxx" 32 33 #include <com/sun/star/drawing/framework/XResourceFactory.hpp> 34 #include <com/sun/star/drawing/framework/XConfigurationController.hpp> 35 #include <com/sun/star/drawing/framework/XPane.hpp> 36 #include <com/sun/star/frame/XController.hpp> 37 #include <com/sun/star/lang/XInitialization.hpp> 38 #include <com/sun/star/uno/XComponentContext.hpp> 39 40 #include <cppuhelper/compbase2.hxx> 41 #include <osl/mutex.hxx> 42 43 #include <boost/shared_ptr.hpp> 44 #include <boost/scoped_ptr.hpp> 45 46 namespace css = ::com::sun::star; 47 48 namespace sd { 49 class ViewShell; 50 class ViewShellBase; 51 class FrameView; 52 } 53 class SfxViewFrame; 54 class Window; 55 56 namespace { 57 58 typedef ::cppu::WeakComponentImplHelper2 < 59 css::drawing::framework::XResourceFactory, 60 css::lang::XInitialization 61 > BasicViewFactoryInterfaceBase; 62 63 } // end of anonymous namespace. 64 65 66 67 68 namespace sd { namespace framework { 69 70 /** Factory for the frequently used standard views of the drawing framework: 71 private:resource/view/ 72 private:resource/view/ImpressView 73 private:resource/view/GraphicView 74 private:resource/view/OutlineView 75 private:resource/view/NotesView 76 private:resource/view/HandoutView 77 private:resource/view/SlideSorter 78 private:resource/view/PresentationView 79 private:resource/view/TaskPane 80 For some views in some panes this class also acts as a cache. 81 */ 82 class BasicViewFactory 83 : private sd::MutexOwner, 84 public BasicViewFactoryInterfaceBase 85 { 86 public: 87 BasicViewFactory ( 88 const css::uno::Reference<css::uno::XComponentContext>& rxContext); 89 virtual ~BasicViewFactory (void); 90 91 virtual void SAL_CALL disposing (void); 92 93 94 // XViewFactory 95 96 virtual css::uno::Reference<css::drawing::framework::XResource> 97 SAL_CALL createResource ( 98 const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) 99 throw(css::uno::RuntimeException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException); 100 101 virtual void SAL_CALL releaseResource ( 102 const css::uno::Reference<css::drawing::framework::XResource>& xView) 103 throw(css::uno::RuntimeException); 104 105 106 // XInitialization 107 108 virtual void SAL_CALL initialize( 109 const css::uno::Sequence<css::uno::Any>& aArguments) 110 throw (css::uno::Exception, css::uno::RuntimeException); 111 112 private: 113 css::uno::Reference<css::drawing::framework::XConfigurationController> 114 mxConfigurationController; 115 class ViewDescriptor; 116 class ViewShellContainer; 117 ::boost::scoped_ptr<ViewShellContainer> mpViewShellContainer; 118 ViewShellBase* mpBase; 119 FrameView* mpFrameView; 120 121 class ViewCache; 122 ::boost::shared_ptr<Window> mpWindow; 123 ::boost::shared_ptr<ViewCache> mpViewCache; 124 125 css::uno::Reference<css::drawing::framework::XPane> mxLocalPane; 126 127 ::boost::shared_ptr<ViewDescriptor> CreateView ( 128 const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId, 129 SfxViewFrame& rFrame, 130 ::Window& rWindow, 131 const css::uno::Reference<css::drawing::framework::XPane>& rxPane, 132 FrameView* pFrameView, 133 const bool bIsCenterView); 134 135 ::boost::shared_ptr<ViewShell> CreateViewShell ( 136 const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId, 137 SfxViewFrame& rFrame, 138 ::Window& rWindow, 139 FrameView* pFrameView, 140 const bool bIsCenterView); 141 142 void ActivateCenterView ( 143 const ::boost::shared_ptr<ViewDescriptor>& rpDescriptor); 144 145 void ReleaseView ( 146 const ::boost::shared_ptr<ViewDescriptor>& rpDescriptor, 147 bool bDoNotCache = false); 148 149 bool IsCacheable ( 150 const ::boost::shared_ptr<ViewDescriptor>& rpDescriptor); 151 152 ::boost::shared_ptr<ViewDescriptor> GetViewFromCache ( 153 const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId, 154 const css::uno::Reference<css::drawing::framework::XPane>& rxPane); 155 }; 156 157 } } // end of namespace sd::framework 158 159 #endif 160