Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / basctl / source / basicide / documentenumeration.hxx
blob2dbe7b6621f327f7e04bc306db18ffe969edb812
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_BASCTL_SOURCE_BASICIDE_DOCUMENTENUMERATION_HXX
21 #define INCLUDED_BASCTL_SOURCE_BASICIDE_DOCUMENTENUMERATION_HXX
23 #include <com/sun/star/frame/XController.hpp>
24 #include <memory>
25 #include <vector>
27 namespace com { namespace sun { namespace star { namespace uno {
28 class XComponentContext;
29 } } } }
32 namespace basctl { namespace docs {
35 typedef std::vector< css::uno::Reference< css::frame::XController > > Controllers;
37 struct DocumentDescriptor
39 css::uno::Reference< css::frame::XModel > xModel;
40 Controllers aControllers;
43 typedef std::vector< DocumentDescriptor > Documents;
46 /// allows pre-filtering when enumerating document descriptors
47 class SAL_NO_VTABLE IDocumentDescriptorFilter
49 public:
50 virtual bool includeDocument( const DocumentDescriptor& _rDocument ) const = 0;
52 protected:
53 ~IDocumentDescriptorFilter() {}
57 struct DocumentEnumeration_Data;
58 /** is a helper class for enumerating documents in OOo
60 If you need a list of all open documents in OOo, this is little bit of
61 a hassle: You need to iterate though all components at the desktop, which
62 might or might not be documents.
64 Additionally, you need to examine the existing documents' frames
65 for sub frames, which might contain sub documents (e.g. embedded objects
66 edited out-place).
68 DocumentEnumeration relieves you from this hassle.
70 class DocumentEnumeration
72 public:
73 DocumentEnumeration( css::uno::Reference< css::uno::XComponentContext > const & _rContext, const IDocumentDescriptorFilter* _pFilter );
74 ~DocumentEnumeration();
76 /** retrieves a list of all currently known documents in the application
78 @param _out_rDocuments
79 output parameter taking the collected document information
82 void getDocuments(
83 Documents& _out_rDocuments
84 ) const;
86 private:
87 std::unique_ptr< DocumentEnumeration_Data > m_pData;
91 } } // namespace basctl::docs
94 #endif // INCLUDED_BASCTL_SOURCE_BASICIDE_DOCUMENTENUMERATION_HXX
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */