CWS-TOOLING: integrate CWS os150
[LibreOffice.git] / sd / source / ui / toolpanel / controls / MasterPageContainerFiller.hxx
blobc8ba61fef378c4077f4dfc4f443b14f40d50edb2
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef SD_TOOLPANEL_CONTROLS_MASTER_PAGE_CONTAINER_FILLER_HXX
29 #define SD_TOOLPANEL_CONTROLS_MASTER_PAGE_CONTAINER_FILLER_HXX
31 #include "MasterPageContainer.hxx"
32 #include "MasterPageDescriptor.hxx"
33 #include "tools/AsynchronousTask.hxx"
35 namespace sd {
36 class TemplateScanner;
37 class TemplateEntry;
40 namespace sd { namespace toolpanel { namespace controls {
42 /** Fill a MasterPageContainer with information about the available master
43 pages. These are provided by one default page and from the existing
44 Impress templates. This is done asynchronously.
46 class MasterPageContainerFiller
47 : public ::sd::tools::AsynchronousTask
49 public:
50 class ContainerAdapter
52 public:
53 virtual MasterPageContainer::Token PutMasterPage (
54 const SharedMasterPageDescriptor& rpDescriptor) = 0;
55 /** This method is called when all Impress templates have been added
56 to the container via the PutMasterPage() method.
58 virtual void FillingDone (void) = 0;
61 MasterPageContainerFiller (ContainerAdapter& rContainerAdapter);
62 virtual ~MasterPageContainerFiller (void);
64 /** Run the next step of the task. After HasNextStep() returns false
65 this method should ignore further calls.
67 virtual void RunNextStep (void);
69 /** Return <TRUE/> when there is at least one more step to execute.
70 When the task has been executed completely then <FALSE/> is
71 returned.
73 virtual bool HasNextStep (void);
75 private:
76 ContainerAdapter& mrContainerAdapter;
77 // Remember what the next step has to do.
78 enum State {
79 INITIALIZE_TEMPLATE_SCANNER,
80 SCAN_TEMPLATE,
81 ADD_TEMPLATE,
82 ERROR,
83 DONE
84 } meState;
85 ::std::auto_ptr<TemplateScanner> mpScannerTask;
86 const TemplateEntry* mpLastAddedEntry;
87 int mnIndex;
89 State ScanTemplate (void);
90 State AddTemplate (void);
93 } } } // end of namespace ::sd::toolpanel::controls
95 #endif