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.cxx103
1 files changed, 36 insertions, 67 deletions
diff --git a/drawinglayer/source/geometry/viewinformation3d.cxx b/drawinglayer/source/geometry/viewinformation3d.cxx
index f0d25bbb07fa..bfe601f976e8 100644
--- a/drawinglayer/source/geometry/viewinformation3d.cxx
+++ b/drawinglayer/source/geometry/viewinformation3d.cxx
@@ -22,8 +22,8 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/geometry/AffineMatrix3D.hpp>
#include <basegfx/utils/canvastools.hxx>
-#include <rtl/instance.hxx>
#include <com/sun/star/uno/Sequence.hxx>
+#include <utility>
using namespace com::sun::star;
@@ -70,50 +70,15 @@ namespace drawinglayer::geometry
uno::Sequence< beans::PropertyValue > mxExtendedInformation;
// the local UNO API strings
- static OUString getNamePropertyObjectTransformation()
- {
- return "ObjectTransformation";
- }
-
- static OUString getNamePropertyOrientation()
- {
- return "Orientation";
- }
-
- static OUString getNamePropertyProjection()
- {
- return "Projection";
- }
-
- static OUString getNamePropertyProjection_30()
- {
- return "Projection30";
- }
-
- static OUString getNamePropertyProjection_31()
- {
- return "Projection31";
- }
-
- static OUString getNamePropertyProjection_32()
- {
- return "Projection32";
- }
-
- static OUString getNamePropertyProjection_33()
- {
- return "Projection33";
- }
-
- static OUString getNamePropertyDeviceToView()
- {
- return "DeviceToView";
- }
-
- static OUString getNamePropertyTime()
- {
- return "Time";
- }
+ static constexpr OUString OBJECT_TRANSFORMATION = u"ObjectTransformation"_ustr;
+ static constexpr OUString ORIENTATION = u"Orientation"_ustr;
+ static constexpr OUString PROJECTION = u"Projection"_ustr;
+ static constexpr OUString PROJECTION30 = u"Projection30"_ustr;
+ static constexpr OUString PROJECTION31 = u"Projection31"_ustr;
+ static constexpr OUString PROJECTION32 = u"Projection32"_ustr;
+ static constexpr OUString PROJECTION33 = u"Projection33"_ustr;
+ static constexpr OUString DEVICE_TO_VIEW = u"DeviceToView"_ustr;
+ static constexpr OUString TIME = u"Time"_ustr;
// a central PropertyValue parsing method to allow transportation of
// all ViewParameters using UNO API
@@ -127,24 +92,25 @@ namespace drawinglayer::geometry
// prepare extended information for filtering. Maximum size is nCount
mxExtendedInformation.realloc(nCount);
+ auto pExtendedInformation = mxExtendedInformation.getArray();
for(sal_Int32 a(0); a < nCount; a++)
{
const beans::PropertyValue& rProp = rViewParameters[a];
- if(rProp.Name == getNamePropertyObjectTransformation())
+ if(rProp.Name == OBJECT_TRANSFORMATION)
{
css::geometry::AffineMatrix3D aAffineMatrix3D;
rProp.Value >>= aAffineMatrix3D;
maObjectTransformation = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D);
}
- else if(rProp.Name == getNamePropertyOrientation())
+ else if(rProp.Name == ORIENTATION)
{
css::geometry::AffineMatrix3D aAffineMatrix3D;
rProp.Value >>= aAffineMatrix3D;
maOrientation = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D);
}
- else if(rProp.Name == getNamePropertyProjection())
+ else if(rProp.Name == PROJECTION)
{
// projection may be defined using a frustum in which case the last line of
// the 4x4 matrix is not (0,0,0,1). Since AffineMatrix3D does not support that,
@@ -163,44 +129,44 @@ namespace drawinglayer::geometry
maProjection.set(3, 2, f_32);
maProjection.set(3, 3, f_33);
}
- else if(rProp.Name == getNamePropertyProjection_30())
+ else if(rProp.Name == PROJECTION30)
{
double f_30(0.0);
rProp.Value >>= f_30;
maProjection.set(3, 0, f_30);
}
- else if(rProp.Name == getNamePropertyProjection_31())
+ else if(rProp.Name == PROJECTION31)
{
double f_31(0.0);
rProp.Value >>= f_31;
maProjection.set(3, 1, f_31);
}
- else if(rProp.Name == getNamePropertyProjection_32())
+ else if(rProp.Name == PROJECTION32)
{
double f_32(0.0);
rProp.Value >>= f_32;
maProjection.set(3, 2, f_32);
}
- else if(rProp.Name == getNamePropertyProjection_33())
+ else if(rProp.Name == PROJECTION33)
{
double f_33(1.0);
rProp.Value >>= f_33;
maProjection.set(3, 3, f_33);
}
- else if(rProp.Name == getNamePropertyDeviceToView())
+ else if(rProp.Name == DEVICE_TO_VIEW)
{
css::geometry::AffineMatrix3D aAffineMatrix3D;
rProp.Value >>= aAffineMatrix3D;
maDeviceToView = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D);
}
- else if(rProp.Name == getNamePropertyTime())
+ else if(rProp.Name == TIME)
{
rProp.Value >>= mfViewTime;
}
else
{
// extra information; add to filtered information
- mxExtendedInformation[nExtendedInsert++] = rProp;
+ pExtendedInformation[nExtendedInsert++] = rProp;
}
}
@@ -210,16 +176,16 @@ namespace drawinglayer::geometry
public:
ImpViewInformation3D(
- const basegfx::B3DHomMatrix& rObjectTransformation,
- const basegfx::B3DHomMatrix& rOrientation,
- const basegfx::B3DHomMatrix& rProjection,
- const basegfx::B3DHomMatrix& rDeviceToView,
+ basegfx::B3DHomMatrix aObjectTransformation,
+ basegfx::B3DHomMatrix aOrientation,
+ basegfx::B3DHomMatrix aProjection,
+ basegfx::B3DHomMatrix aDeviceToView,
double fViewTime,
const uno::Sequence< beans::PropertyValue >& rExtendedParameters)
- : maObjectTransformation(rObjectTransformation),
- maOrientation(rOrientation),
- maProjection(rProjection),
- maDeviceToView(rDeviceToView),
+ : maObjectTransformation(std::move(aObjectTransformation)),
+ maOrientation(std::move(aOrientation)),
+ maProjection(std::move(aProjection)),
+ maDeviceToView(std::move(aDeviceToView)),
mfViewTime(fViewTime)
{
impInterpretPropertyValues(rExtendedParameters);
@@ -276,8 +242,11 @@ namespace drawinglayer::geometry
{
namespace
{
- struct theGlobalDefault :
- public rtl::Static< ViewInformation3D::ImplType, theGlobalDefault > {};
+ ViewInformation3D::ImplType& theGlobalDefault()
+ {
+ static ViewInformation3D::ImplType SINGLETON;
+ return SINGLETON;
+ }
}
ViewInformation3D::ViewInformation3D(
@@ -299,7 +268,7 @@ namespace drawinglayer::geometry
}
ViewInformation3D::ViewInformation3D()
- : mpViewInformation3D(theGlobalDefault::get())
+ : mpViewInformation3D(theGlobalDefault())
{
}
@@ -311,7 +280,7 @@ namespace drawinglayer::geometry
bool ViewInformation3D::isDefault() const
{
- return mpViewInformation3D.same_object(theGlobalDefault::get());
+ return mpViewInformation3D.same_object(theGlobalDefault());
}
ViewInformation3D& ViewInformation3D::operator=(const ViewInformation3D&) = default;