LCOV - code coverage report
Current view: top level - include/svx - gallery1.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 14 18 77.8 %
Date: 2015-06-13 12:38:46 Functions: 14 17 82.4 %
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_SVX_GALLERY1_HXX
      21             : #define INCLUDED_SVX_GALLERY1_HXX
      22             : 
      23             : #include <rtl/ustring.hxx>
      24             : #include <svl/SfxBroadcaster.hxx>
      25             : #include <svx/svxdllapi.h>
      26             : #include <tools/urlobj.hxx>
      27             : 
      28             : #include <cstdio>
      29             : #include <vector>
      30             : 
      31             : 
      32             : // - GalleryThemeEntry -
      33             : 
      34             : 
      35             : class SvStream;
      36             : 
      37             : class GalleryThemeEntry
      38             : {
      39             : private:
      40             : 
      41             :     OUString                aName;
      42             :     INetURLObject           aThmURL;
      43             :     INetURLObject           aSdgURL;
      44             :     INetURLObject           aSdvURL;
      45             :     INetURLObject           aStrURL;
      46             :     sal_uInt32              nId;
      47             :     bool                    bReadOnly;
      48             :     bool                    bModified;
      49             :     bool                    bThemeNameFromResource;
      50             : 
      51             :                             GalleryThemeEntry();
      52             :     static INetURLObject    ImplGetURLIgnoreCase( const INetURLObject& rURL );
      53             : 
      54             : public:
      55             : 
      56             :                             GalleryThemeEntry( bool bCreateUniqueURL,
      57             :                                                const INetURLObject& rBaseURL,
      58             :                                                const OUString& rName,
      59             :                                                bool bReadOnly, bool bNewFile,
      60             :                                                sal_uInt32 nId, bool bThemeNameFromResource );
      61          11 :                             ~GalleryThemeEntry() {};
      62             : 
      63        1542 :     const OUString&         GetThemeName() const { return aName; }
      64             : 
      65          55 :     const INetURLObject&    GetThmURL() const { return aThmURL; }
      66         503 :     const INetURLObject&    GetSdgURL() const { return aSdgURL; }
      67          22 :     const INetURLObject&    GetSdvURL() const { return aSdvURL; }
      68          27 :     const INetURLObject&    GetStrURL() const { return aStrURL; }
      69             : 
      70             :     OUString                ReadStrFromIni(const OUString &aKeyName );
      71             : 
      72         547 :     bool                    IsReadOnly() const { return bReadOnly; }
      73             :     bool                    IsDefault() const;
      74             : 
      75           0 :     bool                    IsHidden() const { return aName.match("private://gallery/hidden/"); }
      76             : 
      77          22 :     bool                    IsModified() const { return bModified; }
      78         574 :     void                    SetModified( bool bSet ) { bModified = ( bSet && !IsReadOnly() ); }
      79             : 
      80             :     void                    SetName( const OUString& rNewName );
      81          22 :     bool                    IsNameFromResource() const { return bThemeNameFromResource; }
      82             : 
      83          22 :     sal_uInt32              GetId() const { return nId; }
      84             :     void                    SetId( sal_uInt32 nNewId, bool bResetThemeName );
      85             : };
      86             : 
      87             : typedef ::std::vector< GalleryThemeEntry* > GalleryThemeList;
      88             : 
      89             : 
      90             : // - Gallery -
      91             : 
      92             : 
      93             : class SfxListener;
      94             : class GalleryTheme;
      95             : class GalleryThemeCacheEntry;
      96             : 
      97             : class SVX_DLLPUBLIC Gallery : public SfxBroadcaster
      98             : {
      99             :     // only for gengal utility!
     100             :     friend Gallery* createGallery( const OUString& );
     101             :     friend void     disposeGallery( Gallery* );
     102             : 
     103             :     typedef std::vector<GalleryThemeCacheEntry*> GalleryCacheThemeList;
     104             : 
     105             : private:
     106             : 
     107             :     GalleryThemeList            aThemeList;
     108             :     GalleryCacheThemeList       aThemeCache;
     109             :     INetURLObject               aRelURL;
     110             :     INetURLObject               aUserURL;
     111             :     rtl_TextEncoding            nReadTextEncoding;
     112             :     bool                        bMultiPath;
     113             : 
     114             :     SAL_DLLPRIVATE void         ImplLoad( const OUString& rMultiPath );
     115             :     SAL_DLLPRIVATE void         ImplLoadSubDirs( const INetURLObject& rBaseURL, bool& rbIsReadOnly );
     116             : 
     117             :     GalleryThemeEntry*          ImplGetThemeEntry( const OUString& rThemeName );
     118             :     SAL_DLLPRIVATE GalleryThemeEntry* ImplGetThemeEntry( sal_uIntPtr nThemeId );
     119             : 
     120             :     SAL_DLLPRIVATE GalleryTheme* ImplGetCachedTheme( const GalleryThemeEntry* pThemeEntry );
     121             :     SAL_DLLPRIVATE void         ImplDeleteCachedTheme( GalleryTheme* pTheme );
     122             : 
     123             :                                 Gallery( const OUString& rMultiPath );
     124             :                                 virtual ~Gallery();
     125             : 
     126             : public:
     127             : 
     128             :     static Gallery*             GetGalleryInstance();
     129             : 
     130          22 :     SAL_DLLPRIVATE size_t       GetThemeCount() const { return aThemeList.size(); }
     131           0 :     SAL_DLLPRIVATE const GalleryThemeEntry* GetThemeInfo( size_t nPos )
     132           0 :                                 { return nPos < aThemeList.size() ? aThemeList[ nPos ] : NULL; }
     133           0 :     SAL_DLLPRIVATE const GalleryThemeEntry* GetThemeInfo( const OUString& rThemeName ) { return ImplGetThemeEntry( rThemeName ); }
     134             : 
     135             :     bool                        HasTheme( const OUString& rThemeName );
     136             :     SAL_DLLPRIVATE OUString     GetThemeName( sal_uIntPtr nThemeId ) const;
     137             : 
     138             :     bool                        CreateTheme( const OUString& rThemeName );
     139             :     SAL_DLLPRIVATE bool         RenameTheme( const OUString& rOldName, const OUString& rNewName );
     140             :     bool                        RemoveTheme( const OUString& rThemeName );
     141             : 
     142             :     GalleryTheme*               AcquireTheme( const OUString& rThemeName, SfxListener& rListener );
     143             :     void                        ReleaseTheme( GalleryTheme* pTheme, SfxListener& rListener );
     144             : 
     145             : public:
     146             : 
     147          55 :     SAL_DLLPRIVATE const INetURLObject& GetUserURL() const { return aUserURL; }
     148          33 :     SAL_DLLPRIVATE const INetURLObject& GetRelativeURL() const { return aRelURL; }
     149             : 
     150             :     SAL_DLLPRIVATE bool         IsMultiPath() const { return bMultiPath; }
     151             : };
     152             : 
     153             : #endif // INCLUDED_SVX_GALLERY1_HXX
     154             : 
     155             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11