LCOV - code coverage report
Current view: top level - libreoffice/vbahelper/source/vbahelper - vbashapes.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 217 0.0 %
Date: 2012-12-27 Functions: 0 26 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : #include <com/sun/star/container/XNamed.hpp>
      20             : #include <com/sun/star/view/XSelectionSupplier.hpp>
      21             : #include <com/sun/star/text/WrapTextMode.hpp>
      22             : #include <ooo/vba/msforms/XShapeRange.hpp>
      23             : #include <ooo/vba/office/MsoAutoShapeType.hpp>
      24             : #include <ooo/vba/office/MsoTextOrientation.hpp>
      25             : #include <com/sun/star/lang/XServiceInfo.hpp>
      26             : #include <com/sun/star/text/XText.hpp>
      27             : #include <com/sun/star/text/XTextDocument.hpp>
      28             : #include <com/sun/star/text/XTextContent.hpp>
      29             : #include <com/sun/star/text/TextContentAnchorType.hpp>
      30             : #include <com/sun/star/text/HoriOrientation.hpp>
      31             : #include <com/sun/star/text/VertOrientation.hpp>
      32             : #include <com/sun/star/text/RelOrientation.hpp>
      33             : #include <com/sun/star/text/SizeType.hpp>
      34             : #include <com/sun/star/text/WritingMode.hpp>
      35             : #include <com/sun/star/drawing/LineStyle.hpp>
      36             : 
      37             : #include <vbahelper/vbahelper.hxx>
      38             : #include <vbahelper/vbashape.hxx>
      39             : #include <vbahelper/vbashapes.hxx>
      40             : #include <vbahelper/vbashaperange.hxx>
      41             : 
      42             : using namespace ::ooo::vba;
      43             : using namespace ::com::sun::star;
      44             : 
      45           0 : class VbShapeEnumHelper : public EnumerationHelper_BASE
      46             : {
      47             :         uno::Reference<msforms::XShapes > m_xParent;
      48             :         uno::Reference<container::XIndexAccess > m_xIndexAccess;
      49             :         sal_Int32 nIndex;
      50             : public:
      51           0 :     VbShapeEnumHelper( const uno::Reference< msforms::XShapes >& xParent,  const uno::Reference< container::XIndexAccess >& xIndexAccess ) : m_xParent( xParent ), m_xIndexAccess( xIndexAccess ), nIndex( 0 ) {}
      52           0 :         virtual ::sal_Bool SAL_CALL hasMoreElements(  ) throw (uno::RuntimeException)
      53             :         {
      54           0 :                 return ( nIndex < m_xIndexAccess->getCount() );
      55             :         }
      56           0 :         virtual uno::Any SAL_CALL nextElement(  ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
      57             :         {
      58           0 :                 ScVbaShapes* pShapes = dynamic_cast< ScVbaShapes* >(m_xParent.get());
      59           0 :                 if ( pShapes && hasMoreElements() )
      60           0 :                     return pShapes->createCollectionObject(  m_xIndexAccess->getByIndex( nIndex++ ) );
      61           0 :                 throw container::NoSuchElementException();
      62             :         }
      63             : 
      64             : };
      65             : 
      66           0 : void ScVbaShapes::initBaseCollection()
      67             : {
      68           0 :     if ( m_xNameAccess.is() ) // already has NameAccess
      69           0 :         return;
      70             :     // no NameAccess then use ShapeCollectionHelper
      71           0 :     XNamedObjectCollectionHelper< drawing::XShape >::XNamedVec mShapes;
      72           0 :     sal_Int32 nLen = m_xIndexAccess->getCount();
      73           0 :     mShapes.reserve( nLen );
      74           0 :     for ( sal_Int32 index=0; index<nLen; ++index )
      75           0 :         mShapes.push_back( uno::Reference< drawing::XShape >( m_xIndexAccess->getByIndex( index ) , uno::UNO_QUERY ) );
      76           0 :     uno::Reference< container::XIndexAccess > xShapes( new XNamedObjectCollectionHelper< drawing::XShape >( mShapes ) );
      77           0 :     m_xIndexAccess.set( xShapes, uno::UNO_QUERY );
      78           0 :     m_xNameAccess.set( xShapes, uno::UNO_QUERY );
      79             : }
      80             : 
      81           0 : ScVbaShapes::ScVbaShapes( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess > xShapes, const uno::Reference< frame::XModel>& xModel ): ScVbaShapes_BASE( xParent, xContext, xShapes, sal_True ), m_nNewShapeCount(0), m_xModel( xModel )
      82             : {
      83           0 :     m_xShapes.set( xShapes, uno::UNO_QUERY_THROW );
      84           0 :     m_xDrawPage.set( xShapes, uno::UNO_QUERY_THROW );
      85           0 :     initBaseCollection();
      86           0 : }
      87             : 
      88             : uno::Reference< container::XEnumeration >
      89           0 : ScVbaShapes::createEnumeration() throw (uno::RuntimeException)
      90             : {
      91           0 :     return new VbShapeEnumHelper( this,  m_xIndexAccess );
      92             : }
      93             : 
      94             : uno::Any
      95           0 : ScVbaShapes::createCollectionObject( const css::uno::Any& aSource ) throw (uno::RuntimeException)
      96             : {
      97           0 :     if( aSource.hasValue() )
      98             :     {
      99           0 :         uno::Reference< drawing::XShape > xShape( aSource, uno::UNO_QUERY_THROW );
     100           0 :         return uno::makeAny( uno::Reference< msforms::XShape >( new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, m_xModel, ScVbaShape::getType( xShape ) ) ) );
     101             :     }
     102           0 :     return uno::Any();
     103             : }
     104             : 
     105             : uno::Type
     106           0 : ScVbaShapes::getElementType() throw (uno::RuntimeException)
     107             : {
     108           0 :     return ooo::vba::msforms::XShape::static_type(0);
     109             : }
     110             : 
     111             : OUString
     112           0 : ScVbaShapes::getServiceImplName()
     113             : {
     114           0 :     return OUString("ScVbaShapes");
     115             : }
     116             : 
     117             : uno::Sequence< OUString >
     118           0 : ScVbaShapes::getServiceNames()
     119             : {
     120           0 :     static uno::Sequence< OUString > aServiceNames;
     121           0 :     if ( aServiceNames.getLength() == 0 )
     122             :     {
     123           0 :         aServiceNames.realloc( 1 );
     124           0 :         aServiceNames[ 0 ] =  "ooo.vba.msform.Shapes";
     125             :     }
     126           0 :     return aServiceNames;
     127             : }
     128             : 
     129             : css::uno::Reference< css::container::XIndexAccess >
     130           0 : ScVbaShapes::getShapesByArrayIndices( const uno::Any& Index  ) throw (uno::RuntimeException)
     131             : {
     132           0 :     if ( Index.getValueTypeClass() != uno::TypeClass_SEQUENCE )
     133           0 :         throw uno::RuntimeException();
     134             : 
     135           0 :     uno::Reference< script::XTypeConverter > xConverter = getTypeConverter(mxContext);
     136           0 :     uno::Any aConverted;
     137           0 :     aConverted = xConverter->convertTo( Index, getCppuType((uno::Sequence< uno::Any >*)0) );
     138             : 
     139           0 :     uno::Sequence< uno::Any > sIndices;
     140           0 :     aConverted >>= sIndices;
     141           0 :     XNamedObjectCollectionHelper< drawing::XShape >::XNamedVec mShapes;
     142           0 :     sal_Int32 nElems = sIndices.getLength();
     143           0 :     for( sal_Int32 index = 0; index < nElems; ++index )
     144             :     {
     145           0 :         uno::Reference< drawing::XShape > xShape;
     146           0 :         if ( sIndices[ index ].getValueTypeClass() == uno::TypeClass_STRING )
     147             :         {
     148           0 :             OUString sName;
     149           0 :             sIndices[ index ] >>= sName;
     150           0 :             xShape.set( m_xNameAccess->getByName( sName ), uno::UNO_QUERY );
     151             :         }
     152             :         else
     153             :         {
     154           0 :             sal_Int32 nIndex = 0;
     155           0 :             sIndices[ index ] >>= nIndex;
     156             :             // adjust for 1 based mso indexing
     157           0 :             xShape.set( m_xIndexAccess->getByIndex( nIndex - 1 ), uno::UNO_QUERY );
     158             : 
     159             :         }
     160             :         // populate map with drawing::XShapes
     161           0 :         if ( xShape.is() )
     162           0 :             mShapes.push_back( xShape );
     163           0 :     }
     164           0 :     uno::Reference< container::XIndexAccess > xIndexAccess( new XNamedObjectCollectionHelper< drawing::XShape >( mShapes ) );
     165           0 :     return xIndexAccess;
     166             : }
     167             : 
     168             : uno::Any SAL_CALL
     169           0 : ScVbaShapes::Item( const uno::Any& Index, const uno::Any& Index2 ) throw (uno::RuntimeException)
     170             : {
     171             :     // I don't think we need to support Array of indices for shapes
     172             : /*
     173             :     if ( Index.getValueTypeClass() == uno::TypeClass_SEQUENCE )
     174             :     {
     175             :         uno::Reference< container::XIndexAccess > xIndexAccess( getShapesByArrayIndices( Index ) );
     176             :         // return new collection instance
     177             :         uno::Reference< XCollection > xShapesCollection(  new ScVbaShapes( this->getParent(), mxContext, xIndexAccess ) );
     178             :         return uno::makeAny( xShapesCollection );
     179             :     }
     180             : */
     181           0 :     return  ScVbaShapes_BASE::Item( Index, Index2 );
     182             : }
     183             : 
     184             : uno::Reference< msforms::XShapeRange > SAL_CALL
     185           0 : ScVbaShapes::Range( const uno::Any& shapes ) throw (css::uno::RuntimeException)
     186             : {
     187             :     // shapes, can be an index or an array of indices
     188           0 :     uno::Reference< container::XIndexAccess > xShapes;
     189           0 :     if ( shapes.getValueTypeClass() == uno::TypeClass_SEQUENCE )
     190           0 :         xShapes = getShapesByArrayIndices( shapes );
     191             :     else
     192             :     {
     193             :         // wrap single index into a sequence
     194           0 :         uno::Sequence< uno::Any > sIndices(1);
     195           0 :         sIndices[ 0 ] = shapes;
     196           0 :         uno::Any aIndex;
     197           0 :         aIndex <<= sIndices;
     198           0 :         xShapes = getShapesByArrayIndices( aIndex );
     199             :     }
     200           0 :     return new ScVbaShapeRange(  getParent(), mxContext, xShapes, m_xDrawPage, m_xModel );
     201             : }
     202             : 
     203             : void SAL_CALL
     204           0 : ScVbaShapes::SelectAll() throw (uno::RuntimeException)
     205             : {
     206           0 :     uno::Reference< view::XSelectionSupplier > xSelectSupp( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
     207             :     try
     208             :     {
     209           0 :         xSelectSupp->select( uno::makeAny( m_xShapes ) );
     210             :     }
     211             :     // viewuno.cxx ScTabViewObj::select will throw IllegalArgumentException
     212             :     // if one of the shapes is no 'markable' e.g. a button
     213             :     // the method still works
     214           0 :     catch(const lang::IllegalArgumentException&)
     215             :     {
     216           0 :     }
     217           0 : }
     218             : 
     219             : uno::Reference< drawing::XShape >
     220           0 : ScVbaShapes::createShape( OUString service ) throw (css::uno::RuntimeException)
     221             : {
     222           0 :     uno::Reference< lang::XMultiServiceFactory > xMSF( m_xModel, uno::UNO_QUERY_THROW );
     223           0 :     uno::Reference< drawing::XShape > xShape( xMSF->createInstance( service ), uno::UNO_QUERY_THROW );
     224           0 :     return xShape;
     225             : }
     226             : 
     227             : uno::Any
     228           0 : ScVbaShapes::AddRectangle( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidth, sal_Int32 nLineHeight, uno::Any aRange ) throw (css::uno::RuntimeException)
     229             : {
     230           0 :     OUString sCreateShapeName( "com.sun.star.drawing.RectangleShape" );
     231           0 :     sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( startX );
     232           0 :     sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( startY );
     233           0 :     sal_Int32 nWidth = Millimeter::getInHundredthsOfOneMillimeter( nLineWidth );
     234           0 :     sal_Int32 nHeight = Millimeter::getInHundredthsOfOneMillimeter( nLineHeight );
     235             : 
     236           0 :     uno::Reference< drawing::XShape > xShape( createShape( sCreateShapeName ), uno::UNO_QUERY_THROW );
     237           0 :     m_xShapes->add( xShape );
     238             : 
     239           0 :     OUString sName(createName( "Rectangle" ));
     240           0 :     setDefaultShapeProperties( xShape );
     241           0 :     setShape_NameProperty( xShape, sName );
     242             : 
     243           0 :     awt::Point aMovePositionIfRange(0, 0);
     244           0 :     awt::Point position;
     245           0 :     position.X = nXPos - aMovePositionIfRange.X;
     246           0 :     position.Y = nYPos - aMovePositionIfRange.Y;
     247           0 :     xShape->setPosition( position );
     248             : 
     249           0 :     awt::Size size;
     250           0 :     size.Height = nHeight;
     251           0 :     size.Width = nWidth;
     252           0 :     xShape->setSize( size );
     253             : 
     254           0 :     ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, m_xModel, ScVbaShape::getType( xShape ) );
     255           0 :     pScVbaShape->setRange( aRange );
     256           0 :     return uno::makeAny( uno::Reference< msforms::XShape > ( pScVbaShape ) );
     257             : }
     258             : 
     259             : uno::Any
     260           0 : ScVbaShapes::AddEllipse( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidth, sal_Int32 nLineHeight, uno::Any aRange ) throw (css::uno::RuntimeException)
     261             : {
     262           0 :     OUString sCreateShapeName( "com.sun.star.drawing.EllipseShape" );
     263           0 :     sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( startX );
     264           0 :     sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( startY );
     265           0 :     sal_Int32 nWidth = Millimeter::getInHundredthsOfOneMillimeter( nLineWidth );
     266           0 :     sal_Int32 nHeight = Millimeter::getInHundredthsOfOneMillimeter( nLineHeight );
     267             : 
     268           0 :     uno::Reference< drawing::XShape > xShape( createShape( sCreateShapeName ), uno::UNO_QUERY_THROW );
     269           0 :     m_xShapes->add( xShape );
     270             : 
     271           0 :     awt::Point aMovePositionIfRange( 0, 0 );
     272             :     //TODO helperapi using a writer document
     273             :     /*
     274             :     XDocument xDocument = (XDocument)getParent();
     275             :     if (AnyConverter.isVoid(_aRange))
     276             :     {
     277             :         _aRange = xDocument.Range(new Integer(0), new Integer(1));
     278             :         // Top&Left in Word is Top&Left of the paper and not the writeable area.
     279             :         aMovePositionIfRange = calculateTopLeftMargin((HelperInterfaceAdaptor)xDocument);
     280             :     }
     281             : 
     282             :     setShape_AnchorTypeAndRangeProperty(xShape, _aRange);
     283             :     */
     284           0 :     OUString name(createName( "Oval" ));
     285           0 :     setDefaultShapeProperties(xShape);
     286           0 :     setShape_NameProperty(xShape, name);
     287             : 
     288           0 :     awt::Point position;
     289           0 :     position.X = nXPos - aMovePositionIfRange.X;
     290           0 :     position.Y = nYPos - aMovePositionIfRange.Y;
     291           0 :     xShape->setPosition(position);
     292             : 
     293           0 :     awt::Size size;
     294           0 :     size.Height = nHeight;
     295           0 :     size.Width = nWidth;
     296           0 :     xShape->setSize(size);
     297             : 
     298           0 :     ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, m_xModel, ScVbaShape::getType( xShape ) );
     299           0 :     pScVbaShape->setRange( aRange );
     300           0 :     return uno::makeAny( uno::Reference< msforms::XShape > ( pScVbaShape ) );
     301             : }
     302             : 
     303             : //helpeapi calc
     304             : uno::Any SAL_CALL
     305           0 : ScVbaShapes::AddLine( sal_Int32 StartX, sal_Int32 StartY, sal_Int32 endX, sal_Int32 endY ) throw (uno::RuntimeException)
     306             : {
     307           0 :     sal_Int32 nLineWidth = endX - StartX;
     308           0 :     sal_Int32 nLineHeight = endY - StartY;
     309             : 
     310           0 :     sal_Int32 nHeight = Millimeter::getInHundredthsOfOneMillimeter( nLineHeight );
     311           0 :     sal_Int32 nWidth = Millimeter::getInHundredthsOfOneMillimeter( nLineWidth );
     312           0 :     sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( StartX );
     313           0 :     sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( StartY );
     314             : 
     315           0 :     uno::Reference< drawing::XShape > xShape( createShape( "com.sun.star.drawing.LineShape" ), uno::UNO_QUERY_THROW );
     316           0 :     m_xShapes->add( xShape );
     317             : 
     318           0 :     awt::Point aMovePositionIfRange( 0, 0 );
     319             : 
     320           0 :     OUString name(createName( "Line" ));
     321           0 :     setDefaultShapeProperties(xShape);
     322           0 :     setShape_NameProperty(xShape, name);
     323             : 
     324           0 :     awt::Point position;
     325           0 :     position.X = nXPos - aMovePositionIfRange.X;
     326           0 :     position.Y = nYPos - aMovePositionIfRange.Y;
     327           0 :     xShape->setPosition(position);
     328             : 
     329           0 :     awt::Size size;
     330           0 :     size.Height = nHeight;
     331           0 :     size.Width = nWidth;
     332           0 :     xShape->setSize(size);
     333             : 
     334           0 :     ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, m_xModel, ScVbaShape::getType( xShape ) );
     335           0 :     return uno::makeAny( uno::Reference< msforms::XShape > ( pScVbaShape ) );
     336             : }
     337             : 
     338             : uno::Any SAL_CALL
     339           0 : ScVbaShapes::AddShape( sal_Int32 _nType, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (uno::RuntimeException)
     340             : {
     341           0 :     uno::Any _aAnchor;
     342           0 :     if (_nType == office::MsoAutoShapeType::msoShapeRectangle)
     343             :     {
     344           0 :         return AddRectangle(_nLeft, _nTop, _nWidth, _nHeight, _aAnchor);
     345             :     }
     346           0 :     else if (_nType == office::MsoAutoShapeType::msoShapeOval)
     347             :     {
     348           0 :         return AddEllipse(_nLeft, _nTop, _nWidth, _nHeight, _aAnchor);
     349             :     }
     350           0 :     return uno::Any();
     351             : }
     352             : 
     353             : uno::Any SAL_CALL
     354           0 : ScVbaShapes::AddTextbox( sal_Int32 _nOrientation, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (uno::RuntimeException)
     355             : {
     356           0 :     uno::Reference< lang::XServiceInfo > xServiceInfo( m_xModel, uno::UNO_QUERY_THROW );
     357           0 :     if( xServiceInfo->supportsService( "com.sun.star.text.TextDocument" ) )
     358             :     {
     359           0 :         return AddTextboxInWriter( _nOrientation, _nLeft, _nTop, _nWidth, _nHeight );
     360             :     }
     361           0 :     throw uno::RuntimeException( "Not implemented" , uno::Reference< uno::XInterface >() );
     362             : }
     363             : 
     364             : uno::Any
     365           0 : ScVbaShapes::AddTextboxInWriter( sal_Int32 /*_nOrientation*/, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (uno::RuntimeException)
     366             : {
     367           0 :     OUString sCreateShapeName( "com.sun.star.drawing.TextShape" );
     368           0 :     sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( _nLeft );
     369           0 :     sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( _nTop );
     370           0 :     sal_Int32 nWidth = Millimeter::getInHundredthsOfOneMillimeter( _nWidth );
     371           0 :     sal_Int32 nHeight = Millimeter::getInHundredthsOfOneMillimeter( _nHeight );
     372             : 
     373           0 :     uno::Reference< drawing::XShape > xShape( createShape( sCreateShapeName ), uno::UNO_QUERY_THROW );
     374           0 :     m_xShapes->add( xShape );
     375             : 
     376           0 :     setDefaultShapeProperties(xShape);
     377             : 
     378           0 :     OUString sName(createName( "Text Box" ));
     379           0 :     setShape_NameProperty( xShape, sName );
     380             : 
     381           0 :     awt::Size size;
     382           0 :     size.Height = nHeight;
     383           0 :     size.Width = nWidth;
     384           0 :     xShape->setSize(size);
     385             : 
     386           0 :     uno::Reference< beans::XPropertySet > xShapeProps( xShape, uno::UNO_QUERY_THROW );
     387           0 :     xShapeProps->setPropertyValue( "AnchorType", uno::makeAny( text::TextContentAnchorType_AT_PAGE ) );
     388           0 :     xShapeProps->setPropertyValue( "HoriOrientRelation", uno::makeAny( text::RelOrientation::PAGE_LEFT ) );
     389           0 :     xShapeProps->setPropertyValue( "HoriOrient", uno::makeAny( text::HoriOrientation::NONE ) );
     390           0 :     xShapeProps->setPropertyValue( "HoriOrientPosition", uno::makeAny( nXPos ) );
     391             : 
     392           0 :     xShapeProps->setPropertyValue( "VertOrientRelation", uno::makeAny( text::RelOrientation::PAGE_FRAME ) );
     393           0 :     xShapeProps->setPropertyValue( "VertOrient", uno::makeAny( text::VertOrientation::NONE ) );
     394           0 :     xShapeProps->setPropertyValue( "VertOrientPosition", uno::makeAny( nYPos ) );
     395             : 
     396             :     // set to visible
     397           0 :     drawing::LineStyle aLineStyle = drawing::LineStyle_SOLID;
     398           0 :     xShapeProps->setPropertyValue( "LineStyle", uno::makeAny( aLineStyle ) );
     399             :     // set to font
     400           0 :     sal_Int16 nLayerId = 1;
     401           0 :     OUString sLayerName("Heaven");
     402           0 :     xShapeProps->setPropertyValue( "LayerID", uno::makeAny( nLayerId ) );
     403           0 :     xShapeProps->setPropertyValue( "LayerName", uno::makeAny( sLayerName ) );
     404             : 
     405             : 
     406           0 :     ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, m_xModel, ScVbaShape::getType( xShape ) );
     407           0 :     return uno::makeAny( uno::Reference< msforms::XShape > ( pScVbaShape ) );
     408             : }
     409             : 
     410             : void
     411           0 : ScVbaShapes::setDefaultShapeProperties( uno::Reference< drawing::XShape > xShape ) throw (uno::RuntimeException)
     412             : {
     413           0 :     uno::Reference< beans::XPropertySet > xPropertySet( xShape, uno::UNO_QUERY_THROW );
     414           0 :     xPropertySet->setPropertyValue( "FillStyle", uno::makeAny( OUString("SOLID") ) );
     415           0 :     xPropertySet->setPropertyValue( "FillColor", uno::makeAny( sal_Int32(0xFFFFFF) )  );
     416           0 :     xPropertySet->setPropertyValue( "TextWordWrap", uno::makeAny( text::WrapTextMode_THROUGHT )  );
     417             :     //not find in OOo2.3
     418             :     //xPropertySet->setPropertyValue( rtl::OUString("Opaque"), uno::makeAny( sal_True )  );
     419           0 : }
     420             : 
     421             : void
     422           0 : ScVbaShapes::setShape_NameProperty( uno::Reference< css::drawing::XShape > xShape, OUString sName )
     423             : {
     424           0 :     uno::Reference< beans::XPropertySet > xPropertySet( xShape, uno::UNO_QUERY_THROW );
     425             :     try
     426             :     {
     427           0 :         xPropertySet->setPropertyValue( "Name", uno::makeAny( sName ) );
     428             :     }
     429           0 :     catch(const script::BasicErrorException&)
     430             :     {
     431           0 :     }
     432           0 : }
     433             : 
     434             : OUString
     435           0 : ScVbaShapes::createName( OUString sName )
     436             : {
     437           0 :     sal_Int32 nActNumber = 1 + m_nNewShapeCount;
     438           0 :     m_nNewShapeCount++;
     439           0 :     sName += OUString::valueOf( nActNumber );
     440           0 :     return sName;
     441             : }
     442             : 
     443             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10