/* -*- 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 .
*/
if ( isRowSetListening() )
{ // we're listening at the row set, this means that the row set does not have our // m_xOriginalConnection as active connection anymore // So there are two possibilities // a. somebody sets a new connection which is not our original one // b. somebody sets a new connection, which is exactly the original one // a. we're not interested in a, but in b: In this case, we simply need to move to the state // we had originally: listen for property changes, do not listen for row set changes, and // do not dispose the connection until the row set does not need it anymore if ( xNewConnection.get() == m_xOriginalConnection.get() )
{
stopRowSetListening();
}
} else
{ // start listening at the row set. We're allowed to dispose the old connection as soon // as the RowSet changed
// Unfortunately, the our database form implementations sometimes fire the change of their // ActiveConnection twice. This is an error in forms/source/component/DatabaseForm.cxx, but // changing this would require incompatible changes we can't do for a while. // So for the moment, we have to live with it here. // // The only scenario where this doubled notification causes problems is when the connection // of the form is reset to the one we're responsible for (m_xOriginalConnection), so we // check this here. // // Yes, this is a HACK :( if ( xNewConnection.get() != m_xOriginalConnection.get() )
{ #if OSL_DEBUG_LEVEL > 0
Reference< XConnection > xOldConnection;
_rEvent.OldValue >>= xOldConnection;
OSL_ENSURE( xOldConnection.get() == m_xOriginalConnection.get(), "OAutoConnectionDisposer::propertyChange: unexpected (original) property value!" ); #endif
startRowSetListening();
}
}
}
void SAL_CALL OAutoConnectionDisposer::disposing( const EventObject& _rSource )
{ // the rowset is being disposed, and nobody has set a new ActiveConnection in the meantime if ( isRowSetListening() )
stopRowSetListening();
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.