LibreOffice Module svx (master)  1
graphicproperties.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 <svl/style.hxx>
25 #include <svx/svddef.hxx>
26 #include <editeng/eeitem.hxx>
27 #include <svx/svdograf.hxx>
28 #include <svx/sdgcpitm.hxx>
29 #include <svx/svdmodel.hxx>
30 #include <svx/sdgluitm.hxx>
31 #include <svx/sdgcoitm.hxx>
32 #include <svx/sdggaitm.hxx>
33 #include <svx/sdgtritm.hxx>
34 #include <svx/sdginitm.hxx>
35 #include <svx/sdgmoitm.hxx>
36 #include <svx/xfillit0.hxx>
37 #include <svx/xlineit0.hxx>
38 
39 namespace sdr
40 {
41  namespace properties
42  {
44  {
45  SfxStyleSheet* pStyleSheet(GetSdrObject().getSdrModelFromSdrObject().GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj());
46 
47  if(pStyleSheet)
48  {
49  // do not delete hard attributes when setting dsefault Style
50  SetStyleSheet(pStyleSheet, true);
51  }
52  else
53  {
54  SetMergedItem(XFillStyleItem(com::sun::star::drawing::FillStyle_NONE));
55  SetMergedItem(XLineStyleItem(com::sun::star::drawing::LineStyle_NONE));
56  }
57  }
58 
59  // create a new itemset
60  std::unique_ptr<SfxItemSet> GraphicProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
61  {
62  return std::make_unique<SfxItemSet>(rPool,
63 
64  // range from SdrAttrObj
68 
69  // range from SdrGrafObj
71 
72  // range from SdrTextObj
74  }
75 
77  : RectangleProperties(rObj)
78  {
79  }
80 
82  : RectangleProperties(rProps, rObj)
83  {
84  }
85 
87  {
88  }
89 
90  std::unique_ptr<BaseProperties> GraphicProperties::Clone(SdrObject& rObj) const
91  {
92  return std::unique_ptr<BaseProperties>(new GraphicProperties(*this, rObj));
93  }
94 
96  {
97  SdrGrafObj& rObj = static_cast<SdrGrafObj&>(GetSdrObject());
98 
99  // local changes
100  rObj.SetXPolyDirty();
101 
102  // #i29367# Update GraphicAttr, too. This was formerly
103  // triggered by SdrGrafObj::Notify, which is no longer
104  // called nowadays. BTW: strictly speaking, the whole
105  // ImpSetAttrToGrafInfostuff could
106  // be dumped, when SdrGrafObj::aGrafInfo is removed and
107  // always created on the fly for repaint.
108  rObj.ImpSetAttrToGrafInfo();
109 
110  // call parent
112  }
113 
114  void GraphicProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr)
115  {
116  // call parent (always first thing to do, may create the SfxItemSet)
117  RectangleProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
118 
119  // local changes
120  SdrGrafObj& rObj = static_cast<SdrGrafObj&>(GetSdrObject());
121  rObj.SetXPolyDirty();
122 
123  // local changes
124  rObj.ImpSetAttrToGrafInfo();
125  }
126 
128  {
129  // call parent
131 
132  // force ItemSet
134 
135  mpItemSet->Put( SdrGrafLuminanceItem( 0 ) );
136  mpItemSet->Put( SdrGrafContrastItem( 0 ) );
137  mpItemSet->Put( SdrGrafRedItem( 0 ) );
138  mpItemSet->Put( SdrGrafGreenItem( 0 ) );
139  mpItemSet->Put( SdrGrafBlueItem( 0 ) );
140  mpItemSet->Put( SdrGrafGamma100Item( 100 ) );
141  mpItemSet->Put( SdrGrafTransparenceItem( 0 ) );
142  mpItemSet->Put( SdrGrafInvertItem( false ) );
143  mpItemSet->Put( SdrGrafModeItem( GraphicDrawMode::Standard ) );
144  mpItemSet->Put( SdrGrafCropItem( 0, 0, 0, 0 ) );
145  }
146  } // end of namespace properties
147 } // end of namespace sdr
148 
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define EE_ITEMS_START
virtual void applyDefaultStyleSheetFromSdrModel() override
virtual std::unique_ptr< BaseProperties > Clone(SdrObject &rObj) const override
virtual const SfxItemSet & GetObjectItemSet() const override
#define SDRATTR_MISC_LAST
Definition: svddef.hxx:220
std::unique_ptr< SfxItemSet > mpItemSet
virtual void ForceDefaultAttributes() override
#define SDRATTR_SHADOW_LAST
Definition: svddef.hxx:178
virtual void ItemSetChanged(const SfxItemSet &rSet) override
#define SDRATTR_MISC_FIRST
Definition: svddef.hxx:193
void SetXPolyDirty()
Definition: svdorect.cxx:106
#define SDRATTR_TEXTDIRECTION
Definition: svddef.hxx:302
virtual std::unique_ptr< SfxItemSet > CreateObjectSpecificItemSet(SfxItemPool &rPool) override
#define SDRATTR_START
Definition: svddef.hxx:168
#define SDRATTR_GRAF_FIRST
Definition: svddef.hxx:307
This class represents an embedded or linked bitmap graphic object.
Definition: svdograf.hxx:79
Abstract DrawObject.
Definition: svdobj.hxx:312
virtual void SetStyleSheet(SfxStyleSheet *pNewStyleSheet, bool bDontRemoveHardAttr) override
virtual void ItemSetChanged(const SfxItemSet &rSet) override
#define SDRATTR_GRAF_LAST
Definition: svddef.hxx:318
virtual void SetMergedItem(const SfxPoolItem &rItem)
Definition: properties.cxx:90
const SdrObject & GetSdrObject() const
Definition: properties.cxx:62
void ImpSetAttrToGrafInfo()
Definition: svdograf.cxx:1059
virtual void ForceDefaultAttributes() override
virtual void SetStyleSheet(SfxStyleSheet *pNewStyleSheet, bool bDontRemoveHardAttr) override
#define EE_ITEMS_END