2010-10-12 15:53:47 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-06-22 16:25:46 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2011-03-25 10:40:25 +01:00
|
|
|
|
2009-09-18 15:35:47 +00:00
|
|
|
#include "vbacheckbox.hxx"
|
2011-03-25 10:40:25 +01:00
|
|
|
#include "vbanewfont.hxx"
|
2009-09-18 15:35:47 +00:00
|
|
|
#include <vbahelper/helperdecl.hxx>
|
|
|
|
|
|
|
|
using namespace com::sun::star;
|
|
|
|
using namespace ooo::vba;
|
|
|
|
|
|
|
|
ScVbaCheckbox::ScVbaCheckbox( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : CheckBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// Attributes
|
2012-09-07 00:13:30 -03:00
|
|
|
OUString SAL_CALL
|
2017-01-26 12:28:58 +01:00
|
|
|
ScVbaCheckbox::getCaption()
|
2009-09-18 15:35:47 +00:00
|
|
|
{
|
2012-09-07 00:13:30 -03:00
|
|
|
OUString Label;
|
2014-04-06 17:05:12 +02:00
|
|
|
m_xProps->getPropertyValue( "Label" ) >>= Label;
|
2009-09-18 15:35:47 +00:00
|
|
|
return Label;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL
|
2017-01-26 12:28:58 +01:00
|
|
|
ScVbaCheckbox::setCaption( const OUString& _caption )
|
2009-09-18 15:35:47 +00:00
|
|
|
{
|
2014-04-06 17:05:12 +02:00
|
|
|
m_xProps->setPropertyValue( "Label", uno::makeAny( _caption ) );
|
2009-09-18 15:35:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uno::Any SAL_CALL
|
2017-01-26 12:28:58 +01:00
|
|
|
ScVbaCheckbox::getValue()
|
2009-09-18 15:35:47 +00:00
|
|
|
{
|
|
|
|
sal_Int16 nValue = -1;
|
2014-04-06 17:05:12 +02:00
|
|
|
m_xProps->getPropertyValue( "State" ) >>= nValue;
|
2009-09-18 15:35:47 +00:00
|
|
|
if( nValue != 0 )
|
|
|
|
nValue = -1;
|
|
|
|
// return uno::makeAny( nValue );
|
|
|
|
// I must be missing something MSO says value should be -1 if selected, 0 if not
|
|
|
|
// selected
|
2015-07-16 13:58:05 +02:00
|
|
|
return uno::makeAny( nValue == -1 );
|
2009-09-18 15:35:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL
|
2017-01-26 12:28:58 +01:00
|
|
|
ScVbaCheckbox::setValue( const uno::Any& _value )
|
2009-09-18 15:35:47 +00:00
|
|
|
{
|
|
|
|
sal_Int16 nValue = 0;
|
2010-10-06 10:16:27 +01:00
|
|
|
sal_Int16 nOldValue = 0;
|
2014-04-06 17:05:12 +02:00
|
|
|
m_xProps->getPropertyValue( "State" ) >>= nOldValue;
|
2013-04-18 16:35:08 +01:00
|
|
|
if( !( _value >>= nValue ) )
|
2009-09-18 15:35:47 +00:00
|
|
|
{
|
2014-04-30 15:52:49 +02:00
|
|
|
bool bValue = false;
|
2013-04-18 16:35:08 +01:00
|
|
|
_value >>= bValue;
|
2009-09-18 15:35:47 +00:00
|
|
|
if ( bValue )
|
2013-04-18 16:35:08 +01:00
|
|
|
nValue = -1;
|
2009-09-18 15:35:47 +00:00
|
|
|
}
|
2013-04-18 16:35:08 +01:00
|
|
|
|
|
|
|
if( nValue == -1)
|
|
|
|
nValue = 1;
|
2014-04-06 17:05:12 +02:00
|
|
|
m_xProps->setPropertyValue( "State", uno::makeAny( nValue ) );
|
2010-10-06 10:16:27 +01:00
|
|
|
if ( nValue != nOldValue )
|
|
|
|
fireClickEvent();
|
2009-09-18 15:35:47 +00:00
|
|
|
}
|
2011-03-25 10:40:25 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
uno::Reference< msforms::XNewFont > SAL_CALL ScVbaCheckbox::getFont()
|
2011-03-25 10:40:25 +01:00
|
|
|
{
|
2014-09-15 10:04:11 +02:00
|
|
|
return new VbaNewFont( m_xProps );
|
2011-03-25 10:40:25 +01:00
|
|
|
}
|
|
|
|
|
2012-09-07 00:13:30 -03:00
|
|
|
OUString
|
2009-09-18 15:35:47 +00:00
|
|
|
ScVbaCheckbox::getServiceImplName()
|
|
|
|
{
|
2012-09-07 00:13:30 -03:00
|
|
|
return OUString("ScVbaCheckbox");
|
2009-09-18 15:35:47 +00:00
|
|
|
}
|
|
|
|
|
2012-09-07 00:13:30 -03:00
|
|
|
uno::Sequence< OUString >
|
2009-09-18 15:35:47 +00:00
|
|
|
ScVbaCheckbox::getServiceNames()
|
|
|
|
{
|
2012-09-07 00:13:30 -03:00
|
|
|
static uno::Sequence< OUString > aServiceNames;
|
2009-09-18 15:35:47 +00:00
|
|
|
if ( aServiceNames.getLength() == 0 )
|
|
|
|
{
|
|
|
|
aServiceNames.realloc( 1 );
|
2012-09-07 00:13:30 -03:00
|
|
|
aServiceNames[ 0 ] = "ooo.vba.msforms.CheckBox";
|
2009-09-18 15:35:47 +00:00
|
|
|
}
|
|
|
|
return aServiceNames;
|
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Int32 SAL_CALL ScVbaCheckbox::getBackColor()
|
2012-03-20 15:35:30 +00:00
|
|
|
{
|
|
|
|
return ScVbaControl::getBackColor();
|
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
void SAL_CALL ScVbaCheckbox::setBackColor( sal_Int32 nBackColor )
|
2012-03-20 15:35:30 +00:00
|
|
|
{
|
|
|
|
ScVbaControl::setBackColor( nBackColor );
|
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Bool SAL_CALL ScVbaCheckbox::getAutoSize()
|
2012-03-20 15:35:30 +00:00
|
|
|
{
|
|
|
|
return ScVbaControl::getAutoSize();
|
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
void SAL_CALL ScVbaCheckbox::setAutoSize( sal_Bool bAutoSize )
|
2012-03-20 15:35:30 +00:00
|
|
|
{
|
|
|
|
ScVbaControl::setAutoSize( bAutoSize );
|
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Bool SAL_CALL ScVbaCheckbox::getLocked()
|
2012-03-20 15:35:30 +00:00
|
|
|
{
|
|
|
|
return ScVbaControl::getLocked();
|
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
void SAL_CALL ScVbaCheckbox::setLocked( sal_Bool bLocked )
|
2012-03-20 15:35:30 +00:00
|
|
|
{
|
|
|
|
ScVbaControl::setLocked( bLocked );
|
|
|
|
}
|
2010-10-12 15:53:47 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|