Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / svx / source / svdraw / sdrmasterpagedescriptor.cxx
blob1d084391896a3f92b33493856cfc2da0f4de5555
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 #include <svx/sdrmasterpagedescriptor.hxx>
21 #include <sdr/contact/viewcontactofmasterpagedescriptor.hxx>
22 #include <svx/svdpage.hxx>
23 #include <svx/xdef.hxx>
24 #include <svx/xfillit0.hxx>
25 #include <svl/itemset.hxx>
27 using namespace com::sun::star;
29 namespace sdr
31 MasterPageDescriptor::MasterPageDescriptor(SdrPage& aOwnerPage, SdrPage& aUsedPage)
32 : maOwnerPage(aOwnerPage),
33 maUsedPage(aUsedPage)
35 // all layers visible
36 maVisibleLayers.SetAll();
38 // register at used page
39 maUsedPage.AddPageUser(*this);
42 MasterPageDescriptor::~MasterPageDescriptor()
44 // de-register at used page
45 maUsedPage.RemovePageUser(*this);
47 mpViewContact.reset();
50 // ViewContact part
51 sdr::contact::ViewContact& MasterPageDescriptor::GetViewContact() const
53 if(!mpViewContact)
55 mpViewContact.reset(
56 new sdr::contact::ViewContactOfMasterPageDescriptor(*const_cast< MasterPageDescriptor* >(this)) );
59 return *mpViewContact;
62 // this method is called from the destructor of the referenced page.
63 // do all necessary action to forget the page. It is not necessary to call
64 // RemovePageUser(), that is done from the destructor.
65 void MasterPageDescriptor::PageInDestruction(const SdrPage& /*rPage*/)
67 maOwnerPage.TRG_ClearMasterPage();
70 void MasterPageDescriptor::SetVisibleLayers(const SdrLayerIDSet& rNew)
72 if(rNew != maVisibleLayers)
74 maVisibleLayers = rNew;
75 GetViewContact().ActionChanged();
80 const SdrPageProperties* MasterPageDescriptor::getCorrectSdrPageProperties() const
82 const SdrPage* pCorrectPage = &GetOwnerPage();
83 const SdrPageProperties* pCorrectProperties = &pCorrectPage->getSdrPageProperties();
85 if(drawing::FillStyle_NONE == pCorrectProperties->GetItemSet().Get(XATTR_FILLSTYLE).GetValue())
87 pCorrectPage = &GetUsedPage();
88 pCorrectProperties = &pCorrectPage->getSdrPageProperties();
91 if(pCorrectPage->IsMasterPage() && !pCorrectProperties->GetStyleSheet())
93 // #i110846# Suppress SdrPage FillStyle for MasterPages without StyleSheets,
94 // else the PoolDefault (XFILL_COLOR and Blue8) will be used. Normally, all
95 // MasterPages should have a StyleSheet exactly for this reason, but historically
96 // e.g. the Notes MasterPage has no StyleSheet set (and there maybe others).
97 pCorrectProperties = nullptr;
100 return pCorrectProperties;
102 } // end of namespace sdr
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */