merged tag LIBREOFFICE_3_2_99_3
[LibreOffice.git] / extensions / source / propctrlr / formlinkdialog.hxx
bloba660a569cd891337d6070bc0b1ab86db58774036
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef EXTENSIONS_SOURCE_PROPCTRLR_FORMLINKDIALOG_HXX
30 #define EXTENSIONS_SOURCE_PROPCTRLR_FORMLINKDIALOG_HXX
32 #include <vcl/dialog.hxx>
33 #include <vcl/fixed.hxx>
34 #include <vcl/button.hxx>
36 /** === begin UNO includes === **/
37 #include <com/sun/star/form/XForm.hpp>
38 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
39 #include <com/sun/star/sdbc/XConnection.hpp>
40 #include <com/sun/star/beans/XPropertySet.hpp>
41 /** === end UNO includes === **/
43 #include <memory>
45 //............................................................................
46 namespace pcr
48 //............................................................................
50 class FieldLinkRow;
51 //========================================================================
52 //= FormLinkDialog
53 //========================================================================
54 class FormLinkDialog : public ModalDialog
56 private:
57 FixedText m_aExplanation;
58 FixedText m_aDetailLabel;
59 FixedText m_aMasterLabel;
60 ::std::auto_ptr< FieldLinkRow > m_aRow1;
61 ::std::auto_ptr< FieldLinkRow > m_aRow2;
62 ::std::auto_ptr< FieldLinkRow > m_aRow3;
63 ::std::auto_ptr< FieldLinkRow > m_aRow4;
64 OKButton m_aOK;
65 CancelButton m_aCancel;
66 HelpButton m_aHelp;
67 PushButton m_aSuggest;
69 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
70 m_xORB;
71 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
72 m_xDetailForm;
73 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
74 m_xMasterForm;
76 ::com::sun::star::uno::Sequence< ::rtl::OUString >
77 m_aRelationDetailColumns;
78 ::com::sun::star::uno::Sequence< ::rtl::OUString >
79 m_aRelationMasterColumns;
81 ::rtl::OUString m_sDetailLabel;
82 ::rtl::OUString m_sMasterLabel;
84 public:
85 FormLinkDialog(
86 Window* _pParent,
87 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxDetailForm,
88 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxMasterForm,
89 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
90 const ::rtl::OUString& _sExplanation = ::rtl::OUString(),
91 const ::rtl::OUString& _sDetailLabel = ::rtl::OUString(),
92 const ::rtl::OUString& _sMasterLabel = ::rtl::OUString()
94 ~FormLinkDialog( );
96 // Dialog overridables
97 virtual short Execute();
99 private:
100 DECL_LINK( OnSuggest, void* );
101 DECL_LINK( OnFieldChanged, FieldLinkRow* );
102 DECL_LINK( OnInitialize, void* );
104 void updateOkButton();
105 void initializeFieldLists();
106 void initializeColumnLabels();
107 void initializeLinks();
108 void initializeSuggest();
109 void commitLinkPairs();
111 void initializeFieldRowsFrom(
112 ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rDetailFields,
113 ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rMasterFields
116 String getFormDataSourceType(
117 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxForm
118 ) const SAL_THROW(());
120 void getFormFields(
121 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxForm,
122 ::com::sun::star::uno::Sequence< ::rtl::OUString >& /* [out] */ _rNames
123 ) const SAL_THROW(());
125 void ensureFormConnection(
126 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxFormProps,
127 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& /* [out] */ _rxConnection
128 ) const SAL_THROW(( ::com::sun::star::uno::Exception ));
130 void getConnectionMetaData(
131 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxFormProps,
132 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& /* [out] */ _rxMeta
133 ) const SAL_THROW(( ::com::sun::star::uno::Exception ));
135 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
136 getCanonicUnderlyingTable( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxFormProps ) const;
137 sal_Bool getExistingRelation(
138 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxLHS,
139 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxRHS,
140 ::com::sun::star::uno::Sequence< ::rtl::OUString >& /* [out] */ _rLeftFields,
141 ::com::sun::star::uno::Sequence< ::rtl::OUString >& /* [out] */ _rRightFields
142 ) const;
145 //............................................................................
146 } // namespace pcr
147 //............................................................................
149 #endif // EXTENSIONS_SOURCE_PROPCTRLR_FORMLINKDIALOG_HXX
151 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */