LCOV - code coverage report
Current view: top level - sdext/source/presenter - PresenterBitmapContainer.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 1 0.0 %
Date: 2014-04-14 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERBITMAPCONTAINER_HXX
      21             : #define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERBITMAPCONTAINER_HXX
      22             : 
      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>
      32             : #include <map>
      33             : #include <boost/shared_ptr.hpp>
      34             : 
      35             : namespace sdext { namespace presenter {
      36             : 
      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.
      41             : */
      42             : class PresenterBitmapContainer
      43             :     : private ::boost::noncopyable
      44             : {
      45             : public:
      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.
      48             :     */
      49           0 :     class BitmapDescriptor
      50             :     {
      51             :     public:
      52             :         BitmapDescriptor (void);
      53             :         BitmapDescriptor (const ::boost::shared_ptr<BitmapDescriptor>& rpDefault);
      54             : 
      55             :         enum Mode {Normal, MouseOver, ButtonDown, Disabled, Mask};
      56             :         css::uno::Reference<css::rendering::XBitmap> GetNormalBitmap (void) const;
      57             :         css::uno::Reference<css::rendering::XBitmap> GetBitmap (
      58             :             const Mode eMode,
      59             :             const bool bMissingDefaultsToNormal = true) const;
      60             :         void SetBitmap (
      61             :             const Mode eMode,
      62             :             const css::uno::Reference<css::rendering::XBitmap>& rxBitmap);
      63             : 
      64             :         sal_Int32 mnWidth;
      65             :         sal_Int32 mnHeight;
      66             :         sal_Int32 mnXOffset;
      67             :         sal_Int32 mnYOffset;
      68             :         sal_Int32 mnXHotSpot;
      69             :         sal_Int32 mnYHotSpot;
      70             :         css::util::Color maReplacementColor;
      71             :         enum TexturingMode { Once, Repeat, Stretch };
      72             :         TexturingMode meHorizontalTexturingMode;
      73             :         TexturingMode meVerticalTexturingMode;
      74             : 
      75             :     private:
      76             :         css::uno::Reference<css::rendering::XBitmap> mxNormalBitmap;
      77             :         css::uno::Reference<css::rendering::XBitmap> mxMouseOverBitmap;
      78             :         css::uno::Reference<css::rendering::XBitmap> mxButtonDownBitmap;
      79             :         css::uno::Reference<css::rendering::XBitmap> mxDisabledBitmap;
      80             :         css::uno::Reference<css::rendering::XBitmap> mxMaskBitmap;
      81             :     };
      82             : 
      83             :     /** Create a new bitmap container from a section of the configuration.
      84             :         @param rxComponentContext
      85             :             The component context is used to create new API objects.
      86             :         @param rxCanvas
      87             :             Bitmaps are created specifically for this canvas.
      88             :         @param rsConfigurationBase
      89             :             The name of a configuration node whose sub-tree defines the
      90             :             bitmap sets.
      91             :     */
      92             :     PresenterBitmapContainer (
      93             :         const OUString& rsConfigurationBase,
      94             :         const ::boost::shared_ptr<PresenterBitmapContainer>& rpParentContainer,
      95             :         const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext,
      96             :         const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
      97             :         const css::uno::Reference<css::drawing::XPresenterHelper>& rxPresenterHelper = NULL);
      98             :     PresenterBitmapContainer (
      99             :         const css::uno::Reference<css::container::XNameAccess>& rsRootNode,
     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 css::uno::Reference<css::drawing::XPresenterHelper>& rxPresenterHelper = NULL);
     104             :     ~PresenterBitmapContainer (void);
     105             : 
     106             :     void Initialize (
     107             :         const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext);
     108             : 
     109             :     /** Return the bitmap set that is associated with the given name.
     110             :     */
     111             :     ::boost::shared_ptr<BitmapDescriptor> GetBitmap (const OUString& rsName) const;
     112             : 
     113             :     static ::boost::shared_ptr<BitmapDescriptor> LoadBitmap (
     114             :         const css::uno::Reference<css::container::XHierarchicalNameAccess>& rxNode,
     115             :         const OUString& rsPathToBitmapNode,
     116             :         const css::uno::Reference<css::drawing::XPresenterHelper>& rxPresenterHelper,
     117             :         const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
     118             :         const ::boost::shared_ptr<BitmapDescriptor>& rpDefaultBitmap);
     119             : 
     120             : private:
     121             :     ::boost::shared_ptr<PresenterBitmapContainer> mpParentContainer;
     122             :     typedef ::std::map<OUString, ::boost::shared_ptr<BitmapDescriptor> > BitmapContainer;
     123             :     BitmapContainer maIconContainer;
     124             :     css::uno::Reference<css::rendering::XCanvas> mxCanvas;
     125             :     css::uno::Reference<css::drawing::XPresenterHelper> mxPresenterHelper;
     126             : 
     127             :     void LoadBitmaps (
     128             :         const css::uno::Reference<css::container::XNameAccess>& rsRootNode);
     129             :     void ProcessBitmap (
     130             :         const OUString& rsKey,
     131             :         const css::uno::Reference<css::beans::XPropertySet>& rProperties);
     132             :     static ::boost::shared_ptr<BitmapDescriptor> LoadBitmap (
     133             :         const css::uno::Reference<css::beans::XPropertySet>& rxProperties,
     134             :         const css::uno::Reference<css::drawing::XPresenterHelper>& rxPresenterHelper,
     135             :         const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
     136             :         const ::boost::shared_ptr<PresenterBitmapContainer::BitmapDescriptor>& rpDefault);
     137             :     static BitmapDescriptor::TexturingMode
     138             :         StringToTexturingMode (const OUString& rsTexturingMode);
     139             : };
     140             : 
     141             : typedef PresenterBitmapContainer::BitmapDescriptor PresenterBitmapDescriptor;
     142             : typedef ::boost::shared_ptr<PresenterBitmapContainer::BitmapDescriptor> SharedBitmapDescriptor;
     143             : 
     144             : } } // end of namespace ::sdext::presenter
     145             : 
     146             : #endif
     147             : 
     148             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10