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 )
371 std::unique_lock aGuard(
m_aMutex );
372 TaskMap::iterator it =
m_aTaskMap.find( CommandId );
375 throw DuplicateCommandIdentifierException( OSL_LOG_PREFIX );
383 const OUString& aUncPath,
386 std::unique_lock 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();
415 std::unique_lock aGuard(
m_aMutex );
416 TaskMap::iterator it =
m_aTaskMap.find( CommandId );
418 it->second.clearError();
424 sal_Int32 &minorCode)
426 std::unique_lock aGuard(
m_aMutex );
427 TaskMap::iterator it =
m_aTaskMap.find( CommandId );
430 ErrorCode = it->second.getInstalledError();
431 minorCode = it->second. getMinorErrorCode();
438 sal_Int32 MinorCode )
440 std::unique_lock aGuard(
m_aMutex );
441 TaskMap::iterator it =
m_aTaskMap.find( CommandId );
443 it->second.installError(
ErrorCode,MinorCode );
450 std::unique_lock aGuard(
m_aMutex );
457 const uno::Reference< task::XInteractionRequest >& request )
459 std::unique_lock aGuard(
m_aMutex );
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();
485 std::unique_lock aGuard(
m_aMutex );
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 );
504 std::unique_lock aGuard(
m_aMutex );
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 );
547 std::unique_lock aGuard(
m_aMutex );
561 it->second.xC->addProperty( PropertyName,Attributes,DefaultValue );
569 const OUString& PropertyName )
575 throw beans::NotRemoveableException(
THROW_WHERE );
577 std::unique_lock aGuard(
m_aMutex );
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;
623 const OUString& aUnqPath,
624 const uno::Reference< io::XOutputStream >& xOutputStream )
626 osl::File aFile( aUnqPath );
627 osl::FileBase::RC
err = aFile.open( osl_File_OpenFlag_Read );
629 if(
err != osl::FileBase::E_None )
638 const sal_uInt64 bfz = 4*1024;
644 err = aFile.read(
static_cast<void*
>(BFF),bfz,nrc );
645 if(
err == osl::FileBase::E_None )
648 uno::Sequence< sal_Int8 > seq( BFF,
static_cast<sal_uInt32
>(nrc) );
651 xOutputStream->writeBytes( seq );
653 catch (
const io::NotConnectedException&)
659 catch (
const io::BufferSizeExceededException&)
665 catch (
const io::IOException&)
679 }
while( nrc == bfz );
687 xOutputStream->closeOutput();
689 catch (
const io::NotConnectedException&)
692 catch (
const io::BufferSizeExceededException&)
695 catch (
const io::IOException&)
710uno::Reference< io::XInputStream >
712 const OUString& aUnqPath,
717 sal_Int32
ErrorCode = pInputStream->CtorSuccess();
723 pInputStream->getMinorError() );
725 pInputStream.clear();
742uno::Reference< io::XStream >
744 const OUString& aUnqPath,
749 sal_Int32
ErrorCode = pStream->CtorSuccess();
755 pStream->getMinorError() );
773uno::Reference< XDynamicResultSet >
775 const OUString& aUnqPath,
776 const sal_Int32 OpenMode,
777 const uno::Sequence< beans::Property >& seq,
778 const uno::Sequence< NumberedSortingInfo >& seqSort )
788 p->getMinorError() );
804uno::Reference< XCommandInfo >
818uno::Reference< beans::XPropertySetInfo >
821 std::unique_lock aGuard(
m_aMutex );
835uno::Sequence< uno::Any >
837 const uno::Sequence< beans::PropertyValue >& values )
839 std::unique_lock aGuard(
m_aMutex );
841 sal_Int32 propChanged = 0;
842 uno::Sequence< uno::Any > ret(
values.getLength() );
843 auto retRange = asNonConstRange(ret);
844 uno::Sequence< beans::PropertyChangeEvent > seqChanged(
values.getLength() );
845 auto seqChangedRange = asNonConstRange(seqChanged);
847 TaskManager::ContentMap::iterator it =
m_aContent.find( aUnqPath );
852 for( sal_Int32
i = 0;
i <
values.getLength(); ++
i )
858 retRange[
i] <<= beans::UnknownPropertyException(
THROW_WHERE );
862 aAny = it1->getValue();
866 if( it1->getAttributes() & beans::PropertyAttribute::READONLY )
868 retRange[
i] <<= lang::IllegalAccessException(
THROW_WHERE );
872 seqChangedRange[ propChanged ].PropertyName =
values[
i].Name;
873 seqChangedRange[ propChanged ].PropertyHandle = -1;
874 seqChangedRange[ propChanged ].Further =
false;
875 seqChangedRange[ propChanged ].OldValue = aAny;
876 seqChangedRange[ propChanged++ ].NewValue =
values[
i].Value;
880 if( ! it1->IsNative() )
883 if( !it->second.xS.is() )
887 it1->getState() == beans::PropertyState_DEFAULT_VALUE )
890 it1->setState( beans::PropertyState_DIRECT_VALUE );
892 beans::PropertyAttribute::MAYBEVOID,
900 catch (
const uno::Exception&e)
912 sal_Int64 newSize = 0;
915 osl::File aFile(aUnqPath);
917 aFile.open(osl_File_OpenFlag_Write) != osl::FileBase::E_None ||
918 aFile.setSize(sal_uInt64(newSize)) != osl::FileBase::E_None ||
919 aFile.close() != osl::FileBase::E_None;
928 retRange[
i] <<= InteractiveAugmentedIOException(
931 task::InteractionClassification_ERROR,
937 retRange[
i] <<= beans::IllegalTypeException(
THROW_WHERE );
945 osl::DirectoryItem aDirItem;
946 osl::FileBase::RC
err =
947 osl::DirectoryItem::get(aUnqPath,aDirItem);
949 if(
err == osl::FileBase::E_None)
951 osl::FileStatus aFileStatus(osl_FileStatus_Mask_Attributes);
952 err = aDirItem.getFileStatus(aFileStatus);
953 if(
err == osl::FileBase::E_None &&
954 aFileStatus.isValid(osl_FileStatus_Mask_Attributes))
958 if(
err == osl::FileBase::E_None) {
962 osl_File_Attribute_GrpWrite |
963 osl_File_Attribute_OthWrite |
964 osl_File_Attribute_ReadOnly);
969 osl_File_Attribute_OwnWrite |
970 osl_File_Attribute_GrpWrite |
971 osl_File_Attribute_OthWrite);
979 err = osl::File::setAttributes(
983 if(
err != osl::FileBase::E_None )
993 case osl::FileBase::E_NOMEM:
995 ioError = IOErrorCode_OUT_OF_MEMORY;
997 case osl::FileBase::E_INVAL:
999 ioError = IOErrorCode_INVALID_PARAMETER;
1001 case osl::FileBase::E_NAMETOOLONG:
1003 ioError = IOErrorCode_NAME_TOO_LONG;
1005 case osl::FileBase::E_NOENT:
1007 case osl::FileBase::E_NOLINK:
1009 ioError = IOErrorCode_NOT_EXISTING;
1011 case osl::FileBase::E_ROFS:
1014 case osl::FileBase::E_PERM:
1015 case osl::FileBase::E_ACCES:
1017 ioError = IOErrorCode_ACCESS_DENIED;
1019 case osl::FileBase::E_LOOP:
1021 case osl::FileBase::E_FAULT:
1023 case osl::FileBase::E_IO:
1025 case osl::FileBase::E_NOSYS:
1027 case osl::FileBase::E_MULTIHOP:
1029 case osl::FileBase::E_INTR:
1032 ioError = IOErrorCode_GENERAL;
1035 retRange[
i] <<= InteractiveAugmentedIOException(
1038 task::InteractionClassification_ERROR,
1044 retRange[
i] <<= beans::IllegalTypeException(
THROW_WHERE );
1052 seqChanged.realloc( propChanged );
1069uno::Reference< sdbc::XRow >
1071 const OUString& aUnqPath,
1072 const uno::Sequence< beans::Property >&
properties )
1074 uno::Sequence< uno::Any > seq(
properties.getLength() );
1078 osl::FileStatus aFileStatus( n_Mask );
1080 osl::DirectoryItem aDirItem;
1081 osl::FileBase::RC nError1 = osl::DirectoryItem::get( aUnqPath,aDirItem );
1082 if( nError1 != osl::FileBase::E_None )
1087 osl::FileBase::RC nError2 = aDirItem.getFileStatus( aFileStatus );
1088 if( nError1 == osl::FileBase::E_None &&
1089 nError2 != osl::FileBase::E_None )
1095 std::unique_lock aGuard(
m_aMutex );
1097 TaskManager::ContentMap::iterator it =
m_aContent.find( aUnqPath );
1098 commit( aGuard, it, aFileStatus );
1103 [&propset](
const beans::Property& rProp) ->
uno::Any {
1104 MyProperty readProp( rProp.Name );
1105 auto it1 = propset.find( readProp );
1106 if( it1 == propset.end() )
1108 return it1->getValue();
1134 const OUString& srcUnqPath,
1135 const OUString& dstUnqPathIn,
1136 const sal_Int32 NameClash )
1140 if( srcUnqPath == dstUnqPathIn )
1143 osl::FileBase::RC nError;
1144 OUString dstUnqPath( dstUnqPathIn );
1148 case NameClash::KEEP:
1151 if( nError != osl::FileBase::E_None && nError != osl::FileBase::E_EXIST )
1160 case NameClash::OVERWRITE:
1163 OUString targetPath(dstUnqPath);
1165 osl::FileStatus aStatus(osl_FileStatus_Mask_Type|osl_FileStatus_Mask_LinkTargetURL);
1166 osl::DirectoryItem aItem;
1167 (void)osl::DirectoryItem::get(dstUnqPath,aItem);
1168 (void)aItem.getFileStatus(aStatus);
1170 if( aStatus.isValid(osl_FileStatus_Mask_Type) &&
1171 aStatus.isValid(osl_FileStatus_Mask_LinkTargetURL) &&
1172 aStatus.getFileType() == osl::FileStatus::Link )
1173 targetPath = aStatus.getLinkTargetURL();
1176 osl::File::remove( targetPath );
1179 if( nError != osl::FileBase::E_None )
1188 case NameClash::RENAME:
1190 OUString newDstUnqPath;
1192 if( nError == osl::FileBase::E_EXIST )
1196 sal_Int32
nPos = -1;
1197 sal_Int32 nLastDot = dstUnqPath.lastIndexOf(
'.' );
1198 sal_Int32 nLastSlash = dstUnqPath.lastIndexOf(
'/' );
1199 if( ( nLastSlash < nLastDot )
1200 && ( nLastSlash != ( nLastDot - 1 ) ) )
1203 nPos = dstUnqPath.getLength();
1209 newDstUnqPath = dstUnqPath;
1211 OUString aPostfix =
"_" + OUString::number( ++nTry );
1213 newDstUnqPath = newDstUnqPath.replaceAt(
nPos, 0, aPostfix );
1217 while( ( nError == osl::FileBase::E_EXIST ) && ( nTry < 10000 ) );
1220 if( nError == osl::FileBase::E_EXIST )
1226 else if( nError != osl::FileBase::E_None )
1234 dstUnqPath = newDstUnqPath;
1238 case NameClash::ERROR:
1241 if( nError == osl::FileBase::E_EXIST )
1247 else if( nError != osl::FileBase::E_None )
1256 case NameClash::ASK:
1260 if( nError == osl::FileBase::E_EXIST )
1272 osl::DirectoryItem aItem;
1273 nError = osl::DirectoryItem::get( dstUnqPath,aItem );
1274 if( nError != osl::FileBase::E_None )
1281 osl::FileStatus aStatus( osl_FileStatus_Mask_Type );
1282 nError = aItem.getFileStatus( aStatus );
1283 if( nError != osl::FileBase::E_None || ! aStatus.isValid( osl_FileStatus_Mask_Type ) )
1290 bool isDocument = ( aStatus.getFileType() == osl::FileStatus::Regular );
1299 if( aDstParent != aSrcParent )
1319 TaskManager & task, sal_Int32
id, OUString
const & fileUrl,
1320 osl::DirectoryItem * item, osl::FileStatus::Type * type)
1322 OSL_ASSERT(item !=
nullptr && type !=
nullptr);
1323 osl::FileBase::RC
err = osl::DirectoryItem::get(fileUrl, *item);
1324 if (err != osl::FileBase::E_None) {
1328 osl::FileStatus stat(osl_FileStatus_Mask_Type);
1329 err = item->getFileStatus(stat);
1330 if (err != osl::FileBase::E_None) {
1334 *
type = stat.getFileType();
1342 sal_Int32 CommandId,
1343 const OUString& srcUnqPath,
1344 const OUString& dstUnqPathIn,
1345 sal_Int32 NameClash )
1347 osl::FileBase::RC nError;
1348 OUString dstUnqPath( dstUnqPathIn );
1355 osl::DirectoryItem item;
1356 osl::FileStatus::Type
type;
1357 if (!
getType(*
this, CommandId, srcUnqPath, &item, &
type)) {
1360 OUString rslvdSrcUnqPath;
1361 if (
type == osl::FileStatus::Link) {
1362 osl::FileStatus stat(osl_FileStatus_Mask_LinkTargetURL);
1363 nError = item.getFileStatus(stat);
1364 if (nError != osl::FileBase::E_None) {
1369 rslvdSrcUnqPath = stat.getLinkTargetURL();
1370 if (!
getType(*
this, CommandId, srcUnqPath, &item, &
type)) {
1374 rslvdSrcUnqPath = srcUnqPath;
1378 =
type != osl::FileStatus::Directory &&
type != osl::FileStatus::Volume;
1383 case NameClash::KEEP:
1385 nError =
copy_recursive( rslvdSrcUnqPath,dstUnqPath,IsWhat,
true );
1386 if( nError != osl::FileBase::E_None && nError != osl::FileBase::E_EXIST )
1395 case NameClash::OVERWRITE:
1398 remove( CommandId, dstUnqPath, IsWhat,
false );
1401 nError =
copy_recursive( rslvdSrcUnqPath,dstUnqPath,IsWhat,
false );
1402 if( nError != osl::FileBase::E_None )
1411 case NameClash::RENAME:
1413 OUString newDstUnqPath = dstUnqPath;
1414 nError =
copy_recursive( rslvdSrcUnqPath,dstUnqPath,IsWhat,
true );
1416 if( nError == osl::FileBase::E_EXIST )
1420 sal_Int32
nPos = -1;
1421 sal_Int32 nLastDot = dstUnqPath.lastIndexOf(
'.' );
1422 sal_Int32 nLastSlash = dstUnqPath.lastIndexOf(
'/' );
1423 if ( ( nLastSlash < nLastDot )
1424 && ( nLastSlash != ( nLastDot - 1 ) ) )
1427 nPos = dstUnqPath.getLength();
1433 newDstUnqPath = dstUnqPath;
1435 OUString aPostfix =
"_" + OUString::number( ++nTry );
1437 newDstUnqPath = newDstUnqPath.replaceAt(
nPos, 0, aPostfix );
1439 nError =
copy_recursive( rslvdSrcUnqPath,newDstUnqPath,IsWhat,
true );
1441 while( ( nError == osl::FileBase::E_EXIST ) && ( nTry < 10000 ) );
1444 if( nError == osl::FileBase::E_EXIST )
1450 else if( nError != osl::FileBase::E_None )
1458 dstUnqPath = newDstUnqPath;
1462 case NameClash::ERROR:
1464 nError =
copy_recursive( rslvdSrcUnqPath,dstUnqPath,IsWhat,
true );
1466 if( nError == osl::FileBase::E_EXIST )
1472 else if( nError != osl::FileBase::E_None )
1481 case NameClash::ASK:
1484 nError =
copy_recursive( rslvdSrcUnqPath,dstUnqPath,IsWhat,
true );
1486 if( nError == osl::FileBase::E_EXIST )
1514 const OUString& aUnqPath,
1518 sal_Int32 nMask = osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileURL;
1520 osl::DirectoryItem aItem;
1521 osl::FileStatus aStatus( nMask );
1522 osl::FileBase::RC nError;
1526 nError = osl::DirectoryItem::get( aUnqPath, aItem );
1527 if( nError != osl::FileBase::E_None )
1535 return (!MustExist);
1538 nError = aItem.getFileStatus( aStatus );
1539 if( nError != osl::FileBase::E_None || ! aStatus.isValid( nMask ) )
1547 if( aStatus.getFileType() == osl::FileStatus::Regular ||
1548 aStatus.getFileType() == osl::FileStatus::Link )
1550 else if( aStatus.getFileType() == osl::FileStatus::Directory ||
1551 aStatus.getFileType() == osl::FileStatus::Volume )
1558 nError = osl::File::remove( aUnqPath );
1559 if( nError != osl::FileBase::E_None )
1567 return (!MustExist);
1577 osl::Directory aDirectory( aUnqPath );
1579 nError = aDirectory.open();
1580 if( nError != osl::FileBase::E_None )
1588 return (!MustExist);
1591 bool whileSuccess =
true;
1595 nError = aDirectory.getNextItem( aItem );
1596 while( nError == osl::FileBase::E_None )
1598 nError = aItem.getFileStatus( aStatus );
1599 if( nError != osl::FileBase::E_None || ! aStatus.isValid( nMask ) )
1604 whileSuccess =
false;
1608 if( aStatus.getFileType() == osl::FileStatus::Regular ||
1609 aStatus.getFileType() == osl::FileStatus::Link )
1611 else if( aStatus.getFileType() == osl::FileStatus::Directory ||
1612 aStatus.getFileType() == osl::FileStatus::Volume )
1615 name = aStatus.getFileURL();
1616 whileSuccess =
remove( CommandId,
name, recurse, MustExist );
1620 nError = aDirectory.getNextItem( aItem );
1625 if( ! whileSuccess )
1628 if( nError != osl::FileBase::E_NOENT )
1636 nError = osl::Directory::remove( aUnqPath );
1637 if( nError != osl::FileBase::E_None )
1645 return (!MustExist);
1676 const OUString& rUnqPath,
1682 if ( rUnqPath.endsWith(
"/") )
1683 aUnqPath = rUnqPath.copy( 0, rUnqPath.getLength() - 1 );
1685 aUnqPath = rUnqPath;
1687 osl::FileBase::RC nError = osl::Directory::create( aUnqPath );
1691 case osl::FileBase::E_EXIST:
1702 case osl::FileBase::E_INVAL:
1708 case osl::FileBase::E_None:
1736 const OUString& aUnqPath,
1738 const uno::Reference< io::XInputStream >& aInputStream )
1741 bool bSuccess =
write( CommandId,
1767 const OUString& aUnqPath,
1769 const uno::Reference< io::XInputStream >& aInputStream )
1771 if( ! aInputStream.is() )
1784 osl::FileBase::RC
err;
1785 osl::File aFile( aUnqPath );
1789 err = aFile.open( osl_File_OpenFlag_Write | osl_File_OpenFlag_Create );
1791 if(
err != osl::FileBase::E_None )
1794 err = aFile.open( osl_File_OpenFlag_Write );
1796 if(
err != osl::FileBase::E_None )
1807 err = aFile.setSize( 0 );
1808 if(
err != osl::FileBase::E_None )
1819 err = aFile.open( osl_File_OpenFlag_Read | osl_File_OpenFlag_NoLock );
1820 if(
err == osl::FileBase::E_None )
1832 err = aFile.open( osl_File_OpenFlag_Write | osl_File_OpenFlag_Create | osl_File_OpenFlag_NoLock );
1834 if(
err != osl::FileBase::E_None )
1844 bool bSuccess =
true;
1846 sal_uInt64 nWrittenBytes;
1847 sal_Int32 nReadBytes = 0, nRequestedBytes = 32768 ;
1848 uno::Sequence< sal_Int8 > seq( nRequestedBytes );
1854 nReadBytes = aInputStream->readBytes( seq,
1857 catch(
const io::NotConnectedException& )
1864 catch(
const io::BufferSizeExceededException& )
1871 catch(
const io::IOException& )
1881 const sal_Int8*
p = seq.getConstArray();
1883 err = aFile.write(
static_cast<void const *
>(
p),
1884 sal_uInt64( nReadBytes ),
1887 if(
err != osl::FileBase::E_None )
1895 else if( nWrittenBytes != sal_uInt64( nReadBytes ) )
1903 }
while( nReadBytes == nRequestedBytes );
1905 err = aFile.close();
1906 if(
err != osl::FileBase::E_None )
1933 ContentMap::iterator it =
1946 if( !ContentNotDefau || defaultprop.getPropertyName() !=
ContentType )
1962 if (
Url ==
"file:///" ||
Url ==
"file://localhost/" ||
Url ==
"file://127.0.0.1/" )
1968 bool err = osl::FileBase::E_None != osl::FileBase::getSystemPathFromFileURL(
Url,Unq );
1972 sal_Int32 l = Unq.getLength()-1;
1973 if( !
err && Unq.endsWith(
"/") &&
1974 Unq.indexOf(
'/', RTL_CONSTASCII_LENGTH(
"//") ) != -1 )
1975 Unq = Unq.copy(0, l);
1983 bool err = osl::FileBase::E_None != osl::FileBase::getSystemPathFromFileURL( Unq,
Url );
1995 const OUString& dstUnqPath,
1997 bool testExistBeforeCopy )
1999 osl::FileBase::RC
err = osl::FileBase::E_None;
2007 osl::Directory aDir( srcUnqPath );
2010 err = osl::Directory::create( dstUnqPath );
2011 osl::FileBase::RC next =
err;
2012 if(
err == osl::FileBase::E_None )
2014 sal_Int32
const n_Mask = osl_FileStatus_Mask_FileURL | osl_FileStatus_Mask_FileName | osl_FileStatus_Mask_Type;
2016 osl::DirectoryItem aDirItem;
2018 while(
err == osl::FileBase::E_None )
2020 next = aDir.getNextItem( aDirItem );
2021 if (next != osl::FileBase::E_None )
2024 osl::FileStatus aFileStatus( n_Mask );
2025 aDirItem.getFileStatus( aFileStatus );
2026 if( aFileStatus.isValid( osl_FileStatus_Mask_Type ) )
2027 IsDoc = aFileStatus.getFileType() == osl::FileStatus::Regular;
2032 OUString newSrcUnqPath;
2033 if( aFileStatus.isValid( osl_FileStatus_Mask_FileURL ) )
2034 newSrcUnqPath = aFileStatus.getFileURL();
2036 OUString newDstUnqPath = dstUnqPath;
2038 if( aFileStatus.isValid( osl_FileStatus_Mask_FileName ) )
2039 tit = rtl::Uri::encode( aFileStatus.getFileName(),
2040 rtl_UriCharClassPchar,
2041 rtl_UriEncodeIgnoreEscapes,
2042 RTL_TEXTENCODING_UTF8 );
2044 if( !newDstUnqPath.endsWith(
"/" ) )
2045 newDstUnqPath +=
"/";
2047 newDstUnqPath += tit;
2049 if ( newSrcUnqPath != dstUnqPath )
2053 if(
err == osl::FileBase::E_None && next != osl::FileBase::E_NOENT )
2069 const OUString& rUnqPath,
2070 sal_Int32 errorCode )
2074 if ( rUnqPath.isEmpty() )
2077 if ( rUnqPath.endsWith(
"/") )
2078 aPath = rUnqPath.copy( 0, rUnqPath.getLength() - 1 );
2082#if HAVE_FEATURE_MACOSX_SANDBOX
2094 if( osl::FileBase::getSystemPathFromFileURL( aPath, aDirName ) == osl::FileBase::E_None &&
2096 S_ISDIR( s.st_mode ) )
2102 osl::Directory aDirectory( aPath );
2103 osl::FileBase::RC nError = aDirectory.open();
2106 if( nError == osl::File::E_None )
2109 nError = osl::Directory::create( aPath );
2111 if( nError == osl::File::E_None )
2114 bool bSuccess = ( nError == osl::File::E_None || nError == osl::FileBase::E_EXIST );
2120 if ( aParentDir != aPath )
2130 nError = osl::Directory::create( aPath );
2132 if( nError == osl::File::E_None )
2135 bSuccess =( nError == osl::File::E_None || nError == osl::FileBase::E_EXIST );
2157 const uno::Sequence< beans::Property >& seq )
2160 for(
const auto& rProp : seq) {
2161 if(rProp.Name ==
Title)
2162 n_Mask |= osl_FileStatus_Mask_FileName;
2164 n_Mask |= osl_FileStatus_Mask_FileURL;
2173 n_Mask |= (osl_FileStatus_Mask_Type | osl_FileStatus_Mask_LinkTargetURL);
2174 else if(rProp.Name ==
Size)
2175 n_Mask |= (osl_FileStatus_Mask_FileSize |
2176 osl_FileStatus_Mask_Type |
2177 osl_FileStatus_Mask_LinkTargetURL);
2180 n_Mask |= osl_FileStatus_Mask_Attributes;
2182 n_Mask |= osl_FileStatus_Mask_ModifyTime;
2200 if( ( it->second.xS.is() && it->second.xC.is() && it->second.xA.is() )
2205 uno::Reference< ucb::XPersistentPropertySet > xS =
m_xFileRegistry->openPropertySet( it->first,
create );
2208 uno::Reference< beans::XPropertyContainer > xC( xS,uno::UNO_QUERY );
2209 uno::Reference< beans::XPropertyAccess > xA( xS,uno::UNO_QUERY );
2218 const uno::Sequence< beans::Property > seq = xS->getPropertySetInfo()->getProperties();
2220 for(
const auto& rProp : seq )
2226 xS->getPropertyValue( rProp.Name ),
2227 beans::PropertyState_DIRECT_VALUE,
2251 const TaskManager::ContentMap::iterator& it,
2252 const osl::FileStatus& aFileStatus )
2256 if( it->second.properties.empty() )
2258 OUString aPath = it->first;
2267 if( aFileStatus.isValid( osl_FileStatus_Mask_FileName ) )
2269 it1->setValue(
uno::Any(aFileStatus.getFileName()) );
2276 if( aFileStatus.isValid( osl_FileStatus_Mask_FileURL ) )
2278 it1->setValue(
uno::Any(aFileStatus.getFileURL()) );
2285 sal_Int64 dirSize = 0;
2287 if( aFileStatus.isValid( osl_FileStatus_Mask_FileSize ) )
2288 dirSize = aFileStatus.getFileSize();
2290 if( aFileStatus.isValid( osl_FileStatus_Mask_Type ) )
2292 bool isFile,isVolume;
2293 if( osl::FileStatus::Link == aFileStatus.getFileType() &&
2294 aFileStatus.isValid( osl_FileStatus_Mask_LinkTargetURL ) )
2296 osl::DirectoryItem aDirItem;
2297 osl::FileStatus aFileStatus2( osl_FileStatus_Mask_Type );
2298 if( osl::FileBase::E_None == osl::DirectoryItem::get( aFileStatus.getLinkTargetURL(),aDirItem ) &&
2299 osl::FileBase::E_None == aDirItem.getFileStatus( aFileStatus2 ) &&
2300 aFileStatus2.isValid( osl_FileStatus_Mask_Type ) )
2302 isVolume = osl::FileStatus::Volume == aFileStatus2.getFileType();
2304 osl::FileStatus::Volume == aFileStatus2.getFileType() ||
2305 osl::FileStatus::Directory == aFileStatus2.getFileType();
2307 osl::FileStatus::Regular == aFileStatus2.getFileType();
2309 if( aFileStatus2.isValid( osl_FileStatus_Mask_FileSize ) )
2310 dirSize = aFileStatus2.getFileSize();
2317 isVolume = osl::FileStatus::Volume == aFileStatus.getFileType();
2319 osl::FileStatus::Volume == aFileStatus.getFileType() ||
2320 osl::FileStatus::Directory == aFileStatus.getFileType();
2322 osl::FileStatus::Regular == aFileStatus.getFileType();
2327 isVolume = osl::FileStatus::Volume == aFileStatus.getFileType();
2329 osl::FileStatus::Volume == aFileStatus.getFileType() ||
2330 osl::FileStatus::Directory == aFileStatus.getFileType();
2332 osl::FileStatus::Regular == aFileStatus.getFileType();
2337 it1->setValue(
uno::Any( isVolume ) );
2341 it1->setValue(
uno::Any( isDirectory ) );
2345 it1->setValue(
uno::Any( isFile ) );
2347 osl::VolumeInfo aVolumeInfo( osl_VolumeInfo_Mask_Attributes );
2349 osl::FileBase::E_None == osl::Directory::getVolumeInfo( it->first,aVolumeInfo ) &&
2350 aVolumeInfo.isValid( osl_VolumeInfo_Mask_Attributes ) )
2353 bool isRemote = aVolumeInfo.getRemoteFlag();
2354 bool isRemoveable = aVolumeInfo.getRemoveableFlag();
2355 bool isCompactDisc = aVolumeInfo.getCompactDiscFlag();
2356 bool isFloppy = aVolumeInfo.getFloppyDiskFlag();
2360 it1->setValue(
uno::Any( isRemote ) );
2364 it1->setValue(
uno::Any( isRemoveable ) );
2368 it1->setValue(
uno::Any( isCompactDisc ) );
2372 it1->setValue(
uno::Any( isFloppy ) );
2379 it1->setValue( aAny );
2383 it1->setValue( aAny );
2387 it1->setValue( aAny );
2391 it1->setValue( aAny );
2396 isDirectory =
false;
2401 it1->setValue(
uno::Any( dirSize ) );
2406 if( aFileStatus.isValid( osl_FileStatus_Mask_Attributes ) )
2408 sal_uInt64
Attr = aFileStatus.getAttributes();
2409 bool readonly = (
Attr & osl_File_Attribute_ReadOnly ) != 0;
2410 it1->setValue(
uno::Any( readonly ) );
2417 if( aFileStatus.isValid( osl_FileStatus_Mask_Attributes ) )
2419 sal_uInt64
Attr = aFileStatus.getAttributes();
2420 bool ishidden = (
Attr & osl_File_Attribute_Hidden ) != 0;
2421 it1->setValue(
uno::Any( ishidden ) );
2428 if( aFileStatus.isValid( osl_FileStatus_Mask_ModifyTime ) )
2430 TimeValue temp = aFileStatus.getModifyTime();
2433 TimeValue myLocalTime;
2434 if (!osl_getLocalTimeFromSystemTime( &temp, &myLocalTime ))
2438 "cannot convert (" << temp.Seconds <<
", " << temp.Nanosec
2439 <<
") to local time");
2443 oslDateTime myDateTime;
2444 osl_getDateTimeFromTimeValue( &myLocalTime, &myDateTime );
2445 util::DateTime aDateTime;
2447 aDateTime.NanoSeconds = myDateTime.NanoSeconds;
2448 aDateTime.Seconds = myDateTime.Seconds;
2449 aDateTime.Minutes = myDateTime.Minutes;
2450 aDateTime.Hours = myDateTime.Hours;
2451 aDateTime.Day = myDateTime.Day;
2452 aDateTime.Month = myDateTime.Month;
2453 aDateTime.Year = myDateTime.Year;
2454 it1->setValue(
uno::Any( aDateTime ) );
2461 isDirectory || !aFileStatus.isValid( osl_FileStatus_Mask_Type )
2463 : uno::Sequence< ucb::ContentInfo >() ) );
2473 const uno::Sequence< beans::Property >&
properties,
2474 osl::DirectoryItem& aDirItem,
2477 uno::Reference< sdbc::XRow > & row )
2479 uno::Sequence< uno::Any > seq(
properties.getLength() );
2485 osl::FileStatus aFileStatus( n_Mask |
2486 osl_FileStatus_Mask_FileURL |
2487 osl_FileStatus_Mask_Type |
2488 osl_FileStatus_Mask_LinkTargetURL );
2490 osl::FileBase::RC aRes = aDirItem.getFileStatus( aFileStatus );
2491 if ( aRes != osl::FileBase::E_None )
2495 "osl::DirectoryItem::getFileStatus failed with " << +aRes);
2499 aUnqPath = aFileStatus.getFileURL();
2503 if ( aFileStatus.getFileType() == osl::FileStatus::Link )
2507 osl::DirectoryItem aTargetItem;
2508 (void)osl::DirectoryItem::get( aFileStatus.getLinkTargetURL(), aTargetItem );
2509 if ( aTargetItem.is() )
2511 osl::FileStatus aTargetStatus( osl_FileStatus_Mask_Type );
2513 if ( osl::FileBase::E_None == aTargetItem.getFileStatus( aTargetStatus ) )
2515 aTargetStatus.getFileType() == osl::FileStatus::Regular;
2519 aIsRegular = aFileStatus.getFileType() == osl::FileStatus::Regular;
2522 std::unique_lock aGuard(
m_aMutex );
2526 TaskManager::ContentMap::iterator it =
m_aContent.find( aUnqPath );
2527 commit( aGuard, it, aFileStatus );
2532 [&propset](
const beans::Property& rProp) ->
uno::Any {
2533 MyProperty readProp( rProp.Name );
2534 auto it1 = propset.find( readProp );
2535 if( it1 == propset.end() )
2537 return it1->getValue();
2549std::vector< ContentEventNotifier >
2552 std::vector< ContentEventNotifier > listeners;
2554 std::unique_lock aGuard(
m_aMutex );
2556 if( it !=
m_aContent.end() && !it->second.notifier.empty() )
2558 std::vector<Notifier*>& listOfNotifiers = it->second.notifier;
2559 for (
auto const& pointer : listOfNotifiers)
2561 std::optional<ContentEventNotifier> notifier = pointer->cCEL();
2563 listeners.push_back( std::move(*notifier) );
2571std::vector< ContentEventNotifier >
2574 std::vector< ContentEventNotifier > listeners;
2576 std::unique_lock aGuard(
m_aMutex );
2578 if( it !=
m_aContent.end() && !it->second.notifier.empty() )
2580 std::vector<Notifier*>& listOfNotifiers = it->second.notifier;
2581 for (
auto const& pointer : listOfNotifiers)
2583 std::optional<ContentEventNotifier> notifier = pointer->cDEL();
2585 listeners.push_back( std::move(*notifier) );
2593 const OUString& aChildName)
2595 for (
const auto & l : listeners )
2597 l.notifyChildInserted( aChildName );
2602 const std::vector<ContentEventNotifier>& listeners)
2604 for(
auto const & l : listeners )
2611 const std::vector<ContentEventNotifier>& listeners,
const OUString& aChildName)
2613 for(
auto const & l : listeners )
2615 l.notifyRemoved( aChildName );
2620std::vector< PropertySetInfoChangeNotifier >
2623 std::vector< PropertySetInfoChangeNotifier > listeners;
2625 std::unique_lock aGuard(
m_aMutex );
2627 if( it !=
m_aContent.end() && !it->second.notifier.empty() )
2629 std::vector<Notifier*>& listOfNotifiers = it->second.notifier;
2630 for (
auto const& pointer : listOfNotifiers)
2632 std::optional<PropertySetInfoChangeNotifier> notifier = pointer->cPSL();
2634 listeners.push_back( std::move(*notifier) );
2642 const std::vector<PropertySetInfoChangeNotifier>& listeners,
2643 const OUString& aPropertyName)
2645 for(
auto const & l : listeners )
2647 l.notifyPropertyAdded( aPropertyName );
2652 const std::vector<PropertySetInfoChangeNotifier>& listeners,
2653 const OUString& aPropertyName)
2655 for(
auto const & l : listeners )
2657 l.notifyPropertyRemoved( aPropertyName );
2662std::vector< ContentEventNotifier >
2664 const OUString& aNewPrefix,
2667 std::vector< ContentEventNotifier > aVector;
2672 std::vector< OUString > oldChildList;
2675 std::unique_lock aGuard(
m_aMutex );
2677 if( ! withChildren )
2679 aOldName = aOldPrefix;
2680 aNewName = aNewPrefix;
2687 if(
isChild( aOldPrefix, content.first ) )
2689 oldChildList.push_back( content.first );
2692 count = oldChildList.size();
2696 for( sal_Int32 j = 0; j <
count; ++j )
2700 aOldName = oldChildList[j];
2701 aNewName =
newName( aNewPrefix,aOldPrefix,aOldName );
2704 TaskManager::ContentMap::iterator itold =
m_aContent.find( aOldName );
2707 TaskManager::ContentMap::iterator itnew =
m_aContent.emplace(
2711 itnew->second.properties = std::move(itold->second.properties);
2714 std::vector< Notifier* > copyList;
2715 std::swap(copyList, itnew->second.notifier);
2716 itnew->second.notifier = std::move(itold->second.notifier);
2722 if (!itnew->second.notifier.empty())
2724 std::vector<Notifier*>& listOfNotifiers = itnew->second.notifier;
2725 for (
auto const& pointer : listOfNotifiers)
2727 std::optional<ContentEventNotifier> notifier = pointer->cEXC( aNewName );
2729 aVector.push_back( std::move(*notifier) );
2735 itnew->second.notifier.insert(itnew->second.notifier.end(),
2736 copyList.begin(), copyList.end() );
2746 const std::vector<ContentEventNotifier>& listeners_vec)
2748 for(
auto & l : listeners_vec)
2750 l.notifyExchanged();
2755std::vector< PropertyChangeNotifier >
2758 std::vector< PropertyChangeNotifier > listeners;
2760 std::unique_lock aGuard(
m_aMutex );
2762 if( it !=
m_aContent.end() && !it->second.notifier.empty() )
2764 std::vector<Notifier*>& listOfNotifiers = it->second.notifier;
2765 for (
auto const& pointer : listOfNotifiers)
2767 std::optional<PropertyChangeNotifier> notifier = pointer->cPCL();
2769 listeners.push_back( std::move(*notifier) );
2777 const std::vector<PropertyChangeNotifier>& listeners,
2778 const uno::Sequence<beans::PropertyChangeEvent>& seqChanged)
2780 for(
auto const & l : listeners )
2782 l.notifyPropertyChanged( seqChanged );
2796 std::unique_lock aGuard(
m_aMutex );
2797 ContentMap::iterator it =
m_aContent.find( aUnqPath );
2800 it->second.xS =
nullptr;
2801 it->second.xC =
nullptr;
2802 it->second.xA =
nullptr;
2804 it->second.properties.clear();
2821 if( ! withChildren )
2827 uno::Reference< container::XNameAccess > xName(
m_xFileRegistry,uno::UNO_QUERY );
2828 const uno::Sequence< OUString > seqNames = xName->getElementNames();
2830 OUString old_Name = aUnqPath;
2832 for(
const auto& rName : seqNames )
2834 if( ! (
isChild( old_Name,rName ) ) )
2851 const OUString& dstUnqPath )
2853 uno::Reference< XPersistentPropertySet > x_src =
2860 const uno::Sequence< beans::Property > seqProperty =
2861 x_src->getPropertySetInfo()->getProperties();
2863 if( ! seqProperty.hasElements() )
2866 uno::Reference< XPersistentPropertySet >
2868 uno::Reference< beans::XPropertyContainer >
2869 x_dstC( x_dstS,uno::UNO_QUERY );
2871 for(
const auto& rProperty : seqProperty )
2873 x_dstC->addProperty( rProperty.Name,
2874 rProperty.Attributes,
2875 x_src->getPropertyValue( rProperty.Name ) );
2881 const OUString& dstUnqPath,
2890 if( ! withChildren )
2896 uno::Reference< container::XNameAccess > xName(
m_xFileRegistry,uno::UNO_QUERY );
2897 const uno::Sequence< OUString > seqNames = xName->getElementNames();
2901 for(
const auto& rName : seqNames )
2903 if( ! (
isChild( srcUnqPath,rName ) ) )
2906 new_Name =
newName( dstUnqPath,srcUnqPath,rName );
2916 uno::Sequence< beans::Property >
props
2922 {
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 commit(std::unique_lock< std::mutex > &rGuard, const TaskManager::ContentMap::iterator &it, const osl::FileStatus &aFileStatus)
Commit inserts the determined properties in the filestatus object into the internal map,...
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)
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...
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, std::u16string_view aOldPrefix, std::u16string_view old_Name)
bool isChild(std::u16string_view srcUnqPath, std::u16string_view dstUnqPath)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
bool getType(BSTR name, Type &type)
std::vector< char * > values