Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sd / source / ui / sidebar / DocumentHelper.hxx
blob0d935b9e5edf0a17c80aa95bee726f493f8a735d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SD_SOURCE_UI_SIDEBAR_DOCUMENTHELPER_HXX
21 #define INCLUDED_SD_SOURCE_UI_SIDEBAR_DOCUMENTHELPER_HXX
23 #include <rtl/ustring.hxx>
24 #include <memory>
25 #include <vector>
27 class SdDrawDocument;
28 class SdPage;
30 namespace sd { namespace sidebar {
32 /** A collection of methods supporting the handling of master pages.
34 class DocumentHelper
36 public:
37 /** Return a copy of the given master page in the given document.
39 static SdPage* CopyMasterPageToLocalDocument (
40 SdDrawDocument& rTargetDocument,
41 SdPage* pMasterPage);
43 /** Return and, when not yet present, create a slide that uses the given
44 master page.
46 static SdPage* GetSlideForMasterPage (SdPage const * pMasterPage);
48 /** Copy the styles used by the given page from the source document to
49 the target document.
51 static void ProvideStyles (
52 SdDrawDocument const & rSourceDocument,
53 SdDrawDocument& rTargetDocument,
54 SdPage const * pPage);
56 /** Assign the given master page to the list of pages.
57 @param rTargetDocument
58 The document that is the owner of the pages in rPageList.
59 @param pMasterPage
60 This master page will usually be a member of the list of all
61 available master pages as provided by the MasterPageContainer.
62 @param rPageList
63 The pages to which to assign the master page. These pages may
64 be slides or master pages themselves.
66 static void AssignMasterPageToPageList (
67 SdDrawDocument& rTargetDocument,
68 SdPage* pMasterPage,
69 const std::shared_ptr<std::vector<SdPage*> >& rPageList);
71 private:
72 static SdPage* AddMasterPage (
73 SdDrawDocument& rTargetDocument,
74 SdPage const * pMasterPage);
75 static SdPage* AddMasterPage (
76 SdDrawDocument& rTargetDocument,
77 SdPage const * pMasterPage,
78 sal_uInt16 nInsertionIndex);
79 static SdPage* ProvideMasterPage (
80 SdDrawDocument& rTargetDocument,
81 SdPage* pMasterPage,
82 const std::shared_ptr<std::vector<SdPage*> >& rpPageList);
84 /** Assign the given master page to the given page.
85 @param pMasterPage
86 In contrast to AssignMasterPageToPageList() this page is assumed
87 to be in the target document, i.e. the same document that pPage
88 is in. The caller will usually call AddMasterPage() to create a
89 clone of a master page in a another document to create it.
90 @param rsBaseLayoutName
91 The layout name of the given master page. It is given so that
92 it has not to be created on every call. It could be generated
93 from the given master page, though.
94 @param pPage
95 The page to which to assign the master page. It can be a slide
96 or a master page itself.
98 static void AssignMasterPageToPage (
99 SdPage const * pMasterPage,
100 const OUString& rsBaseLayoutName,
101 SdPage* pPage);
104 } } // end of namespace sd::sidebar
106 #endif
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */