Bump version to 24.04.3.4
[LibreOffice.git] / ucb / source / core / FileAccess.cxx
blob889655dc3ef23c19caba5dda6df370b6d12d8876
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
54 #include <vector>
56 constexpr OUString SERVICE_NAME = u"com.sun.star.ucb.SimpleFileAccess"_ustr;
58 using namespace ::com::sun::star::uno;
59 using namespace ::com::sun::star::lang;
60 using namespace ::com::sun::star::io;
61 using namespace ::com::sun::star::ucb;
62 using namespace ::com::sun::star::sdbc;
63 using namespace ::com::sun::star::task;
64 using namespace ::com::sun::star::util;
65 using namespace ::com::sun::star::beans;
66 using namespace ::com::sun::star::registry;
67 using namespace ::com::sun::star::container;
69 using ::std::vector;
71 namespace
74 // Implementation XSimpleFileAccess
75 typedef cppu::WeakImplHelper<XSimpleFileAccess3, css::lang::XServiceInfo>
76 FileAccessHelper;
77 class OCommandEnvironment;
79 class OFileAccess : public FileAccessHelper
81 Reference< XComponentContext > m_xContext;
82 rtl::Reference<OCommandEnvironment> mxEnvironment;
84 /// @throws CommandAbortedException
85 /// @throws Exception
86 /// @throws RuntimeException
87 void transferImpl( const OUString& rSource, std::u16string_view rDest, bool bMoveData );
88 /// @throws Exception
89 bool createNewFile( const OUString & rParentURL,
90 const OUString & rTitle,
91 const Reference< XInputStream >& data );
93 public:
94 explicit OFileAccess( const Reference< XComponentContext > & xContext )
95 : m_xContext( xContext) {}
96 // Methods
97 virtual void SAL_CALL copy( const OUString& SourceURL, const OUString& DestURL ) override;
98 virtual void SAL_CALL move( const OUString& SourceURL, const OUString& DestURL ) override;
99 virtual void SAL_CALL kill( const OUString& FileURL ) override;
100 virtual sal_Bool SAL_CALL isFolder( const OUString& FileURL ) override;
101 virtual sal_Bool SAL_CALL isReadOnly( const OUString& FileURL ) override;
102 virtual void SAL_CALL setReadOnly( const OUString& FileURL, sal_Bool bReadOnly ) override;
103 virtual void SAL_CALL createFolder( const OUString& NewFolderURL ) override;
104 virtual sal_Int32 SAL_CALL getSize( const OUString& FileURL ) override;
105 virtual OUString SAL_CALL getContentType( const OUString& FileURL ) override;
106 virtual css::util::DateTime SAL_CALL getDateTimeModified( const OUString& FileURL ) override;
107 virtual css::uno::Sequence< OUString > SAL_CALL getFolderContents( const OUString& FolderURL, sal_Bool bIncludeFolders ) override;
108 virtual sal_Bool SAL_CALL exists( const OUString& FileURL ) override;
109 virtual css::uno::Reference< css::io::XInputStream > SAL_CALL openFileRead( const OUString& FileURL ) override;
110 virtual css::uno::Reference< css::io::XOutputStream > SAL_CALL openFileWrite( const OUString& FileURL ) override;
111 virtual css::uno::Reference< css::io::XStream > SAL_CALL openFileReadWrite( const OUString& FileURL ) override;
112 virtual void SAL_CALL setInteractionHandler( const css::uno::Reference< css::task::XInteractionHandler >& Handler ) override;
113 virtual void SAL_CALL writeFile( const OUString& FileURL, const css::uno::Reference< css::io::XInputStream >& data ) override;
114 virtual sal_Bool SAL_CALL isHidden( const OUString& FileURL ) override;
115 virtual void SAL_CALL setHidden( const OUString& FileURL, sal_Bool bHidden ) override;
117 OUString SAL_CALL getImplementationName() override
118 { return "com.sun.star.comp.ucb.SimpleFileAccess"; }
120 sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override
121 { return cppu::supportsService(this, ServiceName); }
123 css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override
124 { return { SERVICE_NAME }; }
127 // Implementation XActiveDataSink
129 class OActiveDataSink : public cppu::WeakImplHelper< XActiveDataSink >
131 Reference< XInputStream > mxStream;
133 public:
135 // Methods
136 virtual void SAL_CALL setInputStream( const Reference< XInputStream >& aStream ) override;
137 virtual Reference< XInputStream > SAL_CALL getInputStream( ) override;
140 // Implementation XActiveDataStreamer
142 class OActiveDataStreamer : public cppu::WeakImplHelper< XActiveDataStreamer >
144 Reference< XStream > mxStream;
146 public:
148 // Methods
149 virtual void SAL_CALL setStream( const Reference< XStream >& aStream ) override;
150 virtual Reference< XStream > SAL_CALL getStream() override;
153 // Implementation XCommandEnvironment
155 class OCommandEnvironment : public cppu::WeakImplHelper< XCommandEnvironment >
157 Reference< XInteractionHandler > mxInteraction;
159 public:
160 void setHandler( const Reference< XInteractionHandler >& xInteraction_ )
162 mxInteraction = xInteraction_;
165 // Methods
166 virtual Reference< XInteractionHandler > SAL_CALL getInteractionHandler() override;
167 virtual Reference< XProgressHandler > SAL_CALL getProgressHandler() override;
170 void OActiveDataSink::setInputStream( const Reference< XInputStream >& aStream )
172 mxStream = aStream;
175 Reference< XInputStream > OActiveDataSink::getInputStream()
177 return mxStream;
180 void OActiveDataStreamer::setStream( const Reference< XStream >& aStream )
182 mxStream = aStream;
185 Reference< XStream > OActiveDataStreamer::getStream()
187 return mxStream;
190 Reference< XInteractionHandler > OCommandEnvironment::getInteractionHandler()
192 return mxInteraction;
195 Reference< XProgressHandler > OCommandEnvironment::getProgressHandler()
197 Reference< XProgressHandler > xRet;
198 return xRet;
201 void OFileAccess::transferImpl( const OUString& rSource,
202 std::u16string_view rDest,
203 bool bMoveData )
205 // SfxContentHelper::Transfer_Impl
206 INetURLObject aSourceObj( rSource, INetProtocol::File );
207 INetURLObject aDestObj( rDest, INetProtocol::File );
208 OUString aName = aDestObj.getName(
209 INetURLObject::LAST_SEGMENT, true, INetURLObject::DecodeMechanism::WithCharset );
210 OUString aDestURL;
211 OUString aSourceURL = aSourceObj.GetMainURL( INetURLObject::DecodeMechanism::NONE );
212 if ( aDestObj.removeSegment() )
214 // hierarchical URL.
216 aDestObj.setFinalSlash();
217 aDestURL = aDestObj.GetMainURL( INetURLObject::DecodeMechanism::NONE );
219 else
221 // non-hierarchical URL
223 // #i29648#
226 if ( aDestObj.GetProtocol() == INetProtocol::VndSunStarExpand )
228 // Hack: Expand destination URL using Macro Expander and try again
229 // with the hopefully hierarchical expanded URL...
233 Reference< XMacroExpander > xExpander = theMacroExpander::get(m_xContext);
235 aDestURL = xExpander->expandMacros(
236 aDestObj.GetURLPath( INetURLObject::DecodeMechanism::WithCharset ) );
238 catch ( Exception const & )
240 css::uno::Any anyEx = cppu::getCaughtException();
241 throw css::lang::WrappedTargetRuntimeException(
242 "OFileAccess::transferrImpl - Unable to obtain destination folder URL!",
243 getXWeak(), anyEx );
246 transferImpl( rSource, aDestURL, bMoveData );
247 return;
250 throw RuntimeException(
251 "OFileAccess::transferrImpl - Unable to obtain destination folder URL!",
252 getXWeak() );
256 ucbhelper::Content aDestPath( aDestURL, mxEnvironment, comphelper::getProcessComponentContext() );
257 ucbhelper::Content aSrc ( aSourceURL, mxEnvironment, comphelper::getProcessComponentContext() );
261 aDestPath.transferContent(aSrc,
262 bMoveData
263 ? ucbhelper::InsertOperation::Move
264 : ucbhelper::InsertOperation::Copy,
265 aName,
266 css::ucb::NameClash::OVERWRITE);
268 catch ( css::ucb::CommandFailedException const & )
270 // Interaction Handler already handled the error that has occurred...
274 void OFileAccess::copy( const OUString& SourceURL, const OUString& DestURL )
276 transferImpl( SourceURL, DestURL, false );
279 void OFileAccess::move( const OUString& SourceURL, const OUString& DestURL )
281 transferImpl( SourceURL, DestURL, true );
284 void OFileAccess::kill( const OUString& FileURL )
286 // SfxContentHelper::Kill
287 INetURLObject aDeleteObj( FileURL, INetProtocol::File );
288 ucbhelper::Content aCnt( aDeleteObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ), mxEnvironment, comphelper::getProcessComponentContext() );
291 aCnt.executeCommand( "delete", Any( true ) );
293 catch ( css::ucb::CommandFailedException const & )
295 // Interaction Handler already handled the error that has occurred...
299 sal_Bool OFileAccess::isFolder( const OUString& FileURL )
301 bool bRet = false;
304 INetURLObject aURLObj( FileURL, INetProtocol::File );
305 ucbhelper::Content aCnt( aURLObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ), mxEnvironment, comphelper::getProcessComponentContext() );
306 bRet = aCnt.isFolder();
308 catch (const Exception &) {}
309 return bRet;
312 sal_Bool OFileAccess::isReadOnly( const OUString& FileURL )
314 INetURLObject aURLObj( FileURL, INetProtocol::File );
315 ucbhelper::Content aCnt( aURLObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ), mxEnvironment, comphelper::getProcessComponentContext() );
316 Any aRetAny = aCnt.getPropertyValue("IsReadOnly");
317 bool bRet = false;
318 aRetAny >>= bRet;
319 return bRet;
322 void OFileAccess::setReadOnly( const OUString& FileURL, sal_Bool bReadOnly )
324 INetURLObject aURLObj( FileURL, INetProtocol::File );
325 ucbhelper::Content aCnt( aURLObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ), mxEnvironment, comphelper::getProcessComponentContext() );
326 aCnt.setPropertyValue("IsReadOnly", Any(bReadOnly) );
329 void OFileAccess::createFolder( const OUString& NewFolderURL )
331 // Does the folder already exist?
332 if( NewFolderURL.isEmpty() || isFolder( NewFolderURL ) )
333 return;
335 // SfxContentHelper::MakeFolder
336 INetURLObject aURL( NewFolderURL, INetProtocol::File );
337 OUString aTitle = aURL.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DecodeMechanism::WithCharset );
338 if ( !aTitle.isEmpty() )
340 aURL.removeSegment();
342 // Does the base folder exist? Otherwise create it first
343 OUString aBaseFolderURLStr = aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE );
344 if( !isFolder( aBaseFolderURLStr ) )
346 createFolder( aBaseFolderURLStr );
350 ucbhelper::Content aCnt( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), mxEnvironment, comphelper::getProcessComponentContext() );
352 const Sequence< ContentInfo > aInfo = aCnt.queryCreatableContentsInfo();
354 for ( const ContentInfo & rCurr : aInfo )
356 // Simply look for the first KIND_FOLDER...
357 if ( rCurr.Attributes & ContentInfoAttribute::KIND_FOLDER )
359 // Make sure the only required bootstrap property is "Title",
360 const Sequence< Property > & rProps = rCurr.Properties;
361 if ( rProps.getLength() != 1 )
362 continue;
364 if ( rProps[ 0 ].Name != "Title" )
365 continue;
367 ucbhelper::Content aNew;
370 if ( !aCnt.insertNewContent( rCurr.Type, { "Title" }, { Any(aTitle) }, aNew ) )
371 continue;
373 // Success. We're done.
374 return;
376 catch ( css::ucb::CommandFailedException const & )
378 // Interaction Handler already handled the error that has occurred...
379 continue;
385 sal_Int32 OFileAccess::getSize( const OUString& FileURL )
387 // SfxContentHelper::GetSize
388 sal_Int32 nSize = 0;
389 sal_Int64 nTemp = 0;
390 INetURLObject aObj( FileURL, INetProtocol::File );
391 ucbhelper::Content aCnt( aObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ), mxEnvironment, comphelper::getProcessComponentContext() );
392 aCnt.getPropertyValue( "Size" ) >>= nTemp;
393 nSize = static_cast<sal_Int32>(nTemp);
394 return nSize;
397 OUString OFileAccess::getContentType( const OUString& FileURL )
399 INetURLObject aObj( FileURL, INetProtocol::File );
400 ucbhelper::Content aCnt( aObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ), mxEnvironment, comphelper::getProcessComponentContext() );
402 Reference< XContent > xContent = aCnt.get();
403 OUString aTypeStr = xContent->getContentType();
404 return aTypeStr;
407 css::util::DateTime OFileAccess::getDateTimeModified( const OUString& FileURL )
409 INetURLObject aFileObj( FileURL, INetProtocol::File );
410 css::util::DateTime aDateTime;
412 Reference< XCommandEnvironment > aCmdEnv;
413 ucbhelper::Content aYoung( aFileObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ), aCmdEnv, comphelper::getProcessComponentContext() );
414 aYoung.getPropertyValue("DateModified") >>= aDateTime;
415 return aDateTime;
418 Sequence< OUString > OFileAccess::getFolderContents( const OUString& FolderURL, sal_Bool bIncludeFolders )
420 // SfxContentHelper::GetFolderContents
422 std::vector<OUString> aFiles;
423 INetURLObject aFolderObj( FolderURL, INetProtocol::File );
425 ucbhelper::Content aCnt( aFolderObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ), mxEnvironment, comphelper::getProcessComponentContext() );
426 Reference< XResultSet > xResultSet;
428 ucbhelper::ResultSetInclude eInclude = bIncludeFolders ? ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS : ucbhelper::INCLUDE_DOCUMENTS_ONLY;
432 xResultSet = aCnt.createCursor( {}, eInclude );
434 catch ( css::ucb::CommandFailedException const & )
436 // Interaction Handler already handled the error that has occurred...
439 if ( xResultSet.is() )
441 Reference< css::ucb::XContentAccess > xContentAccess( xResultSet, UNO_QUERY );
443 while ( xResultSet->next() )
445 OUString aId = xContentAccess->queryContentIdentifierString();
446 INetURLObject aURL( aId, INetProtocol::File );
447 aFiles.push_back( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
451 return comphelper::containerToSequence(aFiles);
454 sal_Bool OFileAccess::exists( const OUString& FileURL )
456 bool bRet = false;
459 bRet = isFolder( FileURL );
460 if( !bRet )
462 Reference< XInputStream > xStream = openFileRead( FileURL );
463 bRet = xStream.is();
464 if( bRet )
465 xStream->closeInput();
468 catch (const Exception &) {}
469 return bRet;
472 Reference< XInputStream > OFileAccess::openFileRead( const OUString& FileURL )
474 Reference< XInputStream > xRet;
475 INetURLObject aObj( FileURL, INetProtocol::File );
476 ucbhelper::Content aCnt( aObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ), mxEnvironment, comphelper::getProcessComponentContext() );
478 Reference<XActiveDataSink> xSink = new OActiveDataSink;
482 bool bRet = aCnt.openStream( xSink );
483 if( bRet )
484 xRet = xSink->getInputStream();
486 catch ( css::ucb::CommandFailedException const & )
488 // Interaction Handler already handled the error that has occurred...
491 return xRet;
494 Reference< XOutputStream > OFileAccess::openFileWrite( const OUString& FileURL )
496 Reference< XOutputStream > xRet;
497 Reference< XStream > xStream = OFileAccess::openFileReadWrite( FileURL );
498 if( xStream.is() )
499 xRet = xStream->getOutputStream();
500 return xRet;
503 Reference< XStream > OFileAccess::openFileReadWrite( const OUString& FileURL )
505 Reference<XActiveDataStreamer> xSink = new OActiveDataStreamer;
507 OpenCommandArgument2 aArg;
508 aArg.Mode = OpenMode::DOCUMENT;
509 aArg.Priority = 0; // unused
510 aArg.Sink = xSink;
511 aArg.Properties = Sequence< Property >( 0 ); // unused
513 Any aCmdArg;
514 aCmdArg <<= aArg;
516 INetURLObject aFileObj( FileURL, INetProtocol::File );
517 ucbhelper::Content aCnt( aFileObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ), mxEnvironment, comphelper::getProcessComponentContext() );
519 // Be silent...
520 Reference< XInteractionHandler > xIH;
521 if ( mxEnvironment.is() )
523 xIH = mxEnvironment->getInteractionHandler();
524 mxEnvironment->setHandler( nullptr );
529 aCnt.executeCommand( "open", aCmdArg );
531 catch ( InteractiveIOException const & e )
533 if ( xIH.is() && mxEnvironment.is() )
534 mxEnvironment->setHandler( xIH );
536 if ( e.Code == IOErrorCode_NOT_EXISTING )
538 // Create file...
539 SvMemoryStream aStream(0,0);
540 rtl::Reference<::utl::OInputStreamWrapper> pInput = new ::utl::OInputStreamWrapper( aStream );
541 InsertCommandArgument aInsertArg;
542 aInsertArg.Data = pInput;
543 aInsertArg.ReplaceExisting = false;
545 aCmdArg <<= aInsertArg;
546 aCnt.executeCommand( "insert", aCmdArg );
548 // Retry...
549 return openFileReadWrite( FileURL );
552 throw;
555 if ( xIH.is() && mxEnvironment.is() )
556 mxEnvironment->setHandler( xIH );
558 Reference< XStream > xRet = xSink->getStream();
559 return xRet;
562 void OFileAccess::setInteractionHandler( const Reference< XInteractionHandler >& Handler )
564 if( !mxEnvironment.is() )
566 mxEnvironment = new OCommandEnvironment;
568 mxEnvironment->setHandler( Handler );
571 bool OFileAccess::createNewFile( const OUString & rParentURL,
572 const OUString & rTitle,
573 const Reference< XInputStream >& data )
575 ucbhelper::Content aParentCnt( rParentURL, mxEnvironment, comphelper::getProcessComponentContext() );
577 const Sequence< ContentInfo > aInfo = aParentCnt.queryCreatableContentsInfo();
579 for ( const ContentInfo & rCurr : aInfo )
581 if ( ( rCurr.Attributes
582 & ContentInfoAttribute::KIND_DOCUMENT ) &&
583 ( rCurr.Attributes
584 & ContentInfoAttribute::INSERT_WITH_INPUTSTREAM ) )
586 // Make sure the only required bootstrap property is
587 // "Title",
588 const Sequence< Property > & rProps = rCurr.Properties;
589 if ( rProps.getLength() != 1 )
590 continue;
592 if ( rProps[ 0 ].Name != "Title" )
593 continue;
597 ucbhelper::Content aNew;
598 if ( aParentCnt.insertNewContent(
599 rCurr.Type, { "Title" }, { Any(rTitle) }, data, aNew ) )
600 return true; // success.
601 else
602 continue;
604 catch ( CommandFailedException const & )
606 // Interaction Handler already handled the
607 // error that has occurred...
608 continue;
613 return false;
616 void SAL_CALL OFileAccess::writeFile( const OUString& FileURL,
617 const Reference< XInputStream >& data )
619 INetURLObject aURL( FileURL, INetProtocol::File );
622 ucbhelper::Content aCnt(
623 aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), mxEnvironment,
624 comphelper::getProcessComponentContext() );
628 aCnt.writeStream( data, true /* bReplaceExisting */ );
630 catch ( CommandFailedException const & )
632 // Interaction Handler already handled the error that has occurred...
635 catch ( ContentCreationException const & e )
637 // Most probably file does not exist. Try to create.
638 if ( e.eError == ContentCreationError_CONTENT_CREATION_FAILED )
640 INetURLObject aParentURLObj( aURL );
641 if ( aParentURLObj.removeSegment() )
643 OUString aParentURL
644 = aParentURLObj.GetMainURL( INetURLObject::DecodeMechanism::NONE );
646 // ensure all parent folders exist.
647 createFolder( aParentURL );
649 // create the new file...
650 OUString aTitle
651 = aURL.getName( INetURLObject::LAST_SEGMENT,
652 true,
653 INetURLObject::DecodeMechanism::WithCharset );
654 if ( createNewFile( aParentURL, aTitle, data ) )
656 // success
657 return;
662 throw;
666 sal_Bool OFileAccess::isHidden( const OUString& FileURL )
668 INetURLObject aURLObj( FileURL, INetProtocol::File );
669 ucbhelper::Content aCnt( aURLObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ), mxEnvironment, comphelper::getProcessComponentContext() );
670 Any aRetAny = aCnt.getPropertyValue("IsHidden");
671 bool bRet = false;
672 aRetAny >>= bRet;
673 return bRet;
676 void OFileAccess::setHidden( const OUString& FileURL, sal_Bool bHidden )
678 INetURLObject aURLObj( FileURL, INetProtocol::File );
679 ucbhelper::Content aCnt( aURLObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ), mxEnvironment, comphelper::getProcessComponentContext() );
680 aCnt.setPropertyValue("IsHidden", Any(bHidden) );
684 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
685 ucb_OFileAccess_get_implementation(
686 css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&)
688 return cppu::acquire(new OFileAccess(context));
691 }; // namespace end
694 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */