tdf#130857 qt weld: Support mail merge "Server Auth" dialog
[LibreOffice.git] / ucb / source / core / FileAccess.cxx
blobca7752378a9def7ad18644a7c723c5810ecc0ed7
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;
67 using ::std::vector;
69 namespace
72 // Implementation XSimpleFileAccess
73 typedef cppu::WeakImplHelper<XSimpleFileAccess3, css::lang::XServiceInfo>
74 FileAccessHelper;
75 class OCommandEnvironment;
77 class OFileAccess : public FileAccessHelper
79 Reference< XComponentContext > m_xContext;
80 rtl::Reference<OCommandEnvironment> mxEnvironment;
82 /// @throws CommandAbortedException
83 /// @throws Exception
84 /// @throws RuntimeException
85 void transferImpl( const OUString& rSource, std::u16string_view rDest, bool bMoveData );
86 /// @throws Exception
87 bool createNewFile( const OUString & rParentURL,
88 const OUString & rTitle,
89 const Reference< XInputStream >& data );
91 public:
92 explicit OFileAccess( const Reference< XComponentContext > & xContext )
93 : m_xContext( xContext) {}
94 // Methods
95 virtual void SAL_CALL copy( const OUString& SourceURL, const OUString& DestURL ) override;
96 virtual void SAL_CALL move( const OUString& SourceURL, const OUString& DestURL ) override;
97 virtual void SAL_CALL kill( const OUString& FileURL ) override;
98 virtual sal_Bool SAL_CALL isFolder( const OUString& FileURL ) override;
99 virtual sal_Bool SAL_CALL isReadOnly( const OUString& FileURL ) override;
100 virtual void SAL_CALL setReadOnly( const OUString& FileURL, sal_Bool bReadOnly ) override;
101 virtual void SAL_CALL createFolder( const OUString& NewFolderURL ) override;
102 virtual sal_Int32 SAL_CALL getSize( const OUString& FileURL ) override;
103 virtual OUString SAL_CALL getContentType( const OUString& FileURL ) override;
104 virtual css::util::DateTime SAL_CALL getDateTimeModified( const OUString& FileURL ) override;
105 virtual css::uno::Sequence< OUString > SAL_CALL getFolderContents( const OUString& FolderURL, sal_Bool bIncludeFolders ) override;
106 virtual sal_Bool SAL_CALL exists( const OUString& FileURL ) override;
107 virtual css::uno::Reference< css::io::XInputStream > SAL_CALL openFileRead( const OUString& FileURL ) override;
108 virtual css::uno::Reference< css::io::XOutputStream > SAL_CALL openFileWrite( const OUString& FileURL ) override;
109 virtual css::uno::Reference< css::io::XStream > SAL_CALL openFileReadWrite( const OUString& FileURL ) override;
110 virtual void SAL_CALL setInteractionHandler( const css::uno::Reference< css::task::XInteractionHandler >& Handler ) override;
111 virtual void SAL_CALL writeFile( const OUString& FileURL, const css::uno::Reference< css::io::XInputStream >& data ) override;
112 virtual sal_Bool SAL_CALL isHidden( const OUString& FileURL ) override;
113 virtual void SAL_CALL setHidden( const OUString& FileURL, sal_Bool bHidden ) override;
115 OUString SAL_CALL getImplementationName() override
116 { return u"com.sun.star.comp.ucb.SimpleFileAccess"_ustr; }
118 sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override
119 { return cppu::supportsService(this, ServiceName); }
121 css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override
122 { return { SERVICE_NAME }; }
125 // Implementation XActiveDataSink
127 class OActiveDataSink : public cppu::WeakImplHelper< XActiveDataSink >
129 Reference< XInputStream > mxStream;
131 public:
133 // Methods
134 virtual void SAL_CALL setInputStream( const Reference< XInputStream >& aStream ) override;
135 virtual Reference< XInputStream > SAL_CALL getInputStream( ) override;
138 // Implementation XActiveDataStreamer
140 class OActiveDataStreamer : public cppu::WeakImplHelper< XActiveDataStreamer >
142 Reference< XStream > mxStream;
144 public:
146 // Methods
147 virtual void SAL_CALL setStream( const Reference< XStream >& aStream ) override;
148 virtual Reference< XStream > SAL_CALL getStream() override;
151 // Implementation XCommandEnvironment
153 class OCommandEnvironment : public cppu::WeakImplHelper< XCommandEnvironment >
155 Reference< XInteractionHandler > mxInteraction;
157 public:
158 void setHandler( const Reference< XInteractionHandler >& xInteraction_ )
160 mxInteraction = xInteraction_;
163 // Methods
164 virtual Reference< XInteractionHandler > SAL_CALL getInteractionHandler() override;
165 virtual Reference< XProgressHandler > SAL_CALL getProgressHandler() override;
168 void OActiveDataSink::setInputStream( const Reference< XInputStream >& aStream )
170 mxStream = aStream;
173 Reference< XInputStream > OActiveDataSink::getInputStream()
175 return mxStream;
178 void OActiveDataStreamer::setStream( const Reference< XStream >& aStream )
180 mxStream = aStream;
183 Reference< XStream > OActiveDataStreamer::getStream()
185 return mxStream;
188 Reference< XInteractionHandler > OCommandEnvironment::getInteractionHandler()
190 return mxInteraction;
193 Reference< XProgressHandler > OCommandEnvironment::getProgressHandler()
195 Reference< XProgressHandler > xRet;
196 return xRet;
199 void OFileAccess::transferImpl( const OUString& rSource,
200 std::u16string_view rDest,
201 bool bMoveData )
203 // SfxContentHelper::Transfer_Impl
204 INetURLObject aSourceObj( rSource, INetProtocol::File );
205 INetURLObject aDestObj( rDest, INetProtocol::File );
206 OUString aName = aDestObj.getName(
207 INetURLObject::LAST_SEGMENT, true, INetURLObject::DecodeMechanism::WithCharset );
208 OUString aDestURL;
209 OUString aSourceURL = aSourceObj.GetMainURL( INetURLObject::DecodeMechanism::NONE );
210 if ( aDestObj.removeSegment() )
212 // hierarchical URL.
214 aDestObj.setFinalSlash();
215 aDestURL = aDestObj.GetMainURL( INetURLObject::DecodeMechanism::NONE );
217 else
219 // non-hierarchical URL
221 // #i29648#
224 if ( aDestObj.GetProtocol() == INetProtocol::VndSunStarExpand )
226 // Hack: Expand destination URL using Macro Expander and try again
227 // with the hopefully hierarchical expanded URL...
231 Reference< XMacroExpander > xExpander = theMacroExpander::get(m_xContext);
233 aDestURL = xExpander->expandMacros(
234 aDestObj.GetURLPath( INetURLObject::DecodeMechanism::WithCharset ) );
236 catch ( Exception const & )
238 css::uno::Any anyEx = cppu::getCaughtException();
239 throw css::lang::WrappedTargetRuntimeException(
240 u"OFileAccess::transferrImpl - Unable to obtain destination folder URL!"_ustr,
241 getXWeak(), anyEx );
244 transferImpl( rSource, aDestURL, bMoveData );
245 return;
248 throw RuntimeException(
249 u"OFileAccess::transferrImpl - Unable to obtain destination folder URL!"_ustr,
250 getXWeak() );
254 ucbhelper::Content aDestPath( aDestURL, mxEnvironment, comphelper::getProcessComponentContext() );
255 ucbhelper::Content aSrc ( aSourceURL, mxEnvironment, comphelper::getProcessComponentContext() );
259 aDestPath.transferContent(aSrc,
260 bMoveData
261 ? ucbhelper::InsertOperation::Move
262 : ucbhelper::InsertOperation::Copy,
263 aName,
264 css::ucb::NameClash::OVERWRITE);
266 catch ( css::ucb::CommandFailedException const & )
268 // Interaction Handler already handled the error that has occurred...
272 void OFileAccess::copy( const OUString& SourceURL, const OUString& DestURL )
274 transferImpl( SourceURL, DestURL, false );
277 void OFileAccess::move( const OUString& SourceURL, const OUString& DestURL )
279 transferImpl( SourceURL, DestURL, true );
282 void OFileAccess::kill( const OUString& FileURL )
284 // SfxContentHelper::Kill
285 INetURLObject aDeleteObj( FileURL, INetProtocol::File );
286 ucbhelper::Content aCnt( aDeleteObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ), mxEnvironment, comphelper::getProcessComponentContext() );
289 aCnt.executeCommand( u"delete"_ustr, Any( true ) );
291 catch ( css::ucb::CommandFailedException const & )
293 // Interaction Handler already handled the error that has occurred...
297 sal_Bool OFileAccess::isFolder( const OUString& FileURL )
299 bool bRet = false;
302 INetURLObject aURLObj( FileURL, INetProtocol::File );
303 ucbhelper::Content aCnt( aURLObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ), mxEnvironment, comphelper::getProcessComponentContext() );
304 bRet = aCnt.isFolder();
306 catch (const Exception &) {}
307 return bRet;
310 sal_Bool OFileAccess::isReadOnly( const OUString& FileURL )
312 INetURLObject aURLObj( FileURL, INetProtocol::File );
313 ucbhelper::Content aCnt( aURLObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ), mxEnvironment, comphelper::getProcessComponentContext() );
314 Any aRetAny = aCnt.getPropertyValue(u"IsReadOnly"_ustr);
315 bool bRet = false;
316 aRetAny >>= bRet;
317 return bRet;
320 void OFileAccess::setReadOnly( const OUString& FileURL, sal_Bool bReadOnly )
322 INetURLObject aURLObj( FileURL, INetProtocol::File );
323 ucbhelper::Content aCnt( aURLObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ), mxEnvironment, comphelper::getProcessComponentContext() );
324 aCnt.setPropertyValue(u"IsReadOnly"_ustr, Any(bReadOnly) );
327 void OFileAccess::createFolder( const OUString& NewFolderURL )
329 // Does the folder already exist?
330 if( NewFolderURL.isEmpty() || isFolder( NewFolderURL ) )
331 return;
333 // SfxContentHelper::MakeFolder
334 INetURLObject aURL( NewFolderURL, INetProtocol::File );
335 OUString aTitle = aURL.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DecodeMechanism::WithCharset );
336 if ( !aTitle.isEmpty() )
338 aURL.removeSegment();
340 // Does the base folder exist? Otherwise create it first
341 OUString aBaseFolderURLStr = aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE );
342 if( !isFolder( aBaseFolderURLStr ) )
344 createFolder( aBaseFolderURLStr );
348 ucbhelper::Content aCnt( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), mxEnvironment, comphelper::getProcessComponentContext() );
350 const Sequence< ContentInfo > aInfo = aCnt.queryCreatableContentsInfo();
352 for ( const ContentInfo & rCurr : aInfo )
354 // Simply look for the first KIND_FOLDER...
355 if ( rCurr.Attributes & ContentInfoAttribute::KIND_FOLDER )
357 // Make sure the only required bootstrap property is "Title",
358 const Sequence< Property > & rProps = rCurr.Properties;
359 if ( rProps.getLength() != 1 )
360 continue;
362 if ( rProps[ 0 ].Name != "Title" )
363 continue;
365 ucbhelper::Content aNew;
368 if ( !aCnt.insertNewContent( rCurr.Type, { u"Title"_ustr }, { Any(aTitle) }, aNew ) )
369 continue;
371 // Success. We're done.
372 return;
374 catch ( css::ucb::CommandFailedException const & )
376 // Interaction Handler already handled the error that has occurred...
377 continue;
383 sal_Int32 OFileAccess::getSize( const OUString& FileURL )
385 // SfxContentHelper::GetSize
386 sal_Int32 nSize = 0;
387 sal_Int64 nTemp = 0;
388 INetURLObject aObj( FileURL, INetProtocol::File );
389 ucbhelper::Content aCnt( aObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ), mxEnvironment, comphelper::getProcessComponentContext() );
390 aCnt.getPropertyValue( u"Size"_ustr ) >>= nTemp;
391 nSize = static_cast<sal_Int32>(nTemp);
392 return nSize;
395 OUString OFileAccess::getContentType( const OUString& FileURL )
397 INetURLObject aObj( FileURL, INetProtocol::File );
398 ucbhelper::Content aCnt( aObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ), mxEnvironment, comphelper::getProcessComponentContext() );
400 Reference< XContent > xContent = aCnt.get();
401 OUString aTypeStr = xContent->getContentType();
402 return aTypeStr;
405 css::util::DateTime OFileAccess::getDateTimeModified( const OUString& FileURL )
407 INetURLObject aFileObj( FileURL, INetProtocol::File );
408 css::util::DateTime aDateTime;
410 Reference< XCommandEnvironment > aCmdEnv;
411 ucbhelper::Content aYoung( aFileObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ), aCmdEnv, comphelper::getProcessComponentContext() );
412 aYoung.getPropertyValue(u"DateModified"_ustr) >>= aDateTime;
413 return aDateTime;
416 Sequence< OUString > OFileAccess::getFolderContents( const OUString& FolderURL, sal_Bool bIncludeFolders )
418 // SfxContentHelper::GetFolderContents
420 std::vector<OUString> aFiles;
421 INetURLObject aFolderObj( FolderURL, INetProtocol::File );
423 ucbhelper::Content aCnt( aFolderObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ), mxEnvironment, comphelper::getProcessComponentContext() );
424 Reference< XResultSet > xResultSet;
426 ucbhelper::ResultSetInclude eInclude = bIncludeFolders ? ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS : ucbhelper::INCLUDE_DOCUMENTS_ONLY;
430 xResultSet = aCnt.createCursor( {}, eInclude );
432 catch ( css::ucb::CommandFailedException const & )
434 // Interaction Handler already handled the error that has occurred...
437 if ( xResultSet.is() )
439 Reference< css::ucb::XContentAccess > xContentAccess( xResultSet, UNO_QUERY );
441 while ( xResultSet->next() )
443 OUString aId = xContentAccess->queryContentIdentifierString();
444 INetURLObject aURL( aId, INetProtocol::File );
445 aFiles.push_back( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
449 return comphelper::containerToSequence(aFiles);
452 sal_Bool OFileAccess::exists( const OUString& FileURL )
454 bool bRet = false;
457 bRet = isFolder( FileURL );
458 if( !bRet )
460 Reference< XInputStream > xStream = openFileRead( FileURL );
461 bRet = xStream.is();
462 if( bRet )
463 xStream->closeInput();
466 catch (const Exception &) {}
467 return bRet;
470 Reference< XInputStream > OFileAccess::openFileRead( const OUString& FileURL )
472 Reference< XInputStream > xRet;
473 INetURLObject aObj( FileURL, INetProtocol::File );
474 ucbhelper::Content aCnt( aObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ), mxEnvironment, comphelper::getProcessComponentContext() );
476 Reference<XActiveDataSink> xSink = new OActiveDataSink;
480 bool bRet = aCnt.openStream( xSink );
481 if( bRet )
482 xRet = xSink->getInputStream();
484 catch ( css::ucb::CommandFailedException const & )
486 // Interaction Handler already handled the error that has occurred...
489 return xRet;
492 Reference< XOutputStream > OFileAccess::openFileWrite( const OUString& FileURL )
494 Reference< XOutputStream > xRet;
495 Reference< XStream > xStream = OFileAccess::openFileReadWrite( FileURL );
496 if( xStream.is() )
497 xRet = xStream->getOutputStream();
498 return xRet;
501 Reference< XStream > OFileAccess::openFileReadWrite( const OUString& FileURL )
503 Reference<XActiveDataStreamer> xSink = new OActiveDataStreamer;
505 OpenCommandArgument2 aArg;
506 aArg.Mode = OpenMode::DOCUMENT;
507 aArg.Priority = 0; // unused
508 aArg.Sink = xSink;
509 aArg.Properties = Sequence< Property >( 0 ); // unused
511 Any aCmdArg;
512 aCmdArg <<= aArg;
514 INetURLObject aFileObj( FileURL, INetProtocol::File );
515 ucbhelper::Content aCnt( aFileObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ), mxEnvironment, comphelper::getProcessComponentContext() );
517 // Be silent...
518 Reference< XInteractionHandler > xIH;
519 if ( mxEnvironment.is() )
521 xIH = mxEnvironment->getInteractionHandler();
522 mxEnvironment->setHandler( nullptr );
527 aCnt.executeCommand( u"open"_ustr, aCmdArg );
529 catch ( InteractiveIOException const & e )
531 if ( xIH.is() && mxEnvironment.is() )
532 mxEnvironment->setHandler( xIH );
534 if ( e.Code == IOErrorCode_NOT_EXISTING )
536 // Create file...
537 SvMemoryStream aStream(0,0);
538 rtl::Reference<::utl::OInputStreamWrapper> pInput = new ::utl::OInputStreamWrapper( aStream );
539 InsertCommandArgument aInsertArg;
540 aInsertArg.Data = pInput;
541 aInsertArg.ReplaceExisting = false;
543 aCmdArg <<= aInsertArg;
544 aCnt.executeCommand( u"insert"_ustr, aCmdArg );
546 // Retry...
547 return openFileReadWrite( FileURL );
550 throw;
553 if ( xIH.is() && mxEnvironment.is() )
554 mxEnvironment->setHandler( xIH );
556 Reference< XStream > xRet = xSink->getStream();
557 return xRet;
560 void OFileAccess::setInteractionHandler( const Reference< XInteractionHandler >& Handler )
562 if( !mxEnvironment.is() )
564 mxEnvironment = new OCommandEnvironment;
566 mxEnvironment->setHandler( Handler );
569 bool OFileAccess::createNewFile( const OUString & rParentURL,
570 const OUString & rTitle,
571 const Reference< XInputStream >& data )
573 ucbhelper::Content aParentCnt( rParentURL, mxEnvironment, comphelper::getProcessComponentContext() );
575 const Sequence< ContentInfo > aInfo = aParentCnt.queryCreatableContentsInfo();
577 for ( const ContentInfo & rCurr : aInfo )
579 if ( ( rCurr.Attributes
580 & ContentInfoAttribute::KIND_DOCUMENT ) &&
581 ( rCurr.Attributes
582 & ContentInfoAttribute::INSERT_WITH_INPUTSTREAM ) )
584 // Make sure the only required bootstrap property is
585 // "Title",
586 const Sequence< Property > & rProps = rCurr.Properties;
587 if ( rProps.getLength() != 1 )
588 continue;
590 if ( rProps[ 0 ].Name != "Title" )
591 continue;
595 ucbhelper::Content aNew;
596 if ( aParentCnt.insertNewContent(
597 rCurr.Type, { u"Title"_ustr }, { Any(rTitle) }, data, aNew ) )
598 return true; // success.
599 else
600 continue;
602 catch ( CommandFailedException const & )
604 // Interaction Handler already handled the
605 // error that has occurred...
606 continue;
611 return false;
614 void SAL_CALL OFileAccess::writeFile( const OUString& FileURL,
615 const Reference< XInputStream >& data )
617 INetURLObject aURL( FileURL, INetProtocol::File );
620 ucbhelper::Content aCnt(
621 aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), mxEnvironment,
622 comphelper::getProcessComponentContext() );
626 aCnt.writeStream( data, true /* bReplaceExisting */ );
628 catch ( CommandFailedException const & )
630 // Interaction Handler already handled the error that has occurred...
633 catch ( ContentCreationException const & e )
635 // Most probably file does not exist. Try to create.
636 if ( e.eError == ContentCreationError_CONTENT_CREATION_FAILED )
638 INetURLObject aParentURLObj( aURL );
639 if ( aParentURLObj.removeSegment() )
641 OUString aParentURL
642 = aParentURLObj.GetMainURL( INetURLObject::DecodeMechanism::NONE );
644 // ensure all parent folders exist.
645 createFolder( aParentURL );
647 // create the new file...
648 OUString aTitle
649 = aURL.getName( INetURLObject::LAST_SEGMENT,
650 true,
651 INetURLObject::DecodeMechanism::WithCharset );
652 if ( createNewFile( aParentURL, aTitle, data ) )
654 // success
655 return;
660 throw;
664 sal_Bool OFileAccess::isHidden( const OUString& FileURL )
666 INetURLObject aURLObj( FileURL, INetProtocol::File );
667 ucbhelper::Content aCnt( aURLObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ), mxEnvironment, comphelper::getProcessComponentContext() );
668 Any aRetAny = aCnt.getPropertyValue(u"IsHidden"_ustr);
669 bool bRet = false;
670 aRetAny >>= bRet;
671 return bRet;
674 void OFileAccess::setHidden( const OUString& FileURL, sal_Bool bHidden )
676 INetURLObject aURLObj( FileURL, INetProtocol::File );
677 ucbhelper::Content aCnt( aURLObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ), mxEnvironment, comphelper::getProcessComponentContext() );
678 aCnt.setPropertyValue(u"IsHidden"_ustr, Any(bHidden) );
682 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
683 ucb_OFileAccess_get_implementation(
684 css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&)
686 return cppu::acquire(new OFileAccess(context));
689 }; // namespace end
692 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */