xref: /AOO41X/main/vbahelper/source/vbahelper/vbashape.cxx (revision e6ed5fbc51cf474df369618b58e945b84a21a167)
1*e6ed5fbcSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*e6ed5fbcSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*e6ed5fbcSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*e6ed5fbcSAndrew Rist  * distributed with this work for additional information
6*e6ed5fbcSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*e6ed5fbcSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*e6ed5fbcSAndrew Rist  * "License"); you may not use this file except in compliance
9*e6ed5fbcSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*e6ed5fbcSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*e6ed5fbcSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*e6ed5fbcSAndrew Rist  * software distributed under the License is distributed on an
15*e6ed5fbcSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*e6ed5fbcSAndrew Rist  * KIND, either express or implied.  See the License for the
17*e6ed5fbcSAndrew Rist  * specific language governing permissions and limitations
18*e6ed5fbcSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*e6ed5fbcSAndrew Rist  *************************************************************/
21*e6ed5fbcSAndrew Rist 
22*e6ed5fbcSAndrew Rist 
23cdf0e10cSrcweir #include<ooo/vba/office/MsoZOrderCmd.hpp>
24cdf0e10cSrcweir #include<ooo/vba/office/MsoScaleFrom.hpp>
25cdf0e10cSrcweir #include<com/sun/star/container/XNamed.hpp>
26cdf0e10cSrcweir #include<com/sun/star/drawing/ConnectorType.hpp>
27cdf0e10cSrcweir #include <com/sun/star/lang/XEventListener.hpp>
28cdf0e10cSrcweir #include<com/sun/star/drawing/XDrawPagesSupplier.hpp>
29cdf0e10cSrcweir #include<com/sun/star/drawing/XDrawPages.hpp>
30cdf0e10cSrcweir #include<com/sun/star/view/XSelectionSupplier.hpp>
31cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
32cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
33cdf0e10cSrcweir #include <com/sun/star/text/TextContentAnchorType.hpp>
34cdf0e10cSrcweir #include <ooo/vba/word/WdRelativeHorizontalPosition.hpp>
35cdf0e10cSrcweir #include <ooo/vba/word/WdRelativeVerticalPosition.hpp>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
38cdf0e10cSrcweir #include <vos/mutex.hxx>
39cdf0e10cSrcweir #include <vcl/svapp.hxx>
40cdf0e10cSrcweir #include <svx/unopage.hxx>
41cdf0e10cSrcweir #include <svx/unoshape.hxx>
42cdf0e10cSrcweir 
43cdf0e10cSrcweir #include <vbahelper/vbashape.hxx>
44cdf0e10cSrcweir #include <vbahelper/vbatextframe.hxx>
45cdf0e10cSrcweir #include "vbalineformat.hxx"
46cdf0e10cSrcweir #include "vbafillformat.hxx"
47cdf0e10cSrcweir #include "vbapictureformat.hxx"
48cdf0e10cSrcweir #include <vbahelper/vbashaperange.hxx>
49cdf0e10cSrcweir 
50cdf0e10cSrcweir using namespace ::ooo::vba;
51cdf0e10cSrcweir using namespace ::com::sun::star;
52cdf0e10cSrcweir using namespace ::vos;
53cdf0e10cSrcweir 
ScVbaShape(const uno::Reference<XHelperInterface> & xParent,const uno::Reference<uno::XComponentContext> & xContext,const uno::Reference<drawing::XShape> & xShape,const uno::Reference<drawing::XShapes> & xShapes,const uno::Reference<frame::XModel> & xModel,sal_Int32 nType)54cdf0e10cSrcweir ScVbaShape::ScVbaShape( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape >& xShape, const uno::Reference< drawing::XShapes >& xShapes, const uno::Reference< frame::XModel >& xModel, sal_Int32 nType ) throw( lang::IllegalArgumentException ) : ScVbaShape_BASE( xParent, xContext ), m_xShape( xShape ), m_xShapes( xShapes ), m_nType( nType ), m_xModel( xModel )
55cdf0e10cSrcweir {
56cdf0e10cSrcweir     m_xPropertySet.set( m_xShape, uno::UNO_QUERY_THROW );
57cdf0e10cSrcweir     m_pShapeHelper.reset( new ShapeHelper( m_xShape ) );
58cdf0e10cSrcweir     addListeners();
59cdf0e10cSrcweir }
60cdf0e10cSrcweir 
ScVbaShape(const uno::Reference<uno::XComponentContext> & xContext,const uno::Reference<drawing::XShape> & xShape,const uno::Reference<frame::XModel> & xModel)61cdf0e10cSrcweir ScVbaShape::ScVbaShape( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape >& xShape, const uno::Reference< frame::XModel >& xModel ) throw( lang::IllegalArgumentException ) : ScVbaShape_BASE( uno::Reference< XHelperInterface >(), xContext ), m_xShape( xShape ), m_xModel( xModel )
62cdf0e10cSrcweir {
63cdf0e10cSrcweir     // add listener
64cdf0e10cSrcweir     addListeners();
65cdf0e10cSrcweir }
66cdf0e10cSrcweir 
~ScVbaShape()67cdf0e10cSrcweir ScVbaShape::~ScVbaShape()
68cdf0e10cSrcweir {
69cdf0e10cSrcweir     // dtor must never ever throw
70cdf0e10cSrcweir     /*try
71cdf0e10cSrcweir     {
72cdf0e10cSrcweir         removeShapeListener();
73cdf0e10cSrcweir         removeShapesListener();
74cdf0e10cSrcweir     }
75cdf0e10cSrcweir     catch( uno::Exception& )
76cdf0e10cSrcweir     {
77cdf0e10cSrcweir     }*/
78cdf0e10cSrcweir }
79cdf0e10cSrcweir 
80cdf0e10cSrcweir void SAL_CALL
disposing(const lang::EventObject & rEventObject)81cdf0e10cSrcweir ScVbaShape::disposing( const lang::EventObject& rEventObject ) throw( uno::RuntimeException )
82cdf0e10cSrcweir {
83cdf0e10cSrcweir     try
84cdf0e10cSrcweir     {
85cdf0e10cSrcweir     uno::Reference< drawing::XShapes > xShapes( rEventObject.Source, uno::UNO_QUERY );
86cdf0e10cSrcweir     uno::Reference< drawing::XShape > xShape( rEventObject.Source, uno::UNO_QUERY );
87cdf0e10cSrcweir     if ( xShapes.is() )
88cdf0e10cSrcweir         removeShapesListener();
89cdf0e10cSrcweir     if ( xShape.is() )
90cdf0e10cSrcweir         removeShapeListener();
91cdf0e10cSrcweir     }
92cdf0e10cSrcweir     catch( uno::Exception& )
93cdf0e10cSrcweir     {
94cdf0e10cSrcweir     }
95cdf0e10cSrcweir }
96cdf0e10cSrcweir 
97cdf0e10cSrcweir 
addListeners()98cdf0e10cSrcweir void ScVbaShape::addListeners()
99cdf0e10cSrcweir {
100cdf0e10cSrcweir     uno::Reference< lang::XComponent > xComponent( m_xShape, uno::UNO_QUERY );
101cdf0e10cSrcweir     if ( xComponent.is() )
102cdf0e10cSrcweir     	xComponent->addEventListener( this );
103cdf0e10cSrcweir 
104cdf0e10cSrcweir     xComponent.set( m_xShapes, uno::UNO_QUERY );
105cdf0e10cSrcweir     if ( xComponent.is() )
106cdf0e10cSrcweir     	xComponent->addEventListener( this );
107cdf0e10cSrcweir }
108cdf0e10cSrcweir 
109cdf0e10cSrcweir void
removeShapeListener()110cdf0e10cSrcweir ScVbaShape::removeShapeListener() throw( uno::RuntimeException )
111cdf0e10cSrcweir {
112cdf0e10cSrcweir     if( m_xShape.is() )
113cdf0e10cSrcweir     {
114cdf0e10cSrcweir         uno::Reference< lang::XComponent > xComponent( m_xShape, uno::UNO_QUERY_THROW );
115cdf0e10cSrcweir         xComponent->removeEventListener( this );
116cdf0e10cSrcweir     }
117cdf0e10cSrcweir     m_xShape = NULL;
118cdf0e10cSrcweir     m_xPropertySet = NULL;
119cdf0e10cSrcweir }
120cdf0e10cSrcweir 
121cdf0e10cSrcweir void
removeShapesListener()122cdf0e10cSrcweir ScVbaShape::removeShapesListener() throw( uno::RuntimeException )
123cdf0e10cSrcweir {
124cdf0e10cSrcweir     if( m_xShapes.is() )
125cdf0e10cSrcweir     {
126cdf0e10cSrcweir         uno::Reference< lang::XComponent > xComponent( m_xShapes, uno::UNO_QUERY_THROW );
127cdf0e10cSrcweir         xComponent->removeEventListener( this );
128cdf0e10cSrcweir     }
129cdf0e10cSrcweir     m_xShapes = NULL;
130cdf0e10cSrcweir }
131cdf0e10cSrcweir 
132cdf0e10cSrcweir sal_Int32
getType(const css::uno::Reference<drawing::XShape> xShape)133cdf0e10cSrcweir ScVbaShape::getType( const css::uno::Reference< drawing::XShape > xShape ) throw (uno::RuntimeException)
134cdf0e10cSrcweir {
135cdf0e10cSrcweir     rtl::OUString sShapeType;
136cdf0e10cSrcweir     uno::Reference< drawing::XShapeDescriptor > xShapeDescriptor( xShape, uno::UNO_QUERY_THROW );
137cdf0e10cSrcweir     sShapeType = xShapeDescriptor->getShapeType();
138cdf0e10cSrcweir     OSL_TRACE("ScVbaShape::getType: %s", rtl::OUStringToOString( sShapeType, RTL_TEXTENCODING_UTF8 ).getStr() );
139cdf0e10cSrcweir     // office::MsoShapeType::msoDiagram to "com.sun.star.drawing.GroupShape"
140cdf0e10cSrcweir     if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.GroupShape" ) ) )
141cdf0e10cSrcweir         return office::MsoShapeType::msoGroup;
142cdf0e10cSrcweir     else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.GraphicObjectShape" ) ) )
143cdf0e10cSrcweir         return office::MsoShapeType::msoPicture;
144cdf0e10cSrcweir     else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.ControlShape" ) ) ||
145cdf0e10cSrcweir             sShapeType.equals( rtl::OUString::createFromAscii( "FrameShape" ) ) )
146cdf0e10cSrcweir         return office::MsoShapeType::msoOLEControlObject;
147cdf0e10cSrcweir     // OOo don't support office::MsoShapeType::msoComment as a Shape.
148cdf0e10cSrcweir     else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.OLE2Shape" ) ) )
149cdf0e10cSrcweir         return office::MsoShapeType::msoChart;
150cdf0e10cSrcweir     // Art characters office::MsoShapeType::msoTextEffect, in OOo corresponding to "com.sun.star.drawing.CustomShape"
151cdf0e10cSrcweir     else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.ConnectorShape" ) ) )
152cdf0e10cSrcweir     {
153cdf0e10cSrcweir         enum drawing::ConnectorType connectorType;
154cdf0e10cSrcweir         uno::Reference< beans::XPropertySet > xPropertySet( xShape, uno::UNO_QUERY_THROW );
155cdf0e10cSrcweir         xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("EdgeKind")) >>= connectorType;
156cdf0e10cSrcweir         if( connectorType == drawing::ConnectorType_CURVE )
157cdf0e10cSrcweir             return office::MsoShapeType::msoFreeform;
158cdf0e10cSrcweir         else if( connectorType == drawing::ConnectorType_LINE )
159cdf0e10cSrcweir             return office::MsoShapeType::msoLine;
160cdf0e10cSrcweir         else
161cdf0e10cSrcweir             return office::MsoShapeType::msoAutoShape;
162cdf0e10cSrcweir     }
163cdf0e10cSrcweir     else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.LineShape" ) ) )
164cdf0e10cSrcweir         return office::MsoShapeType::msoLine;
165cdf0e10cSrcweir     else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.CustomShape" ) ) ||
166cdf0e10cSrcweir             sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.RectangleShape") ) )
167cdf0e10cSrcweir         return office::MsoShapeType::msoAutoShape;
168cdf0e10cSrcweir     else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.TextShape" ) ) )
169cdf0e10cSrcweir         return office::MsoShapeType::msoTextBox;
170cdf0e10cSrcweir     else
171cdf0e10cSrcweir         throw uno::RuntimeException( rtl::OUString::createFromAscii( "the shape type do not be supported: " ) + sShapeType, uno::Reference< uno::XInterface >() );
172cdf0e10cSrcweir }
173cdf0e10cSrcweir 
174cdf0e10cSrcweir // Attributes
175cdf0e10cSrcweir rtl::OUString SAL_CALL
getName()176cdf0e10cSrcweir ScVbaShape::getName() throw (uno::RuntimeException)
177cdf0e10cSrcweir {
178cdf0e10cSrcweir     rtl::OUString sName;
179cdf0e10cSrcweir     uno::Reference< container::XNamed > xNamed( m_xShape, uno::UNO_QUERY_THROW );
180cdf0e10cSrcweir     sName = xNamed->getName();
181cdf0e10cSrcweir     return sName;
182cdf0e10cSrcweir }
183cdf0e10cSrcweir 
184cdf0e10cSrcweir void SAL_CALL
setName(const rtl::OUString & _name)185cdf0e10cSrcweir ScVbaShape::setName( const rtl::OUString& _name ) throw (uno::RuntimeException)
186cdf0e10cSrcweir {
187cdf0e10cSrcweir     uno::Reference< container::XNamed > xNamed( m_xShape, uno::UNO_QUERY_THROW );
188cdf0e10cSrcweir     xNamed->setName( _name );
189cdf0e10cSrcweir }
190cdf0e10cSrcweir 
191cdf0e10cSrcweir double SAL_CALL
getHeight()192cdf0e10cSrcweir ScVbaShape::getHeight() throw (uno::RuntimeException)
193cdf0e10cSrcweir {
194cdf0e10cSrcweir     return m_pShapeHelper->getHeight();
195cdf0e10cSrcweir }
196cdf0e10cSrcweir 
197cdf0e10cSrcweir void SAL_CALL
setHeight(double _height)198cdf0e10cSrcweir ScVbaShape::setHeight( double _height ) throw (uno::RuntimeException)
199cdf0e10cSrcweir {
200cdf0e10cSrcweir     m_pShapeHelper->setHeight( _height );
201cdf0e10cSrcweir }
202cdf0e10cSrcweir 
203cdf0e10cSrcweir double SAL_CALL
getWidth()204cdf0e10cSrcweir ScVbaShape::getWidth() throw (uno::RuntimeException)
205cdf0e10cSrcweir {
206cdf0e10cSrcweir     return m_pShapeHelper->getWidth();
207cdf0e10cSrcweir }
208cdf0e10cSrcweir 
209cdf0e10cSrcweir void SAL_CALL
setWidth(double _width)210cdf0e10cSrcweir ScVbaShape::setWidth( double _width ) throw (uno::RuntimeException)
211cdf0e10cSrcweir {
212cdf0e10cSrcweir     m_pShapeHelper->setWidth( _width );
213cdf0e10cSrcweir }
214cdf0e10cSrcweir 
215cdf0e10cSrcweir double SAL_CALL
getLeft()216cdf0e10cSrcweir ScVbaShape::getLeft() throw (uno::RuntimeException)
217cdf0e10cSrcweir {
218cdf0e10cSrcweir     return m_pShapeHelper->getLeft();
219cdf0e10cSrcweir }
220cdf0e10cSrcweir 
221cdf0e10cSrcweir void SAL_CALL
setLeft(double _left)222cdf0e10cSrcweir ScVbaShape::setLeft( double _left ) throw (uno::RuntimeException)
223cdf0e10cSrcweir {
224cdf0e10cSrcweir     m_pShapeHelper->setLeft( _left );
225cdf0e10cSrcweir }
226cdf0e10cSrcweir 
227cdf0e10cSrcweir double SAL_CALL
getTop()228cdf0e10cSrcweir ScVbaShape::getTop() throw (uno::RuntimeException)
229cdf0e10cSrcweir {
230cdf0e10cSrcweir     return m_pShapeHelper->getTop();
231cdf0e10cSrcweir }
232cdf0e10cSrcweir 
233cdf0e10cSrcweir void SAL_CALL
setTop(double _top)234cdf0e10cSrcweir ScVbaShape::setTop( double _top ) throw (uno::RuntimeException)
235cdf0e10cSrcweir {
236cdf0e10cSrcweir     return m_pShapeHelper->setTop( _top );
237cdf0e10cSrcweir }
238cdf0e10cSrcweir 
239cdf0e10cSrcweir sal_Bool SAL_CALL
getVisible()240cdf0e10cSrcweir ScVbaShape::getVisible() throw (uno::RuntimeException)
241cdf0e10cSrcweir {
242cdf0e10cSrcweir     //UNO Shapes are always visible
243cdf0e10cSrcweir     return sal_True;
244cdf0e10cSrcweir }
245cdf0e10cSrcweir 
246cdf0e10cSrcweir void SAL_CALL
setVisible(sal_Bool)247cdf0e10cSrcweir ScVbaShape::setVisible( sal_Bool /*_visible*/ ) throw (uno::RuntimeException)
248cdf0e10cSrcweir {
249cdf0e10cSrcweir     //UNO Shapes are always visible
250cdf0e10cSrcweir }
251cdf0e10cSrcweir 
252cdf0e10cSrcweir sal_Int32 SAL_CALL
getZOrderPosition()253cdf0e10cSrcweir ScVbaShape::getZOrderPosition() throw (uno::RuntimeException)
254cdf0e10cSrcweir {
255cdf0e10cSrcweir     sal_Int32 nZOrderPosition = 0;
256cdf0e10cSrcweir     uno::Any aZOrderPosition =  m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ) );
257cdf0e10cSrcweir     aZOrderPosition >>= nZOrderPosition;
258cdf0e10cSrcweir     return nZOrderPosition + 1;
259cdf0e10cSrcweir }
260cdf0e10cSrcweir 
261cdf0e10cSrcweir sal_Int32 SAL_CALL
getType()262cdf0e10cSrcweir ScVbaShape::getType() throw (uno::RuntimeException)
263cdf0e10cSrcweir {
264cdf0e10cSrcweir     return m_nType;
265cdf0e10cSrcweir }
266cdf0e10cSrcweir 
267cdf0e10cSrcweir double SAL_CALL
getRotation()268cdf0e10cSrcweir ScVbaShape::getRotation() throw (uno::RuntimeException)
269cdf0e10cSrcweir {
270cdf0e10cSrcweir     double dRotation = 0;
271cdf0e10cSrcweir     sal_Int32 nRotation = 0;
272cdf0e10cSrcweir     m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "RotateAngle" ) ) >>= nRotation;
273cdf0e10cSrcweir     dRotation = static_cast< double >( nRotation /100 );
274cdf0e10cSrcweir     return dRotation;
275cdf0e10cSrcweir }
276cdf0e10cSrcweir 
277cdf0e10cSrcweir void SAL_CALL
setRotation(double _rotation)278cdf0e10cSrcweir ScVbaShape::setRotation( double _rotation ) throw (uno::RuntimeException)
279cdf0e10cSrcweir {
280cdf0e10cSrcweir     sal_Int32 nRotation = static_cast < sal_Int32 > ( _rotation * 100 );
281cdf0e10cSrcweir     m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "RotateAngle" ), uno::makeAny( nRotation ) );
282cdf0e10cSrcweir }
283cdf0e10cSrcweir 
284cdf0e10cSrcweir uno::Reference< msforms::XLineFormat > SAL_CALL
getLine()285cdf0e10cSrcweir ScVbaShape::getLine() throw (uno::RuntimeException)
286cdf0e10cSrcweir {
287cdf0e10cSrcweir     // TODO should ongly return line
288cdf0e10cSrcweir     return uno::Reference< msforms::XLineFormat >( new ScVbaLineFormat( this, mxContext, m_xShape ) );
289cdf0e10cSrcweir }
290cdf0e10cSrcweir 
291cdf0e10cSrcweir uno::Reference< msforms::XFillFormat > SAL_CALL
getFill()292cdf0e10cSrcweir ScVbaShape::getFill() throw (uno::RuntimeException)
293cdf0e10cSrcweir {
294cdf0e10cSrcweir     return uno::Reference< msforms::XFillFormat >( new ScVbaFillFormat( this, mxContext, m_xShape ) );
295cdf0e10cSrcweir }
296cdf0e10cSrcweir 
297cdf0e10cSrcweir uno::Reference<  msforms::XPictureFormat > SAL_CALL
getPictureFormat()298cdf0e10cSrcweir ScVbaShape::getPictureFormat() throw (uno::RuntimeException)
299cdf0e10cSrcweir {
300cdf0e10cSrcweir     return uno::Reference< msforms::XPictureFormat >( new ScVbaPictureFormat( this, mxContext, m_xShape ) );
301cdf0e10cSrcweir }
302cdf0e10cSrcweir 
303cdf0e10cSrcweir // Methods
304cdf0e10cSrcweir uno::Any SAL_CALL
TextFrame()305cdf0e10cSrcweir ScVbaShape::TextFrame() throw (uno::RuntimeException)
306cdf0e10cSrcweir {
307cdf0e10cSrcweir     uno::Reference< lang::XServiceInfo > xServiceInfo( m_xModel, uno::UNO_QUERY_THROW );
308cdf0e10cSrcweir     if( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SpreadsheetDocument" ) ) ) )
309cdf0e10cSrcweir     {
310cdf0e10cSrcweir         uno::Reference< lang::XMultiServiceFactory > xSF( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
311cdf0e10cSrcweir         uno::Sequence< uno::Any > aArgs(2);
312cdf0e10cSrcweir         aArgs[0] = uno::makeAny( getParent() );
313cdf0e10cSrcweir         aArgs[1] <<= m_xShape;
314cdf0e10cSrcweir         uno::Reference< uno::XInterface > xTextFrame( xSF->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.TextFrame") ) , aArgs ) , uno::UNO_QUERY_THROW );
315cdf0e10cSrcweir         return uno::makeAny( xTextFrame );
316cdf0e10cSrcweir     }
317cdf0e10cSrcweir 
318cdf0e10cSrcweir     return uno::makeAny( uno::Reference< msforms::XTextFrame >( new VbaTextFrame( this, mxContext, m_xShape ) ) );
319cdf0e10cSrcweir }
320cdf0e10cSrcweir 
321cdf0e10cSrcweir void SAL_CALL
Delete()322cdf0e10cSrcweir ScVbaShape::Delete() throw (uno::RuntimeException)
323cdf0e10cSrcweir {
324cdf0e10cSrcweir     OGuard aGuard( Application::GetSolarMutex() );
325cdf0e10cSrcweir     m_xShapes->remove( m_xShape );
326cdf0e10cSrcweir }
327cdf0e10cSrcweir 
328cdf0e10cSrcweir void SAL_CALL
ZOrder(sal_Int32 ZOrderCmd)329cdf0e10cSrcweir ScVbaShape::ZOrder( sal_Int32 ZOrderCmd ) throw (uno::RuntimeException)
330cdf0e10cSrcweir {
331cdf0e10cSrcweir     sal_Int32 nOrderPositon;
332cdf0e10cSrcweir     uno::Any aOrderPostion = m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ) );
333cdf0e10cSrcweir     aOrderPostion >>= nOrderPositon;
334cdf0e10cSrcweir     switch( ZOrderCmd )
335cdf0e10cSrcweir     {
336cdf0e10cSrcweir     case office::MsoZOrderCmd::msoBringToFront:
337cdf0e10cSrcweir         m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ), uno::makeAny( SAL_MAX_INT32 ) );
338cdf0e10cSrcweir         break;
339cdf0e10cSrcweir     case office::MsoZOrderCmd::msoSendToBack:
340cdf0e10cSrcweir         m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ), uno::makeAny( (sal_Int32)0 ) );
341cdf0e10cSrcweir         break;
342cdf0e10cSrcweir     case office::MsoZOrderCmd::msoBringForward:
343cdf0e10cSrcweir         nOrderPositon += 1;
344cdf0e10cSrcweir         m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ), uno::makeAny( nOrderPositon ) );
345cdf0e10cSrcweir         break;
346cdf0e10cSrcweir     case office::MsoZOrderCmd::msoSendBackward:
347cdf0e10cSrcweir         if( nOrderPositon > 0 )
348cdf0e10cSrcweir         {
349cdf0e10cSrcweir             nOrderPositon -= 1;
350cdf0e10cSrcweir             m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ), uno::makeAny( nOrderPositon ) );
351cdf0e10cSrcweir         }
352cdf0e10cSrcweir         break;
353cdf0e10cSrcweir     // below two commands use with Writer for text and image object.
354cdf0e10cSrcweir     case office::MsoZOrderCmd::msoBringInFrontOfText:
355cdf0e10cSrcweir     case office::MsoZOrderCmd::msoSendBehindText:
356cdf0e10cSrcweir         throw uno::RuntimeException( rtl::OUString::createFromAscii( "This ZOrderCmd is not implemented, it is use with writer." ), uno::Reference< uno::XInterface >() );
357cdf0e10cSrcweir     default:
358cdf0e10cSrcweir         throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid Parameter." ), uno::Reference< uno::XInterface >() );
359cdf0e10cSrcweir     }
360cdf0e10cSrcweir }
361cdf0e10cSrcweir 
362cdf0e10cSrcweir void SAL_CALL
IncrementRotation(double Increment)363cdf0e10cSrcweir ScVbaShape::IncrementRotation( double Increment ) throw (uno::RuntimeException)
364cdf0e10cSrcweir {
365cdf0e10cSrcweir     double nCurrentRotation = getRotation();
366cdf0e10cSrcweir     nCurrentRotation += Increment;
367cdf0e10cSrcweir     setRotation(nCurrentRotation);
368cdf0e10cSrcweir }
369cdf0e10cSrcweir 
370cdf0e10cSrcweir void SAL_CALL
IncrementLeft(double Increment)371cdf0e10cSrcweir ScVbaShape::IncrementLeft( double Increment ) throw (uno::RuntimeException)
372cdf0e10cSrcweir {
373cdf0e10cSrcweir     double nCurrentLeft = getLeft();
374cdf0e10cSrcweir     nCurrentLeft += Increment;
375cdf0e10cSrcweir     setLeft(nCurrentLeft);
376cdf0e10cSrcweir }
377cdf0e10cSrcweir 
378cdf0e10cSrcweir void SAL_CALL
IncrementTop(double Increment)379cdf0e10cSrcweir ScVbaShape::IncrementTop( double Increment ) throw (uno::RuntimeException)
380cdf0e10cSrcweir {
381cdf0e10cSrcweir     double nCurrentTop = getTop();
382cdf0e10cSrcweir     nCurrentTop += Increment;
383cdf0e10cSrcweir     setTop(nCurrentTop);
384cdf0e10cSrcweir }
385cdf0e10cSrcweir 
386cdf0e10cSrcweir void SAL_CALL
ScaleHeight(double Factor,sal_Bool,sal_Int32 Scale)387cdf0e10cSrcweir ScVbaShape::ScaleHeight( double Factor, sal_Bool /*RelativeToOriginalSize*/, sal_Int32 Scale ) throw (uno::RuntimeException)
388cdf0e10cSrcweir {
389cdf0e10cSrcweir     double nHeight = getHeight();
390cdf0e10cSrcweir     double nNewHeight = nHeight * Factor;
391cdf0e10cSrcweir     if( Scale == office::MsoScaleFrom::msoScaleFromTopLeft )
392cdf0e10cSrcweir     {
393cdf0e10cSrcweir         setHeight(nNewHeight);
394cdf0e10cSrcweir     }
395cdf0e10cSrcweir     else if( Scale == office::MsoScaleFrom::msoScaleFromBottomRight )
396cdf0e10cSrcweir     {
397cdf0e10cSrcweir         double nDeltaHeight = nNewHeight - nHeight;
398cdf0e10cSrcweir         double nNewTop = getTop() - nDeltaHeight;
399cdf0e10cSrcweir         setTop(nNewTop);
400cdf0e10cSrcweir         setHeight(nNewHeight);
401cdf0e10cSrcweir     }
402cdf0e10cSrcweir     else if( Scale == office::MsoScaleFrom::msoScaleFromMiddle )
403cdf0e10cSrcweir     {
404cdf0e10cSrcweir         double nDeltaHeight = (nNewHeight - nHeight) / 2;
405cdf0e10cSrcweir         double nNewTop = getTop() - nDeltaHeight;
406cdf0e10cSrcweir         setTop(nNewTop);
407cdf0e10cSrcweir         setHeight(nNewHeight);
408cdf0e10cSrcweir     }
409cdf0e10cSrcweir     else
410cdf0e10cSrcweir     {
411cdf0e10cSrcweir         throw uno::RuntimeException( rtl::OUString::createFromAscii( "ScaleHeight.Scale wrong value is given." ) , uno::Reference< uno::XInterface >() );
412cdf0e10cSrcweir     }
413cdf0e10cSrcweir }
414cdf0e10cSrcweir 
415cdf0e10cSrcweir void SAL_CALL
ScaleWidth(double Factor,sal_Bool,sal_Int32 Scale)416cdf0e10cSrcweir ScVbaShape::ScaleWidth( double Factor, sal_Bool /*RelativeToOriginalSize*/, sal_Int32 Scale ) throw (uno::RuntimeException)
417cdf0e10cSrcweir {
418cdf0e10cSrcweir     double nWidth = getWidth();
419cdf0e10cSrcweir     double nNewWidth = nWidth * Factor;
420cdf0e10cSrcweir     if( Scale == office::MsoScaleFrom::msoScaleFromTopLeft )
421cdf0e10cSrcweir     {
422cdf0e10cSrcweir         setWidth(nNewWidth);
423cdf0e10cSrcweir     }
424cdf0e10cSrcweir     else if( Scale == office::MsoScaleFrom::msoScaleFromBottomRight )
425cdf0e10cSrcweir     {
426cdf0e10cSrcweir         double nDeltaWidth = nNewWidth - nWidth;
427cdf0e10cSrcweir         double nNewLeft = getLeft() - nDeltaWidth;
428cdf0e10cSrcweir         setLeft(nNewLeft);
429cdf0e10cSrcweir         setWidth(nNewWidth);
430cdf0e10cSrcweir     }
431cdf0e10cSrcweir     else if( Scale == office::MsoScaleFrom::msoScaleFromMiddle )
432cdf0e10cSrcweir     {
433cdf0e10cSrcweir         double nDeltaWidth = (nNewWidth - nWidth) / 2;
434cdf0e10cSrcweir         double nNewLeft = getLeft() - nDeltaWidth;
435cdf0e10cSrcweir         setLeft(nNewLeft);
436cdf0e10cSrcweir         setWidth(nNewWidth);
437cdf0e10cSrcweir     }
438cdf0e10cSrcweir     else
439cdf0e10cSrcweir     {
440cdf0e10cSrcweir         throw uno::RuntimeException( rtl::OUString::createFromAscii( "ScaleHeight.Scale wrong value is given." ) , uno::Reference< uno::XInterface >() );
441cdf0e10cSrcweir     }
442cdf0e10cSrcweir }
443cdf0e10cSrcweir 
444cdf0e10cSrcweir void SAL_CALL
Select(const uno::Any &)445cdf0e10cSrcweir ScVbaShape::Select( const uno::Any& /*Replace*/ ) throw ( uno::RuntimeException )
446cdf0e10cSrcweir {
447cdf0e10cSrcweir     uno::Reference< view::XSelectionSupplier > xSelectSupp( m_xModel->getCurrentController(), uno::UNO_QUERY_THROW );
448cdf0e10cSrcweir     xSelectSupp->select( uno::makeAny( m_xShape ) );
449cdf0e10cSrcweir }
450cdf0e10cSrcweir 
451cdf0e10cSrcweir // This method should not be part of Shape, what we reall need to do is...
452cdf0e10cSrcweir // dynamically create the appropriate objects e.g. TextBox, Oval, Picture etc.
453cdf0e10cSrcweir // ( e.g. the ones that really do have ShapeRange as an attribute )
454cdf0e10cSrcweir uno::Any SAL_CALL
ShapeRange(const uno::Any & index)455cdf0e10cSrcweir ScVbaShape::ShapeRange( const uno::Any& index ) throw ( uno::RuntimeException )
456cdf0e10cSrcweir {
457cdf0e10cSrcweir 	// perhaps we should store a reference to the Shapes Collection
458cdf0e10cSrcweir 	// in this class
459cdf0e10cSrcweir 	// but anyway this method should not even be in this class
460cdf0e10cSrcweir 	// #TODO not sure what the parent of the Shapes collection should be
461cdf0e10cSrcweir 
462cdf0e10cSrcweir 	XNamedObjectCollectionHelper< drawing::XShape >::XNamedVec aVec;
463cdf0e10cSrcweir 	aVec.push_back( m_xShape );
464cdf0e10cSrcweir 	uno::Reference< container::XIndexAccess > xIndexAccess( new XNamedObjectCollectionHelper< drawing::XShape >( aVec ) );
465cdf0e10cSrcweir 	uno::Reference< container::XChild > xChild( m_xShape, uno::UNO_QUERY_THROW );
466cdf0e10cSrcweir 	// #FIXME for want of a better parent, setting this
467cdf0e10cSrcweir 	uno::Reference< msforms::XShapeRange > xShapeRange( new ScVbaShapeRange( mxParent, mxContext, xIndexAccess,  uno::Reference< drawing::XDrawPage >( xChild->getParent(), uno::UNO_QUERY_THROW ), m_xModel ) );
468cdf0e10cSrcweir 	if ( index.hasValue() )
469cdf0e10cSrcweir 		return xShapeRange->Item( index, uno::Any() );
470cdf0e10cSrcweir 	return uno::makeAny( xShapeRange );
471cdf0e10cSrcweir }
472cdf0e10cSrcweir 
473cdf0e10cSrcweir sal_Bool SAL_CALL
getLockAspectRatio()474cdf0e10cSrcweir ScVbaShape::getLockAspectRatio() throw (uno::RuntimeException)
475cdf0e10cSrcweir {
476cdf0e10cSrcweir     // FIXME:
477cdf0e10cSrcweir     return sal_False;
478cdf0e10cSrcweir }
479cdf0e10cSrcweir 
480cdf0e10cSrcweir void SAL_CALL
setLockAspectRatio(sal_Bool)481cdf0e10cSrcweir ScVbaShape::setLockAspectRatio( sal_Bool /*_lockaspectratio*/ ) throw (uno::RuntimeException)
482cdf0e10cSrcweir {
483cdf0e10cSrcweir     // FIXME:
484cdf0e10cSrcweir }
485cdf0e10cSrcweir 
486cdf0e10cSrcweir sal_Bool SAL_CALL
getLockAnchor()487cdf0e10cSrcweir ScVbaShape::getLockAnchor() throw (uno::RuntimeException)
488cdf0e10cSrcweir {
489cdf0e10cSrcweir     // FIXME:
490cdf0e10cSrcweir     return sal_True;
491cdf0e10cSrcweir }
492cdf0e10cSrcweir 
493cdf0e10cSrcweir void SAL_CALL
setLockAnchor(sal_Bool)494cdf0e10cSrcweir ScVbaShape::setLockAnchor( sal_Bool /*_lockanchor*/ ) throw (uno::RuntimeException)
495cdf0e10cSrcweir {
496cdf0e10cSrcweir     // FIXME:
497cdf0e10cSrcweir }
498cdf0e10cSrcweir 
499cdf0e10cSrcweir sal_Int32 SAL_CALL
getRelativeHorizontalPosition()500cdf0e10cSrcweir ScVbaShape::getRelativeHorizontalPosition() throw (uno::RuntimeException)
501cdf0e10cSrcweir {
502cdf0e10cSrcweir     sal_Int32 nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin;
503cdf0e10cSrcweir     text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH;
504cdf0e10cSrcweir     m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ) ) >>= eType;
505cdf0e10cSrcweir 
506cdf0e10cSrcweir     switch( eType )
507cdf0e10cSrcweir     {
508cdf0e10cSrcweir         case text::TextContentAnchorType_AT_PARAGRAPH:
509cdf0e10cSrcweir         {
510cdf0e10cSrcweir             nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionColumn;
511cdf0e10cSrcweir             break;
512cdf0e10cSrcweir         }
513cdf0e10cSrcweir         case text::TextContentAnchorType_AT_PAGE:
514cdf0e10cSrcweir         {
515cdf0e10cSrcweir             nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionPage;
516cdf0e10cSrcweir             break;
517cdf0e10cSrcweir         }
518cdf0e10cSrcweir         case text::TextContentAnchorType_AT_CHARACTER:
519cdf0e10cSrcweir         {
520cdf0e10cSrcweir             nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionCharacter;
521cdf0e10cSrcweir             break;
522cdf0e10cSrcweir         }
523cdf0e10cSrcweir         case text::TextContentAnchorType_AT_FRAME:
524cdf0e10cSrcweir         case text::TextContentAnchorType_AS_CHARACTER:
525cdf0e10cSrcweir         {
526cdf0e10cSrcweir             nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin;
527cdf0e10cSrcweir             break;
528cdf0e10cSrcweir         }
529cdf0e10cSrcweir         default:
530cdf0e10cSrcweir         {
531cdf0e10cSrcweir             nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin;
532cdf0e10cSrcweir         }
533cdf0e10cSrcweir     }
534cdf0e10cSrcweir     return nRelativeHorizontalPosition;
535cdf0e10cSrcweir }
536cdf0e10cSrcweir 
537cdf0e10cSrcweir void SAL_CALL
setRelativeHorizontalPosition(::sal_Int32 _relativehorizontalposition)538cdf0e10cSrcweir ScVbaShape::setRelativeHorizontalPosition( ::sal_Int32 _relativehorizontalposition ) throw (uno::RuntimeException)
539cdf0e10cSrcweir {
540cdf0e10cSrcweir     text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH;
541cdf0e10cSrcweir     switch( _relativehorizontalposition )
542cdf0e10cSrcweir     {
543cdf0e10cSrcweir         case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionCharacter:
544cdf0e10cSrcweir         {
545cdf0e10cSrcweir             eType = text::TextContentAnchorType_AT_CHARACTER;
546cdf0e10cSrcweir             break;
547cdf0e10cSrcweir         }
548cdf0e10cSrcweir         case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionColumn:
549cdf0e10cSrcweir         case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin:
550cdf0e10cSrcweir         {
551cdf0e10cSrcweir             eType = text::TextContentAnchorType_AT_PARAGRAPH;
552cdf0e10cSrcweir             break;
553cdf0e10cSrcweir         }
554cdf0e10cSrcweir         case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionPage:
555cdf0e10cSrcweir         {
556cdf0e10cSrcweir             eType = text::TextContentAnchorType_AT_PAGE;
557cdf0e10cSrcweir             break;
558cdf0e10cSrcweir         }
559cdf0e10cSrcweir         default:
560cdf0e10cSrcweir         {
561cdf0e10cSrcweir             DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
562cdf0e10cSrcweir         }
563cdf0e10cSrcweir     }
564cdf0e10cSrcweir     m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ), uno::makeAny( eType ) );
565cdf0e10cSrcweir }
566cdf0e10cSrcweir 
567cdf0e10cSrcweir sal_Int32 SAL_CALL
getRelativeVerticalPosition()568cdf0e10cSrcweir ScVbaShape::getRelativeVerticalPosition() throw (uno::RuntimeException)
569cdf0e10cSrcweir {
570cdf0e10cSrcweir     sal_Int32 nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin;
571cdf0e10cSrcweir     text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH;
572cdf0e10cSrcweir     m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ) ) >>= eType;
573cdf0e10cSrcweir 
574cdf0e10cSrcweir     switch( eType )
575cdf0e10cSrcweir     {
576cdf0e10cSrcweir         case text::TextContentAnchorType_AT_PARAGRAPH:
577cdf0e10cSrcweir         {
578cdf0e10cSrcweir             nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionParagraph;
579cdf0e10cSrcweir             break;
580cdf0e10cSrcweir         }
581cdf0e10cSrcweir         case text::TextContentAnchorType_AT_PAGE:
582cdf0e10cSrcweir         {
583cdf0e10cSrcweir             nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionPage;
584cdf0e10cSrcweir             break;
585cdf0e10cSrcweir         }
586cdf0e10cSrcweir         case text::TextContentAnchorType_AT_CHARACTER:
587cdf0e10cSrcweir         {
588cdf0e10cSrcweir             nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionLine;
589cdf0e10cSrcweir             break;
590cdf0e10cSrcweir         }
591cdf0e10cSrcweir         case text::TextContentAnchorType_AT_FRAME:
592cdf0e10cSrcweir         case text::TextContentAnchorType_AS_CHARACTER:
593cdf0e10cSrcweir         {
594cdf0e10cSrcweir             nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin;
595cdf0e10cSrcweir             break;
596cdf0e10cSrcweir         }
597cdf0e10cSrcweir         default:
598cdf0e10cSrcweir         {
599cdf0e10cSrcweir             nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin;
600cdf0e10cSrcweir         }
601cdf0e10cSrcweir     }
602cdf0e10cSrcweir     return nRelativeVerticalPosition;
603cdf0e10cSrcweir }
604cdf0e10cSrcweir 
605cdf0e10cSrcweir void SAL_CALL
setRelativeVerticalPosition(::sal_Int32 _relativeverticalposition)606cdf0e10cSrcweir ScVbaShape::setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition ) throw (uno::RuntimeException)
607cdf0e10cSrcweir {
608cdf0e10cSrcweir     text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH;
609cdf0e10cSrcweir     switch( _relativeverticalposition )
610cdf0e10cSrcweir     {
611cdf0e10cSrcweir         case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionLine:
612cdf0e10cSrcweir         {
613cdf0e10cSrcweir             eType = text::TextContentAnchorType_AT_CHARACTER;
614cdf0e10cSrcweir             break;
615cdf0e10cSrcweir         }
616cdf0e10cSrcweir         case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionParagraph:
617cdf0e10cSrcweir         case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin:
618cdf0e10cSrcweir         {
619cdf0e10cSrcweir             eType = text::TextContentAnchorType_AT_PARAGRAPH;
620cdf0e10cSrcweir             break;
621cdf0e10cSrcweir         }
622cdf0e10cSrcweir         case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionPage:
623cdf0e10cSrcweir         {
624cdf0e10cSrcweir             eType = text::TextContentAnchorType_AT_PAGE;
625cdf0e10cSrcweir             break;
626cdf0e10cSrcweir         }
627cdf0e10cSrcweir         default:
628cdf0e10cSrcweir         {
629cdf0e10cSrcweir             DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
630cdf0e10cSrcweir         }
631cdf0e10cSrcweir     }
632cdf0e10cSrcweir     m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ), uno::makeAny( eType ) );
633cdf0e10cSrcweir }
634cdf0e10cSrcweir 
635cdf0e10cSrcweir uno::Any SAL_CALL
WrapFormat()636cdf0e10cSrcweir ScVbaShape::WrapFormat() throw (uno::RuntimeException)
637cdf0e10cSrcweir {
638cdf0e10cSrcweir     uno::Reference< lang::XServiceInfo > xServiceInfo( m_xModel, uno::UNO_QUERY_THROW );
639cdf0e10cSrcweir     if( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument" ) ) ) )
640cdf0e10cSrcweir     {
641cdf0e10cSrcweir         uno::Reference< lang::XMultiServiceFactory > xSF( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
642cdf0e10cSrcweir         uno::Sequence< uno::Any > aArgs(2);
643cdf0e10cSrcweir         aArgs[0] = uno::makeAny( getParent() );
644cdf0e10cSrcweir         aArgs[1] <<= m_xShape;
645cdf0e10cSrcweir         uno::Reference< uno::XInterface > xWrapFormat( xSF->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.WrapFormat") ) , aArgs ) , uno::UNO_QUERY_THROW );
646cdf0e10cSrcweir         return uno::makeAny( xWrapFormat );
647cdf0e10cSrcweir     }
648cdf0e10cSrcweir     throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
649cdf0e10cSrcweir }
650cdf0e10cSrcweir 
651cdf0e10cSrcweir 
652cdf0e10cSrcweir rtl::OUString&
getServiceImplName()653cdf0e10cSrcweir ScVbaShape::getServiceImplName()
654cdf0e10cSrcweir {
655cdf0e10cSrcweir 	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaShape") );
656cdf0e10cSrcweir 	return sImplName;
657cdf0e10cSrcweir }
658cdf0e10cSrcweir 
659cdf0e10cSrcweir uno::Sequence< rtl::OUString >
getServiceNames()660cdf0e10cSrcweir ScVbaShape::getServiceNames()
661cdf0e10cSrcweir {
662cdf0e10cSrcweir 	static uno::Sequence< rtl::OUString > aServiceNames;
663cdf0e10cSrcweir 	if ( aServiceNames.getLength() == 0 )
664cdf0e10cSrcweir 	{
665cdf0e10cSrcweir 		aServiceNames.realloc( 1 );
666cdf0e10cSrcweir 		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msform.Shape" ) );
667cdf0e10cSrcweir 	}
668cdf0e10cSrcweir 	return aServiceNames;
669cdf0e10cSrcweir }
670