Branch data Line data Source code
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 <svx/sdr/properties/graphicproperties.hxx>
21 : : #include <svl/itemset.hxx>
22 : : #include <svl/style.hxx>
23 : : #include <svx/svddef.hxx>
24 : : #include <editeng/eeitem.hxx>
25 : : #include <svx/svdograf.hxx>
26 : : #include <svx/sdgcpitm.hxx>
27 : :
28 : : //////////////////////////////////////////////////////////////////////////////
29 : :
30 : : namespace sdr
31 : : {
32 : : namespace properties
33 : : {
34 : : // create a new itemset
35 : 115 : SfxItemSet& GraphicProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
36 : : {
37 : : return *(new SfxItemSet(rPool,
38 : :
39 : : // range from SdrAttrObj
40 : : SDRATTR_START, SDRATTR_SHADOW_LAST,
41 : : SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
42 : : SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
43 : :
44 : : // range from SdrGrafObj
45 : : SDRATTR_GRAF_FIRST, SDRATTR_GRAF_LAST,
46 : :
47 : : // range from SdrTextObj
48 : : EE_ITEMS_START, EE_ITEMS_END,
49 : :
50 : : // end
51 [ + - ]: 115 : 0, 0));
52 : : }
53 : :
54 : 115 : GraphicProperties::GraphicProperties(SdrObject& rObj)
55 : 115 : : RectangleProperties(rObj)
56 : : {
57 : 115 : }
58 : :
59 : 3 : GraphicProperties::GraphicProperties(const GraphicProperties& rProps, SdrObject& rObj)
60 : 3 : : RectangleProperties(rProps, rObj)
61 : : {
62 : 3 : }
63 : :
64 : 112 : GraphicProperties::~GraphicProperties()
65 : : {
66 [ - + ]: 224 : }
67 : :
68 : 3 : BaseProperties& GraphicProperties::Clone(SdrObject& rObj) const
69 : : {
70 [ + - ]: 3 : return *(new GraphicProperties(*this, rObj));
71 : : }
72 : :
73 : 136 : void GraphicProperties::ItemSetChanged(const SfxItemSet& rSet)
74 : : {
75 : 136 : SdrGrafObj& rObj = (SdrGrafObj&)GetSdrObject();
76 : :
77 : : // local changes
78 : 136 : rObj.SetXPolyDirty();
79 : :
80 : : // #i29367# Update GraphicAttr, too. This was formerly
81 : : // triggered by SdrGrafObj::Notify, which is no longer
82 : : // called nowadays. BTW: strictly speaking, the whole
83 : : // ImpSetAttrToGrafInfostuff could
84 : : // be dumped, when SdrGrafObj::aGrafInfo is removed and
85 : : // always created on the fly for repaint.
86 : 136 : rObj.ImpSetAttrToGrafInfo();
87 : :
88 : : // call parent
89 : 136 : RectangleProperties::ItemSetChanged(rSet);
90 : 136 : }
91 : :
92 : 118 : void GraphicProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
93 : : {
94 : 118 : SdrGrafObj& rObj = (SdrGrafObj&)GetSdrObject();
95 : :
96 : : // local changes
97 : 118 : rObj.SetXPolyDirty();
98 : :
99 : : // call parent
100 : 118 : RectangleProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
101 : :
102 : : // local changes
103 : 118 : rObj.ImpSetAttrToGrafInfo();
104 : 118 : }
105 : :
106 : 115 : void GraphicProperties::ForceDefaultAttributes()
107 : : {
108 : : // call parent
109 : 115 : RectangleProperties::ForceDefaultAttributes();
110 : :
111 : : // force ItemSet
112 : 115 : GetObjectItemSet();
113 : :
114 [ + - ]: 115 : mpItemSet->Put( SdrGrafLuminanceItem( 0 ) );
115 [ + - ]: 115 : mpItemSet->Put( SdrGrafContrastItem( 0 ) );
116 [ + - ]: 115 : mpItemSet->Put( SdrGrafRedItem( 0 ) );
117 [ + - ]: 115 : mpItemSet->Put( SdrGrafGreenItem( 0 ) );
118 [ + - ]: 115 : mpItemSet->Put( SdrGrafBlueItem( 0 ) );
119 [ + - ]: 115 : mpItemSet->Put( SdrGrafGamma100Item( 100 ) );
120 [ + - ]: 115 : mpItemSet->Put( SdrGrafTransparenceItem( 0 ) );
121 [ + - ]: 115 : mpItemSet->Put( SdrGrafInvertItem( sal_False ) );
122 [ + - ]: 115 : mpItemSet->Put( SdrGrafModeItem( GRAPHICDRAWMODE_STANDARD ) );
123 [ + - ]: 115 : mpItemSet->Put( SdrGrafCropItem( 0, 0, 0, 0 ) );
124 : :
125 : : // #i25616#
126 [ + - ]: 115 : mpItemSet->Put( XFillStyleItem(XFILL_NONE) );
127 [ + - ]: 115 : mpItemSet->Put( XLineStyleItem(XLINE_NONE) );
128 : 115 : }
129 : : } // end of namespace properties
130 : : } // end of namespace sdr
131 : :
132 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|