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