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_PRESENTATION_FACTORY_HXX
29 #define SD_FRAMEWORK_PRESENTATION_FACTORY_HXX
30 
31 #include "MutexOwner.hxx"
32 
33 #include <com/sun/star/drawing/framework/XResourceFactory.hpp>
34 #include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
35 #include <com/sun/star/drawing/framework/XConfigurationController.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 #include <osl/mutex.hxx>
40 #include <cppuhelper/compbase2.hxx>
41 
42 
43 #include <boost/scoped_ptr.hpp>
44 #include <boost/shared_ptr.hpp>
45 
46 namespace css = ::com::sun::star;
47 
48 namespace {
49 
50 typedef ::cppu::WeakComponentImplHelper2 <
51     css::drawing::framework::XResourceFactory,
52     css::drawing::framework::XConfigurationChangeListener
53     > PresentationFactoryInterfaceBase;
54 
55 } // end of anonymous namespace.
56 
57 
58 
59 namespace sd { namespace framework {
60 
61 /** This factory creates a marker view whose existence in a configuration
62     indicates that a slideshow is running (in another but associated
63     application window).
64 */
65 class PresentationFactory
66     : private sd::MutexOwner,
67       public PresentationFactoryInterfaceBase
68 {
69 public:
70     static const ::rtl::OUString msPresentationViewURL;
71 
72     PresentationFactory (
73         const css::uno::Reference<css::frame::XController>& rxController);
74     virtual ~PresentationFactory (void);
75 
76     virtual void SAL_CALL disposing (void);
77 
78 
79     // XResourceFactory
80 
81     virtual css::uno::Reference<css::drawing::framework::XResource>
82         SAL_CALL createResource (
83             const css::uno::Reference<
84                 css::drawing::framework::XResourceId>& rxViewId)
85         throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException);
86 
87     virtual void SAL_CALL releaseResource (
88         const css::uno::Reference<css::drawing::framework::XResource>& xView)
89         throw(css::uno::RuntimeException);
90 
91 
92     // XConfigurationChangeListener
93 
94     virtual void SAL_CALL notifyConfigurationChange (
95         const css::drawing::framework::ConfigurationChangeEvent& rEvent)
96         throw (css::uno::RuntimeException);
97 
98 
99     // lang::XEventListener
100 
101     virtual void SAL_CALL disposing (
102         const css::lang::EventObject& rEventObject)
103         throw (css::uno::RuntimeException);
104 
105 private:
106     css::uno::Reference<css::drawing::framework::XConfigurationController>
107         mxConfigurationController;
108     css::uno::Reference<css::frame::XController> mxController;
109 
110     void ThrowIfDisposed (void) const
111         throw (css::lang::DisposedException);
112 };
113 
114 } } // end of namespace sd::framework
115 
116 #endif
117