1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SD_FRAMEWORK_PRESENTATION_FACTORY_HXX
25 #define SD_FRAMEWORK_PRESENTATION_FACTORY_HXX
26 
27 #include "MutexOwner.hxx"
28 
29 #include <com/sun/star/drawing/framework/XResourceFactory.hpp>
30 #include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
31 #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
32 #include <com/sun/star/frame/XController.hpp>
33 #include <com/sun/star/lang/XInitialization.hpp>
34 #include <com/sun/star/uno/XComponentContext.hpp>
35 #include <osl/mutex.hxx>
36 #include <cppuhelper/compbase2.hxx>
37 
38 
39 #include <boost/scoped_ptr.hpp>
40 #include <boost/shared_ptr.hpp>
41 
42 namespace css = ::com::sun::star;
43 
44 namespace {
45 
46 typedef ::cppu::WeakComponentImplHelper2 <
47     css::drawing::framework::XResourceFactory,
48     css::drawing::framework::XConfigurationChangeListener
49     > PresentationFactoryInterfaceBase;
50 
51 } // end of anonymous namespace.
52 
53 
54 
55 namespace sd { namespace framework {
56 
57 /** This factory creates a marker view whose existence in a configuration
58     indicates that a slideshow is running (in another but associated
59     application window).
60 */
61 class PresentationFactory
62     : private sd::MutexOwner,
63       public PresentationFactoryInterfaceBase
64 {
65 public:
66     static const ::rtl::OUString msPresentationViewURL;
67 
68     PresentationFactory (
69         const css::uno::Reference<css::frame::XController>& rxController);
70     virtual ~PresentationFactory (void);
71 
72     virtual void SAL_CALL disposing (void);
73 
74 
75     // XResourceFactory
76 
77     virtual css::uno::Reference<css::drawing::framework::XResource>
78         SAL_CALL createResource (
79             const css::uno::Reference<
80                 css::drawing::framework::XResourceId>& rxViewId)
81         throw (css::uno::RuntimeException, css::lang::IllegalArgumentException, css::lang::WrappedTargetException);
82 
83     virtual void SAL_CALL releaseResource (
84         const css::uno::Reference<css::drawing::framework::XResource>& xView)
85         throw(css::uno::RuntimeException);
86 
87 
88     // XConfigurationChangeListener
89 
90     virtual void SAL_CALL notifyConfigurationChange (
91         const css::drawing::framework::ConfigurationChangeEvent& rEvent)
92         throw (css::uno::RuntimeException);
93 
94 
95     // lang::XEventListener
96 
97     virtual void SAL_CALL disposing (
98         const css::lang::EventObject& rEventObject)
99         throw (css::uno::RuntimeException);
100 
101 private:
102     css::uno::Reference<css::drawing::framework::XConfigurationController>
103         mxConfigurationController;
104     css::uno::Reference<css::frame::XController> mxController;
105 
106     void ThrowIfDisposed (void) const
107         throw (css::lang::DisposedException);
108 };
109 
110 } } // end of namespace sd::framework
111 
112 #endif
113