LCOV - code coverage report
Current view: top level - include/svx - galtheme.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 25 0.0 %
Date: 2014-04-14 Functions: 0 18 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_GALTHEME_HXX
      21             : #define INCLUDED_SVX_GALTHEME_HXX
      22             : 
      23             : #include <svx/svxdllapi.h>
      24             : 
      25             : #include <tools/debug.hxx>
      26             : #include <tools/urlobj.hxx>
      27             : #include <vcl/salctype.hxx>
      28             : #include <svl/brdcst.hxx>
      29             : #include <svl/lstner.hxx>
      30             : #include <svtools/transfer.hxx>
      31             : #include <sot/storage.hxx>
      32             : #include <svx/svdmodel.hxx>
      33             : #include <svx/galmisc.hxx>
      34             : #include <vector>
      35             : 
      36             : 
      37             : // - GalleryObject -
      38             : 
      39             : 
      40             : // - SgaObjKind -
      41             : 
      42             : 
      43           0 : struct GalleryObject
      44             : {
      45             :     INetURLObject   aURL;
      46             :     sal_uInt32      nOffset;
      47             :     SgaObjKind      eObjKind;
      48             :     bool            mbDelete;
      49             : 
      50             :     //UI visualization buffering
      51             :     BitmapEx        maPreviewBitmapEx;
      52             :     Size            maPreparedSize;
      53             :     OUString        maTitle;
      54             :     OUString        maPath;
      55             : };
      56             : 
      57             : typedef ::std::vector< GalleryObject* > GalleryObjectList;
      58             : 
      59             : class GalleryThemeEntry;
      60             : class SgaObject;
      61             : class FmFormModel;
      62             : class ListBox;
      63             : 
      64             : 
      65             : // - GalDragParams -
      66             : 
      67             : 
      68             : struct GalDragParams
      69             : {
      70             :     Region  aDragRegion;
      71             :     sal_uIntPtr nDragObjPos;
      72             :     OUString aThemeName;
      73             :     OUString aFileName;
      74             :     SgaObjKind  eObjKind;
      75             : };
      76             : 
      77             : 
      78             : // - GalleryTheme -
      79             : 
      80             : 
      81             : class Gallery;
      82             : class GalleryProgress;
      83             : namespace unogallery
      84             : {
      85             :     class GalleryTheme;
      86             :     class GalleryItem;
      87             : }
      88             : 
      89             : class GalleryTheme : public SfxBroadcaster
      90             : {
      91             :     friend class Gallery;
      92             :     friend class GalleryThemeCacheEntry;
      93             :     friend class ::unogallery::GalleryTheme;
      94             :     friend class ::unogallery::GalleryItem;
      95             : 
      96             : private:
      97             : 
      98             :     GalleryObjectList           aObjectList;
      99             :     OUString                    m_aDestDir;
     100             :     bool                        m_bDestDirRelative;
     101             :     SotStorageRef               aSvDrawStorageRef;
     102             :     Gallery*                    pParent;
     103             :     GalleryThemeEntry*          pThm;
     104             :     sal_uIntPtr                 mnThemeLockCount;
     105             :     sal_uIntPtr                 mnBroadcasterLockCount;
     106             :     sal_uIntPtr                 nDragPos;
     107             :     bool                        bDragging;
     108             :     bool                        bAbortActualize;
     109             : 
     110             :     void                        ImplCreateSvDrawStorage();
     111             :     SVX_DLLPUBLIC SgaObject*                    ImplReadSgaObject( GalleryObject* pEntry );
     112             :     bool                        ImplWriteSgaObject( const SgaObject& rObj, size_t nPos, GalleryObject* pExistentEntry );
     113             :     void                        ImplWrite();
     114           0 :     const GalleryObject*        ImplGetGalleryObject( size_t nPos ) const
     115           0 :                                 { return ( nPos < aObjectList.size() ) ? aObjectList[ nPos ] : NULL; }
     116             :     SVX_DLLPUBLIC const GalleryObject*      ImplGetGalleryObject( const INetURLObject& rURL );
     117             : 
     118           0 :     size_t                      ImplGetGalleryObjectPos( const GalleryObject* pObj ) const
     119             :                                 {
     120           0 :                                     for ( size_t i = 0, n = aObjectList.size(); i < n; ++i )
     121           0 :                                         if ( pObj == aObjectList[ i ] )
     122           0 :                                             return i;
     123           0 :                                     return size_t(-1);
     124             :                                 }
     125             :     INetURLObject               ImplGetURL( const GalleryObject* pObject ) const;
     126             :     INetURLObject               ImplCreateUniqueURL( SgaObjKind eObjKind, sal_uIntPtr nFormat = CVT_UNKNOWN );
     127             :     void                        ImplSetModified( bool bModified );
     128             :     void                        ImplBroadcast( sal_uIntPtr nUpdatePos );
     129             : 
     130             :                                 GalleryTheme();
     131             :                                 GalleryTheme( Gallery* pGallery, GalleryThemeEntry* pThemeEntry );
     132             :                                 virtual ~GalleryTheme();
     133             : 
     134             : public:
     135             : 
     136             :     static GalleryThemeEntry*   CreateThemeEntry( const INetURLObject& rURL, bool bReadOnly );
     137             : 
     138           0 :     size_t                      GetObjectCount() const { return aObjectList.size(); }
     139             : 
     140             :     SVX_DLLPUBLIC SgaObject*    AcquireObject( size_t nPos );
     141             :     SVX_DLLPUBLIC void          ReleaseObject( SgaObject* pObj );
     142             : 
     143             :     SVX_DLLPUBLIC bool          InsertObject( const SgaObject& rObj, sal_uIntPtr nPos = CONTAINER_APPEND );
     144             :     SVX_DLLPUBLIC bool          RemoveObject( size_t nPos );
     145             :     bool                        ChangeObjectPos( size_t nOldPos, size_t nNewPos );
     146             : 
     147             :     SVX_DLLPUBLIC const OUString& GetName() const;
     148             :     const OUString&        GetRealName() const;
     149             : 
     150             :     // used for building gallery themes during compilation:
     151             :     const OUString&             GetDestDir() const { return m_aDestDir; }
     152           0 :     void                        SetDestDir(const OUString& rDestDir, bool bRelative = true)
     153           0 :                                 { m_aDestDir = rDestDir; m_bDestDirRelative = bRelative; }
     154             : 
     155             :     const INetURLObject&        GetThmURL() const;
     156             :     SVX_DLLPUBLIC const INetURLObject&      GetSdgURL() const;
     157             :     const INetURLObject&        GetSdvURL() const;
     158             : 
     159             :     SVX_DLLPUBLIC sal_uInt32    GetId() const;
     160             :     void                        SetId( sal_uInt32 nNewId, bool bResetThemeName );
     161             : 
     162           0 :     void                        SetDragging( bool bSet ) { bDragging = bSet; }
     163           0 :     bool                        IsDragging() const { return bDragging; }
     164             : 
     165           0 :     void                        LockTheme() { ++mnThemeLockCount; }
     166             :     bool                        UnlockTheme();
     167             : 
     168           0 :     void                        LockBroadcaster() { mnBroadcasterLockCount++; }
     169             :     SVX_DLLPUBLIC void          UnlockBroadcaster( sal_uIntPtr nUpdatePos = 0 );
     170           0 :     bool                        IsBroadcasterLocked() const { return mnBroadcasterLockCount > 0; }
     171             : 
     172           0 :     void                        SetDragPos( sal_uIntPtr nPos ) { nDragPos = nPos; }
     173           0 :     sal_uIntPtr                     GetDragPos() const { return nDragPos; }
     174             : 
     175             :     bool                        IsThemeNameFromResource() const;
     176             : 
     177             :     SVX_DLLPUBLIC bool          IsReadOnly() const;
     178             :     SVX_DLLPUBLIC bool          IsDefault() const;
     179             :     bool                        IsModified() const;
     180             : 
     181             :     SVX_DLLPUBLIC void                      Actualize( const Link& rActualizeLink, GalleryProgress* pProgress = NULL );
     182           0 :     void                        AbortActualize() { bAbortActualize = true; }
     183             : 
     184           0 :     Gallery*                    GetParent() const { return pParent; }
     185           0 :     SotStorageRef               GetSvDrawStorage() const { return aSvDrawStorageRef; }
     186             : 
     187             : public:
     188             : 
     189           0 :     SgaObjKind                  GetObjectKind( sal_uIntPtr nPos ) const
     190             :                                 {
     191             :                                     DBG_ASSERT( nPos < GetObjectCount(), "Position out of range" );
     192           0 :                                     return ImplGetGalleryObject( nPos )->eObjKind;
     193             :                                 }
     194             : 
     195             : 
     196           0 :     const INetURLObject&        GetObjectURL( sal_uIntPtr nPos ) const
     197             :                                 {
     198             :                                     DBG_ASSERT( nPos < GetObjectCount(), "Position out of range" );
     199           0 :                                     return ImplGetGalleryObject( nPos )->aURL;
     200             :                                 }
     201             : 
     202             :     bool                        GetThumb( sal_uIntPtr nPos, BitmapEx& rBmp, bool bProgress = false );
     203             : 
     204             :     SVX_DLLPUBLIC bool         GetGraphic( sal_uIntPtr nPos, Graphic& rGraphic, bool bProgress = false );
     205             :     SVX_DLLPUBLIC bool         InsertGraphic( const Graphic& rGraphic, sal_uIntPtr nInsertPos = CONTAINER_APPEND );
     206             : 
     207             :     SVX_DLLPUBLIC bool          GetModel( sal_uIntPtr nPos, SdrModel& rModel, bool bProgress = false );
     208             :     SVX_DLLPUBLIC bool          InsertModel( const FmFormModel& rModel, sal_uIntPtr nInsertPos = CONTAINER_APPEND );
     209             : 
     210             :     bool                        GetModelStream( sal_uIntPtr nPos, SotStorageStreamRef& rModelStreamRef, bool bProgress = false );
     211             :     bool                        InsertModelStream( const SotStorageStreamRef& rModelStream, sal_uIntPtr nInsertPos = CONTAINER_APPEND );
     212             : 
     213             :     bool                        GetURL( sal_uIntPtr nPos, INetURLObject& rURL, bool bProgress = false );
     214             :     SVX_DLLPUBLIC bool          InsertURL( const INetURLObject& rURL, sal_uIntPtr nInsertPos = CONTAINER_APPEND );
     215             :     bool                        InsertFileOrDirURL( const INetURLObject& rFileOrDirURL, sal_uIntPtr nInsertPos = CONTAINER_APPEND );
     216             : 
     217             :     bool                        InsertTransferable( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& rxTransferable, sal_uIntPtr nInsertPos );
     218             : 
     219             :     void                        CopyToClipboard( Window* pWindow, sal_uIntPtr nPos );
     220             :     void                        StartDrag( Window* pWindow, sal_uIntPtr nPos );
     221             : 
     222             : public:
     223             : 
     224             :     SvStream&                   WriteData( SvStream& rOut ) const;
     225             :     SvStream&                   ReadData( SvStream& rIn );
     226             :     static SVX_DLLPUBLIC void   InsertAllThemes( ListBox& rListBox );
     227             : 
     228             :     // for buffering PreviewBitmaps and strings for object and path
     229             :     void GetPreviewBitmapExAndStrings(sal_uIntPtr nPos, BitmapEx& rBitmapEx, Size& rSize, OUString& rTitle, OUString& rPath) const;
     230             :     void SetPreviewBitmapExAndStrings(sal_uIntPtr nPos, const BitmapEx& rBitmapEx, const Size& rSize, const OUString& rTitle, const OUString& rPath);
     231             : };
     232             : 
     233             : SvStream& WriteGalleryTheme( SvStream& rOut, const GalleryTheme& rTheme );
     234             : SvStream& ReadGalleryTheme( SvStream& rIn, GalleryTheme& rTheme );
     235             : 
     236             : #endif
     237             : 
     238             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10