LibreOffice Module sd (master) 1
TemplateScanner.hxx
Go to the documentation of this file.
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#pragma once
21
23#include <ucbhelper/content.hxx>
24#include <com/sun/star/uno/Reference.h>
25
26#include <memory>
27#include <utility>
28#include <vector>
29
30namespace com::sun::star::ucb
31{
32class XContent;
33class XCommandEnvironment;
34}
35
37{
38class XResultSet;
39}
40
41namespace sd
42{
46{
47public:
48 TemplateEntry(OUString sTitle, OUString sPath)
49 : msTitle(std::move(sTitle))
50 , msPath(std::move(sPath))
51 {
52 }
53
54 OUString msTitle;
55 OUString msPath;
56};
57
70{
71public:
75
79 virtual ~TemplateScanner();
80
83 virtual void RunNextStep() override;
84
87 virtual bool HasNextStep() override;
88
96 {
97 return mpTemplateEntries.empty() ? nullptr : mpTemplateEntries.back().get();
98 }
99
100private:
104 enum State
105 {
113 ERROR
114 };
116
118 ::std::vector<std::unique_ptr<TemplateEntry>> mpTemplateEntries;
119
123 std::unique_ptr<FolderDescriptorList> mpFolderDescriptors;
124
129 css::uno::Reference<css::ucb::XContent> mxTemplateRoot;
130 css::uno::Reference<css::ucb::XCommandEnvironment> mxFolderEnvironment;
131 css::uno::Reference<css::ucb::XCommandEnvironment> mxEntryEnvironment;
132 css::uno::Reference<css::sdbc::XResultSet> mxFolderResultSet;
133 css::uno::Reference<css::sdbc::XResultSet> mxEntryResultSet;
134
139
145
152
159
165
172};
173
174} // end of namespace sd
175
176/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Representation of a template or layout file.
TemplateEntry(OUString sTitle, OUString sPath)
This class scans the template folders for impress templates.
State GatherFolderList()
Collect all available top-level folders in an ordered list which can then be processed by ScanFolder(...
State ScanEntry()
Scan one entry.
css::uno::Reference< css::ucb::XCommandEnvironment > mxEntryEnvironment
State
The current state determines which step will be executed next by RunNextStep().
::ucbhelper::Content maFolderContent
virtual ~TemplateScanner()
The destructor deletes any remaining entries of the local list of templates.
std::unique_ptr< FolderDescriptorList > mpFolderDescriptors
TemplateScanner()
Create a new template scanner and prepare but do not execute the scanning.
virtual bool HasNextStep() override
Implementation of the AsynchronousTask interface method.
const TemplateEntry * GetLastAddedEntry() const
Return the TemplateDir object that was last added to mpTemplateEntries.
State InitializeFolderScanning()
Initialize the scanning of folders.
css::uno::Reference< css::ucb::XContent > mxTemplateRoot
Set of state variables used by the methods InitializeFolderScanning(), GatherFolderList(),...
State GetTemplateRoot()
Obtain the root folder of the template folder hierarchy.
css::uno::Reference< css::sdbc::XResultSet > mxFolderResultSet
State InitializeEntryScanning()
Initialize the scanning of entries of a top-level folder.
State ScanFolder()
From the list of top-level folders collected by GatherFolderList() the one with highest priority is p...
virtual void RunNextStep() override
Implementation of the AsynchronousTask interface method.
css::uno::Reference< css::sdbc::XResultSet > mxEntryResultSet
css::uno::Reference< css::ucb::XCommandEnvironment > mxFolderEnvironment
::std::vector< std::unique_ptr< TemplateEntry > > mpTemplateEntries
Interface for the asynchronous execution of a task.