2010-10-12 15:53:47 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-07-04 15:25:45 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2005-04-13 07:49:02 +00:00
|
|
|
|
2006-09-16 16:49:45 +00:00
|
|
|
|
2019-10-22 00:28:05 +02:00
|
|
|
#include "OfficeControlAccess.hxx"
|
2005-04-13 07:49:02 +00:00
|
|
|
#include "OfficeFilePicker.hxx"
|
|
|
|
#include "iodlg.hxx"
|
2015-07-13 14:29:09 +02:00
|
|
|
#include "RemoteFilesDialog.hxx"
|
2005-04-13 07:49:02 +00:00
|
|
|
|
2019-05-09 18:30:20 +02:00
|
|
|
#include <vector>
|
2005-04-13 07:49:02 +00:00
|
|
|
#include <algorithm>
|
2018-07-27 17:57:59 +02:00
|
|
|
#include <sal/log.hxx>
|
2005-04-13 07:49:02 +00:00
|
|
|
#include <tools/urlobj.hxx>
|
|
|
|
#include <com/sun/star/uno/Any.hxx>
|
|
|
|
#include <com/sun/star/ui/dialogs/FilePickerEvent.hpp>
|
|
|
|
#include <com/sun/star/ui/dialogs/FilePreviewImageFormats.hpp>
|
|
|
|
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
|
|
|
|
#include <com/sun/star/uno/Sequence.hxx>
|
2008-03-18 16:30:23 +00:00
|
|
|
#include <com/sun/star/beans/NamedValue.hpp>
|
2009-10-06 07:38:24 +02:00
|
|
|
#include <unotools/pathoptions.hxx>
|
2013-09-25 15:41:29 -03:00
|
|
|
#include <cppuhelper/supportsservice.hxx>
|
2016-02-13 00:29:50 +11:00
|
|
|
#include <vcl/svapp.hxx>
|
2005-04-13 07:49:02 +00:00
|
|
|
|
|
|
|
using namespace ::com::sun::star::container;
|
|
|
|
using namespace ::com::sun::star::lang;
|
|
|
|
using namespace ::com::sun::star::ui::dialogs;
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::beans;
|
|
|
|
using namespace ::com::sun::star::awt;
|
|
|
|
using namespace ::utl;
|
|
|
|
|
|
|
|
|
|
|
|
struct FilterEntry
|
|
|
|
{
|
|
|
|
protected:
|
2012-12-08 13:42:54 +02:00
|
|
|
OUString m_sTitle;
|
|
|
|
OUString m_sFilter;
|
2005-04-13 07:49:02 +00:00
|
|
|
|
|
|
|
UnoFilterList m_aSubFilters;
|
|
|
|
|
|
|
|
public:
|
2012-12-08 13:42:54 +02:00
|
|
|
FilterEntry( const OUString& _rTitle, const OUString& _rFilter )
|
2005-04-13 07:49:02 +00:00
|
|
|
:m_sTitle( _rTitle )
|
|
|
|
,m_sFilter( _rFilter )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-12-08 13:42:54 +02:00
|
|
|
FilterEntry( const OUString& _rTitle, const UnoFilterList& _rSubFilters );
|
2005-04-13 07:49:02 +00:00
|
|
|
|
2016-04-14 10:20:52 +02:00
|
|
|
const OUString& getTitle() const { return m_sTitle; }
|
|
|
|
const OUString& getFilter() const { return m_sFilter; }
|
2005-04-13 07:49:02 +00:00
|
|
|
|
|
|
|
/// determines if the filter has sub filter (i.e., the filter is a filter group in real)
|
2014-04-22 12:40:46 +02:00
|
|
|
bool hasSubFilters( ) const;
|
2005-04-13 07:49:02 +00:00
|
|
|
|
|
|
|
/** retrieves the filters belonging to the entry
|
|
|
|
*/
|
2016-01-20 16:36:19 +02:00
|
|
|
void getSubFilters( UnoFilterList& _rSubFilterList );
|
2005-04-13 07:49:02 +00:00
|
|
|
|
|
|
|
// helpers for iterating the sub filters
|
|
|
|
const UnoFilterEntry* beginSubFilters() const { return m_aSubFilters.getConstArray(); }
|
|
|
|
const UnoFilterEntry* endSubFilters() const { return m_aSubFilters.getConstArray() + m_aSubFilters.getLength(); }
|
|
|
|
};
|
|
|
|
|
2014-02-25 18:51:57 +01:00
|
|
|
|
2012-12-08 13:42:54 +02:00
|
|
|
FilterEntry::FilterEntry( const OUString& _rTitle, const UnoFilterList& _rSubFilters )
|
2005-04-13 07:49:02 +00:00
|
|
|
:m_sTitle( _rTitle )
|
|
|
|
,m_aSubFilters( _rSubFilters )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-04-22 12:40:46 +02:00
|
|
|
bool FilterEntry::hasSubFilters( ) const
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
2019-05-04 17:06:38 +03:00
|
|
|
return m_aSubFilters.hasElements();
|
2005-04-13 07:49:02 +00:00
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2016-01-20 16:36:19 +02:00
|
|
|
void FilterEntry::getSubFilters( UnoFilterList& _rSubFilterList )
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
|
|
|
_rSubFilterList = m_aSubFilters;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ElementEntry_Impl
|
|
|
|
{
|
|
|
|
sal_Int16 m_nElementID;
|
|
|
|
sal_Int16 m_nControlAction;
|
|
|
|
Any m_aValue;
|
2012-12-08 13:42:54 +02:00
|
|
|
OUString m_aLabel;
|
2014-04-22 12:40:46 +02:00
|
|
|
bool m_bEnabled : 1;
|
2005-04-13 07:49:02 +00:00
|
|
|
|
2014-04-22 12:40:46 +02:00
|
|
|
bool m_bHasValue : 1;
|
|
|
|
bool m_bHasLabel : 1;
|
|
|
|
bool m_bHasEnabled : 1;
|
2005-04-13 07:49:02 +00:00
|
|
|
|
2016-01-07 09:26:48 +00:00
|
|
|
explicit ElementEntry_Impl( sal_Int16 nId );
|
2005-04-13 07:49:02 +00:00
|
|
|
|
2014-04-22 12:40:46 +02:00
|
|
|
void setValue( const Any& rVal ) { m_aValue = rVal; m_bHasValue = true; }
|
2005-04-13 07:49:02 +00:00
|
|
|
void setAction( sal_Int16 nAction ) { m_nControlAction = nAction; }
|
2014-04-22 12:40:46 +02:00
|
|
|
void setLabel( const OUString& rVal ) { m_aLabel = rVal; m_bHasLabel = true; }
|
|
|
|
void setEnabled( bool bEnabled ) { m_bEnabled = bEnabled; m_bHasEnabled = true; }
|
2005-04-13 07:49:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
ElementEntry_Impl::ElementEntry_Impl( sal_Int16 nId )
|
|
|
|
: m_nElementID( nId )
|
|
|
|
, m_nControlAction( 0 )
|
2014-04-22 12:40:46 +02:00
|
|
|
, m_bEnabled( false )
|
|
|
|
, m_bHasValue( false )
|
|
|
|
, m_bHasLabel( false )
|
|
|
|
, m_bHasEnabled( false )
|
2005-04-13 07:49:02 +00:00
|
|
|
{}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2006-11-22 09:14:13 +00:00
|
|
|
void SvtFilePicker::prepareExecute()
|
|
|
|
{
|
|
|
|
// set the default directory
|
|
|
|
// --**-- doesn't match the spec yet
|
2011-12-25 19:31:22 -02:00
|
|
|
if ( !m_aDisplayDirectory.isEmpty() || !m_aDefaultName.isEmpty() )
|
2006-11-22 09:14:13 +00:00
|
|
|
{
|
2015-11-25 18:49:36 +00:00
|
|
|
bool isFileSet = false;
|
2011-12-25 19:31:22 -02:00
|
|
|
if ( !m_aDisplayDirectory.isEmpty() )
|
2006-11-22 09:14:13 +00:00
|
|
|
{
|
|
|
|
|
2015-11-25 18:49:36 +00:00
|
|
|
INetURLObject aPath;
|
|
|
|
INetURLObject givenPath( m_aDisplayDirectory );
|
|
|
|
if (!givenPath.HasError())
|
|
|
|
aPath = givenPath;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
INetURLObject aStdDirObj( SvtPathOptions().GetWorkPath() );
|
|
|
|
aPath = aStdDirObj;
|
|
|
|
}
|
2011-12-25 19:31:22 -02:00
|
|
|
if ( !m_aDefaultName.isEmpty() )
|
2006-11-22 09:14:13 +00:00
|
|
|
{
|
|
|
|
aPath.insertName( m_aDefaultName );
|
2019-10-21 14:20:12 +01:00
|
|
|
m_xDlg->SetHasFilename( true );
|
2006-11-22 09:14:13 +00:00
|
|
|
}
|
2019-10-21 14:20:12 +01:00
|
|
|
m_xDlg->SetPath( aPath.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
|
2015-11-25 18:49:36 +00:00
|
|
|
isFileSet = true;
|
2006-11-22 09:14:13 +00:00
|
|
|
}
|
2015-11-25 18:49:36 +00:00
|
|
|
if ( !isFileSet && !m_aDefaultName.isEmpty() )
|
2006-11-22 09:14:13 +00:00
|
|
|
{
|
2019-10-21 14:20:12 +01:00
|
|
|
m_xDlg->SetPath( m_aDefaultName );
|
|
|
|
m_xDlg->SetHasFilename( true );
|
2006-11-22 09:14:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-05-19 21:55:00 +02:00
|
|
|
// set the default standard dir
|
2006-11-22 09:14:13 +00:00
|
|
|
INetURLObject aStdDirObj( SvtPathOptions().GetWorkPath() );
|
2019-10-21 14:20:12 +01:00
|
|
|
m_xDlg->SetPath( aStdDirObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
|
2006-11-22 09:14:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// set the control values and set the control labels, too
|
|
|
|
if ( m_pElemList && !m_pElemList->empty() )
|
|
|
|
{
|
2019-10-21 14:20:12 +01:00
|
|
|
::svt::OControlAccess aAccess( m_xDlg.get(), m_xDlg->GetView() );
|
2006-11-22 09:14:13 +00:00
|
|
|
|
2018-03-17 12:35:27 +01:00
|
|
|
for (auto const& elem : *m_pElemList)
|
2006-11-22 09:14:13 +00:00
|
|
|
{
|
2018-03-17 12:35:27 +01:00
|
|
|
if ( elem.m_bHasValue )
|
|
|
|
aAccess.setValue( elem.m_nElementID, elem.m_nControlAction, elem.m_aValue );
|
|
|
|
if ( elem.m_bHasLabel )
|
|
|
|
aAccess.setLabel( elem.m_nElementID, elem.m_aLabel );
|
|
|
|
if ( elem.m_bHasEnabled )
|
|
|
|
aAccess.enableControl( elem.m_nElementID, elem.m_bEnabled );
|
2006-11-22 09:14:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-11-28 15:13:42 +02:00
|
|
|
if ( m_pFilterList )
|
2006-11-22 09:14:13 +00:00
|
|
|
{
|
2018-03-17 12:35:27 +01:00
|
|
|
for (auto & elem : *m_pFilterList)
|
2006-11-22 09:14:13 +00:00
|
|
|
{
|
2018-03-17 12:35:27 +01:00
|
|
|
if ( elem.hasSubFilters() )
|
2006-11-22 09:14:13 +00:00
|
|
|
{ // it's a filter group
|
|
|
|
UnoFilterList aSubFilters;
|
2018-03-17 12:35:27 +01:00
|
|
|
elem.getSubFilters( aSubFilters );
|
2006-11-22 09:14:13 +00:00
|
|
|
|
2019-10-21 14:20:12 +01:00
|
|
|
m_xDlg->AddFilterGroup( elem.getTitle(), aSubFilters );
|
|
|
|
}
|
2006-11-22 09:14:13 +00:00
|
|
|
else
|
2019-10-21 14:20:12 +01:00
|
|
|
{
|
2006-11-22 09:14:13 +00:00
|
|
|
// it's a single filter
|
2019-10-21 14:20:12 +01:00
|
|
|
m_xDlg->AddFilter( elem.getTitle(), elem.getFilter() );
|
|
|
|
}
|
2006-11-22 09:14:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// set the default filter
|
2011-12-25 19:31:22 -02:00
|
|
|
if ( !m_aCurrentFilter.isEmpty() )
|
2019-10-21 14:20:12 +01:00
|
|
|
m_xDlg->SetCurFilter( m_aCurrentFilter );
|
2006-11-22 09:14:13 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-10-31 11:57:38 +00:00
|
|
|
void SvtFilePicker::DialogClosedHdl(sal_Int32 nResult)
|
2006-11-22 09:14:13 +00:00
|
|
|
{
|
|
|
|
if ( m_xDlgClosedListener.is() )
|
|
|
|
{
|
2018-10-31 11:57:38 +00:00
|
|
|
sal_Int16 nRet = static_cast< sal_Int16 >(nResult);
|
2015-10-13 14:19:14 +02:00
|
|
|
css::ui::dialogs::DialogClosedEvent aEvent( *this, nRet );
|
2006-11-22 09:14:13 +00:00
|
|
|
m_xDlgClosedListener->dialogClosed( aEvent );
|
|
|
|
m_xDlgClosedListener.clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-04-13 07:49:02 +00:00
|
|
|
// SvtFilePicker
|
2019-09-25 13:30:20 +02:00
|
|
|
PickerFlags SvtFilePicker::getPickerFlags() const
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
|
|
|
// set the winbits for creating the filedialog
|
2016-05-11 14:07:54 +02:00
|
|
|
PickerFlags nBits = PickerFlags::NONE;
|
2005-04-13 07:49:02 +00:00
|
|
|
|
2012-12-08 13:42:54 +02:00
|
|
|
// set the standard bits according to the service name
|
2005-04-13 07:49:02 +00:00
|
|
|
if ( m_nServiceType == TemplateDescription::FILEOPEN_SIMPLE )
|
|
|
|
{
|
2016-05-11 14:07:54 +02:00
|
|
|
nBits = PickerFlags::Open;
|
2005-04-13 07:49:02 +00:00
|
|
|
}
|
|
|
|
else if ( m_nServiceType == TemplateDescription::FILESAVE_SIMPLE )
|
|
|
|
{
|
2016-05-11 14:07:54 +02:00
|
|
|
nBits = PickerFlags::SaveAs;
|
2005-04-13 07:49:02 +00:00
|
|
|
}
|
|
|
|
else if ( m_nServiceType == TemplateDescription::FILESAVE_AUTOEXTENSION )
|
|
|
|
{
|
2016-05-11 14:07:54 +02:00
|
|
|
nBits = PickerFlags::SaveAs | PickerFlags::AutoExtension;
|
2005-04-13 07:49:02 +00:00
|
|
|
}
|
|
|
|
else if ( m_nServiceType == TemplateDescription::FILESAVE_AUTOEXTENSION_PASSWORD )
|
|
|
|
{
|
2016-05-11 14:07:54 +02:00
|
|
|
nBits = PickerFlags::SaveAs | PickerFlags::Password | PickerFlags::AutoExtension;
|
2005-04-13 07:49:02 +00:00
|
|
|
}
|
|
|
|
else if ( m_nServiceType == TemplateDescription::FILESAVE_AUTOEXTENSION_PASSWORD_FILTEROPTIONS )
|
|
|
|
{
|
2016-05-11 14:07:54 +02:00
|
|
|
nBits = PickerFlags::SaveAs | PickerFlags::Password | PickerFlags::AutoExtension | PickerFlags::FilterOptions;
|
2005-04-13 07:49:02 +00:00
|
|
|
}
|
|
|
|
else if ( m_nServiceType == TemplateDescription::FILESAVE_AUTOEXTENSION_TEMPLATE )
|
|
|
|
{
|
2016-05-11 14:07:54 +02:00
|
|
|
nBits = PickerFlags::SaveAs | PickerFlags::AutoExtension | PickerFlags::Templates;
|
2005-04-13 07:49:02 +00:00
|
|
|
}
|
|
|
|
else if ( m_nServiceType == TemplateDescription::FILESAVE_AUTOEXTENSION_SELECTION )
|
|
|
|
{
|
2016-05-11 14:07:54 +02:00
|
|
|
nBits = PickerFlags::SaveAs | PickerFlags::AutoExtension | PickerFlags::Selection;
|
2005-04-13 07:49:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
else if ( m_nServiceType == TemplateDescription::FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE )
|
|
|
|
{
|
2016-05-11 14:07:54 +02:00
|
|
|
nBits = PickerFlags::Open | PickerFlags::InsertAsLink | PickerFlags::ShowPreview | PickerFlags::ImageTemplate;
|
2005-04-13 07:49:02 +00:00
|
|
|
}
|
|
|
|
else if ( m_nServiceType == TemplateDescription::FILEOPEN_PLAY )
|
|
|
|
{
|
2016-05-11 14:07:54 +02:00
|
|
|
nBits = PickerFlags::Open | PickerFlags::PlayButton;
|
2005-04-13 07:49:02 +00:00
|
|
|
}
|
2016-07-01 11:49:02 +02:00
|
|
|
else if ( m_nServiceType == TemplateDescription::FILEOPEN_LINK_PLAY )
|
|
|
|
{
|
|
|
|
nBits = PickerFlags::Open | PickerFlags::InsertAsLink | PickerFlags::PlayButton;
|
|
|
|
}
|
2005-04-13 07:49:02 +00:00
|
|
|
else if ( m_nServiceType == TemplateDescription::FILEOPEN_READONLY_VERSION )
|
|
|
|
{
|
2016-05-11 14:07:54 +02:00
|
|
|
nBits = PickerFlags::Open | PickerFlags::ReadOnly | PickerFlags::ShowVersions;
|
2005-04-13 07:49:02 +00:00
|
|
|
}
|
|
|
|
else if ( m_nServiceType == TemplateDescription::FILEOPEN_LINK_PREVIEW )
|
|
|
|
{
|
2016-05-11 14:07:54 +02:00
|
|
|
nBits = PickerFlags::Open | PickerFlags::InsertAsLink | PickerFlags::ShowPreview;
|
2005-04-13 07:49:02 +00:00
|
|
|
}
|
2018-02-06 17:48:51 +01:00
|
|
|
else if ( m_nServiceType == TemplateDescription::FILEOPEN_LINK_PREVIEW_IMAGE_ANCHOR )
|
|
|
|
{
|
|
|
|
nBits = PickerFlags::Open | PickerFlags::InsertAsLink | PickerFlags::ShowPreview | PickerFlags::ImageAnchor;
|
|
|
|
}
|
2016-06-30 11:19:43 +02:00
|
|
|
else if ( m_nServiceType == TemplateDescription::FILEOPEN_PREVIEW )
|
|
|
|
{
|
|
|
|
nBits = PickerFlags::Open | PickerFlags::ShowPreview;
|
|
|
|
}
|
2016-05-11 14:07:54 +02:00
|
|
|
if ( m_bMultiSelection && ( nBits & PickerFlags::Open ) )
|
|
|
|
nBits |= PickerFlags::MultiSelection;
|
2005-04-13 07:49:02 +00:00
|
|
|
|
|
|
|
return nBits;
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2005-04-13 07:49:02 +00:00
|
|
|
void SvtFilePicker::notify( sal_Int16 _nEventId, sal_Int16 _nControlId )
|
|
|
|
{
|
|
|
|
if ( !m_xListener.is() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
FilePickerEvent aEvent( *this, _nControlId );
|
|
|
|
|
|
|
|
switch ( _nEventId )
|
|
|
|
{
|
|
|
|
case FILE_SELECTION_CHANGED:
|
|
|
|
m_xListener->fileSelectionChanged( aEvent );
|
|
|
|
break;
|
|
|
|
case DIRECTORY_CHANGED:
|
|
|
|
m_xListener->directoryChanged( aEvent );
|
|
|
|
break;
|
|
|
|
case CTRL_STATE_CHANGED:
|
|
|
|
m_xListener->controlStateChanged( aEvent );
|
|
|
|
break;
|
|
|
|
case DIALOG_SIZE_CHANGED:
|
|
|
|
m_xListener->dialogSizeChanged();
|
|
|
|
break;
|
|
|
|
default:
|
2012-01-16 23:15:55 +01:00
|
|
|
SAL_WARN( "fpicker.office", "SvtFilePicker::notify(): Unknown event id!" );
|
2005-04-13 07:49:02 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2005-04-13 07:49:02 +00:00
|
|
|
namespace {
|
2014-02-25 18:51:57 +01:00
|
|
|
|
2017-06-28 21:48:22 +02:00
|
|
|
struct FilterTitleMatch
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
|
|
|
protected:
|
2012-12-08 13:42:54 +02:00
|
|
|
const OUString& rTitle;
|
2005-04-13 07:49:02 +00:00
|
|
|
|
|
|
|
public:
|
2016-01-07 09:26:48 +00:00
|
|
|
explicit FilterTitleMatch( const OUString& _rTitle ) : rTitle( _rTitle ) { }
|
2005-04-13 07:49:02 +00:00
|
|
|
|
2014-02-25 18:51:57 +01:00
|
|
|
|
2005-04-13 07:49:02 +00:00
|
|
|
bool operator () ( const FilterEntry& _rEntry )
|
|
|
|
{
|
2014-04-22 12:40:46 +02:00
|
|
|
bool bMatch;
|
2005-04-13 07:49:02 +00:00
|
|
|
if ( !_rEntry.hasSubFilters() )
|
|
|
|
// a real filter
|
|
|
|
bMatch = ( _rEntry.getTitle() == rTitle );
|
|
|
|
else
|
|
|
|
// a filter group -> search the sub filters
|
|
|
|
bMatch =
|
2015-05-18 14:27:44 +09:00
|
|
|
::std::any_of(
|
2005-04-13 07:49:02 +00:00
|
|
|
_rEntry.beginSubFilters(),
|
|
|
|
_rEntry.endSubFilters(),
|
|
|
|
*this
|
|
|
|
);
|
|
|
|
|
2014-05-02 15:42:25 +02:00
|
|
|
return bMatch;
|
2005-04-13 07:49:02 +00:00
|
|
|
}
|
|
|
|
bool operator () ( const UnoFilterEntry& _rEntry )
|
|
|
|
{
|
2014-05-02 15:42:25 +02:00
|
|
|
return _rEntry.First == rTitle;
|
2005-04-13 07:49:02 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-04-22 12:40:46 +02:00
|
|
|
bool SvtFilePicker::FilterNameExists( const OUString& rTitle )
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
2014-04-22 12:40:46 +02:00
|
|
|
bool bRet = false;
|
2005-04-13 07:49:02 +00:00
|
|
|
|
|
|
|
if ( m_pFilterList )
|
|
|
|
bRet =
|
2015-05-18 14:27:44 +09:00
|
|
|
::std::any_of(
|
2005-04-13 07:49:02 +00:00
|
|
|
m_pFilterList->begin(),
|
|
|
|
m_pFilterList->end(),
|
|
|
|
FilterTitleMatch( rTitle )
|
|
|
|
);
|
|
|
|
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-04-22 12:40:46 +02:00
|
|
|
bool SvtFilePicker::FilterNameExists( const UnoFilterList& _rGroupedFilters )
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
2014-04-22 12:40:46 +02:00
|
|
|
bool bRet = false;
|
2005-04-13 07:49:02 +00:00
|
|
|
|
|
|
|
if ( m_pFilterList )
|
|
|
|
{
|
|
|
|
const UnoFilterEntry* pStart = _rGroupedFilters.getConstArray();
|
|
|
|
const UnoFilterEntry* pEnd = pStart + _rGroupedFilters.getLength();
|
|
|
|
for ( ; pStart != pEnd; ++pStart )
|
2015-05-18 14:27:44 +09:00
|
|
|
if ( ::std::any_of( m_pFilterList->begin(), m_pFilterList->end(), FilterTitleMatch( pStart->First ) ) )
|
2005-04-13 07:49:02 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
bRet = pStart != pEnd;
|
|
|
|
}
|
|
|
|
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2012-12-08 13:42:54 +02:00
|
|
|
void SvtFilePicker::ensureFilterList( const OUString& _rInitialCurrentFilter )
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
|
|
|
if ( !m_pFilterList )
|
|
|
|
{
|
2018-02-07 12:36:25 +02:00
|
|
|
m_pFilterList.reset( new FilterList );
|
2005-04-13 07:49:02 +00:00
|
|
|
|
|
|
|
// set the first filter to the current filter
|
2011-12-25 19:31:22 -02:00
|
|
|
if ( m_aCurrentFilter.isEmpty() )
|
2005-04-13 07:49:02 +00:00
|
|
|
m_aCurrentFilter = _rInitialCurrentFilter;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2005-04-13 07:49:02 +00:00
|
|
|
// class SvtFilePicker
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2015-12-22 15:38:00 +02:00
|
|
|
SvtFilePicker::SvtFilePicker()
|
2018-02-07 12:36:25 +02:00
|
|
|
:m_bMultiSelection ( false )
|
2005-04-13 07:49:02 +00:00
|
|
|
,m_nServiceType ( TemplateDescription::FILEOPEN_SIMPLE )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SvtFilePicker::~SvtFilePicker()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Int16 SvtFilePicker::implExecutePicker( )
|
|
|
|
{
|
2019-10-21 14:20:12 +01:00
|
|
|
m_xDlg->SetFileCallback( this );
|
2005-04-13 07:49:02 +00:00
|
|
|
|
2006-11-22 09:14:13 +00:00
|
|
|
prepareExecute();
|
2005-04-13 07:49:02 +00:00
|
|
|
|
2019-10-21 14:20:12 +01:00
|
|
|
m_xDlg->EnableAutocompletion();
|
2005-04-13 07:49:02 +00:00
|
|
|
// now we are ready to execute the dialog
|
2019-10-21 14:20:12 +01:00
|
|
|
sal_Int16 nRet = m_xDlg->run();
|
2005-04-13 07:49:02 +00:00
|
|
|
|
2006-03-24 11:49:09 +00:00
|
|
|
// the execution of the dialog yields, so it is possible the at this point the window or the dialog is closed
|
2019-10-21 14:20:12 +01:00
|
|
|
if (m_xDlg)
|
|
|
|
m_xDlg->SetFileCallback( nullptr );
|
2005-04-13 07:49:02 +00:00
|
|
|
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
|
2019-10-21 14:20:12 +01:00
|
|
|
std::unique_ptr<SvtFileDialog_Base> SvtFilePicker::implCreateDialog( weld::Window* pParent )
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
2016-05-11 14:07:54 +02:00
|
|
|
PickerFlags nBits = getPickerFlags();
|
2005-04-13 07:49:02 +00:00
|
|
|
|
2019-10-21 14:20:12 +01:00
|
|
|
auto dialog = std::make_unique<SvtFileDialog>(pParent, nBits);
|
2008-03-18 16:30:23 +00:00
|
|
|
|
|
|
|
// Set StandardDir if present
|
2011-12-25 19:31:22 -02:00
|
|
|
if ( !m_aStandardDir.isEmpty())
|
2008-03-18 16:30:23 +00:00
|
|
|
{
|
2013-09-20 16:47:36 +02:00
|
|
|
OUString sStandardDir = m_aStandardDir;
|
2008-03-18 16:30:23 +00:00
|
|
|
dialog->SetStandardDir( sStandardDir );
|
2009-03-03 10:51:13 +00:00
|
|
|
dialog->SetBlackList( m_aBlackList );
|
2008-03-18 16:30:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return dialog;
|
2005-04-13 07:49:02 +00:00
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2005-04-13 07:49:02 +00:00
|
|
|
// disambiguate XInterface
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2005-04-13 07:49:02 +00:00
|
|
|
IMPLEMENT_FORWARD_XINTERFACE2( SvtFilePicker, OCommonPicker, SvtFilePicker_Base )
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2005-04-13 07:49:02 +00:00
|
|
|
// disambiguate XTypeProvider
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2005-04-13 07:49:02 +00:00
|
|
|
IMPLEMENT_FORWARD_XTYPEPROVIDER2( SvtFilePicker, OCommonPicker, SvtFilePicker_Base )
|
|
|
|
|
2015-06-30 15:31:30 +02:00
|
|
|
IMPLEMENT_FORWARD_XINTERFACE3( SvtRemoteFilePicker, SvtFilePicker, OCommonPicker, SvtFilePicker_Base )
|
|
|
|
|
|
|
|
|
|
|
|
// disambiguate XTypeProvider
|
|
|
|
|
|
|
|
IMPLEMENT_FORWARD_XTYPEPROVIDER3( SvtRemoteFilePicker, SvtFilePicker, OCommonPicker, SvtFilePicker_Base )
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2005-04-13 07:49:02 +00:00
|
|
|
// XExecutableDialog functions
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
void SAL_CALL SvtFilePicker::setTitle( const OUString& _rTitle )
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
|
|
|
OCommonPicker::setTitle( _rTitle );
|
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Int16 SAL_CALL SvtFilePicker::execute( )
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
|
|
|
return OCommonPicker::execute();
|
|
|
|
}
|
|
|
|
|
2006-11-22 09:14:13 +00:00
|
|
|
// XAsynchronousExecutableDialog functions
|
2017-01-26 12:28:58 +01:00
|
|
|
void SAL_CALL SvtFilePicker::setDialogTitle( const OUString& _rTitle )
|
2006-11-22 09:14:13 +00:00
|
|
|
{
|
|
|
|
setTitle( _rTitle );
|
|
|
|
}
|
|
|
|
|
2015-10-13 14:19:14 +02:00
|
|
|
void SAL_CALL SvtFilePicker::startExecuteModal( const Reference< css::ui::dialogs::XDialogClosedListener >& xListener )
|
2006-11-22 09:14:13 +00:00
|
|
|
{
|
|
|
|
m_xDlgClosedListener = xListener;
|
|
|
|
prepareDialog();
|
|
|
|
prepareExecute();
|
2019-10-21 14:20:12 +01:00
|
|
|
m_xDlg->EnableAutocompletion();
|
|
|
|
if (!m_xDlg->PrepareExecute())
|
|
|
|
return;
|
|
|
|
weld::DialogController::runAsync(m_xDlg, [this](sal_Int32 nResult){
|
2018-10-31 11:57:38 +00:00
|
|
|
DialogClosedHdl(nResult);
|
|
|
|
});
|
2006-11-22 09:14:13 +00:00
|
|
|
}
|
|
|
|
|
2005-04-13 07:49:02 +00:00
|
|
|
// XFilePicker functions
|
2017-01-26 12:28:58 +01:00
|
|
|
void SAL_CALL SvtFilePicker::setMultiSelectionMode( sal_Bool bMode )
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
|
|
|
checkAlive();
|
|
|
|
|
2010-10-13 02:47:36 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2005-04-13 07:49:02 +00:00
|
|
|
m_bMultiSelection = bMode;
|
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
void SAL_CALL SvtFilePicker::setDefaultName( const OUString& aName )
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
|
|
|
checkAlive();
|
|
|
|
|
2010-10-13 02:47:36 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2005-04-13 07:49:02 +00:00
|
|
|
m_aDefaultName = aName;
|
|
|
|
}
|
|
|
|
|
2012-12-08 13:42:54 +02:00
|
|
|
void SAL_CALL SvtFilePicker::setDisplayDirectory( const OUString& aDirectory )
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
|
|
|
checkAlive();
|
|
|
|
|
2010-10-13 02:47:36 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2005-04-13 07:49:02 +00:00
|
|
|
m_aDisplayDirectory = aDirectory;
|
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
OUString SAL_CALL SvtFilePicker::getDisplayDirectory()
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
|
|
|
checkAlive();
|
|
|
|
|
2010-10-13 02:47:36 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2019-10-21 14:20:12 +01:00
|
|
|
if (m_xDlg)
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
2019-10-21 14:20:12 +01:00
|
|
|
OUString aPath = m_xDlg->GetPath();
|
2005-04-13 07:49:02 +00:00
|
|
|
|
|
|
|
if( m_aOldHideDirectory == aPath )
|
|
|
|
return m_aOldDisplayDirectory;
|
|
|
|
m_aOldHideDirectory = aPath;
|
|
|
|
|
2019-10-21 14:20:12 +01:00
|
|
|
if( !m_xDlg->ContentIsFolder( aPath ) )
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
|
|
|
INetURLObject aFolder( aPath );
|
|
|
|
aFolder.CutLastName();
|
2016-12-05 08:47:18 +02:00
|
|
|
aPath = aFolder.GetMainURL( INetURLObject::DecodeMechanism::NONE );
|
2005-04-13 07:49:02 +00:00
|
|
|
}
|
|
|
|
m_aOldDisplayDirectory = aPath;
|
|
|
|
return aPath;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return m_aDisplayDirectory;
|
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
Sequence< OUString > SAL_CALL SvtFilePicker::getSelectedFiles()
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
|
|
|
checkAlive();
|
|
|
|
|
2010-10-13 02:47:36 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2019-10-21 14:20:12 +01:00
|
|
|
if (!m_xDlg)
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
2012-12-08 13:42:54 +02:00
|
|
|
Sequence< OUString > aEmpty;
|
2005-04-13 07:49:02 +00:00
|
|
|
return aEmpty;
|
|
|
|
}
|
|
|
|
|
2019-10-21 14:20:12 +01:00
|
|
|
return comphelper::containerToSequence(m_xDlg->GetPathList());
|
2015-07-15 13:24:07 +02:00
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
Sequence< OUString > SAL_CALL SvtFilePicker::getFiles()
|
2015-07-15 13:24:07 +02:00
|
|
|
{
|
|
|
|
Sequence< OUString > aFiles = getSelectedFiles();
|
|
|
|
if (aFiles.getLength() > 1)
|
|
|
|
aFiles.realloc(1);
|
|
|
|
return aFiles;
|
2005-04-13 07:49:02 +00:00
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2005-04-13 07:49:02 +00:00
|
|
|
// XFilePickerControlAccess functions
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2005-04-13 07:49:02 +00:00
|
|
|
|
|
|
|
void SAL_CALL SvtFilePicker::setValue( sal_Int16 nElementID,
|
|
|
|
sal_Int16 nControlAction,
|
|
|
|
const Any& rValue )
|
|
|
|
{
|
|
|
|
checkAlive();
|
|
|
|
|
2010-10-13 02:47:36 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2019-10-21 14:20:12 +01:00
|
|
|
if (m_xDlg)
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
2019-10-21 14:20:12 +01:00
|
|
|
::svt::OControlAccess aAccess( m_xDlg.get(), m_xDlg->GetView() );
|
2005-04-13 07:49:02 +00:00
|
|
|
aAccess.setValue( nElementID, nControlAction, rValue );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( !m_pElemList )
|
2018-02-07 12:36:25 +02:00
|
|
|
m_pElemList.reset( new ElementList );
|
2005-04-13 07:49:02 +00:00
|
|
|
|
2014-04-22 12:40:46 +02:00
|
|
|
bool bFound = false;
|
2005-04-13 07:49:02 +00:00
|
|
|
|
2018-03-17 12:35:27 +01:00
|
|
|
for (auto & elem : *m_pElemList)
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
2018-03-17 12:35:27 +01:00
|
|
|
if ( ( elem.m_nElementID == nElementID ) &&
|
|
|
|
( !elem.m_bHasValue || ( elem.m_nControlAction == nControlAction ) ) )
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
2018-03-17 12:35:27 +01:00
|
|
|
elem.setAction( nControlAction );
|
|
|
|
elem.setValue( rValue );
|
2014-04-22 12:40:46 +02:00
|
|
|
bFound = true;
|
2005-04-13 07:49:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !bFound )
|
|
|
|
{
|
|
|
|
ElementEntry_Impl aNew( nElementID );
|
|
|
|
aNew.setAction( nControlAction );
|
|
|
|
aNew.setValue( rValue );
|
|
|
|
m_pElemList->insert( m_pElemList->end(), aNew );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2005-04-13 07:49:02 +00:00
|
|
|
Any SAL_CALL SvtFilePicker::getValue( sal_Int16 nElementID, sal_Int16 nControlAction )
|
|
|
|
{
|
|
|
|
checkAlive();
|
|
|
|
|
2010-10-13 02:47:36 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2005-04-13 07:49:02 +00:00
|
|
|
Any aAny;
|
|
|
|
|
|
|
|
// execute() called?
|
2019-10-21 14:20:12 +01:00
|
|
|
if (m_xDlg)
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
2019-10-21 14:20:12 +01:00
|
|
|
::svt::OControlAccess aAccess( m_xDlg.get(), m_xDlg->GetView() );
|
2005-04-13 07:49:02 +00:00
|
|
|
aAny = aAccess.getValue( nElementID, nControlAction );
|
|
|
|
}
|
2018-11-28 15:13:42 +02:00
|
|
|
else if ( m_pElemList )
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
2018-03-17 12:35:27 +01:00
|
|
|
for (auto const& elem : *m_pElemList)
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
2018-03-17 12:35:27 +01:00
|
|
|
if ( ( elem.m_nElementID == nElementID ) &&
|
|
|
|
( elem.m_bHasValue ) &&
|
|
|
|
( elem.m_nControlAction == nControlAction ) )
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
2018-03-17 12:35:27 +01:00
|
|
|
aAny = elem.m_aValue;
|
2005-04-13 07:49:02 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return aAny;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-12-08 13:42:54 +02:00
|
|
|
void SAL_CALL SvtFilePicker::setLabel( sal_Int16 nLabelID, const OUString& rValue )
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
|
|
|
checkAlive();
|
|
|
|
|
2010-10-13 02:47:36 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2019-10-21 14:20:12 +01:00
|
|
|
if (m_xDlg)
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
2019-10-21 14:20:12 +01:00
|
|
|
::svt::OControlAccess aAccess( m_xDlg.get(), m_xDlg->GetView() );
|
2005-04-13 07:49:02 +00:00
|
|
|
aAccess.setLabel( nLabelID, rValue );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( !m_pElemList )
|
2018-02-07 12:36:25 +02:00
|
|
|
m_pElemList.reset( new ElementList );
|
2005-04-13 07:49:02 +00:00
|
|
|
|
2014-04-22 12:40:46 +02:00
|
|
|
bool bFound = false;
|
2005-04-13 07:49:02 +00:00
|
|
|
|
2018-03-17 12:35:27 +01:00
|
|
|
for (auto & elem : *m_pElemList)
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
2018-03-17 12:35:27 +01:00
|
|
|
if ( elem.m_nElementID == nLabelID )
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
2018-03-17 12:35:27 +01:00
|
|
|
elem.setLabel( rValue );
|
2014-04-22 12:40:46 +02:00
|
|
|
bFound = true;
|
2005-04-13 07:49:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !bFound )
|
|
|
|
{
|
|
|
|
ElementEntry_Impl aNew( nLabelID );
|
|
|
|
aNew.setLabel( rValue );
|
|
|
|
m_pElemList->insert( m_pElemList->end(), aNew );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2012-12-08 13:42:54 +02:00
|
|
|
OUString SAL_CALL SvtFilePicker::getLabel( sal_Int16 nLabelID )
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
|
|
|
checkAlive();
|
|
|
|
|
2010-10-13 02:47:36 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2012-12-08 13:42:54 +02:00
|
|
|
OUString aLabel;
|
2005-04-13 07:49:02 +00:00
|
|
|
|
2019-10-21 14:20:12 +01:00
|
|
|
if (m_xDlg)
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
2019-10-21 14:20:12 +01:00
|
|
|
::svt::OControlAccess aAccess(m_xDlg.get(), m_xDlg->GetView());
|
2005-04-13 07:49:02 +00:00
|
|
|
aLabel = aAccess.getLabel( nLabelID );
|
|
|
|
}
|
2018-11-28 15:13:42 +02:00
|
|
|
else if ( m_pElemList )
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
2018-03-17 12:35:27 +01:00
|
|
|
for (auto const& elem : *m_pElemList)
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
2018-03-17 12:35:27 +01:00
|
|
|
if ( elem.m_nElementID == nLabelID )
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
2018-03-17 12:35:27 +01:00
|
|
|
if ( elem.m_bHasLabel )
|
|
|
|
aLabel = elem.m_aLabel;
|
2005-04-13 07:49:02 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return aLabel;
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2005-04-13 07:49:02 +00:00
|
|
|
void SAL_CALL SvtFilePicker::enableControl( sal_Int16 nElementID, sal_Bool bEnable )
|
|
|
|
{
|
|
|
|
checkAlive();
|
|
|
|
|
2010-10-13 02:47:36 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2019-10-21 14:20:12 +01:00
|
|
|
if (m_xDlg)
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
2019-10-21 14:20:12 +01:00
|
|
|
::svt::OControlAccess aAccess(m_xDlg.get(), m_xDlg->GetView());
|
2005-04-13 07:49:02 +00:00
|
|
|
aAccess.enableControl( nElementID, bEnable );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( !m_pElemList )
|
2018-02-07 12:36:25 +02:00
|
|
|
m_pElemList.reset( new ElementList );
|
2005-04-13 07:49:02 +00:00
|
|
|
|
2014-04-22 12:40:46 +02:00
|
|
|
bool bFound = false;
|
2005-04-13 07:49:02 +00:00
|
|
|
|
2018-03-17 12:35:27 +01:00
|
|
|
for (auto & elem : *m_pElemList)
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
2018-03-17 12:35:27 +01:00
|
|
|
if ( elem.m_nElementID == nElementID )
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
2018-03-17 12:35:27 +01:00
|
|
|
elem.setEnabled( bEnable );
|
2014-04-22 12:40:46 +02:00
|
|
|
bFound = true;
|
2005-04-13 07:49:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !bFound )
|
|
|
|
{
|
|
|
|
ElementEntry_Impl aNew( nElementID );
|
|
|
|
aNew.setEnabled( bEnable );
|
|
|
|
m_pElemList->insert( m_pElemList->end(), aNew );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2005-04-13 07:49:02 +00:00
|
|
|
// XFilePickerNotifier functions
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2005-04-13 07:49:02 +00:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
void SAL_CALL SvtFilePicker::addFilePickerListener( const Reference< XFilePickerListener >& xListener )
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
|
|
|
checkAlive();
|
|
|
|
|
2010-10-13 02:47:36 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2005-04-13 07:49:02 +00:00
|
|
|
m_xListener = xListener;
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
void SAL_CALL SvtFilePicker::removeFilePickerListener( const Reference< XFilePickerListener >& )
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
|
|
|
checkAlive();
|
|
|
|
|
2010-10-13 02:47:36 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2005-04-13 07:49:02 +00:00
|
|
|
m_xListener.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
// XFilePreview functions
|
|
|
|
Sequence< sal_Int16 > SAL_CALL SvtFilePicker::getSupportedImageFormats()
|
|
|
|
{
|
|
|
|
checkAlive();
|
|
|
|
|
2010-10-13 02:47:36 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2005-04-13 07:49:02 +00:00
|
|
|
Sequence< sal_Int16 > aFormats( 1 );
|
|
|
|
|
|
|
|
aFormats[0] = FilePreviewImageFormats::BITMAP;
|
|
|
|
|
|
|
|
return aFormats;
|
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Int32 SAL_CALL SvtFilePicker::getTargetColorDepth()
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
2019-10-21 14:20:12 +01:00
|
|
|
return 0;
|
2005-04-13 07:49:02 +00:00
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Int32 SAL_CALL SvtFilePicker::getAvailableWidth()
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
|
|
|
checkAlive();
|
|
|
|
|
2010-10-13 02:47:36 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2005-04-13 07:49:02 +00:00
|
|
|
sal_Int32 nWidth = 0;
|
|
|
|
|
2019-10-21 14:20:12 +01:00
|
|
|
if (m_xDlg)
|
|
|
|
nWidth = m_xDlg->getAvailableWidth();
|
2005-04-13 07:49:02 +00:00
|
|
|
|
|
|
|
return nWidth;
|
|
|
|
}
|
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Int32 SAL_CALL SvtFilePicker::getAvailableHeight()
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
|
|
|
checkAlive();
|
|
|
|
|
2010-10-13 02:47:36 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2013-11-23 23:21:52 +01:00
|
|
|
sal_Int32 nHeight = 0;
|
2005-04-13 07:49:02 +00:00
|
|
|
|
2019-10-21 14:20:12 +01:00
|
|
|
if (m_xDlg)
|
|
|
|
nHeight = m_xDlg->getAvailableHeight();
|
2005-04-13 07:49:02 +00:00
|
|
|
|
2013-11-23 23:21:52 +01:00
|
|
|
return nHeight;
|
2005-04-13 07:49:02 +00:00
|
|
|
}
|
|
|
|
|
2019-10-21 14:20:12 +01:00
|
|
|
void SAL_CALL SvtFilePicker::setImage(sal_Int16 /*aImageFormat*/, const Any& rImage)
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
|
|
|
checkAlive();
|
|
|
|
|
2010-10-13 02:47:36 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2019-10-21 14:20:12 +01:00
|
|
|
if (m_xDlg)
|
|
|
|
m_xDlg->setImage(rImage);
|
2005-04-13 07:49:02 +00:00
|
|
|
}
|
|
|
|
|
2015-03-24 10:49:28 +02:00
|
|
|
sal_Bool SAL_CALL SvtFilePicker::setShowState( sal_Bool )
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
|
|
|
checkAlive();
|
|
|
|
|
2010-10-13 02:47:36 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2014-04-22 12:40:46 +02:00
|
|
|
bool bRet = false;
|
2005-04-13 07:49:02 +00:00
|
|
|
|
2019-10-21 14:20:12 +01:00
|
|
|
if (m_xDlg)
|
2015-03-24 10:49:28 +02:00
|
|
|
{
|
|
|
|
// #97633 for the system filedialog it's
|
|
|
|
// useful to make the preview switchable
|
|
|
|
// because the preview occupies
|
|
|
|
// half of the size of the file listbox
|
|
|
|
// which is not the case here,
|
|
|
|
// so we (TRA/FS) decided not to make
|
|
|
|
// the preview window switchable because
|
|
|
|
// else we would have to change the layout
|
|
|
|
// of the file dialog dynamically
|
2017-03-24 11:38:26 +01:00
|
|
|
// support for set/getShowState is optionally
|
2015-10-13 14:19:14 +02:00
|
|
|
// see css::ui::dialogs::XFilePreview
|
2015-03-24 10:49:28 +02:00
|
|
|
|
|
|
|
bRet = false;
|
|
|
|
}
|
2005-04-13 07:49:02 +00:00
|
|
|
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Bool SAL_CALL SvtFilePicker::getShowState()
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
|
|
|
checkAlive();
|
|
|
|
|
2010-10-13 02:47:36 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2014-04-22 12:40:46 +02:00
|
|
|
bool bRet = false;
|
2005-04-13 07:49:02 +00:00
|
|
|
|
2019-10-21 14:20:12 +01:00
|
|
|
if (m_xDlg)
|
|
|
|
bRet = m_xDlg->getShowState();
|
2005-04-13 07:49:02 +00:00
|
|
|
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2005-04-13 07:49:02 +00:00
|
|
|
// XFilterGroupManager functions
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2005-04-13 07:49:02 +00:00
|
|
|
|
2012-12-08 13:42:54 +02:00
|
|
|
void SAL_CALL SvtFilePicker::appendFilterGroup( const OUString& sGroupTitle,
|
2005-04-13 07:49:02 +00:00
|
|
|
const Sequence< StringPair >& aFilters )
|
|
|
|
{
|
|
|
|
checkAlive();
|
|
|
|
|
2010-10-13 02:47:36 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2005-04-13 07:49:02 +00:00
|
|
|
|
|
|
|
// check the names
|
|
|
|
if ( FilterNameExists( aFilters ) )
|
2009-05-22 16:22:30 +02:00
|
|
|
throw IllegalArgumentException(
|
2014-05-28 12:50:02 +02:00
|
|
|
"filter name exists",
|
2009-05-22 16:22:30 +02:00
|
|
|
static_cast< OWeakObject * >(this), 1);
|
2005-04-13 07:49:02 +00:00
|
|
|
|
|
|
|
// ensure that we have a filter list
|
2012-12-08 13:42:54 +02:00
|
|
|
OUString sInitialCurrentFilter;
|
2019-05-04 17:06:38 +03:00
|
|
|
if ( aFilters.hasElements() )
|
2005-04-13 07:49:02 +00:00
|
|
|
sInitialCurrentFilter = aFilters[0].First;
|
|
|
|
ensureFilterList( sInitialCurrentFilter );
|
|
|
|
|
|
|
|
// append the filter
|
|
|
|
m_pFilterList->insert( m_pFilterList->end(), FilterEntry( sGroupTitle, aFilters ) );
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2005-04-13 07:49:02 +00:00
|
|
|
// XFilterManager functions
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2005-04-13 07:49:02 +00:00
|
|
|
|
2012-12-08 13:42:54 +02:00
|
|
|
void SAL_CALL SvtFilePicker::appendFilter( const OUString& aTitle,
|
|
|
|
const OUString& aFilter )
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
|
|
|
checkAlive();
|
|
|
|
|
2010-10-13 02:47:36 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2005-04-13 07:49:02 +00:00
|
|
|
// check the name
|
|
|
|
if ( FilterNameExists( aTitle ) )
|
|
|
|
// TODO: a more precise exception message
|
|
|
|
throw IllegalArgumentException();
|
|
|
|
|
|
|
|
// ensure that we have a filter list
|
|
|
|
ensureFilterList( aTitle );
|
|
|
|
|
|
|
|
// append the filter
|
|
|
|
m_pFilterList->insert( m_pFilterList->end(), FilterEntry( aTitle, aFilter ) );
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2012-12-08 13:42:54 +02:00
|
|
|
void SAL_CALL SvtFilePicker::setCurrentFilter( const OUString& aTitle )
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
|
|
|
checkAlive();
|
|
|
|
|
2010-10-13 02:47:36 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2005-04-13 07:49:02 +00:00
|
|
|
if ( ! FilterNameExists( aTitle ) )
|
|
|
|
throw IllegalArgumentException();
|
|
|
|
|
|
|
|
m_aCurrentFilter = aTitle;
|
|
|
|
|
2019-10-21 14:20:12 +01:00
|
|
|
if (m_xDlg)
|
|
|
|
m_xDlg->SetCurFilter( aTitle );
|
2005-04-13 07:49:02 +00:00
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2012-12-08 13:42:54 +02:00
|
|
|
OUString SAL_CALL SvtFilePicker::getCurrentFilter()
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
|
|
|
checkAlive();
|
|
|
|
|
2010-10-13 02:47:36 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2019-10-21 14:20:12 +01:00
|
|
|
OUString aFilter = m_xDlg ? m_xDlg->GetCurFilter() :
|
2017-05-10 12:37:04 +02:00
|
|
|
m_aCurrentFilter;
|
2005-04-13 07:49:02 +00:00
|
|
|
return aFilter;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// XInitialization functions
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2005-04-13 07:49:02 +00:00
|
|
|
|
|
|
|
void SAL_CALL SvtFilePicker::initialize( const Sequence< Any >& _rArguments )
|
|
|
|
{
|
|
|
|
checkAlive();
|
|
|
|
|
2009-02-11 14:19:26 +00:00
|
|
|
Sequence< Any > aArguments( _rArguments.getLength());
|
|
|
|
|
2005-04-13 07:49:02 +00:00
|
|
|
m_nServiceType = TemplateDescription::FILEOPEN_SIMPLE;
|
|
|
|
|
2019-05-04 17:06:38 +03:00
|
|
|
if ( _rArguments.hasElements() )
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
|
|
|
// compatibility: one argument, type sal_Int16 , specifies the service type
|
2009-02-11 14:19:26 +00:00
|
|
|
int index = 0;
|
2008-03-18 16:30:23 +00:00
|
|
|
|
2009-02-11 14:19:26 +00:00
|
|
|
if (_rArguments[0] >>= m_nServiceType)
|
|
|
|
{
|
|
|
|
// skip the first entry if it was the ServiceType, because it's not needed in OCommonPicker::initialize and it's not a NamedValue
|
|
|
|
NamedValue emptyNamedValue;
|
|
|
|
aArguments[0] <<= emptyNamedValue;
|
|
|
|
index = 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
for ( int i = index; i < _rArguments.getLength(); i++)
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
2008-03-18 16:30:23 +00:00
|
|
|
NamedValue namedValue;
|
2016-10-16 20:08:47 +02:00
|
|
|
aArguments[i] = _rArguments[i];
|
2008-03-18 16:30:23 +00:00
|
|
|
|
2009-02-11 14:19:26 +00:00
|
|
|
if (aArguments[i] >>= namedValue )
|
2008-03-18 16:30:23 +00:00
|
|
|
{
|
2009-02-11 14:19:26 +00:00
|
|
|
|
2012-04-06 14:09:04 +02:00
|
|
|
if ( namedValue.Name == "StandardDir" )
|
2008-03-18 16:30:23 +00:00
|
|
|
{
|
2012-12-08 13:42:54 +02:00
|
|
|
OUString sStandardDir;
|
2008-03-18 16:30:23 +00:00
|
|
|
|
|
|
|
namedValue.Value >>= sStandardDir;
|
|
|
|
|
|
|
|
// Set the directory for the "back to the default dir" button
|
2019-02-08 13:16:19 +02:00
|
|
|
if ( !sStandardDir.isEmpty() )
|
2008-03-18 16:30:23 +00:00
|
|
|
{
|
|
|
|
m_aStandardDir = sStandardDir;
|
|
|
|
}
|
|
|
|
}
|
2012-04-06 14:09:04 +02:00
|
|
|
else if ( namedValue.Name == "BlackList" )
|
2009-03-03 10:51:13 +00:00
|
|
|
{
|
|
|
|
namedValue.Value >>= m_aBlackList;
|
|
|
|
}
|
2008-03-18 16:30:23 +00:00
|
|
|
}
|
2005-04-13 07:49:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// let the base class analyze the sequence (will call into implHandleInitializationArgument)
|
2009-02-11 14:19:26 +00:00
|
|
|
OCommonPicker::initialize( aArguments );
|
2005-04-13 07:49:02 +00:00
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-06-05 08:16:59 +02:00
|
|
|
bool SvtFilePicker::implHandleInitializationArgument( const OUString& _rName, const Any& _rValue )
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
2012-04-06 14:28:18 +02:00
|
|
|
if ( _rName == "TemplateDescription" )
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
|
|
|
m_nServiceType = TemplateDescription::FILEOPEN_SIMPLE;
|
|
|
|
OSL_VERIFY( _rValue >>= m_nServiceType );
|
2014-04-22 12:40:46 +02:00
|
|
|
return true;
|
2005-04-13 07:49:02 +00:00
|
|
|
}
|
2012-04-06 14:28:18 +02:00
|
|
|
if ( _rName == "StandardDir" )
|
2008-06-04 08:42:24 +00:00
|
|
|
{
|
|
|
|
OSL_VERIFY( _rValue >>= m_aStandardDir );
|
2014-04-22 12:40:46 +02:00
|
|
|
return true;
|
2008-06-04 08:42:24 +00:00
|
|
|
}
|
|
|
|
|
2012-04-06 14:28:18 +02:00
|
|
|
if ( _rName == "BlackList" )
|
2009-03-03 10:51:13 +00:00
|
|
|
{
|
|
|
|
OSL_VERIFY( _rValue >>= m_aBlackList );
|
2014-04-22 12:40:46 +02:00
|
|
|
return true;
|
2009-03-03 10:51:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-13 07:49:02 +00:00
|
|
|
return OCommonPicker::implHandleInitializationArgument( _rName, _rValue );
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2005-04-13 07:49:02 +00:00
|
|
|
// XServiceInfo
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2005-04-13 07:49:02 +00:00
|
|
|
|
|
|
|
/* XServiceInfo */
|
2017-01-26 12:28:58 +01:00
|
|
|
OUString SAL_CALL SvtFilePicker::getImplementationName()
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
|
|
|
return impl_getStaticImplementationName();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* XServiceInfo */
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Bool SAL_CALL SvtFilePicker::supportsService( const OUString& sServiceName )
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
2013-09-25 15:41:29 -03:00
|
|
|
return cppu::supportsService(this, sServiceName);
|
2005-04-13 07:49:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* XServiceInfo */
|
2017-01-26 12:28:58 +01:00
|
|
|
Sequence< OUString > SAL_CALL SvtFilePicker::getSupportedServiceNames()
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
|
|
|
return impl_getStaticSupportedServiceNames();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Helper for XServiceInfo */
|
2012-12-08 13:42:54 +02:00
|
|
|
Sequence< OUString > SvtFilePicker::impl_getStaticSupportedServiceNames()
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
2015-11-15 13:17:00 +02:00
|
|
|
Sequence<OUString> seqServiceNames { "com.sun.star.ui.dialogs.OfficeFilePicker" };
|
2005-04-13 07:49:02 +00:00
|
|
|
return seqServiceNames ;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Helper for XServiceInfo */
|
2012-12-08 13:42:54 +02:00
|
|
|
OUString SvtFilePicker::impl_getStaticImplementationName()
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
2019-07-30 17:54:36 +02:00
|
|
|
return "com.sun.star.svtools.OfficeFilePicker";
|
2005-04-13 07:49:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Helper for registry */
|
No need to keep these whitelisted functions decorated with SAL_CALL
The only effect SAL_CALL effectively has on LO-internal code is to change non-
static member functions from __thiscall to __cdecl in MSVC (where all other
functions are __cdecl by default, anyway). (For 3rd-party code, it could be
argued that SAL_CALL is useful on function declarations in the URE stable
interface other than non-static member functions, too, in case 3rd-party code
uses a compiler switch to change the default calling convention to something
other than __cdecl. But loplugin:salcall exempts the URE stable interface,
anyway.)
One could argue that SAL_CALL, even if today it effectively only affects non-
static member functions in MSVC, could be extended in the future to affect more
functions on more platforms. However, the current code would already not
support that. For example, 3af500580b1c82eabd60335c9ebc458a3f68850c
"loplugin:salcall fix functions" changed FrameControl_createInstance in
UnoControls/source/base/registercontrols.cxx to no longer be SAL_CALL, even
though its address (in ctl_component_getFacrory, in the same file) is passed to
cppuhelper::createSingleFactory as an argument of type
cppu::ComponentInstantiation, which is a pointer to SAL_CALL function.
Change-Id: I3acbf7314a3d7868ed70e35bb5c47bc11a0b7ff6
Reviewed-on: https://gerrit.libreoffice.org/46436
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-14 08:45:02 +01:00
|
|
|
Reference< XInterface > SvtFilePicker::impl_createInstance(
|
2017-01-26 12:28:58 +01:00
|
|
|
const Reference< XComponentContext >& )
|
2005-04-13 07:49:02 +00:00
|
|
|
{
|
2015-12-22 15:38:00 +02:00
|
|
|
return Reference< XInterface >( *new SvtFilePicker );
|
2005-04-13 07:49:02 +00:00
|
|
|
}
|
2010-10-12 15:53:47 +02:00
|
|
|
|
2015-06-30 15:31:30 +02:00
|
|
|
// SvtRemoteFilePicker
|
|
|
|
|
2015-12-22 15:38:00 +02:00
|
|
|
SvtRemoteFilePicker::SvtRemoteFilePicker()
|
2015-06-30 15:31:30 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-10-21 14:20:12 +01:00
|
|
|
std::unique_ptr<SvtFileDialog_Base> SvtRemoteFilePicker::implCreateDialog(weld::Window* pParent)
|
2015-06-30 15:31:30 +02:00
|
|
|
{
|
2016-05-11 14:07:54 +02:00
|
|
|
PickerFlags nBits = getPickerFlags();
|
2015-06-30 15:31:30 +02:00
|
|
|
|
2019-10-21 14:20:12 +01:00
|
|
|
auto dialog = std::make_unique<RemoteFilesDialog>(pParent, nBits);
|
2015-06-30 15:31:30 +02:00
|
|
|
|
|
|
|
// Set StandardDir if present
|
|
|
|
if ( !m_aStandardDir.isEmpty())
|
|
|
|
{
|
|
|
|
OUString sStandardDir = m_aStandardDir;
|
|
|
|
dialog->SetStandardDir( sStandardDir );
|
|
|
|
dialog->SetBlackList( m_aBlackList );
|
|
|
|
}
|
|
|
|
|
|
|
|
return dialog;
|
|
|
|
}
|
|
|
|
|
|
|
|
// XServiceInfo
|
|
|
|
|
|
|
|
|
|
|
|
/* XServiceInfo */
|
2017-01-26 12:28:58 +01:00
|
|
|
OUString SAL_CALL SvtRemoteFilePicker::getImplementationName()
|
2015-06-30 15:31:30 +02:00
|
|
|
{
|
|
|
|
return impl_getStaticImplementationName();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* XServiceInfo */
|
2017-01-26 12:28:58 +01:00
|
|
|
sal_Bool SAL_CALL SvtRemoteFilePicker::supportsService( const OUString& sServiceName )
|
2015-06-30 15:31:30 +02:00
|
|
|
{
|
|
|
|
return cppu::supportsService(this, sServiceName);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* XServiceInfo */
|
2017-01-26 12:28:58 +01:00
|
|
|
Sequence< OUString > SAL_CALL SvtRemoteFilePicker::getSupportedServiceNames()
|
2015-06-30 15:31:30 +02:00
|
|
|
{
|
|
|
|
return impl_getStaticSupportedServiceNames();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Helper for XServiceInfo */
|
|
|
|
Sequence< OUString > SvtRemoteFilePicker::impl_getStaticSupportedServiceNames()
|
|
|
|
{
|
2015-11-15 13:17:00 +02:00
|
|
|
Sequence<OUString> seqServiceNames { "com.sun.star.ui.dialogs.RemoteFilePicker" };
|
2015-06-30 15:31:30 +02:00
|
|
|
return seqServiceNames ;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Helper for XServiceInfo */
|
|
|
|
OUString SvtRemoteFilePicker::impl_getStaticImplementationName()
|
|
|
|
{
|
2019-07-30 17:54:36 +02:00
|
|
|
return "com.sun.star.svtools.RemoteFilePicker";
|
2015-06-30 15:31:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Helper for registry */
|
No need to keep these whitelisted functions decorated with SAL_CALL
The only effect SAL_CALL effectively has on LO-internal code is to change non-
static member functions from __thiscall to __cdecl in MSVC (where all other
functions are __cdecl by default, anyway). (For 3rd-party code, it could be
argued that SAL_CALL is useful on function declarations in the URE stable
interface other than non-static member functions, too, in case 3rd-party code
uses a compiler switch to change the default calling convention to something
other than __cdecl. But loplugin:salcall exempts the URE stable interface,
anyway.)
One could argue that SAL_CALL, even if today it effectively only affects non-
static member functions in MSVC, could be extended in the future to affect more
functions on more platforms. However, the current code would already not
support that. For example, 3af500580b1c82eabd60335c9ebc458a3f68850c
"loplugin:salcall fix functions" changed FrameControl_createInstance in
UnoControls/source/base/registercontrols.cxx to no longer be SAL_CALL, even
though its address (in ctl_component_getFacrory, in the same file) is passed to
cppuhelper::createSingleFactory as an argument of type
cppu::ComponentInstantiation, which is a pointer to SAL_CALL function.
Change-Id: I3acbf7314a3d7868ed70e35bb5c47bc11a0b7ff6
Reviewed-on: https://gerrit.libreoffice.org/46436
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-14 08:45:02 +01:00
|
|
|
Reference< XInterface > SvtRemoteFilePicker::impl_createInstance(
|
2017-01-26 12:28:58 +01:00
|
|
|
const Reference< XComponentContext >& )
|
2015-06-30 15:31:30 +02:00
|
|
|
{
|
2015-12-22 15:38:00 +02:00
|
|
|
return Reference< XInterface >( *new SvtRemoteFilePicker );
|
2015-06-30 15:31:30 +02:00
|
|
|
}
|
|
|
|
|
2010-10-12 15:53:47 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|