/* -*- 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 .
*/
sal_Bool SAL_CALL BaseContainerControl::setModel( const Reference< XControlModel >& )
{ // This object has NO model. returnfalse;
}
// XControl
Reference< XControlModel > SAL_CALL BaseContainerControl::getModel()
{ // This object has NO model. // return (XControlModel*)this; return Reference< XControlModel >();
}
// XComponent
void SAL_CALL BaseContainerControl::dispose()
{ // Tell everything that this container is now gone. // It's faster if you listen to both the control and the container.
// Ready for multithreading
MutexGuard aGuard( m_aMutex );
// take memory for new item
IMPL_ControlInfo aNewControl;
// Ready for multithreading
MutexGuard aGuard (m_aMutex);
// set control
aNewControl.sName = rName;
aNewControl.xControl = rControl;
// and insert in list
maControlInfoList.emplace_back( aNewControl );
// initialize new control
aNewControl.xControl->setContext (getXWeak());
aNewControl.xControl->addEventListener ( static_cast< XEventListener* >( static_cast< XWindowListener* >( this ) ) );
// when container has a peer... if (getPeer().is())
{ // ... then create a peer on child
aNewControl.xControl->createPeer ( getPeer()->getToolkit(), getPeer() );
}
// Send message to all listener
comphelper::OInterfaceContainerHelper2* pInterfaceContainer = m_aListeners.getContainer( cppu::UnoType<XContainerListener>::get());
// Ready for multithreading
MutexGuard aGuard (m_aMutex);
// Search for right control auto it = std::find_if(maControlInfoList.begin(), maControlInfoList.end(),
[&rControl](const IMPL_ControlInfo& control)
{ return rControl == control.xControl; });
// if not found if ( it == maControlInfoList.end() ) return;
// remove listener from control
it->xControl->removeEventListener (static_cast< XEventListener* >( static_cast< XWindowListener* >( this ) ));
it->xControl->setContext ( Reference< XInterface > () );
// ... free memory
maControlInfoList.erase(it);
// Send message to all other listener
comphelper::OInterfaceContainerHelper2 * pInterfaceContainer = m_aListeners.getContainer( cppu::UnoType<XContainerListener>::get());
// Search for right control for( const IMPL_ControlInfo& rSearchControl : maControlInfoList )
{ if ( rSearchControl.sName == rName )
{ // We have found it ... // Break operation and return. return rSearchControl.xControl;
}
}
// We have not found it ... return NULL. return Reference< XControl > ();
}
// is it a top window ? if ( !getContext().is() && bVisible )
{ // then show it automatically
createPeer ( Reference< XToolkit > (), Reference< XWindowPeer > () );
}
}
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.