PresenterBitmapContainer.cxx (5d03e972) PresenterBitmapContainer.cxx (45b93914)
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

--- 11 unchanged lines hidden (view full) ---

20 *************************************************************/
21
22
23
24// MARKER(update_precomp.py): autogen include statement, do not remove
25#include "precompiled_sdext.hxx"
26
27#include "PresenterBitmapContainer.hxx"
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

--- 11 unchanged lines hidden (view full) ---

20 *************************************************************/
21
22
23
24// MARKER(update_precomp.py): autogen include statement, do not remove
25#include "precompiled_sdext.hxx"
26
27#include "PresenterBitmapContainer.hxx"
28#include "PresenterComponent.hxx"
28#include "PresenterConfigurationAccess.hxx"
29
30#include <com/sun/star/deployment/XPackageInformationProvider.hpp>
31#include <com/sun/star/drawing/XPresenterHelper.hpp>
32#include <com/sun/star/lang/XMultiComponentFactory.hpp>
33#include <com/sun/star/rendering/CompositeOperation.hpp>
34#include <com/sun/star/rendering/XIntegerBitmap.hpp>
35#include <boost/bind.hpp>

--- 27 unchanged lines hidden (view full) ---

63
64//===== PresenterBitmapContainer ==============================================
65
66PresenterBitmapContainer::PresenterBitmapContainer (
67 const ::rtl::OUString& rsConfigurationBase,
68 const ::boost::shared_ptr<PresenterBitmapContainer>& rpParentContainer,
69 const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext,
70 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
29#include "PresenterConfigurationAccess.hxx"
30
31#include <com/sun/star/deployment/XPackageInformationProvider.hpp>
32#include <com/sun/star/drawing/XPresenterHelper.hpp>
33#include <com/sun/star/lang/XMultiComponentFactory.hpp>
34#include <com/sun/star/rendering/CompositeOperation.hpp>
35#include <com/sun/star/rendering/XIntegerBitmap.hpp>
36#include <boost/bind.hpp>

--- 27 unchanged lines hidden (view full) ---

64
65//===== PresenterBitmapContainer ==============================================
66
67PresenterBitmapContainer::PresenterBitmapContainer (
68 const ::rtl::OUString& rsConfigurationBase,
69 const ::boost::shared_ptr<PresenterBitmapContainer>& rpParentContainer,
70 const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext,
71 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
72 const OUString& rsBasePath,
71 const css::uno::Reference<css::drawing::XPresenterHelper>& rxPresenterHelper)
72 : mpParentContainer(rpParentContainer),
73 maIconContainer(),
73 const css::uno::Reference<css::drawing::XPresenterHelper>& rxPresenterHelper)
74 : mpParentContainer(rpParentContainer),
75 maIconContainer(),
76 msBasePath(rsBasePath),
74 mxCanvas(rxCanvas),
75 mxPresenterHelper(rxPresenterHelper)
76{
77 Initialize(rxComponentContext);
78
79 // Get access to the configuration.
80 PresenterConfigurationAccess aConfiguration (
81 rxComponentContext,
77 mxCanvas(rxCanvas),
78 mxPresenterHelper(rxPresenterHelper)
79{
80 Initialize(rxComponentContext);
81
82 // Get access to the configuration.
83 PresenterConfigurationAccess aConfiguration (
84 rxComponentContext,
82 A2S("org.openoffice.Office.PresenterScreen"),
85 A2S("org.openoffice.Office.extension.PresenterScreen"),
83 PresenterConfigurationAccess::READ_ONLY);
84 Reference<container::XNameAccess> xBitmapList (
85 aConfiguration.GetConfigurationNode(rsConfigurationBase),
86 UNO_QUERY_THROW);
87
88 LoadBitmaps(xBitmapList);
89}
90
91
92
93
94
95PresenterBitmapContainer::PresenterBitmapContainer (
96 const css::uno::Reference<css::container::XNameAccess>& rxRootNode,
97 const ::boost::shared_ptr<PresenterBitmapContainer>& rpParentContainer,
98 const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext,
99 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
86 PresenterConfigurationAccess::READ_ONLY);
87 Reference<container::XNameAccess> xBitmapList (
88 aConfiguration.GetConfigurationNode(rsConfigurationBase),
89 UNO_QUERY_THROW);
90
91 LoadBitmaps(xBitmapList);
92}
93
94
95
96
97
98PresenterBitmapContainer::PresenterBitmapContainer (
99 const css::uno::Reference<css::container::XNameAccess>& rxRootNode,
100 const ::boost::shared_ptr<PresenterBitmapContainer>& rpParentContainer,
101 const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext,
102 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
103 const OUString& rsBasePath,
100 const css::uno::Reference<css::drawing::XPresenterHelper>& rxPresenterHelper)
101 : mpParentContainer(rpParentContainer),
102 maIconContainer(),
104 const css::uno::Reference<css::drawing::XPresenterHelper>& rxPresenterHelper)
105 : mpParentContainer(rpParentContainer),
106 maIconContainer(),
107 msBasePath(rsBasePath),
103 mxCanvas(rxCanvas),
104 mxPresenterHelper(rxPresenterHelper)
105{
106 Initialize(rxComponentContext);
107
108 LoadBitmaps(rxRootNode);
109}
110

--- 72 unchanged lines hidden (view full) ---

183
184
185
186
187SharedBitmapDescriptor PresenterBitmapContainer::LoadBitmap (
188 const css::uno::Reference<css::container::XHierarchicalNameAccess>& rxNode,
189 const ::rtl::OUString& rsPath,
190 const css::uno::Reference<css::drawing::XPresenterHelper>& rxPresenterHelper,
108 mxCanvas(rxCanvas),
109 mxPresenterHelper(rxPresenterHelper)
110{
111 Initialize(rxComponentContext);
112
113 LoadBitmaps(rxRootNode);
114}
115

--- 72 unchanged lines hidden (view full) ---

188
189
190
191
192SharedBitmapDescriptor PresenterBitmapContainer::LoadBitmap (
193 const css::uno::Reference<css::container::XHierarchicalNameAccess>& rxNode,
194 const ::rtl::OUString& rsPath,
195 const css::uno::Reference<css::drawing::XPresenterHelper>& rxPresenterHelper,
196 const OUString& rsBasePath,
191 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
192 const SharedBitmapDescriptor& rpDefault)
193{
194 SharedBitmapDescriptor pBitmap;
195
196 if (rxNode.is())
197 {
198 try
199 {
200 Reference<beans::XPropertySet> xBitmapProperties (
201 PresenterConfigurationAccess::GetConfigurationNode(rxNode, rsPath),
202 UNO_QUERY);
203 if (xBitmapProperties.is())
204 pBitmap = LoadBitmap(
205 xBitmapProperties,
206 rxPresenterHelper,
197 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
198 const SharedBitmapDescriptor& rpDefault)
199{
200 SharedBitmapDescriptor pBitmap;
201
202 if (rxNode.is())
203 {
204 try
205 {
206 Reference<beans::XPropertySet> xBitmapProperties (
207 PresenterConfigurationAccess::GetConfigurationNode(rxNode, rsPath),
208 UNO_QUERY);
209 if (xBitmapProperties.is())
210 pBitmap = LoadBitmap(
211 xBitmapProperties,
212 rxPresenterHelper,
213 rsBasePath,
207 rxCanvas,
208 rpDefault);
209 }
210 catch (Exception&)
211 {
212 OSL_ASSERT(false);
213 }
214 }

--- 10 unchanged lines hidden (view full) ---

225{
226 OUString sName;
227 if ( ! (PresenterConfigurationAccess::GetProperty(rxProperties, gsNameProperty) >>= sName))
228 sName = rsKey;
229
230 maIconContainer[sName] = LoadBitmap(
231 rxProperties,
232 mxPresenterHelper,
214 rxCanvas,
215 rpDefault);
216 }
217 catch (Exception&)
218 {
219 OSL_ASSERT(false);
220 }
221 }

--- 10 unchanged lines hidden (view full) ---

232{
233 OUString sName;
234 if ( ! (PresenterConfigurationAccess::GetProperty(rxProperties, gsNameProperty) >>= sName))
235 sName = rsKey;
236
237 maIconContainer[sName] = LoadBitmap(
238 rxProperties,
239 mxPresenterHelper,
240 msBasePath,
233 mxCanvas,
234 SharedBitmapDescriptor());
235}
236
237
238
239
240SharedBitmapDescriptor PresenterBitmapContainer::LoadBitmap (
241 const Reference<beans::XPropertySet>& rxProperties,
242 const css::uno::Reference<css::drawing::XPresenterHelper>& rxPresenterHelper,
241 mxCanvas,
242 SharedBitmapDescriptor());
243}
244
245
246
247
248SharedBitmapDescriptor PresenterBitmapContainer::LoadBitmap (
249 const Reference<beans::XPropertySet>& rxProperties,
250 const css::uno::Reference<css::drawing::XPresenterHelper>& rxPresenterHelper,
251 const OUString& rsBasePath,
243 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
244 const SharedBitmapDescriptor& rpDefault)
245{
246 OSL_ASSERT(rxCanvas.is());
247 OSL_ASSERT(rxPresenterHelper.is());
248
249 SharedBitmapDescriptor pBitmap (new BitmapDescriptor(rpDefault));
250
251 if ( ! rxProperties.is())
252 return pBitmap;
253
254 OUString sFileName;
255
256 // Load bitmaps.
257 if (PresenterConfigurationAccess::GetProperty(rxProperties, gsNormalFileNameProperty) >>= sFileName)
258 try
259 {
260 pBitmap->SetBitmap(
261 BitmapDescriptor::Normal,
252 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
253 const SharedBitmapDescriptor& rpDefault)
254{
255 OSL_ASSERT(rxCanvas.is());
256 OSL_ASSERT(rxPresenterHelper.is());
257
258 SharedBitmapDescriptor pBitmap (new BitmapDescriptor(rpDefault));
259
260 if ( ! rxProperties.is())
261 return pBitmap;
262
263 OUString sFileName;
264
265 // Load bitmaps.
266 if (PresenterConfigurationAccess::GetProperty(rxProperties, gsNormalFileNameProperty) >>= sFileName)
267 try
268 {
269 pBitmap->SetBitmap(
270 BitmapDescriptor::Normal,
262 rxPresenterHelper->loadBitmap(sFileName, rxCanvas));
271 rxPresenterHelper->loadBitmap(rsBasePath + sFileName, rxCanvas));
263 }
264 catch (Exception&)
265 {}
266 if (PresenterConfigurationAccess::GetProperty(rxProperties, gsMouseOverFileNameProperty) >>= sFileName)
267 try
268 {
269 pBitmap->SetBitmap(
270 BitmapDescriptor::MouseOver,
272 }
273 catch (Exception&)
274 {}
275 if (PresenterConfigurationAccess::GetProperty(rxProperties, gsMouseOverFileNameProperty) >>= sFileName)
276 try
277 {
278 pBitmap->SetBitmap(
279 BitmapDescriptor::MouseOver,
271 rxPresenterHelper->loadBitmap(sFileName, rxCanvas));
280 rxPresenterHelper->loadBitmap(rsBasePath + sFileName, rxCanvas));
272 }
273 catch (Exception&)
274 {}
275 if (PresenterConfigurationAccess::GetProperty(rxProperties, gsButtonDownFileNameProperty) >>= sFileName)
276 try
277 {
278 pBitmap->SetBitmap(
279 BitmapDescriptor::ButtonDown,
281 }
282 catch (Exception&)
283 {}
284 if (PresenterConfigurationAccess::GetProperty(rxProperties, gsButtonDownFileNameProperty) >>= sFileName)
285 try
286 {
287 pBitmap->SetBitmap(
288 BitmapDescriptor::ButtonDown,
280 rxPresenterHelper->loadBitmap(sFileName, rxCanvas));
289 rxPresenterHelper->loadBitmap(rsBasePath + sFileName, rxCanvas));
281 }
282 catch (Exception&)
283 {}
284 if (PresenterConfigurationAccess::GetProperty(rxProperties, gsDisabledFileNameProperty) >>= sFileName)
285 try
286 {
287 pBitmap->SetBitmap(
288 BitmapDescriptor::Disabled,
290 }
291 catch (Exception&)
292 {}
293 if (PresenterConfigurationAccess::GetProperty(rxProperties, gsDisabledFileNameProperty) >>= sFileName)
294 try
295 {
296 pBitmap->SetBitmap(
297 BitmapDescriptor::Disabled,
289 rxPresenterHelper->loadBitmap(sFileName, rxCanvas));
298 rxPresenterHelper->loadBitmap(rsBasePath + sFileName, rxCanvas));
290 }
291 catch (Exception&)
292 {}
293 if (PresenterConfigurationAccess::GetProperty(rxProperties, gsMaskFileNameProperty) >>= sFileName)
294 try
295 {
296 pBitmap->SetBitmap(
297 BitmapDescriptor::Mask,
299 }
300 catch (Exception&)
301 {}
302 if (PresenterConfigurationAccess::GetProperty(rxProperties, gsMaskFileNameProperty) >>= sFileName)
303 try
304 {
305 pBitmap->SetBitmap(
306 BitmapDescriptor::Mask,
298 rxPresenterHelper->loadBitmap(sFileName, rxCanvas));
307 rxPresenterHelper->loadBitmap(rsBasePath + sFileName, rxCanvas));
299 }
300 catch (Exception&)
301 {}
302
303
304 PresenterConfigurationAccess::GetProperty(rxProperties, gsXOffsetProperty) >>= pBitmap->mnXOffset;
305 PresenterConfigurationAccess::GetProperty(rxProperties, gsYOffsetProperty) >>= pBitmap->mnYOffset;
306

--- 179 unchanged lines hidden ---
308 }
309 catch (Exception&)
310 {}
311
312
313 PresenterConfigurationAccess::GetProperty(rxProperties, gsXOffsetProperty) >>= pBitmap->mnXOffset;
314 PresenterConfigurationAccess::GetProperty(rxProperties, gsYOffsetProperty) >>= pBitmap->mnYOffset;
315

--- 179 unchanged lines hidden ---