27#include <com/sun/star/uno/Any.hxx>
28#include <com/sun/star/uno/Sequence.hxx>
30#include <com/sun/star/document/XTypeDetection.hpp>
31#include <com/sun/star/container/XNameAccess.hpp>
32#include <com/sun/star/lang/XMultiServiceFactory.hpp>
40#include <sfx2/strings.hrc>
49 : nPostUserEventId(nullptr)
57 , bStateChangeCalled(false)
73 const OUString & rMimeType,
80 if( SotClipboardFormatId::SIMPLE_FILE == nFmt )
90 if (SotClipboardFormatId::GDIMETAFILE == nFmt
91 || SotClipboardFormatId::BITMAP == nFmt
92 || SotClipboardFormatId::SVXB == nFmt)
118 if( pShell->IsAbortingImport() )
121 if( pShell->GetMedium() )
122 sReferer = pShell->GetMedium()->GetName();
126 switch(
pLink->GetObjType() )
161 SvLinkSource::StreamToLoadFrom aStreamToLoadFrom =
163 xMed->setStreamToLoadFrom(
164 aStreamToLoadFrom.m_xInputStreamToLoadFrom,
165 aStreamToLoadFrom.m_bIsReadOnly);
204 if ( _rURL.isEmpty() )
209 css::uno::Reference< css::document::XTypeDetection > xTypeDetection(
210 ::comphelper::getProcessServiceFactory()->
createInstance(
"com.sun.star.document.TypeDetection" ),
211 css::uno::UNO_QUERY );
212 if ( xTypeDetection.is() )
216 css::uno::Sequence< css::beans::PropertyValue > aDescrList =
217 aDescr.getAsConstPropertyValueList();
218 OUString
sType = xTypeDetection->queryTypeByDescriptor( aDescrList,
true );
219 if ( !
sType.isEmpty() )
222 for (
const auto& rDescr : std::as_const(aDescrList))
224 if (rDescr.Name ==
"FilterName")
226 if (rDescr.Value >>= sFilter)
230 if (sFilter.isEmpty())
232 css::uno::Reference< css::container::XNameAccess > xTypeCont( xTypeDetection,
233 css::uno::UNO_QUERY );
234 if ( xTypeCont.is() )
241 "PreferredFilter", OUString() );
247 catch(
const css::uno::Exception& )
257 OUString sFile, sRange, sTmpFilter;
263 switch(
pLink->GetObjType() )
293 pLink->GetInsertFileDialog( OUString() );
310 pLink->GetInsertFileDialog(sFactory);
326 bWaitForData =
false;
354 nPostUserEventId =
nullptr;
364 if ( _pFileDlg && _pFileDlg->GetError() ==
ERRCODE_NONE )
366 OUString sURL( _pFileDlg->GetPath() );
374 SAL_WARN(
"sfx.appl",
"SvFileObject::DialogClosedHdl(): wrong file type" );
377 aEndEditLink.Call( sFile );
HRESULT createInstance(REFIID iid, Ifc **ppIfc)
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
static void RemoveUserEvent(ImplSVEvent *nUserEvent)
INetProtocol GetProtocol() const
const OUString & GetFactoryName() const
virtual SfxObjectFactory & GetFactory() const =0
static OUString GetFormatMimeType(SotClipboardFormatId nFormat)
static OUString GetFormatName(SotClipboardFormatId nFormat)
static SotClipboardFormatId RegisterFormatMimeType(const OUString &rMimeType)
Link< const OUString &, void > aEndEditLink
virtual ~SvFileObject() override
virtual void Edit(weld::Window *, sfx2::SvBaseLink *, const Link< const OUString &, void > &rEndEditHdl) override
virtual bool IsDataComplete() const override
void SendStateChg_Impl(sfx2::LinkManager::LinkState nState)
ImplSVEvent * nPostUserEventId
tools::SvRef< SfxMedium > xMed
virtual bool GetData(css::uno::Any &rData, const OUString &rMimeType, bool bSynchron=false) override
virtual bool IsPending() const override
virtual bool Connect(sfx2::SvBaseLink *) override
void SetCurrentFilter(const OUString &)
void SetPath(const OUString &rPath, bool bLinkState)
OUString const & GetDetectedFilter() const
TValueType getUnpackedValueOrDefault(const OUString &sKey, const TValueType &aDefault) const
void StartExecuteModal(const Link< FileDialogHelper *, void > &rEndDialogHdl)
void SetContext(Context _eNewContext)
sets the context of the dialog and trigger necessary actions e.g.
static bool GetDisplayNames(const SvBaseLink *, OUString *pType, OUString *pFile=nullptr, OUString *pLink=nullptr, OUString *pFilter=nullptr)
static SotClipboardFormatId RegisterStatusInfoId()
void DataChanged(const OUString &rMimeType, const css::uno::Any &rVal)
void AddDataAdvise(SvBaseLink *, const OUString &rMimeType, sal_uInt16 nAdviceMode)
StreamToLoadFrom getStreamToLoadFrom()
void SetUpdateTimeout(sal_uInt64 nTimeMs)
bool HasDataLinks() const
IMPL_LINK(SvFileObject, DialogClosedHdl, sfx2::FileDialogHelper *, _pFileDlg, void)
IMPL_LINK_NOARG(SvFileObject, LoadGrfReady_Impl, void *, void)
static OUString impl_getFilter(const OUString &_rURL)
detect the filter of the given file
#define LINK(Instance, Class, Member)
#define SAL_WARN(area, stream)
const sal_Unicode cTokenSeparator
OUString SfxResId(TranslateId aId)