1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef DBACCESS_DATABASE_OBJECT_VIEW_HXX 29*cdf0e10cSrcweir #define DBACCESS_DATABASE_OBJECT_VIEW_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #ifndef _RTL_USTRING_HXX_ 32*cdf0e10cSrcweir #include <rtl/ustring.hxx> 33*cdf0e10cSrcweir #endif 34*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_ 35*cdf0e10cSrcweir #include <com/sun/star/sdbc/XConnection.hpp> 36*cdf0e10cSrcweir #endif 37*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBC_XDATASOURCE_HPP_ 38*cdf0e10cSrcweir #include <com/sun/star/sdbc/XDataSource.hpp> 39*cdf0e10cSrcweir #endif 40*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_FRAME_XDISPATCH_HPP_ 41*cdf0e10cSrcweir #include <com/sun/star/frame/XDispatch.hpp> 42*cdf0e10cSrcweir #endif 43*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_ 44*cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp> 45*cdf0e10cSrcweir #endif 46*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ 47*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 48*cdf0e10cSrcweir #endif 49*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_FRAME_XCOMPONENTLOADER_HPP_ 50*cdf0e10cSrcweir #include <com/sun/star/frame/XComponentLoader.hpp> 51*cdf0e10cSrcweir #endif 52*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_FRAME_XFRAME_HPP_ 53*cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp> 54*cdf0e10cSrcweir #endif 55*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_ 56*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp> 57*cdf0e10cSrcweir #endif 58*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UI_DIALOGS_XEXECUTABLEDIALOG_HPP_ 59*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> 60*cdf0e10cSrcweir #endif 61*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDB_APPLICATION_XDATABASEDOCUMENTUI_HPP_ 62*cdf0e10cSrcweir #include <com/sun/star/sdb/application/XDatabaseDocumentUI.hpp> 63*cdf0e10cSrcweir #endif 64*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_ 65*cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx> 66*cdf0e10cSrcweir #endif 67*cdf0e10cSrcweir #include <comphelper/namedvaluecollection.hxx> 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir #include <boost/shared_ptr.hpp> 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir // ......................................................................... 73*cdf0e10cSrcweir namespace dbaui 74*cdf0e10cSrcweir { 75*cdf0e10cSrcweir // ......................................................................... 76*cdf0e10cSrcweir /** encapsulates access to the view of a database object. 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir @todo 79*cdf0e10cSrcweir this is to be merged with the OLinkedDocumentAccess class 80*cdf0e10cSrcweir */ 81*cdf0e10cSrcweir class DatabaseObjectView 82*cdf0e10cSrcweir { 83*cdf0e10cSrcweir private: 84*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > 85*cdf0e10cSrcweir m_xORB; 86*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > 87*cdf0e10cSrcweir m_xParentFrame; 88*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XComponentLoader > 89*cdf0e10cSrcweir m_xFrameLoader; 90*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI > 91*cdf0e10cSrcweir m_xApplication; 92*cdf0e10cSrcweir ::rtl::OUString m_sComponentURL; 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir private: 96*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > 97*cdf0e10cSrcweir doDispatch( 98*cdf0e10cSrcweir const ::comphelper::NamedValueCollection& i_rDispatchArgs 99*cdf0e10cSrcweir ); 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir protected: 102*cdf0e10cSrcweir /** creates the desired view 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir The default implementation will call <member>fillDispatchArgs</member>, followed 105*cdf0e10cSrcweir by <member>doDispatch</member>. 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir @param _rDataSource 108*cdf0e10cSrcweir the data source, as passed to the <member>createNew</member> or <member>openExisting</member> method. 109*cdf0e10cSrcweir @param _rObjectName 110*cdf0e10cSrcweir the name of the object for which the view is to be opened, 111*cdf0e10cSrcweir or an empty string if a view for a new object should be created. 112*cdf0e10cSrcweir @param _rCreationArgs 113*cdf0e10cSrcweir the arguments for the view's creation 114*cdf0e10cSrcweir */ 115*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > doCreateView( 116*cdf0e10cSrcweir const ::com::sun::star::uno::Any& _rDataSource, 117*cdf0e10cSrcweir const ::rtl::OUString& _rObjectName, 118*cdf0e10cSrcweir const ::comphelper::NamedValueCollection& i_rCreationArgs 119*cdf0e10cSrcweir ); 120*cdf0e10cSrcweir 121*cdf0e10cSrcweir virtual void fillDispatchArgs( 122*cdf0e10cSrcweir ::comphelper::NamedValueCollection& i_rDispatchArgs, 123*cdf0e10cSrcweir const ::com::sun::star::uno::Any& _rDataSource, 124*cdf0e10cSrcweir const ::rtl::OUString& _rObjectName 125*cdf0e10cSrcweir ); 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >& 128*cdf0e10cSrcweir getApplicationUI() const { return m_xApplication; } 129*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > 130*cdf0e10cSrcweir getConnection() const; 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir public: 133*cdf0e10cSrcweir DatabaseObjectView( 134*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, 135*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >& _rxApplication, 136*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxParentFrame, 137*cdf0e10cSrcweir const ::rtl::OUString& _rComponentURL 138*cdf0e10cSrcweir ); 139*cdf0e10cSrcweir virtual ~DatabaseObjectView(){} 140*cdf0e10cSrcweir 141*cdf0e10cSrcweir /** sets the target frame into which the view should be loaded. 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir By default, the view is loaded into a top-level frame not being part of the 144*cdf0e10cSrcweir Desktop. 145*cdf0e10cSrcweir */ 146*cdf0e10cSrcweir void setTargetFrame( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame ) 147*cdf0e10cSrcweir { 148*cdf0e10cSrcweir m_xFrameLoader.set( _rxFrame, ::com::sun::star::uno::UNO_QUERY ); 149*cdf0e10cSrcweir } 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir /** opens a view for a to-be-created object 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir @param _xDataSource 154*cdf0e10cSrcweir the data source for which a new object is to be created 155*cdf0e10cSrcweir @return 156*cdf0e10cSrcweir the controller of the newly created document 157*cdf0e10cSrcweir */ 158*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > 159*cdf0e10cSrcweir createNew( 160*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource >& _xDataSource, 161*cdf0e10cSrcweir const ::comphelper::NamedValueCollection& i_rDispatchArgs = ::comphelper::NamedValueCollection() 162*cdf0e10cSrcweir ); 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir /** opens a view for an existent object 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir @param _xDataSource 167*cdf0e10cSrcweir the data source for which a new object is to be created 168*cdf0e10cSrcweir @param _rObjectName 169*cdf0e10cSrcweir the name of the object to be edited 170*cdf0e10cSrcweir @param _rArgs 171*cdf0e10cSrcweir Additional settings which should be forwarded to the frame 172*cdf0e10cSrcweir @return 173*cdf0e10cSrcweir the frame into which the view has been loaded 174*cdf0e10cSrcweir */ 175*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > 176*cdf0e10cSrcweir openExisting( 177*cdf0e10cSrcweir const ::com::sun::star::uno::Any& _aDataSource, 178*cdf0e10cSrcweir const ::rtl::OUString& _rName, 179*cdf0e10cSrcweir const ::comphelper::NamedValueCollection& i_rDispatchArgs 180*cdf0e10cSrcweir ); 181*cdf0e10cSrcweir }; 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir //====================================================================== 184*cdf0e10cSrcweir //= QueryDesigner 185*cdf0e10cSrcweir //====================================================================== 186*cdf0e10cSrcweir class QueryDesigner : public DatabaseObjectView 187*cdf0e10cSrcweir { 188*cdf0e10cSrcweir protected: 189*cdf0e10cSrcweir sal_Int32 m_nCommandType; 190*cdf0e10cSrcweir 191*cdf0e10cSrcweir protected: 192*cdf0e10cSrcweir virtual void fillDispatchArgs( 193*cdf0e10cSrcweir ::comphelper::NamedValueCollection& i_rDispatchArgs, 194*cdf0e10cSrcweir const ::com::sun::star::uno::Any& _aDataSource, 195*cdf0e10cSrcweir const ::rtl::OUString& _rObjectName 196*cdf0e10cSrcweir ); 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir public: 199*cdf0e10cSrcweir QueryDesigner( 200*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, 201*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >& _rxApplication, 202*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxParentFrame, 203*cdf0e10cSrcweir bool _bCreateView 204*cdf0e10cSrcweir ); 205*cdf0e10cSrcweir }; 206*cdf0e10cSrcweir 207*cdf0e10cSrcweir //====================================================================== 208*cdf0e10cSrcweir //= TableDesigner 209*cdf0e10cSrcweir //====================================================================== 210*cdf0e10cSrcweir class TableDesigner : public DatabaseObjectView 211*cdf0e10cSrcweir { 212*cdf0e10cSrcweir protected: 213*cdf0e10cSrcweir virtual void fillDispatchArgs( 214*cdf0e10cSrcweir ::comphelper::NamedValueCollection& i_rDispatchArgs, 215*cdf0e10cSrcweir const ::com::sun::star::uno::Any& _aDataSource, 216*cdf0e10cSrcweir const ::rtl::OUString& _rObjectName 217*cdf0e10cSrcweir ); 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > doCreateView( 220*cdf0e10cSrcweir const ::com::sun::star::uno::Any& _rDataSource, 221*cdf0e10cSrcweir const ::rtl::OUString& _rObjectName, 222*cdf0e10cSrcweir const ::comphelper::NamedValueCollection& i_rCreationArgs 223*cdf0e10cSrcweir ); 224*cdf0e10cSrcweir 225*cdf0e10cSrcweir public: 226*cdf0e10cSrcweir TableDesigner( 227*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, 228*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >& _rxApplication, 229*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxParentFrame 230*cdf0e10cSrcweir ); 231*cdf0e10cSrcweir 232*cdf0e10cSrcweir private: 233*cdf0e10cSrcweir /** retrieves the table designer component as provided by the connection, if any 234*cdf0e10cSrcweir @param _rTableName 235*cdf0e10cSrcweir the name of the table for which a designer is to be obtained 236*cdf0e10cSrcweir @return 237*cdf0e10cSrcweir the designer component, as provided by the connection, or <NULL/>, if the connection 238*cdf0e10cSrcweir does not provide a specialized designer. 239*cdf0e10cSrcweir @see com::sun::star::sdb::application::XTableUIProvider 240*cdf0e10cSrcweir */ 241*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > 242*cdf0e10cSrcweir impl_getConnectionProvidedDesigner_nothrow( const ::rtl::OUString& _rTableName ); 243*cdf0e10cSrcweir }; 244*cdf0e10cSrcweir 245*cdf0e10cSrcweir //====================================================================== 246*cdf0e10cSrcweir //= ResultSetBrowser 247*cdf0e10cSrcweir //====================================================================== 248*cdf0e10cSrcweir class ResultSetBrowser : public DatabaseObjectView 249*cdf0e10cSrcweir { 250*cdf0e10cSrcweir private: 251*cdf0e10cSrcweir sal_Bool m_bTable; 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir protected: 254*cdf0e10cSrcweir virtual void fillDispatchArgs( 255*cdf0e10cSrcweir ::comphelper::NamedValueCollection& i_rDispatchArgs, 256*cdf0e10cSrcweir const ::com::sun::star::uno::Any& _aDataSource, 257*cdf0e10cSrcweir const ::rtl::OUString& _rQualifiedName 258*cdf0e10cSrcweir ); 259*cdf0e10cSrcweir 260*cdf0e10cSrcweir public: 261*cdf0e10cSrcweir ResultSetBrowser( 262*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, 263*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >& _rxApplication, 264*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxParentFrame, 265*cdf0e10cSrcweir sal_Bool _bTable 266*cdf0e10cSrcweir ); 267*cdf0e10cSrcweir 268*cdf0e10cSrcweir }; 269*cdf0e10cSrcweir //====================================================================== 270*cdf0e10cSrcweir //= RelationDesigner 271*cdf0e10cSrcweir //====================================================================== 272*cdf0e10cSrcweir class RelationDesigner : public DatabaseObjectView 273*cdf0e10cSrcweir { 274*cdf0e10cSrcweir public: 275*cdf0e10cSrcweir RelationDesigner( 276*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, 277*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >& _rxApplication, 278*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxParentFrame 279*cdf0e10cSrcweir ); 280*cdf0e10cSrcweir }; 281*cdf0e10cSrcweir // ......................................................................... 282*cdf0e10cSrcweir } // namespace dbaui 283*cdf0e10cSrcweir // ......................................................................... 284*cdf0e10cSrcweir 285*cdf0e10cSrcweir #endif // DBACCESS_DATABASE_OBJECT_VIEW_HXX 286*cdf0e10cSrcweir 287