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