LibreOffice Module svx (master)  1
pageproperties.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 
20 #include <sal/config.h>
21 
23 #include <svl/itemset.hxx>
24 #include <svx/svdobj.hxx>
25 #include <svx/xdef.hxx>
26 #include <tools/debug.hxx>
27 
28 
29 namespace sdr::properties
30 {
31  // create a new itemset
32  std::unique_ptr<SfxItemSet> PageProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
33  {
34  // override to legally return a valid ItemSet
35  return std::make_unique<SfxItemSet>(rPool);
36  }
37 
39  : EmptyProperties(rObj)
40  {
41  }
42 
44  : EmptyProperties(rObj)
45  {
46  }
47 
49  {
50  }
51 
52  std::unique_ptr<BaseProperties> PageProperties::Clone(SdrObject& rObj) const
53  {
54  return std::unique_ptr<BaseProperties>(new PageProperties(*this, rObj));
55  }
56 
57  // get itemset. Override here to allow creating the empty itemset
58  // without asserting
60  {
61  if(!mpEmptyItemSet)
62  {
63  const_cast<PageProperties*>(this)->mpEmptyItemSet = const_cast<PageProperties*>(this)->CreateObjectSpecificItemSet(GetSdrObject().GetObjectItemPool());
64  }
65 
66  DBG_ASSERT(mpEmptyItemSet, "Could not create an SfxItemSet(!)");
67 
68  return *mpEmptyItemSet;
69  }
70 
71  void PageProperties::ItemChange(const sal_uInt16 /*nWhich*/, const SfxPoolItem* /*pNewItem*/)
72  {
73  // #86481# simply ignore item setting on page objects
74  }
75 
77  {
78  // override to legally return a 0L pointer here
79  return nullptr;
80  }
81 
82  void PageProperties::SetStyleSheet(SfxStyleSheet* /*pStyleSheet*/, bool /*bDontRemoveHardAttr*/)
83  {
84  // override to legally ignore the StyleSheet here
85  }
86 
87  void PageProperties::PostItemChange(const sal_uInt16 nWhich )
88  {
89  if( (nWhich == XATTR_FILLSTYLE) && (mpEmptyItemSet != nullptr) )
91  }
92 
93  void PageProperties::ClearObjectItem(const sal_uInt16 /*nWhich*/)
94  {
95  // simply ignore item clearing on page objects
96  }
97 } // end of namespace
98 
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual std::unique_ptr< SfxItemSet > CreateObjectSpecificItemSet(SfxItemPool &pPool) override
virtual void SetStyleSheet(SfxStyleSheet *pStyleSheet, bool bDontRemoveHardAttr) override
virtual void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem *pNewItem=nullptr) override
constexpr TypedWhichId< XFillStyleItem > XATTR_FILLSTYLE(XATTR_FILL_FIRST)
virtual const SfxItemSet & GetObjectItemSet() const override
virtual void PostItemChange(const sal_uInt16 nWhich) override
virtual SfxStyleSheet * GetStyleSheet() const override
std::unique_ptr< SfxItemSet > mpEmptyItemSet
#define DBG_ASSERT(sCon, aError)
void CleanupFillProperties(SfxItemSet &rItemSet)
Definition: properties.cxx:162
virtual ~PageProperties() override
Abstract DrawObject.
Definition: svdobj.hxx:312
virtual std::unique_ptr< BaseProperties > Clone(SdrObject &rObj) const override
virtual void ClearObjectItem(const sal_uInt16 nWhich=0) override
const SdrObject & GetSdrObject() const
Definition: properties.cxx:59