1*e6ed5fbcSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*e6ed5fbcSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*e6ed5fbcSAndrew Rist * or more contributor license agreements. See the NOTICE file
5*e6ed5fbcSAndrew Rist * distributed with this work for additional information
6*e6ed5fbcSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*e6ed5fbcSAndrew Rist * to you under the Apache License, Version 2.0 (the
8*e6ed5fbcSAndrew Rist * "License"); you may not use this file except in compliance
9*e6ed5fbcSAndrew Rist * with the License. You may obtain a copy of the License at
10*e6ed5fbcSAndrew Rist *
11*e6ed5fbcSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*e6ed5fbcSAndrew Rist *
13*e6ed5fbcSAndrew Rist * Unless required by applicable law or agreed to in writing,
14*e6ed5fbcSAndrew Rist * software distributed under the License is distributed on an
15*e6ed5fbcSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*e6ed5fbcSAndrew Rist * KIND, either express or implied. See the License for the
17*e6ed5fbcSAndrew Rist * specific language governing permissions and limitations
18*e6ed5fbcSAndrew Rist * under the License.
19*e6ed5fbcSAndrew Rist *
20*e6ed5fbcSAndrew Rist *************************************************************/
21*e6ed5fbcSAndrew Rist
22*e6ed5fbcSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir #include "vbaframe.hxx"
25cdf0e10cSrcweir #include "vbanewfont.hxx"
26cdf0e10cSrcweir #include "vbacontrols.hxx"
27cdf0e10cSrcweir #include <ooo/vba/msforms/fmBorderStyle.hpp>
28cdf0e10cSrcweir #include <ooo/vba/msforms/fmSpecialEffect.hpp>
29cdf0e10cSrcweir
30cdf0e10cSrcweir using namespace com::sun::star;
31cdf0e10cSrcweir using namespace ooo::vba;
32cdf0e10cSrcweir
33cdf0e10cSrcweir
34cdf0e10cSrcweir const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
35cdf0e10cSrcweir
ScVbaFrame(const uno::Reference<XHelperInterface> & xParent,const uno::Reference<uno::XComponentContext> & xContext,const uno::Reference<uno::XInterface> & xControl,const uno::Reference<frame::XModel> & xModel,ov::AbstractGeometryAttributes * pGeomHelper,const css::uno::Reference<css::awt::XControl> & xDialog)36cdf0e10cSrcweir ScVbaFrame::ScVbaFrame(
37cdf0e10cSrcweir const uno::Reference< XHelperInterface >& xParent,
38cdf0e10cSrcweir const uno::Reference< uno::XComponentContext >& xContext,
39cdf0e10cSrcweir const uno::Reference< uno::XInterface >& xControl,
40cdf0e10cSrcweir const uno::Reference< frame::XModel >& xModel,
41cdf0e10cSrcweir ov::AbstractGeometryAttributes* pGeomHelper,
42cdf0e10cSrcweir const css::uno::Reference< css::awt::XControl >& xDialog ) :
43cdf0e10cSrcweir FrameImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ),
44cdf0e10cSrcweir mxDialog( xDialog )
45cdf0e10cSrcweir {
46cdf0e10cSrcweir }
47cdf0e10cSrcweir
48cdf0e10cSrcweir // XFrame attributes
49cdf0e10cSrcweir
getCaption()50cdf0e10cSrcweir rtl::OUString SAL_CALL ScVbaFrame::getCaption() throw (css::uno::RuntimeException)
51cdf0e10cSrcweir {
52cdf0e10cSrcweir rtl::OUString Label;
53cdf0e10cSrcweir m_xProps->getPropertyValue( LABEL ) >>= Label;
54cdf0e10cSrcweir return Label;
55cdf0e10cSrcweir }
56cdf0e10cSrcweir
setCaption(const rtl::OUString & _caption)57cdf0e10cSrcweir void SAL_CALL ScVbaFrame::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
58cdf0e10cSrcweir {
59cdf0e10cSrcweir m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
60cdf0e10cSrcweir }
61cdf0e10cSrcweir
getSpecialEffect()62cdf0e10cSrcweir sal_Int32 SAL_CALL ScVbaFrame::getSpecialEffect() throw (uno::RuntimeException)
63cdf0e10cSrcweir {
64cdf0e10cSrcweir return msforms::fmSpecialEffect::fmSpecialEffectEtched;
65cdf0e10cSrcweir }
66cdf0e10cSrcweir
setSpecialEffect(sal_Int32)67cdf0e10cSrcweir void SAL_CALL ScVbaFrame::setSpecialEffect( sal_Int32 /*nSpecialEffect*/ ) throw (uno::RuntimeException)
68cdf0e10cSrcweir {
69cdf0e10cSrcweir }
70cdf0e10cSrcweir
getBorderStyle()71cdf0e10cSrcweir sal_Int32 SAL_CALL ScVbaFrame::getBorderStyle() throw (uno::RuntimeException)
72cdf0e10cSrcweir {
73cdf0e10cSrcweir return msforms::fmBorderStyle::fmBorderStyleNone;
74cdf0e10cSrcweir }
75cdf0e10cSrcweir
setBorderStyle(sal_Int32)76cdf0e10cSrcweir void SAL_CALL ScVbaFrame::setBorderStyle( sal_Int32 /*nBorderStyle*/ ) throw (uno::RuntimeException)
77cdf0e10cSrcweir {
78cdf0e10cSrcweir }
79cdf0e10cSrcweir
getFont()80cdf0e10cSrcweir uno::Reference< msforms::XNewFont > SAL_CALL ScVbaFrame::getFont() throw (uno::RuntimeException)
81cdf0e10cSrcweir {
82cdf0e10cSrcweir return new VbaNewFont( this, mxContext, m_xProps );
83cdf0e10cSrcweir }
84cdf0e10cSrcweir
85cdf0e10cSrcweir // XFrame methods
86cdf0e10cSrcweir
Controls(const uno::Any & rIndex)87cdf0e10cSrcweir uno::Any SAL_CALL ScVbaFrame::Controls( const uno::Any& rIndex ) throw (uno::RuntimeException)
88cdf0e10cSrcweir {
89cdf0e10cSrcweir // horizontal anchor of frame children is inside border line (add one unit to compensate border line width)
90cdf0e10cSrcweir double fOffsetX = mpGeometryHelper->getOffsetX() + getLeft() + 1.0;
91cdf0e10cSrcweir // vertical anchor of frame children is inside border line (add half of text height and one unit to compensate border line width)
92cdf0e10cSrcweir double fOffsetY = mpGeometryHelper->getOffsetY() + getTop() + (getFont()->getSize() / 2.0) + 1.0;
93cdf0e10cSrcweir
94cdf0e10cSrcweir uno::Reference< XCollection > xControls( new ScVbaControls( this, mxContext, mxDialog, m_xModel, fOffsetX, fOffsetY ) );
95cdf0e10cSrcweir if( rIndex.hasValue() )
96cdf0e10cSrcweir return uno::Any( xControls->Item( rIndex, uno::Any() ) );
97cdf0e10cSrcweir return uno::Any( xControls );
98cdf0e10cSrcweir }
99cdf0e10cSrcweir
100cdf0e10cSrcweir // XHelperInterface
101cdf0e10cSrcweir
102cdf0e10cSrcweir VBAHELPER_IMPL_XHELPERINTERFACE( ScVbaFrame, "ooo.vba.msforms.Frame" )
103