use insert function instead of for loop
[LibreOffice.git] / extensions / source / propctrlr / MasterDetailLinkDialog.cxx
blob117d7c7da1cebce2704de93cebf10744533f85ef
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/PropertyValue.hpp>
22 #include <vcl/svapp.hxx>
23 #include "MasterDetailLinkDialog.hxx"
24 #include "formlinkdialog.hxx"
26 namespace pcr
30 using namespace ::com::sun::star::uno;
31 using namespace ::com::sun::star::beans;
33 MasterDetailLinkDialog::MasterDetailLinkDialog(const Reference< XComponentContext >& _rxContext )
34 :OGenericUnoDialog( _rxContext )
38 Sequence<sal_Int8> SAL_CALL MasterDetailLinkDialog::getImplementationId( )
40 return css::uno::Sequence<sal_Int8>();
44 OUString SAL_CALL MasterDetailLinkDialog::getImplementationName()
46 return u"org.openoffice.comp.form.ui.MasterDetailLinkDialog"_ustr;
50 css::uno::Sequence<OUString> SAL_CALL MasterDetailLinkDialog::getSupportedServiceNames()
52 return { u"com.sun.star.form.MasterDetailLinkDialog"_ustr };
56 Reference<XPropertySetInfo> SAL_CALL MasterDetailLinkDialog::getPropertySetInfo()
58 Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) );
59 return xInfo;
63 ::cppu::IPropertyArrayHelper& MasterDetailLinkDialog::getInfoHelper()
65 return *getArrayHelper();
69 ::cppu::IPropertyArrayHelper* MasterDetailLinkDialog::createArrayHelper( ) const
71 Sequence< Property > aProps;
72 describeProperties(aProps);
73 return new ::cppu::OPropertyArrayHelper(aProps);
76 std::unique_ptr<weld::DialogController> MasterDetailLinkDialog::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent)
78 return std::make_unique<FormLinkDialog>(Application::GetFrameWeld(rParent), m_xDetail,
79 m_xMaster, m_aContext, m_sExplanation,
80 m_sDetailLabel, m_sMasterLabel);
83 void MasterDetailLinkDialog::implInitialize(const Any& _rValue)
85 PropertyValue aProperty;
86 if (_rValue >>= aProperty)
88 if (aProperty.Name == "Detail")
90 if ( ! (aProperty.Value >>= m_xDetail) )
91 SAL_WARN("extensions.propctrlr", "implInitialize: unable to get property Detail");
92 return;
94 else if (aProperty.Name == "Master")
96 if ( ! (aProperty.Value >>= m_xMaster) )
97 SAL_WARN("extensions.propctrlr", "implInitialize: unable to get property Master");
98 return;
100 else if (aProperty.Name == "Explanation")
102 if ( ! (aProperty.Value >>= m_sExplanation) )
103 SAL_WARN("extensions.propctrlr", "implInitialize: unable to get property Explanation");
104 return;
106 else if (aProperty.Name == "DetailLabel")
108 if ( ! (aProperty.Value >>= m_sDetailLabel) )
109 SAL_WARN("extensions.propctrlr", "implInitialize: unable to get property DetailLabel");
110 return;
112 else if (aProperty.Name == "MasterLabel")
114 if ( ! (aProperty.Value >>= m_sMasterLabel) )
115 SAL_WARN("extensions.propctrlr", "implInitialize: unable to get property MasterLabel");
116 return;
119 MasterDetailLinkDialog_DBase::implInitialize(_rValue);
123 } // namespace pcr
125 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
126 extensions_propctrlr_MasterDetailLinkDialog_get_implementation(
127 css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&)
129 return cppu::acquire(new pcr::MasterDetailLinkDialog(context));
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */