23#include <com/sun/star/uno/Reference.h>
24#include <com/sun/star/lang/IllegalArgumentException.hpp>
25#include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
26#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
27#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
28#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
29#include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
38#include <sfx2/strings.hrc>
40#include <osl/diagnose.h>
47using namespace ::
cppu;
52 return RID_SVXSTR_GRFILTER_OPENERROR;
54 return RID_SVXSTR_GRFILTER_IOERROR;
56 return RID_SVXSTR_GRFILTER_VERSIONERROR;
58 return RID_SVXSTR_GRFILTER_FILTERERROR;
60 return RID_SVXSTR_GRFILTER_FORMATERROR;
66 sal_Int16 nDialogType);
71 uno::Reference < XFilePickerControlAccess >
xCtrlAcc;
76 sal_Int16 nDialogType)
78 , pDialogParent(pPreferredParent)
86 : mpImpl(new
SvxOpenGrf_Impl(pPreferredParent, ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW))
88 mpImpl->aFileDlg.SetTitle(rTitle);
93 sal_Int16 nDialogType)
96 mpImpl->aFileDlg.SetTitle(rTitle);
107 bool bQuitLoop(
false);
120 sal_uInt16 nRetFormat = 0;
121 sal_uInt16 nFound = USHRT_MAX;
155 if ( nFound == USHRT_MAX )
158 VclMessageType::Warning, VclButtonsType::NONE,
183 return ErrCode(sal_uInt32(-1));
189 mpImpl->aFileDlg.SetDisplayDirectory(rPath);
196 if( !
mpImpl->xCtrlAcc.is() )
201 mpImpl->xCtrlAcc->enableControl( ExtendedFilePickerElementIds::CHECKBOX_LINK, state );
203 catch(
const IllegalArgumentException&)
206 OSL_FAIL(
"Cannot enable \"link\" checkbox" );
214 if( !
mpImpl->xCtrlAcc.is() )
219 mpImpl->xCtrlAcc->setValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0,
Any(bState) );
221 catch(
const IllegalArgumentException&)
224 OSL_FAIL(
"Cannot check \"link\" checkbox" );
234 if(
mpImpl->xCtrlAcc.is() )
236 Any aVal =
mpImpl->xCtrlAcc->getValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0 );
237 DBG_ASSERT(aVal.hasValue(),
"Value CBX_INSERT_AS_LINK not found");
238 return aVal.hasValue() && *o3tl::doAccess<bool>(aVal);
241 catch(
const IllegalArgumentException&)
244 OSL_FAIL(
"Cannot access \"link\" checkbox" );
253 return mpImpl->aFileDlg.GetGraphic(rGraphic);
258 return mpImpl->aFileDlg.GetPath();
263 return mpImpl->aFileDlg.GetCurrentFilter();
268 return mpImpl->sDetectedFilter;
273 mpImpl->aFileDlg.SetCurrentFilter(rStr);
278 mpImpl->sDetectedFilter = rStr;
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
static GraphicFilter & GetGraphicFilter()
sal_uInt16 GetImportFormatNumber(std::u16string_view rFormatName)
ErrCode CanImportGraphic(const INetURLObject &rPath, sal_uInt16 nFormat, sal_uInt16 *pDeterminedFormat)
OUString GetImportFormatName(sal_uInt16 nFormat)
sal_uInt16 GetImportFormatCount() const
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
INetProtocol GetProtocol() const
void Download(const Link< void *, void > &aLink=Link< void *, void >())
SvxOpenGraphicDialog(const OUString &rTitle, weld::Window *pPreferredParent)
css::uno::Reference< css::ui::dialogs::XFilePickerControlAccess > const & GetFilePickerControlAccess() const
void SetCurrentFilter(const OUString &)
OUString GetCurrentFilter() const
void SetPath(const OUString &rPath, bool bLinkState)
const std::unique_ptr< SvxOpenGrf_Impl > mpImpl
void SetDetectedFilter(const OUString &)
ErrCode GetGraphic(Graphic &) const
OUString const & GetDetectedFilter() const
const css::uno::Reference< css::ui::dialogs::XFilePicker3 > & GetFilePicker() const
#define DBG_ASSERT(sCon, aError)
#define GRFILTER_FORMAT_DONTKNOW
#define ERRCODE_GRFILTER_OPENERROR
#define ERRCODE_GRFILTER_FILTERERROR
#define ERRCODE_GRFILTER_IOERROR
#define ERRCODE_GRFILTER_VERSIONERROR
static TranslateId SvxOpenGrfErr2ResId(ErrCode err)
OUString SfxResId(TranslateId aId)
OUString VCL_DLLPUBLIC GetStandardText(StandardButtonType eButton)
sfx2::FileDialogHelper aFileDlg
uno::Reference< XFilePickerControlAccess > xCtrlAcc
weld::Window * pDialogParent
SvxOpenGrf_Impl(weld::Window *pPreferredParent, sal_Int16 nDialogType)