1*46dbaceeSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*46dbaceeSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*46dbaceeSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*46dbaceeSAndrew Rist * distributed with this work for additional information 6*46dbaceeSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*46dbaceeSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*46dbaceeSAndrew Rist * "License"); you may not use this file except in compliance 9*46dbaceeSAndrew Rist * with the License. You may obtain a copy of the License at 10*46dbaceeSAndrew Rist * 11*46dbaceeSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*46dbaceeSAndrew Rist * 13*46dbaceeSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*46dbaceeSAndrew Rist * software distributed under the License is distributed on an 15*46dbaceeSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*46dbaceeSAndrew Rist * KIND, either express or implied. See the License for the 17*46dbaceeSAndrew Rist * specific language governing permissions and limitations 18*46dbaceeSAndrew Rist * under the License. 19*46dbaceeSAndrew Rist * 20*46dbaceeSAndrew Rist *************************************************************/ 21*46dbaceeSAndrew Rist 22*46dbaceeSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef EXTENSIONS_SOURCE_PROPCTRLR_FORMLINKDIALOG_HXX 25cdf0e10cSrcweir #define EXTENSIONS_SOURCE_PROPCTRLR_FORMLINKDIALOG_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <vcl/dialog.hxx> 28cdf0e10cSrcweir #include <vcl/fixed.hxx> 29cdf0e10cSrcweir #ifndef _SV_BUTTON_HXX 30cdf0e10cSrcweir #include <vcl/button.hxx> 31cdf0e10cSrcweir #endif 32cdf0e10cSrcweir 33cdf0e10cSrcweir /** === begin UNO includes === **/ 34cdf0e10cSrcweir #include <com/sun/star/form/XForm.hpp> 35cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 36cdf0e10cSrcweir #include <com/sun/star/sdbc/XConnection.hpp> 37cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 38cdf0e10cSrcweir /** === end UNO includes === **/ 39cdf0e10cSrcweir 40cdf0e10cSrcweir #include <memory> 41cdf0e10cSrcweir 42cdf0e10cSrcweir //............................................................................ 43cdf0e10cSrcweir namespace pcr 44cdf0e10cSrcweir { 45cdf0e10cSrcweir //............................................................................ 46cdf0e10cSrcweir 47cdf0e10cSrcweir class FieldLinkRow; 48cdf0e10cSrcweir //======================================================================== 49cdf0e10cSrcweir //= FormLinkDialog 50cdf0e10cSrcweir //======================================================================== 51cdf0e10cSrcweir class FormLinkDialog : public ModalDialog 52cdf0e10cSrcweir { 53cdf0e10cSrcweir private: 54cdf0e10cSrcweir FixedText m_aExplanation; 55cdf0e10cSrcweir FixedText m_aDetailLabel; 56cdf0e10cSrcweir FixedText m_aMasterLabel; 57cdf0e10cSrcweir ::std::auto_ptr< FieldLinkRow > m_aRow1; 58cdf0e10cSrcweir ::std::auto_ptr< FieldLinkRow > m_aRow2; 59cdf0e10cSrcweir ::std::auto_ptr< FieldLinkRow > m_aRow3; 60cdf0e10cSrcweir ::std::auto_ptr< FieldLinkRow > m_aRow4; 61cdf0e10cSrcweir OKButton m_aOK; 62cdf0e10cSrcweir CancelButton m_aCancel; 63cdf0e10cSrcweir HelpButton m_aHelp; 64cdf0e10cSrcweir PushButton m_aSuggest; 65cdf0e10cSrcweir 66cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > 67cdf0e10cSrcweir m_xORB; 68cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > 69cdf0e10cSrcweir m_xDetailForm; 70cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > 71cdf0e10cSrcweir m_xMasterForm; 72cdf0e10cSrcweir 73cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > 74cdf0e10cSrcweir m_aRelationDetailColumns; 75cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString > 76cdf0e10cSrcweir m_aRelationMasterColumns; 77cdf0e10cSrcweir 78cdf0e10cSrcweir ::rtl::OUString m_sDetailLabel; 79cdf0e10cSrcweir ::rtl::OUString m_sMasterLabel; 80cdf0e10cSrcweir 81cdf0e10cSrcweir public: 82cdf0e10cSrcweir FormLinkDialog( 83cdf0e10cSrcweir Window* _pParent, 84cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxDetailForm, 85cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxMasterForm, 86cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, 87cdf0e10cSrcweir const ::rtl::OUString& _sExplanation = ::rtl::OUString(), 88cdf0e10cSrcweir const ::rtl::OUString& _sDetailLabel = ::rtl::OUString(), 89cdf0e10cSrcweir const ::rtl::OUString& _sMasterLabel = ::rtl::OUString() 90cdf0e10cSrcweir ); 91cdf0e10cSrcweir ~FormLinkDialog( ); 92cdf0e10cSrcweir 93cdf0e10cSrcweir // Dialog overridables 94cdf0e10cSrcweir virtual short Execute(); 95cdf0e10cSrcweir 96cdf0e10cSrcweir private: 97cdf0e10cSrcweir DECL_LINK( OnSuggest, void* ); 98cdf0e10cSrcweir DECL_LINK( OnFieldChanged, FieldLinkRow* ); 99cdf0e10cSrcweir DECL_LINK( OnInitialize, void* ); 100cdf0e10cSrcweir 101cdf0e10cSrcweir void updateOkButton(); 102cdf0e10cSrcweir void initializeFieldLists(); 103cdf0e10cSrcweir void initializeColumnLabels(); 104cdf0e10cSrcweir void initializeLinks(); 105cdf0e10cSrcweir void initializeSuggest(); 106cdf0e10cSrcweir void commitLinkPairs(); 107cdf0e10cSrcweir 108cdf0e10cSrcweir void initializeFieldRowsFrom( 109cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rDetailFields, 110cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rMasterFields 111cdf0e10cSrcweir ); 112cdf0e10cSrcweir 113cdf0e10cSrcweir String getFormDataSourceType( 114cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxForm 115cdf0e10cSrcweir ) const SAL_THROW(()); 116cdf0e10cSrcweir 117cdf0e10cSrcweir void getFormFields( 118cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxForm, 119cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString >& /* [out] */ _rNames 120cdf0e10cSrcweir ) const SAL_THROW(()); 121cdf0e10cSrcweir 122cdf0e10cSrcweir void ensureFormConnection( 123cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxFormProps, 124cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& /* [out] */ _rxConnection 125cdf0e10cSrcweir ) const SAL_THROW(( ::com::sun::star::uno::Exception )); 126cdf0e10cSrcweir 127cdf0e10cSrcweir void getConnectionMetaData( 128cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxFormProps, 129cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& /* [out] */ _rxMeta 130cdf0e10cSrcweir ) const SAL_THROW(( ::com::sun::star::uno::Exception )); 131cdf0e10cSrcweir 132cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > 133cdf0e10cSrcweir getCanonicUnderlyingTable( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxFormProps ) const; 134cdf0e10cSrcweir sal_Bool getExistingRelation( 135cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxLHS, 136cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxRHS, 137cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString >& /* [out] */ _rLeftFields, 138cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::rtl::OUString >& /* [out] */ _rRightFields 139cdf0e10cSrcweir ) const; 140cdf0e10cSrcweir }; 141cdf0e10cSrcweir 142cdf0e10cSrcweir //............................................................................ 143cdf0e10cSrcweir } // namespace pcr 144cdf0e10cSrcweir //............................................................................ 145cdf0e10cSrcweir 146cdf0e10cSrcweir #endif // EXTENSIONS_SOURCE_PROPCTRLR_FORMLINKDIALOG_HXX 147