Bump version to 6.4-15
[LibreOffice.git] / svx / source / sdr / properties / graphicproperties.cxx
bloba558a83428b625aab887aca6d1b48c5fb3d454ed
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 <sal/config.h>
22 #include <sdr/properties/graphicproperties.hxx>
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>
39 namespace sdr
41 namespace properties
43 void GraphicProperties::applyDefaultStyleSheetFromSdrModel()
45 SfxStyleSheet* pStyleSheet(GetSdrObject().getSdrModelFromSdrObject().GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj());
47 if(pStyleSheet)
49 // do not delete hard attributes when setting dsefault Style
50 SetStyleSheet(pStyleSheet, true);
52 else
54 SetMergedItem(XFillStyleItem(com::sun::star::drawing::FillStyle_NONE));
55 SetMergedItem(XLineStyleItem(com::sun::star::drawing::LineStyle_NONE));
59 // create a new itemset
60 std::unique_ptr<SfxItemSet> GraphicProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
62 return std::make_unique<SfxItemSet>(rPool,
64 // range from SdrAttrObj
65 svl::Items<SDRATTR_START, SDRATTR_SHADOW_LAST,
66 SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
67 SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
69 // range from SdrGrafObj
70 SDRATTR_GRAF_FIRST, SDRATTR_GRAF_LAST,
72 // range from SdrTextObj
73 EE_ITEMS_START, EE_ITEMS_END>{});
76 GraphicProperties::GraphicProperties(SdrObject& rObj)
77 : RectangleProperties(rObj)
81 GraphicProperties::GraphicProperties(const GraphicProperties& rProps, SdrObject& rObj)
82 : RectangleProperties(rProps, rObj)
86 GraphicProperties::~GraphicProperties()
90 std::unique_ptr<BaseProperties> GraphicProperties::Clone(SdrObject& rObj) const
92 return std::unique_ptr<BaseProperties>(new GraphicProperties(*this, rObj));
95 void GraphicProperties::ItemSetChanged(const SfxItemSet& rSet)
97 SdrGrafObj& rObj = static_cast<SdrGrafObj&>(GetSdrObject());
99 // local changes
100 rObj.SetXPolyDirty();
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();
110 // call parent
111 RectangleProperties::ItemSetChanged(rSet);
114 void GraphicProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr)
116 // call parent (always first thing to do, may create the SfxItemSet)
117 RectangleProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
119 // local changes
120 SdrGrafObj& rObj = static_cast<SdrGrafObj&>(GetSdrObject());
121 rObj.SetXPolyDirty();
123 // local changes
124 rObj.ImpSetAttrToGrafInfo();
127 void GraphicProperties::ForceDefaultAttributes()
129 // call parent
130 RectangleProperties::ForceDefaultAttributes();
132 // force ItemSet
133 GetObjectItemSet();
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 ) );
146 } // end of namespace properties
147 } // end of namespace sdr
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */