filedlghelper.cxx (a8f97e5f) filedlghelper.cxx (203d9678)
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *

--- 771 unchanged lines hidden (view full) ---

780 if (!aPath.isEmpty())
781 nRet = getGraphic(aPath, rGraphic);
782 else
783 nRet = ERRCODE_IO_GENERAL;
784
785 return nRet;
786}
787
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *

--- 771 unchanged lines hidden (view full) ---

780 if (!aPath.isEmpty())
781 nRet = getGraphic(aPath, rGraphic);
782 else
783 nRet = ERRCODE_IO_GENERAL;
784
785 return nRet;
786}
787
788static bool lcl_isSystemFilePicker( const uno::Reference< XFilePicker3 >& _rxFP )
788static bool lcl_isSystemFilePicker( const uno::Reference< XExecutableDialog >& _rxFP )
789{
790 try
791 {
792 uno::Reference< XServiceInfo > xSI( _rxFP, UNO_QUERY );
793 if ( !xSI.is() )
794 return true;
795 return xSI->supportsService( "com.sun.star.ui.dialogs.SystemFilePicker" );
796 }

--- 330 unchanged lines hidden (view full) ---

1127 catch( const IllegalArgumentException& ){}
1128 }
1129 }
1130
1131 // add the event listener
1132 mxFileDlg->addFilePickerListener( this );
1133}
1134
789{
790 try
791 {
792 uno::Reference< XServiceInfo > xSI( _rxFP, UNO_QUERY );
793 if ( !xSI.is() )
794 return true;
795 return xSI->supportsService( "com.sun.star.ui.dialogs.SystemFilePicker" );
796 }

--- 330 unchanged lines hidden (view full) ---

1127 catch( const IllegalArgumentException& ){}
1128 }
1129 }
1130
1131 // add the event listener
1132 mxFileDlg->addFilePickerListener( this );
1133}
1134
1135css::uno::Reference<css::ui::dialogs::XFolderPicker2> createFolderPicker(const css::uno::Reference<css::uno::XComponentContext>& rContext, weld::Window* /*pPreferredParent*/)
1135css::uno::Reference<css::ui::dialogs::XFolderPicker2> createFolderPicker(const css::uno::Reference<css::uno::XComponentContext>& rContext, weld::Window* pPreferredParent)
1136{
1136{
1137 return css::ui::dialogs::FolderPicker::create(rContext);
1137 auto xRet = css::ui::dialogs::FolderPicker::create(rContext);
1138
1139 // see FileDialogHelper_Impl::FileDialogHelper_Impl (above) for args to FilePicker
1140 // reuse the same arguments for FolderPicker
1141 if (pPreferredParent && lcl_isSystemFilePicker(xRet))
1142 {
1143 uno::Reference< XInitialization > xInit(xRet, UNO_QUERY);
1144 if (xInit.is())
1145 {
1146 Sequence<Any> aInitArguments(2);
1147
1148 aInitArguments[0] <<= sal_Int32(0);
1149 aInitArguments[1] <<= pPreferredParent->GetXWindow();
1150
1151 try
1152 {
1153 xInit->initialize(aInitArguments);
1154 }
1155 catch (const Exception&)
1156 {
1157 OSL_FAIL( "createFolderPicker: could not initialize the picker!" );
1158 }
1159 }
1160 }
1161
1162 return xRet;
1138}
1139
1140FileDialogHelper_Impl::~FileDialogHelper_Impl()
1141{
1142 // Remove user event if we haven't received it yet
1143 if ( mnPostUserEventId )
1144 Application::RemoveUserEvent( mnPostUserEventId );
1145 mnPostUserEventId = nullptr;

--- 1625 unchanged lines hidden ---
1163}
1164
1165FileDialogHelper_Impl::~FileDialogHelper_Impl()
1166{
1167 // Remove user event if we haven't received it yet
1168 if ( mnPostUserEventId )
1169 Application::RemoveUserEvent( mnPostUserEventId );
1170 mnPostUserEventId = nullptr;

--- 1625 unchanged lines hidden ---