1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "excelvbahelper.hxx"
21 #include "vbatextboxshape.hxx"
22 #include "vbacharacters.hxx"
23 #include <com/sun/star/text/XSimpleText.hpp>
26 using namespace com::sun::star
;
27 using namespace ooo::vba
;
29 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
) )
31 m_xTextRange
.set( xShape
, uno::UNO_QUERY_THROW
);
35 ScVbaTextBoxShape::getText()
37 return m_xTextRange
->getString();
41 ScVbaTextBoxShape::setText( const OUString
& _text
)
43 m_xTextRange
->setString( _text
);
46 uno::Reference
< excel::XCharacters
> SAL_CALL
47 ScVbaTextBoxShape::characters( const uno::Any
& Start
, const uno::Any
& Length
)
49 ScDocShell
* pDocShell
= excel::getDocShell( m_xModel
);
50 ScDocument
* pDoc
= pDocShell
? &pDocShell
->GetDocument() : nullptr;
53 throw uno::RuntimeException(u
"Failed to access document from shell"_ustr
);
54 uno::Reference
< text::XSimpleText
> xSimple( m_xTextRange
, uno::UNO_QUERY_THROW
);
56 ScVbaPalette
aPalette( pDoc
->GetDocumentShell() );
57 return new ScVbaCharacters( this, mxContext
, aPalette
, xSimple
, Start
, Length
, true );
60 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */