LCOV - code coverage report
Current view: top level - include/svx - gallery1.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 18 0.0 %
Date: 2014-04-14 Functions: 0 17 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_SVX_GALLERY1_HXX
      21             : #define INCLUDED_SVX_GALLERY1_HXX
      22             : 
      23             : #include <rtl/ustring.hxx>
      24             : #include <svl/brdcst.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             :     INetURLObject           ImplGetURLIgnoreCase( const INetURLObject& rURL ) const;
      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           0 :                             ~GalleryThemeEntry() {};
      62             : 
      63           0 :     const OUString&         GetThemeName() const { return aName; }
      64             : 
      65           0 :     const INetURLObject&    GetThmURL() const { return aThmURL; }
      66           0 :     const INetURLObject&    GetSdgURL() const { return aSdgURL; }
      67           0 :     const INetURLObject&    GetSdvURL() const { return aSdvURL; }
      68           0 :     const INetURLObject&    GetStrURL() const { return aStrURL; }
      69             : 
      70             :     OUString                ReadStrFromIni(const OUString &aKeyName );
      71             : 
      72           0 :     bool                    IsReadOnly() const { return bReadOnly; }
      73             :     bool                    IsDefault() const;
      74             : 
      75           0 :     bool                    IsHidden() const { return aName.match("private://gallery/hidden/"); }
      76             : 
      77           0 :     bool                    IsModified() const { return bModified; }
      78           0 :     void                    SetModified( bool bSet ) { bModified = ( bSet && !IsReadOnly() ); }
      79             : 
      80             :     void                    SetName( const OUString& rNewName );
      81           0 :     bool                    IsNameFromResource() const { return bThemeNameFromResource; }
      82             : 
      83           0 :     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 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             :     void                        ImplLoad( const OUString& rMultiPath );
     115             :     void                        ImplLoadSubDirs( const INetURLObject& rBaseURL, bool& rbIsReadOnly );
     116             : 
     117             :     SVX_DLLPUBLIC GalleryThemeEntry*            ImplGetThemeEntry( const OUString& rThemeName );
     118             :     GalleryThemeEntry*          ImplGetThemeEntry( sal_uIntPtr nThemeId );
     119             : 
     120             :     GalleryTheme*               ImplGetCachedTheme( const GalleryThemeEntry* pThemeEntry );
     121             :     void                        ImplDeleteCachedTheme( GalleryTheme* pTheme );
     122             : 
     123             :                                 SVX_DLLPUBLIC Gallery( const OUString& rMultiPath );
     124             :                                 SVX_DLLPUBLIC virtual ~Gallery();
     125             : 
     126             : public:
     127             : 
     128             :     SVX_DLLPUBLIC static Gallery* GetGalleryInstance();
     129             : 
     130           0 :     size_t                      GetThemeCount() const { return aThemeList.size(); }
     131           0 :     const GalleryThemeEntry*    GetThemeInfo( size_t nPos )
     132           0 :                                 { return nPos < aThemeList.size() ? aThemeList[ nPos ] : NULL; }
     133           0 :     const GalleryThemeEntry*    GetThemeInfo( const OUString& rThemeName ) { return ImplGetThemeEntry( rThemeName ); }
     134             : 
     135             :     SVX_DLLPUBLIC bool          HasTheme( const OUString& rThemeName );
     136             :     OUString                    GetThemeName( sal_uIntPtr nThemeId ) const;
     137             : 
     138             :     SVX_DLLPUBLIC bool          CreateTheme( const OUString& rThemeName );
     139             :     bool                        RenameTheme( const OUString& rOldName, const OUString& rNewName );
     140             :     SVX_DLLPUBLIC bool          RemoveTheme( const OUString& rThemeName );
     141             : 
     142             :     SVX_DLLPUBLIC GalleryTheme* AcquireTheme( const OUString& rThemeName, SfxListener& rListener );
     143             :     SVX_DLLPUBLIC void          ReleaseTheme( GalleryTheme* pTheme, SfxListener& rListener );
     144             : 
     145             : public:
     146             : 
     147           0 :     const INetURLObject&        GetUserURL() const { return aUserURL; }
     148           0 :     const INetURLObject&        GetRelativeURL() const { return aRelURL; }
     149             : 
     150             :     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.10