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 31 #include <svx/svdoattr.hxx> 32 #include <svx/xpool.hxx> 33 #include "svx/svditext.hxx" 34 #include <svx/svdmodel.hxx> 35 #include <svx/svdpage.hxx> 36 #include <svx/svdattr.hxx> 37 #include <svx/svdattrx.hxx> 38 #include <svx/svdpool.hxx> 39 #include <svx/svdotext.hxx> 40 #include <svx/svdocapt.hxx> 41 #include <svx/svdograf.hxx> 42 #include <svx/svdoole2.hxx> 43 #include <svx/svdorect.hxx> 44 #include <svx/svdocirc.hxx> 45 #include <svx/svdomeas.hxx> 46 #include <svl/smplhint.hxx> 47 #include <svl/itemiter.hxx> 48 #include <svx/xenum.hxx> 49 #include <svx/xlineit0.hxx> 50 #include <svx/xlnstwit.hxx> 51 #include <svx/xlnedwit.hxx> 52 #include <svx/xfillit0.hxx> 53 #include <svx/xflbmtit.hxx> 54 #include <svx/xtextit0.hxx> 55 #include <svx/xflbstit.hxx> 56 #include <svx/xflbtoxy.hxx> 57 #include <svx/xftshit.hxx> 58 59 60 #include <editeng/colritem.hxx> 61 #include "editeng/fontitem.hxx" 62 #include <editeng/fhgtitem.hxx> 63 64 //#include <editeng/charscaleitem.hxx> 65 #include <svx/xlnstcit.hxx> 66 #include <svx/xlnwtit.hxx> 67 #include <svl/style.hxx> 68 #include <svl/style.hxx> 69 #include <svl/whiter.hxx> 70 #include <svx/xlnclit.hxx> 71 #include <svx/xflclit.hxx> 72 #include <svx/xlntrit.hxx> 73 #include <svx/xfltrit.hxx> 74 #include <svx/xlnedcit.hxx> 75 #include <editeng/adjitem.hxx> 76 #include <svx/xflbckit.hxx> 77 #include <svx/xtable.hxx> 78 #include <svx/xbtmpit.hxx> 79 #include <svx/xlndsit.hxx> 80 #include <svx/xlnedit.hxx> 81 #include <svx/xflgrit.hxx> 82 #include <svx/xflftrit.hxx> 83 #include <svx/xflhtit.hxx> 84 #include <svx/xlnstit.hxx> 85 #include <svx/sdr/properties/attributeproperties.hxx> 86 #include <basegfx/polygon/b2dpolygon.hxx> 87 #include "svx/xlinjoit.hxx" 88 #include <svdoimp.hxx> 89 90 ////////////////////////////////////////////////////////////////////////////// 91 92 sdr::properties::BaseProperties* SdrAttrObj::CreateObjectSpecificProperties() 93 { 94 return new sdr::properties::AttributeProperties(*this); 95 } 96 97 //////////////////////////////////////////////////////////////////////////////////////////////////// 98 99 TYPEINIT1(SdrAttrObj,SdrObject); 100 101 SdrAttrObj::SdrAttrObj() 102 { 103 } 104 105 SdrAttrObj::~SdrAttrObj() 106 { 107 } 108 109 const Rectangle& SdrAttrObj::GetSnapRect() const 110 { 111 if(bSnapRectDirty) 112 { 113 ((SdrAttrObj*)this)->RecalcSnapRect(); 114 ((SdrAttrObj*)this)->bSnapRectDirty = false; 115 } 116 117 return maSnapRect; 118 } 119 120 void SdrAttrObj::SetModel(SdrModel* pNewModel) 121 { 122 SdrModel* pOldModel = pModel; 123 124 // test for correct pool in ItemSet; move to new pool if necessary 125 if(pNewModel && GetObjectItemPool() && GetObjectItemPool() != &pNewModel->GetItemPool()) 126 { 127 MigrateItemPool(GetObjectItemPool(), &pNewModel->GetItemPool(), pNewModel); 128 } 129 130 // call parent 131 SdrObject::SetModel(pNewModel); 132 133 // modify properties 134 GetProperties().SetModel(pOldModel, pNewModel); 135 } 136 137 //////////////////////////////////////////////////////////////////////////////////////////////////// 138 // syntactical sugar for ItemSet accesses 139 140 void __EXPORT SdrAttrObj::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) 141 { 142 SfxSimpleHint *pSimple = PTR_CAST(SfxSimpleHint, &rHint); 143 sal_Bool bDataChg(pSimple && SFX_HINT_DATACHANGED == pSimple->GetId()); 144 145 if(bDataChg) 146 { 147 Rectangle aBoundRect = GetLastBoundRect(); 148 SetBoundRectDirty(); 149 SetRectsDirty(sal_True); 150 151 // This may have lead to object change 152 SetChanged(); 153 BroadcastObjectChange(); 154 SendUserCall(SDRUSERCALL_CHGATTR, aBoundRect); 155 } 156 } 157 158 sal_Int32 SdrAttrObj::ImpGetLineWdt() const 159 { 160 sal_Int32 nRetval(0); 161 162 if(XLINE_NONE != ((XLineStyleItem&)(GetObjectItem(XATTR_LINESTYLE))).GetValue()) 163 { 164 nRetval = ((XLineWidthItem&)(GetObjectItem(XATTR_LINEWIDTH))).GetValue(); 165 } 166 167 return nRetval; 168 } 169 170 sal_Bool SdrAttrObj::HasFill() const 171 { 172 return bClosedObj && ((XFillStyleItem&)(GetProperties().GetObjectItemSet().Get(XATTR_FILLSTYLE))).GetValue()!=XFILL_NONE; 173 } 174 175 sal_Bool SdrAttrObj::HasLine() const 176 { 177 return ((XLineStyleItem&)(GetProperties().GetObjectItemSet().Get(XATTR_LINESTYLE))).GetValue()!=XLINE_NONE; 178 } 179 180 // eof 181