dbaccess/source/core/dataaccess/ComponentDefinition.hxx | 4 - dbaccess/source/core/dataaccess/ModelImpl.cxx | 2 dbaccess/source/core/dataaccess/commanddefinition.cxx | 2 dbaccess/source/core/inc/definitioncontainer.hxx | 4 - oox/source/drawingml/shape.cxx | 8 +-- reportdesign/source/core/api/ReportDefinition.cxx | 2 reportdesign/source/ui/report/ReportSection.cxx | 2 sc/source/filter/excel/xiescher.cxx | 2 svx/qa/unit/customshapes.cxx | 34 ++++++++++++++ svx/qa/unit/data/tdf127785_TextRotateAngle.odp |binary svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx | 23 ++++----- sw/source/ui/dbui/mmresultdialogs.cxx | 2 sw/source/uibase/inc/mailmergewizard.hxx | 2 13 files changed, 59 insertions(+), 28 deletions(-)
New commits: commit 5e68f0e2a13cc21f95a875cf694e926e01642050 Author: Regina Henschel <[email protected]> AuthorDate: Sat Oct 5 22:52:42 2019 +0200 Commit: Regina Henschel <[email protected]> CommitDate: Wed Oct 9 20:43:38 2019 +0200 tdf#127785 Apply 180deg compensation for flipV to text range If a shape is vertically flipped, then the text is rotated by 180deg around the shape center. The rotation is done by SdrTextObj, where text rectangle and shape rectangle are the same, so the rotated text rectangle has the correct position despite flipping. But the text rectangle for SdrObjCustomShape is set by the shape author in the TextFrames attribute and might have an asymmetric position. The patch compensates the flip-rotation by pre-rotate the text rectangle. This replaces commit caaa8fe7c4bb88185b5b11591ee8a619cff0eced. The error in the old patch was, that it has uses a translation instead of a rotation, and has used a wrong place. The result was, that a text box, which has an own TextRotateAngle, had got a wrong position. Change-Id: Id38e8c1839afa5091cd251fc5237315ba7944263 Reviewed-on: https://gerrit.libreoffice.org/80310 Reviewed-by: Regina Henschel <[email protected]> Tested-by: Regina Henschel <[email protected]> Reviewed-by: Thorsten Behrens <[email protected]> diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx index c1090f87109d..4a1f3cb39c46 100644 --- a/svx/qa/unit/customshapes.cxx +++ b/svx/qa/unit/customshapes.cxx @@ -539,6 +539,40 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf127785_Asymmetric) CPPUNIT_ASSERT_EQUAL(OUString(), sErrors); } + +CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf127785_TextRotateAngle) +{ + // The document contains a shapes with vertical flip and a text frame with own + // rotate angle. The shape has not stroke and no fill, so that the bounding box + // surrounds the text and therefore equals approximately the text frame. + // Error was, that the compensation for the 180° rotation added for vertical + // flip were not made to the text box position but to the text matrix. + const OUString sFileName("tdf127785_TextRotateAngle.odp"); + OUString sURL = m_directories.getURLFromSrc(sDataDirectory) + sFileName; + mxComponent = loadFromDesktop(sURL, "com.sun.star.comp.drawing.DrawingDocument"); + CPPUNIT_ASSERT_MESSAGE("Could not load document", mxComponent.is()); + OUString sErrors; // sErrors collects the errors and should be empty in case all is OK. + + uno::Reference<drawing::XShape> xShape(getShape(0)); + uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY); + CPPUNIT_ASSERT_MESSAGE("Could not get the shape properties", xShapeProps.is()); + awt::Rectangle aBoundRect; + xShapeProps->getPropertyValue(UNO_NAME_MISC_OBJ_BOUNDRECT) >>= aBoundRect; + const sal_Int32 nLeft = aBoundRect.X; + const sal_Int32 nTop = aBoundRect.Y; + const sal_Int32 nRight = aBoundRect.X + aBoundRect.Width - 1; + const sal_Int32 nBottom = aBoundRect.Y + aBoundRect.Height - 1; + if (abs(nLeft - 5054) > 5) + sErrors += "wrong left"; + if (abs(nRight - 6374) > 5) + sErrors += " wrong right"; + if (abs(nTop - 4516) > 5) + sErrors += " wrong top"; + if (abs(nBottom - 8930) > 5) + sErrors += " wrong bottom"; + + CPPUNIT_ASSERT_EQUAL(OUString(), sErrors); +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/qa/unit/data/tdf127785_TextRotateAngle.odp b/svx/qa/unit/data/tdf127785_TextRotateAngle.odp new file mode 100644 index 000000000000..742f12d4d941 Binary files /dev/null and b/svx/qa/unit/data/tdf127785_TextRotateAngle.odp differ diff --git a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx index 08771194e109..ada854fd5503 100644 --- a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx @@ -94,6 +94,16 @@ namespace sdr aTextRange.getMinX() + aTranslation.getX(), aTextRange.getMinY() + aTranslation.getY(), aTextRange.getMaxX() + aTranslation.getX(), aTextRange.getMaxY() + aTranslation.getY()); } + + // NbcMirror() of SdrTextObj (from which SdrObjCustomShape is derived), adds a + // 180deg rotation around the shape center to GeoStat.nRotationAngle. So remove here the + // 180° rotation, which was added by GetTextBounds(). + if(GetCustomShapeObj().IsMirroredY()) + { + basegfx::B2DHomMatrix aRotMatrix(basegfx::utils::createRotateAroundPoint( + aObjectRange.getCenterX(), aObjectRange.getCenterY(), F_PI)); + aTextRange.transform(aRotMatrix); + } } return aTextRange; @@ -168,19 +178,6 @@ namespace sdr // give text object a size aTextBoxMatrix.scale(aTextRange.getWidth(), aTextRange.getHeight()); - // NbcMirror() of SdrTextObj (from which SdrObjCustomShape is derived), adds a - // 180deg rotation around the shape center to the text box. If aTextRange differs - // from aObjectRange, that is not the position needed for mirroring. We - // translate the text box here so, that it is at the correct position after rotation. - if(GetCustomShapeObj().IsMirroredY()) - { - aTextBoxMatrix.translate( - aObjectRange.getWidth() - aTextRange.getWidth() - - 2 * (aTextRange.getMinX() - aObjectRange.getMinimum().getX()), - aObjectRange.getHeight() - aTextRange.getHeight() - - 2 * (aTextRange.getMinY() - aObjectRange.getMinimum().getY())); - } - // check if we have a rotation/shear at all to take care of const double fExtraTextRotation(GetCustomShapeObj().GetExtraTextRotation()); const GeoStat& rGeoStat(GetCustomShapeObj().GetGeoStat()); commit 7d361e96c9ea822790db21806e9fc05279423833 Author: Stephan Bergmann <[email protected]> AuthorDate: Wed Oct 9 16:39:32 2019 +0200 Commit: Stephan Bergmann <[email protected]> CommitDate: Wed Oct 9 20:42:44 2019 +0200 loplugin:redundantpointerops (All related to uses of std::shared_ptr, which builds against libstdc++ apparently missed (fix forthcoming) and which I only now found with my macOS build against libc++.) Change-Id: If581e689f0e5ff62d9ce35513c9ff87b00328766 Reviewed-on: https://gerrit.libreoffice.org/80548 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <[email protected]> diff --git a/dbaccess/source/core/dataaccess/ComponentDefinition.hxx b/dbaccess/source/core/dataaccess/ComponentDefinition.hxx index e71b5fe535a9..02e40390ed7f 100644 --- a/dbaccess/source/core/dataaccess/ComponentDefinition.hxx +++ b/dbaccess/source/core/dataaccess/ComponentDefinition.hxx @@ -93,8 +93,8 @@ protected: virtual ~OComponentDefinition() override; virtual void SAL_CALL disposing() override; - const OComponentDefinition_Impl& getDefinition() const { return dynamic_cast< const OComponentDefinition_Impl& >( *m_pImpl.get() ); } - OComponentDefinition_Impl& getDefinition() { return dynamic_cast< OComponentDefinition_Impl& >( *m_pImpl.get() ); } + const OComponentDefinition_Impl& getDefinition() const { return dynamic_cast< const OComponentDefinition_Impl& >( *m_pImpl ); } + OComponentDefinition_Impl& getDefinition() { return dynamic_cast< OComponentDefinition_Impl& >( *m_pImpl ); } public: OComponentDefinition( const css::uno::Reference< css::uno::XComponentContext >&, diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx index 9958b6c0e995..2912c625c465 100644 --- a/dbaccess/source/core/dataaccess/ModelImpl.cxx +++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx @@ -511,7 +511,7 @@ namespace { bool bSomeDocHasMacros = false; - const OContentHelper_Impl& rContainerData( *_rModel.getObjectContainer( _eType ).get() ); + const OContentHelper_Impl& rContainerData( *_rModel.getObjectContainer( _eType ) ); const ODefinitionContainer_Impl& rObjectDefinitions = dynamic_cast< const ODefinitionContainer_Impl& >( rContainerData ); try diff --git a/dbaccess/source/core/dataaccess/commanddefinition.cxx b/dbaccess/source/core/dataaccess/commanddefinition.cxx index f93f7d4d3346..4781146f8bed 100644 --- a/dbaccess/source/core/dataaccess/commanddefinition.cxx +++ b/dbaccess/source/core/dataaccess/commanddefinition.cxx @@ -37,7 +37,7 @@ namespace dbaccess void OCommandDefinition::registerProperties() { - OCommandDefinition_Impl& rCommandDefinition = dynamic_cast< OCommandDefinition_Impl& >( *m_pImpl.get() ); + OCommandDefinition_Impl& rCommandDefinition = dynamic_cast< OCommandDefinition_Impl& >( *m_pImpl ); registerProperty(PROPERTY_COMMAND, PROPERTY_ID_COMMAND, PropertyAttribute::BOUND, &rCommandDefinition.m_sCommand, cppu::UnoType<decltype(rCommandDefinition.m_sCommand)>::get()); diff --git a/dbaccess/source/core/inc/definitioncontainer.hxx b/dbaccess/source/core/inc/definitioncontainer.hxx index e36f90de1eb8..da58ff9daf7d 100644 --- a/dbaccess/source/core/inc/definitioncontainer.hxx +++ b/dbaccess/source/core/inc/definitioncontainer.hxx @@ -144,12 +144,12 @@ protected: const ODefinitionContainer_Impl& getDefinitions() const { - return dynamic_cast< const ODefinitionContainer_Impl& >( *m_pImpl.get() ); + return dynamic_cast< const ODefinitionContainer_Impl& >( *m_pImpl ); } ODefinitionContainer_Impl& getDefinitions() { - return dynamic_cast< ODefinitionContainer_Impl& >( *m_pImpl.get() ); + return dynamic_cast< ODefinitionContainer_Impl& >( *m_pImpl ); } public: /** constructs the container. diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index eba300fc89d5..be8153ef155a 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -327,16 +327,16 @@ void Shape::applyShapeReference( const Shape& rReferencedShape, bool bUseText ) SAL_INFO("oox.drawingml", "Shape::applyShapeReference: apply '" << rReferencedShape.msId << "' to '" << msId << "'"); if ( rReferencedShape.mpTextBody.get() && bUseText ) - mpTextBody = std::make_shared<TextBody>( *rReferencedShape.mpTextBody.get() ); + mpTextBody = std::make_shared<TextBody>( *rReferencedShape.mpTextBody ); else mpTextBody.reset(); maShapeProperties = rReferencedShape.maShapeProperties; mpShapeRefLinePropPtr = std::make_shared<LineProperties>( rReferencedShape.getActualLineProperties(nullptr) ); mpShapeRefFillPropPtr = std::make_shared<FillProperties>( rReferencedShape.getActualFillProperties(nullptr, nullptr) ); - mpCustomShapePropertiesPtr = std::make_shared<CustomShapeProperties>( *rReferencedShape.mpCustomShapePropertiesPtr.get() ); - mpTablePropertiesPtr = table::TablePropertiesPtr( rReferencedShape.mpTablePropertiesPtr.get() ? new table::TableProperties( *rReferencedShape.mpTablePropertiesPtr.get() ) : nullptr ); + mpCustomShapePropertiesPtr = std::make_shared<CustomShapeProperties>( *rReferencedShape.mpCustomShapePropertiesPtr ); + mpTablePropertiesPtr = table::TablePropertiesPtr( rReferencedShape.mpTablePropertiesPtr.get() ? new table::TableProperties( *rReferencedShape.mpTablePropertiesPtr ) : nullptr ); mpShapeRefEffectPropPtr = std::make_shared<EffectProperties>( rReferencedShape.getActualEffectProperties(nullptr) ); - mpMasterTextListStyle = std::make_shared<TextListStyle>( *rReferencedShape.mpMasterTextListStyle.get() ); + mpMasterTextListStyle = std::make_shared<TextListStyle>( *rReferencedShape.mpMasterTextListStyle ); maSize = rReferencedShape.maSize; maPosition = rReferencedShape.maPosition; mnRotation = rReferencedShape.mnRotation; diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx index 166e58eea05f..a051e20ea484 100644 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ b/reportdesign/source/core/api/ReportDefinition.cxx @@ -1988,7 +1988,7 @@ std::shared_ptr<rptui::OReportModel> OReportDefinition::getSdrModel(const uno::R SdrModel& OReportDefinition::getSdrModelFromUnoModel() const { OSL_ENSURE(m_pImpl->m_pReportModel.get(), "No SdrModel in ReportDesign, should not happen"); - return *m_pImpl->m_pReportModel.get(); + return *m_pImpl->m_pReportModel; } uno::Reference< uno::XInterface > SAL_CALL OReportDefinition::createInstanceWithArguments( const OUString& aServiceSpecifier, const uno::Sequence< uno::Any >& _aArgs) diff --git a/reportdesign/source/ui/report/ReportSection.cxx b/reportdesign/source/ui/report/ReportSection.cxx index 6c8b6af013ab..84236084c00d 100644 --- a/reportdesign/source/ui/report/ReportSection.cxx +++ b/reportdesign/source/ui/report/ReportSection.cxx @@ -259,7 +259,7 @@ void OReportSection::Paste(const uno::Sequence< beans::NamedValue >& _aAllreadyC if ( pObject ) { // Clone to target SdrModel - SdrObject* pNewObj(pObject->CloneSdrObject(*m_pModel.get())); + SdrObject* pNewObj(pObject->CloneSdrObject(*m_pModel)); m_pPage->InsertObject(pNewObj, SAL_MAX_SIZE); tools::Rectangle aRet(VCLPoint(rCopy->getPosition()),VCLSize(rCopy->getSize())); aRet.setHeight(aRet.getHeight() + 1); diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index 0866ca17a20d..bd88c7e2224c 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -2348,7 +2348,7 @@ void XclImpOptionButtonObj::DoProcessControl( ScfPropertySet& rPropSet ) const if ( pLeader->HasCellLink() && !pTbxObj->HasCellLink() ) { // propagate cell link info - pTbxObj->mxCellLink.reset( new ScAddress( *pLeader->mxCellLink.get() ) ); + pTbxObj->mxCellLink.reset( new ScAddress( *pLeader->mxCellLink ) ); pTbxObj->ApplySheetLinkProps(); } pTbxObj = dynamic_cast< XclImpOptionButtonObj* >( GetObjectManager().GetSheetDrawing( GetTab() ).FindDrawObj( pTbxObj->mnNextInGroup ).get() ); diff --git a/sw/source/ui/dbui/mmresultdialogs.cxx b/sw/source/ui/dbui/mmresultdialogs.cxx index b55fb24df596..6920fee3fe1c 100644 --- a/sw/source/ui/dbui/mmresultdialogs.cxx +++ b/sw/source/ui/dbui/mmresultdialogs.cxx @@ -888,7 +888,7 @@ IMPL_LINK_NOARG(SwMMResultEmailDialog, SendDocumentsHdl_Impl, weld::Button&, voi // SwMailConfigDlg writes mail merge email settings only to (global) config, // so copy them to the existing config item - lcl_UpdateEmailSettingsFromGlobalConfig(*xConfigItem.get()); + lcl_UpdateEmailSettingsFromGlobalConfig(*xConfigItem); } //add the documents sal_uInt32 nBegin = 0; diff --git a/sw/source/uibase/inc/mailmergewizard.hxx b/sw/source/uibase/inc/mailmergewizard.hxx index cac0942546fc..27fbe4436168 100644 --- a/sw/source/uibase/inc/mailmergewizard.hxx +++ b/sw/source/uibase/inc/mailmergewizard.hxx @@ -64,7 +64,7 @@ public: virtual ~SwMailMergeWizard() override; SwView* GetSwView() {return m_pSwView;} - SwMailMergeConfigItem& GetConfigItem() { return *m_xConfigItem.get();} + SwMailMergeConfigItem& GetConfigItem() { return *m_xConfigItem;} void SetReloadDocument(const OUString& rURL) {sDocumentURL = rURL;} const OUString& GetReloadDocument() const {return sDocumentURL;} _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
