xref: /AOO41X/main/sd/source/ui/sidebar/MasterPageContainerFiller.hxx (revision ca62e2c2083b5d0995f1245bad6c2edfb455fbec)
1*02c50d82SAndre Fischer /**************************************************************
2*02c50d82SAndre Fischer  *
3*02c50d82SAndre Fischer  * Licensed to the Apache Software Foundation (ASF) under one
4*02c50d82SAndre Fischer  * or more contributor license agreements.  See the NOTICE file
5*02c50d82SAndre Fischer  * distributed with this work for additional information
6*02c50d82SAndre Fischer  * regarding copyright ownership.  The ASF licenses this file
7*02c50d82SAndre Fischer  * to you under the Apache License, Version 2.0 (the
8*02c50d82SAndre Fischer  * "License"); you may not use this file except in compliance
9*02c50d82SAndre Fischer  * with the License.  You may obtain a copy of the License at
10*02c50d82SAndre Fischer  *
11*02c50d82SAndre Fischer  *   http://www.apache.org/licenses/LICENSE-2.0
12*02c50d82SAndre Fischer  *
13*02c50d82SAndre Fischer  * Unless required by applicable law or agreed to in writing,
14*02c50d82SAndre Fischer  * software distributed under the License is distributed on an
15*02c50d82SAndre Fischer  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*02c50d82SAndre Fischer  * KIND, either express or implied.  See the License for the
17*02c50d82SAndre Fischer  * specific language governing permissions and limitations
18*02c50d82SAndre Fischer  * under the License.
19*02c50d82SAndre Fischer  *
20*02c50d82SAndre Fischer  *************************************************************/
21*02c50d82SAndre Fischer 
22*02c50d82SAndre Fischer #ifndef SD_SIDEBAR_PANELS_MASTER_PAGE_CONTAINER_FILLER_HXX
23*02c50d82SAndre Fischer #define SD_SIDEBAR_PANELS_MASTER_PAGE_CONTAINER_FILLER_HXX
24*02c50d82SAndre Fischer 
25*02c50d82SAndre Fischer #include "MasterPageContainer.hxx"
26*02c50d82SAndre Fischer #include "MasterPageDescriptor.hxx"
27*02c50d82SAndre Fischer #include "tools/AsynchronousTask.hxx"
28*02c50d82SAndre Fischer 
29*02c50d82SAndre Fischer namespace sd {
30*02c50d82SAndre Fischer class TemplateScanner;
31*02c50d82SAndre Fischer class TemplateEntry;
32*02c50d82SAndre Fischer }
33*02c50d82SAndre Fischer 
34*02c50d82SAndre Fischer namespace sd { namespace sidebar {
35*02c50d82SAndre Fischer 
36*02c50d82SAndre Fischer /** Fill a MasterPageContainer with information about the available master
37*02c50d82SAndre Fischer     pages.  These are provided by one default page and from the existing
38*02c50d82SAndre Fischer     Impress templates.  This is done asynchronously.
39*02c50d82SAndre Fischer */
40*02c50d82SAndre Fischer class MasterPageContainerFiller
41*02c50d82SAndre Fischer     : public ::sd::tools::AsynchronousTask
42*02c50d82SAndre Fischer {
43*02c50d82SAndre Fischer public:
44*02c50d82SAndre Fischer     class ContainerAdapter
45*02c50d82SAndre Fischer     {
46*02c50d82SAndre Fischer     public:
47*02c50d82SAndre Fischer         virtual MasterPageContainer::Token PutMasterPage (
48*02c50d82SAndre Fischer             const SharedMasterPageDescriptor& rpDescriptor) = 0;
49*02c50d82SAndre Fischer         /** This method is called when all Impress templates have been added
50*02c50d82SAndre Fischer             to the container via the PutMasterPage() method.
51*02c50d82SAndre Fischer         */
52*02c50d82SAndre Fischer         virtual void FillingDone (void) = 0;
53*02c50d82SAndre Fischer     };
54*02c50d82SAndre Fischer 
55*02c50d82SAndre Fischer     MasterPageContainerFiller (ContainerAdapter& rContainerAdapter);
56*02c50d82SAndre Fischer     virtual ~MasterPageContainerFiller (void);
57*02c50d82SAndre Fischer 
58*02c50d82SAndre Fischer     /** Run the next step of the task.  After HasNextStep() returns false
59*02c50d82SAndre Fischer         this method should ignore further calls.
60*02c50d82SAndre Fischer     */
61*02c50d82SAndre Fischer     virtual void RunNextStep (void);
62*02c50d82SAndre Fischer 
63*02c50d82SAndre Fischer     /** Return <TRUE/> when there is at least one more step to execute.
64*02c50d82SAndre Fischer         When the task has been executed completely then <FALSE/> is
65*02c50d82SAndre Fischer         returned.
66*02c50d82SAndre Fischer     */
67*02c50d82SAndre Fischer     virtual bool HasNextStep (void);
68*02c50d82SAndre Fischer 
69*02c50d82SAndre Fischer private:
70*02c50d82SAndre Fischer     ContainerAdapter& mrContainerAdapter;
71*02c50d82SAndre Fischer     // Remember what the next step has to do.
72*02c50d82SAndre Fischer     enum State {
73*02c50d82SAndre Fischer         INITIALIZE_TEMPLATE_SCANNER,
74*02c50d82SAndre Fischer         SCAN_TEMPLATE,
75*02c50d82SAndre Fischer         ADD_TEMPLATE,
76*02c50d82SAndre Fischer         ERROR,
77*02c50d82SAndre Fischer         DONE
78*02c50d82SAndre Fischer     } meState;
79*02c50d82SAndre Fischer     ::std::auto_ptr<TemplateScanner> mpScannerTask;
80*02c50d82SAndre Fischer     const TemplateEntry* mpLastAddedEntry;
81*02c50d82SAndre Fischer     int mnIndex;
82*02c50d82SAndre Fischer 
83*02c50d82SAndre Fischer     State ScanTemplate (void);
84*02c50d82SAndre Fischer     State AddTemplate (void);
85*02c50d82SAndre Fischer };
86*02c50d82SAndre Fischer 
87*02c50d82SAndre Fischer } } // end of namespace sd::sidebar
88*02c50d82SAndre Fischer 
89*02c50d82SAndre Fischer #endif
90