LibreOffice Module sfx2 (master) 1
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
sfx2::FileDialogHelper Class Reference

#include <filedlghelper.hxx>

Collaboration diagram for sfx2::FileDialogHelper:
[legend]

Public Types

enum  Context {
  UnknownContext ,
  AcceleratorConfig ,
  AutoRedact ,
  BaseDataSource ,
  BaseSaveAs ,
  BasicExportPackage ,
  BasicExportDialog ,
  BasicExportSource ,
  BasicImportDialog ,
  BasicImportSource ,
  BasicInsertLib ,
  BulletsAddImage ,
  ExtensionManager ,
  CalcDataProvider ,
  CalcDataStream ,
  CalcExport ,
  CalcSaveAs ,
  CalcXMLSource ,
  DrawExport ,
  DrawImpressInsertFile ,
  DrawImpressOpenSound ,
  DrawSaveAs ,
  ExportImage ,
  FormsAddInstance ,
  FormsInsertImage ,
  IconImport ,
  ImpressClickAction ,
  ImpressExport ,
  ImpressPhotoDialog ,
  ImpressSaveAs ,
  LinkClientOLE ,
  LinkClientFile ,
  ImageMap ,
  InsertDoc ,
  InsertImage ,
  InsertMedia ,
  InsertOLE ,
  JavaClassPath ,
  ReportInsertImage ,
  ScreenshotAnnotation ,
  SignatureLine ,
  TemplateImport ,
  WriterCreateAddressList ,
  WriterInsertImage ,
  WriterInsertScript ,
  WriterExport ,
  WriterImportAutotext ,
  WriterInsertHyperlink ,
  WriterLoadTemplate ,
  WriterMailMerge ,
  WriterMailMergeSaveAs ,
  WriterNewHTMLGlobalDoc ,
  WriterRegisterDataSource ,
  WriterSaveAs ,
  WriterSaveHTML ,
  XMLFilterSettings
}
 

Public Member Functions

 FileDialogHelper (sal_Int16 nDialogType, FileDialogFlags nFlags, weld::Window *pPreferredParent)
 
 FileDialogHelper (sal_Int16 nDialogType, FileDialogFlags nFlags, const OUString &rFactory, SfxFilterFlags nMust, SfxFilterFlags nDont, weld::Window *pPreferredParent)
 
 FileDialogHelper (sal_Int16 nDialogType, FileDialogFlags nFlags, const OUString &rFactory, sal_Int16 nDialog, SfxFilterFlags nMust, SfxFilterFlags nDont, const OUString &rStandardDir, const css::uno::Sequence< OUString > &rDenyList, weld::Window *pPreferredParent)
 
 FileDialogHelper (sal_Int16 nDialogType, FileDialogFlags nFlags, const OUString &aFilterUIName, std::u16string_view aExtName, const OUString &rStandardDir, const css::uno::Sequence< OUString > &rDenyList, weld::Window *pPreferredParent)
 
virtual ~FileDialogHelper ()
 
FileDialogHelperoperator= (const FileDialogHelper &)=delete
 
 FileDialogHelper (const FileDialogHelper &)=delete
 
ErrCode Execute ()
 
void StartExecuteModal (const Link< FileDialogHelper *, void > &rEndDialogHdl)
 
ErrCode const & GetError () const
 
sal_Int16 GetDialogType () const
 
bool IsPasswordEnabled () const
 
OUString GetRealFilter () const
 
void SetTitle (const OUString &rNewTitle)
 
OUString GetPath () const
 
css::uno::Sequence< OUString > GetMPath () const
 
css::uno::Sequence< OUString > GetSelectedFiles () const
 Provides the selected files with full path information. More...
 
void AddFilter (const OUString &rFilterName, const OUString &rExtension)
 
void SetCurrentFilter (const OUString &rFilter)
 
void SetDisplayDirectory (const OUString &rPath)
 sets an initial display directory/file name More...
 
void SetDisplayFolder (const OUString &_rURL)
 sets a new folder whose content is to be displayed in the file picker More...
 
void SetFileName (const OUString &_rFileName)
 sets an initial file name to display More...
 
OUString GetCurrentFilter () const
 
OUString GetDisplayDirectory () const
 
ErrCode GetGraphic (Graphic &rGraphic) const
 
const css::uno::Reference< css::ui::dialogs::XFilePicker3 > & GetFilePicker () const
 
void FileSelectionChanged ()
 
void DirectoryChanged ()
 
virtual void ControlStateChanged (const css::ui::dialogs::FilePickerEvent &aEvent)
 
void DialogSizeChanged ()
 
void DialogClosed (const css::ui::dialogs::DialogClosedEvent &_rEvent)
 
void SetControlHelpIds (const sal_Int16 *_pControlId, const char **_pHelpId)
 sets help ids for the controls in the dialog More...
 
void CreateMatcher (const OUString &rName)
 
void SetContext (Context _eNewContext)
 sets the context of the dialog and trigger necessary actions e.g. More...
 
 DECL_DLLPRIVATE_LINK (ExecuteSystemFilePicker, void *, void)
 
ErrCode Execute (std::vector< OUString > &rpURLList, std::optional< SfxAllItemSet > &rpSet, OUString &rFilter, const OUString &rDirPath)
 
ErrCode Execute (std::optional< SfxAllItemSet > &rpSet, OUString &rFilter)
 

Static Public Member Functions

static OUString contextToString (Context context)
 
static OUString HelpRequested (const css::ui::dialogs::FilePickerEvent &aEvent)
 

Private Attributes

Link< FileDialogHelper *, void > m_aDialogClosedLink
 
ErrCode m_nError
 
rtl::Reference< FileDialogHelper_ImplmpImpl
 

Detailed Description

Definition at line 77 of file filedlghelper.hxx.

Member Enumeration Documentation

◆ Context

Enumerator
UnknownContext 
AcceleratorConfig 
AutoRedact 
BaseDataSource 
BaseSaveAs 
BasicExportPackage 
BasicExportDialog 
BasicExportSource 
BasicImportDialog 
BasicImportSource 
BasicInsertLib 
BulletsAddImage 
ExtensionManager 
CalcDataProvider 
CalcDataStream 
CalcExport 
CalcSaveAs 
CalcXMLSource 
DrawExport 
DrawImpressInsertFile 
DrawImpressOpenSound 
DrawSaveAs 
ExportImage 
FormsAddInstance 
FormsInsertImage 
IconImport 
ImpressClickAction 
ImpressExport 
ImpressPhotoDialog 
ImpressSaveAs 
LinkClientOLE 
LinkClientFile 
ImageMap 
InsertDoc 
InsertImage 
InsertMedia 
InsertOLE 
JavaClassPath 
ReportInsertImage 
ScreenshotAnnotation 
SignatureLine 
TemplateImport 
WriterCreateAddressList 
WriterInsertImage 
WriterInsertScript 
WriterExport 
WriterImportAutotext 
WriterInsertHyperlink 
WriterLoadTemplate 
WriterMailMerge 
WriterMailMergeSaveAs 
WriterNewHTMLGlobalDoc 
WriterRegisterDataSource 
WriterSaveAs 
WriterSaveHTML 
XMLFilterSettings 

Definition at line 81 of file filedlghelper.hxx.

Constructor & Destructor Documentation

◆ FileDialogHelper() [1/5]

sfx2::FileDialogHelper::FileDialogHelper ( sal_Int16  nDialogType,
FileDialogFlags  nFlags,
weld::Window pPreferredParent 
)

Definition at line 2392 of file filedlghelper.cxx.

◆ FileDialogHelper() [2/5]

sfx2::FileDialogHelper::FileDialogHelper ( sal_Int16  nDialogType,
FileDialogFlags  nFlags,
const OUString &  rFactory,
SfxFilterFlags  nMust,
SfxFilterFlags  nDont,
weld::Window pPreferredParent 
)

Definition at line 2358 of file filedlghelper.cxx.

References SfxObjectShell::GetServiceNameFromFactory(), and mpImpl.

◆ FileDialogHelper() [3/5]

sfx2::FileDialogHelper::FileDialogHelper ( sal_Int16  nDialogType,
FileDialogFlags  nFlags,
const OUString &  rFactory,
sal_Int16  nDialog,
SfxFilterFlags  nMust,
SfxFilterFlags  nDont,
const OUString &  rStandardDir,
const css::uno::Sequence< OUString > &  rDenyList,
weld::Window pPreferredParent 
)

Definition at line 2374 of file filedlghelper.cxx.

References SfxObjectShell::GetServiceNameFromFactory(), and mpImpl.

◆ FileDialogHelper() [4/5]

sfx2::FileDialogHelper::FileDialogHelper ( sal_Int16  nDialogType,
FileDialogFlags  nFlags,
const OUString &  aFilterUIName,
std::u16string_view  aExtName,
const OUString &  rStandardDir,
const css::uno::Sequence< OUString > &  rDenyList,
weld::Window pPreferredParent 
)

◆ ~FileDialogHelper()

sfx2::FileDialogHelper::~FileDialogHelper ( )
virtual

Definition at line 2426 of file filedlghelper.cxx.

References mpImpl.

◆ FileDialogHelper() [5/5]

sfx2::FileDialogHelper::FileDialogHelper ( const FileDialogHelper )
delete

References Execute().

Member Function Documentation

◆ AddFilter()

void sfx2::FileDialogHelper::AddFilter ( const OUString &  rFilterName,
const OUString &  rExtension 
)

Definition at line 2782 of file filedlghelper.cxx.

References mpImpl.

Referenced by FileDialogHelper(), and SfxTemplateManagerDlg::OnTemplateImportCategory().

◆ contextToString()

OUString sfx2::FileDialogHelper::contextToString ( Context  context)
static

◆ ControlStateChanged()

void sfx2::FileDialogHelper::ControlStateChanged ( const css::ui::dialogs::FilePickerEvent &  aEvent)
virtual

Definition at line 2817 of file filedlghelper.cxx.

References aEvent, and mpImpl.

Referenced by sfx2::FileDialogHelper_Impl::controlStateChanged().

◆ CreateMatcher()

void sfx2::FileDialogHelper::CreateMatcher ( const OUString &  rName)

Definition at line 2431 of file filedlghelper.cxx.

References SfxObjectShell::GetServiceNameFromFactory(), and mpImpl.

◆ DECL_DLLPRIVATE_LINK()

sfx2::FileDialogHelper::DECL_DLLPRIVATE_LINK ( ExecuteSystemFilePicker  ,
void *  ,
void   
)

References Execute().

◆ DialogClosed()

void sfx2::FileDialogHelper::DialogClosed ( const css::ui::dialogs::DialogClosedEvent &  _rEvent)

◆ DialogSizeChanged()

void sfx2::FileDialogHelper::DialogSizeChanged ( )

Definition at line 2822 of file filedlghelper.cxx.

References mpImpl.

Referenced by sfx2::FileDialogHelper_Impl::dialogSizeChanged().

◆ DirectoryChanged()

void sfx2::FileDialogHelper::DirectoryChanged ( )

Definition at line 2807 of file filedlghelper.cxx.

References mpImpl.

Referenced by sfx2::FileDialogHelper_Impl::directoryChanged().

◆ Execute() [1/3]

ErrCode sfx2::FileDialogHelper::Execute ( )

Definition at line 2584 of file filedlghelper.cxx.

References mpImpl.

Referenced by SfxTemplateManagerDlg::OnTemplateImportCategory().

◆ Execute() [2/3]

ErrCode sfx2::FileDialogHelper::Execute ( std::optional< SfxAllItemSet > &  rpSet,
OUString &  rFilter 
)

Definition at line 2589 of file filedlghelper.cxx.

References mpImpl.

◆ Execute() [3/3]

ErrCode sfx2::FileDialogHelper::Execute ( std::vector< OUString > &  rpURLList,
std::optional< SfxAllItemSet > &  rpSet,
OUString &  rFilter,
const OUString &  rDirPath 
)

Definition at line 2574 of file filedlghelper.cxx.

References mpImpl, and SetDisplayFolder().

◆ FileSelectionChanged()

void sfx2::FileDialogHelper::FileSelectionChanged ( )

Definition at line 2802 of file filedlghelper.cxx.

References mpImpl.

Referenced by sfx2::FileDialogHelper_Impl::fileSelectionChanged().

◆ GetCurrentFilter()

OUString sfx2::FileDialogHelper::GetCurrentFilter ( ) const

Definition at line 2707 of file filedlghelper.cxx.

References mpImpl.

◆ GetDialogType()

sal_Int16 sfx2::FileDialogHelper::GetDialogType ( ) const

Definition at line 2608 of file filedlghelper.cxx.

References mpImpl.

◆ GetDisplayDirectory()

OUString sfx2::FileDialogHelper::GetDisplayDirectory ( ) const

Definition at line 2702 of file filedlghelper.cxx.

References mpImpl.

◆ GetError()

ErrCode const & sfx2::FileDialogHelper::GetError ( ) const
inline

Definition at line 186 of file filedlghelper.hxx.

◆ GetFilePicker()

const uno::Reference< XFilePicker3 > & sfx2::FileDialogHelper::GetFilePicker ( ) const

Definition at line 2796 of file filedlghelper.cxx.

References mpImpl.

Referenced by SvxOpenGrf_Impl::SvxOpenGrf_Impl().

◆ GetGraphic()

ErrCode sfx2::FileDialogHelper::GetGraphic ( Graphic rGraphic) const

Definition at line 2712 of file filedlghelper.cxx.

References mpImpl.

◆ GetMPath()

Sequence< OUString > sfx2::FileDialogHelper::GetMPath ( ) const
Deprecated:
: Don't use this method to retrieve the selected files There are file picker which can provide multiple selected file which belong to different folders. As this method always provides the root folder for all selected files this cannot work.

Definition at line 2649 of file filedlghelper.cxx.

References comphelper::containerToSequence(), and mpImpl.

◆ GetPath()

OUString sfx2::FileDialogHelper::GetPath ( ) const

Definition at line 2629 of file filedlghelper.cxx.

References mpImpl.

◆ GetRealFilter()

OUString sfx2::FileDialogHelper::GetRealFilter ( ) const

Definition at line 2615 of file filedlghelper.cxx.

References mpImpl.

◆ GetSelectedFiles()

Sequence< OUString > sfx2::FileDialogHelper::GetSelectedFiles ( ) const

◆ HelpRequested()

OUString sfx2::FileDialogHelper::HelpRequested ( const css::ui::dialogs::FilePickerEvent &  aEvent)
static

◆ IsPasswordEnabled()

bool sfx2::FileDialogHelper::IsPasswordEnabled ( ) const

Definition at line 2610 of file filedlghelper.cxx.

References mpImpl.

◆ operator=()

FileDialogHelper & sfx2::FileDialogHelper::operator= ( const FileDialogHelper )
delete

◆ SetContext()

void sfx2::FileDialogHelper::SetContext ( Context  _eNewContext)

sets the context of the dialog and trigger necessary actions e.g.

loading config, setting help id This will also store the last used directory for this context, so that the last directory gets preselected on next filepicker launch (with the same context)

Parameters
_eNewContextNew context for the dialog.

Definition at line 2441 of file filedlghelper.cxx.

References mpImpl.

Referenced by SvFileObject::Edit(), and SfxTemplateManagerDlg::OnTemplateImportCategory().

◆ SetControlHelpIds()

void sfx2::FileDialogHelper::SetControlHelpIds ( const sal_Int16 *  _pControlId,
const char **  _pHelpId 
)

sets help ids for the controls in the dialog

Parameters
_pControlIdPointer to a 0-terminated array of control ids. They must be recruited from the CommonFilePickerElementIds and ExtendedFilePickerElementIds values.
_pHelpIdPointer to an array of help ids. For each element in _pControlId, there must be a corresponding element herein.

Definition at line 2436 of file filedlghelper.cxx.

References mpImpl.

◆ SetCurrentFilter()

void sfx2::FileDialogHelper::SetCurrentFilter ( const OUString &  rFilter)

Definition at line 2788 of file filedlghelper.cxx.

References mpImpl.

Referenced by SfxTemplateManagerDlg::OnTemplateImportCategory().

◆ SetDisplayDirectory()

void sfx2::FileDialogHelper::SetDisplayDirectory ( const OUString &  rPath)

sets an initial display directory/file name

Deprecated:
don't use this method. It contains a lot of magic in determining whether the last segment of the given path/URL denotes a file name or a folder, and by definition, it cannot succeed with this magic all the time - there will always be scenarios where it fails.

Use SetDisplayFolder and SetFileName.

Definition at line 2736 of file filedlghelper.cxx.

References INetURLObject::GetLastName(), INetURLObject::GetMainURL(), sfx2::impl_isFolder(), mpImpl, INetURLObject::NONE, INetURLObject::removeSegment(), and INetURLObject::WithCharset.

◆ SetDisplayFolder()

void sfx2::FileDialogHelper::SetDisplayFolder ( const OUString &  _rURL)

sets a new folder whose content is to be displayed in the file picker

Parameters
_rURLspecifies the URL of the folder whose content is to be displayed.
If the URL doesn't denote a valid (existent and accessible) folder, the request is silently dropped.
Exceptions
css::uno::RuntimeExceptionif the invocation of any of the file picker or UCB methods throws a RuntimeException.

Definition at line 2772 of file filedlghelper.cxx.

References mpImpl.

Referenced by Execute().

◆ SetFileName()

void sfx2::FileDialogHelper::SetFileName ( const OUString &  _rFileName)

sets an initial file name to display

This method is usually used in "save-as" contexts, where the application should suggest an initial name for the file to save.

Calling this method is nearly equivalent to calling GetFilePicker().setDefaultName( _rFileName ), with the following differences:

  • The FileDialogHelper remembers the given file name, and upon execution, strips its extension if the dialog is set up for "automatic file name extension".
  • Exceptions thrown from the XFilePicker3 are caught and silenced.

Definition at line 2777 of file filedlghelper.cxx.

References mpImpl.

◆ SetTitle()

void sfx2::FileDialogHelper::SetTitle ( const OUString &  rNewTitle)

Definition at line 2623 of file filedlghelper.cxx.

References mpImpl.

◆ StartExecuteModal()

void sfx2::FileDialogHelper::StartExecuteModal ( const Link< FileDialogHelper *, void > &  rEndDialogHdl)

Member Data Documentation

◆ m_aDialogClosedLink

Link<FileDialogHelper*,void> sfx2::FileDialogHelper::m_aDialogClosedLink
private

Definition at line 143 of file filedlghelper.hxx.

Referenced by DialogClosed(), and StartExecuteModal().

◆ m_nError

ErrCode sfx2::FileDialogHelper::m_nError
private

Definition at line 144 of file filedlghelper.hxx.

Referenced by DialogClosed(), and StartExecuteModal().

◆ mpImpl

rtl::Reference< FileDialogHelper_Impl > sfx2::FileDialogHelper::mpImpl
private

The documentation for this class was generated from the following files: