22#include <com/sun/star/awt/XControlContainer.hpp>
23#include <com/sun/star/awt/WindowAttribute.hpp>
24#include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
25#include <com/sun/star/awt/PosSize.hpp>
26#include <com/sun/star/beans/PropertyValue.hpp>
27#include <com/sun/star/beans/XPropertySet.hpp>
28#include <com/sun/star/beans/XMultiPropertySet.hpp>
29#include <com/sun/star/lang/NoSupportException.hpp>
30#include <com/sun/star/resource/XStringResourceResolver.hpp>
34#include <osl/mutex.hxx>
39#include <helper/property.hxx>
55using ::com::sun::star::accessibility::XAccessibleContext;
56using ::com::sun::star::accessibility::XAccessible;
60struct LanguageDependentProp
62 const char* pPropName;
63 sal_Int32 nPropNameLength;
74 {
"CurrencySymbol", 14 },
75 {
"StringItemList", 14 },
81 Sequence< OUString> aNames;
82 Reference< XPropertySetInfo > xPSInf = rxModel->getPropertySetInfo();
83 DBG_ASSERT( xPSInf.is(),
"UpdateFromModel: No PropertySetInfo!" );
86 const Sequence< Property> aProps = xPSInf->getProperties();
87 sal_Int32 nLen = aProps.getLength();
88 aNames = Sequence< OUString>( nLen );
89 std::transform(aProps.begin(), aProps.end(), aNames.getArray(),
90 [](
const Property& rProp) -> OUString { return rProp.Name; });
103 explicit VclListenerLock(
VCLXWindow* _pLockWindow )
104 : m_pLockWindow( _pLockWindow )
114 VclListenerLock(
const VclListenerLock&) =
delete;
115 VclListenerLock& operator=(
const VclListenerLock&) =
delete;
134 maDisposeListeners( *this )
135 , maWindowListeners( *this )
136 , maFocusListeners( *this )
137 , maKeyListeners( *this )
138 , maMouseListeners( *this )
139 , maMouseMotionListeners( *this )
140 , maPaintListeners( *this )
141 , maModeChangeListeners( GetMutex() )
168 if ( !xCompatiblePeer.is() )
179 Reference< XControl > xMe;
180 OWeakAggObject::queryInterface(
cppu::UnoType<
decltype(xMe)>::get() ) >>= xMe;
187 pParentWindow = pDefaultDevice->GetOwnerWindow();
188 ENSURE_OR_THROW( pParentWindow !=
nullptr,
"could obtain a default parent window!" );
194 catch(
const Exception& )
202 if ( xCompatiblePeer.is() &&
mxGraphics.is() )
204 Reference< XView > xPeerView( xCompatiblePeer, UNO_QUERY );
205 if ( xPeerView.is() )
215 return xCompatiblePeer;
220 if ( !
mpData->bLocalizationSupport
221 || ( _rPossiblyLocalizable.isEmpty() )
222 || ( _rPossiblyLocalizable[0] !=
'&' )
230 Reference< XPropertySet > xPropSet(
mxModel, UNO_QUERY_THROW );
231 Reference< resource::XStringResourceResolver > xStringResourceResolver(
232 xPropSet->getPropertyValue(
"ResourceResolver"),
235 if ( xStringResourceResolver.is() )
237 OUString aLocalizationKey( _rPossiblyLocalizable.copy( 1 ) );
238 _rPossiblyLocalizable = xStringResourceResolver->resolveString( aLocalizationKey );
259 Any aConvertedValue( rVal );
261 if (
mpData->bLocalizationSupport )
265 if( rPropName ==
"Text" ||
266 rPropName ==
"Label" ||
267 rPropName ==
"Title" ||
268 rPropName ==
"HelpText" ||
269 rPropName ==
"CurrencySymbol" ||
270 rPropName ==
"StringItemList" )
273 uno::Sequence< OUString > aSeqValue;
274 if ( aConvertedValue >>= aValue )
277 aConvertedValue <<= aValue;
279 else if ( aConvertedValue >>= aSeqValue )
281 for (
auto& rValue : asNonConstRange(aSeqValue) )
283 aConvertedValue <<= aSeqValue;
297 Reference< XWindow > xPeer;
300 Reference< XControl > xContComp(
mxContext, UNO_QUERY );
301 if ( xContComp.is() )
303 Reference< XWindowPeer > xP = xContComp->getPeer();
305 xPeer.set( xP, UNO_QUERY );
316 Reference< XMultiPropertySet > xPropSet(
mxModel, UNO_QUERY );
320 xPropSet->firePropertiesChangeEvent( aNames,
this );
332 if (xContextComp.is())
336 xContextComp->removeEventListener(
this );
337 xContextComp->dispose();
341 OSL_FAIL(
"UnoControl::disposeAccessibleContext: could not dispose my AccessibleContext!" );
348 Reference< XVclWindowPeer > xPeer;
349 Reference<XComponent> xAccessibleComp;
351 ::osl::MutexGuard aGuard(
GetMutex() );
368 EventObject aDisposeEvent;
369 aDisposeEvent.Source =
static_cast< XAggregation*
>( this );
381 setModel( Reference< XControlModel > () );
387 ::osl::MutexGuard aGuard(
GetMutex() );
394 ::osl::MutexGuard aGuard(
GetMutex() );
407 Sequence< PropertyChangeEvent > aEvents( rEvents );
409 ::osl::MutexGuard aGuard(
GetMutex() );
411 if ( !
mpData->aSuspendedPropertyNotifications.empty() )
414 PropertyChangeEvent* pEvents = aEvents.getArray();
415 PropertyChangeEvent* pEventsEnd = pEvents + aEvents.getLength();
416 for ( ; pEvents < pEventsEnd; )
417 if (
mpData->aSuspendedPropertyNotifications.find( pEvents->PropertyName ) !=
mpData->aSuspendedPropertyNotifications.end() )
419 std::copy(pEvents + 1, pEventsEnd, pEvents);
424 aEvents.realloc( pEventsEnd - aEvents.getConstArray() );
426 if ( !aEvents.hasElements() )
436 MapString2Int::iterator
pos =
mpData->aSuspendedPropertyNotifications.find( rPropertyName );
439 if (
pos ==
mpData->aSuspendedPropertyNotifications.end() )
440 pos =
mpData->aSuspendedPropertyNotifications.emplace( rPropertyName, 0 ).first;
445 OSL_ENSURE(
pos !=
mpData->aSuspendedPropertyNotifications.end(),
"UnoControl::ImplLockPropertyChangeNotification: property not locked!" );
446 if (
pos !=
mpData->aSuspendedPropertyNotifications.end() )
448 OSL_ENSURE(
pos->second > 0,
"UnoControl::ImplLockPropertyChangeNotification: invalid suspension counter!" );
449 if ( 0 == --
pos->second )
450 mpData->aSuspendedPropertyNotifications.erase(
pos );
457 for (
auto const & propertyName : rPropertyNames )
463 ::osl::ClearableGuard< ::osl::Mutex > aGuard(
GetMutex() );
468 std::vector< PropertyValue > aPeerPropertiesToSet;
469 sal_Int32 nIndependentPos = 0;
470 bool bResourceResolverSet(
false );
474 bool bNeedNewPeer =
false;
477 Reference< XControlModel > xOwnModel =
getModel();
479 Reference< XPropertySet > xPS( xOwnModel, UNO_QUERY );
480 Reference< XPropertySetInfo > xPSI = xPS->getPropertySetInfo();
481 OSL_ENSURE( xPSI.is(),
"UnoControl::ImplModelPropertiesChanged: should have property set meta data!" );
483 sal_Int32 nLen = rEvents.getLength();
484 aPeerPropertiesToSet.reserve(nLen);
486 for(
const PropertyChangeEvent& rEvent : rEvents )
488 Reference< XControlModel >
xModel( rEvent.Source, UNO_QUERY );
489 bool bOwnModel =
xModel.get() == xOwnModel.get();
495 if ( rEvent.PropertyName ==
"ResourceResolver" )
497 Reference< resource::XStringResourceResolver > xStrResolver;
498 if ( rEvent.NewValue >>= xStrResolver )
499 bResourceResolverSet = xStrResolver.is();
532 aPeerPropertiesToSet.emplace_back(rEvent.PropertyName, 0, rEvent.NewValue, PropertyState_DIRECT_VALUE);
536 if ( bResourceResolverSet )
542 aPeerPropertiesToSet.insert(
543 aPeerPropertiesToSet.begin(),
544 PropertyValue( rEvent.PropertyName, 0, rEvent.NewValue, PropertyState_DIRECT_VALUE ) );
556 aPeerPropertiesToSet.insert(
557 aPeerPropertiesToSet.begin(),
558 PropertyValue( rEvent.PropertyName, 0, rEvent.NewValue, PropertyState_DIRECT_VALUE ) );
563 aPeerPropertiesToSet.insert(aPeerPropertiesToSet.begin() + nIndependentPos,
564 PropertyValue(rEvent.PropertyName, 0, rEvent.NewValue, PropertyState_DIRECT_VALUE));
571 Reference< XControl > xThis(
this);
574 DBG_ASSERT( !bNeedNewPeer || xParent.is(),
"Need new peer, but don't have a parent!" );
577 if ( !bNeedNewPeer && bResourceResolverSet )
583 while ( pLangDepProp->pPropName !=
nullptr )
585 bool bMustBeInserted(
true );
586 for (
const PropertyValue &
i : aPeerPropertiesToSet)
588 if (
i.Name.equalsAsciiL(
589 pLangDepProp->pPropName, pLangDepProp->nPropNameLength ))
591 bMustBeInserted =
false;
596 if ( bMustBeInserted )
599 OUString
aPropName( OUString::createFromAscii( pLangDepProp->pPropName ));
600 if ( xPSI.is() && xPSI->hasPropertyByName(
aPropName ) )
602 aPeerPropertiesToSet.emplace_back(
aPropName, 0, xPS->getPropertyValue(
aPropName ), PropertyState_DIRECT_VALUE );
613 if (bNeedNewPeer && xParent.is())
624 Reference< XWindowPeer > xP( xParent, UNO_QUERY );
625 xThis->createPeer( Reference< XToolkit > (), xP );
627 aPeerPropertiesToSet.clear();
640 pPeer = pVclPeer ? pVclPeer->GetWindowPeer() :
nullptr;
642 VclListenerLock aNoVclEventMultiplexing( pPeer );
647 for (
const auto& rProp : aPeerPropertiesToSet)
656 ::osl::ClearableMutexGuard aGuard(
GetMutex() );
664 else if(
mxModel.get() == Reference< XControlModel >(rEvt.Source,UNO_QUERY).get() )
667 Reference< XControl > xThis =
this;
672 DBG_ASSERT( !
mxModel.is(),
"UnoControl::disposing: invalid dispose behaviour!" );
680 Reference< XWindow2 > xPeerWindow;
682 ::osl::MutexGuard aGuard(
GetMutex() );
683 xPeerWindow.set(
getPeer(), css::uno::UNO_QUERY);
686 if ( xPeerWindow.is() )
687 xPeerWindow->setOutputSize( aSize );
692 template <
typename RETVALTYPE,
typename DEFAULTTYPE >
693 RETVALTYPE lcl_askPeer(
const uno::Reference< awt::XWindowPeer >& _rxPeer, RETVALTYPE (SAL_CALL XWindow2::*_pMethod)(), DEFAULTTYPE _aDefault )
695 RETVALTYPE aReturn( _aDefault );
697 Reference< XWindow2 > xPeerWindow( _rxPeer, UNO_QUERY );
698 if ( xPeerWindow.is() )
699 aReturn = (xPeerWindow.get()->*_pMethod)();
707 return lcl_askPeer(
getPeer(), &XWindow2::getOutputSize, awt::Size() );
717 return lcl_askPeer(
getPeer(), &XWindow2::isActive,
false );
727 return lcl_askPeer(
getPeer(), &XWindow2::hasFocus,
false );
733 Reference< XWindow > xWindow;
735 ::osl::MutexGuard aGuard(
GetMutex() );
737 if (
Flags & awt::PosSize::X )
739 if (
Flags & awt::PosSize::Y )
741 if (
Flags & awt::PosSize::WIDTH )
743 if (
Flags & awt::PosSize::HEIGHT )
747 xWindow.set(
getPeer(), css::uno::UNO_QUERY);
757 Reference< XWindow > xWindow;
760 ::osl::MutexGuard aGuard(
GetMutex() );
761 xWindow.set(
getPeer(), css::uno::UNO_QUERY);
765 aRect = xWindow->getPosSize();
771 Reference< XWindow > xWindow;
773 ::osl::MutexGuard aGuard(
GetMutex() );
777 xWindow.set(
getPeer(), css::uno::UNO_QUERY);
785 Reference< XWindow > xWindow;
787 ::osl::MutexGuard aGuard(
GetMutex() );
791 xWindow.set(
getPeer(), css::uno::UNO_QUERY);
794 xWindow->setEnable( bEnable );
799 Reference< XWindow > xWindow;
801 ::osl::MutexGuard aGuard(
GetMutex() );
802 xWindow.set(
getPeer(), css::uno::UNO_QUERY);
810 Reference< XWindow > xPeerWindow;
812 ::osl::MutexGuard aGuard(
GetMutex() );
815 xPeerWindow.set(
getPeer(), css::uno::UNO_QUERY);
817 if ( xPeerWindow.is() )
823 Reference< XWindow > xPeerWindow;
825 ::osl::MutexGuard aGuard(
GetMutex() );
827 xPeerWindow.set(
getPeer(), css::uno::UNO_QUERY);
830 if ( xPeerWindow.is() )
836 Reference< XWindow > xPeerWindow;
838 ::osl::MutexGuard aGuard(
GetMutex() );
841 xPeerWindow.set(
getPeer(), css::uno::UNO_QUERY);
843 if ( xPeerWindow.is() )
849 Reference< XWindow > xPeerWindow;
851 ::osl::MutexGuard aGuard(
GetMutex() );
853 xPeerWindow.set(
getPeer(), css::uno::UNO_QUERY);
856 if ( xPeerWindow.is() )
862 Reference< XWindow > xPeerWindow;
864 ::osl::MutexGuard aGuard(
GetMutex() );
867 xPeerWindow.set(
getPeer(), css::uno::UNO_QUERY);
869 if ( xPeerWindow.is() )
875 Reference< XWindow > xPeerWindow;
877 ::osl::MutexGuard aGuard(
GetMutex() );
879 xPeerWindow.set(
getPeer(), css::uno::UNO_QUERY);
882 if ( xPeerWindow.is() )
888 Reference< XWindow > xPeerWindow;
890 ::osl::MutexGuard aGuard(
GetMutex() );
893 xPeerWindow.set(
getPeer(), css::uno::UNO_QUERY);
895 if ( xPeerWindow.is() )
901 Reference< XWindow > xPeerWindow;
903 ::osl::MutexGuard aGuard(
GetMutex() );
905 xPeerWindow.set(
getPeer(), css::uno::UNO_QUERY);
908 if ( xPeerWindow.is() )
914 Reference< XWindow > xPeerWindow;
916 ::osl::MutexGuard aGuard(
GetMutex() );
919 xPeerWindow.set(
getPeer(), css::uno::UNO_QUERY);
921 if ( xPeerWindow.is() )
927 Reference< XWindow > xPeerWindow;
929 ::osl::MutexGuard aGuard(
GetMutex() );
931 xPeerWindow.set(
getPeer(), css::uno::UNO_QUERY);
934 if ( xPeerWindow.is() )
940 Reference< XWindow > xPeerWindow;
942 ::osl::MutexGuard aGuard(
GetMutex() );
945 xPeerWindow.set(
getPeer(), css::uno::UNO_QUERY);
947 if ( xPeerWindow.is() )
953 Reference< XWindow > xPeerWindow;
955 ::osl::MutexGuard aGuard(
GetMutex() );
957 xPeerWindow.set(
getPeer(), css::uno::UNO_QUERY);
960 if ( xPeerWindow.is() )
967 Reference< XView > xView;
969 ::osl::MutexGuard aGuard(
GetMutex() );
972 xView.set(
getPeer(), css::uno::UNO_QUERY);
974 return !xView.is() || xView->setGraphics( rDevice );
984 ::osl::MutexGuard aGuard(
GetMutex() );
990 Reference< XWindowPeer > xDrawPeer;
991 Reference< XView > xDrawPeerView;
993 bool bDisposeDrawPeer(
false );
995 ::osl::MutexGuard aGuard(
GetMutex() );
998 bDisposeDrawPeer = xDrawPeer.is() && ( xDrawPeer !=
getPeer() );
1000 xDrawPeerView.set( xDrawPeer, UNO_QUERY );
1001 DBG_ASSERT( xDrawPeerView.is(),
"UnoControl::draw: no peer!" );
1004 if ( xDrawPeerView.is() )
1006 Reference< XVclWindowPeer > xWindowPeer;
1007 xWindowPeer.set( xDrawPeer, UNO_QUERY );
1008 if ( xWindowPeer.is() )
1010 xDrawPeerView->draw(
x,
y );
1013 if ( bDisposeDrawPeer )
1014 xDrawPeer->dispose();
1019 Reference< XView > xView;
1021 ::osl::MutexGuard aGuard(
GetMutex() );
1026 xView.set(
getPeer(), css::uno::UNO_QUERY);
1029 xView->setZoom( fZoomX, fZoomY );
1035 ::osl::MutexGuard aGuard(
GetMutex() );
1042 ::osl::MutexGuard aGuard(
GetMutex() );
1049 Reference< XWindow > xWindow(
getPeer(), UNO_QUERY );
1050 if ( !xWindow.is() )
1074 ::osl::ClearableMutexGuard aGuard(
GetMutex() );
1078 aException.Message =
"createPeer: no model!";
1089 Reference< XToolkit > xToolkit = rxToolkit;
1090 if( rParentPeer.is() &&
mxContext.is() )
1093 if ( !xToolkit.is() )
1094 xToolkit = rParentPeer->getToolkit();
1096 Reference< XControlContainer > xC;
1100 eType = WindowClass_CONTAINER;
1102 eType = WindowClass_SIMPLE;
1106 if( rParentPeer.is() )
1108 if ( !xToolkit.is() )
1109 xToolkit = rParentPeer->getToolkit();
1110 eType = WindowClass_CONTAINER;
1114 if ( !xToolkit.is() )
1116 eType = WindowClass_TOP;
1119 WindowDescriptor aDescr;
1120 aDescr.Type =
eType;
1122 aDescr.Parent = rParentPeer;
1124 aDescr.WindowAttributes = 0;
1127 Reference< XPropertySet > xPSet(
mxModel, UNO_QUERY );
1128 Reference< XPropertySetInfo > xInfo = xPSet->getPropertySetInfo();
1132 if ( xInfo->hasPropertyByName(
aPropName ) )
1134 aVal = xPSet->getPropertyValue(
aPropName );
1135 sal_Int16
n = sal_Int16();
1139 aDescr.WindowAttributes |= WindowAttribute::BORDER;
1141 aDescr.WindowAttributes |= VclWindowPeerAttribute::NOBORDER;
1146 if ( aDescr.Type == WindowClass_TOP )
1149 if ( xInfo->hasPropertyByName(
aPropName ) )
1151 aVal = xPSet->getPropertyValue(
aPropName );
1153 if ( ( aVal >>= b ) && b)
1154 aDescr.ParentIndex = -1;
1159 if ( xInfo->hasPropertyByName(
aPropName ) )
1161 aVal = xPSet->getPropertyValue(
aPropName );
1163 if ( ( aVal >>= b ) && b)
1164 aDescr.WindowAttributes |= WindowAttribute::MOVEABLE;
1169 if ( xInfo->hasPropertyByName(
aPropName ) )
1171 aVal = xPSet->getPropertyValue(
aPropName );
1173 if ( ( aVal >>= b ) && b)
1174 aDescr.WindowAttributes |= WindowAttribute::SIZEABLE;
1179 if ( xInfo->hasPropertyByName(
aPropName ) )
1181 aVal = xPSet->getPropertyValue(
aPropName );
1183 if ( ( aVal >>= b ) && b)
1184 aDescr.WindowAttributes |= WindowAttribute::CLOSEABLE;
1189 if ( xInfo->hasPropertyByName(
aPropName ) )
1191 aVal = xPSet->getPropertyValue(
aPropName );
1193 if ( ( aVal >>= b ) && b)
1194 aDescr.WindowAttributes |= VclWindowPeerAttribute::DROPDOWN;
1199 if ( xInfo->hasPropertyByName(
aPropName ) )
1201 aVal = xPSet->getPropertyValue(
aPropName );
1203 if ( ( aVal >>= b ) && b)
1204 aDescr.WindowAttributes |= VclWindowPeerAttribute::SPIN;
1209 if ( xInfo->hasPropertyByName(
aPropName ) )
1211 aVal = xPSet->getPropertyValue(
aPropName );
1213 if ( ( aVal >>= b ) && b)
1214 aDescr.WindowAttributes |= VclWindowPeerAttribute::HSCROLL;
1219 if ( xInfo->hasPropertyByName(
aPropName ) )
1221 aVal = xPSet->getPropertyValue(
aPropName );
1223 if ( ( aVal >>= b ) && b)
1224 aDescr.WindowAttributes |= VclWindowPeerAttribute::VSCROLL;
1229 if ( xInfo->hasPropertyByName(
aPropName ) )
1231 aVal = xPSet->getPropertyValue(
aPropName );
1233 if ( ( aVal >>= b ) && b)
1234 aDescr.WindowAttributes |= VclWindowPeerAttribute::AUTOHSCROLL;
1239 if ( xInfo->hasPropertyByName(
aPropName ) )
1241 aVal = xPSet->getPropertyValue(
aPropName );
1243 if ( ( aVal >>= b ) && b)
1244 aDescr.WindowAttributes |= VclWindowPeerAttribute::AUTOVSCROLL;
1250 if ( xInfo->hasPropertyByName(
aPropName ) )
1252 aVal = xPSet->getPropertyValue(
aPropName );
1254 if ( ( aVal >>=b ) && b )
1255 aDescr.WindowAttributes |= VclWindowPeerAttribute::NOLABEL;
1261 if ( xInfo->hasPropertyByName(
aPropName ) )
1263 aVal = xPSet->getPropertyValue(
aPropName );
1264 sal_Int16
n = sal_Int16();
1268 aDescr.WindowAttributes |= VclWindowPeerAttribute::LEFT;
1270 aDescr.WindowAttributes |= VclWindowPeerAttribute::CENTER;
1272 aDescr.WindowAttributes |= VclWindowPeerAttribute::RIGHT;
1280 Reference<XWindowPeer> xTemp = xToolkit->createWindow( aDescr );
1296 Reference< XGraphics > xGraphics(
mxGraphics );
1297 Reference< XView > xView (
getPeer(), UNO_QUERY_THROW );
1298 Reference< XWindow > xWindow (
getPeer(), UNO_QUERY_THROW );
1305 if (xInfo->hasPropertyByName(
"StandardTheme"))
1307 aVal = xPSet->getPropertyValue(
"StandardTheme");
1308 bool bUseStandardTheme =
false;
1309 aVal >>= bUseStandardTheme;
1310 if (bUseStandardTheme)
1313 AllSettings aAllSettings = pVclPeer->GetSettings();
1317 pVclPeer->SetSettings(aAllSettings);
1327 xView->setZoom( aComponentInfos.
nZoomX, aComponentInfos.
nZoomY );
1331 if( aComponentInfos.
bVisible && !bDesignMode )
1333 xWindow->setVisible( aComponentInfos.
bVisible );
1335 if( !aComponentInfos.
bEnable )
1336 xWindow->setEnable( aComponentInfos.
bEnable );
1338 xView->setGraphics( xGraphics );
1348 ::osl::MutexGuard aGuard(
GetMutex() );
1354 ::osl::MutexGuard aGuard(
GetMutex() );
1360 ::osl::MutexGuard aGuard(
GetMutex() );
1362 Reference< XMultiPropertySet > xPropSet(
mxModel, UNO_QUERY );
1365 Reference< XPropertiesChangeListener > xListener;
1369 xPropSet->removePropertiesChangeListener( xListener );
1371 mpData->bLocalizationSupport =
false;
1378 xPropSet.set(
mxModel, UNO_QUERY_THROW );
1379 Reference< XPropertySetInfo > xPSI( xPropSet->getPropertySetInfo(), UNO_SET_THROW );
1382 xPropSet->addPropertiesChangeListener( aNames, xListener );
1384 mpData->bLocalizationSupport = xPSI->hasPropertyByName(
"ResourceResolver");
1403 return static_cast< XView*
>( this );
1408 ModeChangeEvent aModeChangeEvent;
1410 Reference< XWindow > xWindow;
1411 Reference<XComponent> xAccessibleComp;
1413 ::osl::MutexGuard aGuard(
GetMutex() );
1419 xWindow.set(
getPeer(), css::uno::UNO_QUERY);
1424 aModeChangeEvent.Source = *
this;
1425 aModeChangeEvent.NewMode =
mbDesignMode ? std::u16string_view(
u"design") : std::u16string_view(
u"alive" );
1435 xWindow->setVisible( !bOn );
1454 OSL_FAIL(
"This method should be overridden!" );
1465 return {
"com.sun.star.awt.UnoControl" };
1473 ::osl::MutexGuard aGuard(
GetMutex() );
1476 if ( !xCurrentContext.is() )
1480 Reference< XAccessible > xPeerAcc(
getPeer(), UNO_QUERY );
1481 if ( xPeerAcc.is() )
1482 xCurrentContext = xPeerAcc->getAccessibleContext( );
1488 DBG_ASSERT( xCurrentContext.is(),
"UnoControl::getAccessibleContext: invalid context (invalid peer?)!" );
1492 Reference< XComponent > xContextComp( xCurrentContext, UNO_QUERY );
1493 if ( xContextComp.is() )
1494 xContextComp->addEventListener(
this );
1501 return xCurrentContext;
1506 ::osl::MutexGuard aGuard(
GetMutex() );
1512 ::osl::MutexGuard aGuard(
GetMutex() );
1518 throw NoSupportException( );
1523 throw NoSupportException( );
1529 Reference< XUnitConversion > xPeerConversion;
1531 ::osl::MutexGuard aGuard(
GetMutex() );
1532 xPeerConversion.set(
getPeer(), css::uno::UNO_QUERY);
1534 if ( xPeerConversion.is() )
1535 return xPeerConversion->convertPointToLogic( i_Point, i_TargetUnit );
1536 return awt::Point( );
1542 Reference< XUnitConversion > xPeerConversion;
1544 ::osl::MutexGuard aGuard(
GetMutex() );
1545 xPeerConversion.set(
getPeer(), css::uno::UNO_QUERY);
1547 if ( xPeerConversion.is() )
1548 return xPeerConversion->convertPointToPixel( i_Point, i_SourceUnit );
1549 return awt::Point( );
1555 Reference< XUnitConversion > xPeerConversion;
1557 ::osl::MutexGuard aGuard(
GetMutex() );
1558 xPeerConversion.set(
getPeer(), css::uno::UNO_QUERY);
1560 if ( xPeerConversion.is() )
1561 return xPeerConversion->convertSizeToLogic( i_Size, i_TargetUnit );
1562 return awt::Size( );
1568 Reference< XUnitConversion > xPeerConversion;
1570 ::osl::MutexGuard aGuard(
GetMutex() );
1571 xPeerConversion.set(
getPeer(), css::uno::UNO_QUERY);
1573 if ( xPeerConversion.is() )
1574 return xPeerConversion->convertSizeToPixel( i_Size, i_SourceUnit );
1575 return awt::Size( );
1581 Reference< awt::XStyleSettingsSupplier > xPeerSupplier;
1583 ::osl::MutexGuard aGuard(
GetMutex() );
1584 xPeerSupplier.set(
getPeer(), css::uno::UNO_QUERY);
1586 if ( xPeerSupplier.is() )
1587 return xPeerSupplier->getStyleSettings();
const StyleSettings & GetStyleSettings() const
void SetStyleSettings(const StyleSettings &rSet)
static OutputDevice * GetDefaultDevice()
bool mbDisposePeer
our most recent XAccessibleContext instance
css::uno::Reference< css::awt::XControlModel > SAL_CALL getModel() override
virtual sal_Bool SAL_CALL isEnabled() override
void SAL_CALL removeMouseListener(const css::uno::Reference< css::awt::XMouseListener > &xListener) override
MouseListenerMultiplexer maMouseListeners
virtual void SAL_CALL removeModeChangeListener(const css::uno::Reference< css::util::XModeChangeListener > &_rxListener) override
void SAL_CALL dispose() override
virtual void SAL_CALL addModeChangeListener(const css::uno::Reference< css::util::XModeChangeListener > &_rxListener) override
void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
void SAL_CALL removePaintListener(const css::uno::Reference< css::awt::XPaintListener > &xListener) override
void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
void SAL_CALL setContext(const css::uno::Reference< css::uno::XInterface > &Context) override
MouseMotionListenerMultiplexer maMouseMotionListeners
KeyListenerMultiplexer maKeyListeners
void SAL_CALL addFocusListener(const css::uno::Reference< css::awt::XFocusListener > &xListener) override
void SAL_CALL removeFocusListener(const css::uno::Reference< css::awt::XFocusListener > &xListener) override
void SAL_CALL setVisible(sal_Bool Visible) override
void SAL_CALL addWindowListener(const css::uno::Reference< css::awt::XWindowListener > &xListener) override
virtual css::awt::Size SAL_CALL convertSizeToPixel(const css::awt::Size &aSize, ::sal_Int16 SourceUnit) override
void SAL_CALL draw(sal_Int32 nX, sal_Int32 nY) override
void SAL_CALL addMouseMotionListener(const css::uno::Reference< css::awt::XMouseMotionListener > &xListener) override
sal_Bool SAL_CALL isTransparent() override
virtual void SAL_CALL addModeChangeApproveListener(const css::uno::Reference< css::util::XModeChangeApproveListener > &_rxListener) override
bool ImplCheckLocalize(OUString &_rPossiblyLocalizable)
::osl::Mutex & GetMutex()
virtual void PrepareWindowDescriptor(css::awt::WindowDescriptor &rDesc)
css::uno::Reference< css::awt::XVclWindowPeer > ImplGetCompatiblePeer()
virtual void updateFromModel()
UnoControlComponentInfos maComponentInfos
css::uno::Reference< css::awt::XVclWindowPeer > getVclWindowPeer()
bool mbCreatingCompatiblePeer
css::awt::Rectangle SAL_CALL getPosSize() override
css::uno::Reference< css::uno::XInterface > mxContext
virtual sal_Bool SAL_CALL hasFocus() override
void SAL_CALL addKeyListener(const css::uno::Reference< css::awt::XKeyListener > &xListener) override
std::unique_ptr< UnoControl_Data > mpData
virtual css::uno::Reference< css::awt::XStyleSettings > SAL_CALL getStyleSettings() override
FocusListenerMultiplexer maFocusListeners
void SAL_CALL setPosSize(sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags) override
virtual void ImplSetPeerProperty(const OUString &rPropName, const css::uno::Any &rVal)
sal_Bool SAL_CALL setModel(const css::uno::Reference< css::awt::XControlModel > &Model) override
virtual css::awt::Point SAL_CALL convertPointToPixel(const css::awt::Point &aPoint, ::sal_Int16 SourceUnit) override
void SAL_CALL setZoom(float fZoomX, float fZoomY) override
void SAL_CALL addMouseListener(const css::uno::Reference< css::awt::XMouseListener > &xListener) override
void SAL_CALL disposing(const css::lang::EventObject &Source) override
css::uno::Reference< css::awt::XVclWindowPeer > mxVclWindowPeer
sal_Bool SAL_CALL isDesignMode() override
css::uno::Reference< css::awt::XControlModel > mxModel
void ImplLockPropertyChangeNotification(const OUString &rPropertyName, bool bLock)
virtual sal_Bool SAL_CALL isActive() override
virtual OUString GetComponentServiceName() const
css::uno::Reference< css::awt::XWindowPeer > SAL_CALL getPeer() override
void SAL_CALL setDesignMode(sal_Bool bOn) override
css::uno::WeakReferenceHelper maAccessibleContext
void SAL_CALL removeWindowListener(const css::uno::Reference< css::awt::XWindowListener > &xListener) override
OUString SAL_CALL getImplementationName() override
virtual sal_Bool SAL_CALL isVisible() override
css::uno::Reference< css::awt::XGraphics > SAL_CALL getGraphics() override
virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext() override
::comphelper::OInterfaceContainerHelper3< css::util::XModeChangeListener > maModeChangeListeners
css::uno::Reference< css::awt::XWindow > getParentPeer() const
void SAL_CALL setFocus() override
virtual css::awt::Size SAL_CALL convertSizeToLogic(const css::awt::Size &aSize, ::sal_Int16 TargetUnit) override
WindowListenerMultiplexer maWindowListeners
void setPeer(const css::uno::Reference< css::awt::XVclWindowPeer > &_xPeer)
void SAL_CALL addPaintListener(const css::uno::Reference< css::awt::XPaintListener > &xListener) override
virtual void SAL_CALL removeModeChangeApproveListener(const css::uno::Reference< css::util::XModeChangeApproveListener > &_rxListener) override
virtual css::awt::Point SAL_CALL convertPointToLogic(const css::awt::Point &Point, ::sal_Int16 TargetUnit) override
PaintListenerMultiplexer maPaintListeners
virtual css::awt::Size SAL_CALL getOutputSize() override
virtual void SAL_CALL setOutputSize(const css::awt::Size &aSize) override
css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
void SAL_CALL removeKeyListener(const css::uno::Reference< css::awt::XKeyListener > &xListener) override
void DisposeAccessibleContext(css::uno::Reference< css::lang::XComponent > const &xContext)
css::awt::Size SAL_CALL getSize() override
virtual void ImplModelPropertiesChanged(const css::uno::Sequence< css::beans::PropertyChangeEvent > &rEvents)
css::uno::Reference< css::uno::XInterface > SAL_CALL getContext() override
void ImplLockPropertyChangeNotifications(const css::uno::Sequence< OUString > &rPropertyNames, bool bLock)
sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual ~UnoControl() override
virtual bool requiresNewPeer(const OUString &_rPropertyName) const
css::uno::Reference< css::awt::XGraphics > mxGraphics
sal_Bool SAL_CALL setGraphics(const css::uno::Reference< css::awt::XGraphics > &aDevice) override
void SAL_CALL removeMouseMotionListener(const css::uno::Reference< css::awt::XMouseMotionListener > &xListener) override
EventListenerMultiplexer maDisposeListeners
css::uno::Reference< css::awt::XView > SAL_CALL getView() override
void SAL_CALL propertiesChange(const css::uno::Sequence< css::beans::PropertyChangeEvent > &evt) override
void SAL_CALL createPeer(const css::uno::Reference< css::awt::XToolkit > &Toolkit, const css::uno::Reference< css::awt::XWindowPeer > &Parent) override
void SAL_CALL setEnable(sal_Bool Enable) override
static css::uno::Reference< css::awt::XToolkit > CreateToolkit()
static vcl::Window * GetWindow(const css::uno::Reference< css::awt::XWindow > &rxWindow)
void suspendVclEventListening()
void resumeVclEventListening()
sal_Int32 addInterface(const css::uno::Reference< ListenerT > &rxIFace)
void disposeAndClear(const css::lang::EventObject &rEvt)
sal_Int32 removeInterface(const css::uno::Reference< ListenerT > &rxIFace)
void notifyEach(void(SAL_CALL ListenerT::*NotificationMethod)(const EventT &), const EventT &Event)
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) SAL_OVERRIDE
static rtl::Reference< OAccessibleControlContext > create(const css::uno::Reference< css::accessibility::XAccessible > &_rxCreator)
creates an accessible context for a uno control
virtual css::uno::Reference< css::awt::XVclWindowPeer > GetComponentInterface(bool bCreate=true)
#define DBG_ASSERT(sCon, aError)
#define ENSURE_OR_THROW(c, m)
#define DBG_UNHANDLED_EXCEPTION(...)
#define IMPL_IMPLEMENTATION_ID(ClassName)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
const OUString & GetPropertyName(sal_uInt16 nPropertyId)
bool DoesDependOnOthers(sal_uInt16 nPropertyId)
sal_uInt16 GetPropertyId(const OUString &rPropertyName)
#define BASEPROPERTY_MULTILINE
#define BASEPROPERTY_BORDER
#define BASEPROPERTY_SPIN
#define BASEPROPERTY_HSCROLL
#define BASEPROPERTY_PAINTTRANSPARENT
#define BASEPROPERTY_NATIVE_WIDGET_LOOK
#define BASEPROPERTY_ORIENTATION
#define BASEPROPERTY_ALIGN
#define BASEPROPERTY_DESKTOP_AS_PARENT
#define BASEPROPERTY_DROPDOWN
#define BASEPROPERTY_CLOSEABLE
#define PROPERTY_ALIGN_CENTER
#define BASEPROPERTY_VSCROLL
#define BASEPROPERTY_NOLABEL
#define BASEPROPERTY_AUTOHSCROLL
#define BASEPROPERTY_AUTOVSCROLL
#define BASEPROPERTY_SIZEABLE
#define BASEPROPERTY_MOVEABLE
#define PROPERTY_ALIGN_LEFT
MapString2Int aSuspendedPropertyNotifications
bool bLocalizationSupport
true if and only if our model has a property ResourceResolver
Reference< XModel > xModel
::std::map< OUString, sal_Int32 > MapString2Int
static Sequence< OUString > lcl_ImplGetPropertyNames(const Reference< XMultiPropertySet > &rxModel)
const LanguageDependentProp aLanguageDependentProp[]