[Libreoffice-commits] core.git: oox/source sw/qa sw/source writerfilter/source
oox/source/drawingml/textcharacterproperties.cxx|2 oox/source/token/properties.txt |1 sw/qa/extras/ooxmlexport/data/Test_CharUnderlineThemeColor.docx |binary sw/qa/extras/ooxmlexport/ooxml_ThemeExport.cxx | 16 +++ sw/source/filter/ww8/docxattributeoutput.cxx| 10 +- writerfilter/source/dmapper/DomainMapper.cxx| 42 ++ writerfilter/source/dmapper/PropertyIds.cxx |1 writerfilter/source/dmapper/PropertyIds.hxx |1 8 files changed, 70 insertions(+), 3 deletions(-) New commits: commit 953ef30494661788b2e980ece84b62c653d77321 Author: Tomaž Vajngerl AuthorDate: Sun Jun 11 00:50:08 2023 +0900 Commit: Tomaž Vajngerl CommitDate: Mon Jun 12 05:26:11 2023 +0200 ooxml: import and export char underline theme colors This adds support to import and export char underline theme color properties. Change-Id: Ia8948ee5aacd20e0c2b7cbb1b2fdf97fc65c04e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152834 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx index 0e1e2830a67f..1217c19441ae 100644 --- a/oox/source/drawingml/textcharacterproperties.cxx +++ b/oox/source/drawingml/textcharacterproperties.cxx @@ -206,6 +206,8 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil { rPropMap.setProperty( PROP_CharUnderlineHasColor, true); rPropMap.setProperty( PROP_CharUnderlineColor, maUnderlineColor.getColor( rFilter.getGraphicHelper() )); +model::ComplexColor aComplexColor = maUnderlineColor.getComplexColor(); +rPropMap.setProperty( PROP_CharUnderlineComplexColor, model::color::createXComplexColor(aComplexColor)); } else { diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index 40988ffb0222..025b0628b9d8 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -91,6 +91,7 @@ CharStyleName CharTransparence CharUnderline CharUnderlineColor +CharUnderlineComplexColor CharUnderlineHasColor CharWeight CharWeightAsian diff --git a/sw/qa/extras/ooxmlexport/data/Test_CharUnderlineThemeColor.docx b/sw/qa/extras/ooxmlexport/data/Test_CharUnderlineThemeColor.docx new file mode 100644 index ..3ee3cdf457f0 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/Test_CharUnderlineThemeColor.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxml_ThemeExport.cxx b/sw/qa/extras/ooxmlexport/ooxml_ThemeExport.cxx index 3804f4606187..f9e7155859ea 100644 --- a/sw/qa/extras/ooxmlexport/ooxml_ThemeExport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxml_ThemeExport.cxx @@ -81,6 +81,22 @@ DECLARE_SW_ROUNDTRIP_TEST(testThemePortionBorderColor_DOCX, "Test_ThemeBorderCol CPPUNIT_ASSERT(isPropertyVoid(xParagraph, "RightBorderComplexColor")); } +DECLARE_SW_ROUNDTRIP_TEST(testCharUnderlineTheme_DOCX, "Test_CharUnderlineThemeColor.docx", nullptr, + Test) +{ +auto xParagraph = getParagraph(1); +CPPUNIT_ASSERT(xParagraph.is()); +auto xRun = getRun(xParagraph, 1); +auto xComplexColor += getProperty>(xRun, "CharUnderlineComplexColor"); +auto aComplexColor = model::color::getFromXComplexColor(xComplexColor); +CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent1, aComplexColor.getSchemeType()); +auto const& rTransforms = aComplexColor.getTransformations(); +CPPUNIT_ASSERT_EQUAL(size_t(1), rTransforms.size()); +CPPUNIT_ASSERT_EQUAL(model::TransformationType::Shade, rTransforms[0].meType); +CPPUNIT_ASSERT_EQUAL(sal_Int16(2509), rTransforms[0].mnValue); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index f5742eae4515..a75682761d84 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -7953,10 +7953,14 @@ void DocxAttributeOutput::CharUnderline( const SvxUnderlineItem& rUnderline ) bool bUnderlineHasColor = !aUnderlineColor.IsTransparent(); if (bUnderlineHasColor) { +model::ComplexColor const& rComplexColor = rUnderline.getComplexColor(); // Underline has a color -m_pSerializer->singleElementNS( XML_w, XML_u, -FSNS( XML_w, XML_val ), pUnderlineValue, -FSNS( XML_w, XML_color ), msfilter::util::ConvertColor(aUnderlineColor) ); +rtl::Reference pAttrList = FastSerializerHelper::createAttrList(); +pAttrList->add(FSNS(XML_w, XML_val), pUnderlineValue); +pAttrList->add(FSNS(XML_w, XML_color), msfilter::util::ConvertColor(aUnderlineColor)); +
[Libreoffice-commits] core.git: oox/source sw/qa sw/source writerfilter/source
oox/source/token/properties.txt |1 + oox/source/vml/vmlshape.cxx |1 + sw/qa/extras/ooxmlexport/data/tdf135665.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport15.cxx| 13 + sw/source/core/unocore/unoframe.cxx |8 ++-- writerfilter/source/dmapper/DomainMapper_Impl.cxx |1 + 6 files changed, 22 insertions(+), 2 deletions(-) New commits: commit 4b7ee7bd61f78be60211cc72ba36da987191266e Author: Daniel Arato (NISZ) AuthorDate: Wed Sep 2 15:46:56 2020 +0200 Commit: László Németh CommitDate: Mon Sep 7 13:11:44 2020 +0200 tdf#135665 DOCX: import tight wrap setting of VML shapes The wrap setting that OOXML calls "tight" and LibreOffice calls "contour" (== true) was not supported by the import code, only the export. Change-Id: I48739ffaad48e28df05fd87a9b51a14238dc47e5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101932 Tested-by: László Németh Reviewed-by: László Németh diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index 46200bf221ff..d50cd4bb124d 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -509,6 +509,7 @@ SubViewSize Subtotals Suffix Surround +SurroundContour SwapXAndYAxis Symbol SymbolColor diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 85ad112bcfae..f8a4c9000e66 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -588,6 +588,7 @@ static void lcl_setSurround(PropertySet& rPropSet, const ShapeTypeModel& rTypeMo nSurround = css::text::WrapTextMode_NONE; rPropSet.setProperty(PROP_Surround, static_cast(nSurround)); +rPropSet.setProperty(PROP_SurroundContour, aWrapType == "tight"); } static void lcl_SetAnchorType(PropertySet& rPropSet, const ShapeTypeModel& rTypeModel, const GraphicHelper& rGraphicHelper) diff --git a/sw/qa/extras/ooxmlexport/data/tdf135665.docx b/sw/qa/extras/ooxmlexport/data/tdf135665.docx new file mode 100644 index ..2400a1c1a46c Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf135665.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx index 4e39a5af0297..95770433a6ab 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx @@ -513,6 +513,19 @@ DECLARE_OOXMLIMPORT_TEST(TestTdf135653, "tdf135653.docx") CPPUNIT_ASSERT_EQUAL_MESSAGE("OLE bg color does not match!", aExpectedColor, aFillColor); } +DECLARE_OOXMLIMPORT_TEST(testTdf135665, "tdf135665.docx") +{ +uno::Reference xOLEProps1(getShape(1), uno::UNO_QUERY_THROW); +uno::Reference xOLEProps2(getShape(2), uno::UNO_QUERY_THROW); +bool bSurroundContour1 = false; +bool bSurroundContour2 = false; +xOLEProps1->getPropertyValue("SurroundContour") >>= bSurroundContour1; +xOLEProps2->getPropertyValue("SurroundContour") >>= bSurroundContour2; + +CPPUNIT_ASSERT_EQUAL_MESSAGE("OLE tight wrap setting not imported correctly", true, bSurroundContour1); +CPPUNIT_ASSERT_EQUAL_MESSAGE("OLE tight wrap setting not imported correctly", false, bSurroundContour2); +} + DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testAtPageShapeRelOrientation, "rotated_shape.fodt") { // invalid combination of at-page anchor and horizontal-rel="paragraph" diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 2d122992d840..5d7b86fc37e0 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -752,15 +752,19 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI bRet &= aSh.PutValue(*pShTr, MID_SHADOW_TRANSPARENCE); rToSet.Put(aSh); } -const ::uno::Any* pSur = nullptr; +const ::uno::Any* pSur = nullptr; GetProperty(RES_SURROUND, MID_SURROUND_SURROUNDTYPE, pSur); +const ::uno::Any* pSurCont = nullptr; +GetProperty(RES_SURROUND, MID_SURROUND_CONTOUR, pSurCont); const ::uno::Any* pSurAnch = nullptr; GetProperty(RES_SURROUND, MID_SURROUND_ANCHORONLY, pSurAnch); if(pSur || pSurAnch) { SwFormatSurround aSrnd ( rFromSet.Get ( RES_SURROUND ) ); if(pSur) -bRet &= static_cast(aSrnd).PutValue(*pSur, MID_SURROUND_SURROUNDTYPE ); +bRet &= static_cast(aSrnd).PutValue(*pSur, MID_SURROUND_SURROUNDTYPE); +if(pSurCont) +bRet &= static_cast(aSrnd).PutValue(*pSurCont, MID_SURROUND_CONTOUR); if(pSurAnch) bRet &= static_cast(aSrnd).PutValue(*pSurAnch, MID_SURROUND_ANCHORONLY); rToSet.Put(aSrnd); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 0347453d6704..ec83a7c2d5f9 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++
[Libreoffice-commits] core.git: oox/source sw/qa sw/source writerfilter/source
oox/source/vml/vmlshape.cxx | 61 +- sw/qa/extras/odfimport/data/Word2010AsCharShape.odt |binary sw/qa/extras/odfimport/odfimport.cxx |9 ++ sw/qa/extras/ooxmlexport/ooxmlexport6.cxx |6 + sw/source/core/unocore/unodraw.cxx| 10 ++ writerfilter/source/rtftok/rtfdispatchdestination.cxx |3 6 files changed, 57 insertions(+), 32 deletions(-) New commits: commit c79467ba954987f1d239c594c1e1b3af3f5515f6 Author: Michael StahlDate: Thu Nov 2 22:13:32 2017 +0100 sw: ODF import: default as-char shapes to vertical-pos="top" The problem is that we don't render ShapesWithWrapping.odt the same as Word does: https://beta.opendocumentformat.org/rendercompare/upload/223/86/191/1 The first shape in the file is anchored "as-char" and has no style:vertical-rel or style:vertical-pos attribute affecting it. If Word would write either style:vertical-rel="baseline" or style:vertical-pos="top" explicitly, the rendering in LO would be the same. So the problem is that, for drawing shapes (note, text frames are images, embedded objects handled differently), LO's default vertical alignment is different, it is hard-coded in SwShapeDescriptor_Impl::GetVOrient() as SwFormatVertOrient(0, text::VertOrientation::NONE, text::RelOrientation::FRAME) This effectively positions as-char shapes *below* the baseline, which, while technically allowed, isn't really a good default. So fix this by making the default alignment dependent on the anchor type, so that as-char shapes sit on top of the baseline. The ODF filter sets the anchor type before inserting the shape in XMLTextShapeImportHelper::addShape(), however as it turns out the various MSO filters insert the shape before setting the anchor, which means the new default in SwXShape has an unwanted effect on them, as inserting the shape causes the default to be created. This requires changes to VML import to always set the VertOrient property, and to RTF import to set the anchor type before inserting. The DrawingML import is unaffected as it already sets VertOrient for every non-as-char shape. The testDmlTextshape "dml-textshape.docx" test still fails, but it turns out that the change in alignment for this test document is a bugfix, as it now has the same vertical alignment as in Word, so adapt the test. Change-Id: Ifcabd96a037515f7803f5474ec995f968b3b4de1 diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 2c1acb029916..74ae15f848f3 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -564,6 +564,39 @@ void lcl_setSurround(PropertySet& rPropSet, const ShapeTypeModel& rTypeModel, co void lcl_SetAnchorType(PropertySet& rPropSet, const ShapeTypeModel& rTypeModel, const GraphicHelper& rGraphicHelper) { +if ( rTypeModel.maPosition == "absolute" ) +{ +// Word supports as-character (inline) and at-character only, absolute can't be inline. +rPropSet.setProperty(PROP_AnchorType, text::TextContentAnchorType_AT_CHARACTER); +// anchor is set after insertion, so reset to NONE +rPropSet.setAnyProperty(PROP_VertOrient, makeAny(text::VertOrientation::NONE)); + +if ( rTypeModel.maPositionVerticalRelative == "page" ) +{ +rPropSet.setProperty(PROP_VertOrientRelation, text::RelOrientation::PAGE_FRAME); +} +else if ( rTypeModel.maPositionVerticalRelative == "margin" ) +{ +rPropSet.setProperty(PROP_VertOrientRelation, text::RelOrientation::PAGE_PRINT_AREA); +} +else +{ +rPropSet.setProperty(PROP_VertOrientRelation, text::RelOrientation::FRAME); +} +} +else if( rTypeModel.maPosition == "relative" ) +{ // I'm not very sure this is correct either. +rPropSet.setProperty(PROP_AnchorType, text::TextContentAnchorType_AT_PARAGRAPH); +// anchor is set after insertion, so reset to NONE +rPropSet.setAnyProperty(PROP_VertOrient, makeAny(text::VertOrientation::NONE)); +} +else // static (is the default) means anchored inline +{ +rPropSet.setProperty(PROP_AnchorType, text::TextContentAnchorType_AS_CHARACTER); +// Use top orientation, this one seems similar to what MSO uses as inline +rPropSet.setAnyProperty(PROP_VertOrient, makeAny(text::VertOrientation::TOP)); +} + if ( rTypeModel.maPositionHorizontal == "center" ) rPropSet.setAnyProperty(PROP_HoriOrient, makeAny(text::HoriOrientation::CENTER)); else if ( rTypeModel.maPositionHorizontal == "left" ) @@ -599,34 +632,6 @@ void lcl_SetAnchorType(PropertySet& rPropSet, const ShapeTypeModel& rTypeModel, else if ( rTypeModel.maPositionVertical ==
[Libreoffice-commits] core.git: oox/source sw/qa sw/source writerfilter/source
oox/source/drawingml/fillproperties.cxx | 30 ++ sw/qa/extras/ooxmlexport/ooxmlexport7.cxx |2 - sw/source/filter/ww8/docxattributeoutput.cxx |2 - writerfilter/source/dmapper/GraphicImport.cxx |5 +--- 4 files changed, 21 insertions(+), 18 deletions(-) New commits: commit d151ed35ad4c4e7aa9fbb807930fcf91dea2eba7 Author: Joren De Cuyper jore...@libreoffice.org Date: Tue Jun 2 22:26:29 2015 +0200 tdf#87539 map MSO washout filter to LO's watermark colormode Change-Id: Id28e301a74a729245b20ba6cd2adecf203633f0e Reviewed-on: https://gerrit.libreoffice.org/16048 Tested-by: Jenkins c...@libreoffice.org Reviewed-by: Thorsten Behrens thorsten.behr...@cib.de diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index 1302a07..6879896 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -696,17 +696,29 @@ void GraphicProperties::pushToPropMap( PropertyMap rPropMap, const GraphicHelpe { sal_Int16 nBrightness = getLimitedValue sal_Int16, sal_Int32 ( maBlipProps.moBrightness.get( 0 ) / PER_PERCENT, -100, 100 ); sal_Int16 nContrast = getLimitedValue sal_Int16, sal_Int32 ( maBlipProps.moContrast.get( 0 ) / PER_PERCENT, -100, 100 ); +ColorMode eColorMode = ColorMode_STANDARD; + +switch( maBlipProps.moColorEffect.get( XML_TOKEN_INVALID ) ) +{ +case XML_biLevel: eColorMode = ColorMode_MONO;break; +case XML_grayscl: eColorMode = ColorMode_GREYS; break; +} + if( maBlipProps.mxGraphic.is() ) { // created transformed graphic Reference XGraphic xGraphic = lclCheckAndApplyDuotoneTransform( maBlipProps, maBlipProps.mxGraphic, rGraphicHelper, nPhClr ); xGraphic = lclCheckAndApplyChangeColorTransform( maBlipProps, xGraphic, rGraphicHelper, nPhClr ); -// MSO uses a different algorithm for contrast+brightness, LO applies contrast before brightness, -// while MSO apparently applies half of brightness before contrast and half after. So if only -// contrast or brightness need to be altered, the result is the same, but if both are involved, -// there's no way to map that, so just force a conversion of the image. -if( nBrightness != 0 nContrast != 0 ) + +if (eColorMode == ColorMode_STANDARD nBrightness == 70 nContrast == -70) +// map MSO 'washout' to our Watermark colormode +eColorMode = ColorMode_WATERMARK; +else if( nBrightness != 0 nContrast != 0 ) { +// MSO uses a different algorithm for contrast+brightness, LO applies contrast before brightness, +// while MSO apparently applies half of brightness before contrast and half after. So if only +// contrast or brightness need to be altered, the result is the same, but if both are involved, +// there's no way to map that, so just force a conversion of the image. xGraphic = applyBrightnessContrast( xGraphic, nBrightness, nContrast ); nBrightness = 0; nContrast = 0; @@ -738,14 +750,6 @@ void GraphicProperties::pushToPropMap( PropertyMap rPropMap, const GraphicHelpe } } } - -// color effect -ColorMode eColorMode = ColorMode_STANDARD; -switch( maBlipProps.moColorEffect.get( XML_TOKEN_INVALID ) ) -{ -case XML_biLevel: eColorMode = ColorMode_MONO;break; -case XML_grayscl: eColorMode = ColorMode_GREYS; break; -} rPropMap.setProperty(PROP_GraphicColorMode, eColorMode); // brightness and contrast diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx index 47b47b8..727d448 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx @@ -973,7 +973,7 @@ DECLARE_OOXMLEXPORT_TEST(testPictureColormodeWatermark, picture_colormode_water if (!pXmlDoc) return; -assertXPath(pXmlDoc, /w:document/w:body/w:p/w:r/w:drawing/wp:anchor/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:blip/a:lum, bright, 5); +assertXPath(pXmlDoc, /w:document/w:body/w:p/w:r/w:drawing/wp:anchor/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:blip/a:lum, bright, 7); assertXPath(pXmlDoc, /w:document/w:body/w:p/w:r/w:drawing/wp:anchor/a:graphic/a:graphicData/pic:pic/pic:blipFill/a:blip/a:lum, contrast, -7); } diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index ddad776..710c862 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -4246,7 +4246,7 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size else if (nMode == GRAPHICDRAWMODE_MONO) //black/white has a 0,5 threshold in LibreOffice
[Libreoffice-commits] core.git: oox/source sw/qa sw/source writerfilter/source
oox/source/shape/WpsContext.cxx|4 ++-- sw/qa/extras/rtfimport/rtfimport.cxx |3 +-- sw/source/filter/ww8/docxsdrexport.cxx |2 +- writerfilter/source/dmapper/SdtHelper.cxx |7 ++- writerfilter/source/dmapper/SdtHelper.hxx |7 ++- writerfilter/source/rtftok/rtfdocumentimpl.cxx |7 ++- writerfilter/source/rtftok/rtfdocumentimpl.hxx |2 +- writerfilter/source/rtftok/rtfsdrimport.cxx|3 +-- writerfilter/source/rtftok/rtfvalue.hxx|8 9 files changed, 16 insertions(+), 27 deletions(-) New commits: commit 2198168af134e7f72afcc07ff5062324a19d Author: Miklos Vajna vmik...@collabora.co.uk Date: Sun Jul 27 17:30:48 2014 +0200 indentation fixes Change-Id: I0a0f04d0f0e008e8947a5a7e3ed6083c1589e61b diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx index 89ed320..fb42e62 100644 --- a/oox/source/shape/WpsContext.cxx +++ b/oox/source/shape/WpsContext.cxx @@ -128,10 +128,10 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken } break; case XML_prstTxWarp: -if( rAttribs.hasAttribute( XML_prst ) ) +if (rAttribs.hasAttribute(XML_prst)) { uno::Referencebeans::XPropertySet xPropertySet(mxShape, uno::UNO_QUERY); -oox::OptValueOUString presetShapeName = rAttribs.getString( XML_prst ); +oox::OptValueOUString presetShapeName = rAttribs.getString(XML_prst); OUString preset = presetShapeName.get(); comphelper::SequenceAsHashMap aCustomShapeGeometry(xPropertySet-getPropertyValue(CustomShapeGeometry)); aCustomShapeGeometry[PresetTextWarp] = uno::makeAny(preset); diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 289cce8..f7763b3 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -1337,8 +1337,7 @@ DECLARE_RTFIMPORT_TEST(testFdo77996, fdo77996.rtf) uno::Referencedocument::XDocumentPropertiesSupplier xDocumentPropertiesSupplier(mxComponent, uno::UNO_QUERY); uno::Referencedocument::XDocumentProperties xProps(xDocumentPropertiesSupplier-getDocumentProperties()); CPPUNIT_ASSERT_EQUAL(OUString(Aln Lin (Bei Jing)), xProps-getAuthor()); -OUString aTitle(\xe5\x8e\xa6\xe9\x97\xa8\xe9\x92\xa8\xe4\xb8\x9a\xe8\x82\xa1\xe4\xbb\xbd\xe6\x9c\x89\xe9\x99\x90\xe5\x85\xac\xe5\x8f\xb8, 30, -RTL_TEXTENCODING_UTF8); +OUString aTitle(\xe5\x8e\xa6\xe9\x97\xa8\xe9\x92\xa8\xe4\xb8\x9a\xe8\x82\xa1\xe4\xbb\xbd\xe6\x9c\x89\xe9\x99\x90\xe5\x85\xac\xe5\x8f\xb8, 30, RTL_TEXTENCODING_UTF8); CPPUNIT_ASSERT_EQUAL(aTitle, xProps-getTitle()); uno::Referencebeans::XPropertySet xUDProps(xProps-getUserDefinedProperties(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(OUString(jay), getPropertyOUString(xUDProps, Operator)); diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index 8e137d9..9429443 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -853,7 +853,7 @@ void DocxSdrExport::writeDMLAndVMLDrawing(const SdrObject* sdrObj, const SwFrmFm // In case we are already inside a DML block, then write the shape only as VML, turn out that's allowed to do. // A common service created in util to check for VML shapes which are allowed to have textbox in content -if ( (msfilter::util::HasTextBoxContent(eShapeType)) m_pImpl-isSupportedDMLShape(xShape) !bDMLAndVMLDrawingOpen) +if ((msfilter::util::HasTextBoxContent(eShapeType)) m_pImpl-isSupportedDMLShape(xShape) !bDMLAndVMLDrawingOpen) { m_pImpl-m_pSerializer-startElementNS(XML_mc, XML_AlternateContent, FSEND); diff --git a/writerfilter/source/dmapper/SdtHelper.cxx b/writerfilter/source/dmapper/SdtHelper.cxx index 671e4c2..ce57d60 100644 --- a/writerfilter/source/dmapper/SdtHelper.cxx +++ b/writerfilter/source/dmapper/SdtHelper.cxx @@ -135,15 +135,12 @@ void SdtHelper::createDateControl(OUString rContentText, beans::PropertyValue a createControlShape(lcl_getOptimalWidth(m_rDM_Impl.GetStyleSheetTable(), rContentText, aItems), xControlModel, aGrabBag.getAsConstPropertyValueList()); } -void SdtHelper::createControlShape(awt::Size aSize, -uno::Referenceawt::XControlModel const xControlModel) +void SdtHelper::createControlShape(awt::Size aSize, uno::Referenceawt::XControlModel const xControlModel) { createControlShape(aSize, xControlModel, uno::Sequencebeans::PropertyValue()); } -void SdtHelper::createControlShape(awt::Size aSize, -uno::Referenceawt::XControlModel const xControlModel, -const uno::Sequencebeans::PropertyValue rGrabBag) +void SdtHelper::createControlShape(awt::Size aSize, uno::Referenceawt::XControlModel const xControlModel, const uno::Sequencebeans::PropertyValue rGrabBag) {
[Libreoffice-commits] core.git: oox/source sw/qa sw/source writerfilter/source
oox/source/drawingml/shape.cxx| 23 +- sw/qa/extras/ooxmlexport/data/fdo73247.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx |9 + sw/source/filter/ww8/docxattributeoutput.cxx | 36 +- writerfilter/source/dmapper/DomainMapper_Impl.cxx |8 +++- 5 files changed, 72 insertions(+), 4 deletions(-) New commits: commit b23867abd8427da361dfa5edb9b41fbbd064ae10 Author: YogeshBharate yogesh.bhar...@synerzip.com Date: Fri Jan 10 19:15:10 2014 +0530 fdo#73247: Code fixed for Shape rotation not preserved in RT Problem Description: - When we create the shape with text, rotated it with some angle, the rotation angle is not preserved after roundtrip. Implementation: - Use the FrameInteroGrabBag to preserve the rotation angle. Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport.cxx Reviewed on: https://gerrit.libreoffice.org/7367 Change-Id: I8a44e82d21f08ecb221cdbfef73f02a652f2bad3 diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index b191762..9437f02 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -657,7 +657,28 @@ Reference XShape Shape::createAndInsert( } aShapeProps.erase(PROP_LineColor); } - +if(mnRotation) +{ +uno::Referencebeans::XPropertySet xPropertySet(mxShape, uno::UNO_QUERY); +const OUString aGrabBagPropName = FrameInteropGrabBag; +uno::Sequencebeans::PropertyValue aGrabBag; +xPropertySet-getPropertyValue(aGrabBagPropName) = aGrabBag; +beans::PropertyValue aPair; +aPair.Name = mso-rotation-angle; +aPair.Value = uno::makeAny(mnRotation); +if (aGrabBag.hasElements()) +{ +sal_Int32 nLength = aGrabBag.getLength(); +aGrabBag.realloc(nLength + 1); +aGrabBag[nLength] = aPair; +} +else +{ +aGrabBag.realloc(1); +aGrabBag[0] = aPair; +} +xPropertySet-setPropertyValue(aGrabBagPropName, uno::makeAny(aGrabBag)); +} // TextFrames have ShadowFormat, not individual shadow properties. boost::optionalsal_Int32 oShadowDistance; if (aShapeProps.hasProperty(PROP_ShadowXDistance)) diff --git a/sw/qa/extras/ooxmlexport/data/fdo73247.docx b/sw/qa/extras/ooxmlexport/data/fdo73247.docx new file mode 100644 index 000..63ad782 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo73247.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 46488de..d4f5e3f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -2404,6 +2404,15 @@ DECLARE_OOXMLEXPORT_TEST(testFdo65833, fdo65833.docx) assertXPath(pXmlDoc, /w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:group, editas, canvas); } +DECLARE_OOXMLEXPORT_TEST(testFdo73247, fdo73247.docx) +{ +xmlDocPtr pXmlDoc = parseExport(word/document.xml); +if (!pXmlDoc) +return; +assertXPath(pXmlDoc, /w:document/w:body/w:p[2]/w:r[2]/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:xfrm, +rot, 1969698); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index a94cd68..e498c09 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -304,9 +304,43 @@ void DocxAttributeOutput::WriteDMLTextFrame(sw::Frame* pParentFrame) XML_txBox, 1, FSEND); +uno::Any aRotation ; +const SdrObject* pSdrObj = rFrmFmt.FindRealSdrObject(); +uno::Reference drawing::XShape xShape( ((SdrObject*)pSdrObj)-getUnoShape(), uno::UNO_QUERY ); +uno::Reference beans::XPropertySet xPropertySet( xShape, uno::UNO_QUERY ); +uno::Reference beans::XPropertySetInfo xPropSetInfo = xPropertySet-getPropertySetInfo(); +OUString pName = FrameInteropGrabBag; +sal_Int32 nRotation = 0; + +if ( xPropSetInfo-hasPropertyByName( pName ) ) +{ +uno::Sequence beans::PropertyValue propList; +xPropertySet-getPropertyValue( pName ) = propList; +for ( sal_Int32 nProp=0; nProp propList.getLength(); ++nProp ) +{ +OUString propName = propList[nProp].Name; +if ( propName == mso-rotation-angle) +{ +aRotation = propList[nProp].Value ; +break; +