LibreOffice Module svx (master)  1
sdrmasterpagedescriptor.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
22 #include <svx/svdpage.hxx>
23 #include <svx/xdef.hxx>
24 #include <svx/xfillit0.hxx>
25 #include <svl/itemset.hxx>
26 
27 using namespace com::sun::star;
28 
29 namespace sdr
30 {
31  MasterPageDescriptor::MasterPageDescriptor(SdrPage& aOwnerPage, SdrPage& aUsedPage)
32  : maOwnerPage(aOwnerPage),
33  maUsedPage(aUsedPage)
34  {
35  // all layers visible
37 
38  // register at used page
39  maUsedPage.AddPageUser(*this);
40  }
41 
43  {
44  // de-register at used page
46 
47  mpViewContact.reset();
48  }
49 
50  // ViewContact part
52  {
53  if(!mpViewContact)
54  {
55  mpViewContact.reset(
56  new sdr::contact::ViewContactOfMasterPageDescriptor(*const_cast< MasterPageDescriptor* >(this)) );
57  }
58 
59  return *mpViewContact;
60  }
61 
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.
66  {
68  }
69 
71  {
72  if(rNew != maVisibleLayers)
73  {
74  maVisibleLayers = rNew;
76  }
77  }
78 
79 
81  {
82  const SdrPage* pCorrectPage = &GetOwnerPage();
83  const SdrPageProperties* pCorrectProperties = &pCorrectPage->getSdrPageProperties();
84 
85  if(drawing::FillStyle_NONE == pCorrectProperties->GetItemSet().Get(XATTR_FILLSTYLE).GetValue())
86  {
87  pCorrectPage = &GetUsedPage();
88  pCorrectProperties = &pCorrectPage->getSdrPageProperties();
89  }
90 
91  if(pCorrectPage->IsMasterPage() && !pCorrectProperties->GetStyleSheet())
92  {
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;
98  }
99 
100  return pCorrectProperties;
101  }
102 } // end of namespace sdr
103 
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void AddPageUser(sdr::PageUser &rNewUser)
Definition: svdpage.cxx:1078
void SetAll()
Definition: svdsob.hxx:71
constexpr TypedWhichId< XFillStyleItem > XATTR_FILLSTYLE(XATTR_FILL_FIRST)
void TRG_ClearMasterPage()
Definition: svdpage.cxx:1543
sdr::contact::ViewContact & GetViewContact() const
void SetVisibleLayers(const SdrLayerIDSet &rNew)
void RemovePageUser(sdr::PageUser &rOldUser)
Definition: svdpage.cxx:1083
const SdrPageProperties * getCorrectSdrPageProperties() const
bool IsMasterPage() const
Definition: svdpage.hxx:450
const SfxItemSet & GetItemSet() const
Definition: svdpage.hxx:334
SdrPageProperties & getSdrPageProperties()
Definition: svdpage.cxx:1755
virtual void PageInDestruction(const SdrPage &rPage) override
virtual void ActionChanged()
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
SfxStyleSheet * GetStyleSheet() const
Definition: svdpage.hxx:341
std::unique_ptr< sdr::contact::ViewContact > mpViewContact
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:365