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_DCUMENT_HELPER_HXX 237a32b0c8SAndre Fischer #define SD_SIDEBAR_PANELS_DCUMENT_HELPER_HXX 24cdf0e10cSrcweir 25cdf0e10cSrcweir #include <tools/solar.h> 26cdf0e10cSrcweir #include <boost/shared_ptr.hpp> 27cdf0e10cSrcweir #include <vector> 28cdf0e10cSrcweir 29cdf0e10cSrcweir class SdDrawDocument; 30cdf0e10cSrcweir class SdPage; 31cdf0e10cSrcweir class String; 32cdf0e10cSrcweir 337a32b0c8SAndre Fischer namespace sd { namespace sidebar { 34cdf0e10cSrcweir 35cdf0e10cSrcweir /** A collection of methods supporting the handling of master pages. 36cdf0e10cSrcweir */ 37cdf0e10cSrcweir class DocumentHelper 38cdf0e10cSrcweir { 39cdf0e10cSrcweir public: 40cdf0e10cSrcweir /** Return a copy of the given master page in the given document. 41cdf0e10cSrcweir */ 42cdf0e10cSrcweir static SdPage* CopyMasterPageToLocalDocument ( 43cdf0e10cSrcweir SdDrawDocument& rTargetDocument, 44cdf0e10cSrcweir SdPage* pMasterPage); 45cdf0e10cSrcweir 46cdf0e10cSrcweir /** Return and, when not yet present, create a slide that uses the given 47cdf0e10cSrcweir masster page. 48cdf0e10cSrcweir */ 49cdf0e10cSrcweir static SdPage* GetSlideForMasterPage (SdPage* pMasterPage); 50cdf0e10cSrcweir 51cdf0e10cSrcweir /** Copy the styles used by the given page from the source document to 52cdf0e10cSrcweir the target document. 53cdf0e10cSrcweir */ 54cdf0e10cSrcweir static void ProvideStyles ( 55cdf0e10cSrcweir SdDrawDocument& rSourceDocument, 56cdf0e10cSrcweir SdDrawDocument& rTargetDocument, 57cdf0e10cSrcweir SdPage* pPage); 58cdf0e10cSrcweir 59cdf0e10cSrcweir /** Assign the given master page to the list of pages. 60cdf0e10cSrcweir @param rTargetDocument 61cdf0e10cSrcweir The document that is the owner of the pages in rPageList. 62cdf0e10cSrcweir @param pMasterPage 63cdf0e10cSrcweir This master page will usually be a member of the list of all 64cdf0e10cSrcweir available master pages as provided by the MasterPageContainer. 65cdf0e10cSrcweir @param rPageList 66cdf0e10cSrcweir The pages to which to assign the master page. These pages may 67cdf0e10cSrcweir be slides or master pages themselves. 68cdf0e10cSrcweir */ 69cdf0e10cSrcweir static void AssignMasterPageToPageList ( 70cdf0e10cSrcweir SdDrawDocument& rTargetDocument, 71cdf0e10cSrcweir SdPage* pMasterPage, 72cdf0e10cSrcweir const ::boost::shared_ptr<std::vector<SdPage*> >& rPageList); 73cdf0e10cSrcweir 74cdf0e10cSrcweir private: 75cdf0e10cSrcweir static SdPage* AddMasterPage ( 76cdf0e10cSrcweir SdDrawDocument& rTargetDocument, 77cdf0e10cSrcweir SdPage* pMasterPage); 78cdf0e10cSrcweir static SdPage* AddMasterPage ( 79cdf0e10cSrcweir SdDrawDocument& rTargetDocument, 80cdf0e10cSrcweir SdPage* pMasterPage, 81cdf0e10cSrcweir sal_uInt16 nInsertionIndex); 82cdf0e10cSrcweir static SdPage* ProvideMasterPage ( 83cdf0e10cSrcweir SdDrawDocument& rTargetDocument, 84cdf0e10cSrcweir SdPage* pMasterPage, 85cdf0e10cSrcweir const ::boost::shared_ptr<std::vector<SdPage*> >& rpPageList); 86cdf0e10cSrcweir 87cdf0e10cSrcweir /** Assign the given master page to the given page. 88cdf0e10cSrcweir @param pMasterPage 89cdf0e10cSrcweir In contrast to AssignMasterPageToPageList() this page is assumed 90cdf0e10cSrcweir to be in the target document, i.e. the same document that pPage 91cdf0e10cSrcweir is in. The caller will usually call AddMasterPage() to create a 92cdf0e10cSrcweir clone of a master page in a another document to create it. 93cdf0e10cSrcweir @param rsBaseLayoutName 94cdf0e10cSrcweir The layout name of the given master page. It is given so that 95cdf0e10cSrcweir it has not to be created on every call. It could be generated 96cdf0e10cSrcweir from the given master page, though. 97cdf0e10cSrcweir @param pPage 98cdf0e10cSrcweir The page to which to assign the master page. It can be a slide 99cdf0e10cSrcweir or a master page itself. 100cdf0e10cSrcweir */ 101cdf0e10cSrcweir static void AssignMasterPageToPage ( 102cdf0e10cSrcweir SdPage* pMasterPage, 103cdf0e10cSrcweir const String& rsBaseLayoutName, 104cdf0e10cSrcweir SdPage* pPage); 105cdf0e10cSrcweir }; 106cdf0e10cSrcweir 107cdf0e10cSrcweir 1087a32b0c8SAndre Fischer } } // end of namespace sd::sidebar 109cdf0e10cSrcweir 110cdf0e10cSrcweir #endif 111