editeng/source/items/borderline.cxx | 11 ++- editeng/source/items/frmitems.cxx | 2 offapi/com/sun/star/table/BorderLineStyle.idl | 8 ++ oox/inc/oox/vml/vmlformatting.hxx | 16 ++++ oox/inc/oox/vml/vmlshape.hxx | 1 oox/source/vml/vmlformatting.cxx | 56 +++++++++++++++ oox/source/vml/vmlshape.cxx | 76 ++++++++++++--------- oox/source/vml/vmlshapecontext.cxx | 3 svtools/inc/svtools/ctrlbox.hxx | 1 svtools/source/control/ctrlbox.cxx | 7 + 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/PropertyIds.cxx | 1 writerfilter/source/dmapper/PropertyIds.hxx | 1 writerfilter/source/dmapper/PropertyMap.cxx | 26 ++++++- writerfilter/source/dmapper/PropertyMap.hxx | 3 writerfilter/source/ooxml/model.xml | 2 22 files changed, 205 insertions(+), 40 deletions(-)
New commits: commit f74e7998ce04d54e10aa25eae45d94315768b120 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. (cherry picked from commit f0aa209390aea68f4c23cf16df9d1577aaea91b5) Change-Id: Ib0aef3245f58c62655769357f1f4dd07eef77f62 diff --git a/writerfilter/source/dmapper/BorderHandler.cxx b/writerfilter/source/dmapper/BorderHandler.cxx index 5bb53fd..9e66147 100644 --- a/writerfilter/source/dmapper/BorderHandler.cxx +++ b/writerfilter/source/dmapper/BorderHandler.cxx @@ -48,6 +48,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); @@ -92,7 +93,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 @@ -182,6 +184,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 6d23f12..8214bdb 100644 --- a/writerfilter/source/dmapper/BorderHandler.hxx +++ b/writerfilter/source/dmapper/BorderHandler.hxx @@ -59,6 +59,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]; @@ -75,6 +76,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 1dd4acf..3defa79 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -2718,7 +2718,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 41469d6..ea6e450 100644 --- a/writerfilter/source/dmapper/PageBordersHandler.cxx +++ b/writerfilter/source/dmapper/PageBordersHandler.cxx @@ -10,7 +10,8 @@ namespace dmapper { _PgBorder::_PgBorder( ) : m_nDistance( 0 ), - m_ePos( BORDER_RIGHT ) + m_ePos( BORDER_RIGHT ), + m_bShadow(false) { } @@ -105,6 +106,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 ); } } @@ -118,7 +120,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 d238a71..6f4ce9e 100644 --- a/writerfilter/source/dmapper/PageBordersHandler.hxx +++ b/writerfilter/source/dmapper/PageBordersHandler.hxx @@ -23,6 +23,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/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx index 0a2a313..2189f4d 100644 --- a/writerfilter/source/dmapper/PropertyIds.cxx +++ b/writerfilter/source/dmapper/PropertyIds.cxx @@ -327,6 +327,7 @@ const rtl::OUString& PropertyNameSupplier::GetName( PropertyIds eId ) const case PROP_Z_ORDER: sName = "ZOrder"; break; case PROP_RELATIVE_WIDTH: sName = "RelativeWidth"; break; case PROP_IS_WIDTH_RELATIVE: sName = "IsWidthRelative"; break; + case PROP_SHADOW_FORMAT: sName = "ShadowFormat"; break; } ::std::pair<PropertyNameMap_t::iterator,bool> aInsertIt = m_pImpl->aNameMap.insert( PropertyNameMap_t::value_type( eId, sName )); diff --git a/writerfilter/source/dmapper/PropertyIds.hxx b/writerfilter/source/dmapper/PropertyIds.hxx index 1d39dbb..4e33082 100644 --- a/writerfilter/source/dmapper/PropertyIds.hxx +++ b/writerfilter/source/dmapper/PropertyIds.hxx @@ -300,6 +300,7 @@ enum PropertyIds ,PROP_Z_ORDER ,PROP_RELATIVE_WIDTH ,PROP_IS_WIDTH_RELATIVE + ,PROP_SHADOW_FORMAT }; struct PropertyNameSupplier_Impl; class PropertyNameSupplier diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index 4781a67..5f34542 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -40,6 +40,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> @@ -296,7 +297,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); @@ -414,11 +418,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; } @@ -511,6 +516,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 baf2d69..1c58e45 100644 --- a/writerfilter/source/dmapper/PropertyMap.hxx +++ b/writerfilter/source/dmapper/PropertyMap.hxx @@ -160,6 +160,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; @@ -230,7 +231,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 429b722cb63e3da76527540fb3754e11531e2cf6 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 (cherry picked from commit f2720b87093968670e3fb47d24d4952f1631a654) Conflicts: oox/source/vml/vmlshape.cxx Change-Id: I86464c44022ef8c8a8037d4228bb2a6409fc77af diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 9c4ff10..32ab756 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -413,6 +413,11 @@ void lcl_SetAnchorType(PropertySet& rPropSet, const ShapeTypeModel& rTypeModel) else // Map to as-character by default, that fixes vertical position of some textframes. rPropSet.setProperty(PROP_AnchorType, text::TextContentAnchorType_AT_CHARACTER); + + if ( rTypeModel.maPositionVerticalRelative == "margin" ) + { + rPropSet.setProperty(PROP_VertOrientRelation, text::RelOrientation::PAGE_PRINT_AREA); + } } else if( rTypeModel.maPosition == "relative" ) { // I'm not very sure this is correct either. commit e242e44038dd6ffbb3f3e51148336bbdbddb90e9 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. (cherry picked from commit b2c16f6c1b8bd3c96e0549eb3036c820094a795f Conflicts: oox/source/vml/vmlshape.cxx Change-Id: I591ec3369a5bdca53f9684006a459d11e37fbc33 diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 1c22024..9c4ff10 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -27,6 +27,7 @@ ************************************************************************/ #include <algorithm> +#include <boost/optional.hpp> #include "oox/vml/vmlshape.hxx" @@ -49,6 +50,7 @@ #include <rtl/math.hxx> #include <rtl/ustrbuf.hxx> #include <rtl/oustringostreaminserter.hxx> +#include <svx/svdtrans.hxx> #include "oox/drawingml/shapepropertymap.hxx" #include "oox/helper/graphichelper.hxx" #include "oox/helper/propertyset.hxx" @@ -91,21 +93,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 ); @@ -156,21 +158,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(); @@ -182,15 +184,15 @@ Rectangle ShapeType::getAbsRectangle() const if ( nHeight == 0 ) nHeight = 1; - return Rectangle( + return awt::Rectangle( ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maTypeModel.maLeft, 0, true, true ) + ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maTypeModel.maMarginLeft, 0, true, true ), 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(), @@ -296,7 +298,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() ) { @@ -332,13 +334,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 ); } } @@ -346,11 +348,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 ); @@ -422,15 +424,20 @@ void lcl_SetAnchorType(PropertySet& rPropSet, const ShapeTypeModel& 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")) { @@ -497,9 +504,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 ) ); @@ -510,7 +519,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() ) @@ -548,7 +557,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(); @@ -589,14 +598,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 ); @@ -646,7 +655,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 ); @@ -671,7 +680,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(); @@ -687,7 +696,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 ); @@ -779,7 +788,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 0819da6b65d6fafde81fa55e3744f49ed11ad53d 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. (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 Change-Id: I23d9b2aab2dab60a98c7f456b0592c2b74bcaf81 diff --git a/oox/inc/oox/vml/vmlformatting.hxx b/oox/inc/oox/vml/vmlformatting.hxx index 428e2bd..4d80fc1 100644 --- a/oox/inc/oox/vml/vmlformatting.hxx +++ b/oox/inc/oox/vml/vmlformatting.hxx @@ -31,6 +31,11 @@ #include "oox/helper/helper.hxx" #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> namespace oox { class GraphicHelper; @@ -213,6 +218,17 @@ struct FillModel // ============================================================================ +/** The shadow model structure contains all shape textpath properties. */ +struct OOX_DLLPUBLIC TextpathModel +{ + OptValue<rtl::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 7216941..e73eaa8 100644 --- a/oox/inc/oox/vml/vmlshape.hxx +++ b/oox/inc/oox/vml/vmlshape.hxx @@ -96,6 +96,7 @@ struct ShapeTypeModel StrokeModel maStrokeModel; ///< Border line formatting. FillModel maFillModel; ///< Shape fill formatting. ::rtl::OUString maArcsize; /// round rectangles arc size + 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 6d20276..63f54d6 100644 --- a/oox/source/vml/vmlformatting.cxx +++ b/oox/source/vml/vmlformatting.cxx @@ -28,6 +28,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" @@ -43,6 +47,7 @@ namespace vml { // ============================================================================ using namespace ::com::sun::star::geometry; +using namespace ::com::sun::star; using ::oox::drawingml::Color; using ::oox::drawingml::FillProperties; @@ -587,6 +592,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 e61820c..1c22024 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -371,6 +371,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 4e21ce9..15010db 100644 --- a/oox/source/vml/vmlshapecontext.cxx +++ b/oox/source/vml/vmlshapecontext.cxx @@ -339,6 +339,9 @@ ContextHandlerRef ShapeTypeContext::onCreateContext( sal_Int32 nElement, const A mrTypeModel.moWrapAnchorY = rAttribs.getString(XML_anchory); break; break; + case VML_TOKEN( textpath ): + mrTypeModel.maTextpathModel.moString.assignIfUsed(rAttribs.getString(XML_string)); + break; } return 0; } commit a481759a903e077bc09a7160ff658f5afa9379c8 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 827b72a..ccabf6b5 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -321,7 +321,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& rEx) commit b532f43821d83134e413186d385060a75d851cf7 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. (cherry picked from commit 992da0d5cf04497bad55637f6a6ebfcdaec03e16) Conflicts: sw/qa/extras/ooxmlimport/ooxmlimport.cxx Change-Id: Iea2707ae665a55eabda3ed7575cf3658f7af5237 diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 58cbb4d..1dd4acf 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1506,6 +1506,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 cc6fd63..5906a42 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -661,6 +661,9 @@ public: bool IsNewDoc(); 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 4dcea8e..4781a67 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -885,6 +885,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 47971ff..a4d4069 100644 --- a/writerfilter/source/ooxml/model.xml +++ b/writerfilter/source/ooxml/model.xml @@ -14974,7 +14974,7 @@ <ref name="CT_PictureBase"/> <optional> <attribute name="color"> - <text/> + <ref name="ST_HexColor"/> <xs:documentation>Background Color</xs:documentation> </attribute> </optional> commit 487e34c741231b939b314442b091edb6ab7216a8 Author: Eilidh McAdam <eil...@lanedo.com> Date: Thu Nov 15 00:29:58 2012 +0000 Support added for fine dashing on table borders. When reading in docx documents, fine dashing provides a better visual match for some border types. Added in this patch: - FINE_DASHED in BorderLineStyle UNO enum and in internals - Import of docx table borders using this border style Change-Id: I39cfa18c915ec94d8e4ecfc6a2ca637076d1e468 Reviewed-on: https://gerrit.libreoffice.org/1123 Reviewed-by: Fridrich Strba <fridr...@documentfoundation.org> Tested-by: Fridrich Strba <fridr...@documentfoundation.org> (cherry picked from commit 7d632ff29e601c2e680c4a689997fbf552592a4b) diff --git a/editeng/source/items/borderline.cxx b/editeng/source/items/borderline.cxx index 6fdefe2..0ce62a7 100644 --- a/editeng/source/items/borderline.cxx +++ b/editeng/source/items/borderline.cxx @@ -140,9 +140,11 @@ ConvertBorderStyleFromWord(int const nWordLineStyle) return DOTTED; break; case 7: - case 22: return DASHED; break; + case 22: + return FINE_DASHED; + break; // then the shading beams which we represent by a double line case 23: return DOUBLE; @@ -228,6 +230,10 @@ ConvertBorderWidthFromWord(SvxBorderStyle const eStyle, double const fWidth, case DOTTED: case DASHED: return fWidth; + + // Display a minimum effective border width of 1pt + case FINE_DASHED: + return (fWidth > 0 && fWidth < 20) ? 20 : fWidth; break; // Double lines @@ -282,6 +288,7 @@ ConvertBorderWidthToWord(SvxBorderStyle const eStyle, double const fWidth) case SOLID: case DOTTED: case DASHED: + case FINE_DASHED: return fWidth; break; @@ -347,6 +354,7 @@ BorderWidthImpl SvxBorderLine::getWidthImpl( SvxBorderStyle nStyle ) case SOLID: case DOTTED: case DASHED: + case FINE_DASHED: aImpl = BorderWidthImpl( CHANGE_LINE1, 1.0 ); break; @@ -526,6 +534,7 @@ void SvxBorderLine::GuessLinesWidths( SvxBorderStyle nStyle, sal_uInt16 nOut, sa case SOLID: case DOTTED: case DASHED: + case FINE_DASHED: ::std::swap( nOut, nIn); break; default: diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index dbcde63..c1953df 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -1808,7 +1808,7 @@ sal_Bool SvxBoxItem::LineToSvxLine(const ::com::sun::star::table::BorderLine2& rLine, SvxBorderLine& rSvxLine, sal_Bool bConvert) { SvxBorderStyle const nStyle = - (rLine.LineStyle < 0 || INSET < rLine.LineStyle) + (rLine.LineStyle < 0 || BORDER_LINE_STYLE_MAX < rLine.LineStyle) ? SOLID // default : rLine.LineStyle; diff --git a/offapi/com/sun/star/table/BorderLineStyle.idl b/offapi/com/sun/star/table/BorderLineStyle.idl index 29cfe0d..781473e 100644 --- a/offapi/com/sun/star/table/BorderLineStyle.idl +++ b/offapi/com/sun/star/table/BorderLineStyle.idl @@ -101,6 +101,14 @@ constants BorderLineStyle /** Inset border line. */ const short INSET = 13; + + /** Finely dashed border line. + */ + const short FINE_DASHED = 14; + + /** Maximum valid border line style value. + */ + const short BORDER_LINE_STYLE_MAX = 14; }; //============================================================================= diff --git a/svtools/inc/svtools/ctrlbox.hxx b/svtools/inc/svtools/ctrlbox.hxx index 5cb20ef..dac419d 100644 --- a/svtools/inc/svtools/ctrlbox.hxx +++ b/svtools/inc/svtools/ctrlbox.hxx @@ -54,6 +54,7 @@ typedef ::std::vector< ImplFontNameListData* > ImplFontList; #define STYLE_SOLID ( ( sal_uInt16 ) 0 ) #define STYLE_DOTTED ( ( sal_uInt16 ) 1 ) #define STYLE_DASHED ( ( sal_uInt16 ) 2 ) +#define STYLE_FINE_DASHED ( ( sal_uInt16 ) 14 ) #define STYLE_NONE ( ( sal_uInt16 ) -1) #define CHANGE_LINE1 ( ( sal_uInt16 ) 1 ) diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 4a44d03..554cbf3 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -596,6 +596,13 @@ namespace svtools aPattern.push_back( 20 ); } break; + case STYLE_FINE_DASHED: + if ( eUnit == MAP_PIXEL ) + { + aPattern.push_back( 4 ); + aPattern.push_back( 1 ); + } + break; default: break; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits