1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERBITMAPCONTAINER_HXX
21 #define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERBITMAPCONTAINER_HXX
23 #include <com/sun/star/beans/XPropertySet.hpp>
24 #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
25 #include <com/sun/star/container/XNameAccess.hpp>
26 #include <com/sun/star/drawing/XPresenterHelper.hpp>
27 #include <com/sun/star/rendering/XBitmap.hpp>
28 #include <com/sun/star/rendering/XCanvas.hpp>
29 #include <com/sun/star/uno/XComponentContext.hpp>
30 #include <com/sun/star/util/Color.hpp>
31 #include <boost/noncopyable.hpp>
33 #include <boost/shared_ptr.hpp>
35 namespace sdext
{ namespace presenter
{
37 /** Manage a set of bitmap groups as they are used for buttons: three
38 bitmaps, one for the normal state, one for a mouse over effect and one
39 to show that the button has been pressed.
40 A bitmap group is defined by some entries in the configuration.
42 class PresenterBitmapContainer
43 : private ::boost::noncopyable
46 /** There is one bitmap for the normal state, one for a mouse over effect and one
47 to show that a button has been pressed.
49 class BitmapDescriptor
53 BitmapDescriptor (const ::boost::shared_ptr
<BitmapDescriptor
>& rpDefault
);
55 enum Mode
{Normal
, MouseOver
, ButtonDown
, Disabled
, Mask
};
56 css::uno::Reference
<css::rendering::XBitmap
> GetNormalBitmap() const;
57 css::uno::Reference
<css::rendering::XBitmap
> GetBitmap(const Mode eMode
) const;
60 const css::uno::Reference
<css::rendering::XBitmap
>& rxBitmap
);
68 css::util::Color maReplacementColor
;
69 enum TexturingMode
{ Once
, Repeat
, Stretch
};
70 TexturingMode meHorizontalTexturingMode
;
71 TexturingMode meVerticalTexturingMode
;
74 css::uno::Reference
<css::rendering::XBitmap
> mxNormalBitmap
;
75 css::uno::Reference
<css::rendering::XBitmap
> mxMouseOverBitmap
;
76 css::uno::Reference
<css::rendering::XBitmap
> mxButtonDownBitmap
;
77 css::uno::Reference
<css::rendering::XBitmap
> mxDisabledBitmap
;
78 css::uno::Reference
<css::rendering::XBitmap
> mxMaskBitmap
;
81 /** Create a new bitmap container from a section of the configuration.
82 @param rxComponentContext
83 The component context is used to create new API objects.
85 Bitmaps are created specifically for this canvas.
86 @param rsConfigurationBase
87 The name of a configuration node whose sub-tree defines the
90 PresenterBitmapContainer (
91 const OUString
& rsConfigurationBase
,
92 const ::boost::shared_ptr
<PresenterBitmapContainer
>& rpParentContainer
,
93 const css::uno::Reference
<css::uno::XComponentContext
>& rxComponentContext
,
94 const css::uno::Reference
<css::rendering::XCanvas
>& rxCanvas
,
95 const css::uno::Reference
<css::drawing::XPresenterHelper
>& rxPresenterHelper
= NULL
);
96 PresenterBitmapContainer (
97 const css::uno::Reference
<css::container::XNameAccess
>& rsRootNode
,
98 const ::boost::shared_ptr
<PresenterBitmapContainer
>& rpParentContainer
,
99 const css::uno::Reference
<css::uno::XComponentContext
>& rxComponentContext
,
100 const css::uno::Reference
<css::rendering::XCanvas
>& rxCanvas
,
101 const css::uno::Reference
<css::drawing::XPresenterHelper
>& rxPresenterHelper
= NULL
);
102 ~PresenterBitmapContainer();
105 const css::uno::Reference
<css::uno::XComponentContext
>& rxComponentContext
);
107 /** Return the bitmap set that is associated with the given name.
109 ::boost::shared_ptr
<BitmapDescriptor
> GetBitmap (const OUString
& rsName
) const;
111 static ::boost::shared_ptr
<BitmapDescriptor
> LoadBitmap (
112 const css::uno::Reference
<css::container::XHierarchicalNameAccess
>& rxNode
,
113 const OUString
& rsPathToBitmapNode
,
114 const css::uno::Reference
<css::drawing::XPresenterHelper
>& rxPresenterHelper
,
115 const css::uno::Reference
<css::rendering::XCanvas
>& rxCanvas
,
116 const ::boost::shared_ptr
<BitmapDescriptor
>& rpDefaultBitmap
);
119 ::boost::shared_ptr
<PresenterBitmapContainer
> mpParentContainer
;
120 typedef ::std::map
<OUString
, ::boost::shared_ptr
<BitmapDescriptor
> > BitmapContainer
;
121 BitmapContainer maIconContainer
;
122 css::uno::Reference
<css::rendering::XCanvas
> mxCanvas
;
123 css::uno::Reference
<css::drawing::XPresenterHelper
> mxPresenterHelper
;
126 const css::uno::Reference
<css::container::XNameAccess
>& rsRootNode
);
128 const OUString
& rsKey
,
129 const css::uno::Reference
<css::beans::XPropertySet
>& rProperties
);
130 static ::boost::shared_ptr
<BitmapDescriptor
> LoadBitmap (
131 const css::uno::Reference
<css::beans::XPropertySet
>& rxProperties
,
132 const css::uno::Reference
<css::drawing::XPresenterHelper
>& rxPresenterHelper
,
133 const css::uno::Reference
<css::rendering::XCanvas
>& rxCanvas
,
134 const ::boost::shared_ptr
<PresenterBitmapContainer::BitmapDescriptor
>& rpDefault
);
135 static BitmapDescriptor::TexturingMode
136 StringToTexturingMode (const OUString
& rsTexturingMode
);
139 typedef PresenterBitmapContainer::BitmapDescriptor PresenterBitmapDescriptor
;
140 typedef ::boost::shared_ptr
<PresenterBitmapContainer::BitmapDescriptor
> SharedBitmapDescriptor
;
142 } } // end of namespace ::sdext::presenter
146 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */