Avoid potential negative array index access to cached text.
[LibreOffice.git] / extensions / source / propctrlr / pcrunodialogs.cxx
bloba6c7703a8d15865ae184cd9662ffb8ef3c4398f7
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::lang;
39 using namespace ::com::sun::star::beans;
42 //= OTabOrderDialog
45 OTabOrderDialog::OTabOrderDialog( const Reference< XComponentContext >& _rxContext )
46 :OGenericUnoDialog( _rxContext )
48 registerProperty( PROPERTY_CONTROLCONTEXT, static_cast<sal_Int32>(OwnPropertyId::CONTROLCONTEXT),
49 PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT,
50 &m_xControlContext, cppu::UnoType<decltype(m_xControlContext)>::get() );
52 registerProperty( PROPERTY_TABBINGMODEL, static_cast<sal_Int32>(OwnPropertyId::TABBINGMODEL),
53 PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT,
54 &m_xTabbingModel, cppu::UnoType<decltype(m_xTabbingModel)>::get() );
57 OTabOrderDialog::~OTabOrderDialog()
59 if (m_xDialog)
61 ::osl::MutexGuard aGuard( m_aMutex );
62 if (m_xDialog)
63 destroyDialog();
67 Sequence<sal_Int8> SAL_CALL OTabOrderDialog::getImplementationId( )
69 return css::uno::Sequence<sal_Int8>();
72 OUString SAL_CALL OTabOrderDialog::getImplementationName()
74 return "org.openoffice.comp.form.ui.OTabOrderDialog";
78 css::uno::Sequence<OUString> SAL_CALL OTabOrderDialog::getSupportedServiceNames()
80 return { "com.sun.star.form.ui.TabOrderDialog", "com.sun.star.form.TabOrderDialog" };
84 Reference<XPropertySetInfo> SAL_CALL OTabOrderDialog::getPropertySetInfo()
86 Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) );
87 return xInfo;
90 ::cppu::IPropertyArrayHelper& OTabOrderDialog::getInfoHelper()
92 return *getArrayHelper();
95 ::cppu::IPropertyArrayHelper* OTabOrderDialog::createArrayHelper( ) const
97 Sequence< Property > aProps;
98 describeProperties( aProps );
99 return new ::cppu::OPropertyArrayHelper( aProps );
102 std::unique_ptr<weld::DialogController> OTabOrderDialog::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent)
104 return std::make_unique<TabOrderDialog>(Application::GetFrameWeld(rParent), m_xTabbingModel, m_xControlContext, m_aContext);
107 void OTabOrderDialog::initialize( const Sequence< Any >& aArguments )
109 Reference<css::awt::XTabControllerModel> xTabbingModel;
110 Reference<css::awt::XControlContainer> xControlContext;
111 Reference<css::awt::XWindow> xParentWindow;
112 if (aArguments.getLength() == 3 && (aArguments[0] >>= xTabbingModel) && (aArguments[1] >>= xControlContext) && (aArguments[2] >>= xParentWindow))
114 Sequence< Any > aNewArguments{
115 Any(NamedValue(
116 "TabbingModel",
117 Any( xTabbingModel )
119 Any(NamedValue(
120 "ControlContext",
121 Any( xControlContext )
123 Any(NamedValue(
124 "ParentWindow",
125 Any( xParentWindow )
128 OTabOrderDialog_DBase::initialize(aNewArguments);
130 else
131 OTabOrderDialog_DBase::initialize(aArguments);
134 } // namespace pcr
136 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
137 extensions_propcrltr_OTabOrderDialog_get_implementation(
138 css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&)
140 return cppu::acquire(new pcr::OTabOrderDialog(context));
143 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */