21#include <com/sun/star/io/BufferSizeExceededException.hpp>
22#include <com/sun/star/io/NotConnectedException.hpp>
23#include <com/sun/star/beans/PropertyAttribute.hpp>
48 static ::cppu::OTypeCollection ourTypeCollection(
50 ,OTempFileBase::getTypes() );
52 return ourTypeCollection.getTypes();
59 std::unique_lock aGuard(
maMutex );
64 throw css::uno::RuntimeException(
"Not connected to a file.");
71 std::unique_lock aGuard(
maMutex );
76 throw css::uno::RuntimeException(
"Not connected to a file.");
84 std::unique_lock aGuard(
maMutex );
88 throw css::uno::RuntimeException(
"Not connected to a file.");
96 std::unique_lock aGuard(
maMutex );
100 throw css::uno::RuntimeException(
"Not connected to a file.");
110 std::unique_lock aGuard(
maMutex );
112 throw css::io::NotConnectedException ( OUString(), getXWeak() );
115 if (nBytesToRead < 0)
116 throw css::io::BufferSizeExceededException( OUString(), getXWeak());
118 if (
aData.getLength() < nBytesToRead)
119 aData.realloc(nBytesToRead);
125 aData.realloc( nRead );
132 std::unique_lock aGuard(
maMutex );
134 throw css::io::NotConnectedException ( OUString(), getXWeak() );
139 if (nMaxBytesToRead < 0)
140 throw css::io::BufferSizeExceededException( OUString(), getXWeak() );
152 std::unique_lock aGuard(
maMutex );
154 throw css::io::NotConnectedException ( OUString(), getXWeak() );
163 std::unique_lock aGuard(
maMutex );
165 throw css::io::NotConnectedException ( OUString(), getXWeak() );
176 std::unique_lock aGuard(
maMutex );
178 throw css::io::NotConnectedException ( OUString(), getXWeak() );
194 std::unique_lock aGuard(
maMutex );
196 throw css::io::NotConnectedException ( OUString(), getXWeak() );
201 if ( nWritten !=
static_cast<sal_uInt32
>(
aData.getLength()))
202 throw css::io::BufferSizeExceededException( OUString(), getXWeak() );
206 std::unique_lock aGuard(
maMutex );
208 throw css::io::NotConnectedException ( OUString(), getXWeak() );
216 std::unique_lock aGuard(
maMutex );
218 throw css::io::NotConnectedException ( OUString(), getXWeak() );
239 throw css::io::NotConnectedException ( OUString(),
const_cast < OTempFileService *
> (
this)->getXWeak() );
248 | StreamMode::SHARE_DENYWRITE);
252 throw css::io::NotConnectedException ( OUString(), getXWeak() );
259 std::unique_lock aGuard(
maMutex );
263 if ( nLocation < 0 || nLocation > nEndPos )
264 throw css::lang::IllegalArgumentException();
271 std::unique_lock aGuard(
maMutex );
276 return static_cast<sal_Int64
>(
nPos);
280 std::unique_lock aGuard(
maMutex );
306 std::unique_lock aGuard(
maMutex );
314#define PROPERTY_HANDLE_URI 1
315#define PROPERTY_HANDLE_REMOVE_FILE 2
316#define PROPERTY_HANDLE_RESOURCE_NAME 3
326 css::beans::PropertyAttribute::READONLY ),
330 css::beans::PropertyAttribute::READONLY )
333 static css::uno::Reference< css::beans::XPropertySetInfo > xInfo(
339 if ( aPropertyName ==
"RemoveFile" )
344 throw css::beans::UnknownPropertyException(aPropertyName);
349 if ( aPropertyName ==
"RemoveFile" )
351 else if ( aPropertyName ==
"ResourceName" )
353 else if ( aPropertyName ==
"Uri" )
354 return css::uno::Any(
getUri());
358 throw css::beans::UnknownPropertyException(aPropertyName);
385 throw css::beans::UnknownPropertyException(OUString::number(
nHandle));
396 throw css::beans::UnknownPropertyException(OUString::number(
nHandle));
409 for (
auto const & rPropVal : aProps )
420 return "com.sun.star.io.comp.TempFile";
424 return {
"com.sun.star.io.TempFile" };
427extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
429 css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any>
const&)
constexpr OUStringLiteral sServiceName
virtual void SAL_CALL skipBytes(::sal_Int32 nBytesToSkip) override
virtual void SAL_CALL addVetoableChangeListener(const ::rtl::OUString &PropertyName, const ::css::uno::Reference< ::css::beans::XVetoableChangeListener > &aListener) override
virtual void SAL_CALL setRemoveFile(sal_Bool _removefile) override
virtual sal_Int64 SAL_CALL getPosition() override
virtual ::css::uno::Any SAL_CALL getFastPropertyValue(::sal_Int32 nHandle) override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual void SAL_CALL closeInput() override
virtual OUString SAL_CALL getUri() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual ::css::uno::Any SAL_CALL getPropertyValue(const ::rtl::OUString &PropertyName) override
virtual ::sal_Int32 SAL_CALL readSomeBytes(css::uno::Sequence< ::sal_Int8 > &aData, ::sal_Int32 nMaxBytesToRead) override
virtual void SAL_CALL setFastPropertyValue(::sal_Int32 nHandle, const ::css::uno::Any &aValue) override
virtual void SAL_CALL closeOutput() override
virtual ::css::uno::Reference< ::css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual void SAL_CALL addPropertyChangeListener(const ::rtl::OUString &aPropertyName, const ::css::uno::Reference< ::css::beans::XPropertyChangeListener > &xListener) override
virtual ::css::uno::Sequence< ::css::beans::PropertyValue > SAL_CALL getPropertyValues() override
virtual void SAL_CALL seek(sal_Int64 location) override
virtual ::sal_Int32 SAL_CALL available() override
virtual css::uno::Reference< css::io::XOutputStream > SAL_CALL getOutputStream() override
virtual OUString SAL_CALL getImplementationName() override
std::optional< utl::TempFileNamed > mpTempFile
virtual void SAL_CALL removeVetoableChangeListener(const ::rtl::OUString &PropertyName, const ::css::uno::Reference< ::css::beans::XVetoableChangeListener > &aListener) override
virtual void SAL_CALL flush() override
OTempFileService(css::uno::Reference< css::uno::XComponentContext > const &context)
virtual OUString SAL_CALL getResourceName() override
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getInputStream() override
virtual sal_Bool SAL_CALL supportsService(const OUString &sServiceName) override
virtual void SAL_CALL writeBytes(const css::uno::Sequence< ::sal_Int8 > &aData) override
virtual sal_Int64 SAL_CALL getLength() override
virtual ::sal_Int32 SAL_CALL readBytes(css::uno::Sequence< ::sal_Int8 > &aData, ::sal_Int32 nBytesToRead) override
virtual void SAL_CALL removePropertyChangeListener(const ::rtl::OUString &aPropertyName, const ::css::uno::Reference< ::css::beans::XPropertyChangeListener > &aListener) override
virtual void SAL_CALL setPropertyValues(const ::css::uno::Sequence< ::css::beans::PropertyValue > &aProps) override
virtual sal_Bool SAL_CALL getRemoveFile() override
virtual void SAL_CALL truncate() override
virtual void SAL_CALL setPropertyValue(const ::rtl::OUString &aPropertyName, const ::css::uno::Any &aValue) override
virtual ~OTempFileService() override
virtual sal_uInt64 TellEnd()
std::size_t WriteBytes(const void *pData, std::size_t nSize)
bool SetStreamSize(sal_uInt64 nSize)
sal_uInt64 Seek(sal_uInt64 nPos)
std::size_t ReadBytes(void *pData, std::size_t nSize)
sal_uInt64 SeekRel(sal_Int64 nPos)
sal_uInt64 remainingSize()
static css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL createPropertySetInfo(IPropertyArrayHelper &rProperties)
constexpr OUStringLiteral aData
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * unotools_OTempFileService_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
#define PROPERTY_HANDLE_REMOVE_FILE
#define PROPERTY_HANDLE_RESOURCE_NAME
#define PROPERTY_HANDLE_URI