1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 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. 14 * 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). 20 * 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. 25 * 26 ************************************************************************/ 27 28 #ifndef SD_TOOLPANEL_CONTROLS_DCUMENT_HELPER_HXX 29 #define SD_TOOLPANEL_CONTROLS_DCUMENT_HELPER_HXX 30 31 #include <tools/solar.h> 32 #include <boost/shared_ptr.hpp> 33 #include <vector> 34 35 class SdDrawDocument; 36 class SdPage; 37 class String; 38 39 namespace sd { namespace toolpanel { namespace controls { 40 41 /** A collection of methods supporting the handling of master pages. 42 */ 43 class DocumentHelper 44 { 45 public: 46 /** Return a copy of the given master page in the given document. 47 */ 48 static SdPage* CopyMasterPageToLocalDocument ( 49 SdDrawDocument& rTargetDocument, 50 SdPage* pMasterPage); 51 52 /** Return and, when not yet present, create a slide that uses the given 53 masster page. 54 */ 55 static SdPage* GetSlideForMasterPage (SdPage* pMasterPage); 56 57 /** Copy the styles used by the given page from the source document to 58 the target document. 59 */ 60 static void ProvideStyles ( 61 SdDrawDocument& rSourceDocument, 62 SdDrawDocument& rTargetDocument, 63 SdPage* pPage); 64 65 /** Assign the given master page to the list of pages. 66 @param rTargetDocument 67 The document that is the owner of the pages in rPageList. 68 @param pMasterPage 69 This master page will usually be a member of the list of all 70 available master pages as provided by the MasterPageContainer. 71 @param rPageList 72 The pages to which to assign the master page. These pages may 73 be slides or master pages themselves. 74 */ 75 static void AssignMasterPageToPageList ( 76 SdDrawDocument& rTargetDocument, 77 SdPage* pMasterPage, 78 const ::boost::shared_ptr<std::vector<SdPage*> >& rPageList); 79 80 private: 81 static SdPage* AddMasterPage ( 82 SdDrawDocument& rTargetDocument, 83 SdPage* pMasterPage); 84 static SdPage* AddMasterPage ( 85 SdDrawDocument& rTargetDocument, 86 SdPage* pMasterPage, 87 sal_uInt16 nInsertionIndex); 88 static SdPage* ProvideMasterPage ( 89 SdDrawDocument& rTargetDocument, 90 SdPage* pMasterPage, 91 const ::boost::shared_ptr<std::vector<SdPage*> >& rpPageList); 92 93 /** Assign the given master page to the given page. 94 @param pMasterPage 95 In contrast to AssignMasterPageToPageList() this page is assumed 96 to be in the target document, i.e. the same document that pPage 97 is in. The caller will usually call AddMasterPage() to create a 98 clone of a master page in a another document to create it. 99 @param rsBaseLayoutName 100 The layout name of the given master page. It is given so that 101 it has not to be created on every call. It could be generated 102 from the given master page, though. 103 @param pPage 104 The page to which to assign the master page. It can be a slide 105 or a master page itself. 106 */ 107 static void AssignMasterPageToPage ( 108 SdPage* pMasterPage, 109 const String& rsBaseLayoutName, 110 SdPage* pPage); 111 }; 112 113 114 } } } // end of namespace ::sd::toolpanel::controls 115 116 #endif 117