LibreOffice Module vbahelper (master) 1
vbaframe.cxx
Go to the documentation of this file.
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#include <utility>
26
27using namespace com::sun::star;
28using namespace ooo::vba;
29
31 const uno::Reference< XHelperInterface >& xParent,
32 const uno::Reference< uno::XComponentContext >& xContext,
33 const uno::Reference< uno::XInterface >& xControl,
34 const uno::Reference< frame::XModel >& xModel,
35 std::unique_ptr<ov::AbstractGeometryAttributes> pGeomHelper,
36 css::uno::Reference< css::awt::XControl > xDialog ) :
37 FrameImpl_BASE( xParent, xContext, xControl, xModel, std::move(pGeomHelper) ),
38 mxDialog(std::move( xDialog ))
39{
40}
41
42// XFrame attributes
43
44OUString SAL_CALL ScVbaFrame::getCaption()
45{
46 OUString Label;
47 m_xProps->getPropertyValue( "Label" ) >>= Label;
48 return Label;
49}
50
51void SAL_CALL ScVbaFrame::setCaption( const OUString& _caption )
52{
53 m_xProps->setPropertyValue( "Label", uno::Any( _caption ) );
54}
55
56sal_Int32 SAL_CALL ScVbaFrame::getSpecialEffect()
57{
58 return msforms::fmSpecialEffect::fmSpecialEffectEtched;
59}
60
61
62void SAL_CALL ScVbaFrame::setSpecialEffect( sal_Int32 /*nSpecialEffect*/ )
63{
64 // #STUB
65}
66
67sal_Int32 SAL_CALL ScVbaFrame::getBorderStyle()
68{
69 return msforms::fmBorderStyle::fmBorderStyleNone;
70}
71
72void SAL_CALL ScVbaFrame::setBorderStyle( sal_Int32 /*nBorderStyle*/ )
73{
74 // #STUB
75}
76
77uno::Reference< msforms::XNewFont > SAL_CALL ScVbaFrame::getFont()
78{
79 return new VbaNewFont( m_xProps );
80}
81
82// XFrame methods
83
84uno::Any SAL_CALL ScVbaFrame::Controls( const uno::Any& rIndex )
85{
86 // horizontal anchor of frame children is inside border line (add one unit to compensate border line width)
87 double fOffsetX = mpGeometryHelper->getOffsetX() + getLeft() + 1.0;
88 // vertical anchor of frame children is inside border line (add half of text height and one unit to compensate border line width)
89 double fOffsetY = mpGeometryHelper->getOffsetY() + getTop() + (getFont()->getSize() / 2.0) + 1.0;
90
91 uno::Reference< XCollection > xControls( new ScVbaControls( this, mxContext, mxDialog, m_xModel, fOffsetX, fOffsetY ) );
92 if( rIndex.hasValue() )
93 return xControls->Item( rIndex, uno::Any() );
94 return uno::Any( xControls );
95}
96
97// XHelperInterface
98
99VBAHELPER_IMPL_XHELPERINTERFACE( ScVbaFrame, "ooo.vba.msforms.Frame" )
100/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Reference< XPropertySet > m_xProps
virtual OUString SAL_CALL getCaption() override
Definition: vbaframe.cxx:44
virtual void SAL_CALL setCaption(const OUString &_caption) override
Definition: vbaframe.cxx:51
virtual sal_Int32 SAL_CALL getSpecialEffect() override
Definition: vbaframe.cxx:56
virtual css::uno::Reference< ov::msforms::XNewFont > SAL_CALL getFont() override
Definition: vbaframe.cxx:77
css::uno::Reference< css::awt::XControl > mxDialog
Definition: vbaframe.hxx:58
ScVbaFrame(const css::uno::Reference< ov::XHelperInterface > &xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext, const css::uno::Reference< css::uno::XInterface > &xControl, const css::uno::Reference< css::frame::XModel > &xModel, std::unique_ptr< ov::AbstractGeometryAttributes > pGeomHelper, css::uno::Reference< css::awt::XControl > xDialog)
Definition: vbaframe.cxx:30
virtual void SAL_CALL setSpecialEffect(sal_Int32 nSpecialEffect) override
Definition: vbaframe.cxx:62
virtual void SAL_CALL setBorderStyle(sal_Int32 nBorderStyle) override
Definition: vbaframe.cxx:72
virtual sal_Int32 SAL_CALL getBorderStyle() override
Definition: vbaframe.cxx:67
css::uno::Any SAL_CALL Controls(const css::uno::Any &rIndex) override
Definition: vbaframe.cxx:84
Reference< frame::XModel > m_xModel
uno::Reference< uno::XComponentContext > mxContext
bool hasValue()
Reference< XModel > xModel
cppu::ImplInheritanceHelper< ScVbaControl, ov::msforms::XFrame > FrameImpl_BASE
Definition: vbaframe.hxx:29
#define VBAHELPER_IMPL_XHELPERINTERFACE(classname, servicename)
Helper macro to implement the methods 'getServiceImplName()' and 'getServiceNames()' of the 'ooo....