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