LCOV - code coverage report
Current view: top level - include/vcl - IconThemeInfo.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 3 0.0 %
Date: 2014-04-14 Functions: 0 4 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             : 
      10             : #ifndef VCL_ICONTHEMEINFO_HXX_
      11             : #define VCL_ICONTHEMEINFO_HXX_
      12             : 
      13             : #include <vcl/dllapi.h>
      14             : // for Size
      15             : #include <tools/gen.hxx>
      16             : #include <rtl/ustring.hxx>
      17             : 
      18             : #include <vector>
      19             : 
      20             : // forward declaration of unit test classes. Required for friend relationship.
      21             : class IconThemeInfoTest;
      22             : class IconThemeSelectorTest;
      23             : class IconThemeScannerTest;
      24             : 
      25             : namespace vcl {
      26             : 
      27             : /** This class provides information about an icon theme.
      28             :  */
      29           0 : class VCL_DLLPUBLIC IconThemeInfo {
      30             : 
      31             : public:
      32             : 
      33             :     /** Construct an IconThemeInfo from the URL to a file.
      34             :      * This method will throw a std::runtime_error if the URL cannot be properly parsed.
      35             :      * Check the URL with UrlCanBeParsed() first.
      36             :      */
      37             :     IconThemeInfo(const OUString& urlToFile);
      38             : 
      39           0 :     const OUString& GetDisplayName() const {return mDisplayName;}
      40             : 
      41           0 :     const OUString& GetThemeId() const { return mThemeId; }
      42             : 
      43             :     const OUString& GetUrlToFile() const { return mUrlToFile; }
      44             : 
      45             :     /** Obtain the icon size by theme name.
      46             :      * @internal
      47             :      * It is not clear where this information belongs to. The sizes were hard-coded before they moved here.
      48             :      * Maybe there is a way to determine the sizes from the icon theme packages.
      49             :      */
      50             :     static Size SizeByThemeName(const OUString&);
      51             : 
      52             :     /** Check whether a IconThemeInfo can be constructed from an URL */
      53             :     static bool UrlCanBeParsed(const OUString& url);
      54             : 
      55             :     /** Find an icon theme by its id in a vector.
      56             :      * Throws a runtime_error if the theme is not contained in the vector
      57             :      */
      58             :     static const vcl::IconThemeInfo&
      59             :     FindIconThemeById(const std::vector<vcl::IconThemeInfo>& themes, const OUString& themeId);
      60             : 
      61             :     /** Check whether a theme with a specified id is in a vector of IconThemeInfo */
      62             :     static bool
      63             :     IconThemeIsInVector(const std::vector<vcl::IconThemeInfo>& themes, const OUString& themeId);
      64             : 
      65             : private:
      66             :     /** private constructor for testing purposes only */
      67             :     IconThemeInfo();
      68             : 
      69             :     /** Determine the icon theme name from the filename
      70             :      * If the name has an underscore, the name is taken from the first underscore to the last dot,
      71             :      * e.g., images_oxygen.zip becomes oxygen
      72             :      * If the name does not have an underscore in it, the whole name until the last dot is returned,
      73             :      * e.g. default.zip becomes default
      74             :      */
      75             :     static OUString FileNameToThemeId(const OUString&);
      76             : 
      77             :     /** Creates the display name for the given id of a file.
      78             :      * Currently, we only uppercase the id.
      79             :      */
      80             :     static OUString ThemeIdToDisplayName(const OUString&);
      81             : 
      82             :     /** The name which is presented to the user */
      83             :     OUString mDisplayName;
      84             :     /** The theme id. This id is used in ... to determine the file name */
      85             :     OUString mThemeId;
      86             :     /** The url to the icon theme package */
      87             :     OUString mUrlToFile;
      88             : 
      89             :     friend class ::IconThemeInfoTest;
      90             :     friend class ::IconThemeScannerTest;
      91             :     friend class ::IconThemeSelectorTest;
      92             : };
      93             : 
      94             : } // namespace vcl
      95             : 
      96             : 
      97             : #endif /* VCL_ICONTHEMEINFO_HXX_ */

Generated by: LCOV version 1.10