20#include <config_features.h>
25#if HAVE_FEATURE_MACOSX_SANDBOX
29#include <com/sun/star/beans/IllegalTypeException.hpp>
30#include <com/sun/star/beans/NotRemoveableException.hpp>
31#include <com/sun/star/beans/PropertyAttribute.hpp>
32#include <com/sun/star/beans/PropertyExistException.hpp>
33#include <com/sun/star/io/BufferSizeExceededException.hpp>
34#include <com/sun/star/io/NotConnectedException.hpp>
35#include <com/sun/star/io/IOException.hpp>
36#include <com/sun/star/lang/IllegalAccessException.hpp>
37#include <com/sun/star/task/InteractionClassification.hpp>
38#include <com/sun/star/ucb/ContentInfoAttribute.hpp>
39#include <com/sun/star/ucb/DuplicateCommandIdentifierException.hpp>
40#include <com/sun/star/ucb/IOErrorCode.hpp>
41#include <com/sun/star/ucb/InsertCommandArgument.hpp>
42#include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
43#include <com/sun/star/ucb/NameClash.hpp>
44#include <com/sun/star/ucb/OpenCommandArgument.hpp>
45#include <com/sun/star/ucb/Store.hpp>
46#include <com/sun/star/ucb/TransferInfo.hpp>
72#if OSL_DEBUG_LEVEL > 0
73#define THROW_WHERE SAL_WHERE
78TaskManager::UnqPathData::UnqPathData() =
default;
83TaskManager::UnqPathData::~UnqPathData()
88 : PropertyName( thePropertyName )
91 ,
State(beans::PropertyState_AMBIGUOUS_VALUE)
98 const OUString& thePropertyName,
100 const css::uno::Type& theTyp,
101 const css::uno::Any& theValue,
102 const css::beans::PropertyState& theState,
103 sal_Int16 theAttributes )
104 : PropertyName( thePropertyName ),
106 isNative( theisNative ),
110 Attributes( theAttributes )
119constexpr OUStringLiteral
Title( u
"Title" );
124constexpr OUStringLiteral
Size( u
"Size" );
146 {
"getPropertySetInfo",
150 {
"getPropertyValues",
154 {
"setPropertyValues",
174 {
"createNewContent",
179 m_aDefaultProperties.insert( MyProperty(
true,
184 beans::PropertyState_DEFAULT_VALUE,
185 beans::PropertyAttribute::MAYBEVOID
186 | beans::PropertyAttribute::BOUND ) );
189 m_aDefaultProperties.insert(
195 beans::PropertyState_DEFAULT_VALUE,
196 beans::PropertyAttribute::MAYBEVOID
197 | beans::PropertyAttribute::BOUND
198 | beans::PropertyAttribute::READONLY ) );
202 m_aDefaultProperties.insert( MyProperty(
true,
207 beans::PropertyState_DEFAULT_VALUE,
208 beans::PropertyAttribute::MAYBEVOID
209 | beans::PropertyAttribute::BOUND
210 | beans::PropertyAttribute::READONLY ) );
214 m_aDefaultProperties.insert( MyProperty(
true,
219 beans::PropertyState_DEFAULT_VALUE,
220 beans::PropertyAttribute::MAYBEVOID
221 | beans::PropertyAttribute::BOUND
222 | beans::PropertyAttribute::READONLY ) );
225 m_aDefaultProperties.insert( MyProperty(
true,
230 beans::PropertyState_DEFAULT_VALUE,
231 beans::PropertyAttribute::MAYBEVOID
232 | beans::PropertyAttribute::BOUND
233 | beans::PropertyAttribute::READONLY ) );
237 m_aDefaultProperties.insert( MyProperty(
true,
242 beans::PropertyState_DEFAULT_VALUE,
243 beans::PropertyAttribute::MAYBEVOID
244 | beans::PropertyAttribute::BOUND
245 | beans::PropertyAttribute::READONLY ) );
248 m_aDefaultProperties.insert( MyProperty(
true,
253 beans::PropertyState_DEFAULT_VALUE,
254 beans::PropertyAttribute::MAYBEVOID
255 | beans::PropertyAttribute::BOUND
256 | beans::PropertyAttribute::READONLY ) );
259 m_aDefaultProperties.insert( MyProperty(
true,
264 beans::PropertyState_DEFAULT_VALUE,
265 beans::PropertyAttribute::MAYBEVOID
266 | beans::PropertyAttribute::BOUND
267 | beans::PropertyAttribute::READONLY ) );
270 m_aDefaultProperties.insert( MyProperty(
true,
275 beans::PropertyState_DEFAULT_VALUE,
276 beans::PropertyAttribute::MAYBEVOID
277 | beans::PropertyAttribute::BOUND
278 | beans::PropertyAttribute::READONLY ) );
281 m_aDefaultProperties.insert(
288 beans::PropertyState_DEFAULT_VALUE,
289 beans::PropertyAttribute::MAYBEVOID
290 | beans::PropertyAttribute::BOUND
294 | beans::PropertyAttribute::READONLY));
299 m_aDefaultProperties.insert( MyProperty(
false,
304 beans::PropertyState_DEFAULT_VALUE,
305 beans::PropertyAttribute::MAYBEVOID
306 | beans::PropertyAttribute::BOUND
307 | beans::PropertyAttribute::READONLY ) );
311 m_aDefaultProperties.insert( MyProperty(
true,
316 beans::PropertyState_DEFAULT_VALUE,
317 beans::PropertyAttribute::MAYBEVOID
318 | beans::PropertyAttribute::BOUND ) );
321 m_aDefaultProperties.insert( MyProperty(
true,
326 beans::PropertyState_DEFAULT_VALUE,
327 beans::PropertyAttribute::MAYBEVOID
328 | beans::PropertyAttribute::BOUND ) );
331 m_aDefaultProperties.insert( MyProperty(
true,
336 beans::PropertyState_DEFAULT_VALUE,
337 beans::PropertyAttribute::MAYBEVOID
338 | beans::PropertyAttribute::BOUND ) );
342 m_aDefaultProperties.insert( MyProperty(
true,
347 beans::PropertyState_DEFAULT_VALUE,
348 beans::PropertyAttribute::MAYBEVOID
349 | beans::PropertyAttribute::BOUND
350 | beans::PropertyAttribute::READONLY ) );
354 uno::Reference< XPropertySetRegistryFactory > xRegFac = ucb::Store::create( m_xContext );
356 m_xFileRegistry = xRegFac->createPropertySetRegistry( OUString() );
369 const uno::Reference< XCommandEnvironment >& xCommandEnv )
372 TaskMap::iterator it =
m_aTaskMap.find( CommandId );
375 throw DuplicateCommandIdentifierException( OSL_LOG_PREFIX );
383 const OUString& aUncPath,
386 osl::ClearableMutexGuard aGuard(
m_aMutex );
387 TaskMap::iterator it =
m_aTaskMap.find( CommandId );
391 sal_Int32
ErrorCode = it->second.getInstalledError();
392 sal_Int32 MinorCode = it->second.getMinorErrorCode();
393 bool isHandled = it->second.isHandled();
396 = it->second.getCommandEnvironment();
416 TaskMap::iterator it =
m_aTaskMap.find( CommandId );
418 it->second.clearError();
424 sal_Int32 &minorCode)
427 TaskMap::iterator it =
m_aTaskMap.find( CommandId );
430 ErrorCode = it->second.getInstalledError();
431 minorCode = it->second. getMinorErrorCode();
438 sal_Int32 MinorCode )
441 TaskMap::iterator it =
m_aTaskMap.find( CommandId );
443 it->second.installError(
ErrorCode,MinorCode );
457 const uno::Reference< task::XInteractionRequest >& request )
460 TaskMap::iterator it =
m_aTaskMap.find( CommandId );
461 uno::Reference< task::XInteractionHandler > xInt;
464 xInt = it->second.getInteractionHandler();
466 xInt->handle( request );
467 it->second.setHandled();
487 ContentMap::iterator it =
490 std::vector< Notifier* >& nlist = it->second.notifier;
492 std::vector<Notifier*>::iterator it1 = std::find(nlist.begin(), nlist.end(), pNotifier);
493 if( it1 != nlist.end() )
497 nlist.push_back( pNotifier );
506 ContentMap::iterator it =
m_aContent.find( aUnqPath );
510 it->second.notifier.erase(std::remove(it->second.notifier.begin(), it->second.notifier.end(), pNotifier), it->second.notifier.end());
512 if( it->second.notifier.empty() )
530 const OUString& PropertyName,
532 const sal_Int16 Attributes )
537 DefaultValue.getValueType(),
539 beans::PropertyState_DEFAULT_VALUE,
544 throw beans::PropertyExistException(
THROW_WHERE );
561 it->second.xC->addProperty( PropertyName,Attributes,DefaultValue );
569 const OUString& PropertyName )
575 throw beans::NotRemoveableException(
THROW_WHERE );
587 throw beans::UnknownPropertyException( PropertyName );
591 if( it->second.xC.is() )
592 it->second.xC->removeProperty( PropertyName );
598 if(
properties.find( ContentTProperty )->getState() == beans::PropertyState_DEFAULT_VALUE )
600 it->second.xS =
nullptr;
601 it->second.xC =
nullptr;
602 it->second.xA =
nullptr;
622 const OUString& aUnqPath,
623 const uno::Reference< io::XOutputStream >& xOutputStream )
625 osl::File aFile( aUnqPath );
626 osl::FileBase::RC
err = aFile.open( osl_File_OpenFlag_Read );
628 if(
err != osl::FileBase::E_None )
637 const sal_uInt64 bfz = 4*1024;
643 err = aFile.read(
static_cast<void*
>(BFF),bfz,nrc );
644 if(
err == osl::FileBase::E_None )
647 uno::Sequence< sal_Int8 > seq( BFF,
static_cast<sal_uInt32
>(nrc) );
650 xOutputStream->writeBytes( seq );
652 catch (
const io::NotConnectedException&)
658 catch (
const io::BufferSizeExceededException&)
664 catch (
const io::IOException&)
678 }
while( nrc == bfz );
686 xOutputStream->closeOutput();
688 catch (
const io::NotConnectedException&)
691 catch (
const io::BufferSizeExceededException&)
694 catch (
const io::IOException&)
709uno::Reference< io::XInputStream >
711 const OUString& aUnqPath,
716 sal_Int32
ErrorCode = pInputStream->CtorSuccess();
722 pInputStream->getMinorError() );
724 pInputStream.clear();
741uno::Reference< io::XStream >
743 const OUString& aUnqPath,
748 sal_Int32
ErrorCode = pStream->CtorSuccess();
754 pStream->getMinorError() );
772uno::Reference< XDynamicResultSet >
774 const OUString& aUnqPath,
775 const sal_Int32 OpenMode,
776 const uno::Sequence< beans::Property >& seq,
777 const uno::Sequence< NumberedSortingInfo >& seqSort )
787 p->getMinorError() );
803uno::Reference< XCommandInfo >
817uno::Reference< beans::XPropertySetInfo >
834uno::Sequence< uno::Any >
836 const uno::Sequence< beans::PropertyValue >& values )
840 sal_Int32 propChanged = 0;
841 uno::Sequence< uno::Any > ret(
values.getLength() );
842 auto retRange = asNonConstRange(ret);
843 uno::Sequence< beans::PropertyChangeEvent > seqChanged(
values.getLength() );
844 auto seqChangedRange = asNonConstRange(seqChanged);
846 TaskManager::ContentMap::iterator it =
m_aContent.find( aUnqPath );
851 for( sal_Int32
i = 0;
i <
values.getLength(); ++
i )
857 retRange[
i] <<= beans::UnknownPropertyException(
THROW_WHERE );
861 aAny = it1->getValue();
865 if( it1->getAttributes() & beans::PropertyAttribute::READONLY )
867 retRange[
i] <<= lang::IllegalAccessException(
THROW_WHERE );
871 seqChangedRange[ propChanged ].PropertyName =
values[
i].Name;
872 seqChangedRange[ propChanged ].PropertyHandle = -1;
873 seqChangedRange[ propChanged ].Further =
false;
874 seqChangedRange[ propChanged ].OldValue = aAny;
875 seqChangedRange[ propChanged++ ].NewValue =
values[
i].Value;
879 if( ! it1->IsNative() )
882 if( !it->second.xS.is() )
886 it1->getState() == beans::PropertyState_DEFAULT_VALUE )
889 it1->setState( beans::PropertyState_DIRECT_VALUE );
891 beans::PropertyAttribute::MAYBEVOID,
899 catch (
const uno::Exception&e)
911 sal_Int64 newSize = 0;
914 osl::File aFile(aUnqPath);
916 aFile.open(osl_File_OpenFlag_Write) != osl::FileBase::E_None ||
917 aFile.setSize(sal_uInt64(newSize)) != osl::FileBase::E_None ||
918 aFile.close() != osl::FileBase::E_None;
927 retRange[
i] <<= InteractiveAugmentedIOException(
930 task::InteractionClassification_ERROR,
936 retRange[
i] <<= beans::IllegalTypeException(
THROW_WHERE );
944 osl::DirectoryItem aDirItem;
945 osl::FileBase::RC
err =
946 osl::DirectoryItem::get(aUnqPath,aDirItem);
948 if(
err == osl::FileBase::E_None)
950 osl::FileStatus aFileStatus(osl_FileStatus_Mask_Attributes);
951 err = aDirItem.getFileStatus(aFileStatus);
952 if(
err == osl::FileBase::E_None &&
953 aFileStatus.isValid(osl_FileStatus_Mask_Attributes))
957 if(
err == osl::FileBase::E_None) {
961 osl_File_Attribute_GrpWrite |
962 osl_File_Attribute_OthWrite |
963 osl_File_Attribute_ReadOnly);
968 osl_File_Attribute_OwnWrite |
969 osl_File_Attribute_GrpWrite |
970 osl_File_Attribute_OthWrite);
978 err = osl::File::setAttributes(
982 if(
err != osl::FileBase::E_None )
992 case osl::FileBase::E_NOMEM:
994 ioError = IOErrorCode_OUT_OF_MEMORY;
996 case osl::FileBase::E_INVAL:
998 ioError = IOErrorCode_INVALID_PARAMETER;
1000 case osl::FileBase::E_NAMETOOLONG:
1002 ioError = IOErrorCode_NAME_TOO_LONG;
1004 case osl::FileBase::E_NOENT:
1006 case osl::FileBase::E_NOLINK:
1008 ioError = IOErrorCode_NOT_EXISTING;
1010 case osl::FileBase::E_ROFS:
1013 case osl::FileBase::E_PERM:
1014 case osl::FileBase::E_ACCES:
1016 ioError = IOErrorCode_ACCESS_DENIED;
1018 case osl::FileBase::E_LOOP:
1020 case osl::FileBase::E_FAULT:
1022 case osl::FileBase::E_IO:
1024 case osl::FileBase::E_NOSYS:
1026 case osl::FileBase::E_MULTIHOP:
1028 case osl::FileBase::E_INTR:
1031 ioError = IOErrorCode_GENERAL;
1034 retRange[
i] <<= InteractiveAugmentedIOException(
1037 task::InteractionClassification_ERROR,
1043 retRange[
i] <<= beans::IllegalTypeException(
THROW_WHERE );
1050 seqChanged.realloc( propChanged );
1067uno::Reference< sdbc::XRow >
1069 const OUString& aUnqPath,
1070 const uno::Sequence< beans::Property >&
properties )
1072 uno::Sequence< uno::Any > seq(
properties.getLength() );
1076 osl::FileStatus aFileStatus( n_Mask );
1078 osl::DirectoryItem aDirItem;
1079 osl::FileBase::RC nError1 = osl::DirectoryItem::get( aUnqPath,aDirItem );
1080 if( nError1 != osl::FileBase::E_None )
1085 osl::FileBase::RC nError2 = aDirItem.getFileStatus( aFileStatus );
1086 if( nError1 == osl::FileBase::E_None &&
1087 nError2 != osl::FileBase::E_None )
1093 osl::MutexGuard aGuard(
m_aMutex );
1095 TaskManager::ContentMap::iterator it =
m_aContent.find( aUnqPath );
1096 commit( it,aFileStatus );
1101 [&propset](
const beans::Property& rProp) ->
uno::Any {
1102 MyProperty readProp( rProp.Name );
1103 auto it1 = propset.find( readProp );
1104 if( it1 == propset.end() )
1106 return it1->getValue();
1132 const OUString& srcUnqPath,
1133 const OUString& dstUnqPathIn,
1134 const sal_Int32 NameClash )
1138 if( srcUnqPath == dstUnqPathIn )
1141 osl::FileBase::RC nError;
1142 OUString dstUnqPath( dstUnqPathIn );
1146 case NameClash::KEEP:
1149 if( nError != osl::FileBase::E_None && nError != osl::FileBase::E_EXIST )
1158 case NameClash::OVERWRITE:
1161 OUString targetPath(dstUnqPath);
1163 osl::FileStatus aStatus(osl_FileStatus_Mask_Type|osl_FileStatus_Mask_LinkTargetURL);
1164 osl::DirectoryItem aItem;
1165 (void)osl::DirectoryItem::get(dstUnqPath,aItem);
1166 (void)aItem.getFileStatus(aStatus);
1168 if( aStatus.isValid(osl_FileStatus_Mask_Type) &&
1169 aStatus.isValid(osl_FileStatus_Mask_LinkTargetURL) &&
1170 aStatus.getFileType() == osl::FileStatus::Link )
1171 targetPath = aStatus.getLinkTargetURL();
1174 osl::File::remove( targetPath );
1177 if( nError != osl::FileBase::E_None )
1186 case NameClash::RENAME:
1188 OUString newDstUnqPath;
1190 if( nError == osl::FileBase::E_EXIST )
1194 sal_Int32
nPos = -1;
1195 sal_Int32 nLastDot = dstUnqPath.lastIndexOf(
'.' );
1196 sal_Int32 nLastSlash = dstUnqPath.lastIndexOf(
'/' );
1197 if( ( nLastSlash < nLastDot )
1198 && ( nLastSlash != ( nLastDot - 1 ) ) )
1201 nPos = dstUnqPath.getLength();
1207 newDstUnqPath = dstUnqPath;
1209 OUString aPostfix =
"_" + OUString::number( ++nTry );
1211 newDstUnqPath = newDstUnqPath.replaceAt(
nPos, 0, aPostfix );
1215 while( ( nError == osl::FileBase::E_EXIST ) && ( nTry < 10000 ) );
1218 if( nError == osl::FileBase::E_EXIST )
1224 else if( nError != osl::FileBase::E_None )
1232 dstUnqPath = newDstUnqPath;
1236 case NameClash::ERROR:
1239 if( nError == osl::FileBase::E_EXIST )
1245 else if( nError != osl::FileBase::E_None )
1254 case NameClash::ASK:
1258 if( nError == osl::FileBase::E_EXIST )
1270 osl::DirectoryItem aItem;
1271 nError = osl::DirectoryItem::get( dstUnqPath,aItem );
1272 if( nError != osl::FileBase::E_None )
1279 osl::FileStatus aStatus( osl_FileStatus_Mask_Type );
1280 nError = aItem.getFileStatus( aStatus );
1281 if( nError != osl::FileBase::E_None || ! aStatus.isValid( osl_FileStatus_Mask_Type ) )
1288 bool isDocument = ( aStatus.getFileType() == osl::FileStatus::Regular );
1297 if( aDstParent != aSrcParent )
1317 TaskManager & task, sal_Int32
id, OUString
const & fileUrl,
1318 osl::DirectoryItem * item, osl::FileStatus::Type * type)
1320 OSL_ASSERT(item !=
nullptr && type !=
nullptr);
1321 osl::FileBase::RC
err = osl::DirectoryItem::get(fileUrl, *item);
1322 if (err != osl::FileBase::E_None) {
1326 osl::FileStatus stat(osl_FileStatus_Mask_Type);
1327 err = item->getFileStatus(stat);
1328 if (err != osl::FileBase::E_None) {
1332 *
type = stat.getFileType();
1340 sal_Int32 CommandId,
1341 const OUString& srcUnqPath,
1342 const OUString& dstUnqPathIn,
1343 sal_Int32 NameClash )
1345 osl::FileBase::RC nError;
1346 OUString dstUnqPath( dstUnqPathIn );
1353 osl::DirectoryItem item;
1354 osl::FileStatus::Type
type;
1355 if (!
getType(*
this, CommandId, srcUnqPath, &item, &
type)) {
1358 OUString rslvdSrcUnqPath;
1359 if (
type == osl::FileStatus::Link) {
1360 osl::FileStatus stat(osl_FileStatus_Mask_LinkTargetURL);
1361 nError = item.getFileStatus(stat);
1362 if (nError != osl::FileBase::E_None) {
1367 rslvdSrcUnqPath = stat.getLinkTargetURL();
1368 if (!
getType(*
this, CommandId, srcUnqPath, &item, &
type)) {
1372 rslvdSrcUnqPath = srcUnqPath;
1376 =
type != osl::FileStatus::Directory &&
type != osl::FileStatus::Volume;
1381 case NameClash::KEEP:
1383 nError =
copy_recursive( rslvdSrcUnqPath,dstUnqPath,IsWhat,
true );
1384 if( nError != osl::FileBase::E_None && nError != osl::FileBase::E_EXIST )
1393 case NameClash::OVERWRITE:
1396 remove( CommandId, dstUnqPath, IsWhat,
false );
1399 nError =
copy_recursive( rslvdSrcUnqPath,dstUnqPath,IsWhat,
false );
1400 if( nError != osl::FileBase::E_None )
1409 case NameClash::RENAME:
1411 OUString newDstUnqPath = dstUnqPath;
1412 nError =
copy_recursive( rslvdSrcUnqPath,dstUnqPath,IsWhat,
true );
1414 if( nError == osl::FileBase::E_EXIST )
1418 sal_Int32
nPos = -1;
1419 sal_Int32 nLastDot = dstUnqPath.lastIndexOf(
'.' );
1420 sal_Int32 nLastSlash = dstUnqPath.lastIndexOf(
'/' );
1421 if ( ( nLastSlash < nLastDot )
1422 && ( nLastSlash != ( nLastDot - 1 ) ) )
1425 nPos = dstUnqPath.getLength();
1431 newDstUnqPath = dstUnqPath;
1433 OUString aPostfix =
"_" + OUString::number( ++nTry );
1435 newDstUnqPath = newDstUnqPath.replaceAt(
nPos, 0, aPostfix );
1437 nError =
copy_recursive( rslvdSrcUnqPath,newDstUnqPath,IsWhat,
true );
1439 while( ( nError == osl::FileBase::E_EXIST ) && ( nTry < 10000 ) );
1442 if( nError == osl::FileBase::E_EXIST )
1448 else if( nError != osl::FileBase::E_None )
1456 dstUnqPath = newDstUnqPath;
1460 case NameClash::ERROR:
1462 nError =
copy_recursive( rslvdSrcUnqPath,dstUnqPath,IsWhat,
true );
1464 if( nError == osl::FileBase::E_EXIST )
1470 else if( nError != osl::FileBase::E_None )
1479 case NameClash::ASK:
1482 nError =
copy_recursive( rslvdSrcUnqPath,dstUnqPath,IsWhat,
true );
1484 if( nError == osl::FileBase::E_EXIST )
1512 const OUString& aUnqPath,
1516 sal_Int32 nMask = osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileURL;
1518 osl::DirectoryItem aItem;
1519 osl::FileStatus aStatus( nMask );
1520 osl::FileBase::RC nError;
1524 nError = osl::DirectoryItem::get( aUnqPath, aItem );
1525 if( nError != osl::FileBase::E_None )
1533 return (!MustExist);
1536 nError = aItem.getFileStatus( aStatus );
1537 if( nError != osl::FileBase::E_None || ! aStatus.isValid( nMask ) )
1545 if( aStatus.getFileType() == osl::FileStatus::Regular ||
1546 aStatus.getFileType() == osl::FileStatus::Link )
1548 else if( aStatus.getFileType() == osl::FileStatus::Directory ||
1549 aStatus.getFileType() == osl::FileStatus::Volume )
1556 nError = osl::File::remove( aUnqPath );
1557 if( nError != osl::FileBase::E_None )
1565 return (!MustExist);
1575 osl::Directory aDirectory( aUnqPath );
1577 nError = aDirectory.open();
1578 if( nError != osl::FileBase::E_None )
1586 return (!MustExist);
1589 bool whileSuccess =
true;
1593 nError = aDirectory.getNextItem( aItem );
1594 while( nError == osl::FileBase::E_None )
1596 nError = aItem.getFileStatus( aStatus );
1597 if( nError != osl::FileBase::E_None || ! aStatus.isValid( nMask ) )
1602 whileSuccess =
false;
1606 if( aStatus.getFileType() == osl::FileStatus::Regular ||
1607 aStatus.getFileType() == osl::FileStatus::Link )
1609 else if( aStatus.getFileType() == osl::FileStatus::Directory ||
1610 aStatus.getFileType() == osl::FileStatus::Volume )
1613 name = aStatus.getFileURL();
1614 whileSuccess =
remove( CommandId,
name, recurse, MustExist );
1618 nError = aDirectory.getNextItem( aItem );
1623 if( ! whileSuccess )
1626 if( nError != osl::FileBase::E_NOENT )
1634 nError = osl::Directory::remove( aUnqPath );
1635 if( nError != osl::FileBase::E_None )
1643 return (!MustExist);
1674 const OUString& rUnqPath,
1680 if ( rUnqPath.endsWith(
"/") )
1681 aUnqPath = rUnqPath.copy( 0, rUnqPath.getLength() - 1 );
1683 aUnqPath = rUnqPath;
1685 osl::FileBase::RC nError = osl::Directory::create( aUnqPath );
1689 case osl::FileBase::E_EXIST:
1700 case osl::FileBase::E_INVAL:
1706 case osl::FileBase::E_None:
1734 const OUString& aUnqPath,
1736 const uno::Reference< io::XInputStream >& aInputStream )
1739 bool bSuccess =
write( CommandId,
1765 const OUString& aUnqPath,
1767 const uno::Reference< io::XInputStream >& aInputStream )
1769 if( ! aInputStream.is() )
1782 osl::FileBase::RC
err;
1783 osl::File aFile( aUnqPath );
1787 err = aFile.open( osl_File_OpenFlag_Write | osl_File_OpenFlag_Create );
1789 if(
err != osl::FileBase::E_None )
1792 err = aFile.open( osl_File_OpenFlag_Write );
1794 if(
err != osl::FileBase::E_None )
1805 err = aFile.setSize( 0 );
1806 if(
err != osl::FileBase::E_None )
1817 err = aFile.open( osl_File_OpenFlag_Read | osl_File_OpenFlag_NoLock );
1818 if(
err == osl::FileBase::E_None )
1830 err = aFile.open( osl_File_OpenFlag_Write | osl_File_OpenFlag_Create | osl_File_OpenFlag_NoLock );
1832 if(
err != osl::FileBase::E_None )
1842 bool bSuccess =
true;
1844 sal_uInt64 nWrittenBytes;
1845 sal_Int32 nReadBytes = 0, nRequestedBytes = 32768 ;
1846 uno::Sequence< sal_Int8 > seq( nRequestedBytes );
1852 nReadBytes = aInputStream->readBytes( seq,
1855 catch(
const io::NotConnectedException& )
1862 catch(
const io::BufferSizeExceededException& )
1869 catch(
const io::IOException& )
1879 const sal_Int8*
p = seq.getConstArray();
1881 err = aFile.write(
static_cast<void const *
>(
p),
1882 sal_uInt64( nReadBytes ),
1885 if(
err != osl::FileBase::E_None )
1893 else if( nWrittenBytes != sal_uInt64( nReadBytes ) )
1901 }
while( nReadBytes == nRequestedBytes );
1903 err = aFile.close();
1904 if(
err != osl::FileBase::E_None )
1925 osl::MutexGuard aGuard(
m_aMutex );
1927 ContentMap::iterator it =
1940 if( !ContentNotDefau || defaultprop.getPropertyName() !=
ContentType )
1956 if (
Url ==
"file:///" ||
Url ==
"file://localhost/" ||
Url ==
"file://127.0.0.1/" )
1962 bool err = osl::FileBase::E_None != osl::FileBase::getSystemPathFromFileURL(
Url,Unq );
1966 sal_Int32 l = Unq.getLength()-1;
1967 if( !
err && Unq.endsWith(
"/") &&
1968 Unq.indexOf(
'/', RTL_CONSTASCII_LENGTH(
"//") ) != -1 )
1969 Unq = Unq.copy(0, l);
1977 bool err = osl::FileBase::E_None != osl::FileBase::getSystemPathFromFileURL( Unq,
Url );
1989 const OUString& dstUnqPath,
1991 bool testExistBeforeCopy )
1993 osl::FileBase::RC
err = osl::FileBase::E_None;
2001 osl::Directory aDir( srcUnqPath );
2004 err = osl::Directory::create( dstUnqPath );
2005 osl::FileBase::RC next =
err;
2006 if(
err == osl::FileBase::E_None )
2008 sal_Int32
const n_Mask = osl_FileStatus_Mask_FileURL | osl_FileStatus_Mask_FileName | osl_FileStatus_Mask_Type;
2010 osl::DirectoryItem aDirItem;
2012 while(
err == osl::FileBase::E_None )
2014 next = aDir.getNextItem( aDirItem );
2015 if (next != osl::FileBase::E_None )
2018 osl::FileStatus aFileStatus( n_Mask );
2019 aDirItem.getFileStatus( aFileStatus );
2020 if( aFileStatus.isValid( osl_FileStatus_Mask_Type ) )
2021 IsDoc = aFileStatus.getFileType() == osl::FileStatus::Regular;
2026 OUString newSrcUnqPath;
2027 if( aFileStatus.isValid( osl_FileStatus_Mask_FileURL ) )
2028 newSrcUnqPath = aFileStatus.getFileURL();
2030 OUString newDstUnqPath = dstUnqPath;
2032 if( aFileStatus.isValid( osl_FileStatus_Mask_FileName ) )
2033 tit = rtl::Uri::encode( aFileStatus.getFileName(),
2034 rtl_UriCharClassPchar,
2035 rtl_UriEncodeIgnoreEscapes,
2036 RTL_TEXTENCODING_UTF8 );
2038 if( !newDstUnqPath.endsWith(
"/" ) )
2039 newDstUnqPath +=
"/";
2041 newDstUnqPath += tit;
2043 if ( newSrcUnqPath != dstUnqPath )
2047 if(
err == osl::FileBase::E_None && next != osl::FileBase::E_NOENT )
2063 const OUString& rUnqPath,
2064 sal_Int32 errorCode )
2068 if ( rUnqPath.isEmpty() )
2071 if ( rUnqPath.endsWith(
"/") )
2072 aPath = rUnqPath.copy( 0, rUnqPath.getLength() - 1 );
2076#if HAVE_FEATURE_MACOSX_SANDBOX
2088 if( osl::FileBase::getSystemPathFromFileURL( aPath, aDirName ) == osl::FileBase::E_None &&
2090 S_ISDIR( s.st_mode ) )
2096 osl::Directory aDirectory( aPath );
2097 osl::FileBase::RC nError = aDirectory.open();
2100 if( nError == osl::File::E_None )
2103 nError = osl::Directory::create( aPath );
2105 if( nError == osl::File::E_None )
2108 bool bSuccess = ( nError == osl::File::E_None || nError == osl::FileBase::E_EXIST );
2114 if ( aParentDir != aPath )
2124 nError = osl::Directory::create( aPath );
2126 if( nError == osl::File::E_None )
2129 bSuccess =( nError == osl::File::E_None || nError == osl::FileBase::E_EXIST );
2151 const uno::Sequence< beans::Property >& seq )
2154 for(
const auto& rProp : seq) {
2155 if(rProp.Name ==
Title)
2156 n_Mask |= osl_FileStatus_Mask_FileName;
2158 n_Mask |= osl_FileStatus_Mask_FileURL;
2167 n_Mask |= (osl_FileStatus_Mask_Type | osl_FileStatus_Mask_LinkTargetURL);
2168 else if(rProp.Name ==
Size)
2169 n_Mask |= (osl_FileStatus_Mask_FileSize |
2170 osl_FileStatus_Mask_Type |
2171 osl_FileStatus_Mask_LinkTargetURL);
2174 n_Mask |= osl_FileStatus_Mask_Attributes;
2176 n_Mask |= osl_FileStatus_Mask_ModifyTime;
2194 if( ( it->second.xS.is() && it->second.xC.is() && it->second.xA.is() )
2199 uno::Reference< ucb::XPersistentPropertySet > xS =
m_xFileRegistry->openPropertySet( it->first,
create );
2202 uno::Reference< beans::XPropertyContainer > xC( xS,uno::UNO_QUERY );
2203 uno::Reference< beans::XPropertyAccess > xA( xS,uno::UNO_QUERY );
2212 const uno::Sequence< beans::Property > seq = xS->getPropertySetInfo()->getProperties();
2214 for(
const auto& rProp : seq )
2220 xS->getPropertyValue( rProp.Name ),
2221 beans::PropertyState_DIRECT_VALUE,
2245 const osl::FileStatus& aFileStatus )
2249 if( it->second.properties.empty() )
2251 OUString aPath = it->first;
2260 if( aFileStatus.isValid( osl_FileStatus_Mask_FileName ) )
2262 it1->setValue(
uno::Any(aFileStatus.getFileName()) );
2269 if( aFileStatus.isValid( osl_FileStatus_Mask_FileURL ) )
2271 it1->setValue(
uno::Any(aFileStatus.getFileURL()) );
2278 sal_Int64 dirSize = 0;
2280 if( aFileStatus.isValid( osl_FileStatus_Mask_FileSize ) )
2281 dirSize = aFileStatus.getFileSize();
2283 if( aFileStatus.isValid( osl_FileStatus_Mask_Type ) )
2285 bool isFile,isVolume;
2286 if( osl::FileStatus::Link == aFileStatus.getFileType() &&
2287 aFileStatus.isValid( osl_FileStatus_Mask_LinkTargetURL ) )
2289 osl::DirectoryItem aDirItem;
2290 osl::FileStatus aFileStatus2( osl_FileStatus_Mask_Type );
2291 if( osl::FileBase::E_None == osl::DirectoryItem::get( aFileStatus.getLinkTargetURL(),aDirItem ) &&
2292 osl::FileBase::E_None == aDirItem.getFileStatus( aFileStatus2 ) &&
2293 aFileStatus2.isValid( osl_FileStatus_Mask_Type ) )
2295 isVolume = osl::FileStatus::Volume == aFileStatus2.getFileType();
2297 osl::FileStatus::Volume == aFileStatus2.getFileType() ||
2298 osl::FileStatus::Directory == aFileStatus2.getFileType();
2300 osl::FileStatus::Regular == aFileStatus2.getFileType();
2302 if( aFileStatus2.isValid( osl_FileStatus_Mask_FileSize ) )
2303 dirSize = aFileStatus2.getFileSize();
2310 isVolume = osl::FileStatus::Volume == aFileStatus.getFileType();
2312 osl::FileStatus::Volume == aFileStatus.getFileType() ||
2313 osl::FileStatus::Directory == aFileStatus.getFileType();
2315 osl::FileStatus::Regular == aFileStatus.getFileType();
2320 isVolume = osl::FileStatus::Volume == aFileStatus.getFileType();
2322 osl::FileStatus::Volume == aFileStatus.getFileType() ||
2323 osl::FileStatus::Directory == aFileStatus.getFileType();
2325 osl::FileStatus::Regular == aFileStatus.getFileType();
2330 it1->setValue(
uno::Any( isVolume ) );
2334 it1->setValue(
uno::Any( isDirectory ) );
2338 it1->setValue(
uno::Any( isFile ) );
2340 osl::VolumeInfo aVolumeInfo( osl_VolumeInfo_Mask_Attributes );
2342 osl::FileBase::E_None == osl::Directory::getVolumeInfo( it->first,aVolumeInfo ) &&
2343 aVolumeInfo.isValid( osl_VolumeInfo_Mask_Attributes ) )
2346 bool isRemote = aVolumeInfo.getRemoteFlag();
2347 bool isRemoveable = aVolumeInfo.getRemoveableFlag();
2348 bool isCompactDisc = aVolumeInfo.getCompactDiscFlag();
2349 bool isFloppy = aVolumeInfo.getFloppyDiskFlag();
2353 it1->setValue(
uno::Any( isRemote ) );
2357 it1->setValue(
uno::Any( isRemoveable ) );
2361 it1->setValue(
uno::Any( isCompactDisc ) );
2365 it1->setValue(
uno::Any( isFloppy ) );
2372 it1->setValue( aAny );
2376 it1->setValue( aAny );
2380 it1->setValue( aAny );
2384 it1->setValue( aAny );
2389 isDirectory =
false;
2394 it1->setValue(
uno::Any( dirSize ) );
2399 if( aFileStatus.isValid( osl_FileStatus_Mask_Attributes ) )
2401 sal_uInt64
Attr = aFileStatus.getAttributes();
2402 bool readonly = (
Attr & osl_File_Attribute_ReadOnly ) != 0;
2403 it1->setValue(
uno::Any( readonly ) );
2410 if( aFileStatus.isValid( osl_FileStatus_Mask_Attributes ) )
2412 sal_uInt64
Attr = aFileStatus.getAttributes();
2413 bool ishidden = (
Attr & osl_File_Attribute_Hidden ) != 0;
2414 it1->setValue(
uno::Any( ishidden ) );
2421 if( aFileStatus.isValid( osl_FileStatus_Mask_ModifyTime ) )
2423 TimeValue temp = aFileStatus.getModifyTime();
2426 TimeValue myLocalTime;
2427 if (!osl_getLocalTimeFromSystemTime( &temp, &myLocalTime ))
2431 "cannot convert (" << temp.Seconds <<
", " << temp.Nanosec
2432 <<
") to local time");
2436 oslDateTime myDateTime;
2437 osl_getDateTimeFromTimeValue( &myLocalTime, &myDateTime );
2438 util::DateTime aDateTime;
2440 aDateTime.NanoSeconds = myDateTime.NanoSeconds;
2441 aDateTime.Seconds = myDateTime.Seconds;
2442 aDateTime.Minutes = myDateTime.Minutes;
2443 aDateTime.Hours = myDateTime.Hours;
2444 aDateTime.Day = myDateTime.Day;
2445 aDateTime.Month = myDateTime.Month;
2446 aDateTime.Year = myDateTime.Year;
2447 it1->setValue(
uno::Any( aDateTime ) );
2454 isDirectory || !aFileStatus.isValid( osl_FileStatus_Mask_Type )
2456 : uno::Sequence< ucb::ContentInfo >() ) );
2466 const uno::Sequence< beans::Property >&
properties,
2467 osl::DirectoryItem& aDirItem,
2470 uno::Reference< sdbc::XRow > & row )
2472 uno::Sequence< uno::Any > seq(
properties.getLength() );
2478 osl::FileStatus aFileStatus( n_Mask |
2479 osl_FileStatus_Mask_FileURL |
2480 osl_FileStatus_Mask_Type |
2481 osl_FileStatus_Mask_LinkTargetURL );
2483 osl::FileBase::RC aRes = aDirItem.getFileStatus( aFileStatus );
2484 if ( aRes != osl::FileBase::E_None )
2488 "osl::DirectoryItem::getFileStatus failed with " << +aRes);
2492 aUnqPath = aFileStatus.getFileURL();
2496 if ( aFileStatus.getFileType() == osl::FileStatus::Link )
2500 osl::DirectoryItem aTargetItem;
2501 (void)osl::DirectoryItem::get( aFileStatus.getLinkTargetURL(), aTargetItem );
2502 if ( aTargetItem.is() )
2504 osl::FileStatus aTargetStatus( osl_FileStatus_Mask_Type );
2506 if ( osl::FileBase::E_None == aTargetItem.getFileStatus( aTargetStatus ) )
2508 aTargetStatus.getFileType() == osl::FileStatus::Regular;
2512 aIsRegular = aFileStatus.getFileType() == osl::FileStatus::Regular;
2516 osl::MutexGuard aGuard(
m_aMutex );
2518 TaskManager::ContentMap::iterator it =
m_aContent.find( aUnqPath );
2519 commit( it,aFileStatus );
2524 [&propset](
const beans::Property& rProp) ->
uno::Any {
2525 MyProperty readProp( rProp.Name );
2526 auto it1 = propset.find( readProp );
2527 if( it1 == propset.end() )
2529 return it1->getValue();
2541std::vector< ContentEventNotifier >
2544 std::vector< ContentEventNotifier > listeners;
2546 osl::MutexGuard aGuard(
m_aMutex );
2548 if( it !=
m_aContent.end() && !it->second.notifier.empty() )
2550 std::vector<Notifier*>& listOfNotifiers = it->second.notifier;
2551 for (
auto const& pointer : listOfNotifiers)
2553 std::optional<ContentEventNotifier> notifier = pointer->cCEL();
2555 listeners.push_back( std::move(*notifier) );
2563std::vector< ContentEventNotifier >
2566 std::vector< ContentEventNotifier > listeners;
2568 osl::MutexGuard aGuard(
m_aMutex );
2570 if( it !=
m_aContent.end() && !it->second.notifier.empty() )
2572 std::vector<Notifier*>& listOfNotifiers = it->second.notifier;
2573 for (
auto const& pointer : listOfNotifiers)
2575 std::optional<ContentEventNotifier> notifier = pointer->cDEL();
2577 listeners.push_back( std::move(*notifier) );
2585 const OUString& aChildName)
2587 for (
const auto & l : listeners )
2589 l.notifyChildInserted( aChildName );
2594 const std::vector<ContentEventNotifier>& listeners)
2596 for(
auto const & l : listeners )
2603 const std::vector<ContentEventNotifier>& listeners,
const OUString& aChildName)
2605 for(
auto const & l : listeners )
2607 l.notifyRemoved( aChildName );
2612std::vector< PropertySetInfoChangeNotifier >
2615 std::vector< PropertySetInfoChangeNotifier > listeners;
2617 osl::MutexGuard aGuard(
m_aMutex );
2619 if( it !=
m_aContent.end() && !it->second.notifier.empty() )
2621 std::vector<Notifier*>& listOfNotifiers = it->second.notifier;
2622 for (
auto const& pointer : listOfNotifiers)
2624 std::optional<PropertySetInfoChangeNotifier> notifier = pointer->cPSL();
2626 listeners.push_back( std::move(*notifier) );
2634 const std::vector<PropertySetInfoChangeNotifier>& listeners,
2635 const OUString& aPropertyName)
2637 for(
auto const & l : listeners )
2639 l.notifyPropertyAdded( aPropertyName );
2644 const std::vector<PropertySetInfoChangeNotifier>& listeners,
2645 const OUString& aPropertyName)
2647 for(
auto const & l : listeners )
2649 l.notifyPropertyRemoved( aPropertyName );
2654std::vector< ContentEventNotifier >
2656 const OUString& aNewPrefix,
2659 std::vector< ContentEventNotifier > aVector;
2664 std::vector< OUString > oldChildList;
2667 osl::MutexGuard aGuard(
m_aMutex );
2669 if( ! withChildren )
2671 aOldName = aOldPrefix;
2672 aNewName = aNewPrefix;
2679 if(
isChild( aOldPrefix,content.first ) )
2681 oldChildList.push_back( content.first );
2684 count = oldChildList.size();
2688 for( sal_Int32 j = 0; j <
count; ++j )
2692 aOldName = oldChildList[j];
2693 aNewName =
newName( aNewPrefix,aOldPrefix,aOldName );
2696 TaskManager::ContentMap::iterator itold =
m_aContent.find( aOldName );
2699 TaskManager::ContentMap::iterator itnew =
m_aContent.emplace(
2703 itnew->second.properties = std::move(itold->second.properties);
2706 std::vector< Notifier* > copyList;
2707 std::swap(copyList, itnew->second.notifier);
2708 itnew->second.notifier = std::move(itold->second.notifier);
2714 if (!itnew->second.notifier.empty())
2716 std::vector<Notifier*>& listOfNotifiers = itnew->second.notifier;
2717 for (
auto const& pointer : listOfNotifiers)
2719 std::optional<ContentEventNotifier> notifier = pointer->cEXC( aNewName );
2721 aVector.push_back( std::move(*notifier) );
2727 itnew->second.notifier.insert(itnew->second.notifier.end(),
2728 copyList.begin(), copyList.end() );
2738 const std::vector<ContentEventNotifier>& listeners_vec)
2740 for(
auto & l : listeners_vec)
2742 l.notifyExchanged();
2747std::vector< PropertyChangeNotifier >
2750 std::vector< PropertyChangeNotifier > listeners;
2752 osl::MutexGuard aGuard(
m_aMutex );
2754 if( it !=
m_aContent.end() && !it->second.notifier.empty() )
2756 std::vector<Notifier*>& listOfNotifiers = it->second.notifier;
2757 for (
auto const& pointer : listOfNotifiers)
2759 std::optional<PropertyChangeNotifier> notifier = pointer->cPCL();
2761 listeners.push_back( std::move(*notifier) );
2769 const std::vector<PropertyChangeNotifier>& listeners,
2770 const uno::Sequence<beans::PropertyChangeEvent>& seqChanged)
2772 for(
auto const & l : listeners )
2774 l.notifyPropertyChanged( seqChanged );
2788 osl::MutexGuard aGuard(
m_aMutex );
2789 ContentMap::iterator it =
m_aContent.find( aUnqPath );
2792 it->second.xS =
nullptr;
2793 it->second.xC =
nullptr;
2794 it->second.xA =
nullptr;
2796 it->second.properties.clear();
2813 if( ! withChildren )
2819 uno::Reference< container::XNameAccess > xName(
m_xFileRegistry,uno::UNO_QUERY );
2820 const uno::Sequence< OUString > seqNames = xName->getElementNames();
2822 OUString old_Name = aUnqPath;
2824 for(
const auto& rName : seqNames )
2826 if( ! (
isChild( old_Name,rName ) ) )
2843 const OUString& dstUnqPath )
2845 uno::Reference< XPersistentPropertySet > x_src =
2852 const uno::Sequence< beans::Property > seqProperty =
2853 x_src->getPropertySetInfo()->getProperties();
2855 if( ! seqProperty.hasElements() )
2858 uno::Reference< XPersistentPropertySet >
2860 uno::Reference< beans::XPropertyContainer >
2861 x_dstC( x_dstS,uno::UNO_QUERY );
2863 for(
const auto& rProperty : seqProperty )
2865 x_dstC->addProperty( rProperty.Name,
2866 rProperty.Attributes,
2867 x_src->getPropertyValue( rProperty.Name ) );
2873 const OUString& dstUnqPath,
2882 if( ! withChildren )
2888 uno::Reference< container::XNameAccess > xName(
m_xFileRegistry,uno::UNO_QUERY );
2889 const uno::Sequence< OUString > seqNames = xName->getElementNames();
2893 for(
const auto& rName : seqNames )
2895 if( ! (
isChild( srcUnqPath,rName ) ) )
2898 new_Name =
newName( dstUnqPath,srcUnqPath,rName );
2908 uno::Sequence< beans::Property >
props
2914 {
FileContentType, ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM | ucb::ContentInfoAttribute::KIND_DOCUMENT,
props },
css::uno::Type const & get()
MyProperty(const OUString &thePropertyName)
std::vector< ContentEventNotifier > getContentEventListeners(const OUString &aName)
static css::uno::Sequence< css::ucb::ContentInfo > queryCreatableContentsInfo()
css::uno::Reference< css::uno::XComponentContext > m_xContext
void erasePersistentSetWithoutChildren(const OUString &aUnqPath)
bool mkdir(sal_Int32 CommandId, const OUString &aDirectoryName, bool OverWrite)
Creates new directory with given URL, recursively if necessary Return:: success of operation.
void endTask(sal_Int32 CommandId, const OUString &aUnqPath, BaseContent *pContent)
Deinstalls the task and evaluates a possibly set error code.
css::uno::Sequence< css::uno::Any > setv(const OUString &aUnqPath, const css::uno::Sequence< css::beans::PropertyValue > &values)
Sets the values of the properties belonging to fileURL aUnqPath.
bool write(sal_Int32 CommandId, const OUString &aUnqPath, bool OverWrite, const css::uno::Reference< css::io::XInputStream > &aInputStream)
writes to the file with given URL.
void registerNotifier(const OUString &aUnqPath, Notifier *pNotifier)
This two methods register and deregister a change listener for the content belonging to URL aUnqPath.
css::uno::Reference< css::ucb::XDynamicResultSet > ls(sal_Int32 CommandId, const OUString &aUnqPath, const sal_Int32 OpenMode, const css::uno::Sequence< css::beans::Property > &sProperty, const css::uno::Sequence< css::ucb::NumberedSortingInfo > &sSortingInfo)
This method returns the result set containing the children of the directory belonging to file URL aUn...
std::vector< ContentEventNotifier > getContentDeletedEventListeners(const OUString &aName)
static void getScheme(OUString &Scheme)
o3tl::sorted_vector< MyProperty, MyPropertyLess > PropertySet
static void notifyContentDeleted(const std::vector< ContentEventNotifier > &listeners)
std::vector< PropertyChangeNotifier > getPropertyChangeNotifier(const OUString &aName)
static constexpr OUStringLiteral FolderContentType
FileProvider * m_pProvider
void erasePersistentSet(const OUString &aUnqPath, bool withChildren=false)
css::uno::Sequence< css::ucb::CommandInfo > m_sCommandInfo
void copyPersistentSet(const OUString &srcUnqPath, const OUString &dstUnqPath, bool withChildren)
void installError(sal_Int32 CommandId, sal_Int32 ErrorCode, sal_Int32 minorCode=TASKHANDLER_NO_ERROR)
The error code may be one of the error codes defined in filerror.hxx.
bool mkfil(sal_Int32 CommandId, const OUString &aFileName, bool OverWrite, const css::uno::Reference< css::io::XInputStream > &aInputStream)
Creates new file with given URL.
void deregisterNotifier(const OUString &aUnqPath, Notifier *pNotifier)
void commit(const TaskManager::ContentMap::iterator &it, const osl::FileStatus &aFileStatus)
Commit inserts the determined properties in the filestatus object into the internal map,...
static void notifyInsert(const std::vector< ContentEventNotifier > &listeners, const OUString &aChildName)
void handleTask(sal_Int32 CommandId, const css::uno::Reference< css::task::XInteractionRequest > &request)
Handles an interactionrequest.
static bool getUnqFromUrl(const OUString &Url, OUString &Unq)
void copyPersistentSetWithoutChildren(const OUString &srcUnqPath, const OUString &dstUnqPath)
static bool getUrlFromUnq(const OUString &Unq, OUString &Url)
static void notifyPropertyChanges(const std::vector< PropertyChangeNotifier > &listeners, const css::uno::Sequence< css::beans::PropertyChangeEvent > &seqChanged)
void load(const TaskManager::ContentMap::iterator &it, bool create)
Load the properties from configuration, if create == true create them.
bool ensuredir(sal_Int32 CommandId, const OUString &aDirectoryName, sal_Int32 errorCode)
css::uno::Reference< css::beans::XPropertySetInfo > info_p(const OUString &aUnqPath)
css::uno::Reference< css::io::XStream > open_rw(sal_Int32 CommandId, const OUString &aUnqPath, bool bLock)
Given a file URL aUnqPath, this methods returns a XStream which can be used to read and write from/to...
void startTask(sal_Int32 CommandId, const css::uno::Reference< css::ucb::XCommandEnvironment > &xCommandEnv)
static void getMaskFromProperties(sal_Int32 &n_Mask, const css::uno::Sequence< css::beans::Property > &seq)
Given a Sequence of properties seq, this method determines the mask used to instantiate an osl::FileS...
void clearError(sal_Int32)
Clears any error which are set on the commandid.
TaskManager(const css::uno::Reference< css::uno::XComponentContext > &rxContext, FileProvider *pProvider, bool bWithConfig)
css::uno::Reference< css::io::XInputStream > open(sal_Int32 CommandId, const OUString &aUnqPath, bool bLock)
Given a file URL aUnqPath, this methods returns a XInputStream which reads from the open file.
void insertDefaultProperties(const OUString &aUnqPath)
css::uno::Reference< css::ucb::XPropertySetRegistry > m_xFileRegistry
PropertySet m_aDefaultProperties
static void notifyPropertyRemoved(const std::vector< PropertySetInfoChangeNotifier > &listeners, const OUString &aPropertyName)
bool remove(sal_Int32 CommandId, const OUString &aUnqPath, FileUrlType eTypeToMove=FileUrlType::Unknown, bool MustExist=true)
Deletes the content belonging to fileURL aUnqPath( recursively in case of directory )
static void notifyContentExchanged(const std::vector< ContentEventNotifier > &listeners_vec)
void move(sal_Int32 CommandId, const OUString &srcUnqPath, const OUString &dstUnqPath, const sal_Int32 NameClash)
Moves the content belonging to fileURL srcUnqPath to fileURL dstUnqPath( files and directories )
void retrieveError(sal_Int32 CommandId, sal_Int32 &ErrorCode, sal_Int32 &minorCode)
friend class XResultSet_impl
void copy(sal_Int32 CommandId, const OUString &srcUnqPath, const OUString &dstUnqPath, sal_Int32 NameClash)
Copies the content belonging to fileURL srcUnqPath to fileURL dstUnqPath ( files and directories )
std::vector< ContentEventNotifier > getContentExchangedEventListeners(const OUString &aOldPrefix, const OUString &aNewPrefix, bool withChildren)
osl::FileBase::RC copy_recursive(const OUString &srcUnqPath, const OUString &dstUnqPath, FileUrlType TypeToCopy, bool testExistence)
void deassociate(const OUString &UnqPath, const OUString &PropertyName)
friend class XCommandInfo_impl
friend class XPropertySetInfo_impl
css::uno::Reference< css::ucb::XCommandInfo > info_c()
Info methods.
void page(sal_Int32 CommandId, const OUString &aUnqPath, const css::uno::Reference< css::io::XOutputStream > &xOutputStream)
Given an xOutputStream, this method writes the content of the file belonging to URL aUnqPath into the...
css::uno::Reference< css::sdbc::XRow > getv(sal_Int32 CommandId, const OUString &aUnqPath, const css::uno::Sequence< css::beans::Property > &properties)
Reads the values of the properties belonging to fileURL aUnqPath; Returns an XRow object containing t...
static void notifyPropertyAdded(const std::vector< PropertySetInfoChangeNotifier > &listeners, const OUString &aPropertyName)
static constexpr OUStringLiteral FileContentType
static void notifyContentRemoved(const std::vector< ContentEventNotifier > &listeners, const OUString &aChildName)
std::vector< PropertySetInfoChangeNotifier > getPropertySetListeners(const OUString &aName)
void associate(const OUString &UnqPath, const OUString &PropertyName, const css::uno::Any &DefaultValue, const sal_Int16 Attributes)
Used to associate and deassociate a new property with the content belonging to URL UnqPath.
std::vector< Value >::const_iterator const_iterator
const_iterator find(const Value &x) const
const_iterator end() const
#define TASKHANDLER_NO_ERROR
#define TASKHANDLING_FILETYPE_FOR_REMOVE
#define TASKHANDLING_FOLDER_EXISTS_MKDIR
#define TASKHANDLING_CREATEDIRECTORY_MKDIR
#define TASKHANDLING_VALIDFILESTATUSWHILE_FOR_REMOVE
#define TASKHANDLING_TRANSFER_BY_COPY_SOURCE
#define TASKHANDLING_IOEXCEPTION_FOR_WRITE
#define TASKHANDLING_FILEIOERROR_FOR_WRITE
#define TASKHANDLING_TRANSFER_BY_MOVE_SOURCE
#define TASKHANDLING_OPEN_FILE_FOR_PAGING
#define TASKHANDLING_DIRECTORYEXHAUSTED_FOR_REMOVE
#define TASKHANDLING_NAMECLASH_FOR_COPY
#define TASKHANDLING_INPUTSTREAM_FOR_WRITE
#define TASKHANDLING_DELETEDIRECTORY_FOR_REMOVE
#define TASKHANDLING_KEEPERROR_FOR_MOVE
#define TASKHANDLING_TRANSFER_BY_COPY_SOURCESTAT
#define TASKHANDLING_READING_FILE_FOR_PAGING
#define TASKHANDLING_NAMECLASHMOVE_FOR_COPY
#define TASKHANDLING_VALIDFILESTATUS_FOR_REMOVE
#define TASKHANDLING_NAMECLASHMOVE_FOR_MOVE
#define TASKHANDLING_RENAMEMOVE_FOR_MOVE
#define TASKHANDLING_OVERWRITE_FOR_COPY
#define TASKHANDLING_DELETEFILE_FOR_REMOVE
#define TASKHANDLING_NOSUCHFILEORDIR_FOR_REMOVE
#define TASKHANDLING_RENAME_FOR_MOVE
#define TASKHANDLING_RENAME_FOR_COPY
#define TASKHANDLING_TRANSFER_BY_MOVE_SOURCESTAT
#define TASKHANDLING_ENSUREDIR_FOR_WRITE
#define TASKHANDLING_RENAMEMOVE_FOR_COPY
#define TASKHANDLING_NOREPLACE_FOR_WRITE
#define TASKHANDLING_NOTCONNECTED_FOR_WRITE
#define TASKHANDLING_OVERWRITE_FOR_MOVE
#define TASKHANDLING_NO_OPEN_FILE_FOR_OVERWRITE
#define TASKHANDLING_KEEPERROR_FOR_COPY
#define TASKHANDLING_BUFFERSIZEEXCEEDED_FOR_WRITE
#define TASKHANDLING_INVALID_NAME_MKDIR
#define TASKHANDLING_FILEIOERROR_FOR_NO_SPACE
#define TASKHANDLING_NAMECLASH_FOR_MOVE
#define TASKHANDLING_BUFFERSIZEEXCEEDED_FOR_PAGING
#define TASKHANDLING_NOTCONNECTED_FOR_PAGING
#define TASKHANDLING_OPENDIRECTORY_FOR_REMOVE
#define TASKHANDLING_IOEXCEPTION_FOR_PAGING
#define TASKHANDLING_NAMECLASHSUPPORT_FOR_MOVE
#define TASKHANDLING_NO_OPEN_FILE_FOR_WRITE
#define TASKHANDLING_FILESIZE_FOR_WRITE
#define TASKHANDLING_NAMECLASHSUPPORT_FOR_COPY
constexpr OUStringLiteral IsRemoveable(u"IsRemoveable")
constexpr OUStringLiteral ContentType(u"ContentType")
constexpr OUStringLiteral IsRemote(u"IsRemote")
constexpr OUStringLiteral IsCompactDisc(u"IsCompactDisc")
constexpr OUStringLiteral IsDocument(u"IsDocument")
constexpr OUStringLiteral IsVolume(u"IsVolume")
constexpr OUStringLiteral DateModified(u"DateModified")
constexpr OUStringLiteral CasePreservingURL(u"CasePreservingURL")
constexpr OUStringLiteral IsFloppy(u"IsFloppy")
constexpr OUStringLiteral IsHidden(u"IsHidden")
constexpr OUStringLiteral IsReadOnly(u"IsReadOnly")
constexpr OUStringLiteral CreatableContentsInfo(u"CreatableContentsInfo")
constexpr OUStringLiteral IsFolder(u"IsFolder")
#define SAL_WARN(area, stream)
css::uno::Sequence< css::uno::Any > InitAnyPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
css::uno::Reference< css::deployment::XPackageRegistry > create(css::uno::Reference< css::deployment::XPackageRegistry > const &xRootRegistry, OUString const &context, OUString const &cachePath, css::uno::Reference< css::uno::XComponentContext > const &xComponentContext)
OUString getParentName(std::u16string_view aFileName)
osl::FileBase::RC osl_File_move(const OUString &strPath, const OUString &strDestPath, bool test)
special move: On test = true, the implementation determines whether the destination exists and return...
osl::FileBase::RC osl_File_copy(const OUString &strPath, const OUString &strDestPath, bool test)
special copy: On test = true, the implementation determines whether the destination exists and return...
bool isChild(const OUString &srcUnqPath, const OUString &dstUnqPath)
void throw_handler(sal_Int32 errorCode, sal_Int32 minorCode, const Reference< XCommandEnvironment > &xEnv, const OUString &aUncPath, BaseContent *pContent, bool isHandled)
OUString newName(std::u16string_view aNewPrefix, const OUString &aOldPrefix, std::u16string_view old_Name)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
bool getType(BSTR name, Type &type)
std::vector< char * > values