[Libreoffice-commits] core.git: oox/source

Miklos Vajna vmiklos at collabora.co.uk
Fri Dec 4 00:10:11 PST 2015


 oox/source/vml/vmlshape.cxx |   42 ++++++++++++------------------------------
 1 file changed, 12 insertions(+), 30 deletions(-)

New commits:
commit 5c2f78cd15563389496979e50a38980b65b7f12b
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Dec 4 09:08:44 2015 +0100

    Prefer STL container to manual realloc
    
    Change-Id: Id586934c8ff635b1ec2b645b0956cc60960f6078

diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 222e38d..ae717ed 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -61,6 +61,8 @@
 #include "svx/EnhancedCustomShapeTypeNames.hxx"
 #include <svx/unoapi.hxx>
 #include <svx/svdoashp.hxx>
+#include <comphelper/sequence.hxx>
+#include <comphelper/propertyvalue.hxx>
 
 using ::com::sun::star::beans::XPropertySet;
 using ::com::sun::star::uno::Any;
@@ -335,46 +337,26 @@ Reference< XShape > ShapeBase::convertAndInsert( const Reference< XShapes >& rxS
 
                 if (xSInfo->supportsService("com.sun.star.text.TextFrame"))
                 {
-                    uno::Sequence<beans::PropertyValue> aGrabBag;
                     uno::Reference<beans::XPropertySet> propertySet (xShape, uno::UNO_QUERY);
-                    propertySet->getPropertyValue("FrameInteropGrabBag") >>= aGrabBag;
-                    sal_Int32 length;
+                    uno::Any aAny = propertySet->getPropertyValue("FrameInteropGrabBag");
+                    auto aGrabBag = comphelper::sequenceToContainer< std::vector<beans::PropertyValue> >(aAny.get< uno::Sequence<beans::PropertyValue> >());
 
-                    length = aGrabBag.getLength();
-                    aGrabBag.realloc( length+1 );
-                    aGrabBag[length].Name = "VML-Z-ORDER";
-                    aGrabBag[length].Value = uno::makeAny( maTypeModel.maZIndex.toInt32() );
+                    aGrabBag.push_back(comphelper::makePropertyValue("VML-Z-ORDER", maTypeModel.maZIndex.toInt32()));
 
                     if( !s_mso_next_textbox.isEmpty() )
-                    {
-                        length = aGrabBag.getLength();
-                        aGrabBag.realloc( length+1 );
-                        aGrabBag[length].Name = "mso-next-textbox";
-                        aGrabBag[length].Value = uno::makeAny( s_mso_next_textbox );
-                    }
+                        aGrabBag.push_back(comphelper::makePropertyValue("mso-next-textbox", s_mso_next_textbox));
 
                     if( !sLinkChainName.isEmpty() )
                     {
-                        length = aGrabBag.getLength();
-                        aGrabBag.realloc( length+4 );
-                        aGrabBag[length].Name   = "TxbxHasLink";
-                        aGrabBag[length].Value   = uno::makeAny( true );
-                        aGrabBag[length+1].Name = "Txbx-Id";
-                        aGrabBag[length+1].Value = uno::makeAny( id );
-                        aGrabBag[length+2].Name = "Txbx-Seq";
-                        aGrabBag[length+2].Value = uno::makeAny( seq );
-                        aGrabBag[length+3].Name = "LinkChainName";
-                        aGrabBag[length+3].Value = uno::makeAny( sLinkChainName );
+                        aGrabBag.push_back(comphelper::makePropertyValue("TxbxHasLink", true));
+                        aGrabBag.push_back(comphelper::makePropertyValue("Txbx-Id", id));
+                        aGrabBag.push_back(comphelper::makePropertyValue("Txbx-Seq", seq));
+                        aGrabBag.push_back(comphelper::makePropertyValue("LinkChainName", sLinkChainName));
                     }
 
                     if(!(maTypeModel.maRotation).isEmpty())
-                    {
-                        length = aGrabBag.getLength();
-                        aGrabBag.realloc( length+1 );
-                        aGrabBag[length].Name = "mso-rotation-angle";
-                        aGrabBag[length].Value = uno::makeAny(sal_Int32(NormAngle360((maTypeModel.maRotation.toInt32()) * -100)));
-                    }
-                    propertySet->setPropertyValue( "FrameInteropGrabBag", uno::makeAny(aGrabBag) );
+                        aGrabBag.push_back(comphelper::makePropertyValue("mso-rotation-angle", sal_Int32(NormAngle360((maTypeModel.maRotation.toInt32()) * -100))));
+                    propertySet->setPropertyValue("FrameInteropGrabBag", uno::makeAny(comphelper::containerToSequence(aGrabBag)));
                     sal_Int32 backColorTransparency = 0;
                     propertySet->getPropertyValue("BackColorTransparency")
                         >>= backColorTransparency;


More information about the Libreoffice-commits mailing list