xref: /trunk/main/svx/source/sdr/properties/graphicproperties.cxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_svx.hxx"
30 #include <svx/sdr/properties/graphicproperties.hxx>
31 #include <svl/itemset.hxx>
32 #include <svl/style.hxx>
33 #include <svx/svddef.hxx>
34 #include <editeng/eeitem.hxx>
35 #include <svx/svdograf.hxx>
36 #include <svx/sdgcpitm.hxx>
37 
38 //////////////////////////////////////////////////////////////////////////////
39 
40 namespace sdr
41 {
42     namespace properties
43     {
44         // create a new itemset
45         SfxItemSet& GraphicProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
46         {
47             return *(new SfxItemSet(rPool,
48 
49                 // range from SdrAttrObj
50                 SDRATTR_START, SDRATTR_SHADOW_LAST,
51                 SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
52                 SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
53 
54                 // range from SdrGrafObj
55                 SDRATTR_GRAF_FIRST, SDRATTR_GRAF_LAST,
56 
57                 // range from SdrTextObj
58                 EE_ITEMS_START, EE_ITEMS_END,
59 
60                 // end
61                 0, 0));
62         }
63 
64         GraphicProperties::GraphicProperties(SdrObject& rObj)
65         :   RectangleProperties(rObj)
66         {
67         }
68 
69         GraphicProperties::GraphicProperties(const GraphicProperties& rProps, SdrObject& rObj)
70         :   RectangleProperties(rProps, rObj)
71         {
72         }
73 
74         GraphicProperties::~GraphicProperties()
75         {
76         }
77 
78         BaseProperties& GraphicProperties::Clone(SdrObject& rObj) const
79         {
80             return *(new GraphicProperties(*this, rObj));
81         }
82 
83         void GraphicProperties::ItemSetChanged(const SfxItemSet& rSet)
84         {
85             SdrGrafObj& rObj = (SdrGrafObj&)GetSdrObject();
86 
87             // local changes
88             rObj.SetXPolyDirty();
89 
90             // #i29367# Update GraphicAttr, too. This was formerly
91             // triggered by SdrGrafObj::Notify, which is no longer
92             // called nowadays. BTW: strictly speaking, the whole
93             // ImpSetAttrToGrafInfo/ImpSetGrafInfoToAttr stuff could
94             // be dumped, when SdrGrafObj::aGrafInfo is removed and
95             // always created on the fly for repaint.
96             rObj.ImpSetAttrToGrafInfo();
97 
98             // call parent
99             RectangleProperties::ItemSetChanged(rSet);
100         }
101 
102         void GraphicProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr)
103         {
104             SdrGrafObj& rObj = (SdrGrafObj&)GetSdrObject();
105 
106             // local changes
107             rObj.SetXPolyDirty();
108 
109             // call parent
110             RectangleProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
111 
112             // local changes
113             rObj.ImpSetAttrToGrafInfo();
114         }
115 
116         void GraphicProperties::ForceDefaultAttributes()
117         {
118             // call parent
119             RectangleProperties::ForceDefaultAttributes();
120 
121             // force ItemSet
122             GetObjectItemSet();
123 
124             mpItemSet->Put( SdrGrafLuminanceItem( 0 ) );
125             mpItemSet->Put( SdrGrafContrastItem( 0 ) );
126             mpItemSet->Put( SdrGrafRedItem( 0 ) );
127             mpItemSet->Put( SdrGrafGreenItem( 0 ) );
128             mpItemSet->Put( SdrGrafBlueItem( 0 ) );
129             mpItemSet->Put( SdrGrafGamma100Item( 100 ) );
130             mpItemSet->Put( SdrGrafTransparenceItem( 0 ) );
131             mpItemSet->Put( SdrGrafInvertItem( sal_False ) );
132             mpItemSet->Put( SdrGrafModeItem( GRAPHICDRAWMODE_STANDARD ) );
133             mpItemSet->Put( SdrGrafCropItem( 0, 0, 0, 0 ) );
134 
135             // #i25616#
136             mpItemSet->Put( XFillStyleItem(XFILL_NONE) );
137             mpItemSet->Put( XLineStyleItem(XLINE_NONE) );
138         }
139     } // end of namespace properties
140 } // end of namespace sdr
141 
142 //////////////////////////////////////////////////////////////////////////////
143 // eof
144