1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <cppuhelper/exc_hlp.hxx>
21 #include <comphelper/processfactory.hxx>
22 #include <comphelper/sequence.hxx>
23 #include <cppuhelper/factory.hxx>
24 #include <cppuhelper/implbase.hxx>
25 #include <cppuhelper/supportsservice.hxx>
27 #include <tools/urlobj.hxx>
28 #include <ucbhelper/content.hxx>
29 #include <unotools/streamwrap.hxx>
30 #include <tools/stream.hxx>
32 #include <com/sun/star/beans/Property.hpp>
33 #include <com/sun/star/container/XChild.hpp>
34 #include <com/sun/star/io/XActiveDataSink.hpp>
35 #include <com/sun/star/io/XActiveDataStreamer.hpp>
36 #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
37 #include <com/sun/star/lang/XServiceInfo.hpp>
38 #include <com/sun/star/sdbc/XResultSet.hpp>
39 #include <com/sun/star/ucb/ContentCreationException.hpp>
40 #include <com/sun/star/ucb/CommandFailedException.hpp>
41 #include <com/sun/star/ucb/ContentInfo.hpp>
42 #include <com/sun/star/ucb/ContentInfoAttribute.hpp>
43 #include <com/sun/star/ucb/InsertCommandArgument.hpp>
44 #include <com/sun/star/ucb/InteractiveIOException.hpp>
45 #include <com/sun/star/ucb/NameClash.hpp>
46 #include <com/sun/star/ucb/OpenCommandArgument2.hpp>
47 #include <com/sun/star/ucb/OpenMode.hpp>
48 #include <com/sun/star/ucb/XCommandEnvironment.hpp>
49 #include <com/sun/star/ucb/XContent.hpp>
50 #include <com/sun/star/ucb/XContentAccess.hpp>
51 #include <com/sun/star/ucb/XSimpleFileAccess3.hpp>
52 #include <com/sun/star/util/theMacroExpander.hpp>
56 #include "FileAccess.hxx"
58 #define SERVICE_NAME "com.sun.star.ucb.SimpleFileAccess"
60 using namespace ::com::sun::star::uno
;
61 using namespace ::com::sun::star::lang
;
62 using namespace ::com::sun::star::io
;
63 using namespace ::com::sun::star::ucb
;
64 using namespace ::com::sun::star::sdbc
;
65 using namespace ::com::sun::star::task
;
66 using namespace ::com::sun::star::util
;
67 using namespace ::com::sun::star::beans
;
68 using namespace ::com::sun::star::registry
;
69 using namespace ::com::sun::star::container
;
76 // Implementation XSimpleFileAccess
77 typedef cppu::WeakImplHelper
<XSimpleFileAccess3
, css::lang::XServiceInfo
>
79 class OCommandEnvironment
;
81 class OFileAccess
: public FileAccessHelper
83 Reference
< XComponentContext
> m_xContext
;
84 rtl::Reference
<OCommandEnvironment
> mxEnvironment
;
86 /// @throws CommandAbortedException
88 /// @throws RuntimeException
89 void transferImpl( const OUString
& rSource
, const OUString
& rDest
, bool bMoveData
);
91 bool createNewFile( const OUString
& rParentURL
,
92 const OUString
& rTitle
,
93 const Reference
< XInputStream
>& data
);
96 explicit OFileAccess( const Reference
< XComponentContext
> & xContext
)
97 : m_xContext( xContext
) {}
99 virtual void SAL_CALL
copy( const OUString
& SourceURL
, const OUString
& DestURL
) override
;
100 virtual void SAL_CALL
move( const OUString
& SourceURL
, const OUString
& DestURL
) override
;
101 virtual void SAL_CALL
kill( const OUString
& FileURL
) override
;
102 virtual sal_Bool SAL_CALL
isFolder( const OUString
& FileURL
) override
;
103 virtual sal_Bool SAL_CALL
isReadOnly( const OUString
& FileURL
) override
;
104 virtual void SAL_CALL
setReadOnly( const OUString
& FileURL
, sal_Bool bReadOnly
) override
;
105 virtual void SAL_CALL
createFolder( const OUString
& NewFolderURL
) override
;
106 virtual sal_Int32 SAL_CALL
getSize( const OUString
& FileURL
) override
;
107 virtual OUString SAL_CALL
getContentType( const OUString
& FileURL
) override
;
108 virtual css::util::DateTime SAL_CALL
getDateTimeModified( const OUString
& FileURL
) override
;
109 virtual css::uno::Sequence
< OUString
> SAL_CALL
getFolderContents( const OUString
& FolderURL
, sal_Bool bIncludeFolders
) override
;
110 virtual sal_Bool SAL_CALL
exists( const OUString
& FileURL
) override
;
111 virtual css::uno::Reference
< css::io::XInputStream
> SAL_CALL
openFileRead( const OUString
& FileURL
) override
;
112 virtual css::uno::Reference
< css::io::XOutputStream
> SAL_CALL
openFileWrite( const OUString
& FileURL
) override
;
113 virtual css::uno::Reference
< css::io::XStream
> SAL_CALL
openFileReadWrite( const OUString
& FileURL
) override
;
114 virtual void SAL_CALL
setInteractionHandler( const css::uno::Reference
< css::task::XInteractionHandler
>& Handler
) override
;
115 virtual void SAL_CALL
writeFile( const OUString
& FileURL
, const css::uno::Reference
< css::io::XInputStream
>& data
) override
;
116 virtual sal_Bool SAL_CALL
isHidden( const OUString
& FileURL
) override
;
117 virtual void SAL_CALL
setHidden( const OUString
& FileURL
, sal_Bool bHidden
) override
;
119 OUString SAL_CALL
getImplementationName() override
120 { return IMPLEMENTATION_NAME
; }
122 sal_Bool SAL_CALL
supportsService(OUString
const & ServiceName
) override
123 { return cppu::supportsService(this, ServiceName
); }
125 css::uno::Sequence
<OUString
> SAL_CALL
getSupportedServiceNames() override
126 { return FileAccess_getSupportedServiceNames(); }
129 // Implementation XActiveDataSink
131 class OActiveDataSink
: public cppu::WeakImplHelper
< XActiveDataSink
>
133 Reference
< XInputStream
> mxStream
;
138 virtual void SAL_CALL
setInputStream( const Reference
< XInputStream
>& aStream
) override
;
139 virtual Reference
< XInputStream
> SAL_CALL
getInputStream( ) override
;
142 // Implementation XActiveDataStreamer
144 class OActiveDataStreamer
: public cppu::WeakImplHelper
< XActiveDataStreamer
>
146 Reference
< XStream
> mxStream
;
151 virtual void SAL_CALL
setStream( const Reference
< XStream
>& aStream
) override
;
152 virtual Reference
< XStream
> SAL_CALL
getStream() override
;
155 // Implementation XCommandEnvironment
157 class OCommandEnvironment
: public cppu::WeakImplHelper
< XCommandEnvironment
>
159 Reference
< XInteractionHandler
> mxInteraction
;
162 void setHandler( const Reference
< XInteractionHandler
>& xInteraction_
)
164 mxInteraction
= xInteraction_
;
168 virtual Reference
< XInteractionHandler
> SAL_CALL
getInteractionHandler() override
;
169 virtual Reference
< XProgressHandler
> SAL_CALL
getProgressHandler() override
;
172 void OActiveDataSink::setInputStream( const Reference
< XInputStream
>& aStream
)
177 Reference
< XInputStream
> OActiveDataSink::getInputStream()
182 void OActiveDataStreamer::setStream( const Reference
< XStream
>& aStream
)
187 Reference
< XStream
> OActiveDataStreamer::getStream()
192 Reference
< XInteractionHandler
> OCommandEnvironment::getInteractionHandler()
194 return mxInteraction
;
197 Reference
< XProgressHandler
> OCommandEnvironment::getProgressHandler()
199 Reference
< XProgressHandler
> xRet
;
203 void OFileAccess::transferImpl( const OUString
& rSource
,
204 const OUString
& rDest
,
207 // SfxContentHelper::Transfer_Impl
208 INetURLObject
aSourceObj( rSource
, INetProtocol::File
);
209 INetURLObject
aDestObj( rDest
, INetProtocol::File
);
210 OUString aName
= aDestObj
.getName(
211 INetURLObject::LAST_SEGMENT
, true, INetURLObject::DecodeMechanism::WithCharset
);
213 OUString aSourceURL
= aSourceObj
.GetMainURL( INetURLObject::DecodeMechanism::NONE
);
214 if ( aDestObj
.removeSegment() )
218 aDestObj
.setFinalSlash();
219 aDestURL
= aDestObj
.GetMainURL( INetURLObject::DecodeMechanism::NONE
);
223 // non-hierarchical URL
228 if ( aDestObj
.GetProtocol() == INetProtocol::VndSunStarExpand
)
230 // Hack: Expand destination URL using Macro Expander and try again
231 // with the hopefully hierarchical expanded URL...
235 Reference
< XMacroExpander
> xExpander
= theMacroExpander::get(m_xContext
);
237 aDestURL
= xExpander
->expandMacros(
238 aDestObj
.GetURLPath( INetURLObject::DecodeMechanism::WithCharset
) );
240 catch ( Exception
const & )
242 css::uno::Any anyEx
= cppu::getCaughtException();
243 throw css::lang::WrappedTargetRuntimeException(
244 "OFileAccess::transferrImpl - Unable to obtain destination folder URL!",
245 static_cast< cppu::OWeakObject
* >( this ), anyEx
);
248 transferImpl( rSource
, aDestURL
, bMoveData
);
252 throw RuntimeException(
253 "OFileAccess::transferrImpl - Unable to obtain destination folder URL!",
254 static_cast< cppu::OWeakObject
* >( this ) );
258 ucbhelper::Content
aDestPath( aDestURL
, mxEnvironment
.get(), comphelper::getProcessComponentContext() );
259 ucbhelper::Content
aSrc ( aSourceURL
, mxEnvironment
.get(), comphelper::getProcessComponentContext() );
263 aDestPath
.transferContent(aSrc
,
265 ? ucbhelper::InsertOperation::Move
266 : ucbhelper::InsertOperation::Copy
,
268 css::ucb::NameClash::OVERWRITE
);
270 catch ( css::ucb::CommandFailedException
const & )
272 // Interaction Handler already handled the error that has occurred...
276 void OFileAccess::copy( const OUString
& SourceURL
, const OUString
& DestURL
)
278 transferImpl( SourceURL
, DestURL
, false );
281 void OFileAccess::move( const OUString
& SourceURL
, const OUString
& DestURL
)
283 transferImpl( SourceURL
, DestURL
, true );
286 void OFileAccess::kill( const OUString
& FileURL
)
288 // SfxContentHelper::Kill
289 INetURLObject
aDeleteObj( FileURL
, INetProtocol::File
);
290 ucbhelper::Content
aCnt( aDeleteObj
.GetMainURL( INetURLObject::DecodeMechanism::NONE
), mxEnvironment
.get(), comphelper::getProcessComponentContext() );
293 aCnt
.executeCommand( "delete", makeAny( true ) );
295 catch ( css::ucb::CommandFailedException
const & )
297 // Interaction Handler already handled the error that has occurred...
301 sal_Bool
OFileAccess::isFolder( const OUString
& FileURL
)
306 INetURLObject
aURLObj( FileURL
, INetProtocol::File
);
307 ucbhelper::Content
aCnt( aURLObj
.GetMainURL( INetURLObject::DecodeMechanism::NONE
), mxEnvironment
.get(), comphelper::getProcessComponentContext() );
308 bRet
= aCnt
.isFolder();
310 catch (const Exception
&) {}
314 sal_Bool
OFileAccess::isReadOnly( const OUString
& FileURL
)
316 INetURLObject
aURLObj( FileURL
, INetProtocol::File
);
317 ucbhelper::Content
aCnt( aURLObj
.GetMainURL( INetURLObject::DecodeMechanism::NONE
), mxEnvironment
.get(), comphelper::getProcessComponentContext() );
318 Any aRetAny
= aCnt
.getPropertyValue("IsReadOnly");
324 void OFileAccess::setReadOnly( const OUString
& FileURL
, sal_Bool bReadOnly
)
326 INetURLObject
aURLObj( FileURL
, INetProtocol::File
);
327 ucbhelper::Content
aCnt( aURLObj
.GetMainURL( INetURLObject::DecodeMechanism::NONE
), mxEnvironment
.get(), comphelper::getProcessComponentContext() );
328 aCnt
.setPropertyValue("IsReadOnly", Any(bReadOnly
) );
331 void OFileAccess::createFolder( const OUString
& NewFolderURL
)
333 // Does the folder already exist?
334 if( NewFolderURL
.isEmpty() || isFolder( NewFolderURL
) )
337 // SfxContentHelper::MakeFolder
338 INetURLObject
aURL( NewFolderURL
, INetProtocol::File
);
339 OUString aTitle
= aURL
.getName( INetURLObject::LAST_SEGMENT
, true, INetURLObject::DecodeMechanism::WithCharset
);
340 if ( !aTitle
.isEmpty() )
342 aURL
.removeSegment();
344 // Does the base folder exist? Otherwise create it first
345 OUString aBaseFolderURLStr
= aURL
.GetMainURL( INetURLObject::DecodeMechanism::NONE
);
346 if( !isFolder( aBaseFolderURLStr
) )
348 createFolder( aBaseFolderURLStr
);
352 ucbhelper::Content
aCnt( aURL
.GetMainURL( INetURLObject::DecodeMechanism::NONE
), mxEnvironment
.get(), comphelper::getProcessComponentContext() );
354 const Sequence
< ContentInfo
> aInfo
= aCnt
.queryCreatableContentsInfo();
356 for ( const ContentInfo
& rCurr
: aInfo
)
358 // Simply look for the first KIND_FOLDER...
359 if ( rCurr
.Attributes
& ContentInfoAttribute::KIND_FOLDER
)
361 // Make sure the only required bootstrap property is "Title",
362 const Sequence
< Property
> & rProps
= rCurr
.Properties
;
363 if ( rProps
.getLength() != 1 )
366 if ( rProps
[ 0 ].Name
!= "Title" )
369 Sequence
<OUString
> aNames
{ "Title" };
370 Sequence
< Any
> aValues(1);
371 Any
* pValues
= aValues
.getArray();
372 pValues
[0] <<= aTitle
;
374 ucbhelper::Content aNew
;
377 if ( !aCnt
.insertNewContent( rCurr
.Type
, aNames
, aValues
, aNew
) )
380 // Success. We're done.
383 catch ( css::ucb::CommandFailedException
const & )
385 // Interaction Handler already handled the error that has occurred...
392 sal_Int32
OFileAccess::getSize( const OUString
& FileURL
)
394 // SfxContentHelper::GetSize
397 INetURLObject
aObj( FileURL
, INetProtocol::File
);
398 ucbhelper::Content
aCnt( aObj
.GetMainURL( INetURLObject::DecodeMechanism::NONE
), mxEnvironment
.get(), comphelper::getProcessComponentContext() );
399 aCnt
.getPropertyValue( "Size" ) >>= nTemp
;
400 nSize
= static_cast<sal_Int32
>(nTemp
);
404 OUString
OFileAccess::getContentType( const OUString
& FileURL
)
406 INetURLObject
aObj( FileURL
, INetProtocol::File
);
407 ucbhelper::Content
aCnt( aObj
.GetMainURL( INetURLObject::DecodeMechanism::NONE
), mxEnvironment
.get(), comphelper::getProcessComponentContext() );
409 Reference
< XContent
> xContent
= aCnt
.get();
410 OUString aTypeStr
= xContent
->getContentType();
414 css::util::DateTime
OFileAccess::getDateTimeModified( const OUString
& FileURL
)
416 INetURLObject
aFileObj( FileURL
, INetProtocol::File
);
417 css::util::DateTime aDateTime
;
419 Reference
< XCommandEnvironment
> aCmdEnv
;
420 ucbhelper::Content
aYoung( aFileObj
.GetMainURL( INetURLObject::DecodeMechanism::NONE
), aCmdEnv
, comphelper::getProcessComponentContext() );
421 aYoung
.getPropertyValue("DateModified") >>= aDateTime
;
425 Sequence
< OUString
> OFileAccess::getFolderContents( const OUString
& FolderURL
, sal_Bool bIncludeFolders
)
427 // SfxContentHelper::GetFolderContents
429 std::vector
<OUString
> aFiles
;
430 INetURLObject
aFolderObj( FolderURL
, INetProtocol::File
);
432 ucbhelper::Content
aCnt( aFolderObj
.GetMainURL( INetURLObject::DecodeMechanism::NONE
), mxEnvironment
.get(), comphelper::getProcessComponentContext() );
433 Reference
< XResultSet
> xResultSet
;
434 Sequence
< OUString
> aProps(0);
436 ucbhelper::ResultSetInclude eInclude
= bIncludeFolders
? ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS
: ucbhelper::INCLUDE_DOCUMENTS_ONLY
;
440 xResultSet
= aCnt
.createCursor( aProps
, eInclude
);
442 catch ( css::ucb::CommandFailedException
const & )
444 // Interaction Handler already handled the error that has occurred...
447 if ( xResultSet
.is() )
449 Reference
< css::ucb::XContentAccess
> xContentAccess( xResultSet
, UNO_QUERY
);
451 while ( xResultSet
->next() )
453 OUString aId
= xContentAccess
->queryContentIdentifierString();
454 INetURLObject
aURL( aId
, INetProtocol::File
);
455 aFiles
.push_back( aURL
.GetMainURL( INetURLObject::DecodeMechanism::NONE
) );
459 return comphelper::containerToSequence(aFiles
);
462 sal_Bool
OFileAccess::exists( const OUString
& FileURL
)
467 bRet
= isFolder( FileURL
);
470 Reference
< XInputStream
> xStream
= openFileRead( FileURL
);
473 xStream
->closeInput();
476 catch (const Exception
&) {}
480 Reference
< XInputStream
> OFileAccess::openFileRead( const OUString
& FileURL
)
482 Reference
< XInputStream
> xRet
;
483 INetURLObject
aObj( FileURL
, INetProtocol::File
);
484 ucbhelper::Content
aCnt( aObj
.GetMainURL( INetURLObject::DecodeMechanism::NONE
), mxEnvironment
.get(), comphelper::getProcessComponentContext() );
486 Reference
<XActiveDataSink
> xSink
= new OActiveDataSink
;
490 bool bRet
= aCnt
.openStream( xSink
);
492 xRet
= xSink
->getInputStream();
494 catch ( css::ucb::CommandFailedException
const & )
496 // Interaction Handler already handled the error that has occurred...
502 Reference
< XOutputStream
> OFileAccess::openFileWrite( const OUString
& FileURL
)
504 Reference
< XOutputStream
> xRet
;
505 Reference
< XStream
> xStream
= OFileAccess::openFileReadWrite( FileURL
);
507 xRet
= xStream
->getOutputStream();
511 Reference
< XStream
> OFileAccess::openFileReadWrite( const OUString
& FileURL
)
513 Reference
<XActiveDataStreamer
> xSink
= new OActiveDataStreamer
;
515 OpenCommandArgument2 aArg
;
516 aArg
.Mode
= OpenMode::DOCUMENT
;
517 aArg
.Priority
= 0; // unused
519 aArg
.Properties
= Sequence
< Property
>( 0 ); // unused
524 INetURLObject
aFileObj( FileURL
, INetProtocol::File
);
525 ucbhelper::Content
aCnt( aFileObj
.GetMainURL( INetURLObject::DecodeMechanism::NONE
), mxEnvironment
.get(), comphelper::getProcessComponentContext() );
528 Reference
< XInteractionHandler
> xIH
;
529 if ( mxEnvironment
.is() )
531 xIH
= mxEnvironment
->getInteractionHandler();
532 mxEnvironment
->setHandler( nullptr );
537 aCnt
.executeCommand( "open", aCmdArg
);
539 catch ( InteractiveIOException
const & e
)
541 if ( xIH
.is() && mxEnvironment
.is() )
542 mxEnvironment
->setHandler( xIH
);
544 if ( e
.Code
== IOErrorCode_NOT_EXISTING
)
547 SvMemoryStream
aStream(0,0);
548 ::utl::OInputStreamWrapper
* pInput
= new ::utl::OInputStreamWrapper( aStream
);
549 Reference
< XInputStream
> xInput( pInput
);
550 InsertCommandArgument aInsertArg
;
551 aInsertArg
.Data
= xInput
;
552 aInsertArg
.ReplaceExisting
= false;
554 aCmdArg
<<= aInsertArg
;
555 aCnt
.executeCommand( "insert", aCmdArg
);
558 return openFileReadWrite( FileURL
);
564 if ( xIH
.is() && mxEnvironment
.is() )
565 mxEnvironment
->setHandler( xIH
);
567 Reference
< XStream
> xRet
= xSink
->getStream();
571 void OFileAccess::setInteractionHandler( const Reference
< XInteractionHandler
>& Handler
)
573 if( !mxEnvironment
.is() )
575 mxEnvironment
= new OCommandEnvironment
;
577 mxEnvironment
->setHandler( Handler
);
580 bool OFileAccess::createNewFile( const OUString
& rParentURL
,
581 const OUString
& rTitle
,
582 const Reference
< XInputStream
>& data
)
584 ucbhelper::Content
aParentCnt( rParentURL
, mxEnvironment
.get(), comphelper::getProcessComponentContext() );
586 const Sequence
< ContentInfo
> aInfo
= aParentCnt
.queryCreatableContentsInfo();
588 for ( const ContentInfo
& rCurr
: aInfo
)
590 if ( ( rCurr
.Attributes
591 & ContentInfoAttribute::KIND_DOCUMENT
) &&
593 & ContentInfoAttribute::INSERT_WITH_INPUTSTREAM
) )
595 // Make sure the only required bootstrap property is
597 const Sequence
< Property
> & rProps
= rCurr
.Properties
;
598 if ( rProps
.getLength() != 1 )
601 if ( rProps
[ 0 ].Name
!= "Title" )
604 Sequence
<OUString
> aNames
{ "Title" };
605 Sequence
< Any
> aValues(1);
606 Any
* pValues
= aValues
.getArray();
607 pValues
[0] <<= rTitle
;
611 ucbhelper::Content aNew
;
612 if ( aParentCnt
.insertNewContent(
613 rCurr
.Type
, aNames
, aValues
, data
, aNew
) )
614 return true; // success.
618 catch ( CommandFailedException
const & )
620 // Interaction Handler already handled the
621 // error that has occurred...
630 void SAL_CALL
OFileAccess::writeFile( const OUString
& FileURL
,
631 const Reference
< XInputStream
>& data
)
633 INetURLObject
aURL( FileURL
, INetProtocol::File
);
636 ucbhelper::Content
aCnt(
637 aURL
.GetMainURL( INetURLObject::DecodeMechanism::NONE
), mxEnvironment
.get(),
638 comphelper::getProcessComponentContext() );
642 aCnt
.writeStream( data
, true /* bReplaceExisting */ );
644 catch ( CommandFailedException
const & )
646 // Interaction Handler already handled the error that has occurred...
649 catch ( ContentCreationException
const & e
)
651 // Most probably file does not exist. Try to create.
652 if ( e
.eError
== ContentCreationError_CONTENT_CREATION_FAILED
)
654 INetURLObject
aParentURLObj( aURL
);
655 if ( aParentURLObj
.removeSegment() )
658 = aParentURLObj
.GetMainURL( INetURLObject::DecodeMechanism::NONE
);
660 // ensure all parent folders exist.
661 createFolder( aParentURL
);
663 // create the new file...
665 = aURL
.getName( INetURLObject::LAST_SEGMENT
,
667 INetURLObject::DecodeMechanism::WithCharset
);
668 if ( createNewFile( aParentURL
, aTitle
, data
) )
680 sal_Bool
OFileAccess::isHidden( const OUString
& FileURL
)
682 INetURLObject
aURLObj( FileURL
, INetProtocol::File
);
683 ucbhelper::Content
aCnt( aURLObj
.GetMainURL( INetURLObject::DecodeMechanism::NONE
), mxEnvironment
.get(), comphelper::getProcessComponentContext() );
684 Any aRetAny
= aCnt
.getPropertyValue("IsHidden");
690 void OFileAccess::setHidden( const OUString
& FileURL
, sal_Bool bHidden
)
692 INetURLObject
aURLObj( FileURL
, INetProtocol::File
);
693 ucbhelper::Content
aCnt( aURLObj
.GetMainURL( INetURLObject::DecodeMechanism::NONE
), mxEnvironment
.get(), comphelper::getProcessComponentContext() );
694 aCnt
.setPropertyValue("IsHidden", Any(bHidden
) );
699 Reference
< XInterface
> FileAccess_CreateInstance( const Reference
< XMultiServiceFactory
> & xSMgr
)
701 return Reference
< XInterface
>( static_cast<cppu::OWeakObject
*>(new OFileAccess( comphelper::getComponentContext(xSMgr
) )) );
704 Sequence
< OUString
> FileAccess_getSupportedServiceNames()
706 Sequence
< OUString
> seqNames
{ SERVICE_NAME
};
710 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */