summaryrefslogtreecommitdiff
path: root/drawinglayer/source/geometry/viewinformation3d.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'drawinglayer/source/geometry/viewinformation3d.cxx')
-rw-r--r--drawinglayer/source/geometry/viewinformation3d.cxx47
1 files changed, 46 insertions, 1 deletions
diff --git a/drawinglayer/source/geometry/viewinformation3d.cxx b/drawinglayer/source/geometry/viewinformation3d.cxx
index b884c359d0..316d2e4d52 100644
--- a/drawinglayer/source/geometry/viewinformation3d.cxx
+++ b/drawinglayer/source/geometry/viewinformation3d.cxx
@@ -387,6 +387,18 @@ namespace drawinglayer
impInterpretPropertyValues(rViewParameters);
}
+ ImpViewInformation3D()
+ : mnRefCount(0),
+ maObjectTransformation(),
+ maOrientation(),
+ maProjection(),
+ maDeviceToView(),
+ mfViewTime(),
+ mxViewInformation(),
+ mxExtendedInformation()
+ {
+ }
+
const basegfx::B3DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
const basegfx::B3DHomMatrix& getOrientation() const { return maOrientation; }
const basegfx::B3DHomMatrix& getProjection() const { return maProjection; }
@@ -432,6 +444,21 @@ namespace drawinglayer
&& mfViewTime == rCandidate.mfViewTime
&& mxExtendedInformation == rCandidate.mxExtendedInformation);
}
+
+ static ImpViewInformation3D* get_global_default()
+ {
+ static ImpViewInformation3D* pDefault = 0;
+
+ if(!pDefault)
+ {
+ pDefault = new ImpViewInformation3D();
+
+ // never delete; start with RefCount 1, not 0
+ pDefault->mnRefCount++;
+ }
+
+ return pDefault;
+ }
};
} // end of anonymous namespace
} // end of namespace drawinglayer
@@ -449,7 +476,9 @@ namespace drawinglayer
const basegfx::B3DHomMatrix& rDeviceToView,
double fViewTime,
const uno::Sequence< beans::PropertyValue >& rExtendedParameters)
- : mpViewInformation3D(new ImpViewInformation3D(rObjectObjectTransformation, rOrientation, rProjection, rDeviceToView, fViewTime, rExtendedParameters))
+ : mpViewInformation3D(new ImpViewInformation3D(
+ rObjectObjectTransformation, rOrientation, rProjection,
+ rDeviceToView, fViewTime, rExtendedParameters))
{
}
@@ -458,6 +487,12 @@ namespace drawinglayer
{
}
+ ViewInformation3D::ViewInformation3D()
+ : mpViewInformation3D(ImpViewInformation3D::get_global_default())
+ {
+ mpViewInformation3D->mnRefCount++;
+ }
+
ViewInformation3D::ViewInformation3D(const ViewInformation3D& rCandidate)
: mpViewInformation3D(rCandidate.mpViewInformation3D)
{
@@ -479,6 +514,11 @@ namespace drawinglayer
}
}
+ bool ViewInformation3D::isDefault() const
+ {
+ return mpViewInformation3D == ImpViewInformation3D::get_global_default();
+ }
+
ViewInformation3D& ViewInformation3D::operator=(const ViewInformation3D& rCandidate)
{
::osl::Mutex m_mutex;
@@ -505,6 +545,11 @@ namespace drawinglayer
return true;
}
+ if(rCandidate.isDefault() != isDefault())
+ {
+ return false;
+ }
+
return (*rCandidate.mpViewInformation3D == *mpViewInformation3D);
}