Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
52aee9a4
Kaydet (Commit)
52aee9a4
authored
May 03, 2005
tarafından
Oliver Bolte
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
INTEGRATION: CWS savewrap1 (1.97.12); FILE MERGED
2005/04/28 11:45:36 mav 1.97.12.1: #i47821# new helper class
üst
5d6563d1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
20 deletions
+70
-20
ZipPackage.cxx
package/source/zippackage/ZipPackage.cxx
+70
-20
No files found.
package/source/zippackage/ZipPackage.cxx
Dosyayı görüntüle @
52aee9a4
...
@@ -2,9 +2,9 @@
...
@@ -2,9 +2,9 @@
*
*
* $RCSfile: ZipPackage.cxx,v $
* $RCSfile: ZipPackage.cxx,v $
*
*
* $Revision: 1.9
7
$
* $Revision: 1.9
8
$
*
*
* last change: $Author:
vg $ $Date: 2005-02-25 09:38:23
$
* last change: $Author:
obo $ $Date: 2005-05-03 13:56:10
$
*
*
* The Contents of this file are made available subject to the terms of
* The Contents of this file are made available subject to the terms of
* either of the following licenses
* either of the following licenses
...
@@ -130,6 +130,9 @@
...
@@ -130,6 +130,9 @@
#ifndef _CPPUHELPER_FACTORY_HXX_
#ifndef _CPPUHELPER_FACTORY_HXX_
#include <cppuhelper/factory.hxx>
#include <cppuhelper/factory.hxx>
#endif
#endif
#ifndef _CPPUHELPER_EXC_HLP_HXX_
#include <cppuhelper/exc_hlp.hxx>
#endif
#ifndef _COM_SUN_STAR_UCB_TRANSFERINFO_HPP_
#ifndef _COM_SUN_STAR_UCB_TRANSFERINFO_HPP_
#include <com/sun/star/ucb/TransferInfo.hpp>
#include <com/sun/star/ucb/TransferInfo.hpp>
#endif
#endif
...
@@ -151,6 +154,9 @@
...
@@ -151,6 +154,9 @@
#ifndef _COM_SUN_STAR_IO_XACTIVEDATASTREAMER_HPP_
#ifndef _COM_SUN_STAR_IO_XACTIVEDATASTREAMER_HPP_
#include <com/sun/star/io/XActiveDataStreamer.hpp>
#include <com/sun/star/io/XActiveDataStreamer.hpp>
#endif
#endif
#ifndef _COM_SUN_STAR_EMBED_XTRANSACTEDOBJECT_HPP_
#include <com/sun/star/embed/XTransactedObject.hpp>
#endif
#ifndef _COM_SUN_STAR_EMBED_USEBACKUPEXCEPTION_HPP_
#ifndef _COM_SUN_STAR_EMBED_USEBACKUPEXCEPTION_HPP_
#include <com/sun/star/embed/UseBackupException.hpp>
#include <com/sun/star/embed/UseBackupException.hpp>
#endif
#endif
...
@@ -942,12 +948,11 @@ sal_Bool ZipPackage::writeFileIsTemp()
...
@@ -942,12 +948,11 @@ sal_Bool ZipPackage::writeFileIsTemp()
// In case the target local file does not exist or empty
// In case the target local file does not exist or empty
// write directly to it otherwize create a temporary file to write to
// write directly to it otherwize create a temporary file to write to
sal_Bool
a
UseTemp
=
sal_True
;
sal_Bool
b
UseTemp
=
sal_True
;
Reference
<
XOutputStream
>
xTempOut
;
Reference
<
XOutputStream
>
xTempOut
;
Reference
<
XActiveDataStreamer
>
xSink
;
Reference
<
XActiveDataStreamer
>
xSink
;
if
(
eMode
==
e_IMode_URL
&&
!
pZipFile
if
(
eMode
==
e_IMode_URL
&&
!
pZipFile
&&
isLocalFile_Impl
(
sURL
)
)
&&
isLocalFile_Impl
(
sURL
)
)
{
{
xSink
=
openOriginalForOutput
();
xSink
=
openOriginalForOutput
();
if
(
xSink
.
is
()
)
if
(
xSink
.
is
()
)
...
@@ -957,12 +962,19 @@ sal_Bool ZipPackage::writeFileIsTemp()
...
@@ -957,12 +962,19 @@ sal_Bool ZipPackage::writeFileIsTemp()
{
{
xTempOut
=
xStr
->
getOutputStream
();
xTempOut
=
xStr
->
getOutputStream
();
if
(
xTempOut
.
is
()
)
if
(
xTempOut
.
is
()
)
a
UseTemp
=
sal_False
;
b
UseTemp
=
sal_False
;
}
}
}
}
}
}
else
if
(
eMode
==
e_IMode_XStream
&&
!
pZipFile
)
{
// write directly to an empty stream
xTempOut
=
xStream
->
getOutputStream
();
if
(
xTempOut
.
is
()
)
bUseTemp
=
sal_False
;
}
if
(
a
UseTemp
)
if
(
b
UseTemp
)
{
{
// create temporary file
// create temporary file
const
OUString
sServiceName
(
RTL_CONSTASCII_USTRINGPARAM
(
"com.sun.star.io.TempFile"
)
);
const
OUString
sServiceName
(
RTL_CONSTASCII_USTRINGPARAM
(
"com.sun.star.io.TempFile"
)
);
...
@@ -1121,26 +1133,64 @@ sal_Bool ZipPackage::writeFileIsTemp()
...
@@ -1121,26 +1133,64 @@ sal_Bool ZipPackage::writeFileIsTemp()
}
}
// Update our References to point to the new temp file
// Update our References to point to the new temp file
if
(
a
UseTemp
)
if
(
b
UseTemp
)
{
{
xContentStream
=
Reference
<
XInputStream
>
(
xTempOut
,
UNO_QUERY
);
xContentStream
=
Reference
<
XInputStream
>
(
xTempOut
,
UNO_QUERY
_THROW
);
xContentSeek
=
Reference
<
XSeekable
>
(
xTempOut
,
UNO_QUERY
);
xContentSeek
=
Reference
<
XSeekable
>
(
xTempOut
,
UNO_QUERY
_THROW
);
}
}
else
else
{
{
// the case when the original file was written directly
// the case when the original contents were written directly
try
try
{
{
// the output should be closed after request fo input
xTempOut
->
flush
();
// to avoid file closing
xContentStream
=
xSink
->
getStream
()
->
getInputStream
();
// in case the stream supports transactions it should be commited
xTempOut
->
closeOutput
();
uno
::
Reference
<
beans
::
XPropertySet
>
xProps
(
xTempOut
,
uno
::
UNO_QUERY
);
xContentSeek
=
Reference
<
XSeekable
>
(
xContentStream
,
UNO_QUERY
);
if
(
xProps
.
is
()
)
{
uno
::
Reference
<
embed
::
XTransactedObject
>
xTransactObj
;
try
{
// if the property provides a valid object the transaction is required
xProps
->
getPropertyValue
(
::
rtl
::
OUString
(
RTL_CONSTASCII_USTRINGPARAM
(
"TransactionSupport"
)
)
)
>>=
xTransactObj
;
}
catch
(
uno
::
Exception
&
)
{
}
if
(
xTransactObj
.
is
()
)
xTransactObj
->
commit
();
}
// in case the stream is based on a file it will implement the following interface
// the call should be used to be sure that the contents are written to the file system
uno
::
Reference
<
io
::
XAsyncOutputMonitor
>
asyncOutputMonitor
(
xTempOut
,
uno
::
UNO_QUERY
);
if
(
asyncOutputMonitor
.
is
()
)
asyncOutputMonitor
->
waitForCompletion
();
if
(
eMode
==
e_IMode_URL
)
xContentStream
=
xSink
->
getStream
()
->
getInputStream
();
else
if
(
eMode
==
e_IMode_XStream
)
xContentStream
=
xStream
->
getInputStream
();
}
}
catch
(
Exception
&
)
catch
(
lang
::
WrappedTarget
Exception
&
)
{
{
throw
;
}
}
catch
(
uno
::
Exception
&
)
{
// the original content is written directly here only in case either it did not exist before
// or was empty, in both cases no information loss appeares, thus no special handling is required
uno
::
Any
aCaught
(
::
cppu
::
getCaughtException
()
);
throw
WrappedTargetException
(
OUString
(
RTL_CONSTASCII_USTRINGPARAM
(
"Problem writing the original content!"
)
),
static_cast
<
OWeakObject
*
>
(
this
),
aCaught
);
}
xContentSeek
=
Reference
<
XSeekable
>
(
xContentStream
,
UNO_QUERY_THROW
);
OSL_ENSURE
(
xContentStream
.
is
()
&&
xContentSeek
.
is
(),
"XSeekable interface is required!"
);
OSL_ENSURE
(
xContentStream
.
is
()
&&
xContentSeek
.
is
(),
"XSeekable interface is required!"
);
}
}
...
@@ -1152,7 +1202,7 @@ sal_Bool ZipPackage::writeFileIsTemp()
...
@@ -1152,7 +1202,7 @@ sal_Bool ZipPackage::writeFileIsTemp()
else
else
pZipFile
=
new
ZipFile
(
xContentStream
,
xFactory
,
sal_False
);
pZipFile
=
new
ZipFile
(
xContentStream
,
xFactory
,
sal_False
);
return
a
UseTemp
;
return
b
UseTemp
;
}
}
Reference
<
XActiveDataStreamer
>
ZipPackage
::
openOriginalForOutput
()
Reference
<
XActiveDataStreamer
>
ZipPackage
::
openOriginalForOutput
()
...
@@ -1379,7 +1429,7 @@ void ZipPackage::DisconnectFromTargetAndThrowException_Impl( const uno::Referenc
...
@@ -1379,7 +1429,7 @@ void ZipPackage::DisconnectFromTargetAndThrowException_Impl( const uno::Referenc
}
}
catch
(
uno
::
Exception
&
)
catch
(
uno
::
Exception
&
)
{
{
OSL_ENSURE
(
sal_False
,
"Th
is
calls are pretty simple, they should not fail!
\n
"
);
OSL_ENSURE
(
sal_False
,
"Th
ese
calls are pretty simple, they should not fail!
\n
"
);
}
}
::
rtl
::
OUString
aErrTxt
(
RTL_CONSTASCII_USTRINGPARAM
(
"This package is read only!"
)
);
::
rtl
::
OUString
aErrTxt
(
RTL_CONSTASCII_USTRINGPARAM
(
"This package is read only!"
)
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment