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 === **/
45 //............................................................................
48 //............................................................................
51 //========================================================================
53 //========================================================================
54 class FormLinkDialog
: public ModalDialog
57 FixedText m_aExplanation
;
58 FixedText m_aDetailLabel
;
59 FixedText m_aMasterLabel
;
60 SAL_WNODEPRECATED_DECLARATIONS_PUSH
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 SAL_WNODEPRECATED_DECLARATIONS_POP
67 CancelButton m_aCancel
;
69 PushButton m_aSuggest
;
71 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>
73 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>
75 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>
78 ::com::sun::star::uno::Sequence
< ::rtl::OUString
>
79 m_aRelationDetailColumns
;
80 ::com::sun::star::uno::Sequence
< ::rtl::OUString
>
81 m_aRelationMasterColumns
;
83 ::rtl::OUString m_sDetailLabel
;
84 ::rtl::OUString m_sMasterLabel
;
89 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxDetailForm
,
90 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxMasterForm
,
91 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _rxORB
,
92 const ::rtl::OUString
& _sExplanation
= ::rtl::OUString(),
93 const ::rtl::OUString
& _sDetailLabel
= ::rtl::OUString(),
94 const ::rtl::OUString
& _sMasterLabel
= ::rtl::OUString()
98 // Dialog overridables
99 virtual short Execute();
102 DECL_LINK( OnSuggest
, void* );
103 DECL_LINK( OnFieldChanged
, FieldLinkRow
* );
104 DECL_LINK( OnInitialize
, void* );
106 void updateOkButton();
107 void initializeFieldLists();
108 void initializeColumnLabels();
109 void initializeLinks();
110 void initializeSuggest();
111 void commitLinkPairs();
113 void initializeFieldRowsFrom(
114 ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& _rDetailFields
,
115 ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& _rMasterFields
118 String
getFormDataSourceType(
119 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxForm
120 ) const SAL_THROW(());
123 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxForm
,
124 ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& /* [out] */ _rNames
125 ) const SAL_THROW(());
127 void ensureFormConnection(
128 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxFormProps
,
129 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>& /* [out] */ _rxConnection
130 ) const SAL_THROW(( ::com::sun::star::uno::Exception
));
132 void getConnectionMetaData(
133 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxFormProps
,
134 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XDatabaseMetaData
>& /* [out] */ _rxMeta
135 ) const SAL_THROW(( ::com::sun::star::uno::Exception
));
137 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>
138 getCanonicUnderlyingTable( const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxFormProps
) const;
139 sal_Bool
getExistingRelation(
140 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxLHS
,
141 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxRHS
,
142 ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& /* [out] */ _rLeftFields
,
143 ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& /* [out] */ _rRightFields
147 //............................................................................
149 //............................................................................
151 #endif // EXTENSIONS_SOURCE_PROPCTRLR_FORMLINKDIALOG_HXX
153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */