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