Branch data 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 "vbaframe.hxx"
21 : : #include "vbanewfont.hxx"
22 : : #include "vbacontrols.hxx"
23 : : #include <ooo/vba/msforms/fmBorderStyle.hpp>
24 : : #include <ooo/vba/msforms/fmSpecialEffect.hpp>
25 : :
26 : : using namespace com::sun::star;
27 : : using namespace ooo::vba;
28 : :
29 : :
30 : 0 : const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
31 : :
32 : 0 : ScVbaFrame::ScVbaFrame(
33 : : const uno::Reference< XHelperInterface >& xParent,
34 : : const uno::Reference< uno::XComponentContext >& xContext,
35 : : const uno::Reference< uno::XInterface >& xControl,
36 : : const uno::Reference< frame::XModel >& xModel,
37 : : ov::AbstractGeometryAttributes* pGeomHelper,
38 : : const css::uno::Reference< css::awt::XControl >& xDialog ) :
39 : : FrameImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ),
40 : 0 : mxDialog( xDialog )
41 : : {
42 : 0 : }
43 : :
44 : : // XFrame attributes
45 : :
46 : 0 : rtl::OUString SAL_CALL ScVbaFrame::getCaption() throw (css::uno::RuntimeException)
47 : : {
48 : 0 : rtl::OUString Label;
49 : 0 : m_xProps->getPropertyValue( LABEL ) >>= Label;
50 : 0 : return Label;
51 : : }
52 : :
53 : 0 : void SAL_CALL ScVbaFrame::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
54 : : {
55 : 0 : m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
56 : 0 : }
57 : :
58 : 0 : sal_Int32 SAL_CALL ScVbaFrame::getSpecialEffect() throw (uno::RuntimeException)
59 : : {
60 : 0 : return msforms::fmSpecialEffect::fmSpecialEffectEtched;
61 : : }
62 : :
63 : 0 : ::sal_Int32 SAL_CALL ScVbaFrame::getForeColor() throw (::com::sun::star::uno::RuntimeException)
64 : : {
65 : 0 : return 0;
66 : : }
67 : :
68 : 0 : void SAL_CALL ScVbaFrame::setForeColor( ::sal_Int32 /*_forecolor*/ ) throw (::com::sun::star::uno::RuntimeException)
69 : : {
70 : 0 : return;
71 : : }
72 : :
73 : :
74 : 0 : void SAL_CALL ScVbaFrame::setSpecialEffect( sal_Int32 /*nSpecialEffect*/ ) throw (uno::RuntimeException)
75 : : {
76 : 0 : }
77 : :
78 : 0 : sal_Int32 SAL_CALL ScVbaFrame::getBorderStyle() throw (uno::RuntimeException)
79 : : {
80 : 0 : return msforms::fmBorderStyle::fmBorderStyleNone;
81 : : }
82 : :
83 : 0 : void SAL_CALL ScVbaFrame::setBorderStyle( sal_Int32 /*nBorderStyle*/ ) throw (uno::RuntimeException)
84 : : {
85 : 0 : }
86 : :
87 : 0 : uno::Reference< msforms::XNewFont > SAL_CALL ScVbaFrame::getFont() throw (uno::RuntimeException)
88 : : {
89 : 0 : return new VbaNewFont( this, mxContext, m_xProps );
90 : : }
91 : :
92 : : // XFrame methods
93 : :
94 : 0 : uno::Any SAL_CALL ScVbaFrame::Controls( const uno::Any& rIndex ) throw (uno::RuntimeException)
95 : : {
96 : : // horizontal anchor of frame children is inside border line (add one unit to compensate border line width)
97 : 0 : double fOffsetX = mpGeometryHelper->getOffsetX() + getLeft() + 1.0;
98 : : // vertical anchor of frame children is inside border line (add half of text height and one unit to compensate border line width)
99 : 0 : double fOffsetY = mpGeometryHelper->getOffsetY() + getTop() + (getFont()->getSize() / 2.0) + 1.0;
100 : :
101 : 0 : uno::Reference< XCollection > xControls( new ScVbaControls( this, mxContext, mxDialog, m_xModel, fOffsetX, fOffsetY ) );
102 : 0 : if( rIndex.hasValue() )
103 : 0 : return uno::Any( xControls->Item( rIndex, uno::Any() ) );
104 : 0 : return uno::Any( xControls );
105 : : }
106 : :
107 : : // XHelperInterface
108 : :
109 : 0 : VBAHELPER_IMPL_XHELPERINTERFACE( ScVbaFrame, "ooo.vba.msforms.Frame" )
110 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|