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 <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>
38
39namespace sdr::properties
40{
42 {
43 SfxStyleSheet* pStyleSheet(GetSdrObject().getSdrModelFromSdrObject().GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj());
44
45 if(pStyleSheet)
46 {
47 // do not delete hard attributes when setting dsefault Style
48 SetStyleSheet(pStyleSheet, true, true);
49 }
50 else
51 {
52 SetMergedItem(XFillStyleItem(com::sun::star::drawing::FillStyle_NONE));
53 SetMergedItem(XLineStyleItem(com::sun::star::drawing::LineStyle_NONE));
54 }
55 }
56
57 // create a new itemset
59 {
60 return SfxItemSet(rPool,
61
62 // range from SdrAttrObj
66
67 // range from SdrGrafObj
69
72
73 // range from SdrTextObj
75 }
76
79 {
80 }
81
83 : RectangleProperties(rProps, rObj)
84 {
85 }
86
88 {
89 }
90
91 std::unique_ptr<BaseProperties> GraphicProperties::Clone(SdrObject& rObj) const
92 {
93 return std::unique_ptr<BaseProperties>(new GraphicProperties(*this, rObj));
94 }
95
97 {
98 SdrGrafObj& rObj = static_cast<SdrGrafObj&>(GetSdrObject());
99
100 // local changes
101 rObj.SetXPolyDirty();
102
103 // #i29367# Update GraphicAttr, too. This was formerly
104 // triggered by SdrGrafObj::Notify, which is no longer
105 // called nowadays. BTW: strictly speaking, the whole
106 // ImpSetAttrToGrafInfostuff could
107 // be dumped, when SdrGrafObj::aGrafInfo is removed and
108 // always created on the fly for repaint.
110
111 // call parent
112 RectangleProperties::ItemSetChanged(aChangedItems, nDeletedWhich);
113 }
114
115 void GraphicProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr,
116 bool bBroadcast)
117 {
118 // call parent (always first thing to do, may create the SfxItemSet)
119 RectangleProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr, bBroadcast);
120
121 // local changes
122 SdrGrafObj& rObj = static_cast<SdrGrafObj&>(GetSdrObject());
123 rObj.SetXPolyDirty();
124
125 // local changes
127 }
128
130 {
131 // call parent
133
134 // force ItemSet
136
137 mxItemSet->Put( SdrGrafLuminanceItem( 0 ) );
138 mxItemSet->Put( SdrGrafContrastItem( 0 ) );
139 mxItemSet->Put( SdrGrafRedItem( 0 ) );
140 mxItemSet->Put( SdrGrafGreenItem( 0 ) );
141 mxItemSet->Put( SdrGrafBlueItem( 0 ) );
142 mxItemSet->Put( SdrGrafGamma100Item( 100 ) );
143 mxItemSet->Put( SdrGrafTransparenceItem( 0 ) );
144 mxItemSet->Put( SdrGrafInvertItem( false ) );
145 mxItemSet->Put( SdrGrafModeItem( GraphicDrawMode::Standard ) );
146 mxItemSet->Put( SdrGrafCropItem( 0, 0, 0, 0 ) );
147 }
148} // end of namespace
149
150/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This class represents an embedded or linked bitmap graphic object.
Definition: svdograf.hxx:68
void ImpSetAttrToGrafInfo()
Definition: svdograf.cxx:1044
Abstract DrawObject.
Definition: svdobj.hxx:261
void SetXPolyDirty()
Definition: svdorect.cxx:101
virtual const SfxItemSet & GetObjectItemSet() const override
const SdrObject & GetSdrObject() const
Definition: properties.cxx:43
virtual void SetMergedItem(const SfxPoolItem &rItem)
Definition: properties.cxx:71
std::optional< SfxItemSet > mxItemSet
virtual void ForceDefaultAttributes() override
virtual void applyDefaultStyleSheetFromSdrModel() override
virtual SfxItemSet CreateObjectSpecificItemSet(SfxItemPool &rPool) override
virtual void SetStyleSheet(SfxStyleSheet *pNewStyleSheet, bool bDontRemoveHardAttr, bool bBroadcast) override
virtual void ItemSetChanged(o3tl::span< const SfxPoolItem *const > aChangedItems, sal_uInt16 nDeletedWhich) override
virtual std::unique_ptr< BaseProperties > Clone(SdrObject &rObj) const override
virtual void SetStyleSheet(SfxStyleSheet *pNewStyleSheet, bool bDontRemoveHardAttr, bool bBroadcast) override
virtual void ItemSetChanged(o3tl::span< const SfxPoolItem *const > aChangedItems, sal_uInt16 nDeletedWhich) override
virtual void ForceDefaultAttributes() override
constexpr sal_uInt16 EE_ITEMS_END(EE_FEATURE_END)
constexpr sal_uInt16 EE_ITEMS_START(OWN_ATTR_VALUE_END+1)
static constexpr auto Items
constexpr sal_uInt16 SDRATTR_START(XATTR_START)
constexpr sal_uInt16 SDRATTR_TEXTCOLUMNS_FIRST(SDRATTR_SOFTEDGE_LAST+1)
constexpr sal_uInt16 SDRATTR_GLOW_FIRST(SDRATTR_TABLE_LAST+1)
constexpr sal_uInt16 SDRATTR_GRAF_LAST(SDRATTR_GRAFCROP)
constexpr sal_uInt16 SDRATTR_SOFTEDGE_LAST(SDRATTR_SOFTEDGE_RADIUS)
constexpr sal_uInt16 SDRATTR_MISC_FIRST(SDRATTR_CAPTION_LAST+1)
constexpr sal_uInt16 SDRATTR_SHADOW_LAST(SDRATTR_SHADOWBLUR)
constexpr sal_uInt16 SDRATTR_MISC_LAST(SDRATTR_TEXT_CHAINNEXTNAME)
constexpr sal_uInt16 SDRATTR_TEXTCOLUMNS_LAST(SDRATTR_TEXTCOLUMNS_SPACING)
constexpr sal_uInt16 SDRATTR_GRAF_FIRST(SDRATTR_NOTPERSIST_LAST+1)
constexpr TypedWhichId< SvxWritingModeItem > SDRATTR_TEXTDIRECTION(SDRATTR_NOTPERSIST_FIRST+34)