masterfix DEV300: #i10000# build fix
[LibreOffice.git] / extensions / source / propctrlr / formlinkdialog.hxx
blob9605ee62223484e076ac0c9269d223bb5d837b1d
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef EXTENSIONS_SOURCE_PROPCTRLR_FORMLINKDIALOG_HXX
29 #define EXTENSIONS_SOURCE_PROPCTRLR_FORMLINKDIALOG_HXX
31 #include <vcl/dialog.hxx>
32 #include <vcl/fixed.hxx>
33 #ifndef _SV_BUTTON_HXX
34 #include <vcl/button.hxx>
35 #endif
37 /** === begin UNO includes === **/
38 #include <com/sun/star/form/XForm.hpp>
39 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
40 #include <com/sun/star/sdbc/XConnection.hpp>
41 #include <com/sun/star/beans/XPropertySet.hpp>
42 /** === end UNO includes === **/
44 #include <memory>
46 //............................................................................
47 namespace pcr
49 //............................................................................
51 class FieldLinkRow;
52 //========================================================================
53 //= FormLinkDialog
54 //========================================================================
55 class FormLinkDialog : public ModalDialog
57 private:
58 FixedText m_aExplanation;
59 FixedText m_aDetailLabel;
60 FixedText m_aMasterLabel;
61 ::std::auto_ptr< FieldLinkRow > m_aRow1;
62 ::std::auto_ptr< FieldLinkRow > m_aRow2;
63 ::std::auto_ptr< FieldLinkRow > m_aRow3;
64 ::std::auto_ptr< FieldLinkRow > m_aRow4;
65 OKButton m_aOK;
66 CancelButton m_aCancel;
67 HelpButton m_aHelp;
68 PushButton m_aSuggest;
70 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
71 m_xORB;
72 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
73 m_xDetailForm;
74 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
75 m_xMasterForm;
77 ::com::sun::star::uno::Sequence< ::rtl::OUString >
78 m_aRelationDetailColumns;
79 ::com::sun::star::uno::Sequence< ::rtl::OUString >
80 m_aRelationMasterColumns;
82 ::rtl::OUString m_sDetailLabel;
83 ::rtl::OUString m_sMasterLabel;
85 public:
86 FormLinkDialog(
87 Window* _pParent,
88 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxDetailForm,
89 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxMasterForm,
90 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
91 const ::rtl::OUString& _sExplanation = ::rtl::OUString(),
92 const ::rtl::OUString& _sDetailLabel = ::rtl::OUString(),
93 const ::rtl::OUString& _sMasterLabel = ::rtl::OUString()
95 ~FormLinkDialog( );
97 // Dialog overridables
98 virtual short Execute();
100 private:
101 DECL_LINK( OnSuggest, void* );
102 DECL_LINK( OnFieldChanged, FieldLinkRow* );
103 DECL_LINK( OnInitialize, void* );
105 void updateOkButton();
106 void initializeFieldLists();
107 void initializeColumnLabels();
108 void initializeLinks();
109 void initializeSuggest();
110 void commitLinkPairs();
112 void initializeFieldRowsFrom(
113 ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rDetailFields,
114 ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rMasterFields
117 String getFormDataSourceType(
118 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxForm
119 ) const SAL_THROW(());
121 void getFormFields(
122 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxForm,
123 ::com::sun::star::uno::Sequence< ::rtl::OUString >& /* [out] */ _rNames
124 ) const SAL_THROW(());
126 void ensureFormConnection(
127 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxFormProps,
128 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& /* [out] */ _rxConnection
129 ) const SAL_THROW(( ::com::sun::star::uno::Exception ));
131 void getConnectionMetaData(
132 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxFormProps,
133 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& /* [out] */ _rxMeta
134 ) const SAL_THROW(( ::com::sun::star::uno::Exception ));
136 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
137 getCanonicUnderlyingTable( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxFormProps ) const;
138 sal_Bool getExistingRelation(
139 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxLHS,
140 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxRHS,
141 ::com::sun::star::uno::Sequence< ::rtl::OUString >& /* [out] */ _rLeftFields,
142 ::com::sun::star::uno::Sequence< ::rtl::OUString >& /* [out] */ _rRightFields
143 ) const;
146 //............................................................................
147 } // namespace pcr
148 //............................................................................
150 #endif // EXTENSIONS_SOURCE_PROPCTRLR_FORMLINKDIALOG_HXX