Update ooo320-m1
[ooovba.git] / basctl / source / basicide / documentenumeration.hxx
blobb9ccffc463d35ae3c5514076f248c93c549e34c9
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: documentenumeration.hxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef BASCTL_DOCUMENTENUMERATION_HXX
32 #define BASCTL_DOCUMENTENUMERATION_HXX
34 /** === begin UNO includes === **/
35 #include <com/sun/star/frame/XModel.hpp>
36 #include <com/sun/star/frame/XController.hpp>
37 /** === end UNO includes === **/
39 #include <comphelper/componentcontext.hxx>
41 #include <memory>
42 #include <vector>
44 //........................................................................
45 namespace basctl { namespace docs {
46 //........................................................................
48 typedef ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > Model;
49 typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > > Controllers;
51 struct DocumentDescriptor
53 Model xModel;
54 Controllers aControllers;
57 typedef ::std::vector< DocumentDescriptor > Documents;
59 //====================================================================
60 //= IDocumentDescriptorFilter
61 //====================================================================
62 /// allows pre-filtering when enumerating document descriptors
63 class SAL_NO_VTABLE IDocumentDescriptorFilter
65 public:
66 virtual bool includeDocument( const DocumentDescriptor& _rDocument ) const = 0;
69 //====================================================================
70 //= DocumentEnumeration
71 //====================================================================
72 struct DocumentEnumeration_Data;
73 /** is a helper class for enumerating documents in OOo
75 If you need a list of all open documents in OOo, this is little bit of
76 a hassle: You need to iterate though all components at the desktop, which
77 might or might not be documents.
79 Additionally, you need to examine the existing documents' frames
80 for sub frames, which might contain sub documents (e.g. embedded objects
81 edited out-place).
83 DocumentEnumeration relieves you from this hassle.
85 class DocumentEnumeration
87 public:
88 DocumentEnumeration( const ::comphelper::ComponentContext& _rContext, const IDocumentDescriptorFilter* _pFilter = NULL );
89 ~DocumentEnumeration();
91 /** retrieves a list of all currently known documents in the application
93 @param _out_rDocuments
94 output parameter taking the collected document information
97 void getDocuments(
98 Documents& _out_rDocuments
99 ) const;
101 private:
102 ::std::auto_ptr< DocumentEnumeration_Data > m_pData;
105 //........................................................................
106 } } // namespace basctl::docs
107 //........................................................................
109 #endif // BASCTL_DOCUMENTENUMERATION_HXX