1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #include <vbahelper/helperdecl.hxx> 24 #include <com/sun/star/text/XText.hpp> 25 #include "vbatextframe.hxx" 26 #include "vbacharacters.hxx" 27 28 using namespace ::ooo::vba; 29 using namespace ::com::sun::star; 30 31 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 ) ) 32 { 33 } 34 35 // Methods 36 uno::Any SAL_CALL 37 ScVbaTextFrame::Characters() throw (uno::RuntimeException) 38 { 39 uno::Reference< text::XSimpleText > xSimpleText( m_xShape, uno::UNO_QUERY_THROW ); 40 ScVbaPalette aPalette( SfxObjectShell::Current() ); 41 uno::Any aStart( sal_Int32( 1 ) ); 42 uno::Any aLength(sal_Int32( -1 ) ); 43 return uno::makeAny( uno::Reference< ov::excel::XCharacters >( new ScVbaCharacters( this, mxContext, aPalette, xSimpleText, aStart, aLength, sal_True ) ) ); 44 } 45 46 rtl::OUString& 47 ScVbaTextFrame::getServiceImplName() 48 { 49 static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaTextFrame") ); 50 return sImplName; 51 } 52 53 uno::Sequence< rtl::OUString > 54 ScVbaTextFrame::getServiceNames() 55 { 56 static uno::Sequence< rtl::OUString > aServiceNames; 57 if ( aServiceNames.getLength() == 0 ) 58 { 59 aServiceNames.realloc( 1 ); 60 aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.TextFrame" ) ); 61 } 62 return aServiceNames; 63 } 64 65 namespace textframe 66 { 67 namespace sdecl = comphelper::service_decl; 68 sdecl::vba_service_class_<ScVbaTextFrame, sdecl::with_args<true> > serviceImpl; 69 extern sdecl::ServiceDecl const serviceDecl( 70 serviceImpl, 71 "ScVbaTextFrame", 72 "ooo.vba.excel.TextFrame" ); 73 } 74