LCOV - code coverage report
Current view: top level - libreoffice/svx/source/form - fmtools.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 189 0.0 %
Date: 2012-12-27 Functions: 0 22 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : #include "fmprop.hrc"
      22             : #include "fmservs.hxx"
      23             : #include "svx/fmtools.hxx"
      24             : #include "svx/dbtoolsclient.hxx"
      25             : #include "svx/fmglob.hxx"
      26             : 
      27             : #include <com/sun/star/awt/LineEndFormat.hpp>
      28             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      29             : #include <com/sun/star/beans/XIntrospection.hpp>
      30             : #include <com/sun/star/container/XChild.hpp>
      31             : #include <com/sun/star/form/XForm.hpp>
      32             : #include <com/sun/star/form/XFormComponent.hpp>
      33             : #include <com/sun/star/form/XGridColumnFactory.hpp>
      34             : #include <com/sun/star/io/XActiveDataSink.hpp>
      35             : #include <com/sun/star/io/XActiveDataSource.hpp>
      36             : #include <com/sun/star/io/XObjectInputStream.hpp>
      37             : #include <com/sun/star/io/XObjectOutputStream.hpp>
      38             : #include <com/sun/star/io/XPersistObject.hpp>
      39             : #include <com/sun/star/lang/Locale.hpp>
      40             : #include <com/sun/star/lang/XServiceInfo.hpp>
      41             : #include <com/sun/star/sdb/CommandType.hpp>
      42             : #include <com/sun/star/sdb/ErrorCondition.hpp>
      43             : #include <com/sun/star/sdb/ErrorMessageDialog.hpp>
      44             : #include <com/sun/star/sdb/SQLContext.hpp>
      45             : #include <com/sun/star/sdb/XCompletedConnection.hpp>
      46             : #include <com/sun/star/sdb/XQueriesSupplier.hpp>
      47             : #include <com/sun/star/sdb/XResultSetAccess.hpp>
      48             : #include <com/sun/star/sdbc/DataType.hpp>
      49             : #include <com/sun/star/sdbc/XDataSource.hpp>
      50             : #include <com/sun/star/sdbcx/Privilege.hpp>
      51             : #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
      52             : #include <com/sun/star/task/XInteractionHandler.hpp>
      53             : #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
      54             : #include <com/sun/star/uno/XNamingService.hpp>
      55             : #include <com/sun/star/util/Language.hpp>
      56             : #include <com/sun/star/util/NumberFormat.hpp>
      57             : #include <com/sun/star/util/XCloneable.hpp>
      58             : #include <com/sun/star/util/XNumberFormatTypes.hpp>
      59             : #include <com/sun/star/util/XNumberFormats.hpp>
      60             : #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
      61             : #include <com/sun/star/util/XNumberFormatter.hpp>
      62             : 
      63             : #include <basic/sbxvar.hxx>
      64             : #include <svl/eitem.hxx>
      65             : #include <svl/stritem.hxx>
      66             : #include <comphelper/container.hxx>
      67             : #include <comphelper/extract.hxx>
      68             : #include <comphelper/processfactory.hxx>
      69             : #include <comphelper/property.hxx>
      70             : #include <comphelper/sequence.hxx>
      71             : #include <comphelper/types.hxx>
      72             : #include <comphelper/uno3.hxx>
      73             : #include <connectivity/dbexception.hxx>
      74             : #include <connectivity/dbtools.hxx>
      75             : #include <cppuhelper/typeprovider.hxx>
      76             : #include <rtl/logfile.hxx>
      77             : #include <rtl/math.hxx>
      78             : #include <sfx2/bindings.hxx>
      79             : #include <toolkit/unohlp.hxx>
      80             : #include <tools/debug.hxx>
      81             : #include <vcl/stdtext.hxx>
      82             : #include <vcl/svapp.hxx>
      83             : 
      84             : #include <algorithm>
      85             : 
      86             : using namespace ::com::sun::star::uno;
      87             : using namespace ::com::sun::star::util;
      88             : using namespace ::com::sun::star::lang;
      89             : using namespace ::com::sun::star::frame;
      90             : using namespace ::com::sun::star::awt;
      91             : using namespace ::com::sun::star::beans;
      92             : using namespace ::com::sun::star::container;
      93             : using namespace ::com::sun::star::ui::dialogs;
      94             : using namespace ::com::sun::star::sdbc;
      95             : using namespace ::com::sun::star::sdbcx;
      96             : using namespace ::com::sun::star::sdb;
      97             : using namespace ::com::sun::star::task;
      98             : using namespace ::com::sun::star::form;
      99             : using namespace ::svxform;
     100             : using namespace ::connectivity::simple;
     101             : 
     102             : //  ------------------------------------------------------------------------------
     103             : namespace
     104             : {
     105           0 :     static bool lcl_shouldDisplayError( const Any& _rError )
     106             :     {
     107           0 :         SQLException aError;
     108           0 :         if ( !( _rError >>= aError ) )
     109           0 :             return true;
     110             : 
     111           0 :         if ( aError.Message.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "[OOoBase]" ) ) != 0 )
     112             :             // it is an exception *not* thrown by an OOo Base core component
     113           0 :             return true;
     114             : 
     115             :         // the only exception we do not display ATM is a RowSetVetoException, which
     116             :         // has been raised because an XRowSetApprovalListener vetoed a change
     117           0 :         if ( aError.ErrorCode + ErrorCondition::ROW_SET_OPERATION_VETOED == 0 )
     118           0 :             return false;
     119             : 
     120             :         // everything else is to be displayed
     121           0 :         return true;
     122             :     }
     123             : }
     124             : 
     125             : //  ------------------------------------------------------------------------------
     126           0 : void displayException(const Any& _rExcept, Window* _pParent)
     127             : {
     128             :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "fmtools::displayException" );
     129             :     // check whether we need to display it
     130           0 :     if ( !lcl_shouldDisplayError( _rExcept ) )
     131           0 :         return;
     132             : 
     133             :     try
     134             :     {
     135             :         // the parent window
     136           0 :         Window* pParentWindow = _pParent ? _pParent : GetpApp()->GetDefDialogParent();
     137           0 :         Reference< XWindow > xParentWindow = VCLUnoHelper::GetInterface(pParentWindow);
     138             : 
     139           0 :         Reference< XExecutableDialog > xErrorDialog = ErrorMessageDialog::create(::comphelper::getProcessComponentContext(), "", xParentWindow, _rExcept);
     140           0 :         xErrorDialog->execute();
     141             :     }
     142           0 :     catch(const Exception&)
     143             :     {
     144             :         OSL_FAIL("displayException: could not display the error message!");
     145             :     }
     146             : }
     147             : 
     148             : //  ------------------------------------------------------------------------------
     149           0 : void displayException(const ::com::sun::star::sdbc::SQLException& _rExcept, Window* _pParent)
     150             : {
     151           0 :     displayException(makeAny(_rExcept), _pParent);
     152           0 : }
     153             : 
     154             : //  ------------------------------------------------------------------------------
     155           0 : void displayException(const ::com::sun::star::sdbc::SQLWarning& _rExcept, Window* _pParent)
     156             : {
     157           0 :     displayException(makeAny(_rExcept), _pParent);
     158           0 : }
     159             : 
     160             : //  ------------------------------------------------------------------------------
     161           0 : void displayException(const ::com::sun::star::sdb::SQLContext& _rExcept, Window* _pParent)
     162             : {
     163           0 :     displayException(makeAny(_rExcept), _pParent);
     164           0 : }
     165             : 
     166             : //  ------------------------------------------------------------------------------
     167           0 : void displayException(const ::com::sun::star::sdb::SQLErrorEvent& _rEvent, Window* _pParent)
     168             : {
     169           0 :     displayException(_rEvent.Reason, _pParent);
     170           0 : }
     171             : 
     172             : //------------------------------------------------------------------------------
     173           0 : sal_Int32 getElementPos(const Reference< ::com::sun::star::container::XIndexAccess>& xCont, const Reference< XInterface >& xElement)
     174             : {
     175           0 :     sal_Int32 nIndex = -1;
     176           0 :     if (!xCont.is())
     177           0 :         return nIndex;
     178             : 
     179             : 
     180           0 :     Reference< XInterface > xNormalized( xElement, UNO_QUERY );
     181             :     DBG_ASSERT( xNormalized.is(), "getElementPos: invalid element!" );
     182           0 :     if ( xNormalized.is() )
     183             :     {
     184             :         // Feststellen an welcher Position sich das Kind befindet
     185           0 :         nIndex = xCont->getCount();
     186           0 :         while (nIndex--)
     187             :         {
     188             :             try
     189             :             {
     190           0 :                 Reference< XInterface > xCurrent(xCont->getByIndex( nIndex ),UNO_QUERY);
     191             :                 DBG_ASSERT( xCurrent.get() == Reference< XInterface >( xCurrent, UNO_QUERY ).get(),
     192             :                     "getElementPos: container element not normalized!" );
     193           0 :                 if ( xNormalized.get() == xCurrent.get() )
     194           0 :                     break;
     195             :             }
     196           0 :             catch(Exception&)
     197             :             {
     198             :                 OSL_FAIL( "getElementPos: caught an exception!" );
     199             :             }
     200             : 
     201             :         }
     202             :     }
     203           0 :     return nIndex;
     204             : }
     205             : 
     206             : //------------------------------------------------------------------
     207           0 : ::rtl::OUString getLabelName(const Reference< ::com::sun::star::beans::XPropertySet>& xControlModel)
     208             : {
     209             :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "fmtools::getLabelName" );
     210           0 :     if (!xControlModel.is())
     211           0 :         return ::rtl::OUString();
     212             : 
     213           0 :     if (::comphelper::hasProperty(FM_PROP_CONTROLLABEL, xControlModel))
     214             :     {
     215           0 :         Reference< ::com::sun::star::beans::XPropertySet> xLabelSet;
     216           0 :         xControlModel->getPropertyValue(FM_PROP_CONTROLLABEL) >>= xLabelSet;
     217           0 :         if (xLabelSet.is() && ::comphelper::hasProperty(FM_PROP_LABEL, xLabelSet))
     218             :         {
     219           0 :             Any aLabel( xLabelSet->getPropertyValue(FM_PROP_LABEL) );
     220           0 :             if ((aLabel.getValueTypeClass() == TypeClass_STRING) && !::comphelper::getString(aLabel).isEmpty())
     221           0 :                 return ::comphelper::getString(aLabel);
     222           0 :         }
     223             :     }
     224             : 
     225           0 :     return ::comphelper::getString(xControlModel->getPropertyValue(FM_PROP_CONTROLSOURCE));
     226             : }
     227             : 
     228             : //========================================================================
     229             : // = CursorWrapper
     230             : //------------------------------------------------------------------------
     231           0 : CursorWrapper::CursorWrapper(const Reference< ::com::sun::star::sdbc::XRowSet>& _rxCursor, sal_Bool bUseCloned)
     232             : {
     233           0 :     ImplConstruct(Reference< ::com::sun::star::sdbc::XResultSet>(_rxCursor, UNO_QUERY), bUseCloned);
     234           0 : }
     235             : 
     236             : //------------------------------------------------------------------------
     237           0 : CursorWrapper::CursorWrapper(const Reference< ::com::sun::star::sdbc::XResultSet>& _rxCursor, sal_Bool bUseCloned)
     238             : {
     239           0 :     ImplConstruct(_rxCursor, bUseCloned);
     240           0 : }
     241             : 
     242             : //------------------------------------------------------------------------
     243           0 : void CursorWrapper::ImplConstruct(const Reference< ::com::sun::star::sdbc::XResultSet>& _rxCursor, sal_Bool bUseCloned)
     244             : {
     245           0 :     if (bUseCloned)
     246             :     {
     247           0 :         Reference< ::com::sun::star::sdb::XResultSetAccess> xAccess(_rxCursor, UNO_QUERY);
     248             :         try
     249             :         {
     250           0 :             m_xMoveOperations = xAccess.is() ? xAccess->createResultSet() : Reference< ::com::sun::star::sdbc::XResultSet>();
     251             :         }
     252           0 :         catch(Exception&)
     253             :         {
     254           0 :         }
     255             :     }
     256             :     else
     257           0 :         m_xMoveOperations   = _rxCursor;
     258             : 
     259           0 :     m_xBookmarkOperations   = m_xBookmarkOperations.query( m_xMoveOperations );
     260           0 :     m_xColumnsSupplier      = m_xColumnsSupplier.query( m_xMoveOperations );
     261           0 :     m_xPropertyAccess       = m_xPropertyAccess.query( m_xMoveOperations );
     262             : 
     263           0 :     if ( !m_xMoveOperations.is() || !m_xBookmarkOperations.is() || !m_xColumnsSupplier.is() || !m_xPropertyAccess.is() )
     264             :     {   // all or nothing !!
     265           0 :         m_xMoveOperations = NULL;
     266           0 :         m_xBookmarkOperations = NULL;
     267           0 :         m_xColumnsSupplier = NULL;
     268             :     }
     269             :     else
     270           0 :         m_xGeneric = m_xMoveOperations.get();
     271           0 : }
     272             : 
     273             : //------------------------------------------------------------------------
     274           0 : const CursorWrapper& CursorWrapper::operator=(const Reference< ::com::sun::star::sdbc::XRowSet>& _rxCursor)
     275             : {
     276           0 :     m_xMoveOperations = Reference< ::com::sun::star::sdbc::XResultSet>(_rxCursor, UNO_QUERY);
     277           0 :     m_xBookmarkOperations = Reference< ::com::sun::star::sdbcx::XRowLocate>(_rxCursor, UNO_QUERY);
     278           0 :     m_xColumnsSupplier = Reference< ::com::sun::star::sdbcx::XColumnsSupplier>(_rxCursor, UNO_QUERY);
     279           0 :     if (!m_xMoveOperations.is() || !m_xBookmarkOperations.is() || !m_xColumnsSupplier.is())
     280             :     {   // all or nothing !!
     281           0 :         m_xMoveOperations = NULL;
     282           0 :         m_xBookmarkOperations = NULL;
     283           0 :         m_xColumnsSupplier = NULL;
     284             :     }
     285           0 :     return *this;
     286             : }
     287             : 
     288             : //------------------------------------------------------------------------------
     289           0 : FmXDisposeListener::~FmXDisposeListener()
     290             : {
     291           0 :     setAdapter(NULL);
     292           0 : }
     293             : 
     294             : //------------------------------------------------------------------------------
     295           0 : void FmXDisposeListener::setAdapter(FmXDisposeMultiplexer* pAdapter)
     296             : {
     297           0 :     if (m_pAdapter)
     298             :     {
     299           0 :         ::osl::MutexGuard aGuard(m_rMutex);
     300           0 :         m_pAdapter->release();
     301           0 :         m_pAdapter = NULL;
     302             :     }
     303             : 
     304           0 :     if (pAdapter)
     305             :     {
     306           0 :         ::osl::MutexGuard aGuard(m_rMutex);
     307           0 :         m_pAdapter = pAdapter;
     308           0 :         m_pAdapter->acquire();
     309             :     }
     310           0 : }
     311             : 
     312             : //==============================================================================
     313             : DBG_NAME(FmXDisposeMultiplexer);
     314             : //------------------------------------------------------------------------------
     315           0 : FmXDisposeMultiplexer::FmXDisposeMultiplexer(FmXDisposeListener* _pListener, const Reference< ::com::sun::star::lang::XComponent>& _rxObject, sal_Int16 _nId)
     316             :     :m_xObject(_rxObject)
     317             :     ,m_pListener(_pListener)
     318           0 :     ,m_nId(_nId)
     319             : {
     320             :     DBG_CTOR(FmXDisposeMultiplexer, NULL);
     321           0 :     m_pListener->setAdapter(this);
     322             : 
     323           0 :     if (m_xObject.is())
     324           0 :         m_xObject->addEventListener(this);
     325           0 : }
     326             : 
     327             : //------------------------------------------------------------------------------
     328           0 : FmXDisposeMultiplexer::~FmXDisposeMultiplexer()
     329             : {
     330             :     DBG_DTOR(FmXDisposeMultiplexer, NULL);
     331           0 : }
     332             : 
     333             : // ::com::sun::star::lang::XEventListener
     334             : //------------------------------------------------------------------
     335           0 : void FmXDisposeMultiplexer::disposing(const ::com::sun::star::lang::EventObject& _Source) throw( RuntimeException )
     336             : {
     337           0 :     Reference< ::com::sun::star::lang::XEventListener> xPreventDelete(this);
     338             : 
     339           0 :     if (m_pListener)
     340             :     {
     341           0 :         m_pListener->disposing(_Source, m_nId);
     342           0 :         m_pListener->setAdapter(NULL);
     343           0 :         m_pListener = NULL;
     344             :     }
     345           0 :     m_xObject = NULL;
     346           0 : }
     347             : 
     348             : //------------------------------------------------------------------
     349           0 : void FmXDisposeMultiplexer::dispose()
     350             : {
     351           0 :     if (m_xObject.is())
     352             :     {
     353           0 :         Reference< ::com::sun::star::lang::XEventListener> xPreventDelete(this);
     354             : 
     355           0 :         m_xObject->removeEventListener(this);
     356           0 :         m_xObject = NULL;
     357             : 
     358           0 :         m_pListener->setAdapter(NULL);
     359           0 :         m_pListener = NULL;
     360             :     }
     361           0 : }
     362             : 
     363             : //==============================================================================
     364             : //------------------------------------------------------------------------------
     365           0 : sal_Int16 getControlTypeByObject(const Reference< ::com::sun::star::lang::XServiceInfo>& _rxObject)
     366             : {
     367             :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "fmtools::getControlTypeByObject" );
     368             :     // ask for the persistent service name
     369           0 :     Reference< ::com::sun::star::io::XPersistObject> xPersistence(_rxObject, UNO_QUERY);
     370             :     DBG_ASSERT(xPersistence.is(), "::getControlTypeByObject : argument shold be an ::com::sun::star::io::XPersistObject !");
     371           0 :     if (!xPersistence.is())
     372           0 :         return OBJ_FM_CONTROL;
     373             : 
     374           0 :     ::rtl::OUString sPersistentServiceName = xPersistence->getServiceName();
     375           0 :     if (sPersistentServiceName.equals(FM_COMPONENT_EDIT))   // 5.0-Name
     376             :     {
     377             :         // may be a simple edit field or a formatted field, dependent of the supported services
     378           0 :         if (_rxObject->supportsService(FM_SUN_COMPONENT_FORMATTEDFIELD))
     379           0 :             return OBJ_FM_FORMATTEDFIELD;
     380           0 :         return OBJ_FM_EDIT;
     381             :     }
     382           0 :     if (sPersistentServiceName.equals(FM_COMPONENT_TEXTFIELD))
     383           0 :         return OBJ_FM_EDIT;
     384           0 :     if (sPersistentServiceName.equals(FM_COMPONENT_COMMANDBUTTON))
     385           0 :         return OBJ_FM_BUTTON;
     386           0 :     if (sPersistentServiceName.equals(FM_COMPONENT_FIXEDTEXT))
     387           0 :         return OBJ_FM_FIXEDTEXT;
     388           0 :     if (sPersistentServiceName.equals(FM_COMPONENT_LISTBOX))
     389           0 :         return OBJ_FM_LISTBOX;
     390           0 :     if (sPersistentServiceName.equals(FM_COMPONENT_CHECKBOX))
     391           0 :         return OBJ_FM_CHECKBOX;
     392           0 :     if (sPersistentServiceName.equals(FM_COMPONENT_RADIOBUTTON))
     393           0 :         return OBJ_FM_RADIOBUTTON;
     394           0 :     if (sPersistentServiceName.equals(FM_COMPONENT_GROUPBOX))
     395           0 :         return OBJ_FM_GROUPBOX;
     396           0 :     if (sPersistentServiceName.equals(FM_COMPONENT_COMBOBOX))
     397           0 :         return OBJ_FM_COMBOBOX;
     398           0 :     if (sPersistentServiceName.equals(FM_COMPONENT_GRID))   // 5.0-Name
     399           0 :         return OBJ_FM_GRID;
     400           0 :     if (sPersistentServiceName.equals(FM_COMPONENT_GRIDCONTROL))
     401           0 :         return OBJ_FM_GRID;
     402           0 :     if (sPersistentServiceName.equals(FM_COMPONENT_IMAGEBUTTON))
     403           0 :         return OBJ_FM_IMAGEBUTTON;
     404           0 :     if (sPersistentServiceName.equals(FM_COMPONENT_FILECONTROL))
     405           0 :         return OBJ_FM_FILECONTROL;
     406           0 :     if (sPersistentServiceName.equals(FM_COMPONENT_DATEFIELD))
     407           0 :         return OBJ_FM_DATEFIELD;
     408           0 :     if (sPersistentServiceName.equals(FM_COMPONENT_TIMEFIELD))
     409           0 :         return OBJ_FM_TIMEFIELD;
     410           0 :     if (sPersistentServiceName.equals(FM_COMPONENT_NUMERICFIELD))
     411           0 :         return OBJ_FM_NUMERICFIELD;
     412           0 :     if (sPersistentServiceName.equals(FM_COMPONENT_CURRENCYFIELD))
     413           0 :         return OBJ_FM_CURRENCYFIELD;
     414           0 :     if (sPersistentServiceName.equals(FM_COMPONENT_PATTERNFIELD))
     415           0 :         return OBJ_FM_PATTERNFIELD;
     416           0 :     if (sPersistentServiceName.equals(FM_COMPONENT_HIDDEN)) // 5.0-Name
     417           0 :         return OBJ_FM_HIDDEN;
     418           0 :     if (sPersistentServiceName.equals(FM_COMPONENT_HIDDENCONTROL))
     419           0 :         return OBJ_FM_HIDDEN;
     420           0 :     if (sPersistentServiceName.equals(FM_COMPONENT_IMAGECONTROL))
     421           0 :         return OBJ_FM_IMAGECONTROL;
     422           0 :     if (sPersistentServiceName.equals(FM_COMPONENT_FORMATTEDFIELD))
     423             :     {
     424             :         OSL_FAIL("::getControlTypeByObject : suspicious persistent service name (formatted field) !");
     425             :             // objects with that service name should exist as they aren't compatible with older versions
     426           0 :         return OBJ_FM_FORMATTEDFIELD;
     427             :     }
     428           0 :     if ( sPersistentServiceName.equals( FM_SUN_COMPONENT_SCROLLBAR ) )
     429           0 :         return OBJ_FM_SCROLLBAR;
     430           0 :     if ( sPersistentServiceName.equals( FM_SUN_COMPONENT_SPINBUTTON) )
     431           0 :         return OBJ_FM_SPINBUTTON;
     432           0 :     if (sPersistentServiceName.equals(FM_SUN_COMPONENT_NAVIGATIONBAR))
     433           0 :         return OBJ_FM_NAVIGATIONBAR;
     434             : 
     435             :     OSL_FAIL("::getControlTypeByObject : unknown object type !");
     436           0 :     return OBJ_FM_CONTROL;
     437             : }
     438             : 
     439             : //------------------------------------------------------------------------------
     440           0 : sal_Bool isRowSetAlive(const Reference< XInterface >& _rxRowSet)
     441             : {
     442             :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "fmtools::isRowSetAlive" );
     443           0 :     sal_Bool bIsAlive = sal_False;
     444           0 :     Reference< ::com::sun::star::sdbcx::XColumnsSupplier> xSupplyCols(_rxRowSet, UNO_QUERY);
     445           0 :     Reference< ::com::sun::star::container::XIndexAccess> xCols;
     446           0 :     if (xSupplyCols.is())
     447           0 :         xCols = Reference< ::com::sun::star::container::XIndexAccess>(xSupplyCols->getColumns(), UNO_QUERY);
     448           0 :     if (xCols.is() && (xCols->getCount() > 0))
     449           0 :         bIsAlive = sal_True;
     450             : 
     451           0 :     return bIsAlive;
     452             : }
     453             : 
     454             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10