LCOV - code coverage report
Current view: top level - sdext/source/presenter - PresenterTheme.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 1 0.0 %
Date: 2014-11-03 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_PRESENTERTHEME_HXX
      21             : #define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERTHEME_HXX
      22             : 
      23             : #include "PresenterBitmapContainer.hxx"
      24             : #include "PresenterConfigurationAccess.hxx"
      25             : #include <com/sun/star/uno/XComponentContext.hpp>
      26             : #include <com/sun/star/rendering/XCanvas.hpp>
      27             : #include <com/sun/star/rendering/XCanvasFont.hpp>
      28             : #include <com/sun/star/rendering/XIntegerBitmap.hpp>
      29             : #include <com/sun/star/util/Color.hpp>
      30             : #include <boost/shared_ptr.hpp>
      31             : 
      32             : namespace sdext { namespace presenter {
      33             : 
      34             : /** A theme is a set of properties describing fonts, colors, and bitmaps to be used to draw
      35             :     background, pane borders, and view content.
      36             : 
      37             :     At the moment the properties can be accessed via the getPropertyValue() method.
      38             : 
      39             :     For a resource URL of a pane or a view you get the name of the
      40             :     associated PaneStyle or ViewStyle.
      41             : 
      42             :     For the name of pane or view style suffixed with and underscore and the
      43             :     name of configuration property, and maybe additionally suffixed by
      44             :     another underscore and sub property name you get the associated
      45             :     property.
      46             : 
      47             :     Example: you want to access the top left bitmap of a pane border
      48             :         (simplified code):
      49             : 
      50             :     OUString sStyleName = getPropertyValue("private:resource/pane/Presenter/Pane1");
      51             :     XBitmap xBitmap = getPropertyValue(sStyleName + "_TopLeftBitmap");
      52             : 
      53             :     For the offset of the bitmap you can call
      54             :     Point aOffset = getPropertyValue(sStyleName + "_TopLeftOffset");
      55             : 
      56             :     This is work in progress.
      57             : */
      58             : class PresenterTheme
      59             : {
      60             : public:
      61             :     PresenterTheme (
      62             :         const css::uno::Reference<css::uno::XComponentContext>& rxContext,
      63             :         const OUString& rsThemeName,
      64             :         const css::uno::Reference<css::rendering::XCanvas>& rxCanvas);
      65             :     ~PresenterTheme (void);
      66             : 
      67             :     bool HasCanvas (void) const;
      68             :     void ProvideCanvas (const css::uno::Reference<css::rendering::XCanvas>& rxCanvas);
      69             : 
      70             :     OUString GetStyleName (const OUString& rsResourceURL) const;
      71             :     ::std::vector<sal_Int32> GetBorderSize (
      72             :         const OUString& rsStyleName,
      73             :         const bool bOuter) const;
      74             : 
      75             :     class Theme;
      76           0 :     class FontDescriptor
      77             :     {
      78             :     public:
      79             :         explicit FontDescriptor (const ::boost::shared_ptr<FontDescriptor>& rpDescriptor);
      80             : 
      81             :         OUString msFamilyName;
      82             :         OUString msStyleName;
      83             :         sal_Int32 mnSize;
      84             :         sal_uInt32 mnColor;
      85             :         OUString msAnchor;
      86             :         sal_Int32 mnXOffset;
      87             :         sal_Int32 mnYOffset;
      88             :         css::uno::Reference<css::rendering::XCanvasFont> mxFont;
      89             : 
      90             :         bool PrepareFont (const css::uno::Reference<css::rendering::XCanvas>& rxCanvas);
      91             : 
      92             :     private:
      93             :         css::uno::Reference<css::rendering::XCanvasFont> CreateFont (
      94             :             const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
      95             :             const double nCellSize) const;
      96             :         double GetCellSizeForDesignSize (
      97             :             const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
      98             :             const double nDesignSize) const;
      99             :     };
     100             :     typedef ::boost::shared_ptr<FontDescriptor> SharedFontDescriptor;
     101             : 
     102             :     SharedBitmapDescriptor GetBitmap (
     103             :         const OUString& rsStyleName,
     104             :         const OUString& rsBitmapName) const;
     105             : 
     106             :     SharedBitmapDescriptor GetBitmap (
     107             :         const OUString& rsBitmapName) const;
     108             : 
     109             :     ::boost::shared_ptr<PresenterBitmapContainer> GetBitmapContainer (void) const;
     110             : 
     111             :     SharedFontDescriptor GetFont (
     112             :         const OUString& rsStyleName) const;
     113             : 
     114             :     static SharedFontDescriptor ReadFont (
     115             :         const css::uno::Reference<css::container::XHierarchicalNameAccess>& rxNode,
     116             :         const OUString& rsFontPath,
     117             :         const SharedFontDescriptor& rDefaultFount);
     118             : 
     119             :     static bool ConvertToColor (
     120             :         const css::uno::Any& rColorSequence,
     121             :         sal_uInt32& rColor);
     122             : 
     123             :     ::boost::shared_ptr<PresenterConfigurationAccess> GetNodeForViewStyle (
     124             :         const OUString& rsStyleName) const;
     125             : 
     126             : private:
     127             :     css::uno::Reference<css::uno::XComponentContext> mxContext;
     128             :     const OUString msThemeName;
     129             :     ::boost::shared_ptr<Theme> mpTheme;
     130             :     ::boost::shared_ptr<PresenterBitmapContainer> mpBitmapContainer;
     131             :     css::uno::Reference<css::rendering::XCanvas> mxCanvas;
     132             : 
     133             :     ::boost::shared_ptr<Theme> ReadTheme (void);
     134             : };
     135             : 
     136             : } } // end of namespace ::sd::presenter
     137             : 
     138             : #endif
     139             : 
     140             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10