/* -*- 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 .
*/
// the underline type is an aspect of the font
FontDescriptor aFont;
OSL_VERIFY( _rxPeer->getProperty( FM_PROP_FONT ) >>= aFont );
aFont.Underline = _rUnderline.nUnderlineType;
_rxPeer->setProperty( FM_PROP_FONT, Any( aFont ) ); // the underline color is a separate property
_rxPeer->setProperty( FM_PROP_TEXTLINECOLOR, Any( _rUnderline.nUnderlineColor ) );
}
// no border coloring for controls which are not for text input // #i37434# / 2004-11-19 / frank.schoenheit@sun.com
Reference< XTextComponent > xText( _rxPeer, UNO_QUERY );
Reference< XListBox > xListBox( _rxPeer, UNO_QUERY ); if ( xText.is() || xListBox.is() )
{
sal_Int16 nBorderStyle = VisualEffect::NONE;
OSL_VERIFY( _rxPeer->getProperty( FM_PROP_BORDER ) >>= nBorderStyle ); if ( nBorderStyle == VisualEffect::FLAT ) // if you change this to also accept LOOK3D, then this would also work, but look ugly
{
m_aColorableControls.insert( _rxPeer ); returntrue;
}
}
try
{
Reference< XVclWindowPeer > xPeer( xAsControl->getPeer(), UNO_QUERY ); if ( xPeer.is() && canColorBorder( xPeer ) )
{ // remember the control and its current border color
_rControlData.xControl.clear(); // so determineOriginalBorderStyle doesn't get confused
if ( _rxValidatable->isValid() )
{
ControlBag::iterator aPos = m_aInvalidControls.find( aData ); if ( aPos != m_aInvalidControls.end() )
{ // invalid before, valid now
ControlData aOriginalLayout( *aPos );
m_aInvalidControls.erase( aPos );
// restore all the things we used to indicate invalidity if ( m_bDynamicBorderColors )
updateBorderStyle( _rxControl, xPeer, aOriginalLayout );
xPeer->setProperty( FM_PROP_HELPTEXT, Any( aOriginalLayout.sOriginalHelpText ) );
setUnderline( xPeer, aOriginalLayout );
} return;
}
// we're here in the INVALID case if ( m_aInvalidControls.find( _rxControl ) == m_aInvalidControls.end() )
{ // valid before, invalid now
// remember the current border
determineOriginalBorderStyle( _rxControl, aData ); // and tool tip
xPeer->getProperty( FM_PROP_HELPTEXT ) >>= aData.sOriginalHelpText; // and font
getUnderline( xPeer, aData );
m_aInvalidControls.insert( aData );
// update the border to the new invalidity if ( m_bDynamicBorderColors && canColorBorder( xPeer ) )
updateBorderStyle( _rxControl, xPeer, aData ); else
{ // and also the new font
setUnderline( xPeer, UnderlineDescriptor( css::awt::FontUnderline::WAVE, m_nInvalidColor ) );
}
}
// update the explanation for invalidity (this is always done, even if the validity did not change)
Reference< XValidator > xValidator = _rxValidatable->getValidator();
OSL_ENSURE( xValidator.is(), "ControlBorderManager::validityChanged: invalid, but no validator?" );
OUString sExplainInvalidity = xValidator.is() ? xValidator->explainInvalid( _rxValidatable->getCurrentValue() ) : OUString();
xPeer->setProperty( FM_PROP_HELPTEXT, Any( sExplainInvalidity ) );
} catch( const Exception& )
{
TOOLS_WARN_EXCEPTION( "svx", "ControlBorderManager::validityChanged" );
}
}
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.