1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
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.
14  *
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).
20  *
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.
25  *
26  ************************************************************************/
27 
28  #include "precompiled_extensions.hxx"
29  #include "MasterDetailLinkDialog.hxx"
30  #include "formlinkdialog.hxx"
31 
32  extern "C" void SAL_CALL createRegistryInfo_MasterDetailLinkDialog()
33 {
34 	::pcr::OAutoRegistration< ::pcr::MasterDetailLinkDialog > aAutoRegistration;
35 }
36 
37 //............................................................................
38 namespace pcr
39 {
40 //............................................................................
41 
42     using namespace ::com::sun::star::uno;
43     using namespace ::com::sun::star::lang;
44     using namespace ::com::sun::star::beans;
45 
46     //====================================================================
47 	//= MasterDetailLinkDialog
48 	//====================================================================
49 	//---------------------------------------------------------------------
50 	MasterDetailLinkDialog::MasterDetailLinkDialog(const Reference< XComponentContext >& _rxContext )
51 		:OGenericUnoDialog( _rxContext )
52 	{
53 	}
54 //---------------------------------------------------------------------
55 	Sequence<sal_Int8> SAL_CALL MasterDetailLinkDialog::getImplementationId(  ) throw(RuntimeException)
56 	{
57 		static ::cppu::OImplementationId aId;
58 		return aId.getImplementationId();
59 	}
60 
61 	//---------------------------------------------------------------------
62 	Reference< XInterface > SAL_CALL MasterDetailLinkDialog::Create( const Reference< XComponentContext >& _rxContext )
63 	{
64 		return *( new MasterDetailLinkDialog( _rxContext ) );
65 	}
66 
67 	//---------------------------------------------------------------------
68 	::rtl::OUString SAL_CALL MasterDetailLinkDialog::getImplementationName() throw(RuntimeException)
69 	{
70 		return getImplementationName_static();
71 	}
72 
73 	//---------------------------------------------------------------------
74 	::rtl::OUString MasterDetailLinkDialog::getImplementationName_static() throw(RuntimeException)
75 	{
76 		return ::rtl::OUString::createFromAscii("org.openoffice.comp.form.ui.MasterDetailLinkDialog");
77 	}
78 
79 	//---------------------------------------------------------------------
80 	::comphelper::StringSequence SAL_CALL MasterDetailLinkDialog::getSupportedServiceNames() throw(RuntimeException)
81 	{
82 		return getSupportedServiceNames_static();
83 	}
84 
85 	//---------------------------------------------------------------------
86 	::comphelper::StringSequence MasterDetailLinkDialog::getSupportedServiceNames_static() throw(RuntimeException)
87 	{
88 		::comphelper::StringSequence aSupported(1);
89 		aSupported.getArray()[0] = ::rtl::OUString::createFromAscii("com.sun.star.form.MasterDetailLinkDialog");
90 		return aSupported;
91 	}
92 
93 	//---------------------------------------------------------------------
94 	Reference<XPropertySetInfo>  SAL_CALL MasterDetailLinkDialog::getPropertySetInfo() throw(RuntimeException)
95 	{
96 		Reference<XPropertySetInfo>  xInfo( createPropertySetInfo( getInfoHelper() ) );
97 		return xInfo;
98 	}
99 
100 	//---------------------------------------------------------------------
101 	::cppu::IPropertyArrayHelper& MasterDetailLinkDialog::getInfoHelper()
102 	{
103 		return *const_cast<MasterDetailLinkDialog*>(this)->getArrayHelper();
104 	}
105 
106 	//--------------------------------------------------------------------------
107 	::cppu::IPropertyArrayHelper* MasterDetailLinkDialog::createArrayHelper( ) const
108 	{
109 		Sequence< Property > aProps;
110 		describeProperties(aProps);
111 		return new ::cppu::OPropertyArrayHelper(aProps);
112 	}
113 
114 	//--------------------------------------------------------------------------
115 	Dialog*	MasterDetailLinkDialog::createDialog(Window* _pParent)
116 	{
117         return new FormLinkDialog(_pParent,m_xDetail,m_xMaster,m_aContext.getLegacyServiceFactory()
118             ,m_sExplanation,m_sDetailLabel,m_sMasterLabel);
119 	}
120     //---------------------------------------------------------------------
121 	void MasterDetailLinkDialog::implInitialize(const Any& _rValue)
122 	{
123 		PropertyValue aProperty;
124 		if (_rValue >>= aProperty)
125 		{
126 			if (0 == aProperty.Name.compareToAscii("Detail"))
127 			{
128 				OSL_VERIFY( aProperty.Value >>= m_xDetail );
129                 return;
130 			}
131             else if (0 == aProperty.Name.compareToAscii("Master"))
132 			{
133 				OSL_VERIFY( aProperty.Value >>= m_xMaster );
134                 return;
135 			}
136             else if (0 == aProperty.Name.compareToAscii("Explanation"))
137 			{
138 				OSL_VERIFY( aProperty.Value >>= m_sExplanation );
139                 return;
140 			}
141             else if (0 == aProperty.Name.compareToAscii("DetailLabel"))
142 			{
143 				OSL_VERIFY( aProperty.Value >>= m_sDetailLabel );
144                 return;
145 			}
146             else if (0 == aProperty.Name.compareToAscii("MasterLabel"))
147 			{
148 				OSL_VERIFY( aProperty.Value >>= m_sMasterLabel );
149                 return;
150 			}
151 		}
152 		MasterDetailLinkDialog_DBase::implInitialize(_rValue);
153 	}
154 
155 //............................................................................
156 }   // namespace pcr
157 //............................................................................
158