merge the formfield patch from ooo-build
[ooovba.git] / sc / source / ui / vba / vbatextframe.cxx
blob1a0f588f6cd9d7166696580950d4bcb94589a599
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: vbatextframe.cxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #include <vbahelper/helperdecl.hxx>
31 #include <com/sun/star/drawing/TextFitToSizeType.hpp>
32 #include <com/sun/star/text/XText.hpp>
33 #include "vbatextframe.hxx"
34 #include "vbacharacters.hxx"
36 using namespace ::ooo::vba;
37 using namespace ::com::sun::star;
39 ScVbaTextFrame::ScVbaTextFrame( uno::Sequence< uno::Any> const & args, uno::Reference< uno::XComponentContext> const & xContext ) throw ( lang::IllegalArgumentException ) : ScVbaTextFrame_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0 ), xContext, getXSomethingFromArgs< drawing::XShape >( args, 1, false ) )
43 // Methods
44 uno::Any SAL_CALL
45 ScVbaTextFrame::Characters() throw (uno::RuntimeException)
47 uno::Reference< text::XSimpleText > xSimpleText( m_xShape, uno::UNO_QUERY_THROW );
48 ScVbaPalette aPalette( SfxObjectShell::Current() );
49 uno::Any aStart( sal_Int32( 1 ) );
50 uno::Any aLength(sal_Int32( -1 ) );
51 return uno::makeAny( uno::Reference< ov::excel::XCharacters >( new ScVbaCharacters( this, mxContext, aPalette, xSimpleText, aStart, aLength, sal_True ) ) );
54 rtl::OUString&
55 ScVbaTextFrame::getServiceImplName()
57 static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaTextFrame") );
58 return sImplName;
61 uno::Sequence< rtl::OUString >
62 ScVbaTextFrame::getServiceNames()
64 static uno::Sequence< rtl::OUString > aServiceNames;
65 if ( aServiceNames.getLength() == 0 )
67 aServiceNames.realloc( 1 );
68 aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.TextFrame" ) );
70 return aServiceNames;
73 namespace textframe
75 namespace sdecl = comphelper::service_decl;
76 sdecl::vba_service_class_<ScVbaTextFrame, sdecl::with_args<true> > serviceImpl;
77 extern sdecl::ServiceDecl const serviceDecl(
78 serviceImpl,
79 "ScVbaTextFrame",
80 "ooo.vba.excel.TextFrame" );