1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #include "vbaframe.hxx" 29 #include "vbanewfont.hxx" 30 #include "vbacontrols.hxx" 31 #include <ooo/vba/msforms/fmBorderStyle.hpp> 32 #include <ooo/vba/msforms/fmSpecialEffect.hpp> 33 34 using namespace com::sun::star; 35 using namespace ooo::vba; 36 37 38 const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") ); 39 40 ScVbaFrame::ScVbaFrame( 41 const uno::Reference< XHelperInterface >& xParent, 42 const uno::Reference< uno::XComponentContext >& xContext, 43 const uno::Reference< uno::XInterface >& xControl, 44 const uno::Reference< frame::XModel >& xModel, 45 ov::AbstractGeometryAttributes* pGeomHelper, 46 const css::uno::Reference< css::awt::XControl >& xDialog ) : 47 FrameImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ), 48 mxDialog( xDialog ) 49 { 50 } 51 52 // XFrame attributes 53 54 rtl::OUString SAL_CALL ScVbaFrame::getCaption() throw (css::uno::RuntimeException) 55 { 56 rtl::OUString Label; 57 m_xProps->getPropertyValue( LABEL ) >>= Label; 58 return Label; 59 } 60 61 void SAL_CALL ScVbaFrame::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException) 62 { 63 m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) ); 64 } 65 66 sal_Int32 SAL_CALL ScVbaFrame::getSpecialEffect() throw (uno::RuntimeException) 67 { 68 return msforms::fmSpecialEffect::fmSpecialEffectEtched; 69 } 70 71 void SAL_CALL ScVbaFrame::setSpecialEffect( sal_Int32 /*nSpecialEffect*/ ) throw (uno::RuntimeException) 72 { 73 } 74 75 sal_Int32 SAL_CALL ScVbaFrame::getBorderStyle() throw (uno::RuntimeException) 76 { 77 return msforms::fmBorderStyle::fmBorderStyleNone; 78 } 79 80 void SAL_CALL ScVbaFrame::setBorderStyle( sal_Int32 /*nBorderStyle*/ ) throw (uno::RuntimeException) 81 { 82 } 83 84 uno::Reference< msforms::XNewFont > SAL_CALL ScVbaFrame::getFont() throw (uno::RuntimeException) 85 { 86 return new VbaNewFont( this, mxContext, m_xProps ); 87 } 88 89 // XFrame methods 90 91 uno::Any SAL_CALL ScVbaFrame::Controls( const uno::Any& rIndex ) throw (uno::RuntimeException) 92 { 93 // horizontal anchor of frame children is inside border line (add one unit to compensate border line width) 94 double fOffsetX = mpGeometryHelper->getOffsetX() + getLeft() + 1.0; 95 // vertical anchor of frame children is inside border line (add half of text height and one unit to compensate border line width) 96 double fOffsetY = mpGeometryHelper->getOffsetY() + getTop() + (getFont()->getSize() / 2.0) + 1.0; 97 98 uno::Reference< XCollection > xControls( new ScVbaControls( this, mxContext, mxDialog, m_xModel, fOffsetX, fOffsetY ) ); 99 if( rIndex.hasValue() ) 100 return uno::Any( xControls->Item( rIndex, uno::Any() ) ); 101 return uno::Any( xControls ); 102 } 103 104 // XHelperInterface 105 106 VBAHELPER_IMPL_XHELPERINTERFACE( ScVbaFrame, "ooo.vba.msforms.Frame" ) 107