xref: /trunk/main/sc/source/ui/vba/vbatextframe.cxx (revision 26734c99)
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/drawing/TextFitToSizeType.hpp>
25 #include <com/sun/star/text/XText.hpp>
26 #include "vbatextframe.hxx"
27 #include "vbacharacters.hxx"
28 
29 using namespace ::ooo::vba;
30 using namespace ::com::sun::star;
31 
ScVbaTextFrame(uno::Sequence<uno::Any> const & args,uno::Reference<uno::XComponentContext> const & xContext)32 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 ) )
33 {
34 }
35 
36 // Methods
37 uno::Any SAL_CALL
Characters()38 ScVbaTextFrame::Characters() throw (uno::RuntimeException)
39 {
40     uno::Reference< text::XSimpleText > xSimpleText( m_xShape, uno::UNO_QUERY_THROW );
41     ScVbaPalette aPalette( SfxObjectShell::Current() );
42     uno::Any aStart( sal_Int32( 1 ) );
43     uno::Any aLength(sal_Int32( -1 ) );
44     return uno::makeAny( uno::Reference< ov::excel::XCharacters >( new ScVbaCharacters( this, mxContext, aPalette, xSimpleText, aStart, aLength, sal_True ) ) );
45 }
46 
47 rtl::OUString&
getServiceImplName()48 ScVbaTextFrame::getServiceImplName()
49 {
50     static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaTextFrame") );
51     return sImplName;
52 }
53 
54 uno::Sequence< rtl::OUString >
getServiceNames()55 ScVbaTextFrame::getServiceNames()
56 {
57     static uno::Sequence< rtl::OUString > aServiceNames;
58     if ( aServiceNames.getLength() == 0 )
59     {
60         aServiceNames.realloc( 1 );
61         aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.TextFrame" ) );
62     }
63     return aServiceNames;
64 }
65 
66 namespace textframe
67 {
68 namespace sdecl = comphelper::service_decl;
69 sdecl::vba_service_class_<ScVbaTextFrame, sdecl::with_args<true> > serviceImpl;
70 extern sdecl::ServiceDecl const serviceDecl(
71     serviceImpl,
72     "ScVbaTextFrame",
73     "ooo.vba.excel.TextFrame" );
74 }
75