summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--svx/inc/sdr/properties/itemsettools.hxx18
-rw-r--r--svx/source/sdr/properties/itemsettools.cxx34
2 files changed, 11 insertions, 41 deletions
diff --git a/svx/inc/sdr/properties/itemsettools.hxx b/svx/inc/sdr/properties/itemsettools.hxx
index c9cb93261ad0..4559f8f2e3c8 100644
--- a/svx/inc/sdr/properties/itemsettools.hxx
+++ b/svx/inc/sdr/properties/itemsettools.hxx
@@ -21,11 +21,11 @@
#define INCLUDED_SVX_INC_SDR_PROPERTIES_ITEMSETTOOLS_HXX
#include <sal/types.h>
-#include <vcl/region.hxx>
+#include <tools/gen.hxx>
+#include <vector>
class SdrObject;
class SfxItemSet;
-namespace tools { class Rectangle; }
class Fraction;
// class to remember broadcast start positions
@@ -35,21 +35,19 @@ namespace sdr
{
class ItemChangeBroadcaster
{
- bool mbSingleRect;
- union {
- RectangleVector* mpRectangleVector;
- tools::Rectangle* mpRectangle;
- };
+ std::vector< tools::Rectangle > maRectangles;
public:
explicit ItemChangeBroadcaster(const SdrObject& rObj);
- ~ItemChangeBroadcaster();
sal_uInt32 GetRectangleCount() const
{
- return mbSingleRect ? 1 : mpRectangleVector->size();
+ return maRectangles.size();
+ }
+ const tools::Rectangle& GetRectangle(sal_uInt32 nIndex) const
+ {
+ return maRectangles[nIndex];
}
- const tools::Rectangle& GetRectangle(sal_uInt32 nIndex) const;
};
} // end of namespace properties
} // end of namespace sdr
diff --git a/svx/source/sdr/properties/itemsettools.cxx b/svx/source/sdr/properties/itemsettools.cxx
index c11c54dcf445..6e7d990ef781 100644
--- a/svx/source/sdr/properties/itemsettools.cxx
+++ b/svx/source/sdr/properties/itemsettools.cxx
@@ -38,8 +38,7 @@ namespace sdr
if (const SdrObjGroup* pGroupObj = dynamic_cast<const SdrObjGroup*>(&rObj))
{
SdrObjListIter aIter(*pGroupObj, SdrIterMode::DeepNoGroups);
- mpRectangleVector = new RectangleVector;
- mpRectangleVector->reserve(aIter.Count());
+ maRectangles.reserve(aIter.Count());
while(aIter.IsMore())
{
@@ -47,40 +46,13 @@ namespace sdr
if(pObj)
{
- mpRectangleVector->push_back(pObj->GetLastBoundRect());
+ maRectangles.push_back(pObj->GetLastBoundRect());
}
}
-
- mbSingleRect = false;
- }
- else
- {
- mpRectangle = new tools::Rectangle(rObj.GetLastBoundRect());
- mbSingleRect = true;
- }
- }
-
- ItemChangeBroadcaster::~ItemChangeBroadcaster()
- {
- if (!mbSingleRect)
- {
- delete mpRectangleVector;
- }
- else
- {
- delete mpRectangle;
- }
- }
-
- const tools::Rectangle& ItemChangeBroadcaster::GetRectangle(sal_uInt32 nIndex) const
- {
- if (!mbSingleRect)
- {
- return (*mpRectangleVector)[nIndex];
}
else
{
- return *mpRectangle;
+ maRectangles.push_back(rObj.GetLastBoundRect());
}
}
} // end of namespace properties