tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / svx / source / sdr / properties / graphicproperties.cxx
blob71adb3e258cecc2cc5821447885074ea9cc97662
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 <sdgcoitm.hxx>
32 #include <svx/sdggaitm.hxx>
33 #include <sdgtritm.hxx>
34 #include <sdginitm.hxx>
35 #include <svx/sdgmoitm.hxx>
36 #include <svx/xfillit0.hxx>
37 #include <svx/xlineit0.hxx>
39 namespace sdr::properties
41 void GraphicProperties::applyDefaultStyleSheetFromSdrModel()
43 SfxStyleSheet* pStyleSheet(GetSdrObject().getSdrModelFromSdrObject().GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj());
45 if(pStyleSheet)
47 // do not delete hard attributes when setting dsefault Style
48 SetStyleSheet(pStyleSheet, true, true);
50 else
52 RectangleProperties::applyDefaultStyleSheetFromSdrModel();
53 SetMergedItem(XFillStyleItem(css::drawing::FillStyle_NONE));
54 SetMergedItem(XLineStyleItem(css::drawing::LineStyle_NONE));
58 // create a new itemset
59 SfxItemSet GraphicProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
61 return SfxItemSet(rPool,
63 // range from SdrAttrObj
64 svl::Items<SDRATTR_START, SDRATTR_SHADOW_LAST,
65 SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
66 SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
68 // range from SdrGrafObj
69 SDRATTR_GRAF_FIRST, SDRATTR_GRAF_LAST,
71 SDRATTR_GLOW_FIRST, SDRATTR_SOFTEDGE_LAST,
72 SDRATTR_TEXTCOLUMNS_FIRST, SDRATTR_TEXTCOLUMNS_LAST,
74 // range from SdrTextObj
75 EE_ITEMS_START, EE_ITEMS_END>);
78 GraphicProperties::GraphicProperties(SdrObject& rObj)
79 : RectangleProperties(rObj)
83 GraphicProperties::GraphicProperties(const GraphicProperties& rProps, SdrObject& rObj)
84 : RectangleProperties(rProps, rObj)
88 GraphicProperties::~GraphicProperties()
92 std::unique_ptr<BaseProperties> GraphicProperties::Clone(SdrObject& rObj) const
94 return std::unique_ptr<BaseProperties>(new GraphicProperties(*this, rObj));
97 void GraphicProperties::ItemSetChanged(std::span< const SfxPoolItem* const > aChangedItems, sal_uInt16 nDeletedWhich, bool bAdjustTextFrameWidthAndHeight)
99 SdrGrafObj& rObj = static_cast<SdrGrafObj&>(GetSdrObject());
101 // local changes
102 rObj.SetXPolyDirty();
104 // call parent
105 RectangleProperties::ItemSetChanged(aChangedItems, nDeletedWhich, bAdjustTextFrameWidthAndHeight);
108 void GraphicProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr,
109 bool bBroadcast, bool bAdjustTextFrameWidthAndHeight)
111 // call parent (always first thing to do, may create the SfxItemSet)
112 RectangleProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr, bBroadcast, bAdjustTextFrameWidthAndHeight);
114 // local changes
115 SdrGrafObj& rObj = static_cast<SdrGrafObj&>(GetSdrObject());
116 rObj.SetXPolyDirty();
119 void GraphicProperties::ForceDefaultAttributes()
121 // call parent
122 RectangleProperties::ForceDefaultAttributes();
124 moItemSet->Put( SdrGrafLuminanceItem( 0 ) );
125 moItemSet->Put( SdrGrafContrastItem( 0 ) );
126 moItemSet->Put( SdrGrafRedItem( 0 ) );
127 moItemSet->Put( SdrGrafGreenItem( 0 ) );
128 moItemSet->Put( SdrGrafBlueItem( 0 ) );
129 moItemSet->Put( SdrGrafGamma100Item( 100 ) );
130 moItemSet->Put( SdrGrafTransparenceItem( 0 ) );
131 moItemSet->Put( SdrGrafInvertItem( false ) );
132 moItemSet->Put( SdrGrafModeItem( GraphicDrawMode::Standard ) );
133 moItemSet->Put( SdrGrafCropItem( 0, 0, 0, 0 ) );
135 } // end of namespace
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */