merge the formfield patch from ooo-build
[ooovba.git] / sd / source / ui / toolpanel / controls / DocumentHelper.hxx
blob125d53094ae9e8d41087e58c557b9adc69fcd389
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: DocumentHelper.hxx,v $
10 * $Revision: 1.4 $
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_DCUMENT_HELPER_HXX
32 #define SD_TOOLPANEL_CONTROLS_DCUMENT_HELPER_HXX
34 #include <tools/solar.h>
35 #include <boost/shared_ptr.hpp>
36 #include <vector>
38 class SdDrawDocument;
39 class SdPage;
40 class String;
42 namespace sd { namespace toolpanel { namespace controls {
44 /** A collection of methods supporting the handling of master pages.
46 class DocumentHelper
48 public:
49 /** Return a copy of the given master page in the given document.
51 static SdPage* CopyMasterPageToLocalDocument (
52 SdDrawDocument& rTargetDocument,
53 SdPage* pMasterPage);
55 /** Return and, when not yet present, create a slide that uses the given
56 masster page.
58 static SdPage* GetSlideForMasterPage (SdPage* pMasterPage);
60 /** Copy the styles used by the given page from the source document to
61 the target document.
63 static void ProvideStyles (
64 SdDrawDocument& rSourceDocument,
65 SdDrawDocument& rTargetDocument,
66 SdPage* pPage);
68 /** Assign the given master page to the list of pages.
69 @param rTargetDocument
70 The document that is the owner of the pages in rPageList.
71 @param pMasterPage
72 This master page will usually be a member of the list of all
73 available master pages as provided by the MasterPageContainer.
74 @param rPageList
75 The pages to which to assign the master page. These pages may
76 be slides or master pages themselves.
78 static void AssignMasterPageToPageList (
79 SdDrawDocument& rTargetDocument,
80 SdPage* pMasterPage,
81 const ::boost::shared_ptr<std::vector<SdPage*> >& rPageList);
83 private:
84 static SdPage* AddMasterPage (
85 SdDrawDocument& rTargetDocument,
86 SdPage* pMasterPage);
87 static SdPage* AddMasterPage (
88 SdDrawDocument& rTargetDocument,
89 SdPage* pMasterPage,
90 USHORT nInsertionIndex);
91 static SdPage* ProvideMasterPage (
92 SdDrawDocument& rTargetDocument,
93 SdPage* pMasterPage,
94 const ::boost::shared_ptr<std::vector<SdPage*> >& rpPageList);
96 /** Assign the given master page to the given page.
97 @param pMasterPage
98 In contrast to AssignMasterPageToPageList() this page is assumed
99 to be in the target document, i.e. the same document that pPage
100 is in. The caller will usually call AddMasterPage() to create a
101 clone of a master page in a another document to create it.
102 @param rsBaseLayoutName
103 The layout name of the given master page. It is given so that
104 it has not to be created on every call. It could be generated
105 from the given master page, though.
106 @param pPage
107 The page to which to assign the master page. It can be a slide
108 or a master page itself.
110 static void AssignMasterPageToPage (
111 SdPage* pMasterPage,
112 const String& rsBaseLayoutName,
113 SdPage* pPage);
117 } } } // end of namespace ::sd::toolpanel::controls
119 #endif