oox/inc/oox/vml/vmlformatting.hxx | 12 ++ oox/inc/oox/vml/vmlshape.hxx | 1 oox/source/vml/vmlformatting.cxx | 56 ++++++++++ oox/source/vml/vmlshape.cxx | 97 ++++++++++-------- oox/source/vml/vmlshapecontext.cxx | 3 sc/source/filter/inc/condformatbuffer.hxx | 2 sw/qa/extras/ooxmlimport/data/page-background.docx |binary sw/qa/extras/ooxmlimport/data/page-border-shadow.docx |binary sw/qa/extras/ooxmlimport/data/watermark.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 47 ++++++++ writerfilter/source/dmapper/BorderHandler.cxx | 9 + writerfilter/source/dmapper/BorderHandler.hxx | 2 writerfilter/source/dmapper/DomainMapper.cxx | 5 writerfilter/source/dmapper/DomainMapper_Impl.cxx | 5 writerfilter/source/dmapper/DomainMapper_Impl.hxx | 3 writerfilter/source/dmapper/PageBordersHandler.cxx | 6 - writerfilter/source/dmapper/PageBordersHandler.hxx | 1 writerfilter/source/dmapper/PropertyMap.cxx | 26 ++++ writerfilter/source/dmapper/PropertyMap.hxx | 3 writerfilter/source/ooxml/model.xml | 2 20 files changed, 230 insertions(+), 50 deletions(-)
New commits: commit f64d62130be8029bcdcd8eb4aace99296d4be82a Author: Miklos Vajna <vmik...@suse.cz> Date: Thu May 30 12:18:30 2013 +0200 bnc#817956 page border shadow testcase Change-Id: I1ded79d89dcceb3bae5926a2f217cde8bf6aa830 (cherry picked from commit 300ba1a171a37da08d72e278cf38988f1225cc83) diff --git a/sw/qa/extras/ooxmlimport/data/page-border-shadow.docx b/sw/qa/extras/ooxmlimport/data/page-border-shadow.docx new file mode 100755 index 0000000..65a2273 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/page-border-shadow.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 8d55c28..8f24b40 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -120,6 +120,7 @@ public: void testN592908_Picture(); void testPageBackground(); void testWatermark(); + void testPageBorderShadow(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -192,6 +193,7 @@ void Test::run() {"n592908-picture.docx", &Test::testN592908_Picture}, {"page-background.docx", &Test::testPageBackground}, {"watermark.docx", &Test::testWatermark}, + {"page-border-shadow.docx", &Test::testPageBorderShadow}, }; for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) { @@ -1214,6 +1216,16 @@ void Test::testWatermark() CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_PRINT_AREA, getProperty<sal_Int16>(xShape, "VertOrientRelation")); } +void Test::testPageBorderShadow() +{ + // The problem was that in w:pgBorders, child elements had a w:shadow attribute, but that was ignored. + table::ShadowFormat aShadow = getProperty<table::ShadowFormat>(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "ShadowFormat"); + CPPUNIT_ASSERT_EQUAL(COL_BLACK, sal_uInt32(aShadow.Color)); + CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location); + // w:sz="48" is in eights of a point, 1 pt is 20 twips. + CPPUNIT_ASSERT_EQUAL(sal_Int16(TWIP_TO_MM100(48/8*20)), aShadow.ShadowWidth); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); commit c185f04cd36d2bba3b3d24530966baa4079b109b Author: Miklos Vajna <vmik...@suse.cz> Date: Thu May 30 11:55:37 2013 +0200 bnc#817956 DOCX import of page border shadow See the comment in SectionPropertyMap::ApplyBorderToPageStyles() on what and how is mapped. The control flow is like this: BorderHandler::lcl_attribute() notices w:shadow, then PageBordersHandler::lcl_sprm() gets it, passes it to SectionPropertyMap::SetBorder(), finally SectionPropertyMap::ApplyBorderToPageStyles() uses the UNO API. Change-Id: Ib0aef3245f58c62655769357f1f4dd07eef77f62 (cherry picked from commit f0aa209390aea68f4c23cf16df9d1577aaea91b5) diff --git a/writerfilter/source/dmapper/BorderHandler.cxx b/writerfilter/source/dmapper/BorderHandler.cxx index 068c210..c219d39 100644 --- a/writerfilter/source/dmapper/BorderHandler.cxx +++ b/writerfilter/source/dmapper/BorderHandler.cxx @@ -39,6 +39,7 @@ m_nLineWidth(15), // Word default, in twips m_nLineType(0), m_nLineColor(0), m_nLineDistance(0), +m_bShadow(false), m_bOOXML( bOOXML ) { const int nBorderCount(BORDER_COUNT); @@ -83,7 +84,8 @@ void BorderHandler::lcl_attribute(Id rName, Value & rVal) m_nLineDistance = ConversionHelper::convertTwipToMM100( nIntValue * 20 ); break; case NS_rtf::LN_FSHADOW: // 0x2875 - //if 1 then line has shadow - unsupported + m_bShadow = nIntValue; + break; case NS_rtf::LN_FFRAME: // 0x2876 case NS_rtf::LN_UNUSED2_15: // 0x2877 // ignored @@ -173,6 +175,11 @@ table::BorderLine2 BorderHandler::getBorderLine() return aBorderLine; } +bool BorderHandler::getShadow() +{ + return m_bShadow; +} + } //namespace dmapper } //namespace writerfilter diff --git a/writerfilter/source/dmapper/BorderHandler.hxx b/writerfilter/source/dmapper/BorderHandler.hxx index 7a6eec9..3d43c4a 100644 --- a/writerfilter/source/dmapper/BorderHandler.hxx +++ b/writerfilter/source/dmapper/BorderHandler.hxx @@ -50,6 +50,7 @@ private: sal_Int32 m_nLineType; sal_Int32 m_nLineColor; sal_Int32 m_nLineDistance; + bool m_bShadow; bool m_bOOXML; bool m_aFilledLines[BORDER_COUNT]; @@ -66,6 +67,7 @@ public: ::boost::shared_ptr<PropertyMap> getProperties(); ::com::sun::star::table::BorderLine2 getBorderLine(); sal_Int32 getLineDistance() const { return m_nLineDistance;} + bool getShadow(); }; typedef boost::shared_ptr< BorderHandler > BorderHandlerPtr; }} diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 5acfb0c..48b0cdb 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -2656,7 +2656,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType BORDER_BOTTOM, BORDER_RIGHT }; - pSectionContext->SetBorder( aPositions[nSprmId - NS_sprm::LN_SBrcTop], nLineDistance, aBorderLine ); + pSectionContext->SetBorder( aPositions[nSprmId - NS_sprm::LN_SBrcTop], nLineDistance, aBorderLine, /*bShadow =*/ false ); } } break; diff --git a/writerfilter/source/dmapper/PageBordersHandler.cxx b/writerfilter/source/dmapper/PageBordersHandler.cxx index 9ce4269..471a85a 100644 --- a/writerfilter/source/dmapper/PageBordersHandler.cxx +++ b/writerfilter/source/dmapper/PageBordersHandler.cxx @@ -28,7 +28,8 @@ namespace dmapper { _PgBorder::_PgBorder( ) : m_nDistance( 0 ), - m_ePos( BORDER_RIGHT ) + m_ePos( BORDER_RIGHT ), + m_bShadow(false) { } @@ -123,6 +124,7 @@ void PageBordersHandler::lcl_sprm( Sprm& rSprm ) aPgBorder.m_rLine = pBorderHandler->getBorderLine( ); aPgBorder.m_nDistance = pBorderHandler->getLineDistance( ); aPgBorder.m_ePos = ePos; + aPgBorder.m_bShadow = pBorderHandler->getShadow(); m_aBorders.push_back( aPgBorder ); } } @@ -136,7 +138,7 @@ void PageBordersHandler::SetBorders( SectionPropertyMap* pSectContext ) for ( int i = 0, length = m_aBorders.size( ); i < length; i++ ) { _PgBorder aBorder = m_aBorders[i]; - pSectContext->SetBorder( aBorder.m_ePos, aBorder.m_nDistance, aBorder.m_rLine ); + pSectContext->SetBorder( aBorder.m_ePos, aBorder.m_nDistance, aBorder.m_rLine, aBorder.m_bShadow ); } } diff --git a/writerfilter/source/dmapper/PageBordersHandler.hxx b/writerfilter/source/dmapper/PageBordersHandler.hxx index 7d5af39..b6aebf5 100644 --- a/writerfilter/source/dmapper/PageBordersHandler.hxx +++ b/writerfilter/source/dmapper/PageBordersHandler.hxx @@ -40,6 +40,7 @@ public: com::sun::star::table::BorderLine2 m_rLine; sal_Int32 m_nDistance; BorderPosition m_ePos; + bool m_bShadow; _PgBorder( ); ~_PgBorder( ); diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index 284dfbf..2b927a2 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -31,6 +31,7 @@ #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/style/BreakType.hpp> #include <com/sun/star/style/PageStyleLayout.hpp> +#include <com/sun/star/table/ShadowFormat.hpp> #include <com/sun/star/text/RelOrientation.hpp> #include <com/sun/star/text/WritingMode.hpp> #include <com/sun/star/text/XTextColumns.hpp> @@ -285,7 +286,10 @@ SectionPropertyMap::SectionPropertyMap(bool bIsFirstSection) : nSectionNumber = nNumber++; memset(&m_pBorderLines, 0x00, sizeof(m_pBorderLines)); for( sal_Int32 nBorder = 0; nBorder < 4; ++nBorder ) + { m_nBorderDistances[ nBorder ] = -1; + m_bBorderShadows[nBorder] = false; + } //todo: set defaults in ApplyPropertiesToPageStyles //initialize defaults PaperInfo aLetter(PAPER_LETTER); @@ -405,11 +409,12 @@ uno::Reference< beans::XPropertySet > SectionPropertyMap::GetPageStyle( } -void SectionPropertyMap::SetBorder( BorderPosition ePos, sal_Int32 nLineDistance, const table::BorderLine2& rBorderLine ) +void SectionPropertyMap::SetBorder( BorderPosition ePos, sal_Int32 nLineDistance, const table::BorderLine2& rBorderLine, bool bShadow ) { delete m_pBorderLines[ePos]; m_pBorderLines[ePos] = new table::BorderLine2( rBorderLine ); m_nBorderDistances[ePos] = nLineDistance; + m_bBorderShadows[ePos] = bShadow; } @@ -502,6 +507,22 @@ void SectionPropertyMap::ApplyBorderToPageStyles( m_nBorderDistances[nBorder], nOffsetFrom, nLineWidth ); } } + + if (m_bBorderShadows[BORDER_RIGHT]) + { + // In Word UI, shadow is a boolean property, in OOXML, it's a boolean + // property of each 4 border type, finally in Writer the border is a + // property of the page style, with shadow location, distance and + // color. See SwWW8ImplReader::SetShadow(). + table::ShadowFormat aFormat; + aFormat.Color = COL_BLACK; + aFormat.Location = table::ShadowLocation_BOTTOM_RIGHT; + aFormat.ShadowWidth = m_pBorderLines[BORDER_RIGHT]->LineWidth; + if (xFirst.is()) + xFirst->setPropertyValue(rPropNameSupplier.GetName(PROP_SHADOW_FORMAT), uno::makeAny(aFormat)); + if (xSecond.is()) + xSecond->setPropertyValue(rPropNameSupplier.GetName(PROP_SHADOW_FORMAT), uno::makeAny(aFormat)); + } } void SectionPropertyMap::SetBorderDistance( uno::Reference< beans::XPropertySet > xStyle, diff --git a/writerfilter/source/dmapper/PropertyMap.hxx b/writerfilter/source/dmapper/PropertyMap.hxx index 6bbb4c7..595ebb2 100644 --- a/writerfilter/source/dmapper/PropertyMap.hxx +++ b/writerfilter/source/dmapper/PropertyMap.hxx @@ -149,6 +149,7 @@ class SectionPropertyMap : public PropertyMap ::com::sun::star::table::BorderLine2* m_pBorderLines[4]; sal_Int32 m_nBorderDistances[4]; sal_Int32 m_nBorderParams; + bool m_bBorderShadows[4]; bool m_bTitlePage; sal_Int16 m_nColumnCount; @@ -219,7 +220,7 @@ public: const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& xTextFactory, bool bFirst ); - void SetBorder( BorderPosition ePos, sal_Int32 nLineDistance, const ::com::sun::star::table::BorderLine2& rBorderLine ); + void SetBorder( BorderPosition ePos, sal_Int32 nLineDistance, const ::com::sun::star::table::BorderLine2& rBorderLine, bool bShadow ); void SetBorderParams( sal_Int32 nSet ) { m_nBorderParams = nSet; } void SetColumnCount( sal_Int16 nCount ) { m_nColumnCount = nCount; } commit 44ad989229d09179b045210ef67c29a1df90def6 Author: Miklos Vajna <vmik...@suse.cz> Date: Wed May 29 15:22:14 2013 +0200 bnc#817956 v:textpath VML import testcase Change-Id: I4c4c3a84e8d9d048262e6570a8bed0106e8d184f (cherry picked from commit 8931c8f3c58afe35b5b7c98e136825aff04291e3) diff --git a/sw/qa/extras/ooxmlimport/data/watermark.docx b/sw/qa/extras/ooxmlimport/data/watermark.docx new file mode 100755 index 0000000..8e279e3 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/watermark.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 69862e5..8d55c28 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -119,6 +119,7 @@ public: void testN592908_Frame(); void testN592908_Picture(); void testPageBackground(); + void testWatermark(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -190,6 +191,7 @@ void Test::run() {"n592908-frame.docx", &Test::testN592908_Frame}, {"n592908-picture.docx", &Test::testN592908_Picture}, {"page-background.docx", &Test::testPageBackground}, + {"watermark.docx", &Test::testWatermark}, }; for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) { @@ -1188,6 +1190,30 @@ void Test::testPageBackground() CPPUNIT_ASSERT_EQUAL(sal_Int32(0x92D050), getProperty<sal_Int32>(xPageStyle, "BackColor")); } +void Test::testWatermark() +{ + uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xShape(xDraws->getByIndex(0), uno::UNO_QUERY); + // 1st problem: last character was missing + CPPUNIT_ASSERT_EQUAL(OUString("SAMPLE"), xShape->getString()); + + uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY); + uno::Sequence<beans::PropertyValue> aProps = getProperty< uno::Sequence<beans::PropertyValue> >(xShape, "CustomShapeGeometry"); + bool bFound = false; + for (int i = 0; i < aProps.getLength(); ++i) + if (aProps[i].Name == "TextPath") + bFound = true; + // 2nd problem: v:textpath wasn't imported + CPPUNIT_ASSERT_EQUAL(true, bFound); + + // 3rd problem: rotation angle was 315, not 45. + CPPUNIT_ASSERT_EQUAL(sal_Int32(45 * 100), getProperty<sal_Int32>(xShape, "RotateAngle")); + + // 4th problem: mso-position-vertical-relative:margin was ignored, VertOrientRelation was text::RelOrientation::FRAME. + CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_PRINT_AREA, getProperty<sal_Int16>(xShape, "VertOrientRelation")); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); commit 56eeebb39a72fa90f945fe54e3af8a2c3a2918c2 Author: Miklos Vajna <vmik...@suse.cz> Date: Wed May 29 14:47:54 2013 +0200 bnc#817956 VML import of mso-position-vertical-relative:margin Change-Id: I86464c44022ef8c8a8037d4228bb2a6409fc77af (cherry picked from commit f2720b87093968670e3fb47d24d4952f1631a654) diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 4cf771e..1c3cbac 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -433,6 +433,10 @@ void lcl_SetAnchorType(PropertySet& rPropSet, const ShapeTypeModel& rTypeModel) { rPropSet.setProperty(PROP_VertOrientRelation, text::RelOrientation::PAGE_FRAME); } + else if ( rTypeModel.maPositionVerticalRelative == "margin" ) + { + rPropSet.setProperty(PROP_VertOrientRelation, text::RelOrientation::PAGE_PRINT_AREA); + } else { // Vertical placement relative to margin, because parent style must not modify vertical position commit 9dc54d258cee67ce702f907504fcc776712cad47 Author: Miklos Vajna <vmik...@suse.cz> Date: Thu May 30 15:43:55 2013 +0200 bnc#817956 fix VML import of rotation In VML, positive rotation angles are clockwise, we have them as counter-clockwise. This wasn't noticed earlier, as the n751117.docx testcase also had flip:x. (For example, rotation with angle 90 + flip:x is presented as 270 by the UI.) Fix this, and also mirror the angle when flip:x is present. Change-Id: I591ec3369a5bdca53f9684006a459d11e37fbc33 (cherry picked from commit b2c16f6c1b8bd3c96e0549eb3036c820094a795f diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 3861ee1..4cf771e 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -18,6 +18,7 @@ */ #include <algorithm> +#include <boost/optional.hpp> #include "oox/vml/vmlshape.hxx" @@ -41,6 +42,7 @@ #include <com/sun/star/text/TextContentAnchorType.hpp> #include <rtl/math.hxx> #include <rtl/ustrbuf.hxx> +#include <svx/svdtrans.hxx> #include "oox/drawingml/shapepropertymap.hxx" #include "oox/helper/graphichelper.hxx" #include "oox/helper/propertyset.hxx" @@ -83,21 +85,21 @@ const sal_Int32 VML_SHAPETYPE_HOSTCONTROL = 201; // ---------------------------------------------------------------------------- -Point lclGetAbsPoint( const Point& rRelPoint, const Rectangle& rShapeRect, const Rectangle& rCoordSys ) +awt::Point lclGetAbsPoint( const awt::Point& rRelPoint, const awt::Rectangle& rShapeRect, const awt::Rectangle& rCoordSys ) { double fWidthRatio = static_cast< double >( rShapeRect.Width ) / rCoordSys.Width; double fHeightRatio = static_cast< double >( rShapeRect.Height ) / rCoordSys.Height; - Point aAbsPoint; + awt::Point aAbsPoint; aAbsPoint.X = static_cast< sal_Int32 >( rShapeRect.X + fWidthRatio * (rRelPoint.X - rCoordSys.X) + 0.5 ); aAbsPoint.Y = static_cast< sal_Int32 >( rShapeRect.Y + fHeightRatio * (rRelPoint.Y - rCoordSys.Y) + 0.5 ); return aAbsPoint; } -Rectangle lclGetAbsRect( const Rectangle& rRelRect, const Rectangle& rShapeRect, const Rectangle& rCoordSys ) +awt::Rectangle lclGetAbsRect( const awt::Rectangle& rRelRect, const awt::Rectangle& rShapeRect, const awt::Rectangle& rCoordSys ) { double fWidthRatio = static_cast< double >( rShapeRect.Width ) / rCoordSys.Width; double fHeightRatio = static_cast< double >( rShapeRect.Height ) / rCoordSys.Height; - Rectangle aAbsRect; + awt::Rectangle aAbsRect; aAbsRect.X = static_cast< sal_Int32 >( rShapeRect.X + fWidthRatio * (rRelRect.X - rCoordSys.X) + 0.5 ); aAbsRect.Y = static_cast< sal_Int32 >( rShapeRect.Y + fHeightRatio * (rRelRect.Y - rCoordSys.Y) + 0.5 ); aAbsRect.Width = static_cast< sal_Int32 >( fWidthRatio * rRelRect.Width + 0.5 ); @@ -149,21 +151,21 @@ OUString ShapeType::getGraphicPath() const return maTypeModel.moGraphicPath.get( OUString() ); } -Rectangle ShapeType::getCoordSystem() const +awt::Rectangle ShapeType::getCoordSystem() const { Int32Pair aCoordPos = maTypeModel.moCoordPos.get( Int32Pair( 0, 0 ) ); Int32Pair aCoordSize = maTypeModel.moCoordSize.get( Int32Pair( 1000, 1000 ) ); - return Rectangle( aCoordPos.first, aCoordPos.second, aCoordSize.first, aCoordSize.second ); + return awt::Rectangle( aCoordPos.first, aCoordPos.second, aCoordSize.first, aCoordSize.second ); } -Rectangle ShapeType::getRectangle( const ShapeParentAnchor* pParentAnchor ) const +awt::Rectangle ShapeType::getRectangle( const ShapeParentAnchor* pParentAnchor ) const { return pParentAnchor ? lclGetAbsRect( getRelRectangle(), pParentAnchor->maShapeRect, pParentAnchor->maCoordSys ) : getAbsRectangle(); } -Rectangle ShapeType::getAbsRectangle() const +awt::Rectangle ShapeType::getAbsRectangle() const { const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper(); @@ -180,15 +182,15 @@ Rectangle ShapeType::getAbsRectangle() const if (nLeft == 0 && maTypeModel.maPosition == "absolute") nLeft = 1; - return Rectangle( + return awt::Rectangle( nLeft, ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maTypeModel.maTop, 0, false, true ) + ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maTypeModel.maMarginTop, 0, false, true ), nWidth, nHeight ); } -Rectangle ShapeType::getRelRectangle() const +awt::Rectangle ShapeType::getRelRectangle() const { - return Rectangle( + return awt::Rectangle( maTypeModel.maLeft.toInt32(), maTypeModel.maTop.toInt32(), maTypeModel.maWidth.toInt32(), @@ -294,7 +296,7 @@ Reference< XShape > ShapeBase::convertAndInsert( const Reference< XShapes >& rxS { /* Calculate shape rectangle. Applications may do something special according to some imported shape client data (e.g. Excel cell anchor). */ - Rectangle aShapeRect = calcShapeRectangle( pParentAnchor ); + awt::Rectangle aShapeRect = calcShapeRectangle( pParentAnchor ); if( ((aShapeRect.Width > 0) || (aShapeRect.Height > 0)) && rxShapes.is() ) { @@ -330,13 +332,13 @@ void ShapeBase::convertFormatting( const Reference< XShape >& rxShape, const Sha { /* Calculate shape rectangle. Applications may do something special according to some imported shape client data (e.g. Excel cell anchor). */ - Rectangle aShapeRect = calcShapeRectangle( pParentAnchor ); + awt::Rectangle aShapeRect = calcShapeRectangle( pParentAnchor ); // convert the shape, if the calculated rectangle is not empty if( (aShapeRect.Width > 0) || (aShapeRect.Height > 0) ) { - rxShape->setPosition( Point( aShapeRect.X, aShapeRect.Y ) ); - rxShape->setSize( Size( aShapeRect.Width, aShapeRect.Height ) ); + rxShape->setPosition( awt::Point( aShapeRect.X, aShapeRect.Y ) ); + rxShape->setSize( awt::Size( aShapeRect.Width, aShapeRect.Height ) ); convertShapeProperties( rxShape ); } } @@ -344,11 +346,11 @@ void ShapeBase::convertFormatting( const Reference< XShape >& rxShape, const Sha // protected ------------------------------------------------------------------ -Rectangle ShapeBase::calcShapeRectangle( const ShapeParentAnchor* pParentAnchor ) const +awt::Rectangle ShapeBase::calcShapeRectangle( const ShapeParentAnchor* pParentAnchor ) const { /* Calculate shape rectangle. Applications may do something special according to some imported shape client data (e.g. Excel cell anchor). */ - Rectangle aShapeRect; + awt::Rectangle aShapeRect; const ClientData* pClientData = getClientData(); if( !pClientData || !mrDrawing.convertClientAnchor( aShapeRect, pClientData->maAnchor ) ) aShapeRect = getRectangle( pParentAnchor ); @@ -448,15 +450,20 @@ void lcl_SetAnchorType(PropertySet& rPropSet, const ShapeTypeModel& rTypeModel) lcl_setSurround( rPropSet, rTypeModel ); } -Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const Rectangle& rShapeRect ) const +Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const awt::Rectangle& rShapeRect ) const { - Rectangle aShapeRect(rShapeRect); + awt::Rectangle aShapeRect(rShapeRect); + boost::optional<sal_Int32> oRotation; + if (!maTypeModel.maRotation.isEmpty()) + oRotation.reset(maTypeModel.maRotation.toInt32()); if (!maTypeModel.maFlip.isEmpty()) { if (maTypeModel.maFlip.equalsAscii("x")) { aShapeRect.X += aShapeRect.Width; aShapeRect.Width *= -1; + if (oRotation) + oRotation.reset(360 - *oRotation); } else if (maTypeModel.maFlip.equalsAscii("y")) { @@ -523,9 +530,11 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes } PropertySet aPropertySet(xShape); - if (xShape.is() && !maTypeModel.maRotation.isEmpty()) + if (xShape.is() && oRotation) { - aPropertySet.setAnyProperty(PROP_RotateAngle, makeAny(maTypeModel.maRotation.toInt32() * 100)); + // See DffPropertyReader::Fix16ToAngle(): in VML, positive rotation angles are clockwise, we have them as counter-clockwise. + // Additionally, VML type is 0..360, our is 0.36000. + aPropertySet.setAnyProperty(PROP_RotateAngle, makeAny(sal_Int32(NormAngle360((*oRotation) * -100)))); // If rotation is used, simple setPosition() is not enough. aPropertySet.setAnyProperty(PROP_HoriOrientPosition, makeAny( aShapeRect.X ) ); aPropertySet.setAnyProperty(PROP_VertOrientPosition, makeAny( aShapeRect.Y ) ); @@ -536,7 +545,7 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes return xShape; } -Reference< XShape > SimpleShape::createPictureObject( const Reference< XShapes >& rxShapes, const Rectangle& rShapeRect, OUString& rGraphicPath ) const +Reference< XShape > SimpleShape::createPictureObject( const Reference< XShapes >& rxShapes, const awt::Rectangle& rShapeRect, OUString& rGraphicPath ) const { Reference< XShape > xShape = mrDrawing.createAndInsertXShape( "com.sun.star.drawing.GraphicObjectShape", rxShapes, rShapeRect ); if( xShape.is() ) @@ -569,7 +578,7 @@ RectangleShape::RectangleShape( Drawing& rDrawing ) : { } -Reference<XShape> RectangleShape::implConvertAndInsert(const Reference<XShapes>& rxShapes, const Rectangle& rShapeRect) const +Reference<XShape> RectangleShape::implConvertAndInsert(const Reference<XShapes>& rxShapes, const awt::Rectangle& rShapeRect) const { OUString aGraphicPath = getGraphicPath(); @@ -610,14 +619,14 @@ PolyLineShape::PolyLineShape( Drawing& rDrawing ) : { } -Reference< XShape > PolyLineShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const Rectangle& rShapeRect ) const +Reference< XShape > PolyLineShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const awt::Rectangle& rShapeRect ) const { Reference< XShape > xShape = SimpleShape::implConvertAndInsert( rxShapes, rShapeRect ); // polygon path - Rectangle aCoordSys = getCoordSystem(); + awt::Rectangle aCoordSys = getCoordSystem(); if( !maShapeModel.maPoints.empty() && (aCoordSys.Width > 0) && (aCoordSys.Height > 0) ) { - ::std::vector< Point > aAbsPoints; + ::std::vector< awt::Point > aAbsPoints; for( ShapeModel::PointVector::const_iterator aIt = maShapeModel.maPoints.begin(), aEnd = maShapeModel.maPoints.end(); aIt != aEnd; ++aIt ) aAbsPoints.push_back( lclGetAbsPoint( *aIt, rShapeRect, aCoordSys ) ); PointSequenceSequence aPointSeq( 1 ); @@ -667,17 +676,17 @@ BezierShape::BezierShape(Drawing& rDrawing) { } -Reference< XShape > BezierShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const Rectangle& rShapeRect ) const +Reference< XShape > BezierShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const awt::Rectangle& rShapeRect ) const { Reference< XShape > xShape = SimpleShape::implConvertAndInsert( rxShapes, rShapeRect ); - Rectangle aCoordSys = getCoordSystem(); + awt::Rectangle aCoordSys = getCoordSystem(); if( (aCoordSys.Width > 0) && (aCoordSys.Height > 0) ) { const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper(); // Bezier paths may consist of one or more sub-paths - typedef ::std::vector< ::std::vector< Point > > SubPathList; + typedef ::std::vector< ::std::vector< awt::Point > > SubPathList; typedef ::std::vector< ::std::vector< PolygonFlags > > FlagsList; SubPathList aCoordLists; FlagsList aFlagLists; @@ -686,24 +695,24 @@ Reference< XShape > BezierShape::implConvertAndInsert( const Reference< XShapes // Curve defined by to, from, control1 and control2 attributes if ( maShapeModel.maVmlPath.isEmpty() ) { - aCoordLists.push_back( ::std::vector< Point >() ); + aCoordLists.push_back( ::std::vector< awt::Point >() ); aFlagLists.push_back( ::std::vector< PolygonFlags >() ); // Start point aCoordLists[ 0 ].push_back( - Point(ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maFrom.getToken( 0, ',', nIndex ), 0, true, true ), + awt::Point(ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maFrom.getToken( 0, ',', nIndex ), 0, true, true ), ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maFrom.getToken( 0, ',', nIndex ), 0, false, true ) ) ); // Control point 1 aCoordLists[ 0 ].push_back( - Point( ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maControl1.getToken( 0, ',', nIndex ), 0, true, true ), + awt::Point( ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maControl1.getToken( 0, ',', nIndex ), 0, true, true ), ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maControl1.getToken( 0, ',', nIndex ), 0, false, true ) ) ); // Control point 2 aCoordLists[ 0 ].push_back( - Point( ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maControl2.getToken( 0, ',', nIndex ), 0, true, true ), + awt::Point( ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maControl2.getToken( 0, ',', nIndex ), 0, true, true ), ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maControl2.getToken( 0, ',', nIndex ), 0, false, true ) ) ); // End point aCoordLists[ 0 ].push_back( - Point( ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maTo.getToken( 0, ',', nIndex ), 0, true, true ), + awt::Point( ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maTo.getToken( 0, ',', nIndex ), 0, true, true ), ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maShapeModel.maTo.getToken( 0, ',', nIndex ), 0, false, true ) ) ); // First and last points are normals, points 2 and 4 are controls @@ -718,7 +727,7 @@ Reference< XShape > BezierShape::implConvertAndInsert( const Reference< XShapes ConversionHelper::decodeVmlPath( aCoordLists, aFlagLists, maShapeModel.maVmlPath ); for ( SubPathList::iterator aListIt = aCoordLists.begin(); aListIt != aCoordLists.end(); ++aListIt ) - for ( ::std::vector< Point >::iterator aPointIt = (*aListIt).begin(); aPointIt != (*aListIt).end(); ++aPointIt) + for ( ::std::vector< awt::Point >::iterator aPointIt = (*aListIt).begin(); aPointIt != (*aListIt).end(); ++aPointIt) { (*aPointIt) = lclGetAbsPoint( (*aPointIt), rShapeRect, aCoordSys ); } @@ -738,8 +747,8 @@ Reference< XShape > BezierShape::implConvertAndInsert( const Reference< XShapes } // Hacky way of ensuring the shape is correctly sized/positioned - xShape->setSize( Size( rShapeRect.Width, rShapeRect.Height ) ); - xShape->setPosition( Point( rShapeRect.X, rShapeRect.Y ) ); + xShape->setSize( awt::Size( rShapeRect.Width, rShapeRect.Height ) ); + xShape->setPosition( awt::Point( rShapeRect.X, rShapeRect.Y ) ); return xShape; } @@ -750,7 +759,7 @@ CustomShape::CustomShape( Drawing& rDrawing ) : { } -Reference< XShape > CustomShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const Rectangle& rShapeRect ) const +Reference< XShape > CustomShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const awt::Rectangle& rShapeRect ) const { // try to create a custom shape Reference< XShape > xShape = SimpleShape::implConvertAndInsert( rxShapes, rShapeRect ); @@ -775,7 +784,7 @@ ComplexShape::ComplexShape( Drawing& rDrawing ) : { } -Reference< XShape > ComplexShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const Rectangle& rShapeRect ) const +Reference< XShape > ComplexShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const awt::Rectangle& rShapeRect ) const { XmlFilterBase& rFilter = mrDrawing.getFilter(); sal_Int32 nShapeType = getShapeType(); @@ -791,7 +800,7 @@ Reference< XShape > ComplexShape::implConvertAndInsert( const Reference< XShapes return Reference< XShape >(); PropertyMap aOleProps; - Size aOleSize( rShapeRect.Width, rShapeRect.Height ); + awt::Size aOleSize( rShapeRect.Width, rShapeRect.Height ); if( rFilter.getOleObjectHelper().importOleObject( aOleProps, *pOleObjectInfo, aOleSize ) ) { Reference< XShape > xShape = mrDrawing.createAndInsertXShape( CREATE_OUSTRING( "com.sun.star.drawing.OLE2Shape" ), rxShapes, rShapeRect ); @@ -883,7 +892,7 @@ const ShapeBase* GroupShape::getChildById( const OUString& rShapeId ) const return mxChildren->getShapeById( rShapeId, true ); } -Reference< XShape > GroupShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const Rectangle& rShapeRect ) const +Reference< XShape > GroupShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const awt::Rectangle& rShapeRect ) const { Reference< XShape > xGroupShape; // check that this shape contains children and a valid coordinate system commit bf32dfeffb79fc7c06189f9040f7a8db3ce56700 Author: Miklos Vajna <vmik...@suse.cz> Date: Tue May 28 17:44:25 2013 +0200 bnc#817956 VML import of v:textpath Word exposes this as Watermark in its UI. Change-Id: I23d9b2aab2dab60a98c7f456b0592c2b74bcaf81 (cherry picked from commit 290695c785ef831abb6e78cd3675bc071f05f643) Conflicts: oox/inc/oox/vml/vmlformatting.hxx oox/inc/oox/vml/vmlshape.hxx oox/source/vml/vmlformatting.cxx oox/source/vml/vmlshapecontext.cxx diff --git a/oox/inc/oox/vml/vmlformatting.hxx b/oox/inc/oox/vml/vmlformatting.hxx index 277b358..7ead90e 100644 --- a/oox/inc/oox/vml/vmlformatting.hxx +++ b/oox/inc/oox/vml/vmlformatting.hxx @@ -24,6 +24,7 @@ #include "oox/dllapi.h" #include <com/sun/star/awt/Point.hpp> #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp> +#include <com/sun/star/drawing/XShape.hpp> #include <vector> @@ -225,6 +226,17 @@ struct FillModel // ============================================================================ +/** The shadow model structure contains all shape textpath properties. */ +struct OOX_DLLPUBLIC TextpathModel +{ + OptValue<OUString> moString; ///< Specifies the string of the textpath. + + TextpathModel(); + + /** Writes the properties to the passed property map. */ + void pushToPropMap(oox::drawingml::ShapePropertyMap& rPropMap, com::sun::star::uno::Reference<com::sun::star::drawing::XShape> xShape) const; +}; + } // namespace vml } // namespace oox diff --git a/oox/inc/oox/vml/vmlshape.hxx b/oox/inc/oox/vml/vmlshape.hxx index 1c289b2..ce8c325 100644 --- a/oox/inc/oox/vml/vmlshape.hxx +++ b/oox/inc/oox/vml/vmlshape.hxx @@ -87,6 +87,7 @@ struct OOX_DLLPUBLIC ShapeTypeModel StrokeModel maStrokeModel; ///< Border line formatting. FillModel maFillModel; ///< Shape fill formatting. + TextpathModel maTextpathModel; ///< Shape textpath formatting. OptValue< ::rtl::OUString > moGraphicPath; ///< Path to a graphic for this shape. OptValue< ::rtl::OUString > moGraphicTitle; ///< Title of the graphic. diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx index ed6355b..02559d4 100644 --- a/oox/source/vml/vmlformatting.cxx +++ b/oox/source/vml/vmlformatting.cxx @@ -18,6 +18,10 @@ */ #include "oox/vml/vmlformatting.hxx" +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp> +#include <com/sun/star/text/XTextRange.hpp> #include <rtl/strbuf.hxx> #include "oox/drawingml/color.hxx" #include "oox/drawingml/drawingmltypes.hxx" @@ -33,6 +37,7 @@ namespace vml { // ============================================================================ using namespace ::com::sun::star::geometry; +using namespace ::com::sun::star; using ::oox::drawingml::Color; using ::oox::drawingml::FillProperties; @@ -713,6 +718,57 @@ void FillModel::pushToPropMap( ShapePropertyMap& rPropMap, const GraphicHelper& // ============================================================================ +TextpathModel::TextpathModel() +{ +} + +beans::PropertyValue lcl_createTextpathProps() +{ + uno::Sequence<beans::PropertyValue> aTextpathPropSeq(4); + aTextpathPropSeq[0].Name = "TextPath"; + aTextpathPropSeq[0].Value <<= sal_True; + aTextpathPropSeq[1].Name = "TextPathMode"; + aTextpathPropSeq[1].Value <<= drawing::EnhancedCustomShapeTextPathMode_SHAPE; + aTextpathPropSeq[2].Name = "ScaleX"; + aTextpathPropSeq[2].Value <<= sal_False; + aTextpathPropSeq[3].Name = "SameLetterHeights"; + aTextpathPropSeq[3].Value <<= sal_False; + + beans::PropertyValue aRet; + aRet.Name = "TextPath"; + aRet.Value <<= aTextpathPropSeq; + return aRet; +} + +void TextpathModel::pushToPropMap(ShapePropertyMap& rPropMap, uno::Reference<drawing::XShape> xShape) const +{ + if (moString.has()) + { + uno::Reference<text::XTextRange> xTextRange(xShape, uno::UNO_QUERY); + xTextRange->setString(moString.get()); + + uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY); + uno::Sequence<beans::PropertyValue> aGeomPropSeq = xPropertySet->getPropertyValue("CustomShapeGeometry").get< uno::Sequence<beans::PropertyValue> >(); + bool bFound = false; + for (int i = 0; i < aGeomPropSeq.getLength(); ++i) + { + beans::PropertyValue& rProp = aGeomPropSeq[i]; + if (rProp.Name == "TextPath") + { + bFound = true; + rProp = lcl_createTextpathProps(); + } + } + if (!bFound) + { + sal_Int32 nSize = aGeomPropSeq.getLength(); + aGeomPropSeq.realloc(nSize+1); + aGeomPropSeq[nSize] = lcl_createTextpathProps(); + } + rPropMap.setAnyProperty(PROP_CustomShapeGeometry, uno::makeAny(aGeomPropSeq)); + } +} + } // namespace vml } // namespace oox diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 5a4a165..3861ee1 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -369,6 +369,8 @@ void ShapeBase::convertShapeProperties( const Reference< XShape >& rxShape ) con aPropMap.setProperty(PROP_BackColor, aPropMap[PROP_FillColor]); aPropMap.erase(PROP_FillColor); } + else if (xSInfo->supportsService("com.sun.star.drawing.CustomShape")) + maTypeModel.maTextpathModel.pushToPropMap(aPropMap, rxShape); PropertySet( rxShape ).setProperties( aPropMap ); } diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx index 6a53f17..7757c8b 100644 --- a/oox/source/vml/vmlshapecontext.cxx +++ b/oox/source/vml/vmlshapecontext.cxx @@ -335,6 +335,9 @@ ContextHandlerRef ShapeTypeContext::onCreateContext( sal_Int32 nElement, const A mrTypeModel.moWrapType = rAttribs.getString(XML_type); mrTypeModel.moWrapSide = rAttribs.getString(XML_side); break; + case VML_TOKEN( textpath ): + mrTypeModel.maTextpathModel.moString.assignIfUsed(rAttribs.getString(XML_string)); + break; } return 0; } commit d2e061be5c8788865e524bf7e7b355f65892a79e Author: Miklos Vajna <vmik...@suse.cz> Date: Tue May 28 16:11:38 2013 +0200 bnc#817956 DOCX import: missing last character of shape text Make sure writerfilter only removes the last character of the text if it's a newline. Change-Id: I96980e2d148ced93363b3147545afdd0dd070e5d (cherry picked from commit 4eaabc45f76aefe82558b283975ab9df3aea7fce) diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 39f1977..0cd81c3 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -309,7 +309,10 @@ void DomainMapper_Impl::RemoveLastParagraph( ) else { xCursor->goLeft( 1, true ); - xCursor->setString(OUString()); + // If this is a text on a shape, possibly the text has the trailing + // newline removed already. + if (xCursor->getString() == "\n") + xCursor->setString(OUString()); } } catch( const uno::Exception& ) commit 74657a03218e37fc833c002a22c42950768ad7a3 Author: Miklos Vajna <vmik...@suse.cz> Date: Mon May 27 17:09:44 2013 +0200 bnc#817956 DOCX import of document background color See wwSectionManager::SetSegmentToPageDesc(), this has to be applied to every page style. Change-Id: Iea2707ae665a55eabda3ed7575cf3658f7af5237 (cherry picked from commit 992da0d5cf04497bad55637f6a6ebfcdaec03e16) Conflicts: sw/qa/extras/ooxmlimport/ooxmlimport.cxx diff --git a/sw/qa/extras/ooxmlimport/data/page-background.docx b/sw/qa/extras/ooxmlimport/data/page-background.docx new file mode 100644 index 0000000..8c1f2ebd Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/page-background.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 38f3df3..69862e5 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -118,6 +118,7 @@ public: void testFdo59273(); void testN592908_Frame(); void testN592908_Picture(); + void testPageBackground(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -188,6 +189,7 @@ void Test::run() {"fdo59273.docx", &Test::testFdo59273}, {"n592908-frame.docx", &Test::testN592908_Frame}, {"n592908-picture.docx", &Test::testN592908_Picture}, + {"page-background.docx", &Test::testPageBackground}, }; for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) { @@ -1179,6 +1181,13 @@ void Test::testN592908_Picture() CPPUNIT_ASSERT_EQUAL(eValue, text::WrapTextMode_PARALLEL); } +void Test::testPageBackground() +{ + // The problem was that <w:background w:color="92D050"/> was ignored. + uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0x92D050), getProperty<sal_Int32>(xPageStyle, "BackColor")); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 66b1e6c..5acfb0c 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1446,6 +1446,9 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) case NS_ooxml::LN_CT_SdtListItem_value: m_pImpl->m_pSdtHelper->getDropDownItems().push_back(sStringValue); break; + case NS_ooxml::LN_CT_Background_color: + m_pImpl->m_oBackgroundColor.reset(nIntValue); + break; default: { #if OSL_DEBUG_LEVEL > 0 diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index 8d513bb..e2a43b6 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -680,6 +680,9 @@ public: bool m_bInTableStyleRunProps; SdtHelper* m_pSdtHelper; + + /// Document background color, applied to every page style. + boost::optional<sal_Int32> m_oBackgroundColor; }; } //namespace dmapper } //namespace writerfilter diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index 8f19057..284dfbf 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -889,6 +889,9 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) operator[]( PropertyDefinition( PROP_LEFT_MARGIN, false )) = uno::makeAny( m_nLeftMargin ); operator[]( PropertyDefinition( PROP_RIGHT_MARGIN, false )) = uno::makeAny( m_nRightMargin ); + if (rDM_Impl.m_oBackgroundColor) + operator[](PropertyDefinition(PROP_BACK_COLOR, false)) = uno::makeAny(*rDM_Impl.m_oBackgroundColor); + /*** if headers/footers are available then the top/bottom margins of the header/footer are copied to the top/bottom margin of the page */ diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml index 33b3414..6fc2798 100644 --- a/writerfilter/source/ooxml/model.xml +++ b/writerfilter/source/ooxml/model.xml @@ -14997,7 +14997,7 @@ <ref name="CT_PictureBase"/> <optional> <attribute name="color"> - <text/> + <ref name="ST_HexColor"/> <xs:documentation>Background Color</xs:documentation> </attribute> </optional> commit 6272a497cdb97d2d6b697e0abfe74d42b97470ce Author: Tor Lillqvist <t...@iki.fi> Date: Tue May 28 08:00:53 2013 +0300 Fix compilation error with older compilers Change-Id: If9eff90d91c79d942fec59fee4daedccf7c69a83 diff --git a/sc/source/filter/inc/condformatbuffer.hxx b/sc/source/filter/inc/condformatbuffer.hxx index c7b01ae..d499455 100644 --- a/sc/source/filter/inc/condformatbuffer.hxx +++ b/sc/source/filter/inc/condformatbuffer.hxx @@ -261,7 +261,7 @@ class ExtCfRule RuleType mnRuleType; void* mpTarget; public: - ExtCfRule(void* pTarget = NULL ) : mnRuleType( ExtCfRule::RuleType::UNKNOWN ), mpTarget(pTarget) {} + ExtCfRule(void* pTarget = NULL ) : mnRuleType( ExtCfRule::UNKNOWN ), mpTarget(pTarget) {} void finalizeImport(); void importDataBar( const AttributeList& rAttribs ); void importNegativeFillColor( const AttributeList& rAttribs ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits