Tag: cws_src680_odbmacros2
User: fs      
Date: 2007-12-19 06:12:25+0000
Modified:
   dba/dbaccess/source/ui/browser/unodatbr.cxx

Log:
 #i49133# +m_xCurrentDatabaseDocument

File Changes:

Directory: /dba/dbaccess/source/ui/browser/
===========================================

File [changed]: unodatbr.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/browser/unodatbr.cxx?r1=1.192.2.2&r2=1.192.2.3
Delta lines:  +109 -284
-----------------------
--- unodatbr.cxx        2007-12-18 21:23:20+0000        1.192.2.2
+++ unodatbr.cxx        2007-12-19 06:12:22+0000        1.192.2.3
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: unodatbr.cxx,v $
  *
- *  $Revision: 1.192.2.2 $
+ *  $Revision: 1.192.2.3 $
  *
- *  last change: $Author: fs $ $Date: 2007/12/18 21:23:20 $
+ *  last change: $Author: fs $ $Date: 2007/12/19 06:12:22 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -36,299 +36,105 @@
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_dbaccess.hxx"
 
-#ifndef _SVX_GRIDCTRL_HXX
-#include <svx/gridctrl.hxx>
-#endif
-#ifndef SVX_DATABASE_REGISTRATION_UI_HXX
-#include <svx/databaseregistrationui.hxx>
-#endif
-#ifndef _SBA_UNODATBR_HXX_
-#include "unodatbr.hxx"
-#endif
-#ifndef _SBA_GRID_HXX
-#include "sbagrid.hxx"
-#endif
-#ifndef DBACCESS_IMAGEPROVIDER_HXX
+#include "browserids.hxx"
+#include "dbaccess_helpid.hrc"
+#include "dbexchange.hxx"
+#include "dbtreelistbox.hxx"
+#include "dbtreemodel.hxx"
+#include "dbtreeview.hxx"
+#include "dbu_brw.hrc"
+#include "dbu_reghelper.hxx"
+#include "dbustrings.hrc"
+#include "directsql.hxx"
+#include "dlgsave.hxx"
+#include "HtmlReader.hxx"
 #include "imageprovider.hxx"
-#endif
-#ifndef _SVTREEBOX_HXX
-#include <svtools/svtreebx.hxx>
-#endif
-#ifndef _SVX_DATACCESSDESCRIPTOR_HXX_
-#include <svx/dataaccessdescriptor.hxx>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_FETCHDIRECTION_HPP_
-#include <com/sun/star/sdbc/FetchDirection.hpp>
-#endif
-#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
-#include <toolkit/unohlp.hxx>
-#endif
-#ifndef _COM_SUN_STAR_FORM_XLOADABLE_HPP_
-#include <com/sun/star/form/XLoadable.hpp>
-#endif
-#ifndef _SV_MSGBOX_HXX //autogen
-#include <vcl/msgbox.hxx>
-#endif
-#ifndef _COM_SUN_STAR_SDB_XPARAMETERSSUPPLIER_HPP_
-#include <com/sun/star/sdb/XParametersSupplier.hpp>
-#endif
-#ifndef _SFXDISPATCH_HXX //autogen
-#include <sfx2/dispatch.hxx>
-#endif
-#ifndef _COM_SUN_STAR_SDB_XSINGLESELECTQUERYANALYZER_HPP_
-#include <com/sun/star/sdb/XSingleSelectQueryAnalyzer.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_XSINGLESELECTQUERYCOMPOSER_HPP_
-#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
-#endif
-#ifndef _SV_MULTISEL_HXX //autogen
-#include <tools/multisel.hxx>
-#endif
-#ifndef TOOLS_DIAGNOSE_EX_H
-#include <tools/diagnose_ex.h>
-#endif
-#ifndef _COM_SUN_STAR_SDB_XQUERIESSUPPLIER_HPP_
-#include <com/sun/star/sdb/XQueriesSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XWARNINGSSUPPLIER_HPP_
-#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XRENAME_HPP_
-#include <com/sun/star/sdbcx/XRename.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_XDOCUMENTDATASOURCE_HPP_
-#include <com/sun/star/sdb/XDocumentDataSource.hpp>
-#endif
-#ifndef _COM_SUN_STAR_FRAME_XLAYOUTMANAGER_HPP_
-#include <com/sun/star/frame/XLayoutManager.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UTIL_XFLUSHABLE_HPP_
-#include <com/sun/star/util/XFlushable.hpp>
-#endif
-#ifndef _URLOBJ_HXX //autogen
-#include <tools/urlobj.hxx>
-#endif
-#ifndef TOOLS_DIAGNOSE_EX_H
-#include <tools/diagnose_ex.h>
-#endif
+#include "linkeddocuments.hxx"
+#include "listviewitems.hxx"
+#include "QEnumTypes.hxx"
+#include "RtfReader.hxx"
+#include "sbagrid.hrc"
+#include "sbagrid.hxx"
+#include "sqlmessage.hxx"
+#include "TokenWriter.hxx"
+#include "UITools.hxx"
+#include "unodatbr.hxx"
+#include "WColumnSelect.hxx"
+#include "WCopyTable.hxx"
+#include "WCPage.hxx"
+#include "WExtendPages.hxx"
+#include "WNameMatch.hxx"
 
-#ifndef _SFXINTITEM_HXX //autogen
-#include <svtools/intitem.hxx>
-#endif
-#ifndef _UNOTOOLS_CONFIGNODE_HXX_
-#include <unotools/confignode.hxx>
-#endif
-#ifndef _SV_WAITOBJ_HXX
-#include <vcl/waitobj.hxx>
-#endif
-#ifndef _SV_SVAPP_HXX //autogen
-#include <vcl/svapp.hxx>
-#endif
-#ifndef _SV_TOOLBOX_HXX
-#include <vcl/toolbox.hxx>
-#endif
-#ifndef _SFXAPP_HXX //autogen
-#include <sfx2/app.hxx>
-#endif
-#ifndef _SV_WRKWIN_HXX //autogen
-#include <vcl/wrkwin.hxx>
-#endif
-#ifndef _COM_SUN_STAR_SDB_COMMANDTYPE_HPP_
-#include <com/sun/star/sdb/CommandType.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_
-#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_
-#include <com/sun/star/sdbc/DataType.hpp>
-#endif
-#ifndef _COM_SUN_STAR_FORM_XGRIDCOLUMNFACTORY_HPP_
-#include <com/sun/star/form/XGridColumnFactory.hpp>
-#endif
-#ifndef _COM_SUN_STAR_FORM_XFORM_HPP_
-#include <com/sun/star/form/XForm.hpp>
-#endif
-#ifndef _COM_SUN_STAR_AWT_VISUALEFFECT_HPP_
-#include <com/sun/star/awt/VisualEffect.hpp>
-#endif
-#ifndef _COM_SUN_STAR_AWT_LINEENDFORMAT_HPP_
+/** === begin UNO includes === **/
 #include <com/sun/star/awt/LineEndFormat.hpp>
-#endif
-#ifndef _COM_SUN_STAR_AWT_TEXTALIGN_HPP_
 #include <com/sun/star/awt/TextAlign.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_XBOOKMARKSSUPPLIER_HPP_
-#include <com/sun/star/sdb/XBookmarksSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_
-#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XVIEWSSUPPLIER_HPP_
-#include <com/sun/star/sdbcx/XViewsSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XDROP_HPP_
-#include <com/sun/star/sdbcx/XDrop.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_XCOMPLETEDCONNECTION_HPP_
-#include <com/sun/star/sdb/XCompletedConnection.hpp>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
+#include <com/sun/star/awt/VisualEffect.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/container/XNameContainer.hpp>
-#endif
-#ifndef _COM_SUN_STAR_FRAME_FRAMESEARCHFLAG_HPP_
+#include <com/sun/star/form/XForm.hpp>
+#include <com/sun/star/form/XGridColumnFactory.hpp>
+#include <com/sun/star/form/XLoadable.hpp>
 #include <com/sun/star/frame/FrameSearchFlag.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XDATASOURCE_HPP_
+#include <com/sun/star/frame/XLayoutManager.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/sdb/SQLContext.hpp>
+#include <com/sun/star/sdb/XBookmarksSupplier.hpp>
+#include <com/sun/star/sdb/XCompletedConnection.hpp>
+#include <com/sun/star/sdb/XDocumentDataSource.hpp>
+#include <com/sun/star/sdb/XParametersSupplier.hpp>
+#include <com/sun/star/sdb/XQueriesSupplier.hpp>
+#include <com/sun/star/sdb/XQueryDefinitionsSupplier.hpp>
+#include <com/sun/star/sdb/XResultSetAccess.hpp>
+#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/sdbc/FetchDirection.hpp>
+#include <com/sun/star/sdbc/SQLWarning.hpp>
 #include <com/sun/star/sdbc/XDataSource.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XRESULTSETMETADATASUPPLIER_HPP_
 #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_XQUERYDEFINITIONSSUPPLIER_HPP_
-#include <com/sun/star/sdb/XQueryDefinitionsSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UI_DIALOGS_XEXECUTABLEDIALOG_HPP_
-#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
-#include <com/sun/star/beans/PropertyValue.hpp>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_NAMEDVALUE_HPP_
-#include <com/sun/star/beans/NamedValue.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XDATADESCRIPTORFACTORY_HPP_
+#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
+#include <com/sun/star/sdbcx/Privilege.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
 #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
-#endif
+#include <com/sun/star/sdbcx/XDrop.hpp>
+#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
+#include <com/sun/star/sdbcx/XViewsSupplier.hpp>
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <com/sun/star/util/XFlushable.hpp>
+#include <com/sun/star/sdb/XDocumentDataSource.hpp>
+/** === end UNO includes === **/
 
-#ifndef _SVX_ALGITEM_HXX //autogen
-#include <svx/algitem.hxx>
-#endif
-#ifndef _COM_SUN_STAR_SDB_XRESULTSETACCESS_HPP_
-#include <com/sun/star/sdb/XResultSetAccess.hpp>
-#endif
-#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_
-#include <com/sun/star/lang/DisposedException.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_SQLWARNING_HPP_
-#include <com/sun/star/sdbc/SQLWarning.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_SQLCONTEXT_HPP_
-#include <com/sun/star/sdb/SQLContext.hpp>
-#endif
-#ifndef _COMPHELPER_SEQUENCE_HXX_
+#include <comphelper/extract.hxx>
 #include <comphelper/sequence.hxx>
-#endif
-#ifndef _COMPHELPER_TYPES_HXX_
 #include <comphelper/types.hxx>
-#endif
-#ifndef DBAUI_DBTREEMODEL_HXX
-#include "dbtreemodel.hxx"
-#endif
-#ifndef DBACCESS_UI_DBTREEVIEW_HXX
-#include "dbtreeview.hxx"
-#endif
-#ifndef SVTOOLS_FILENOTATION_HXX
-#include <svtools/filenotation.hxx>
-#endif
-#ifndef _SVLBOXITM_HXX
-#include <svtools/svlbitm.hxx>
-#endif
-#ifndef _SV_SPLIT_HXX
-#include <vcl/split.hxx>
-#endif
-#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
-#include "dbustrings.hrc"
-#endif
-#ifndef _DBU_BRW_HRC_
-#include "dbu_brw.hrc"
-#endif
-#ifndef DBACCESS_SBA_GRID_HRC
-#include "sbagrid.hrc"
-#endif
-#ifndef DBACCESS_UI_BROWSER_ID_HXX
-#include "browserids.hxx"
-#endif
-#ifndef _DBU_REGHELPER_HXX_
-#include "dbu_reghelper.hxx"
-#endif
-#ifndef _COMPHELPER_EXTRACT_HXX_
-#include <comphelper/extract.hxx>
-#endif
-#ifndef _DBHELPER_DBEXCEPTION_HXX_
 #include <connectivity/dbexception.hxx>
-#endif
-#ifndef _VCL_STDTEXT_HXX
-#include <vcl/stdtext.hxx>
-#endif
-#ifndef DBAUI_DBTREELISTBOX_HXX
-#include "dbtreelistbox.hxx"
-#endif
-#ifndef _DBA_DBACCESS_HELPID_HRC_
-#include "dbaccess_helpid.hrc"
-#endif
-#ifndef _DBAUI_LISTVIEWITEMS_HXX_
-#include "listviewitems.hxx"
-#endif
-#ifndef _CPPUHELPER_IMPLBASE2_HXX_
 #include <cppuhelper/implbase2.hxx>
-#endif
-#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
 #include <cppuhelper/typeprovider.hxx>
-#endif
-#ifndef DBAUI_TOKENWRITER_HXX
-#include "TokenWriter.hxx"
-#endif
-#ifndef DBAUI_DBEXCHANGE_HXX
-#include "dbexchange.hxx"
-#endif
-#ifndef DBAUI_WIZ_COPYTABLEDIALOG_HXX
-#include "WCopyTable.hxx"
-#endif
-#ifndef DBAUI_WIZ_EXTENDPAGES_HXX
-#include "WExtendPages.hxx"
-#endif
-#ifndef DBAUI_WIZ_NAMEMATCHING_HXX
-#include "WNameMatch.hxx"
-#endif
-#ifndef DBAUI_WIZ_COLUMNSELECT_HXX
-#include "WColumnSelect.hxx"
-#endif
-#ifndef DBAUI_ENUMTYPES_HXX
-#include "QEnumTypes.hxx"
-#endif
-#ifndef DBAUI_WIZARD_CPAGE_HXX
-#include "WCPage.hxx"
-#endif
-#ifndef DBAUI_TOOLS_HXX
-#include "UITools.hxx"
-#endif
-#ifndef DBAUI_RTFREADER_HXX
-#include "RtfReader.hxx"
-#endif
-#ifndef DBAUI_HTMLREADER_HXX
-#include "HtmlReader.hxx"
-#endif
-#ifndef _DBAUI_SQLMESSAGE_HXX_
-#include "sqlmessage.hxx"
-#endif
-#ifndef DBAUI_DLGSAVE_HXX
-#include "dlgsave.hxx"
-#endif
-#ifndef _SOT_STORAGE_HXX
+#include <sfx2/app.hxx>
+#include <sfx2/dispatch.hxx>
 #include <sot/storage.hxx>
-#endif
-#ifndef _DBAUI_LINKEDDOCUMENTS_HXX_
-#include "linkeddocuments.hxx"
-#endif
-#ifndef _DBACCESS_UI_DIRECTSQL_HXX_
-#include "directsql.hxx"
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_PRIVILEGE_HPP_
-#include <com/sun/star/sdbcx/Privilege.hpp>
-#endif
-#ifndef INCLUDED_SVTOOLS_MODULEOPTIONS_HXX
+#include <svtools/filenotation.hxx>
+#include <svtools/intitem.hxx>
 #include <svtools/moduleoptions.hxx>
-#endif
+#include <svtools/svlbitm.hxx>
+#include <svtools/svtreebx.hxx>
+#include <svx/algitem.hxx>
+#include <svx/dataaccessdescriptor.hxx>
+#include <svx/databaseregistrationui.hxx>
+#include <svx/gridctrl.hxx>
+#include <toolkit/unohlp.hxx>
+#include <tools/diagnose_ex.h>
+#include <tools/multisel.hxx>
+#include <tools/urlobj.hxx>
+#include <unotools/confignode.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/split.hxx>
+#include <vcl/stdtext.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/toolbox.hxx>
+#include <vcl/waitobj.hxx>
+#include <vcl/wrkwin.hxx>
 
 #include <memory>
 
@@ -1651,7 +1457,6 @@
 
        if (isValid() && !loadingCancelled())
        {
-               // -------------------------------
                // did we load a query?
                sal_Bool bTemporary;    // needed because we 
m_bQueryEscapeProcessing is only one bit wide (and we want to pass it by 
reference)
                if ( implGetQuerySignature( m_sQueryCommand, bTemporary ) )
@@ -1659,10 +1464,27 @@
        }
 
        // if the form has been loaded, this means that our "selection" has 
changed
-       ::com::sun::star::lang::EventObject aEvt(*this);
-       ::cppu::OInterfaceIteratorHelper aIter(m_aSelectionListeners);
-       while (aIter.hasMoreElements())
-               static_cast< XSelectionChangeListener* 
>(aIter.next())->selectionChanged(aEvt);
+       EventObject aEvent( *this );
+    m_aSelectionListeners.notifyEach( 
&XSelectionChangeListener::selectionChanged, aEvent );
+
+    // update our database document
+    Reference< XModel > xDocument;
+    try
+    {
+        Reference< XPropertySet > xCursorProps( getRowSet(), UNO_QUERY_THROW );
+        Reference< XConnection > xConnection( xCursorProps->getPropertyValue( 
PROPERTY_ACTIVECONNECTION ), UNO_QUERY );
+        if ( xConnection.is() )
+        {
+            Reference< XChild > xChild( xConnection, UNO_QUERY_THROW );
+            Reference< XDocumentDataSource > xDataSource( xChild->getParent(), 
UNO_QUERY_THROW );
+            xDocument.set( xDataSource->getDatabaseDocument(), UNO_QUERY_THROW 
);
+        }
+    }
+    catch( const Exception& )
+    {
+       DBG_UNHANDLED_EXCEPTION();
+    }
+    m_xCurrentDatabaseDocument = xDocument;
 }
 
 
//------------------------------------------------------------------------------
@@ -3753,7 +3575,10 @@
 
//------------------------------------------------------------------------------
 Reference< XEmbeddedScripts > SAL_CALL 
SbaTableQueryBrowser::getScriptContainer() throw (RuntimeException)
 {
-    return Reference< XEmbeddedScripts >( );
+    Reference< XEmbeddedScripts > xScripts( m_xCurrentDatabaseDocument, 
UNO_QUERY );
+    OSL_ENSURE( xScripts.is() || !m_xCurrentDatabaseDocument.is(),
+        "SbaTableQueryBrowser::getScriptContainer: invalid database document!" 
);
+    return xScripts;
 }
 
 // .........................................................................




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to