summaryrefslogtreecommitdiff
path: root/basegfx/source/matrix
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@cib.de (CIB)>2018-03-01 15:54:32 +0100
committerArmin Le Grand <Armin.Le.Grand@cib.de>2018-04-06 22:29:02 +0200
commit6c14c27c75a03e2363f2b363ddf0a6f2f46cfa91 (patch)
treee66f50adb222dbc1490b4df2d3c63541dad999ac /basegfx/source/matrix
parente1b247a843c5eb850fe0079819239d9883412d38 (diff)
SOSAW080: Added first bunch of basic changes to helpers
SOSAW080: Make SdrModel& prerequisite to SdrObjects Added need for SdrModel& in constructors of SdrModel, SdrPage, SdrView and SdrObjList. Builds, not finished. SOSAW080: removed and replaced old SdrModel Removed and replaced GetModel()/SetModel() in all using classes (SdrObject, SdrPage, SdrView), added accessors to new referenced SdrModel, adapted all accessing places. Refactored/Extended ::Clone and ::operator== for these classes to allow cloning objects to a target SdrModel. Adapted places where this is done AFAP. Added quite some comments (tagged with 'TTTT') where possible further work is needed. Builds completely, thus checking in. This does not mean that this change is done yet. SOSAW080: Adapted SdrPage/SdrModel relationship Also needed to work on copy-construction of SdrPage and hierarchy, quite some stuff removed, no copy-constructor anymore, no MigrateItemPool stuff. Builds well, test stuck, will need some cleanup/finetunung SOSAW080: Smaller corrections/includes adapted SOSAW080: Smaller corrections/includes adapted SOSAW080: Debugging/Stabilizing/MakeUnitTestWork SOSAW080: Stabilized for UnitTests, cleanups SOSAW080: Adapted GetObjGraphic to just take a const SdrObject& SOSAW080: Removed ChangeModel from classes Classes SvxTextEditSource and SvxDrawPage (including TextEditSource stuff) do not need change of SdrModel anymore. SOSAW080: Adapted some comments to make more readable SOSAW080: Corrected constructor SOSAW080: getSdrModelFromUnoModel added override marks SOSAW080: Added missing includes SOSAW080: Corrected SdrPage constructor SOSAW080: Corrected some SdrObject::Clone scenarios Especially when cloning to another SdrModel and taking the sdr::properties into account. SOSAW080: Added include for Mac-Build SOSAW080: Added Scale to DefaultProperties If a SdrModel change happens in DefaultProperties copy constructor (used from Clone()), potentially a Scale for the SfxItems has to be done. SOSAW080: Added missing include for MacBuild SOSAW080: Corrected CppunitTest_sc_anchor_test An adaption of a SdrPathObj instantiation was missing, added that. Seems as if that test is no tpart of the usual 'make' scenario, but used/executed in gerrit builds SOSAW080: Reworked SvxShape to use SdrObject's SdrModel SOSAW080: Reworked SvxShape to use SdrObject's SdrModel SOSAW080: Free SdrObjects when SdrModel goes down In an UNO API test problem is that SvxShapes reference SdrShapes, but these are not added to a SdrPage and not 'owned' by the SvxShape. Thus these do not get deleted at all (same in master, memory leak). I extended SvxShape::Notify the case for ModelCleared to also Free the SdrObject when not owner and it's not added to a SdrPage (in that case it gets deleted with deleting the SdrModel) SOSAW080: Solve UNO API calls that move SvxShapes to other Model Due to UNO API tests I got a call to insert an xShape to a xDrawPage which was constructed in another Model, this has now to be done by Cloning the SdrObject to the new SdrModel, getting rid of the old one and getting all the UNO implementation stuff right (referemces SdrObject <-> xShape). Change-Id: Iaf53535de0502a481466be74a1768bbb39f0e78c 1cb7d573d323e98a89761fe662c10c4a654fdec0 24617494a0ef79f6e33dfcb02782a833a81c6434 763f39094b6a48b529a6952d01468f8776c97679 242b9e228a9a042c3a5bdd38b1ea6600144276d5 242b9e228a9a042c3a5bdd38b1ea6600144276d5 33a6f3f306b70c223171aef796dd5ee041ad14df 6878b33f8b05738a44c0910e40a60a0f0d1d58ed 0a636caf3cb36c2f9c6cd11aa22cb9bc435dc8f2 8c4626274a5cc531dad27f27c0c45d4c528fb2fb 446685a49a6d67aedd01cfbbd5e87b07f97a4d7b c1b5ed3c99bc7219a0061e4ece24ea42afd2889a 22de9a1c8af7c25be5c108671ddc548ba323ed47 4caf6b6fbbe6e8130741d793dffb560fd01d4ed5 488b9601735ec1822433f82f633990063951fe08 c366d60299f239e3df856ddffedb19e743e4be0c c5137ba8c597c7b5f90318df50e87b93a39a28dc f9e646242cf89f6fde1315046952252a2c429779 f830fbc5fadd89d04be5edd2a5abf9b0d4bf0410 1694b54903df784385abaa8452e1201e12344238 17bcb44d2e29920c0c74430c2d9c703b36cfa0ad 17bcb44d2e29920c0c74430c2d9c703b36cfa0ad 7b5c241faec7488924e5935ae8b19f785846b5e4 bf097ee7467895823fbd158a2a9543da3b5a5078
Diffstat (limited to 'basegfx/source/matrix')
-rw-r--r--basegfx/source/matrix/b2dhommatrix.cxx15
-rw-r--r--basegfx/source/matrix/b3dhommatrix.cxx15
-rwxr-xr-xbasegfx/source/matrix/b3dhommatrixtools.cxx76
3 files changed, 106 insertions, 0 deletions
diff --git a/basegfx/source/matrix/b2dhommatrix.cxx b/basegfx/source/matrix/b2dhommatrix.cxx
index 9f7d5bff0156..466e9037d149 100644
--- a/basegfx/source/matrix/b2dhommatrix.cxx
+++ b/basegfx/source/matrix/b2dhommatrix.cxx
@@ -115,6 +115,11 @@ namespace basegfx
bool B2DHomMatrix::invert()
{
+ if(isIdentity())
+ {
+ return true;
+ }
+
Impl2DHomMatrix aWork(*mpImpl);
std::unique_ptr<sal_uInt16[]> pIndex( new sal_uInt16[Impl2DHomMatrix_Base::getEdgeLength()] );
sal_Int16 nParity;
@@ -213,6 +218,11 @@ namespace basegfx
}
}
+ void B2DHomMatrix::translate(const B2DTuple& rTuple)
+ {
+ translate(rTuple.getX(), rTuple.getY());
+ }
+
void B2DHomMatrix::scale(double fX, double fY)
{
const double fOne(1.0);
@@ -228,6 +238,11 @@ namespace basegfx
}
}
+ void B2DHomMatrix::scale(const B2DTuple& rTuple)
+ {
+ scale(rTuple.getX(), rTuple.getY());
+ }
+
void B2DHomMatrix::shearX(double fSx)
{
// #i76239# do not test against 1.0, but against 0.0. We are talking about a value not on the diagonal (!)
diff --git a/basegfx/source/matrix/b3dhommatrix.cxx b/basegfx/source/matrix/b3dhommatrix.cxx
index 6cfd054992ec..b55dd079b514 100644
--- a/basegfx/source/matrix/b3dhommatrix.cxx
+++ b/basegfx/source/matrix/b3dhommatrix.cxx
@@ -203,6 +203,11 @@ namespace basegfx
}
}
+ void B3DHomMatrix::rotate(const B3DTuple& rRotation)
+ {
+ rotate(rRotation.getX(), rRotation.getY(), rRotation.getZ());
+ }
+
void B3DHomMatrix::translate(double fX, double fY, double fZ)
{
if(!fTools::equalZero(fX) || !fTools::equalZero(fY) || !fTools::equalZero(fZ))
@@ -217,6 +222,11 @@ namespace basegfx
}
}
+ void B3DHomMatrix::translate(const B3DTuple& rRotation)
+ {
+ translate(rRotation.getX(), rRotation.getY(), rRotation.getZ());
+ }
+
void B3DHomMatrix::scale(double fX, double fY, double fZ)
{
const double fOne(1.0);
@@ -233,6 +243,11 @@ namespace basegfx
}
}
+ void B3DHomMatrix::scale(const B3DTuple& rRotation)
+ {
+ scale(rRotation.getX(), rRotation.getY(), rRotation.getZ());
+ }
+
void B3DHomMatrix::shearXY(double fSx, double fSy)
{
// #i76239# do not test against 1.0, but against 0.0. We are talking about a value not on the diagonal (!)
diff --git a/basegfx/source/matrix/b3dhommatrixtools.cxx b/basegfx/source/matrix/b3dhommatrixtools.cxx
new file mode 100755
index 000000000000..677c978545ee
--- /dev/null
+++ b/basegfx/source/matrix/b3dhommatrixtools.cxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <basegfx/matrix/b3dhommatrixtools.hxx>
+
+namespace basegfx
+{
+ namespace utils
+ {
+ B3DHomMatrix UnoHomogenMatrixToB3DHomMatrix(
+ const com::sun::star::drawing::HomogenMatrix& rMatrixIn)
+ {
+ B3DHomMatrix aRetval;
+
+ aRetval.set(0, 0, rMatrixIn.Line1.Column1);
+ aRetval.set(0, 1, rMatrixIn.Line1.Column2);
+ aRetval.set(0, 2, rMatrixIn.Line1.Column3);
+ aRetval.set(0, 3, rMatrixIn.Line1.Column4);
+ aRetval.set(1, 0, rMatrixIn.Line2.Column1);
+ aRetval.set(1, 1, rMatrixIn.Line2.Column2);
+ aRetval.set(1, 2, rMatrixIn.Line2.Column3);
+ aRetval.set(1, 3, rMatrixIn.Line2.Column4);
+ aRetval.set(2, 0, rMatrixIn.Line3.Column1);
+ aRetval.set(2, 1, rMatrixIn.Line3.Column2);
+ aRetval.set(2, 2, rMatrixIn.Line3.Column3);
+ aRetval.set(2, 3, rMatrixIn.Line3.Column4);
+ aRetval.set(3, 0, rMatrixIn.Line4.Column1);
+ aRetval.set(3, 1, rMatrixIn.Line4.Column2);
+ aRetval.set(3, 2, rMatrixIn.Line4.Column3);
+ aRetval.set(3, 3, rMatrixIn.Line4.Column4);
+
+ return aRetval;
+ }
+
+ void B3DHomMatrixToUnoHomogenMatrix(
+ const B3DHomMatrix& rMatrixIn,
+ com::sun::star::drawing::HomogenMatrix& rMatrixOut)
+ {
+ rMatrixOut.Line1.Column1 = rMatrixIn.get(0, 0);
+ rMatrixOut.Line1.Column2 = rMatrixIn.get(0, 1);
+ rMatrixOut.Line1.Column3 = rMatrixIn.get(0, 2);
+ rMatrixOut.Line1.Column4 = rMatrixIn.get(0, 3);
+ rMatrixOut.Line2.Column1 = rMatrixIn.get(1, 0);
+ rMatrixOut.Line2.Column2 = rMatrixIn.get(1, 1);
+ rMatrixOut.Line2.Column3 = rMatrixIn.get(1, 2);
+ rMatrixOut.Line2.Column4 = rMatrixIn.get(1, 3);
+ rMatrixOut.Line3.Column1 = rMatrixIn.get(2, 0);
+ rMatrixOut.Line3.Column2 = rMatrixIn.get(2, 1);
+ rMatrixOut.Line3.Column3 = rMatrixIn.get(2, 2);
+ rMatrixOut.Line3.Column4 = rMatrixIn.get(2, 3);
+ rMatrixOut.Line4.Column1 = rMatrixIn.get(3, 0);
+ rMatrixOut.Line4.Column2 = rMatrixIn.get(3, 1);
+ rMatrixOut.Line4.Column3 = rMatrixIn.get(3, 2);
+ rMatrixOut.Line4.Column4 = rMatrixIn.get(3, 3);
+ }
+
+ } // end of namespace tools
+} // end of namespace basegfx
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */