1*06bcd5d2SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*06bcd5d2SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*06bcd5d2SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*06bcd5d2SAndrew Rist * distributed with this work for additional information 6*06bcd5d2SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*06bcd5d2SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*06bcd5d2SAndrew Rist * "License"); you may not use this file except in compliance 9*06bcd5d2SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*06bcd5d2SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*06bcd5d2SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*06bcd5d2SAndrew Rist * software distributed under the License is distributed on an 15*06bcd5d2SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*06bcd5d2SAndrew Rist * KIND, either express or implied. See the License for the 17*06bcd5d2SAndrew Rist * specific language governing permissions and limitations 18*06bcd5d2SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*06bcd5d2SAndrew Rist *************************************************************/ 21*06bcd5d2SAndrew Rist 22*06bcd5d2SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef SDEXT_PRESENTER_PANE_FACTORY_HXX 25cdf0e10cSrcweir #define SDEXT_PRESENTER_PANE_FACTORY_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <cppuhelper/compbase1.hxx> 28cdf0e10cSrcweir #include <cppuhelper/basemutex.hxx> 29cdf0e10cSrcweir #include <com/sun/star/frame/XController.hpp> 30cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp> 31cdf0e10cSrcweir #include <com/sun/star/drawing/XPresenterHelper.hpp> 32cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XConfigurationController.hpp> 33cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XPane.hpp> 34cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XResourceFactory.hpp> 35cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp> 36cdf0e10cSrcweir #include <rtl/ref.hxx> 37cdf0e10cSrcweir #include <boost/scoped_ptr.hpp> 38cdf0e10cSrcweir #include <map> 39cdf0e10cSrcweir 40cdf0e10cSrcweir namespace css = ::com::sun::star; 41cdf0e10cSrcweir 42cdf0e10cSrcweir namespace sdext { namespace presenter { 43cdf0e10cSrcweir 44cdf0e10cSrcweir class PresenterController; 45cdf0e10cSrcweir 46cdf0e10cSrcweir namespace { 47cdf0e10cSrcweir typedef ::cppu::WeakComponentImplHelper1 < 48cdf0e10cSrcweir css::drawing::framework::XResourceFactory 49cdf0e10cSrcweir > PresenterPaneFactoryInterfaceBase; 50cdf0e10cSrcweir } 51cdf0e10cSrcweir 52cdf0e10cSrcweir 53cdf0e10cSrcweir /** The PresenerPaneFactory provides a fixed set of panes. 54cdf0e10cSrcweir 55cdf0e10cSrcweir In order to make the presener screen more easily extendable in the 56cdf0e10cSrcweir future the set of supported panes could be made extendable on demand. 57cdf0e10cSrcweir */ 58cdf0e10cSrcweir class PresenterPaneFactory 59cdf0e10cSrcweir : public ::cppu::BaseMutex, 60cdf0e10cSrcweir public PresenterPaneFactoryInterfaceBase 61cdf0e10cSrcweir { 62cdf0e10cSrcweir public: 63cdf0e10cSrcweir static const ::rtl::OUString msCurrentSlidePreviewPaneURL; 64cdf0e10cSrcweir static const ::rtl::OUString msNextSlidePreviewPaneURL; 65cdf0e10cSrcweir static const ::rtl::OUString msNotesPaneURL; 66cdf0e10cSrcweir static const ::rtl::OUString msToolBarPaneURL; 67cdf0e10cSrcweir static const ::rtl::OUString msSlideSorterPaneURL; 68cdf0e10cSrcweir static const ::rtl::OUString msHelpPaneURL; 69cdf0e10cSrcweir static const ::rtl::OUString msOverlayPaneURL; 70cdf0e10cSrcweir 71cdf0e10cSrcweir /** Create a new instance of this class and register it as resource 72cdf0e10cSrcweir factory in the drawing framework of the given controller. 73cdf0e10cSrcweir This registration keeps it alive. When the drawing framework is 74cdf0e10cSrcweir shut down and releases its reference to the factory then the factory 75cdf0e10cSrcweir is destroyed. 76cdf0e10cSrcweir */ 77cdf0e10cSrcweir static css::uno::Reference<css::drawing::framework::XResourceFactory> Create ( 78cdf0e10cSrcweir const css::uno::Reference<css::uno::XComponentContext>& rxContext, 79cdf0e10cSrcweir const css::uno::Reference<css::frame::XController>& rxController, 80cdf0e10cSrcweir const ::rtl::Reference<PresenterController>& rpPresenterController); 81cdf0e10cSrcweir virtual ~PresenterPaneFactory (void); 82cdf0e10cSrcweir 83cdf0e10cSrcweir static ::rtl::OUString getImplementationName_static (void); 84cdf0e10cSrcweir static css::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static (void); 85cdf0e10cSrcweir static css::uno::Reference<css::uno::XInterface> Create( 86cdf0e10cSrcweir const css::uno::Reference<css::uno::XComponentContext>& rxContext) 87cdf0e10cSrcweir SAL_THROW((css::uno::Exception)); 88cdf0e10cSrcweir 89cdf0e10cSrcweir virtual void SAL_CALL disposing (void) 90cdf0e10cSrcweir throw (css::uno::RuntimeException); 91cdf0e10cSrcweir 92cdf0e10cSrcweir // XResourceFactory 93cdf0e10cSrcweir 94cdf0e10cSrcweir virtual css::uno::Reference<css::drawing::framework::XResource> 95cdf0e10cSrcweir SAL_CALL createResource ( 96cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 97cdf0e10cSrcweir com::sun::star::drawing::framework::XResourceId>& rxPaneId) 98cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException); 99cdf0e10cSrcweir 100cdf0e10cSrcweir virtual void SAL_CALL 101cdf0e10cSrcweir releaseResource ( 102cdf0e10cSrcweir const ::com::sun::star::uno::Reference<com::sun::star::drawing::framework::XResource>& 103cdf0e10cSrcweir rxPane) 104cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException); 105cdf0e10cSrcweir 106cdf0e10cSrcweir private: 107cdf0e10cSrcweir css::uno::WeakReference<css::uno::XComponentContext> mxComponentContextWeak; 108cdf0e10cSrcweir css::uno::WeakReference<css::drawing::framework::XConfigurationController> 109cdf0e10cSrcweir mxConfigurationControllerWeak; 110cdf0e10cSrcweir ::rtl::Reference<PresenterController> mpPresenterController; 111cdf0e10cSrcweir typedef ::std::map<rtl::OUString, css::uno::Reference<css::drawing::framework::XResource> > 112cdf0e10cSrcweir ResourceContainer; 113cdf0e10cSrcweir ::boost::scoped_ptr<ResourceContainer> mpResourceCache; 114cdf0e10cSrcweir 115cdf0e10cSrcweir PresenterPaneFactory ( 116cdf0e10cSrcweir const css::uno::Reference<css::uno::XComponentContext>& rxContext, 117cdf0e10cSrcweir const ::rtl::Reference<PresenterController>& rpPresenterController); 118cdf0e10cSrcweir 119cdf0e10cSrcweir void Register (const css::uno::Reference<css::frame::XController>& rxController); 120cdf0e10cSrcweir 121cdf0e10cSrcweir css::uno::Reference<css::drawing::framework::XResource> CreatePane ( 122cdf0e10cSrcweir const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId, 123cdf0e10cSrcweir const ::rtl::OUString& rsTitle); 124cdf0e10cSrcweir css::uno::Reference<css::drawing::framework::XResource> CreatePane ( 125cdf0e10cSrcweir const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId, 126cdf0e10cSrcweir const ::rtl::OUString& rsTitle, 127cdf0e10cSrcweir const css::uno::Reference<css::drawing::framework::XPane>& rxParentPane, 128cdf0e10cSrcweir const bool bIsSpritePane); 129cdf0e10cSrcweir 130cdf0e10cSrcweir void ThrowIfDisposed (void) const throw (::com::sun::star::lang::DisposedException); 131cdf0e10cSrcweir }; 132cdf0e10cSrcweir 133cdf0e10cSrcweir } } 134cdf0e10cSrcweir 135cdf0e10cSrcweir #endif 136