/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * 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 .
*/
// Value, [read] e.g. getValue returns the value of ooo Text property e.g. the value in // the drop down
uno::Any SAL_CALL
ScVbaComboBox::getValue()
{ return m_xProps->getPropertyValue( sSourceName );
}
// fire the _Change event if( nOldIndex != nIndex )
fireClickEvent();
}
}
uno::Any SAL_CALL
ScVbaComboBox::getListIndex()
{
uno::Sequence< OUString > sItems;
m_xProps->getPropertyValue( u"StringItemList"_ustr ) >>= sItems; // should really return the item that has focus regardless of // it been selected if ( sItems.hasElements() )
{
OUString sText = getText(); if (!sText.isEmpty())
{
sal_Int32 index = comphelper::findValue(sItems, sText); if (index != -1)
{
SAL_INFO("vbahelper", "getListIndex returning " << index ); return uno::Any( index );
}
}
}
SAL_INFO("vbahelper", "getListIndex returning -1" ); return uno::Any( sal_Int32( -1 ) );
}
// Value, [write]e.g. setValue sets the value in the drop down, and if the value is one // of the values in the list then the selection is also set void SAL_CALL
ScVbaComboBox::setValue( const uno::Any& _value )
{ // booleans are converted to uppercase strings
OUString oldValue = extractStringFromAny( getValue(), OUString(), true );
m_xProps->setPropertyValue( sSourceName, uno::Any( extractStringFromAny( _value, OUString(), true ) ) );
OUString newValue = extractStringFromAny( getValue(), OUString(), true ); if ( oldValue != newValue )
{
sal_Int32 index = 0;
uno::Any aIndex = getListIndex();
aIndex >>= index; if ( index < 0 )
fireChangeEvent(); else
fireClickEvent();
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.