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_SLIDESORTER_SLIDE_SORTER_SERVICE_HXX
25 #define SD_SLIDESORTER_SLIDE_SORTER_SERVICE_HXX
26 
27 #include "SlideSorter.hxx"
28 
29 #include "tools/PropertySet.hxx"
30 #include <com/sun/star/awt/XWindowListener.hpp>
31 #include <com/sun/star/drawing/SlideSorter.hpp>
32 #include <com/sun/star/drawing/XDrawView.hpp>
33 #include <com/sun/star/drawing/framework/XView.hpp>
34 #include <com/sun/star/lang/XInitialization.hpp>
35 #include <cppuhelper/basemutex.hxx>
36 #include <cppuhelper/compbase3.hxx>
37 #include <cppuhelper/propshlp.hxx>
38 #include <boost/noncopyable.hpp>
39 #include <boost/shared_ptr.hpp>
40 #include <boost/scoped_ptr.hpp>
41 
42 namespace css = ::com::sun::star;
43 
44 namespace sd { namespace slidesorter {
45 
46 namespace {
47     typedef ::cppu::WeakComponentImplHelper3 <
48         css::drawing::XSlideSorterBase,
49         css::lang::XInitialization,
50         css::awt::XWindowListener
51     > SlideSorterServiceInterfaceBase;
52 }
53 
54 
55 /** Implementation of the com.sun.star.drawing.SlideSorter service.
56 */
57 class SlideSorterService
58     : private ::boost::noncopyable,
59       protected ::cppu::BaseMutex,
60       public SlideSorterServiceInterfaceBase
61 {
62 public:
63     explicit SlideSorterService (
64         const css::uno::Reference<css::uno::XComponentContext>& rxContext);
65     virtual ~SlideSorterService (void);
66     virtual void SAL_CALL disposing (void);
67 
68 
69     // XInitialization
70 
71     virtual void SAL_CALL initialize (const css::uno::Sequence<css::uno::Any>& rArguments)
72         throw (css::uno::Exception, css::uno::RuntimeException);
73 
74 
75     // XResourceId
76 
77     css::uno::Reference<css::drawing::framework::XResourceId> SAL_CALL getResourceId (void)
78         throw (css::uno::RuntimeException);
79 
80     sal_Bool SAL_CALL isAnchorOnly (void)
81         throw (css::uno::RuntimeException);
82 
83 
84     // XWindowListener
85 
86     virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent)
87         throw (css::uno::RuntimeException);
88 
89     virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent)
90         throw (css::uno::RuntimeException);
91 
92     virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent)
93         throw (css::uno::RuntimeException);
94 
95     virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent)
96         throw (css::uno::RuntimeException);
97 
98 
99     // lang::XEventListener
100     virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent)
101         throw (css::uno::RuntimeException);
102 
103 
104     // XDrawView
105 
106     virtual void SAL_CALL setCurrentPage(
107         const css::uno::Reference<css::drawing::XDrawPage>& rxSlide)
108         throw (css::uno::RuntimeException);
109 
110     virtual css::uno::Reference<css::drawing::XDrawPage> SAL_CALL getCurrentPage (void)
111         throw (css::uno::RuntimeException);
112 
113 
114     // Attributes
115 
116     virtual css::uno::Reference<css::container::XIndexAccess> SAL_CALL getDocumentSlides (void)
117         throw (css::uno::RuntimeException);
118 
119     virtual void SAL_CALL setDocumentSlides (
120         const css::uno::Reference<css::container::XIndexAccess >& rxSlides)
121         throw (css::uno::RuntimeException);
122 
123     virtual sal_Bool SAL_CALL getIsHighlightCurrentSlide (void)
124         throw (css::uno::RuntimeException);
125 
126     virtual void SAL_CALL setIsHighlightCurrentSlide (::sal_Bool bIsHighlightCurrentSlide)
127         throw (css::uno::RuntimeException);
128 
129     virtual sal_Bool SAL_CALL getIsShowSelection (void)
130         throw (css::uno::RuntimeException);
131 
132     virtual void SAL_CALL setIsShowSelection (sal_Bool bIsShowSelection)
133         throw (css::uno::RuntimeException);
134 
135     virtual sal_Bool SAL_CALL getIsCenterSelection (void)
136         throw (css::uno::RuntimeException);
137 
138     virtual void SAL_CALL setIsCenterSelection (sal_Bool bIsCenterSelection)
139         throw (css::uno::RuntimeException);
140 
141     virtual sal_Bool SAL_CALL getIsSuspendPreviewUpdatesDuringFullScreenPresentation (void)
142         throw (css::uno::RuntimeException);
143 
144     virtual void SAL_CALL setIsSuspendPreviewUpdatesDuringFullScreenPresentation (
145         sal_Bool bIsSuspendPreviewUpdatesDuringFullScreenPresentation)
146         throw (css::uno::RuntimeException);
147 
148     virtual sal_Bool SAL_CALL getIsOrientationVertical (void)
149         throw (css::uno::RuntimeException);
150 
151     virtual void SAL_CALL setIsOrientationVertical (sal_Bool bIsOrientationVertical)
152         throw (css::uno::RuntimeException);
153 
154     virtual sal_Bool SAL_CALL getIsSmoothScrolling (void)
155         throw (css::uno::RuntimeException);
156 
157     virtual void SAL_CALL setIsSmoothScrolling (sal_Bool bIsOrientationVertical)
158         throw (css::uno::RuntimeException);
159 
160     virtual css::util::Color SAL_CALL getBackgroundColor (void)
161         throw (css::uno::RuntimeException);
162 
163     virtual void SAL_CALL setBackgroundColor (css::util::Color aBackgroundColor)
164         throw (css::uno::RuntimeException);
165 
166     virtual css::util::Color SAL_CALL getTextColor (void)
167         throw (css::uno::RuntimeException);
168 
169     virtual void SAL_CALL setTextColor (css::util::Color aTextColor)
170         throw (css::uno::RuntimeException);
171 
172     virtual css::util::Color SAL_CALL getSelectionColor (void)
173         throw (css::uno::RuntimeException);
174 
175     virtual void SAL_CALL setSelectionColor (css::util::Color aSelectionColor)
176         throw (css::uno::RuntimeException);
177 
178     virtual css::util::Color SAL_CALL getHighlightColor (void)
179         throw (css::uno::RuntimeException);
180 
181     virtual void SAL_CALL setHighlightColor (css::util::Color aHighlightColor)
182         throw (css::uno::RuntimeException);
183 
184     virtual sal_Bool SAL_CALL getIsUIReadOnly (void)
185         throw (css::uno::RuntimeException);
186 
187     virtual void SAL_CALL setIsUIReadOnly (sal_Bool bIsUIReadOnly)
188         throw (css::uno::RuntimeException);
189 
190     virtual sal_Bool SAL_CALL getIsShowFocus (void)
191         throw (css::uno::RuntimeException);
192 
193     virtual void SAL_CALL setIsShowFocus (sal_Bool bIsShowFocus)
194         throw (css::uno::RuntimeException);
195 
196 private:
197     ::boost::shared_ptr<SlideSorter> mpSlideSorter;
198     css::uno::Reference<css::drawing::framework::XResourceId> mxViewId;
199     css::uno::Reference<css::awt::XWindow> mxParentWindow;
200     ::boost::scoped_ptr<cppu::IPropertyArrayHelper> mpPropertyArrayHelper;
201 
202     void Resize (void);
203 
204     /** This method throws a DisposedException when the object has already been
205         disposed.
206     */
207     void ThrowIfDisposed (void) throw (css::lang::DisposedException);
208 };
209 
210 } } // end of namespace ::sd::slidesorter
211 
212 #endif
213