[Libreoffice-commits] core.git: 5 commits - basegfx/source drawinglayer/source include/basegfx include/drawinglayer include/svx svx/inc svx/source
Thorsten Behrens
Thorsten.Behrens at CIB.de
Sun May 24 12:51:19 PDT 2015
basegfx/source/polygon/b2dtrapezoid.cxx | 4
drawinglayer/source/attribute/fillgradientattribute.cxx | 4
drawinglayer/source/attribute/fillgraphicattribute.cxx | 4
drawinglayer/source/attribute/fillhatchattribute.cxx | 4
drawinglayer/source/attribute/lineattribute.cxx | 4
drawinglayer/source/attribute/linestartendattribute.cxx | 4
drawinglayer/source/attribute/sdrfillattribute.cxx | 4
drawinglayer/source/attribute/sdrfillgraphicattribute.cxx | 6
drawinglayer/source/attribute/sdrlightingattribute3d.cxx | 4
drawinglayer/source/attribute/sdrlineattribute.cxx | 4
drawinglayer/source/attribute/sdrlinestartendattribute.cxx | 4
drawinglayer/source/attribute/sdrsceneattribute3d.cxx | 4
drawinglayer/source/attribute/sdrshadowattribute.cxx | 4
drawinglayer/source/attribute/strokeattribute.cxx | 4
drawinglayer/source/primitive2d/cropprimitive2d.cxx | 2
drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx | 2
drawinglayer/source/primitive2d/metafileprimitive2d.cxx | 4
include/basegfx/curve/b2dcubicbezier.hxx | 2
include/basegfx/polygon/b2dpolygontools.hxx | 2
include/basegfx/polygon/b2dpolypolygoncutter.hxx | 4
include/basegfx/polygon/b2dpolypolygontools.hxx | 4
include/drawinglayer/primitive2d/polygonprimitive2d.hxx | 6
include/drawinglayer/processor2d/baseprocessor2d.hxx | 2
include/svx/e3dsceneupdater.hxx | 22 +-
include/svx/sdr/attribute/sdrformtextattribute.hxx | 7
include/svx/sdr/attribute/sdrtextattribute.hxx | 7
svx/inc/sdr/attribute/sdrformtextoutlineattribute.hxx | 7
svx/source/sdr/attribute/sdrformtextattribute.cxx | 73 +-------
svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx | 84 ++-------
svx/source/sdr/attribute/sdrtextattribute.cxx | 91 ++--------
30 files changed, 155 insertions(+), 222 deletions(-)
New commits:
commit cd6ee5de8ef7345ba219f0d50e9e1ee45332e55f
Author: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Date: Sun May 24 21:45:10 2015 +0200
comments: fix mis-use of eventual in English
The adjective was used as the German meaning, which translates to
maybe or possibly.
Change-Id: Iaf5b38f628b23796829a1c4bd3919d4e13b874f0
diff --git a/basegfx/source/polygon/b2dtrapezoid.cxx b/basegfx/source/polygon/b2dtrapezoid.cxx
index d7168b7..935287e 100644
--- a/basegfx/source/polygon/b2dtrapezoid.cxx
+++ b/basegfx/source/polygon/b2dtrapezoid.cxx
@@ -763,7 +763,7 @@ namespace basegfx
aAllRange.expand(aRightRange);
// prepare loop iterator; aCurrent needs to stay unchanged for
- // eventual sorted insertions of new EdgeNodes. Also prepare stop flag
+ // possibly sorted insertions of new EdgeNodes. Also prepare stop flag
TrDeEdgeEntries::iterator aLoop(aCurrent);
bool bDone(false);
@@ -848,7 +848,7 @@ namespace basegfx
}
// when we get here, the intended trapezoid can be used. It needs to
- // be corrected, eventually (if prepared); but this is no reason not to
+ // be corrected possibly (if prepared); but this is no reason not to
// use it in the same loop iteration
if(!bEndOnSameLine)
{
diff --git a/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx b/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx
index ea7e691..6efece2 100644
--- a/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx
+++ b/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx
@@ -210,7 +210,7 @@ namespace drawinglayer
FillGraphicAttribute SdrFillGraphicAttribute::createFillGraphicAttribute(const basegfx::B2DRange& rRange) const
{
- // get logical size of bitmap (before expanding eventually)
+ // get logical size of bitmap (before possibly expanding it)
Graphic aGraphic(getFillGraphic());
// init values with defaults for stretched
diff --git a/drawinglayer/source/primitive2d/cropprimitive2d.cxx b/drawinglayer/source/primitive2d/cropprimitive2d.cxx
index 8c5f1d6..b2a7ea4 100644
--- a/drawinglayer/source/primitive2d/cropprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/cropprimitive2d.cxx
@@ -116,7 +116,7 @@ namespace drawinglayer
// apply original transformation. Since we have manipulated the crop
// in unit coordinates we do not need to care about mirroring or
- // a corrected point for eventual shear or rotation, this all comes for
+ // a corrected point for a possible shear or rotation, this all comes for
// free
aNewTransform = getTransformation() * aNewTransform;
diff --git a/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx b/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx
index dbf8674..e406a3b 100644
--- a/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx
@@ -49,7 +49,7 @@ namespace drawinglayer
const basegfx::B2DPoint aWorldTopLeft(getObjectTransformation() * getTopLeft());
// build object matrix in world coordinates so that the top-left
- // position remains, but eventual transformations (e.g. rotations)
+ // position remains, but possible transformations (e.g. rotations)
// in the ObjectToView stack remain and get correctly applied
basegfx::B2DHomMatrix aObjectTransform;
diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
index 100d2f3..e718176 100644
--- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
@@ -943,8 +943,8 @@ namespace
/** helper to take needed action on ClipRegion change. This method needs to be called
on any vcl::Region change, e.g. at the obvious actions doing this, but also at pop-calls
which change the vcl::Region of the current context. It takes care of creating the
- current embeddec context, set the new vcl::Region at the context and eventually prepare
- a new target for embracing new geometry to the current region
+ current embedded context, set the new vcl::Region at the context and possibly prepare
+ a new target for including new geometry into the current region
*/
void HandleNewClipRegion(
const basegfx::B2DPolyPolygon& rClipPolyPolygon,
diff --git a/include/basegfx/curve/b2dcubicbezier.hxx b/include/basegfx/curve/b2dcubicbezier.hxx
index bde5318..72715ed 100644
--- a/include/basegfx/curve/b2dcubicbezier.hxx
+++ b/include/basegfx/curve/b2dcubicbezier.hxx
@@ -166,7 +166,7 @@ namespace basegfx
/** Get the minimum extremum position t
@param rfResult
- Will be changed and set to a eventually found split value which should be in the
+ Will be changed and might possibly be set to a found split value, which should be in the
range [0.0 .. 1.0]. It will be the smallest current extremum; there may be more
@return
diff --git a/include/basegfx/polygon/b2dpolygontools.hxx b/include/basegfx/polygon/b2dpolygontools.hxx
index dc0cf11..02cc43d 100644
--- a/include/basegfx/polygon/b2dpolygontools.hxx
+++ b/include/basegfx/polygon/b2dpolygontools.hxx
@@ -94,7 +94,7 @@ namespace basegfx
For detailed discussion see B2DPolygon::getB2DRange()
@param rCandidate
- The B2DPolygon eventually containing bezier segments
+ The B2DPolygon possibly containing bezier segments
@return
The outer range of the bezier curve
diff --git a/include/basegfx/polygon/b2dpolypolygoncutter.hxx b/include/basegfx/polygon/b2dpolypolygoncutter.hxx
index cfa2449..37ce2ab 100644
--- a/include/basegfx/polygon/b2dpolypolygoncutter.hxx
+++ b/include/basegfx/polygon/b2dpolypolygoncutter.hxx
@@ -50,8 +50,8 @@ namespace basegfx
Same as above, but for single polygons. Result will be
free of self-intersections. When result contains multiple
polygons, it may be necessary to rearrange their
- orientations since holes may have been created (use
- correctOrientations eventually).
+ orientations since holes may have been created (possibly use
+ correctOrientations).
*/
BASEGFX_DLLPUBLIC B2DPolyPolygon solveCrossovers(const B2DPolygon& rCandidate);
diff --git a/include/basegfx/polygon/b2dpolypolygontools.hxx b/include/basegfx/polygon/b2dpolypolygontools.hxx
index 11fed47..42fda3e 100644
--- a/include/basegfx/polygon/b2dpolypolygontools.hxx
+++ b/include/basegfx/polygon/b2dpolypolygontools.hxx
@@ -74,7 +74,7 @@ namespace basegfx
This method just expands by the range of every sub-Polygon.
@param rCandidate
- The B2DPolyPolygon eventually containing bezier segments
+ The B2DPolyPolygon possibly containing bezier segments
@return
The outer range of the polygon
@@ -170,7 +170,7 @@ namespace basegfx
// This method will correct a pair of polyPolygons where the goal is to keep same point count
// to allow direct point association and also to remove self-intersections produced by shrinks.
- // This method will eventually change both polyPolygons to reach that goal because there are cases
+ // This method might possibly change both polyPolygons to reach that goal because there are cases
// where it is necessary to add new cut points to the original
BASEGFX_DLLPUBLIC void correctGrowShrinkPolygonPair(B2DPolyPolygon& rOriginal, B2DPolyPolygon& rGrown);
diff --git a/include/drawinglayer/primitive2d/polygonprimitive2d.hxx b/include/drawinglayer/primitive2d/polygonprimitive2d.hxx
index 62e2f20..cc08349 100644
--- a/include/drawinglayer/primitive2d/polygonprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/polygonprimitive2d.hxx
@@ -263,9 +263,9 @@ namespace drawinglayer
{
/** PolygonStrokeArrowPrimitive2D class
- This primitive defines a PolygonStrokePrimitive2D which is extended
- eventually by start and end definitions which are normally used for
- arrows.
+ This primitive defines a PolygonStrokePrimitive2D,
+ possibly extended by start and end definitions, which are
+ normally used for arrows.
*/
class DRAWINGLAYER_DLLPUBLIC PolygonStrokeArrowPrimitive2D : public PolygonStrokePrimitive2D
{
diff --git a/include/drawinglayer/processor2d/baseprocessor2d.hxx b/include/drawinglayer/processor2d/baseprocessor2d.hxx
index 4f9eedf..95803af 100644
--- a/include/drawinglayer/processor2d/baseprocessor2d.hxx
+++ b/include/drawinglayer/processor2d/baseprocessor2d.hxx
@@ -69,7 +69,7 @@ namespace drawinglayer
Basic Primitives:
- - BitmapPrimitive2D (bitmap data, eventually with transparency)
+ - BitmapPrimitive2D (bitmap data, possibly with transparency)
- PointArrayPrimitive2D (single points)
- PolygonHairlinePrimitive2D (hairline curves/polygons)
- PolyPolygonColorPrimitive2D (colored polygons)
diff --git a/include/svx/e3dsceneupdater.hxx b/include/svx/e3dsceneupdater.hxx
index 457948c..32041c8 100644
--- a/include/svx/e3dsceneupdater.hxx
+++ b/include/svx/e3dsceneupdater.hxx
@@ -29,16 +29,20 @@ namespace drawinglayer { namespace geometry {
class ViewInformation3D;
}}
-// This class is a helper to encapsulate 3D object changes which shall change the
-// scene's 2D geometry. E.g. when moving one 3D object in a scene, the visualisation
-// would not change since the scene's 2D attributes are defined by it's 2D object
-// transformation and the changed content would be projected to the same 2D bounds
-// as before. To reflect the fact that the 2D positions may 'change' for the user's
-// imagination, it is necessary to calculate a new 2D object transformation of the scene
-// (the SnapRect) using the old 3D transformation stack and the eventually changed
-// 3D content and tu use it. This is only wanted if changes to the scene's
-// content are intended to change the scene's 2D geometry attributes
+/** Helper for 3d object changes affecting 2d geometry
+ This class is a helper to encapsulate 3D object changes which shall
+ change the scene's 2D geometry. E.g. when moving one 3D object in a
+ scene, the visualisation would not change since the scene's 2D
+ attributes are defined by it's 2D object transformation and the
+ changed content would be projected to the same 2D bounds as
+ before. To reflect the fact that the 2D positions may 'change' for
+ the user's imagination, it is necessary to calculate a new 2D
+ object transformation of the scene (the SnapRect) using the old 3D
+ transformation stack and the possibly modified 3D content and to
+ use it. This is only desirable if changes to the scene's content
+ are intended to change the scene's 2D geometry attributes
+*/
class SVX_DLLPUBLIC E3DModifySceneSnapRectUpdater
{
// the scene which may be changed. This gets set to the outmost scene
commit e9bb2e6f09d711833e659db3b229326d5e997266
Author: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Date: Sun May 24 17:21:47 2015 +0200
tdf#62525: use cow_wrapper for SdrTextAttribute
Change-Id: I8daf6d155c631cbdb850a6af95c92a578905d6e6
diff --git a/include/svx/sdr/attribute/sdrtextattribute.hxx b/include/svx/sdr/attribute/sdrtextattribute.hxx
index 637b769..66e3e7a 100644
--- a/include/svx/sdr/attribute/sdrtextattribute.hxx
+++ b/include/svx/sdr/attribute/sdrtextattribute.hxx
@@ -24,7 +24,7 @@
#include <svx/xenum.hxx>
#include <editeng/outlobj.hxx>
#include <svx/sdtaitm.hxx>
-
+#include <o3tl/cow_wrapper.hxx>
// predefines
@@ -50,8 +50,11 @@ namespace drawinglayer
{
class SdrTextAttribute
{
+ public:
+ typedef o3tl::cow_wrapper< ImpSdrTextAttribute > ImplType;
+
private:
- ImpSdrTextAttribute* mpSdrTextAttribute;
+ ImplType mpSdrTextAttribute;
public:
/// constructors/assignmentoperator/destructor
diff --git a/svx/source/sdr/attribute/sdrtextattribute.cxx b/svx/source/sdr/attribute/sdrtextattribute.cxx
index 57d2dfd..45b55fb 100644
--- a/svx/source/sdr/attribute/sdrtextattribute.cxx
+++ b/svx/source/sdr/attribute/sdrtextattribute.cxx
@@ -25,7 +25,7 @@
#include <editeng/editobj.hxx>
#include <editeng/flditem.hxx>
#include <svx/sdr/properties/properties.hxx>
-
+#include <rtl/instance.hxx>
namespace drawinglayer
@@ -35,9 +35,6 @@ namespace drawinglayer
class ImpSdrTextAttribute
{
public:
- // refcounter
- sal_uInt32 mnRefCount;
-
// all-text attributes. The SdrText itself and a copy
// of the OPO
const SdrText* mpSdrText;
@@ -90,8 +87,7 @@ namespace drawinglayer
bool bInEditMode,
bool bFixedCellHeight,
bool bWrongSpell)
- : mnRefCount(0),
- mpSdrText(pSdrText),
+ : mpSdrText(pSdrText),
mpOutlinerParaObject(new OutlinerParaObject(rOutlinerParaObject)),
maSdrFormTextAttribute(),
maTextLeftDistance(aTextLeftDistance),
@@ -128,8 +124,7 @@ namespace drawinglayer
}
ImpSdrTextAttribute()
- : mnRefCount(0),
- mpSdrText(0),
+ : mpSdrText(0),
mpOutlinerParaObject(0),
maSdrFormTextAttribute(),
maTextLeftDistance(0),
@@ -151,14 +146,6 @@ namespace drawinglayer
{
}
- ~ImpSdrTextAttribute()
- {
- if(mpOutlinerParaObject)
- {
- delete mpOutlinerParaObject;
- }
- }
-
// data read access
const SdrText& getSdrText() const
{
@@ -241,24 +228,14 @@ namespace drawinglayer
&& isFixedCellHeight() == rCandidate.isFixedCellHeight()
&& isWrongSpell() == rCandidate.isWrongSpell());
}
-
- static ImpSdrTextAttribute* get_global_default()
- {
- static ImpSdrTextAttribute* pDefault = 0;
-
- if(!pDefault)
- {
- // use default constructor
- pDefault = new ImpSdrTextAttribute();
-
- // never delete; start with RefCount 1, not 0
- pDefault->mnRefCount++;
- }
-
- return pDefault;
- }
};
+ namespace
+ {
+ struct theGlobalDefault :
+ public rtl::Static< SdrTextAttribute::ImplType, theGlobalDefault > {};
+ }
+
SdrTextAttribute::SdrTextAttribute(
const SdrText& rSdrText,
const OutlinerParaObject& rOutlinerParaObject,
@@ -278,75 +255,47 @@ namespace drawinglayer
bool bInEditMode,
bool bFixedCellHeight,
bool bWrongSpell)
- : mpSdrTextAttribute(new ImpSdrTextAttribute(
- &rSdrText, rOutlinerParaObject, eFormTextStyle, aTextLeftDistance, aTextUpperDistance,
- aTextRightDistance, aTextLowerDistance, aSdrTextHorzAdjust, aSdrTextVertAdjust, bContour,
- bFitToSize, bAutoFit, bHideContour, bBlink, bScroll, bInEditMode, bFixedCellHeight, bWrongSpell))
+ : mpSdrTextAttribute(
+ ImpSdrTextAttribute(
+ &rSdrText, rOutlinerParaObject, eFormTextStyle, aTextLeftDistance,
+ aTextUpperDistance, aTextRightDistance, aTextLowerDistance,
+ aSdrTextHorzAdjust, aSdrTextVertAdjust, bContour, bFitToSize, bAutoFit,
+ bHideContour, bBlink, bScroll, bInEditMode, bFixedCellHeight, bWrongSpell))
{
}
SdrTextAttribute::SdrTextAttribute()
- : mpSdrTextAttribute(ImpSdrTextAttribute::get_global_default())
+ : mpSdrTextAttribute(theGlobalDefault::get())
{
- mpSdrTextAttribute->mnRefCount++;
}
SdrTextAttribute::SdrTextAttribute(const SdrTextAttribute& rCandidate)
: mpSdrTextAttribute(rCandidate.mpSdrTextAttribute)
{
- mpSdrTextAttribute->mnRefCount++;
}
SdrTextAttribute::~SdrTextAttribute()
{
- if(mpSdrTextAttribute->mnRefCount)
- {
- mpSdrTextAttribute->mnRefCount--;
- }
- else
- {
- delete mpSdrTextAttribute;
- }
}
bool SdrTextAttribute::isDefault() const
{
- return mpSdrTextAttribute == ImpSdrTextAttribute::get_global_default();
+ return mpSdrTextAttribute.same_object(theGlobalDefault::get());
}
SdrTextAttribute& SdrTextAttribute::operator=(const SdrTextAttribute& rCandidate)
{
- if(rCandidate.mpSdrTextAttribute != mpSdrTextAttribute)
- {
- if(mpSdrTextAttribute->mnRefCount)
- {
- mpSdrTextAttribute->mnRefCount--;
- }
- else
- {
- delete mpSdrTextAttribute;
- }
-
- mpSdrTextAttribute = rCandidate.mpSdrTextAttribute;
- mpSdrTextAttribute->mnRefCount++;
- }
-
+ mpSdrTextAttribute = rCandidate.mpSdrTextAttribute;
return *this;
}
bool SdrTextAttribute::operator==(const SdrTextAttribute& rCandidate) const
{
- if(rCandidate.mpSdrTextAttribute == mpSdrTextAttribute)
- {
- return true;
- }
-
+ // tdf#87509 default attr is always != non-default attr, even with same values
if(rCandidate.isDefault() != isDefault())
- {
return false;
- }
- return (*rCandidate.mpSdrTextAttribute == *mpSdrTextAttribute);
+ return rCandidate.mpSdrTextAttribute == mpSdrTextAttribute;
}
const SdrText& SdrTextAttribute::getSdrText() const
commit 27e1a92d3bddf3c3e8595256e67aff006a402b6a
Author: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Date: Sun May 24 16:12:01 2015 +0200
tdf#62525: use cow_wrapper for SdrFormTextOutlineAttribute
Change-Id: I7f75833bfec2cde140ded1dfe60aed2684905b0a
diff --git a/svx/inc/sdr/attribute/sdrformtextoutlineattribute.hxx b/svx/inc/sdr/attribute/sdrformtextoutlineattribute.hxx
index 979762c..121f45b 100644
--- a/svx/inc/sdr/attribute/sdrformtextoutlineattribute.hxx
+++ b/svx/inc/sdr/attribute/sdrformtextoutlineattribute.hxx
@@ -21,7 +21,7 @@
#define INCLUDED_SVX_INC_SDR_ATTRIBUTE_SDRFORMTEXTOUTLINEATTRIBUTE_HXX
#include <sal/types.h>
-
+#include <o3tl/cow_wrapper.hxx>
// predefines
@@ -39,8 +39,11 @@ namespace drawinglayer
{
class SdrFormTextOutlineAttribute
{
+ public:
+ typedef o3tl::cow_wrapper< ImpSdrFormTextOutlineAttribute > ImplType;
+
private:
- ImpSdrFormTextOutlineAttribute* mpSdrFormTextOutlineAttribute;
+ ImplType mpSdrFormTextOutlineAttribute;
public:
/// constructors/assignmentoperator/destructor
diff --git a/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx b/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx
index 23a8bf8..1126013 100644
--- a/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx
+++ b/svx/source/sdr/attribute/sdrformtextoutlineattribute.cxx
@@ -21,7 +21,7 @@
#include <sdr/attribute/sdrformtextoutlineattribute.hxx>
#include <drawinglayer/attribute/lineattribute.hxx>
#include <drawinglayer/attribute/strokeattribute.hxx>
-
+#include <rtl/instance.hxx>
namespace drawinglayer
@@ -31,9 +31,6 @@ namespace drawinglayer
class ImpSdrFormTextOutlineAttribute
{
public:
- // refcounter
- sal_uInt32 mnRefCount;
-
// one set of attributes for FormText (FontWork) outline visualisation
LineAttribute maLineAttribute;
StrokeAttribute maStrokeAttribute;
@@ -43,13 +40,19 @@ namespace drawinglayer
const LineAttribute& rLineAttribute,
const StrokeAttribute& rStrokeAttribute,
sal_uInt8 nTransparence)
- : mnRefCount(0),
- maLineAttribute(rLineAttribute),
+ : maLineAttribute(rLineAttribute),
maStrokeAttribute(rStrokeAttribute),
mnTransparence(nTransparence)
{
}
+ ImpSdrFormTextOutlineAttribute()
+ : maLineAttribute(),
+ maStrokeAttribute(),
+ mnTransparence(0)
+ {
+ }
+
// data read access
const LineAttribute& getLineAttribute() const { return maLineAttribute; }
const StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; }
@@ -62,97 +65,56 @@ namespace drawinglayer
&& getStrokeAttribute() == rCandidate.getStrokeAttribute()
&& getTransparence() == rCandidate.getTransparence());
}
-
- static ImpSdrFormTextOutlineAttribute* get_global_default()
- {
- static ImpSdrFormTextOutlineAttribute* pDefault = 0;
-
- if(!pDefault)
- {
- pDefault = new ImpSdrFormTextOutlineAttribute(
- LineAttribute(),
- StrokeAttribute(),
- 0);
-
- // never delete; start with RefCount 1, not 0
- pDefault->mnRefCount++;
- }
-
- return pDefault;
- }
};
+ namespace
+ {
+ struct theGlobalDefault :
+ public rtl::Static< SdrFormTextOutlineAttribute::ImplType, theGlobalDefault > {};
+ }
+
SdrFormTextOutlineAttribute::SdrFormTextOutlineAttribute(
const LineAttribute& rLineAttribute,
const StrokeAttribute& rStrokeAttribute,
sal_uInt8 nTransparence)
- : mpSdrFormTextOutlineAttribute(new ImpSdrFormTextOutlineAttribute(
- rLineAttribute, rStrokeAttribute, nTransparence))
+ : mpSdrFormTextOutlineAttribute(
+ ImpSdrFormTextOutlineAttribute(
+ rLineAttribute, rStrokeAttribute, nTransparence))
{
}
SdrFormTextOutlineAttribute::SdrFormTextOutlineAttribute()
- : mpSdrFormTextOutlineAttribute(ImpSdrFormTextOutlineAttribute::get_global_default())
+ : mpSdrFormTextOutlineAttribute(theGlobalDefault::get())
{
- mpSdrFormTextOutlineAttribute->mnRefCount++;
}
SdrFormTextOutlineAttribute::SdrFormTextOutlineAttribute(const SdrFormTextOutlineAttribute& rCandidate)
: mpSdrFormTextOutlineAttribute(rCandidate.mpSdrFormTextOutlineAttribute)
{
- mpSdrFormTextOutlineAttribute->mnRefCount++;
}
SdrFormTextOutlineAttribute::~SdrFormTextOutlineAttribute()
{
- if(mpSdrFormTextOutlineAttribute->mnRefCount)
- {
- mpSdrFormTextOutlineAttribute->mnRefCount--;
- }
- else
- {
- delete mpSdrFormTextOutlineAttribute;
- }
}
bool SdrFormTextOutlineAttribute::isDefault() const
{
- return mpSdrFormTextOutlineAttribute == ImpSdrFormTextOutlineAttribute::get_global_default();
+ return mpSdrFormTextOutlineAttribute.same_object(theGlobalDefault::get());
}
SdrFormTextOutlineAttribute& SdrFormTextOutlineAttribute::operator=(const SdrFormTextOutlineAttribute& rCandidate)
{
- if(rCandidate.mpSdrFormTextOutlineAttribute != mpSdrFormTextOutlineAttribute)
- {
- if(mpSdrFormTextOutlineAttribute->mnRefCount)
- {
- mpSdrFormTextOutlineAttribute->mnRefCount--;
- }
- else
- {
- delete mpSdrFormTextOutlineAttribute;
- }
-
- mpSdrFormTextOutlineAttribute = rCandidate.mpSdrFormTextOutlineAttribute;
- mpSdrFormTextOutlineAttribute->mnRefCount++;
- }
-
+ mpSdrFormTextOutlineAttribute = rCandidate.mpSdrFormTextOutlineAttribute;
return *this;
}
bool SdrFormTextOutlineAttribute::operator==(const SdrFormTextOutlineAttribute& rCandidate) const
{
- if(rCandidate.mpSdrFormTextOutlineAttribute == mpSdrFormTextOutlineAttribute)
- {
- return true;
- }
-
+ // tdf#87509 default attr is always != non-default attr, even with same values
if(rCandidate.isDefault() != isDefault())
- {
return false;
- }
- return (*rCandidate.mpSdrFormTextOutlineAttribute == *mpSdrFormTextOutlineAttribute);
+ return rCandidate.mpSdrFormTextOutlineAttribute == mpSdrFormTextOutlineAttribute;
}
const LineAttribute& SdrFormTextOutlineAttribute::getLineAttribute() const
commit 6a42657fa9afc93c3e4b7afc0c00c0de8e704169
Author: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Date: Sun May 24 12:41:24 2015 +0200
tdf#62525: use cow_wrapper for SdrFormTextAttribute
Change-Id: I0fd55ea6c775d771e001c0db78bb72c50e9b81cf
diff --git a/include/svx/sdr/attribute/sdrformtextattribute.hxx b/include/svx/sdr/attribute/sdrformtextattribute.hxx
index 970fbb5..466b95e 100644
--- a/include/svx/sdr/attribute/sdrformtextattribute.hxx
+++ b/include/svx/sdr/attribute/sdrformtextattribute.hxx
@@ -23,7 +23,7 @@
#include <sal/types.h>
#include <svx/xenum.hxx>
#include <tools/color.hxx>
-
+#include <o3tl/cow_wrapper.hxx>
// predefines
@@ -42,8 +42,11 @@ namespace drawinglayer
{
class SdrFormTextAttribute
{
+ public:
+ typedef o3tl::cow_wrapper< ImpSdrFormTextAttribute > ImplType;
+
private:
- ImpSdrFormTextAttribute* mpSdrFormTextAttribute;
+ ImplType mpSdrFormTextAttribute;
public:
/// constructors/assignmentoperator/destructor
diff --git a/svx/source/sdr/attribute/sdrformtextattribute.cxx b/svx/source/sdr/attribute/sdrformtextattribute.cxx
index 2210191..03af4df 100644
--- a/svx/source/sdr/attribute/sdrformtextattribute.cxx
+++ b/svx/source/sdr/attribute/sdrformtextattribute.cxx
@@ -45,6 +45,7 @@
#include <sdr/attribute/sdrformtextoutlineattribute.hxx>
#include <com/sun/star/drawing/LineCap.hpp>
#include <com/sun/star/drawing/LineStyle.hpp>
+#include <rtl/instance.hxx>
// helper to get line, stroke and transparence attributes from SfxItemSet
@@ -150,9 +151,6 @@ namespace drawinglayer
class ImpSdrFormTextAttribute
{
public:
- // refcounter
- sal_uInt32 mnRefCount;
-
// FormText (FontWork) Attributes
sal_Int32 mnFormTextDistance; // distance from line in upright direction
sal_Int32 mnFormTextStart; // shift from polygon start
@@ -174,8 +172,7 @@ namespace drawinglayer
bool mbFormTextOutline : 1; // show contour of objects
explicit ImpSdrFormTextAttribute(const SfxItemSet& rSet)
- : mnRefCount(0),
- mnFormTextDistance(static_cast<const XFormTextDistanceItem&>(rSet.Get(XATTR_FORMTXTDISTANCE)).GetValue()),
+ : mnFormTextDistance(static_cast<const XFormTextDistanceItem&>(rSet.Get(XATTR_FORMTXTDISTANCE)).GetValue()),
mnFormTextStart(static_cast<const XFormTextStartItem&>(rSet.Get(XATTR_FORMTXTSTART)).GetValue()),
mnFormTextShdwXVal(static_cast<const XFormTextShadowXValItem&>(rSet.Get(XATTR_FORMTXTSHDWXVAL)).GetValue()),
mnFormTextShdwYVal(static_cast<const XFormTextShadowYValItem&>(rSet.Get(XATTR_FORMTXTSHDWYVAL)).GetValue()),
@@ -215,8 +212,7 @@ namespace drawinglayer
}
ImpSdrFormTextAttribute()
- : mnRefCount(0),
- mnFormTextDistance(0),
+ : mnFormTextDistance(0),
mnFormTextStart(0),
mnFormTextShdwXVal(0),
mnFormTextShdwYVal(0),
@@ -264,90 +260,51 @@ namespace drawinglayer
&& getFormTextMirror() == rCandidate.getFormTextMirror()
&& getFormTextOutline() == rCandidate.getFormTextOutline());
}
-
- static ImpSdrFormTextAttribute* get_global_default()
- {
- static ImpSdrFormTextAttribute* pDefault = 0;
-
- if(!pDefault)
- {
- pDefault = new ImpSdrFormTextAttribute();
-
- // never delete; start with RefCount 1, not 0
- pDefault->mnRefCount++;
- }
-
- return pDefault;
- }
};
+ namespace
+ {
+ struct theGlobalDefault :
+ public rtl::Static< SdrFormTextAttribute::ImplType, theGlobalDefault > {};
+ }
+
SdrFormTextAttribute::SdrFormTextAttribute(const SfxItemSet& rSet)
- : mpSdrFormTextAttribute(new ImpSdrFormTextAttribute(rSet))
+ : mpSdrFormTextAttribute(ImpSdrFormTextAttribute(rSet))
{
}
SdrFormTextAttribute::SdrFormTextAttribute()
- : mpSdrFormTextAttribute(ImpSdrFormTextAttribute::get_global_default())
+ : mpSdrFormTextAttribute(theGlobalDefault::get())
{
- mpSdrFormTextAttribute->mnRefCount++;
}
SdrFormTextAttribute::SdrFormTextAttribute(const SdrFormTextAttribute& rCandidate)
: mpSdrFormTextAttribute(rCandidate.mpSdrFormTextAttribute)
{
- mpSdrFormTextAttribute->mnRefCount++;
}
SdrFormTextAttribute::~SdrFormTextAttribute()
{
- if(mpSdrFormTextAttribute->mnRefCount)
- {
- mpSdrFormTextAttribute->mnRefCount--;
- }
- else
- {
- delete mpSdrFormTextAttribute;
- }
}
bool SdrFormTextAttribute::isDefault() const
{
- return mpSdrFormTextAttribute == ImpSdrFormTextAttribute::get_global_default();
+ return mpSdrFormTextAttribute.same_object(theGlobalDefault::get());
}
SdrFormTextAttribute& SdrFormTextAttribute::operator=(const SdrFormTextAttribute& rCandidate)
{
- if(rCandidate.mpSdrFormTextAttribute != mpSdrFormTextAttribute)
- {
- if(mpSdrFormTextAttribute->mnRefCount)
- {
- mpSdrFormTextAttribute->mnRefCount--;
- }
- else
- {
- delete mpSdrFormTextAttribute;
- }
-
- mpSdrFormTextAttribute = rCandidate.mpSdrFormTextAttribute;
- mpSdrFormTextAttribute->mnRefCount++;
- }
-
+ mpSdrFormTextAttribute = rCandidate.mpSdrFormTextAttribute;
return *this;
}
bool SdrFormTextAttribute::operator==(const SdrFormTextAttribute& rCandidate) const
{
- if(rCandidate.mpSdrFormTextAttribute == mpSdrFormTextAttribute)
- {
- return true;
- }
-
+ // tdf#87509 default attr is always != non-default attr, even with same values
if(rCandidate.isDefault() != isDefault())
- {
return false;
- }
- return (*rCandidate.mpSdrFormTextAttribute == *mpSdrFormTextAttribute);
+ return rCandidate.mpSdrFormTextAttribute == mpSdrFormTextAttribute;
}
sal_Int32 SdrFormTextAttribute::getFormTextDistance() const
commit 551c204740a37c8dbc7acd35bc9fe683ade3fe80
Author: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Date: Sun May 24 11:53:59 2015 +0200
Fix tdf#87509 - default sdr attribute is special object.
The drawinglayer attributes signal defaultness by object identity, not
value equalness. That should fix a number of subtle cache and redraw
problems.
Change-Id: I049ffda228a48db71cef108571805c6e41e4b149
diff --git a/drawinglayer/source/attribute/fillgradientattribute.cxx b/drawinglayer/source/attribute/fillgradientattribute.cxx
index 2689d07..497817e 100644
--- a/drawinglayer/source/attribute/fillgradientattribute.cxx
+++ b/drawinglayer/source/attribute/fillgradientattribute.cxx
@@ -142,6 +142,10 @@ namespace drawinglayer
bool FillGradientAttribute::operator==(const FillGradientAttribute& rCandidate) const
{
+ // tdf#87509 default attr is always != non-default attr, even with same values
+ if(rCandidate.isDefault() != isDefault())
+ return false;
+
return rCandidate.mpFillGradientAttribute == mpFillGradientAttribute;
}
diff --git a/drawinglayer/source/attribute/fillgraphicattribute.cxx b/drawinglayer/source/attribute/fillgraphicattribute.cxx
index bd7b98e..89422be 100644
--- a/drawinglayer/source/attribute/fillgraphicattribute.cxx
+++ b/drawinglayer/source/attribute/fillgraphicattribute.cxx
@@ -120,6 +120,10 @@ namespace drawinglayer
bool FillGraphicAttribute::operator==(const FillGraphicAttribute& rCandidate) const
{
+ // tdf#87509 default attr is always != non-default attr, even with same values
+ if(rCandidate.isDefault() != isDefault())
+ return false;
+
return rCandidate.mpFillGraphicAttribute == mpFillGraphicAttribute;
}
diff --git a/drawinglayer/source/attribute/fillhatchattribute.cxx b/drawinglayer/source/attribute/fillhatchattribute.cxx
index 9e3adc7..f54db08 100644
--- a/drawinglayer/source/attribute/fillhatchattribute.cxx
+++ b/drawinglayer/source/attribute/fillhatchattribute.cxx
@@ -131,6 +131,10 @@ namespace drawinglayer
bool FillHatchAttribute::operator==(const FillHatchAttribute& rCandidate) const
{
+ // tdf#87509 default attr is always != non-default attr, even with same values
+ if(rCandidate.isDefault() != isDefault())
+ return false;
+
return rCandidate.mpFillHatchAttribute == mpFillHatchAttribute;
}
diff --git a/drawinglayer/source/attribute/lineattribute.cxx b/drawinglayer/source/attribute/lineattribute.cxx
index 6cf96e1..6d22e56 100644
--- a/drawinglayer/source/attribute/lineattribute.cxx
+++ b/drawinglayer/source/attribute/lineattribute.cxx
@@ -118,6 +118,10 @@ namespace drawinglayer
bool LineAttribute::operator==(const LineAttribute& rCandidate) const
{
+ // tdf#87509 default attr is always != non-default attr, even with same values
+ if(rCandidate.isDefault() != isDefault())
+ return false;
+
return rCandidate.mpLineAttribute == mpLineAttribute;
}
diff --git a/drawinglayer/source/attribute/linestartendattribute.cxx b/drawinglayer/source/attribute/linestartendattribute.cxx
index f11e66f..f3a0822 100644
--- a/drawinglayer/source/attribute/linestartendattribute.cxx
+++ b/drawinglayer/source/attribute/linestartendattribute.cxx
@@ -110,6 +110,10 @@ namespace drawinglayer
bool LineStartEndAttribute::operator==(const LineStartEndAttribute& rCandidate) const
{
+ // tdf#87509 default attr is always != non-default attr, even with same values
+ if(rCandidate.isDefault() != isDefault())
+ return false;
+
return rCandidate.mpLineStartEndAttribute == mpLineStartEndAttribute;
}
diff --git a/drawinglayer/source/attribute/sdrfillattribute.cxx b/drawinglayer/source/attribute/sdrfillattribute.cxx
index aacfa87..2ad96fe 100644
--- a/drawinglayer/source/attribute/sdrfillattribute.cxx
+++ b/drawinglayer/source/attribute/sdrfillattribute.cxx
@@ -126,6 +126,10 @@ namespace drawinglayer
bool SdrFillAttribute::operator==(const SdrFillAttribute& rCandidate) const
{
+ // tdf#87509 default attr is always != non-default attr, even with same values
+ if(rCandidate.isDefault() != isDefault())
+ return false;
+
return rCandidate.mpSdrFillAttribute == mpSdrFillAttribute;
}
diff --git a/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx b/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx
index 4ad7cdb..ea7e691 100644
--- a/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx
+++ b/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx
@@ -161,6 +161,10 @@ namespace drawinglayer
bool SdrFillGraphicAttribute::operator==(const SdrFillGraphicAttribute& rCandidate) const
{
+ // tdf#87509 default attr is always != non-default attr, even with same values
+ if(rCandidate.isDefault() != isDefault())
+ return false;
+
return rCandidate.mpSdrFillGraphicAttribute == mpSdrFillGraphicAttribute;
}
diff --git a/drawinglayer/source/attribute/sdrlightingattribute3d.cxx b/drawinglayer/source/attribute/sdrlightingattribute3d.cxx
index 9e3f809..43b4b94 100644
--- a/drawinglayer/source/attribute/sdrlightingattribute3d.cxx
+++ b/drawinglayer/source/attribute/sdrlightingattribute3d.cxx
@@ -102,6 +102,10 @@ namespace drawinglayer
bool SdrLightingAttribute::operator==(const SdrLightingAttribute& rCandidate) const
{
+ // tdf#87509 default attr is always != non-default attr, even with same values
+ if(rCandidate.isDefault() != isDefault())
+ return false;
+
return rCandidate.mpSdrLightingAttribute == mpSdrLightingAttribute;
}
diff --git a/drawinglayer/source/attribute/sdrlineattribute.cxx b/drawinglayer/source/attribute/sdrlineattribute.cxx
index 5afcac0..f1842fa 100644
--- a/drawinglayer/source/attribute/sdrlineattribute.cxx
+++ b/drawinglayer/source/attribute/sdrlineattribute.cxx
@@ -142,6 +142,10 @@ namespace drawinglayer
bool SdrLineAttribute::operator==(const SdrLineAttribute& rCandidate) const
{
+ // tdf#87509 default attr is always != non-default attr, even with same values
+ if(rCandidate.isDefault() != isDefault())
+ return false;
+
return rCandidate.mpSdrLineAttribute == mpSdrLineAttribute;
}
diff --git a/drawinglayer/source/attribute/sdrlinestartendattribute.cxx b/drawinglayer/source/attribute/sdrlinestartendattribute.cxx
index 20aa45d..b64f98c 100644
--- a/drawinglayer/source/attribute/sdrlinestartendattribute.cxx
+++ b/drawinglayer/source/attribute/sdrlinestartendattribute.cxx
@@ -144,6 +144,10 @@ namespace drawinglayer
bool SdrLineStartEndAttribute::operator==(const SdrLineStartEndAttribute& rCandidate) const
{
+ // tdf#87509 default attr is always != non-default attr, even with same values
+ if(rCandidate.isDefault() != isDefault())
+ return false;
+
return rCandidate.mpSdrLineStartEndAttribute == mpSdrLineStartEndAttribute;
}
diff --git a/drawinglayer/source/attribute/sdrsceneattribute3d.cxx b/drawinglayer/source/attribute/sdrsceneattribute3d.cxx
index 5776d20..a873440 100644
--- a/drawinglayer/source/attribute/sdrsceneattribute3d.cxx
+++ b/drawinglayer/source/attribute/sdrsceneattribute3d.cxx
@@ -123,6 +123,10 @@ namespace drawinglayer
bool SdrSceneAttribute::operator==(const SdrSceneAttribute& rCandidate) const
{
+ // tdf#87509 default attr is always != non-default attr, even with same values
+ if(rCandidate.isDefault() != isDefault())
+ return false;
+
return rCandidate.mpSdrSceneAttribute == mpSdrSceneAttribute;
}
diff --git a/drawinglayer/source/attribute/sdrshadowattribute.cxx b/drawinglayer/source/attribute/sdrshadowattribute.cxx
index 9630593..907423a 100644
--- a/drawinglayer/source/attribute/sdrshadowattribute.cxx
+++ b/drawinglayer/source/attribute/sdrshadowattribute.cxx
@@ -109,6 +109,10 @@ namespace drawinglayer
bool SdrShadowAttribute::operator==(const SdrShadowAttribute& rCandidate) const
{
+ // tdf#87509 default attr is always != non-default attr, even with same values
+ if(rCandidate.isDefault() != isDefault())
+ return false;
+
return mpSdrShadowAttribute == rCandidate.mpSdrShadowAttribute;
}
diff --git a/drawinglayer/source/attribute/strokeattribute.cxx b/drawinglayer/source/attribute/strokeattribute.cxx
index 08445b0..efbcc5d 100644
--- a/drawinglayer/source/attribute/strokeattribute.cxx
+++ b/drawinglayer/source/attribute/strokeattribute.cxx
@@ -110,6 +110,10 @@ namespace drawinglayer
bool StrokeAttribute::operator==(const StrokeAttribute& rCandidate) const
{
+ // tdf#87509 default attr is always != non-default attr, even with same values
+ if(rCandidate.isDefault() != isDefault())
+ return false;
+
return rCandidate.mpStrokeAttribute == mpStrokeAttribute;
}
More information about the Libreoffice-commits
mailing list