LCOV - code coverage report
Current view: top level - basctl/source/basicide - documentenumeration.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 3 0.0 %
Date: 2012-08-25 Functions: 0 5 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     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 BASCTL_DOCUMENTENUMERATION_HXX
      21                 :            : #define BASCTL_DOCUMENTENUMERATION_HXX
      22                 :            : 
      23                 :            : #include <com/sun/star/frame/XModel.hpp>
      24                 :            : #include <com/sun/star/frame/XController.hpp>
      25                 :            : 
      26                 :            : #include <comphelper/componentcontext.hxx>
      27                 :            : 
      28                 :            : #include <memory>
      29                 :            : #include <vector>
      30                 :            : 
      31                 :            : //........................................................................
      32                 :            : namespace basctl { namespace docs {
      33                 :            : //........................................................................
      34                 :            : 
      35                 :            :     typedef ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >                         Model;
      36                 :            :     typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > >   Controllers;
      37                 :            : 
      38                 :          0 :     struct DocumentDescriptor
      39                 :            :     {
      40                 :            :         Model       xModel;
      41                 :            :         Controllers aControllers;
      42                 :            :     };
      43                 :            : 
      44                 :            :     typedef ::std::vector< DocumentDescriptor > Documents;
      45                 :            : 
      46                 :            :     //====================================================================
      47                 :            :     //= IDocumentDescriptorFilter
      48                 :            :     //====================================================================
      49                 :            :     /// allows pre-filtering when enumerating document descriptors
      50                 :          0 :     class SAL_NO_VTABLE IDocumentDescriptorFilter
      51                 :            :     {
      52                 :            :     public:
      53                 :            :         virtual bool    includeDocument( const DocumentDescriptor& _rDocument ) const = 0;
      54                 :            : 
      55                 :            :     protected:
      56                 :          0 :         ~IDocumentDescriptorFilter() {}
      57                 :            :     };
      58                 :            : 
      59                 :            :     //====================================================================
      60                 :            :     //= DocumentEnumeration
      61                 :            :     //====================================================================
      62                 :            :     struct DocumentEnumeration_Data;
      63                 :            :     /** is a helper class for enumerating documents in OOo
      64                 :            : 
      65                 :            :         If you need a list of all open documents in OOo, this is little bit of
      66                 :            :         a hassle: You need to iterate though all components at the desktop, which
      67                 :            :         might or might not be documents.
      68                 :            : 
      69                 :            :         Additionally, you need to examine the existing documents' frames
      70                 :            :         for sub frames, which might contain sub documents (e.g. embedded objects
      71                 :            :         edited out-place).
      72                 :            : 
      73                 :            :         DocumentEnumeration relieves you from this hassle.
      74                 :            :     */
      75                 :            :     class DocumentEnumeration
      76                 :            :     {
      77                 :            :     public:
      78                 :            :         DocumentEnumeration( const ::comphelper::ComponentContext& _rContext, const IDocumentDescriptorFilter* _pFilter = NULL );
      79                 :            :         ~DocumentEnumeration();
      80                 :            : 
      81                 :            :         /** retrieves a list of all currently known documents in the application
      82                 :            : 
      83                 :            :             @param _out_rDocuments
      84                 :            :                 output parameter taking the collected document information
      85                 :            :             @
      86                 :            :         */
      87                 :            :         void    getDocuments(
      88                 :            :             Documents& _out_rDocuments
      89                 :            :         ) const;
      90                 :            : 
      91                 :            :     private:
      92                 :            :         ::std::auto_ptr< DocumentEnumeration_Data > m_pData;
      93                 :            :     };
      94                 :            : 
      95                 :            : //........................................................................
      96                 :            : } } // namespace basctl::docs
      97                 :            : //........................................................................
      98                 :            : 
      99                 :            : #endif // BASCTL_DOCUMENTENUMERATION_HXX
     100                 :            : 
     101                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10