LCOV - code coverage report
Current view: top level - framework/source/inc/accelerators - storageholder.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 4 0.0 %
Date: 2014-04-14 Functions: 0 3 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_FRAMEWORK_SOURCE_INC_ACCELERATORS_STORAGEHOLDER_HXX
      21             : #define INCLUDED_FRAMEWORK_SOURCE_INC_ACCELERATORS_STORAGEHOLDER_HXX
      22             : 
      23             : #include <accelerators/istoragelistener.hxx>
      24             : #include <general.h>
      25             : #include <stdtypes.h>
      26             : 
      27             : #include <com/sun/star/embed/XStorage.hpp>
      28             : 
      29             : namespace framework
      30             : {
      31             : 
      32             : /**
      33             :     TODO document me
      34             :  */
      35             : class StorageHolder
      36             : {
      37             : 
      38             :     // types
      39             :     public:
      40             : 
      41             :         /** @short  TODO */
      42             :         typedef ::std::vector< css::uno::Reference< css::embed::XStorage > > TStorageList;
      43             : 
      44             :         typedef ::std::vector< IStorageListener* > TStorageListenerList;
      45             : 
      46           0 :         struct TStorageInfo
      47             :         {
      48             :             public:
      49             :                 css::uno::Reference< css::embed::XStorage > Storage;
      50             :                 sal_Int32 UseCount;
      51             :                 TStorageListenerList Listener;
      52             : 
      53           0 :                 TStorageInfo()
      54           0 :                     : UseCount(0)
      55           0 :                 {}
      56             :         };
      57             : 
      58             :         /** @short  TODO */
      59             :         typedef ::boost::unordered_map< OUString                    ,
      60             :                                  TStorageInfo                       ,
      61             :                                  OUStringHash                ,
      62             :                                  ::std::equal_to< OUString > > TPath2StorageInfo;
      63             : 
      64             :     // member
      65             :     private:
      66             :         mutable osl::Mutex m_mutex;
      67             : 
      68             :         /** @short  TODO */
      69             :         css::uno::Reference< css::embed::XStorage > m_xRoot;
      70             : 
      71             :         /** @short  TODO */
      72             :         TPath2StorageInfo m_lStorages;
      73             : 
      74             :     // interface
      75             :     public:
      76             : 
      77             :         /** @short  TODO
      78             :          */
      79             :         StorageHolder();
      80             : 
      81             :         /** @short  TODO
      82             :          */
      83             :         virtual ~StorageHolder();
      84             : 
      85             :         /** @short  TODO
      86             :          */
      87             :         virtual void forgetCachedStorages();
      88             : 
      89             :         /** @short  TODO
      90             :          */
      91             :         virtual void setRootStorage(const css::uno::Reference< css::embed::XStorage >& xRoot);
      92             : 
      93             :         /** @short  TODO
      94             :          */
      95             :         virtual css::uno::Reference< css::embed::XStorage > getRootStorage() const;
      96             : 
      97             :         /** @short  TODO
      98             :                     open or get!
      99             :          */
     100             :         virtual css::uno::Reference< css::embed::XStorage > openPath(const OUString& sPath    ,
     101             :                                                                            sal_Int32        nOpenMode);
     102             : 
     103             :         /** @short  TODO
     104             :          */
     105             :         virtual StorageHolder::TStorageList getAllPathStorages(const OUString& sPath);
     106             : 
     107             :         /** @short  TODO
     108             :          */
     109             :         virtual void commitPath(const OUString& sPath);
     110             : 
     111             :         /** @short  TODO
     112             :          */
     113             :         virtual void closePath(const OUString& sPath);
     114             : 
     115             :         /** @short  TODO
     116             :          */
     117             :         virtual void notifyPath(const OUString& sPath);
     118             : 
     119             :         /** @short  TODO
     120             :          */
     121             :         virtual void addStorageListener(      IStorageListener* pListener,
     122             :                                         const OUString&  sPath    );
     123             : 
     124             :         /** @short  TODO
     125             :          */
     126             :         virtual void removeStorageListener(      IStorageListener* pListener,
     127             :                                            const OUString&  sPath    );
     128             : 
     129             :         /** @short  TODO
     130             :          */
     131             :         virtual OUString getPathOfStorage(const css::uno::Reference< css::embed::XStorage >& xStorage);
     132             : 
     133             :         /** @short  TODO
     134             :          */
     135             :         virtual css::uno::Reference< css::embed::XStorage > getParentStorage(const css::uno::Reference< css::embed::XStorage >& xChild);
     136             : 
     137             :         /** @short  TODO
     138             :          */
     139             :         virtual css::uno::Reference< css::embed::XStorage > getParentStorage(const OUString& sChildPath);
     140             : 
     141             :         /** @short  TODO
     142             :          */
     143             :         void operator=(const StorageHolder& rCopy);
     144             : 
     145             :         /** @short  opens a sub element of the specified base storage.
     146             : 
     147             :             @descr  First this method try to open the requested sub element
     148             :                     using the given open mode. If it failed there is second step,
     149             :                     which tries to do the same again ... but removing a might existing
     150             :                     WRITE flag from the open mode. The user can supress this fallback
     151             :                     handling by setting the parameter bAllowFallback to sal_False.
     152             : 
     153             :             @param  xBaseStorage
     154             :                     the storage, where the sub element should be searched.
     155             : 
     156             :             @param  sSubElement
     157             :                     the full name of the sub element.
     158             :                     e.g. "default.xml"
     159             : 
     160             :             @param  eOpenMode
     161             :                     a flag field, which set the open mode for this operation.
     162             : 
     163             :             @param  bAllowFallback
     164             :                     if eOpenMode contains an ELEMENT_WRITE flag this parameter
     165             :                     allow to remove it and try it with the rest of eOpenMode flags
     166             :                     again.
     167             :          */
     168             :         static css::uno::Reference< css::embed::XStorage > openSubStorageWithFallback(const css::uno::Reference< css::embed::XStorage >& xBaseStorage  ,
     169             :                                                                                       const OUString&                             sSubStorage   ,
     170             :                                                                                             sal_Int32                                    eOpenMode     ,
     171             :                                                                                             bool                                     bAllowFallback);
     172             : 
     173             :         static css::uno::Reference< css::io::XStream > openSubStreamWithFallback(const css::uno::Reference< css::embed::XStorage >& xBaseStorage  ,
     174             :                                                                                  const OUString&                             sSubStream    ,
     175             :                                                                                        sal_Int32                                    eOpenMode     ,
     176             :                                                                                        bool                                     bAllowFallback);
     177             : 
     178             :         // helper
     179             :         private:
     180             : 
     181             :             /** @short  TODO
     182             :              */
     183             :             static OUString impl_st_normPath(const OUString& sPath);
     184             : 
     185             :             /** @short  TODO
     186             :              */
     187             :             static OUStringList impl_st_parsePath(const OUString& sPath);
     188             : };
     189             : 
     190             : } // namespace framework
     191             : 
     192             : #endif // INCLUDED_FRAMEWORK_SOURCE_INC_ACCELERATORS_STORAGEHOLDER_HXX
     193             : 
     194             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10