1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_FORMLINKDIALOG_HXX
21 #define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_FORMLINKDIALOG_HXX
23 #include <vcl/dialog.hxx>
24 #include <vcl/fixed.hxx>
25 #include <vcl/button.hxx>
27 #include <com/sun/star/form/XForm.hpp>
28 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
29 #include <com/sun/star/sdbc/XConnection.hpp>
30 #include <com/sun/star/beans/XPropertySet.hpp>
31 #include <com/sun/star/uno/XComponentContext.hpp>
44 class FormLinkDialog
: public ModalDialog
47 VclPtr
<FixedText
> m_pExplanation
;
48 VclPtr
<FixedText
> m_pDetailLabel
;
49 VclPtr
<FixedText
> m_pMasterLabel
;
50 VclPtr
<FieldLinkRow
> m_aRow1
;
51 VclPtr
<FieldLinkRow
> m_aRow2
;
52 VclPtr
<FieldLinkRow
> m_aRow3
;
53 VclPtr
<FieldLinkRow
> m_aRow4
;
54 VclPtr
<OKButton
> m_pOK
;
55 VclPtr
<PushButton
> m_pSuggest
;
57 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>
59 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>
61 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>
64 ::com::sun::star::uno::Sequence
< OUString
>
65 m_aRelationDetailColumns
;
66 ::com::sun::star::uno::Sequence
< OUString
>
67 m_aRelationMasterColumns
;
69 OUString m_sDetailLabel
;
70 OUString m_sMasterLabel
;
74 vcl::Window
* _pParent
,
75 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxDetailForm
,
76 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxMasterForm
,
77 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& _rxContext
,
78 const OUString
& _sExplanation
= OUString(),
79 const OUString
& _sDetailLabel
= OUString(),
80 const OUString
& _sMasterLabel
= OUString()
82 virtual ~FormLinkDialog( );
83 virtual void dispose() SAL_OVERRIDE
;
85 // Dialog overridables
86 virtual short Execute() SAL_OVERRIDE
;
89 DECL_LINK( OnSuggest
, void* );
90 DECL_LINK( OnFieldChanged
, FieldLinkRow
* );
91 DECL_LINK( OnInitialize
, void* );
93 void updateOkButton();
94 void initializeFieldLists();
95 void initializeColumnLabels();
96 void initializeLinks();
97 void initializeSuggest();
98 void commitLinkPairs();
100 void initializeFieldRowsFrom(
101 ::com::sun::star::uno::Sequence
< OUString
>& _rDetailFields
,
102 ::com::sun::star::uno::Sequence
< OUString
>& _rMasterFields
105 static OUString
getFormDataSourceType(
106 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxForm
110 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxForm
,
111 ::com::sun::star::uno::Sequence
< OUString
>& /* [out] */ _rNames
114 void ensureFormConnection(
115 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxFormProps
,
116 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>& /* [out] */ _rxConnection
119 static void getConnectionMetaData(
120 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxFormProps
,
121 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XDatabaseMetaData
>& /* [out] */ _rxMeta
124 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>
125 getCanonicUnderlyingTable( const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxFormProps
) const;
126 static bool getExistingRelation(
127 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxLHS
,
128 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& _rxRHS
,
129 ::com::sun::star::uno::Sequence
< OUString
>& /* [out] */ _rLeftFields
,
130 ::com::sun::star::uno::Sequence
< OUString
>& /* [out] */ _rRightFields
138 #endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_FORMLINKDIALOG_HXX
140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */