bump product version to 5.0.4.1
[LibreOffice.git] / vbahelper / source / msforms / vbaframe.cxx
blob756b82dce226b919608029368b54a2ac5b0e34a0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 "vbaframe.hxx"
21 #include "vbanewfont.hxx"
22 #include "vbacontrols.hxx"
23 #include <ooo/vba/msforms/fmBorderStyle.hpp>
24 #include <ooo/vba/msforms/fmSpecialEffect.hpp>
26 using namespace com::sun::star;
27 using namespace ooo::vba;
29 ScVbaFrame::ScVbaFrame(
30 const uno::Reference< XHelperInterface >& xParent,
31 const uno::Reference< uno::XComponentContext >& xContext,
32 const uno::Reference< uno::XInterface >& xControl,
33 const uno::Reference< frame::XModel >& xModel,
34 ov::AbstractGeometryAttributes* pGeomHelper,
35 const css::uno::Reference< css::awt::XControl >& xDialog ) :
36 FrameImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ),
37 mxDialog( xDialog )
41 // XFrame attributes
43 OUString SAL_CALL ScVbaFrame::getCaption() throw (css::uno::RuntimeException, std::exception)
45 OUString Label;
46 m_xProps->getPropertyValue( "Label" ) >>= Label;
47 return Label;
50 void SAL_CALL ScVbaFrame::setCaption( const OUString& _caption ) throw (::com::sun::star::uno::RuntimeException, std::exception)
52 m_xProps->setPropertyValue( "Label", uno::makeAny( _caption ) );
55 sal_Int32 SAL_CALL ScVbaFrame::getSpecialEffect() throw (uno::RuntimeException, std::exception)
57 return msforms::fmSpecialEffect::fmSpecialEffectEtched;
61 void SAL_CALL ScVbaFrame::setSpecialEffect( sal_Int32 /*nSpecialEffect*/ ) throw (uno::RuntimeException, std::exception)
63 // #STUB
66 sal_Int32 SAL_CALL ScVbaFrame::getBorderStyle() throw (uno::RuntimeException, std::exception)
68 return msforms::fmBorderStyle::fmBorderStyleNone;
71 void SAL_CALL ScVbaFrame::setBorderStyle( sal_Int32 /*nBorderStyle*/ ) throw (uno::RuntimeException, std::exception)
73 // #STUB
76 uno::Reference< msforms::XNewFont > SAL_CALL ScVbaFrame::getFont() throw (uno::RuntimeException, std::exception)
78 return new VbaNewFont( m_xProps );
81 // XFrame methods
83 uno::Any SAL_CALL ScVbaFrame::Controls( const uno::Any& rIndex ) throw (uno::RuntimeException, std::exception)
85 // horizontal anchor of frame children is inside border line (add one unit to compensate border line width)
86 double fOffsetX = mpGeometryHelper->getOffsetX() + getLeft() + 1.0;
87 // vertical anchor of frame children is inside border line (add half of text height and one unit to compensate border line width)
88 double fOffsetY = mpGeometryHelper->getOffsetY() + getTop() + (getFont()->getSize() / 2.0) + 1.0;
90 uno::Reference< XCollection > xControls( new ScVbaControls( this, mxContext, mxDialog, m_xModel, fOffsetX, fOffsetY ) );
91 if( rIndex.hasValue() )
92 return uno::Any( xControls->Item( rIndex, uno::Any() ) );
93 return uno::Any( xControls );
96 // XHelperInterface
98 VBAHELPER_IMPL_XHELPERINTERFACE( ScVbaFrame, "ooo.vba.msforms.Frame" )
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */