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