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 :
20 : #include "vbatextboxshape.hxx"
21 : #include "vbacharacters.hxx"
22 : #include <com/sun/star/text/XSimpleText.hpp>
23 : #include <vector>
24 :
25 : using namespace com::sun::star;
26 : using namespace ooo::vba;
27 :
28 0 : ScVbaTextBoxShape::ScVbaTextBoxShape( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape >& xShape, const uno::Reference< drawing::XShapes >& xShapes, const uno::Reference< frame::XModel >& xModel ) : TextBoxShapeImpl_BASE( uno::Reference< XHelperInterface >(), xContext, xShape, xShapes, xModel, ScVbaShape::getType( xShape ) )
29 : {
30 0 : m_xTextRange.set( xShape , uno::UNO_QUERY_THROW );
31 0 : m_xModel.set( xModel );
32 0 : }
33 :
34 : OUString SAL_CALL
35 0 : ScVbaTextBoxShape::getText() throw (css::uno::RuntimeException, std::exception)
36 : {
37 0 : return m_xTextRange->getString();
38 : }
39 :
40 : void SAL_CALL
41 0 : ScVbaTextBoxShape::setText( const OUString& _text ) throw (css::uno::RuntimeException, std::exception)
42 : {
43 0 : m_xTextRange->setString( _text );
44 0 : }
45 :
46 : uno::Reference< excel::XCharacters > SAL_CALL
47 0 : ScVbaTextBoxShape::characters( const uno::Any& Start, const uno::Any& Length ) throw (uno::RuntimeException, std::exception)
48 : {
49 0 : ScDocShell* pDocShell = excel::getDocShell( m_xModel );
50 0 : ScDocument* pDoc = pDocShell ? pDocShell->GetDocument() : NULL;
51 :
52 0 : if ( !pDoc )
53 0 : throw uno::RuntimeException("Failed to access document from shell", uno::Reference< uno::XInterface >() );
54 0 : uno::Reference< text::XSimpleText > xSimple( m_xTextRange, uno::UNO_QUERY_THROW );
55 :
56 0 : ScVbaPalette aPalette( pDoc->GetDocumentShell() );
57 0 : return new ScVbaCharacters( this, mxContext, aPalette, xSimple, Start, Length, true );
58 : }
59 :
60 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|