diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-19 11:10:43 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-19 12:23:46 +0200 |
commit | 2ee60f02c456f39a80edb2dbfed48c3e0147a7f7 (patch) | |
tree | ca4b9c95c2c1f28dcfd4ecb3307015c7f82603b9 /drawinglayer/source/geometry | |
parent | 9df2821e61979dab32390d5c64dd49bee868adbb (diff) |
loplugin:flatten in drawinglayer
Change-Id: Ieb5f682ec627c8d8ddfc286ec0e4422104b4d847
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92494
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'drawinglayer/source/geometry')
-rw-r--r-- | drawinglayer/source/geometry/viewinformation2d.cxx | 107 | ||||
-rw-r--r-- | drawinglayer/source/geometry/viewinformation3d.cxx | 164 |
2 files changed, 135 insertions, 136 deletions
diff --git a/drawinglayer/source/geometry/viewinformation2d.cxx b/drawinglayer/source/geometry/viewinformation2d.cxx index a88757416b1b..08a88b23d564 100644 --- a/drawinglayer/source/geometry/viewinformation2d.cxx +++ b/drawinglayer/source/geometry/viewinformation2d.cxx @@ -86,66 +86,65 @@ protected: void impInterpretPropertyValues(const uno::Sequence<beans::PropertyValue>& rViewParameters) { - if (rViewParameters.hasElements()) + if (!rViewParameters.hasElements()) + return; + + const sal_Int32 nCount(rViewParameters.getLength()); + sal_Int32 nExtendedInsert(0); + + // prepare extended information for filtering. Maximum size is nCount + mxExtendedInformation.realloc(nCount); + + for (sal_Int32 a(0); a < nCount; a++) { - const sal_Int32 nCount(rViewParameters.getLength()); - sal_Int32 nExtendedInsert(0); + const beans::PropertyValue& rProp = rViewParameters[a]; - // prepare extended information for filtering. Maximum size is nCount - mxExtendedInformation.realloc(nCount); + if (rProp.Name == g_PropertyName_ReducedDisplayQuality) + { + // extra information; add to filtered information + mxExtendedInformation[nExtendedInsert++] = rProp; - for (sal_Int32 a(0); a < nCount; a++) + // for performance reasons, also cache content locally + bool bSalBool(false); + rProp.Value >>= bSalBool; + mbReducedDisplayQuality = bSalBool; + } + else if (rProp.Name == g_PropertyName_ObjectTransformation) { - const beans::PropertyValue& rProp = rViewParameters[a]; - - if (rProp.Name == g_PropertyName_ReducedDisplayQuality) - { - // extra information; add to filtered information - mxExtendedInformation[nExtendedInsert++] = rProp; - - // for performance reasons, also cache content locally - bool bSalBool(false); - rProp.Value >>= bSalBool; - mbReducedDisplayQuality = bSalBool; - } - else if (rProp.Name == g_PropertyName_ObjectTransformation) - { - css::geometry::AffineMatrix2D aAffineMatrix2D; - rProp.Value >>= aAffineMatrix2D; - basegfx::unotools::homMatrixFromAffineMatrix(maObjectTransformation, - aAffineMatrix2D); - } - else if (rProp.Name == g_PropertyName_ViewTransformation) - { - css::geometry::AffineMatrix2D aAffineMatrix2D; - rProp.Value >>= aAffineMatrix2D; - basegfx::unotools::homMatrixFromAffineMatrix(maViewTransformation, - aAffineMatrix2D); - } - else if (rProp.Name == g_PropertyName_Viewport) - { - css::geometry::RealRectangle2D aViewport; - rProp.Value >>= aViewport; - maViewport = basegfx::unotools::b2DRectangleFromRealRectangle2D(aViewport); - } - else if (rProp.Name == g_PropertyName_Time) - { - rProp.Value >>= mfViewTime; - } - else if (rProp.Name == g_PropertyName_VisualizedPage) - { - rProp.Value >>= mxVisualizedPage; - } - else - { - // extra information; add to filtered information - mxExtendedInformation[nExtendedInsert++] = rProp; - } + css::geometry::AffineMatrix2D aAffineMatrix2D; + rProp.Value >>= aAffineMatrix2D; + basegfx::unotools::homMatrixFromAffineMatrix(maObjectTransformation, + aAffineMatrix2D); + } + else if (rProp.Name == g_PropertyName_ViewTransformation) + { + css::geometry::AffineMatrix2D aAffineMatrix2D; + rProp.Value >>= aAffineMatrix2D; + basegfx::unotools::homMatrixFromAffineMatrix(maViewTransformation, aAffineMatrix2D); + } + else if (rProp.Name == g_PropertyName_Viewport) + { + css::geometry::RealRectangle2D aViewport; + rProp.Value >>= aViewport; + maViewport = basegfx::unotools::b2DRectangleFromRealRectangle2D(aViewport); + } + else if (rProp.Name == g_PropertyName_Time) + { + rProp.Value >>= mfViewTime; + } + else if (rProp.Name == g_PropertyName_VisualizedPage) + { + rProp.Value >>= mxVisualizedPage; + } + else + { + // extra information; add to filtered information + mxExtendedInformation[nExtendedInsert++] = rProp; } - - // extra information size is now known; realloc to final size - mxExtendedInformation.realloc(nExtendedInsert); } + + // extra information size is now known; realloc to final size + mxExtendedInformation.realloc(nExtendedInsert); } void impFillViewInformationFromContent() diff --git a/drawinglayer/source/geometry/viewinformation3d.cxx b/drawinglayer/source/geometry/viewinformation3d.cxx index f59a88fa0071..b3e75bffa6dd 100644 --- a/drawinglayer/source/geometry/viewinformation3d.cxx +++ b/drawinglayer/source/geometry/viewinformation3d.cxx @@ -122,93 +122,93 @@ namespace drawinglayer::geometry // all ViewParameters using UNO API void impInterpretPropertyValues(const uno::Sequence< beans::PropertyValue >& rViewParameters) { - if(rViewParameters.hasElements()) - { - const sal_Int32 nCount(rViewParameters.getLength()); - sal_Int32 nExtendedInsert(0); + if(!rViewParameters.hasElements()) + return; + + const sal_Int32 nCount(rViewParameters.getLength()); + sal_Int32 nExtendedInsert(0); + + // prepare extended information for filtering. Maximum size is nCount + mxExtendedInformation.realloc(nCount); - // prepare extended information for filtering. Maximum size is nCount - mxExtendedInformation.realloc(nCount); + for(sal_Int32 a(0); a < nCount; a++) + { + const beans::PropertyValue& rProp = rViewParameters[a]; - for(sal_Int32 a(0); a < nCount; a++) + if(rProp.Name == getNamePropertyObjectTransformation()) { - const beans::PropertyValue& rProp = rViewParameters[a]; - - if(rProp.Name == getNamePropertyObjectTransformation()) - { - css::geometry::AffineMatrix3D aAffineMatrix3D; - rProp.Value >>= aAffineMatrix3D; - maObjectTransformation = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D); - } - else if(rProp.Name == getNamePropertyOrientation()) - { - css::geometry::AffineMatrix3D aAffineMatrix3D; - rProp.Value >>= aAffineMatrix3D; - maOrientation = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D); - } - else if(rProp.Name == getNamePropertyProjection()) - { - // 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, - // these four values need to be treated extra - const double f_30(maProjection.get(3, 0)); - const double f_31(maProjection.get(3, 1)); - const double f_32(maProjection.get(3, 2)); - const double f_33(maProjection.get(3, 3)); - - css::geometry::AffineMatrix3D aAffineMatrix3D; - rProp.Value >>= aAffineMatrix3D; - maProjection = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D); - - maProjection.set(3, 0, f_30); - maProjection.set(3, 1, f_31); - maProjection.set(3, 2, f_32); - maProjection.set(3, 3, f_33); - } - else if(rProp.Name == getNamePropertyProjection_30()) - { - double f_30(0.0); - rProp.Value >>= f_30; - maProjection.set(3, 0, f_30); - } - else if(rProp.Name == getNamePropertyProjection_31()) - { - double f_31(0.0); - rProp.Value >>= f_31; - maProjection.set(3, 1, f_31); - } - else if(rProp.Name == getNamePropertyProjection_32()) - { - double f_32(0.0); - rProp.Value >>= f_32; - maProjection.set(3, 2, f_32); - } - else if(rProp.Name == getNamePropertyProjection_33()) - { - double f_33(1.0); - rProp.Value >>= f_33; - maProjection.set(3, 3, f_33); - } - else if(rProp.Name == getNamePropertyDeviceToView()) - { - css::geometry::AffineMatrix3D aAffineMatrix3D; - rProp.Value >>= aAffineMatrix3D; - maDeviceToView = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D); - } - else if(rProp.Name == getNamePropertyTime()) - { - rProp.Value >>= mfViewTime; - } - else - { - // extra information; add to filtered information - mxExtendedInformation[nExtendedInsert++] = rProp; - } + css::geometry::AffineMatrix3D aAffineMatrix3D; + rProp.Value >>= aAffineMatrix3D; + maObjectTransformation = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D); + } + else if(rProp.Name == getNamePropertyOrientation()) + { + css::geometry::AffineMatrix3D aAffineMatrix3D; + rProp.Value >>= aAffineMatrix3D; + maOrientation = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D); + } + else if(rProp.Name == getNamePropertyProjection()) + { + // 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, + // these four values need to be treated extra + const double f_30(maProjection.get(3, 0)); + const double f_31(maProjection.get(3, 1)); + const double f_32(maProjection.get(3, 2)); + const double f_33(maProjection.get(3, 3)); + + css::geometry::AffineMatrix3D aAffineMatrix3D; + rProp.Value >>= aAffineMatrix3D; + maProjection = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D); + + maProjection.set(3, 0, f_30); + maProjection.set(3, 1, f_31); + maProjection.set(3, 2, f_32); + maProjection.set(3, 3, f_33); + } + else if(rProp.Name == getNamePropertyProjection_30()) + { + double f_30(0.0); + rProp.Value >>= f_30; + maProjection.set(3, 0, f_30); + } + else if(rProp.Name == getNamePropertyProjection_31()) + { + double f_31(0.0); + rProp.Value >>= f_31; + maProjection.set(3, 1, f_31); + } + else if(rProp.Name == getNamePropertyProjection_32()) + { + double f_32(0.0); + rProp.Value >>= f_32; + maProjection.set(3, 2, f_32); + } + else if(rProp.Name == getNamePropertyProjection_33()) + { + double f_33(1.0); + rProp.Value >>= f_33; + maProjection.set(3, 3, f_33); + } + else if(rProp.Name == getNamePropertyDeviceToView()) + { + css::geometry::AffineMatrix3D aAffineMatrix3D; + rProp.Value >>= aAffineMatrix3D; + maDeviceToView = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D); + } + else if(rProp.Name == getNamePropertyTime()) + { + rProp.Value >>= mfViewTime; + } + else + { + // extra information; add to filtered information + mxExtendedInformation[nExtendedInsert++] = rProp; } - - // extra information size is now known; realloc to final size - mxExtendedInformation.realloc(nExtendedInsert); } + + // extra information size is now known; realloc to final size + mxExtendedInformation.realloc(nExtendedInsert); } // central method to create a Sequence of PropertyValues containing he complete |