use insert function instead of for loop
[LibreOffice.git] / extensions / source / propctrlr / pcrunodialogs.cxx
blobef5ff1903f1ece3cd634bf68f3ca1e5260ba021c
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/config.h>
22 #include <com/sun/star/beans/NamedValue.hpp>
23 #include <com/sun/star/beans/PropertyAttribute.hpp>
24 #include <com/sun/star/awt/XWindow.hpp>
25 #include <vcl/svapp.hxx>
26 #include "pcrunodialogs.hxx"
27 #include "formstrings.hxx"
28 #include "pcrstrings.hxx"
29 #include "taborder.hxx"
30 #include "pcrcommon.hxx"
33 namespace pcr
37 using namespace ::com::sun::star::uno;
38 using namespace ::com::sun::star::beans;
41 //= OTabOrderDialog
44 OTabOrderDialog::OTabOrderDialog( const Reference< XComponentContext >& _rxContext )
45 :OGenericUnoDialog( _rxContext )
47 registerProperty( PROPERTY_CONTROLCONTEXT, static_cast<sal_Int32>(OwnPropertyId::CONTROLCONTEXT),
48 PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT,
49 &m_xControlContext, cppu::UnoType<decltype(m_xControlContext)>::get() );
51 registerProperty( PROPERTY_TABBINGMODEL, static_cast<sal_Int32>(OwnPropertyId::TABBINGMODEL),
52 PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT,
53 &m_xTabbingModel, cppu::UnoType<decltype(m_xTabbingModel)>::get() );
56 OTabOrderDialog::~OTabOrderDialog()
58 if (m_xDialog)
60 ::osl::MutexGuard aGuard( m_aMutex );
61 if (m_xDialog)
62 destroyDialog();
66 Sequence<sal_Int8> SAL_CALL OTabOrderDialog::getImplementationId( )
68 return css::uno::Sequence<sal_Int8>();
71 OUString SAL_CALL OTabOrderDialog::getImplementationName()
73 return u"org.openoffice.comp.form.ui.OTabOrderDialog"_ustr;
77 css::uno::Sequence<OUString> SAL_CALL OTabOrderDialog::getSupportedServiceNames()
79 return { u"com.sun.star.form.ui.TabOrderDialog"_ustr, u"com.sun.star.form.TabOrderDialog"_ustr };
83 Reference<XPropertySetInfo> SAL_CALL OTabOrderDialog::getPropertySetInfo()
85 Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) );
86 return xInfo;
89 ::cppu::IPropertyArrayHelper& OTabOrderDialog::getInfoHelper()
91 return *getArrayHelper();
94 ::cppu::IPropertyArrayHelper* OTabOrderDialog::createArrayHelper( ) const
96 Sequence< Property > aProps;
97 describeProperties( aProps );
98 return new ::cppu::OPropertyArrayHelper( aProps );
101 std::unique_ptr<weld::DialogController> OTabOrderDialog::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent)
103 return std::make_unique<TabOrderDialog>(Application::GetFrameWeld(rParent), m_xTabbingModel, m_xControlContext, m_aContext);
106 void OTabOrderDialog::initialize( const Sequence< Any >& aArguments )
108 Reference<css::awt::XTabControllerModel> xTabbingModel;
109 Reference<css::awt::XControlContainer> xControlContext;
110 Reference<css::awt::XWindow> xParentWindow;
111 if (aArguments.getLength() == 3 && (aArguments[0] >>= xTabbingModel) && (aArguments[1] >>= xControlContext) && (aArguments[2] >>= xParentWindow))
113 Sequence< Any > aNewArguments{
114 Any(NamedValue(
115 u"TabbingModel"_ustr,
116 Any( xTabbingModel )
118 Any(NamedValue(
119 u"ControlContext"_ustr,
120 Any( xControlContext )
122 Any(NamedValue(
123 u"ParentWindow"_ustr,
124 Any( xParentWindow )
127 OTabOrderDialog_DBase::initialize(aNewArguments);
129 else
130 OTabOrderDialog_DBase::initialize(aArguments);
133 } // namespace pcr
135 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
136 extensions_propcrltr_OTabOrderDialog_get_implementation(
137 css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&)
139 return cppu::acquire(new pcr::OTabOrderDialog(context));
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */