xref: /trunk/main/sd/source/ui/sidebar/DocumentHelper.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
102c50d82SAndre Fischer /**************************************************************
202c50d82SAndre Fischer  *
302c50d82SAndre Fischer  * Licensed to the Apache Software Foundation (ASF) under one
402c50d82SAndre Fischer  * or more contributor license agreements.  See the NOTICE file
502c50d82SAndre Fischer  * distributed with this work for additional information
602c50d82SAndre Fischer  * regarding copyright ownership.  The ASF licenses this file
702c50d82SAndre Fischer  * to you under the Apache License, Version 2.0 (the
802c50d82SAndre Fischer  * "License"); you may not use this file except in compliance
902c50d82SAndre Fischer  * with the License.  You may obtain a copy of the License at
1002c50d82SAndre Fischer  *
1102c50d82SAndre Fischer  *   http://www.apache.org/licenses/LICENSE-2.0
1202c50d82SAndre Fischer  *
1302c50d82SAndre Fischer  * Unless required by applicable law or agreed to in writing,
1402c50d82SAndre Fischer  * software distributed under the License is distributed on an
1502c50d82SAndre Fischer  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1602c50d82SAndre Fischer  * KIND, either express or implied.  See the License for the
1702c50d82SAndre Fischer  * specific language governing permissions and limitations
1802c50d82SAndre Fischer  * under the License.
1902c50d82SAndre Fischer  *
2002c50d82SAndre Fischer  *************************************************************/
2102c50d82SAndre Fischer 
2202c50d82SAndre Fischer #ifndef SD_SIDEBAR_PANELS_DCUMENT_HELPER_HXX
2302c50d82SAndre Fischer #define SD_SIDEBAR_PANELS_DCUMENT_HELPER_HXX
2402c50d82SAndre Fischer 
2502c50d82SAndre Fischer #include <tools/solar.h>
2602c50d82SAndre Fischer #include <boost/shared_ptr.hpp>
2702c50d82SAndre Fischer #include <vector>
2802c50d82SAndre Fischer 
2902c50d82SAndre Fischer class SdDrawDocument;
3002c50d82SAndre Fischer class SdPage;
3102c50d82SAndre Fischer class String;
3202c50d82SAndre Fischer 
3302c50d82SAndre Fischer namespace sd { namespace sidebar {
3402c50d82SAndre Fischer 
3502c50d82SAndre Fischer /** A collection of methods supporting the handling of master pages.
3602c50d82SAndre Fischer */
3702c50d82SAndre Fischer class DocumentHelper
3802c50d82SAndre Fischer {
3902c50d82SAndre Fischer public:
4002c50d82SAndre Fischer     /** Return a copy of the given master page in the given document.
4102c50d82SAndre Fischer     */
4202c50d82SAndre Fischer     static SdPage* CopyMasterPageToLocalDocument (
4302c50d82SAndre Fischer         SdDrawDocument& rTargetDocument,
4402c50d82SAndre Fischer         SdPage* pMasterPage);
4502c50d82SAndre Fischer 
4602c50d82SAndre Fischer     /** Return and, when not yet present, create a slide that uses the given
47*ad1df53dSJohn Bampton         master page.
4802c50d82SAndre Fischer     */
4902c50d82SAndre Fischer     static SdPage* GetSlideForMasterPage (SdPage* pMasterPage);
5002c50d82SAndre Fischer 
5102c50d82SAndre Fischer     /** Copy the styles used by the given page from the source document to
5202c50d82SAndre Fischer         the target document.
5302c50d82SAndre Fischer     */
5402c50d82SAndre Fischer     static void ProvideStyles (
5502c50d82SAndre Fischer         SdDrawDocument& rSourceDocument,
5602c50d82SAndre Fischer         SdDrawDocument& rTargetDocument,
5702c50d82SAndre Fischer         SdPage* pPage);
5802c50d82SAndre Fischer 
5902c50d82SAndre Fischer     /** Assign the given master page to the list of pages.
6002c50d82SAndre Fischer         @param rTargetDocument
6102c50d82SAndre Fischer             The document that is the owner of the pages in rPageList.
6202c50d82SAndre Fischer         @param pMasterPage
6302c50d82SAndre Fischer             This master page will usually be a member of the list of all
6402c50d82SAndre Fischer             available master pages as provided by the MasterPageContainer.
6502c50d82SAndre Fischer         @param rPageList
6602c50d82SAndre Fischer             The pages to which to assign the master page.  These pages may
6702c50d82SAndre Fischer             be slides or master pages themselves.
6802c50d82SAndre Fischer     */
6902c50d82SAndre Fischer     static void AssignMasterPageToPageList (
7002c50d82SAndre Fischer         SdDrawDocument& rTargetDocument,
7102c50d82SAndre Fischer         SdPage* pMasterPage,
7202c50d82SAndre Fischer         const ::boost::shared_ptr<std::vector<SdPage*> >& rPageList);
7302c50d82SAndre Fischer 
7402c50d82SAndre Fischer private:
7502c50d82SAndre Fischer     static SdPage* AddMasterPage (
7602c50d82SAndre Fischer         SdDrawDocument& rTargetDocument,
7702c50d82SAndre Fischer         SdPage* pMasterPage);
7802c50d82SAndre Fischer     static SdPage* AddMasterPage (
7902c50d82SAndre Fischer         SdDrawDocument& rTargetDocument,
8002c50d82SAndre Fischer         SdPage* pMasterPage,
8102c50d82SAndre Fischer         sal_uInt16 nInsertionIndex);
8202c50d82SAndre Fischer     static SdPage* ProvideMasterPage (
8302c50d82SAndre Fischer         SdDrawDocument& rTargetDocument,
8402c50d82SAndre Fischer         SdPage* pMasterPage,
8502c50d82SAndre Fischer         const ::boost::shared_ptr<std::vector<SdPage*> >& rpPageList);
8602c50d82SAndre Fischer 
8702c50d82SAndre Fischer     /** Assign the given master page to the given page.
8802c50d82SAndre Fischer         @param pMasterPage
8902c50d82SAndre Fischer             In contrast to AssignMasterPageToPageList() this page is assumed
9002c50d82SAndre Fischer             to be in the target document, i.e. the same document that pPage
9102c50d82SAndre Fischer             is in.  The caller will usually call AddMasterPage() to create a
9202c50d82SAndre Fischer             clone of a master page in a another document to create it.
9302c50d82SAndre Fischer         @param rsBaseLayoutName
9402c50d82SAndre Fischer             The layout name of the given master page.  It is given so that
9502c50d82SAndre Fischer             it has not to be created on every call.  It could be generated
9602c50d82SAndre Fischer             from the given master page, though.
9702c50d82SAndre Fischer         @param pPage
9802c50d82SAndre Fischer             The page to which to assign the master page.  It can be a slide
9902c50d82SAndre Fischer             or a master page itself.
10002c50d82SAndre Fischer     */
10102c50d82SAndre Fischer     static void AssignMasterPageToPage (
10202c50d82SAndre Fischer         SdPage* pMasterPage,
10302c50d82SAndre Fischer         const String& rsBaseLayoutName,
10402c50d82SAndre Fischer         SdPage* pPage);
10502c50d82SAndre Fischer };
10602c50d82SAndre Fischer 
10702c50d82SAndre Fischer 
10802c50d82SAndre Fischer } } // end of namespace sd::sidebar
10902c50d82SAndre Fischer 
11002c50d82SAndre Fischer #endif
111