diff options
author | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2012-09-26 13:10:31 +0200 |
---|---|---|
committer | Cédric Bosdonnat <cedric.bosdonnat.ooo@free.fr> | 2012-10-02 18:08:18 +0200 |
commit | a8e3f0a50e0e81004ec56b9b0dabc5f3a9ec5792 (patch) | |
tree | e93dfcbaa37434bb68a7e29f41da72acfd1697cd /oox | |
parent | 331bc92dc42cc05bf786ed30f4548b048d98fbf1 (diff) |
sw: implement page-relative size for drawing objects and import them from docx
Conflicts:
oox/inc/oox/vml/vmlshape.hxx
oox/source/vml/vmlshapecontext.cxx
svx/inc/svx/svdobj.hxx
Change-Id: I98b5c53d4860278e3646324ca045114e37b4cf61
Diffstat (limited to 'oox')
-rw-r--r-- | oox/inc/oox/vml/vmlshape.hxx | 4 | ||||
-rw-r--r-- | oox/source/token/properties.txt | 2 | ||||
-rw-r--r-- | oox/source/vml/vmlshape.cxx | 26 | ||||
-rw-r--r-- | oox/source/vml/vmlshapecontext.cxx | 4 |
4 files changed, 36 insertions, 0 deletions
diff --git a/oox/inc/oox/vml/vmlshape.hxx b/oox/inc/oox/vml/vmlshape.hxx index c7484d287f34..cf7100640d06 100644 --- a/oox/inc/oox/vml/vmlshape.hxx +++ b/oox/inc/oox/vml/vmlshape.hxx @@ -86,6 +86,10 @@ struct ShapeTypeModel ::rtl::OUString maRotation; ///< Rotation of the shape, in degrees. ::rtl::OUString maFlip; ///< Flip type of the shape (can be "x" or "y"). sal_Bool mbAutoHeight; ///< If true, the height value is a minimum value (mostly used for textboxes) + ::rtl::OUString maWidthPercent; ///< The width in percents of the WidthRelative + ::rtl::OUString maHeightPercent; ///< The height in percents of the HeightRelative + ::rtl::OUString maWidthRelative; ///< To what the width is relative + ::rtl::OUString maHeightRelative; ///< To what the height is relative sal_Bool mbVisible; /// Visible or Hidden ::rtl::OUString maWrapStyle; /// Wrapping mode for text. diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index 7aaa67354feb..4710f1483a4b 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -373,9 +373,11 @@ ReferenceSheet RefreshPeriod RegularExpressions RelId +RelativeHeight RelativeHorizontalTabbarWidth RelativePosition RelativeSize +RelativeWidth Repeat RepeatDelay Representation diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 6ba41e2f571a..e68bfab84b9c 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -444,6 +444,32 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes PropertySet( xShape ).setAnyProperty( PROP_FrameIsAutomaticHeight, makeAny( maTypeModel.mbAutoHeight ) ); PropertySet( xShape ).setAnyProperty( PROP_SizeType, makeAny( maTypeModel.mbAutoHeight ? SizeType::MIN : SizeType::FIX ) ); } + else + { + // FIXME Setting the relative width/heigh only for everything but text frames as + // TextFrames already have relative widht/heigh feature... but currently not working + // in the way we need. + + // Set the relative width / height if any + if ( !maTypeModel.maWidthPercent.isEmpty( ) ) + { + // Only page-relative width is supported ATM + if ( maTypeModel.maWidthRelative.isEmpty() || maTypeModel.maWidthRelative.equalsAscii( "page" ) ) + { + sal_Int16 nWidth = maTypeModel.maWidthPercent.toInt32() / 10; + PropertySet( xShape ).setAnyProperty(PROP_RelativeWidth, makeAny( nWidth ) ); + } + } + if ( !maTypeModel.maHeightPercent.isEmpty( ) ) + { + // Only page-relative height is supported ATM + if ( maTypeModel.maHeightRelative.isEmpty() || maTypeModel.maHeightRelative.equalsAscii( "page" ) ) + { + sal_Int16 nHeight = maTypeModel.maHeightPercent.toInt32() / 10; + PropertySet( xShape ).setAnyProperty(PROP_RelativeHeight, makeAny( nHeight ) ); + } + } + } // Import Legacy Fragments (if any) if( xShape.is() && !maShapeModel.maLegacyDiagramPath.isEmpty() ) diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx index 11a566f1e5d0..0ed4d8b25076 100644 --- a/oox/source/vml/vmlshapecontext.cxx +++ b/oox/source/vml/vmlshapecontext.cxx @@ -371,6 +371,10 @@ void ShapeTypeContext::setStyle( const OUString& rStyle ) else if( aName == "mso-position-horizontal" ) mrTypeModel.maPositionHorizontal = aValue; else if( aName == "mso-position-vertical" ) mrTypeModel.maPositionVertical = aValue; else if( aName == "mso-fit-shape-to-text" ) mrTypeModel.mbAutoHeight = sal_True; + else if( aName == "mso-width-percent" ) mrTypeModel.maWidthPercent = aValue; + else if( aName == "mso-width-relative" ) mrTypeModel.maWidthRelative = aValue; + else if( aName == "mso-height-percent" ) mrTypeModel.maHeightPercent = aValue; + else if( aName == "mso-height-relative" ) mrTypeModel.maHeightRelative = aValue; else if( aName == "rotation" ) mrTypeModel.maRotation = aValue; else if( aName == "flip" ) mrTypeModel.maFlip = aValue; else if( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "visibility" ) ) ) |