1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: documentenumeration.hxx,v $
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>
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
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
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
83 DocumentEnumeration relieves you from this hassle.
85 class DocumentEnumeration
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
98 Documents
& _out_rDocuments
102 ::std::auto_ptr
< DocumentEnumeration_Data
> m_pData
;
105 //........................................................................
106 } } // namespace basctl::docs
107 //........................................................................
109 #endif // BASCTL_DOCUMENTENUMERATION_HXX