LCOV - code coverage report
Current view: top level - svx/inc/svx - galtheme.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 22 0.0 %
Date: 2012-08-25 Functions: 0 16 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 6 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef _SVX_GALTHEME_HXX_
      30                 :            : #define _SVX_GALTHEME_HXX_
      31                 :            : 
      32                 :            : #include "svx/svxdllapi.h"
      33                 :            : 
      34                 :            : #include <tools/debug.hxx>
      35                 :            : #include <tools/urlobj.hxx>
      36                 :            : #include <vcl/salctype.hxx>
      37                 :            : #include <svl/brdcst.hxx>
      38                 :            : #include <svl/lstner.hxx>
      39                 :            : #include <svtools/transfer.hxx>
      40                 :            : #include <sot/storage.hxx>
      41                 :            : #include <svx/svdmodel.hxx>
      42                 :            : #include <svx/galmisc.hxx>
      43                 :            : #include <vector>
      44                 :            : 
      45                 :            : // -----------------
      46                 :            : // - GalleryObject -
      47                 :            : // -----------------
      48                 :            : // --------------
      49                 :            : // - SgaObjKind -
      50                 :            : // --------------
      51                 :            : 
      52                 :          0 : struct GalleryObject
      53                 :            : {
      54                 :            :     INetURLObject   aURL;
      55                 :            :     sal_uInt32      nOffset;
      56                 :            :     SgaObjKind      eObjKind;
      57                 :            :     sal_Bool            bDummy;
      58                 :            : };
      59                 :            : 
      60                 :            : typedef ::std::vector< GalleryObject* > GalleryObjectList;
      61                 :            : 
      62                 :            : class GalleryThemeEntry;
      63                 :            : class SgaObject;
      64                 :            : class FmFormModel;
      65                 :            : class ListBox;
      66                 :            : 
      67                 :            : // -----------------
      68                 :            : // - GalDragParams -
      69                 :            : // -----------------
      70                 :            : 
      71                 :            : struct GalDragParams
      72                 :            : {
      73                 :            :     Region  aDragRegion;
      74                 :            :     sal_uIntPtr nDragObjPos;
      75                 :            :     rtl::OUString aThemeName;
      76                 :            :     rtl::OUString aFileName;
      77                 :            :     SgaObjKind  eObjKind;
      78                 :            : };
      79                 :            : 
      80                 :            : // ----------------
      81                 :            : // - GalleryTheme -
      82                 :            : // ----------------
      83                 :            : 
      84                 :            : class Gallery;
      85                 :            : class GalleryProgress;
      86                 :            : namespace unogallery
      87                 :            : {
      88                 :            :     class GalleryTheme;
      89                 :            :     class GalleryItem;
      90                 :            : }
      91                 :            : 
      92                 :            : class GalleryTheme : public SfxBroadcaster
      93                 :            : {
      94                 :            :     friend class Gallery;
      95                 :            :     friend class GalleryThemeCacheEntry;
      96                 :            :     friend class ::unogallery::GalleryTheme;
      97                 :            :     friend class ::unogallery::GalleryItem;
      98                 :            : 
      99                 :            : private:
     100                 :            : 
     101                 :            :     GalleryObjectList           aObjectList;
     102                 :            :     String                      m_aDestDir;
     103                 :            :     SotStorageRef               aSvDrawStorageRef;
     104                 :            :     Gallery*                    pParent;
     105                 :            :     GalleryThemeEntry*          pThm;
     106                 :            :     sal_uIntPtr                       mnThemeLockCount;
     107                 :            :     sal_uIntPtr                     mnBroadcasterLockCount;
     108                 :            :     sal_uIntPtr                     nDragPos;
     109                 :            :     sal_Bool                        bDragging;
     110                 :            :     sal_Bool                        bAbortActualize;
     111                 :            : 
     112                 :            :     void                        ImplCreateSvDrawStorage();
     113                 :            :     SVX_DLLPUBLIC SgaObject*                    ImplReadSgaObject( GalleryObject* pEntry );
     114                 :            :     sal_Bool                    ImplWriteSgaObject( const SgaObject& rObj, size_t nPos, GalleryObject* pExistentEntry );
     115                 :            :     void                        ImplWrite();
     116                 :          0 :     const GalleryObject*        ImplGetGalleryObject( size_t nPos ) const
     117         [ #  # ]:          0 :                                 { return ( nPos < aObjectList.size() ) ? aObjectList[ nPos ] : NULL; }
     118                 :            :     SVX_DLLPUBLIC const GalleryObject*      ImplGetGalleryObject( const INetURLObject& rURL );
     119                 :            : 
     120                 :          0 :     size_t                      ImplGetGalleryObjectPos( const GalleryObject* pObj ) const
     121                 :            :                                 {
     122         [ #  # ]:          0 :                                     for ( size_t i = 0, n = aObjectList.size(); i < n; ++i )
     123         [ #  # ]:          0 :                                         if ( pObj == aObjectList[ i ] )
     124                 :          0 :                                             return i;
     125                 :          0 :                                     return size_t(-1);
     126                 :            :                                 }
     127                 :            :     INetURLObject               ImplGetURL( const GalleryObject* pObject ) const;
     128                 :            :     INetURLObject               ImplCreateUniqueURL( SgaObjKind eObjKind, sal_uIntPtr nFormat = CVT_UNKNOWN );
     129                 :            :     void                        ImplSetModified( sal_Bool bModified );
     130                 :            :     void                        ImplBroadcast( sal_uIntPtr nUpdatePos );
     131                 :            : 
     132                 :            :                                 GalleryTheme();
     133                 :            :                                 GalleryTheme( Gallery* pGallery, GalleryThemeEntry* pThemeEntry );
     134                 :            :                                 ~GalleryTheme();
     135                 :            : 
     136                 :            : public:
     137                 :            : 
     138                 :            :     static GalleryThemeEntry*   CreateThemeEntry( const INetURLObject& rURL, sal_Bool bReadOnly );
     139                 :            : 
     140                 :          0 :     size_t                      GetObjectCount() const { return aObjectList.size(); }
     141                 :            : 
     142                 :            :     SVX_DLLPUBLIC SgaObject*    AcquireObject( size_t nPos );
     143                 :            :     SVX_DLLPUBLIC void          ReleaseObject( SgaObject* pObj );
     144                 :            : 
     145                 :            :     SVX_DLLPUBLIC bool          InsertObject( const SgaObject& rObj, sal_uIntPtr nPos = LIST_APPEND );
     146                 :            :     SVX_DLLPUBLIC bool          RemoveObject( size_t nPos );
     147                 :            :     bool                        ChangeObjectPos( size_t nOldPos, size_t nNewPos );
     148                 :            : 
     149                 :            :     SVX_DLLPUBLIC const rtl::OUString& GetName() const;
     150                 :            :     const rtl::OUString&        GetRealName() const;
     151                 :            : 
     152                 :            :     const String&               GetDestDir() const { return m_aDestDir; }
     153                 :            :     void                        SetDestDir(const String& rDestDir) { m_aDestDir = rDestDir; }
     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, sal_Bool bResetThemeName );
     161                 :            : 
     162                 :          0 :     void                        SetDragging( sal_Bool bSet ) { bDragging = bSet; }
     163                 :          0 :     sal_Bool                        IsDragging() const { return bDragging; }
     164                 :            : 
     165                 :          0 :     void                        LockTheme() { ++mnThemeLockCount; }
     166                 :            :     sal_Bool                        UnlockTheme();
     167                 :            : 
     168                 :          0 :     void                        LockBroadcaster() { mnBroadcasterLockCount++; }
     169                 :            :     SVX_DLLPUBLIC void          UnlockBroadcaster( sal_uIntPtr nUpdatePos = 0 );
     170                 :          0 :     sal_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                 :            :     sal_Bool                        IsThemeNameFromResource() const;
     176                 :            : 
     177                 :            :     SVX_DLLPUBLIC sal_Bool          IsReadOnly() const;
     178                 :            :     SVX_DLLPUBLIC sal_Bool          IsDefault() const;
     179                 :            :     sal_Bool                        IsModified() const;
     180                 :            : 
     181                 :            :     SVX_DLLPUBLIC void                      Actualize( const Link& rActualizeLink, GalleryProgress* pProgress = NULL );
     182                 :            :     void                        AbortActualize() { bAbortActualize = sal_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                 :            :     sal_Bool                        GetThumb( sal_uIntPtr nPos, Bitmap& rBmp, sal_Bool bProgress = sal_False );
     203                 :            : 
     204                 :            :     SVX_DLLPUBLIC sal_Bool                      GetGraphic( sal_uIntPtr nPos, Graphic& rGraphic, sal_Bool bProgress = sal_False );
     205                 :            :     SVX_DLLPUBLIC sal_Bool                      InsertGraphic( const Graphic& rGraphic, sal_uIntPtr nInsertPos = LIST_APPEND );
     206                 :            : 
     207                 :            :     SVX_DLLPUBLIC sal_Bool                      GetModel( sal_uIntPtr nPos, SdrModel& rModel, sal_Bool bProgress = sal_False );
     208                 :            :     SVX_DLLPUBLIC sal_Bool                      InsertModel( const FmFormModel& rModel, sal_uIntPtr nInsertPos = LIST_APPEND );
     209                 :            : 
     210                 :            :     sal_Bool                        GetModelStream( sal_uIntPtr nPos, SotStorageStreamRef& rModelStreamRef, sal_Bool bProgress = sal_False );
     211                 :            :     sal_Bool                        InsertModelStream( const SotStorageStreamRef& rModelStream, sal_uIntPtr nInsertPos = LIST_APPEND );
     212                 :            : 
     213                 :            :     sal_Bool                        GetURL( sal_uIntPtr nPos, INetURLObject& rURL, sal_Bool bProgress = sal_False );
     214                 :            :     SVX_DLLPUBLIC sal_Bool                      InsertURL( const INetURLObject& rURL, sal_uIntPtr nInsertPos = LIST_APPEND );
     215                 :            :     sal_Bool                        InsertFileOrDirURL( const INetURLObject& rFileOrDirURL, sal_uIntPtr nInsertPos = LIST_APPEND );
     216                 :            : 
     217                 :            :     sal_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                 :            : 
     229                 :            : SvStream& operator<<( SvStream& rOut, const GalleryTheme& rTheme );
     230                 :            : SvStream& operator>>( SvStream& rIn, GalleryTheme& rTheme );
     231                 :            : 
     232                 :            : #endif
     233                 :            : 
     234                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10