Update ooo320-m1
[ooovba.git] / extensions / source / propctrlr / formlinkdialog.hxx
blob754cd2630de99482bf27894270694d5a7d31cfab
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: formlinkdialog.hxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef EXTENSIONS_SOURCE_PROPCTRLR_FORMLINKDIALOG_HXX
32 #define EXTENSIONS_SOURCE_PROPCTRLR_FORMLINKDIALOG_HXX
34 #include <vcl/dialog.hxx>
35 #include <vcl/fixed.hxx>
36 #ifndef _SV_BUTTON_HXX
37 #include <vcl/button.hxx>
38 #endif
40 /** === begin UNO includes === **/
41 #include <com/sun/star/form/XForm.hpp>
42 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
43 #include <com/sun/star/sdbc/XConnection.hpp>
44 #include <com/sun/star/beans/XPropertySet.hpp>
45 /** === end UNO includes === **/
47 #include <memory>
49 //............................................................................
50 namespace pcr
52 //............................................................................
54 class FieldLinkRow;
55 //========================================================================
56 //= FormLinkDialog
57 //========================================================================
58 class FormLinkDialog : public ModalDialog
60 private:
61 FixedText m_aExplanation;
62 FixedText m_aDetailLabel;
63 FixedText m_aMasterLabel;
64 ::std::auto_ptr< FieldLinkRow > m_aRow1;
65 ::std::auto_ptr< FieldLinkRow > m_aRow2;
66 ::std::auto_ptr< FieldLinkRow > m_aRow3;
67 ::std::auto_ptr< FieldLinkRow > m_aRow4;
68 OKButton m_aOK;
69 CancelButton m_aCancel;
70 HelpButton m_aHelp;
71 PushButton m_aSuggest;
73 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
74 m_xORB;
75 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
76 m_xDetailForm;
77 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
78 m_xMasterForm;
80 ::com::sun::star::uno::Sequence< ::rtl::OUString >
81 m_aRelationDetailColumns;
82 ::com::sun::star::uno::Sequence< ::rtl::OUString >
83 m_aRelationMasterColumns;
85 ::rtl::OUString m_sDetailLabel;
86 ::rtl::OUString m_sMasterLabel;
88 public:
89 FormLinkDialog(
90 Window* _pParent,
91 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxDetailForm,
92 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxMasterForm,
93 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
94 const ::rtl::OUString& _sExplanation = ::rtl::OUString(),
95 const ::rtl::OUString& _sDetailLabel = ::rtl::OUString(),
96 const ::rtl::OUString& _sMasterLabel = ::rtl::OUString()
98 ~FormLinkDialog( );
100 // Dialog overridables
101 virtual short Execute();
103 private:
104 DECL_LINK( OnSuggest, void* );
105 DECL_LINK( OnFieldChanged, FieldLinkRow* );
106 DECL_LINK( OnInitialize, void* );
108 void updateOkButton();
109 void initializeFieldLists();
110 void initializeColumnLabels();
111 void initializeLinks();
112 void initializeSuggest();
113 void commitLinkPairs();
115 void initializeFieldRowsFrom(
116 ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rDetailFields,
117 ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rMasterFields
120 String getFormDataSourceType(
121 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxForm
122 ) const SAL_THROW(());
124 void getFormFields(
125 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxForm,
126 ::com::sun::star::uno::Sequence< ::rtl::OUString >& /* [out] */ _rNames
127 ) const SAL_THROW(());
129 void ensureFormConnection(
130 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxFormProps,
131 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& /* [out] */ _rxConnection
132 ) const SAL_THROW(( ::com::sun::star::uno::Exception ));
134 void getConnectionMetaData(
135 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxFormProps,
136 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& /* [out] */ _rxMeta
137 ) const SAL_THROW(( ::com::sun::star::uno::Exception ));
139 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
140 getCanonicUnderlyingTable( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxFormProps ) const;
141 sal_Bool getExistingRelation(
142 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxLHS,
143 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxRHS,
144 ::com::sun::star::uno::Sequence< ::rtl::OUString >& /* [out] */ _rLeftFields,
145 ::com::sun::star::uno::Sequence< ::rtl::OUString >& /* [out] */ _rRightFields
146 ) const;
149 //............................................................................
150 } // namespace pcr
151 //............................................................................
153 #endif // EXTENSIONS_SOURCE_PROPCTRLR_FORMLINKDIALOG_HXX