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 _DBAUI_LINKEDDOCUMENTS_HXX_ 29*cdf0e10cSrcweir #define _DBAUI_LINKEDDOCUMENTS_HXX_ 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "AppElementType.hxx" 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ 34*cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp> 35*cdf0e10cSrcweir #endif 36*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ 37*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 38*cdf0e10cSrcweir #endif 39*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_ 40*cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp> 41*cdf0e10cSrcweir #endif 42*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ 43*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 44*cdf0e10cSrcweir #endif 45*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_ 46*cdf0e10cSrcweir #include <com/sun/star/sdbc/XConnection.hpp> 47*cdf0e10cSrcweir #endif 48*cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp> 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_UCB_XCONTENT_HPP_ 53*cdf0e10cSrcweir #include <com/sun/star/ucb/XContent.hpp> 54*cdf0e10cSrcweir #endif 55*cdf0e10cSrcweir #include <com/sun/star/sdb/application/XDatabaseDocumentUI.hpp> 56*cdf0e10cSrcweir #ifndef _LINK_HXX 57*cdf0e10cSrcweir #include <tools/link.hxx> 58*cdf0e10cSrcweir #endif 59*cdf0e10cSrcweir #ifndef _STRING_HXX 60*cdf0e10cSrcweir #include <tools/string.hxx> 61*cdf0e10cSrcweir #endif 62*cdf0e10cSrcweir #ifndef COMPHELPER_NAMEDVALUECOLLECTION_HXX 63*cdf0e10cSrcweir #include <comphelper/namedvaluecollection.hxx> 64*cdf0e10cSrcweir #endif 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir class Window; 67*cdf0e10cSrcweir //...................................................................... 68*cdf0e10cSrcweir namespace dbaui 69*cdf0e10cSrcweir { 70*cdf0e10cSrcweir //...................................................................... 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir //================================================================== 73*cdf0e10cSrcweir //= OLinkedDocumentsAccess 74*cdf0e10cSrcweir //================================================================== 75*cdf0e10cSrcweir class OLinkedDocumentsAccess 76*cdf0e10cSrcweir { 77*cdf0e10cSrcweir protected: 78*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > 79*cdf0e10cSrcweir m_xORB; 80*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > 81*cdf0e10cSrcweir m_xDocumentContainer; 82*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> 83*cdf0e10cSrcweir m_xConnection; 84*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI > 85*cdf0e10cSrcweir m_xDocumentUI; 86*cdf0e10cSrcweir Window* m_pDialogParent; 87*cdf0e10cSrcweir String m_sCurrentlyEditing; 88*cdf0e10cSrcweir ::rtl::OUString 89*cdf0e10cSrcweir m_sDataSourceName; 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir public: 92*cdf0e10cSrcweir OLinkedDocumentsAccess( 93*cdf0e10cSrcweir Window* _pDialogParent, 94*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >& i_rDocumentUI, 95*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, 96*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxContainer, 97*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection, 98*cdf0e10cSrcweir const ::rtl::OUString& _sDataSourceName 99*cdf0e10cSrcweir ); 100*cdf0e10cSrcweir ~OLinkedDocumentsAccess(); 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir inline sal_Bool isConnected() const { return m_xConnection.is(); } 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent> 105*cdf0e10cSrcweir open( 106*cdf0e10cSrcweir const ::rtl::OUString& _rLinkName, 107*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent>& _xDefinition, 108*cdf0e10cSrcweir ElementOpenMode _eOpenMode, 109*cdf0e10cSrcweir const ::comphelper::NamedValueCollection& _rAdditionalArgs 110*cdf0e10cSrcweir ); 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > 113*cdf0e10cSrcweir newDocument( 114*cdf0e10cSrcweir sal_Int32 i_nActionID, 115*cdf0e10cSrcweir const ::comphelper::NamedValueCollection& i_rCreationArgs, 116*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& o_rDefinition 117*cdf0e10cSrcweir ); 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir void newFormWithPilot( 120*cdf0e10cSrcweir const sal_Int32 _nCommandType = -1, 121*cdf0e10cSrcweir const ::rtl::OUString& _rObjectName = ::rtl::OUString() 122*cdf0e10cSrcweir ); 123*cdf0e10cSrcweir void newReportWithPilot( 124*cdf0e10cSrcweir const sal_Int32 _nCommandType = -1, 125*cdf0e10cSrcweir const ::rtl::OUString& _rObjectName = ::rtl::OUString() 126*cdf0e10cSrcweir ); 127*cdf0e10cSrcweir void newQueryWithPilot(); 128*cdf0e10cSrcweir void newTableWithPilot(); 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir enum RESULT 131*cdf0e10cSrcweir { 132*cdf0e10cSrcweir ERROR, 133*cdf0e10cSrcweir SUCCESS, 134*cdf0e10cSrcweir CANCEL 135*cdf0e10cSrcweir }; 136*cdf0e10cSrcweir private: 137*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > 138*cdf0e10cSrcweir impl_open( 139*cdf0e10cSrcweir const ::rtl::OUString& _rLinkName, 140*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& _xDefinition, 141*cdf0e10cSrcweir ElementOpenMode _eOpenMode, 142*cdf0e10cSrcweir const ::comphelper::NamedValueCollection& _rAdditionalArgs 143*cdf0e10cSrcweir ); 144*cdf0e10cSrcweir 145*cdf0e10cSrcweir void 146*cdf0e10cSrcweir impl_newWithPilot( 147*cdf0e10cSrcweir const char* _pWizardService, 148*cdf0e10cSrcweir const sal_Int32 _nCommandType, 149*cdf0e10cSrcweir const ::rtl::OUString& _rObjectName 150*cdf0e10cSrcweir ); 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir }; 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir //...................................................................... 155*cdf0e10cSrcweir } // namespace dbaui 156*cdf0e10cSrcweir //...................................................................... 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir #endif // _DBAUI_LINKEDDOCUMENTS_HXX_ 159*cdf0e10cSrcweir 160