Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / extensions / source / propctrlr / MasterDetailLinkDialog.cxx
blob3b130c173cb4c87356228876042e59bb891929c7
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #include <sal/log.hxx>
21 #include <com/sun/star/beans/PropertyAttribute.hpp>
22 #include <com/sun/star/beans/PropertyValue.hpp>
23 #include <vcl/svapp.hxx>
24 #include "MasterDetailLinkDialog.hxx"
25 #include "formlinkdialog.hxx"
26 #include "pcrservices.hxx"
28 extern "C" void createRegistryInfo_MasterDetailLinkDialog()
30 ::pcr::OAutoRegistration< ::pcr::MasterDetailLinkDialog > aAutoRegistration;
33 namespace pcr
37 using namespace ::com::sun::star::uno;
38 using namespace ::com::sun::star::lang;
39 using namespace ::com::sun::star::beans;
41 MasterDetailLinkDialog::MasterDetailLinkDialog(const Reference< XComponentContext >& _rxContext )
42 :OGenericUnoDialog( _rxContext )
46 Sequence<sal_Int8> SAL_CALL MasterDetailLinkDialog::getImplementationId( )
48 return css::uno::Sequence<sal_Int8>();
52 Reference< XInterface > MasterDetailLinkDialog::Create( const Reference< XComponentContext >& _rxContext )
54 return *( new MasterDetailLinkDialog( _rxContext ) );
58 OUString SAL_CALL MasterDetailLinkDialog::getImplementationName()
60 return getImplementationName_static();
64 OUString MasterDetailLinkDialog::getImplementationName_static()
66 return "org.openoffice.comp.form.ui.MasterDetailLinkDialog";
70 css::uno::Sequence<OUString> SAL_CALL MasterDetailLinkDialog::getSupportedServiceNames()
72 return getSupportedServiceNames_static();
76 css::uno::Sequence<OUString> MasterDetailLinkDialog::getSupportedServiceNames_static()
78 css::uno::Sequence<OUString> aSupported { "com.sun.star.form.MasterDetailLinkDialog" };
79 return aSupported;
83 Reference<XPropertySetInfo> SAL_CALL MasterDetailLinkDialog::getPropertySetInfo()
85 Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) );
86 return xInfo;
90 ::cppu::IPropertyArrayHelper& MasterDetailLinkDialog::getInfoHelper()
92 return *getArrayHelper();
96 ::cppu::IPropertyArrayHelper* MasterDetailLinkDialog::createArrayHelper( ) const
98 Sequence< Property > aProps;
99 describeProperties(aProps);
100 return new ::cppu::OPropertyArrayHelper(aProps);
103 std::unique_ptr<weld::DialogController> MasterDetailLinkDialog::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent)
105 return std::make_unique<FormLinkDialog>(Application::GetFrameWeld(rParent), m_xDetail,
106 m_xMaster, m_aContext, m_sExplanation,
107 m_sDetailLabel, m_sMasterLabel);
110 void MasterDetailLinkDialog::implInitialize(const Any& _rValue)
112 PropertyValue aProperty;
113 if (_rValue >>= aProperty)
115 if (aProperty.Name == "Detail")
117 if ( ! (aProperty.Value >>= m_xDetail) )
118 SAL_WARN("extensions.propctrlr", "implInitialize: unable to get property Detail");
119 return;
121 else if (aProperty.Name == "Master")
123 if ( ! (aProperty.Value >>= m_xMaster) )
124 SAL_WARN("extensions.propctrlr", "implInitialize: unable to get property Master");
125 return;
127 else if (aProperty.Name == "Explanation")
129 if ( ! (aProperty.Value >>= m_sExplanation) )
130 SAL_WARN("extensions.propctrlr", "implInitialize: unable to get property Explanation");
131 return;
133 else if (aProperty.Name == "DetailLabel")
135 if ( ! (aProperty.Value >>= m_sDetailLabel) )
136 SAL_WARN("extensions.propctrlr", "implInitialize: unable to get property DetailLabel");
137 return;
139 else if (aProperty.Name == "MasterLabel")
141 if ( ! (aProperty.Value >>= m_sMasterLabel) )
142 SAL_WARN("extensions.propctrlr", "implInitialize: unable to get property MasterLabel");
143 return;
146 MasterDetailLinkDialog_DBase::implInitialize(_rValue);
150 } // namespace pcr
153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */