1*c45d927aSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*c45d927aSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*c45d927aSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*c45d927aSAndrew Rist * distributed with this work for additional information 6*c45d927aSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*c45d927aSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*c45d927aSAndrew Rist * "License"); you may not use this file except in compliance 9*c45d927aSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*c45d927aSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*c45d927aSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*c45d927aSAndrew Rist * software distributed under the License is distributed on an 15*c45d927aSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*c45d927aSAndrew Rist * KIND, either express or implied. See the License for the 17*c45d927aSAndrew Rist * specific language governing permissions and limitations 18*c45d927aSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*c45d927aSAndrew Rist *************************************************************/ 21*c45d927aSAndrew Rist 22*c45d927aSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef SD_FRAMEWORK_BASIC_VIEW_FACTORY_HXX 25cdf0e10cSrcweir #define SD_FRAMEWORK_BASIC_VIEW_FACTORY_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "MutexOwner.hxx" 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XResourceFactory.hpp> 30cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XConfigurationController.hpp> 31cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XPane.hpp> 32cdf0e10cSrcweir #include <com/sun/star/frame/XController.hpp> 33cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp> 34cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp> 35cdf0e10cSrcweir 36cdf0e10cSrcweir #include <cppuhelper/compbase2.hxx> 37cdf0e10cSrcweir #include <osl/mutex.hxx> 38cdf0e10cSrcweir 39cdf0e10cSrcweir #include <boost/shared_ptr.hpp> 40cdf0e10cSrcweir #include <boost/scoped_ptr.hpp> 41cdf0e10cSrcweir 42cdf0e10cSrcweir namespace css = ::com::sun::star; 43cdf0e10cSrcweir 44cdf0e10cSrcweir namespace sd { 45cdf0e10cSrcweir class ViewShell; 46cdf0e10cSrcweir class ViewShellBase; 47cdf0e10cSrcweir class FrameView; 48cdf0e10cSrcweir } 49cdf0e10cSrcweir class SfxViewFrame; 50cdf0e10cSrcweir class Window; 51cdf0e10cSrcweir 52cdf0e10cSrcweir namespace { 53cdf0e10cSrcweir 54cdf0e10cSrcweir typedef ::cppu::WeakComponentImplHelper2 < 55cdf0e10cSrcweir css::drawing::framework::XResourceFactory, 56cdf0e10cSrcweir css::lang::XInitialization 57cdf0e10cSrcweir > BasicViewFactoryInterfaceBase; 58cdf0e10cSrcweir 59cdf0e10cSrcweir } // end of anonymous namespace. 60cdf0e10cSrcweir 61cdf0e10cSrcweir 62cdf0e10cSrcweir 63cdf0e10cSrcweir 64cdf0e10cSrcweir namespace sd { namespace framework { 65cdf0e10cSrcweir 66cdf0e10cSrcweir /** Factory for the frequently used standard views of the drawing framework: 67cdf0e10cSrcweir private:resource/view/ 68cdf0e10cSrcweir private:resource/view/ImpressView 69cdf0e10cSrcweir private:resource/view/GraphicView 70cdf0e10cSrcweir private:resource/view/OutlineView 71cdf0e10cSrcweir private:resource/view/NotesView 72cdf0e10cSrcweir private:resource/view/HandoutView 73cdf0e10cSrcweir private:resource/view/SlideSorter 74cdf0e10cSrcweir private:resource/view/PresentationView 75cdf0e10cSrcweir private:resource/view/TaskPane 76cdf0e10cSrcweir For some views in some panes this class also acts as a cache. 77cdf0e10cSrcweir */ 78cdf0e10cSrcweir class BasicViewFactory 79cdf0e10cSrcweir : private sd::MutexOwner, 80cdf0e10cSrcweir public BasicViewFactoryInterfaceBase 81cdf0e10cSrcweir { 82cdf0e10cSrcweir public: 83cdf0e10cSrcweir BasicViewFactory ( 84cdf0e10cSrcweir const css::uno::Reference<css::uno::XComponentContext>& rxContext); 85cdf0e10cSrcweir virtual ~BasicViewFactory (void); 86cdf0e10cSrcweir 87cdf0e10cSrcweir virtual void SAL_CALL disposing (void); 88cdf0e10cSrcweir 89cdf0e10cSrcweir 90cdf0e10cSrcweir // XViewFactory 91cdf0e10cSrcweir 92cdf0e10cSrcweir virtual css::uno::Reference<css::drawing::framework::XResource> 93cdf0e10cSrcweir SAL_CALL createResource ( 94cdf0e10cSrcweir const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) 95cdf0e10cSrcweir throw(css::uno::RuntimeException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException); 96cdf0e10cSrcweir 97cdf0e10cSrcweir virtual void SAL_CALL releaseResource ( 98cdf0e10cSrcweir const css::uno::Reference<css::drawing::framework::XResource>& xView) 99cdf0e10cSrcweir throw(css::uno::RuntimeException); 100cdf0e10cSrcweir 101cdf0e10cSrcweir 102cdf0e10cSrcweir // XInitialization 103cdf0e10cSrcweir 104cdf0e10cSrcweir virtual void SAL_CALL initialize( 105cdf0e10cSrcweir const css::uno::Sequence<css::uno::Any>& aArguments) 106cdf0e10cSrcweir throw (css::uno::Exception, css::uno::RuntimeException); 107cdf0e10cSrcweir 108cdf0e10cSrcweir private: 109cdf0e10cSrcweir css::uno::Reference<css::drawing::framework::XConfigurationController> 110cdf0e10cSrcweir mxConfigurationController; 111cdf0e10cSrcweir class ViewDescriptor; 112cdf0e10cSrcweir class ViewShellContainer; 113cdf0e10cSrcweir ::boost::scoped_ptr<ViewShellContainer> mpViewShellContainer; 114cdf0e10cSrcweir ViewShellBase* mpBase; 115cdf0e10cSrcweir FrameView* mpFrameView; 116cdf0e10cSrcweir 117cdf0e10cSrcweir class ViewCache; 118cdf0e10cSrcweir ::boost::shared_ptr<Window> mpWindow; 119cdf0e10cSrcweir ::boost::shared_ptr<ViewCache> mpViewCache; 120cdf0e10cSrcweir 121cdf0e10cSrcweir css::uno::Reference<css::drawing::framework::XPane> mxLocalPane; 122cdf0e10cSrcweir 123cdf0e10cSrcweir ::boost::shared_ptr<ViewDescriptor> CreateView ( 124cdf0e10cSrcweir const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId, 125cdf0e10cSrcweir SfxViewFrame& rFrame, 126cdf0e10cSrcweir ::Window& rWindow, 127cdf0e10cSrcweir const css::uno::Reference<css::drawing::framework::XPane>& rxPane, 128cdf0e10cSrcweir FrameView* pFrameView, 129cdf0e10cSrcweir const bool bIsCenterView); 130cdf0e10cSrcweir 131cdf0e10cSrcweir ::boost::shared_ptr<ViewShell> CreateViewShell ( 132cdf0e10cSrcweir const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId, 133cdf0e10cSrcweir SfxViewFrame& rFrame, 134cdf0e10cSrcweir ::Window& rWindow, 135cdf0e10cSrcweir FrameView* pFrameView, 136cdf0e10cSrcweir const bool bIsCenterView); 137cdf0e10cSrcweir 138cdf0e10cSrcweir void ActivateCenterView ( 139cdf0e10cSrcweir const ::boost::shared_ptr<ViewDescriptor>& rpDescriptor); 140cdf0e10cSrcweir 141cdf0e10cSrcweir void ReleaseView ( 142cdf0e10cSrcweir const ::boost::shared_ptr<ViewDescriptor>& rpDescriptor, 143cdf0e10cSrcweir bool bDoNotCache = false); 144cdf0e10cSrcweir 145cdf0e10cSrcweir bool IsCacheable ( 146cdf0e10cSrcweir const ::boost::shared_ptr<ViewDescriptor>& rpDescriptor); 147cdf0e10cSrcweir 148cdf0e10cSrcweir ::boost::shared_ptr<ViewDescriptor> GetViewFromCache ( 149cdf0e10cSrcweir const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId, 150cdf0e10cSrcweir const css::uno::Reference<css::drawing::framework::XPane>& rxPane); 151cdf0e10cSrcweir }; 152cdf0e10cSrcweir 153cdf0e10cSrcweir } } // end of namespace sd::framework 154cdf0e10cSrcweir 155cdf0e10cSrcweir #endif 156