Tag: cws_src680_dba24
User: oj      
Date: 05/02/18 04:44:44

Modified:
 /dba/dbaccess/source/filter/xml/
  dbloader2.cxx, xmlDataSource.cxx, xmlDatabase.cxx, xmlExport.cxx,
  xmlExport.hxx, xmlLogin.cxx, xmlTableFilterList.cxx, xmlTableFilterList.hxx,
  xmlfilter.cxx, xmlfilter.hxx

Log:
 #i42460# changes for the separation of datasource and database document(model)

File Changes:

Directory: /dba/dbaccess/source/filter/xml/
===========================================

File [changed]: dbloader2.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/filter/xml/dbloader2.cxx?r1=1.5.18.1&r2=1.5.18.2
Delta lines:  +16 -9
--------------------
--- dbloader2.cxx       10 Feb 2005 11:27:43 -0000      1.5.18.1
+++ dbloader2.cxx       18 Feb 2005 12:44:39 -0000      1.5.18.2
@@ -89,6 +89,9 @@
 #ifndef _COM_SUN_STAR_DOCUMENT_XEVENTLISTENER_HPP_
 #include <com/sun/star/document/XEventListener.hpp>
 #endif
+#ifndef _COM_SUN_STAR_SDB_XDOCUMENTDATASOURCE_HPP_
+#include <com/sun/star/sdb/XDocumentDataSource.hpp>
+#endif
 #ifndef _COM_SUN_STAR_FRAME_XLOADEVENTLISTENER_HPP_
 #include <com/sun/star/frame/XLoadEventListener.hpp>
 #endif
@@ -177,6 +180,8 @@
 using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::document;
 using namespace ::com::sun::star::registry;
+using namespace ::com::sun::star::sdb;
+namespace css = ::com::sun::star;
 
 // -------------------------------------------------------------------------
 namespace dbaxml
@@ -374,6 +379,7 @@
 
        sal_Bool bCreateNew = sal_False;
        sal_Bool bInteractive = sal_False;
+       Reference<XDocumentDataSource> xDocumentDataSource;
        /* special mode: use already loaded model ...
         In such case no filter name will be selected and no URL will be given!
         Such informations are not neccessary. We have to create a new view only
@@ -392,7 +398,9 @@
                        }
                        else
                                bInteractive = 
rURL.match(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("?Interactive")), 
SvtModuleOptions().GetFactoryEmptyDocumentURL(SvtModuleOptions::E_DATABASE).getLength()
 );
-                       
xModel.set(xDatabaseContext->createInstanceWithArguments(aCreationArgs),UNO_QUERY);
+            
+            
xDocumentDataSource.set(xDatabaseContext->createInstanceWithArguments(aCreationArgs),UNO_QUERY_THROW);
+                       
xModel.set(xDocumentDataSource->getDatabaseDocument(),UNO_QUERY);
                }
        }
 
@@ -462,17 +470,16 @@
 
         try
         {
-            Reference< ::com::sun::star::document::XEventListener > 
xDocEventBroadcaster(m_xServiceFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.GlobalEventBroadcaster"))),
-                UNO_QUERY);
-            if ( xDocEventBroadcaster.is() )
-            {
-                ::com::sun::star::document::EventObject aEvent(xModel, 
bCreateNew ? ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OnNew")) : 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OnLoad")));
+            Reference< css::container::XSet > 
xModelCollection(m_xServiceFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.GlobalEventBroadcaster"))),UNO_QUERY_THROW);
+            xModelCollection->insert(css::uno::makeAny(xModel));
+
+            Reference< css::document::XEventListener > 
xDocEventBroadcaster(xModel,UNO_QUERY_THROW);
+            css::document::EventObject aEvent(xModel, bCreateNew ? 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OnNew")) : 
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OnLoad")));
                 xDocEventBroadcaster->notifyEvent(aEvent);
             }
-        }
         catch(Exception)
         {
-            OSL_ENSURE(0,"Could not create GlobalEventBroadcaster!");
+            OSL_ENSURE(0,"Could not add database model to global model 
collection and broadcast the events OnNew/OnLoad!");
         }
                rListener->loadFinished(this);        
        }

File [changed]: xmlDataSource.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/filter/xml/xmlDataSource.cxx?r1=1.2&r2=1.2.80.1
Delta lines:  +5 -5
-------------------
--- xmlDataSource.cxx   2 Aug 2004 15:19:19 -0000       1.2
+++ xmlDataSource.cxx   18 Feb 2005 12:44:40 -0000      1.2.80.1
@@ -110,7 +110,7 @@
        const SvXMLNamespaceMap& rMap = rImport.GetNamespaceMap();
        const SvXMLTokenMap& rTokenMap = rImport.GetDataSourceElemTokenMap();
 
-       Reference<XPropertySet> xDataSource(rImport.GetModel(),UNO_QUERY);
+       Reference<XPropertySet> xDataSource = rImport.getDataSource();
 
        PropertyValue aProperty;
 
@@ -271,7 +271,7 @@
 // 
-----------------------------------------------------------------------------
 void OXMLDataSource::EndElement()
 {
-       Reference<XPropertySet> xDataSource(GetImport().GetModel(),UNO_QUERY);
+       Reference<XPropertySet> xDataSource(GetOwnImport().getDataSource());
        if ( !m_aInfoSequence.empty() && xDataSource.is() )
        {
                try

File [changed]: xmlDatabase.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/filter/xml/xmlDatabase.cxx?r1=1.2&r2=1.2.80.1
Delta lines:  +4 -4
-------------------
--- xmlDatabase.cxx     2 Aug 2004 15:20:35 -0000       1.2
+++ xmlDatabase.cxx     18 Feb 2005 12:44:40 -0000      1.2.80.1
@@ -149,7 +149,7 @@
                case XML_TOK_QUERIES:
                        {
                                
GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
-                               Reference<XQueryDefinitionsSupplier> 
xSup(GetOwnImport().GetModel(),UNO_QUERY);
+                               Reference<XQueryDefinitionsSupplier> 
xSup(GetOwnImport().getDataSource(),UNO_QUERY);
                                if ( xSup.is() )
                                        pContext = new OXMLDocuments( 
GetOwnImport(), nPrefix, 
rLocalName,xSup->getQueryDefinitions(),SERVICE_NAME_QUERY_COLLECTION);
                        }

File [changed]: xmlExport.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/filter/xml/xmlExport.cxx?r1=1.4&r2=1.4.20.1
Delta lines:  +13 -8
--------------------
--- xmlExport.cxx       5 Jan 2005 12:31:05 -0000       1.4
+++ xmlExport.cxx       18 Feb 2005 12:44:40 -0000      1.4.20.1
@@ -101,6 +101,9 @@
 #ifndef _COM_SUN_STAR_SDB_XFORMDOCUMENTSSUPPLIER_HPP_
 #include <com/sun/star/sdb/XFormDocumentsSupplier.hpp>
 #endif
+#ifndef _COM_SUN_STAR_SDB_XOFFICEDATABASEDOCUMENT_HPP_
+#include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
+#endif
 #ifndef _COM_SUN_STAR_SDB_XREPORTDOCUMENTSSUPPLIER_HPP_
 #include <com/sun/star/sdb/XReportDocumentsSupplier.hpp>
 #endif
@@ -306,7 +309,7 @@
 // 
-----------------------------------------------------------------------------   
    
 void ODBExport::exportDataSource()
 {
-       Reference<XPropertySet> xProp(GetModel(),UNO_QUERY);
+       Reference<XPropertySet> xProp(getDataSource());
        if ( xProp.is() )
        {
                ::rtl::OUString sValue;
@@ -589,7 +592,7 @@
                                                        
,::xmloff::token::XMLTokenEnum _eTokenFilter
                                                        
,::xmloff::token::XMLTokenEnum _eTokenType)
 {
-       Reference<XPropertySet> xProp(GetModel(),UNO_QUERY);
+       Reference<XPropertySet> xProp(getDataSource());
        Sequence< ::rtl::OUString> aValue;
        if ( _aValue.getLength() )
        {
@@ -607,7 +610,7 @@
 // 
-----------------------------------------------------------------------------
 void ODBExport::exportLogin()
 {
-       Reference<XPropertySet> xProp(GetModel(),UNO_QUERY);
+       Reference<XPropertySet> xProp(getDataSource());
        ::rtl::OUString sValue;
        xProp->getPropertyValue(PROPERTY_USER) >>= sValue;
        if ( sValue.getLength() )
@@ -842,7 +845,7 @@
 // 
-----------------------------------------------------------------------------
 void ODBExport::exportQueries(sal_Bool _bExportContext)
 {
-       Reference<XQueryDefinitionsSupplier> xSup(GetModel(),UNO_QUERY);
+       Reference<XQueryDefinitionsSupplier> xSup(getDataSource(),UNO_QUERY);
        if ( xSup.is() )
        {
                Reference< XNameAccess > xCollection = 
xSup->getQueryDefinitions();
@@ -969,7 +972,7 @@
 // 
-----------------------------------------------------------------------------
 void ODBExport::GetViewSettings(Sequence<PropertyValue>& aProps)
 {
-       Reference<XQueryDefinitionsSupplier> xSup(GetModel(),UNO_QUERY);
+       Reference<XQueryDefinitionsSupplier> xSup(getDataSource(),UNO_QUERY);
        if ( xSup.is() )
        {
                Reference< XNameAccess > xCollection = 
xSup->getQueryDefinitions();
@@ -1007,7 +1010,7 @@
 // 
-----------------------------------------------------------------------------
 void ODBExport::GetConfigurationSettings(Sequence<PropertyValue>& aProps)
 {
-       Reference<XPropertySet> xProp(GetModel(),UNO_QUERY);
+       Reference<XPropertySet> xProp(getDataSource());
        if ( xProp.is() )
        {
                sal_Int32 nLength = aProps.getLength();
@@ -1081,8 +1084,10 @@
 // 
-----------------------------------------------------------------------------
 void SAL_CALL ODBExport::setSourceDocument( const Reference< XComponent >& 
xDoc ) throw(IllegalArgumentException, RuntimeException)
 {
-       Reference<XPropertySet> xProp(xDoc,UNO_QUERY);
-       Reference< XNumberFormatsSupplier > 
xNum(xProp->getPropertyValue(PROPERTY_NUMBERFORMATSSUPPLIER),UNO_QUERY);
+       Reference<XOfficeDatabaseDocument> xOfficeDoc(xDoc,UNO_QUERY_THROW);
+       m_xDataSource.set(xOfficeDoc->getDataSource(),UNO_QUERY_THROW);
+       OSL_ENSURE(m_xDataSource.is(),"DataSource is NULL!");
+       Reference< XNumberFormatsSupplier > 
xNum(m_xDataSource->getPropertyValue(PROPERTY_NUMBERFORMATSSUPPLIER),UNO_QUERY);
        SetNumberFormatsSupplier(xNum);
        SvXMLExport::setSourceDocument(xDoc);
 }

File [changed]: xmlExport.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/filter/xml/xmlExport.hxx?r1=1.3&r2=1.3.20.1
Delta lines:  +3 -0
-------------------
--- xmlExport.hxx       5 Jan 2005 12:31:19 -0000       1.3
+++ xmlExport.hxx       18 Feb 2005 12:44:41 -0000      1.3.20.1
@@ -169,6 +169,7 @@
 
        mutable UniReference < XMLPropertySetMapper >   
m_xTableStylesPropertySetMapper;
        mutable UniReference < XMLPropertySetMapper >   
m_xColumnStylesPropertySetMapper;
+       Reference<XPropertySet>                                                 
m_xDataSource;
 
        void                                    exportDataSource();
        void                                    exportLogin();
@@ -228,6 +229,8 @@
 
        // XExporter
        virtual void SAL_CALL setSourceDocument( const 
::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc ) 
throw(::com::sun::star::lang::IllegalArgumentException, 
::com::sun::star::uno::RuntimeException);
+
+       inline Reference<XPropertySet> getDataSource() const { return 
m_xDataSource; }
 };
 
 // 
-----------------------------------------------------------------------------

File [changed]: xmlLogin.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/filter/xml/xmlLogin.cxx?r1=1.2&r2=1.2.80.1
Delta lines:  +4 -4
-------------------
--- xmlLogin.cxx        2 Aug 2004 15:22:18 -0000       1.2
+++ xmlLogin.cxx        18 Feb 2005 12:44:41 -0000      1.2.80.1
@@ -98,7 +98,7 @@
        const SvXMLNamespaceMap& rMap = rImport.GetNamespaceMap();
        const SvXMLTokenMap& rTokenMap = rImport.GetLoginElemTokenMap();
 
-       Reference<XPropertySet> xDataSource(rImport.GetModel(),UNO_QUERY);
+       Reference<XPropertySet> xDataSource(rImport.getDataSource());
 
        sal_Int16 nLength = (xDataSource.is() && _xAttrList.is()) ? 
_xAttrList->getLength() : 0;
        static const ::rtl::OUString s_sTRUE = 
::xmloff::token::GetXMLToken(XML_TRUE);

File [changed]: xmlTableFilterList.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/filter/xml/xmlTableFilterList.cxx?r1=1.2&r2=1.2.80.1
Delta lines:  +10 -4
--------------------
--- xmlTableFilterList.cxx      2 Aug 2004 15:23:30 -0000       1.2
+++ xmlTableFilterList.cxx      18 Feb 2005 12:44:41 -0000      1.2.80.1
@@ -136,9 +136,15 @@
        return pContext;
 }
 // 
-----------------------------------------------------------------------------
+ODBFilter& OXMLTableFilterList::GetOwnImport()
+{
+       return static_cast<ODBFilter&>(GetImport());
+}
+
+// 
-----------------------------------------------------------------------------
 void OXMLTableFilterList::EndElement()
 {
-       Reference<XPropertySet> xDataSource(GetImport().GetModel(),UNO_QUERY);
+       Reference<XPropertySet> xDataSource(GetOwnImport().getDataSource());
        if ( xDataSource.is() )
        {
                if ( !m_aPatterns.empty() )

File [changed]: xmlTableFilterList.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/filter/xml/xmlTableFilterList.hxx?r1=1.2&r2=1.2.80.1
Delta lines:  +6 -3
-------------------
--- xmlTableFilterList.hxx      2 Aug 2004 15:23:42 -0000       1.2
+++ xmlTableFilterList.hxx      18 Feb 2005 12:44:41 -0000      1.2.80.1
@@ -68,10 +68,13 @@
 
 namespace dbaxml
 {
+       class ODBFilter;
        class OXMLTableFilterList : public SvXMLImportContext
        {
                ::std::vector< ::rtl::OUString> m_aPatterns;
                ::std::vector< ::rtl::OUString> m_aTypes;
+
+               ODBFilter& GetOwnImport();
        public:
 
                OXMLTableFilterList( SvXMLImport& rImport, sal_uInt16 nPrfx,

File [changed]: xmlfilter.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/filter/xml/xmlfilter.cxx?r1=1.7&r2=1.7.26.1
Delta lines:  +8 -4
-------------------
--- xmlfilter.cxx       17 Nov 2004 14:45:28 -0000      1.7
+++ xmlfilter.cxx       18 Feb 2005 12:44:42 -0000      1.7.26.1
@@ -65,7 +65,9 @@
 #ifndef _COM_SUN_STAR_EMBED_ELEMENTMODES_HPP_
 #include <com/sun/star/embed/ElementModes.hpp>
 #endif
-
+#ifndef _COM_SUN_STAR_SDB_XOFFICEDATABASEDOCUMENT_HPP_
+#include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
+#endif
 #ifndef DBA_XMLFILTER_HXX
 #include "xmlfilter.hxx" 
 #endif
@@ -394,8 +396,10 @@
                OSL_ENSURE(xStorage.is(),"No Storage for read!");
                if ( xStorage.is() )
                {
-                       Reference<XPropertySet> xProp(GetModel(),UNO_QUERY);
-                       Reference< XNumberFormatsSupplier > 
xNum(xProp->getPropertyValue(PROPERTY_NUMBERFORMATSSUPPLIER),UNO_QUERY);
+                       Reference<sdb::XOfficeDatabaseDocument> 
xOfficeDoc(GetModel(),UNO_QUERY_THROW);
+                       
m_xDataSource.set(xOfficeDoc->getDataSource(),UNO_QUERY_THROW);
+                       OSL_ENSURE(m_xDataSource.is(),"DataSource is NULL!");
+                       Reference< XNumberFormatsSupplier > 
xNum(m_xDataSource->getPropertyValue(PROPERTY_NUMBERFORMATSSUPPLIER),UNO_QUERY);
                        SetNumberFormatsSupplier(xNum);
 
 
@@ -511,7 +515,7 @@
                {
                        Sequence<PropertyValue> aWindows;
                        pIter->Value >>= aWindows;
-                       Reference<XPropertySet> xProp(GetModel(),UNO_QUERY);
+                       Reference<XPropertySet> xProp(getDataSource());
                        if ( xProp.is() )
                                
xProp->setPropertyValue(PROPERTY_LAYOUTINFORMATION,makeAny(aWindows));
                }

File [changed]: xmlfilter.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/filter/xml/xmlfilter.hxx?r1=1.2&r2=1.2.80.1
Delta lines:  +5 -3
-------------------
--- xmlfilter.hxx       2 Aug 2004 15:24:23 -0000       1.2
+++ xmlfilter.hxx       18 Feb 2005 12:44:42 -0000      1.2.80.1
@@ -159,6 +159,7 @@
 
        mutable UniReference < XMLPropertySetMapper >   
m_xTableStylesPropertySetMapper;
        mutable UniReference < XMLPropertySetMapper >   
m_xColumnStylesPropertySetMapper;
+       Reference<XPropertySet>                                                 
m_xDataSource;
        sal_Int32                                                               
                m_nPreviewMode;
 
        sal_Bool                                                        
implImport( const Sequence< PropertyValue >& rDescriptor ) throw 
(RuntimeException);
@@ -196,6 +197,7 @@
        virtual void SetConfigurationSettings(const 
com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& 
aConfigProps);
 
        inline Reference< XMultiServiceFactory > getORB() { return 
getServiceFactory(); }
+       inline Reference<XPropertySet> getDataSource() const { return 
m_xDataSource; }
 
        inline const TPropertyNameMap& getQuerySettings() const { return 
m_aQuerySettings;}
        inline const TPropertyNameMap& getTableSettings() const { return 
m_aTablesSettings;}




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

Reply via email to