LCOV - code coverage report
Current view: top level - sdext/source/presenter - PresenterBitmapContainer.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 1 0.0 %
Date: 2015-06-13 12:38:46 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();
      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() const;
      57             :         css::uno::Reference<css::rendering::XBitmap> GetBitmap(const Mode eMode) const;
      58             :         void SetBitmap (
      59             :             const Mode eMode,
      60             :             const css::uno::Reference<css::rendering::XBitmap>& rxBitmap);
      61             : 
      62             :         sal_Int32 mnWidth;
      63             :         sal_Int32 mnHeight;
      64             :         sal_Int32 mnXOffset;
      65             :         sal_Int32 mnYOffset;
      66             :         sal_Int32 mnXHotSpot;
      67             :         sal_Int32 mnYHotSpot;
      68             :         css::util::Color maReplacementColor;
      69             :         enum TexturingMode { Once, Repeat, Stretch };
      70             :         TexturingMode meHorizontalTexturingMode;
      71             :         TexturingMode meVerticalTexturingMode;
      72             : 
      73             :     private:
      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;
      79             :     };
      80             : 
      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.
      84             :         @param rxCanvas
      85             :             Bitmaps are created specifically for this canvas.
      86             :         @param rsConfigurationBase
      87             :             The name of a configuration node whose sub-tree defines the
      88             :             bitmap sets.
      89             :     */
      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();
     103             : 
     104             :     void Initialize (
     105             :         const css::uno::Reference<css::uno::XComponentContext>& rxComponentContext);
     106             : 
     107             :     /** Return the bitmap set that is associated with the given name.
     108             :     */
     109             :     ::boost::shared_ptr<BitmapDescriptor> GetBitmap (const OUString& rsName) const;
     110             : 
     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);
     117             : 
     118             : private:
     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;
     124             : 
     125             :     void LoadBitmaps (
     126             :         const css::uno::Reference<css::container::XNameAccess>& rsRootNode);
     127             :     void ProcessBitmap (
     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);
     137             : };
     138             : 
     139             : typedef PresenterBitmapContainer::BitmapDescriptor PresenterBitmapDescriptor;
     140             : typedef ::boost::shared_ptr<PresenterBitmapContainer::BitmapDescriptor> SharedBitmapDescriptor;
     141             : 
     142             : } } // end of namespace ::sdext::presenter
     143             : 
     144             : #endif
     145             : 
     146             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11