1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: properties.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
33 #include <svx/sdr/properties/properties.hxx>
34 #include <svx/sdr/properties/itemsettools.hxx>
35 #include <svtools/itemset.hxx>
36 #include <svx/svdogrp.hxx>
37 #include <svditer.hxx>
39 //////////////////////////////////////////////////////////////////////////////
45 BaseProperties::BaseProperties(SdrObject
& rObj
)
50 BaseProperties::BaseProperties(const BaseProperties
& /*rProps*/, SdrObject
& rObj
)
55 BaseProperties::~BaseProperties()
59 const SfxItemSet
& BaseProperties::GetMergedItemSet() const
61 // default implementation falls back to GetObjectItemSet()
62 return GetObjectItemSet();
65 void BaseProperties::SetMergedItemSet(const SfxItemSet
& rSet
, sal_Bool bClearAllItems
)
67 // clear items if requested
73 // default implementation falls back to SetObjectItemSet()
74 SetObjectItemSet(rSet
);
77 void BaseProperties::SetMergedItem(const SfxPoolItem
& rItem
)
79 // default implementation falls back to SetObjectItem()
83 void BaseProperties::ClearMergedItem(const sal_uInt16 nWhich
)
85 // default implementation falls back to ClearObjectItem()
86 ClearObjectItem(nWhich
);
89 void BaseProperties::Scale(const Fraction
& /*rScale*/)
91 // default implementation does nothing; overload where
92 // an ItemSet is implemented.
95 void BaseProperties::MoveToItemPool(SfxItemPool
* /*pSrcPool*/, SfxItemPool
* /*pDestPool*/, SdrModel
* /*pNewModel*/)
97 // Move properties to a new ItemPool. Default implementation does nothing.
98 // Overload where an ItemSet is implemented.
101 void BaseProperties::SetModel(SdrModel
* /*pOldModel*/, SdrModel
* /*pNewModel*/)
103 // Set new model. Default implementation does nothing.
104 // Overload where an ItemSet is implemented.
107 void BaseProperties::ForceStyleToHardAttributes()
109 // force all attributes which come from styles to hard attributes
110 // to be able to live without the style. Default implementation does nothing.
111 // Overload where an ItemSet is implemented.
114 //void BaseProperties::SetItemAndBroadcast(const SfxPoolItem& rItem)
116 // ItemChangeBroadcaster aC(GetSdrObject());
117 // SetObjectItem(rItem);
118 // BroadcastItemChange(aC);
121 //void BaseProperties::ClearItemAndBroadcast(const sal_uInt16 nWhich)
123 // ItemChangeBroadcaster aC(GetSdrObject());
124 // ClearObjectItem(nWhich);
125 // BroadcastItemChange(aC);
128 void BaseProperties::SetMergedItemSetAndBroadcast(const SfxItemSet
& rSet
, sal_Bool bClearAllItems
)
130 ItemChangeBroadcaster
aC(GetSdrObject());
137 SetMergedItemSet(rSet
);
138 BroadcastItemChange(aC
);
141 const SfxPoolItem
& BaseProperties::GetItem(const sal_uInt16 nWhich
) const
143 return GetObjectItemSet().Get(nWhich
);
146 void BaseProperties::BroadcastItemChange(const ItemChangeBroadcaster
& rChange
)
148 const sal_uInt32
nCount(rChange
.GetRectangleCount());
150 // #110094#-14 Reduce to do only second change
151 //// invalidate all remembered rectangles
152 //for(sal_uInt32 a(0); a < nCount; a++)
154 // GetSdrObject().BroadcastObjectChange(rChange.GetRectangle(a));
157 // invalidate all new rectangles
158 if(GetSdrObject().ISA(SdrObjGroup
))
160 SdrObjListIter
aIter((SdrObjGroup
&)GetSdrObject(), IM_DEEPNOGROUPS
);
162 while(aIter
.IsMore())
164 SdrObject
* pObj
= aIter
.Next();
165 // This is done with ItemSetChanged
166 // pObj->SetChanged();
167 pObj
->BroadcastObjectChange();
172 // This is done with ItemSetChanged
173 // GetSdrObject().SetChanged();
174 GetSdrObject().BroadcastObjectChange();
177 // also send the user calls
178 for(sal_uInt32
a(0L); a
< nCount
; a
++)
180 GetSdrObject().SendUserCall(SDRUSERCALL_CHGATTR
, rChange
.GetRectangle(a
));
184 sal_uInt32
BaseProperties::getVersion() const
188 } // end of namespace properties
189 } // end of namespace sdr
191 //////////////////////////////////////////////////////////////////////////////