1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_svx.hxx" 26 #include <svx/sdr/properties/graphicproperties.hxx> 27 #include <svl/itemset.hxx> 28 #include <svl/style.hxx> 29 #include <svx/svddef.hxx> 30 #include <editeng/eeitem.hxx> 31 #include <svx/svdograf.hxx> 32 #include <svx/sdgcpitm.hxx> 33 34 ////////////////////////////////////////////////////////////////////////////// 35 36 namespace sdr 37 { 38 namespace properties 39 { 40 // create a new itemset CreateObjectSpecificItemSet(SfxItemPool & rPool)41 SfxItemSet& GraphicProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool) 42 { 43 return *(new SfxItemSet(rPool, 44 45 // range from SdrAttrObj 46 SDRATTR_START, SDRATTR_SHADOW_LAST, 47 SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST, 48 SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION, 49 50 // range from SdrGrafObj 51 SDRATTR_GRAF_FIRST, SDRATTR_GRAF_LAST, 52 53 // range from SdrTextObj 54 EE_ITEMS_START, EE_ITEMS_END, 55 56 // end 57 0, 0)); 58 } 59 GraphicProperties(SdrObject & rObj)60 GraphicProperties::GraphicProperties(SdrObject& rObj) 61 : RectangleProperties(rObj) 62 { 63 } 64 GraphicProperties(const GraphicProperties & rProps,SdrObject & rObj)65 GraphicProperties::GraphicProperties(const GraphicProperties& rProps, SdrObject& rObj) 66 : RectangleProperties(rProps, rObj) 67 { 68 } 69 ~GraphicProperties()70 GraphicProperties::~GraphicProperties() 71 { 72 } 73 Clone(SdrObject & rObj) const74 BaseProperties& GraphicProperties::Clone(SdrObject& rObj) const 75 { 76 return *(new GraphicProperties(*this, rObj)); 77 } 78 ItemSetChanged(const SfxItemSet & rSet)79 void GraphicProperties::ItemSetChanged(const SfxItemSet& rSet) 80 { 81 SdrGrafObj& rObj = (SdrGrafObj&)GetSdrObject(); 82 83 // local changes 84 rObj.SetXPolyDirty(); 85 86 // #i29367# Update GraphicAttr, too. This was formerly 87 // triggered by SdrGrafObj::Notify, which is no longer 88 // called nowadays. BTW: strictly speaking, the whole 89 // ImpSetAttrToGrafInfo/ImpSetGrafInfoToAttr stuff could 90 // be dumped, when SdrGrafObj::aGrafInfo is removed and 91 // always created on the fly for repaint. 92 rObj.ImpSetAttrToGrafInfo(); 93 94 // call parent 95 RectangleProperties::ItemSetChanged(rSet); 96 } 97 SetStyleSheet(SfxStyleSheet * pNewStyleSheet,sal_Bool bDontRemoveHardAttr)98 void GraphicProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr) 99 { 100 SdrGrafObj& rObj = (SdrGrafObj&)GetSdrObject(); 101 102 // local changes 103 rObj.SetXPolyDirty(); 104 105 // call parent 106 RectangleProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr); 107 108 // local changes 109 rObj.ImpSetAttrToGrafInfo(); 110 } 111 ForceDefaultAttributes()112 void GraphicProperties::ForceDefaultAttributes() 113 { 114 // call parent 115 RectangleProperties::ForceDefaultAttributes(); 116 117 // force ItemSet 118 GetObjectItemSet(); 119 120 mpItemSet->Put( SdrGrafLuminanceItem( 0 ) ); 121 mpItemSet->Put( SdrGrafContrastItem( 0 ) ); 122 mpItemSet->Put( SdrGrafRedItem( 0 ) ); 123 mpItemSet->Put( SdrGrafGreenItem( 0 ) ); 124 mpItemSet->Put( SdrGrafBlueItem( 0 ) ); 125 mpItemSet->Put( SdrGrafGamma100Item( 100 ) ); 126 mpItemSet->Put( SdrGrafTransparenceItem( 0 ) ); 127 mpItemSet->Put( SdrGrafInvertItem( sal_False ) ); 128 mpItemSet->Put( SdrGrafModeItem( GRAPHICDRAWMODE_STANDARD ) ); 129 mpItemSet->Put( SdrGrafCropItem( 0, 0, 0, 0 ) ); 130 } 131 } // end of namespace properties 132 } // end of namespace sdr 133 134 ////////////////////////////////////////////////////////////////////////////// 135 // eof 136