Bump version to 24.04.3.4
[LibreOffice.git] / basctl / source / basicide / documentenumeration.hxx
blobdfd4d2e8172fb205b064519ac4741a3a1165086e
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 #pragma once
22 #include <com/sun/star/frame/XController.hpp>
23 #include <memory>
24 #include <vector>
26 namespace com::sun::star::uno { class XComponentContext; }
29 namespace basctl::docs {
32 typedef std::vector< css::uno::Reference< css::frame::XController > > Controllers;
34 struct DocumentDescriptor
36 css::uno::Reference< css::frame::XModel > xModel;
37 Controllers aControllers;
40 typedef std::vector< DocumentDescriptor > Documents;
43 /// allows pre-filtering when enumerating document descriptors
44 class SAL_NO_VTABLE IDocumentDescriptorFilter
46 public:
47 virtual bool includeDocument( const DocumentDescriptor& _rDocument ) const = 0;
49 protected:
50 ~IDocumentDescriptorFilter() {}
54 /** is a helper class for enumerating documents in OOo
56 If you need a list of all open documents in OOo, this is little bit of
57 a hassle: You need to iterate though all components at the desktop, which
58 might or might not be documents.
60 Additionally, you need to examine the existing documents' frames
61 for sub frames, which might contain sub documents (e.g. embedded objects
62 edited out-place).
64 DocumentEnumeration relieves you from this hassle.
66 class DocumentEnumeration
68 public:
69 DocumentEnumeration( css::uno::Reference< css::uno::XComponentContext > const & _rContext, const IDocumentDescriptorFilter* _pFilter );
70 ~DocumentEnumeration();
72 /** retrieves a list of all currently known documents in the application
74 @param _out_rDocuments
75 output parameter taking the collected document information
78 void getDocuments(
79 Documents& _out_rDocuments
80 ) const;
82 private:
83 css::uno::Reference< css::uno::XComponentContext > m_xContext;
84 const IDocumentDescriptorFilter* m_pFilter;
88 } // namespace basctl::docs
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */