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
95a9655a
Kaydet (Commit)
95a9655a
authored
Kas 08, 2001
tarafından
Kai Ahrens
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#94204#: write XML stream directly to storage
üst
401f6f58
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
195 additions
and
129 deletions
+195
-129
codec.cxx
svx/source/gallery2/codec.cxx
+53
-75
codec.hxx
svx/source/gallery2/codec.hxx
+4
-7
galmisc.cxx
svx/source/gallery2/galmisc.cxx
+35
-37
galtheme.cxx
svx/source/gallery2/galtheme.cxx
+103
-10
No files found.
svx/source/gallery2/codec.cxx
Dosyayı görüntüle @
95a9655a
...
...
@@ -2,9 +2,9 @@
*
* $RCSfile: codec.cxx,v $
*
* $Revision: 1.
2
$
* $Revision: 1.
3
$
*
* last change: $Author: ka $ $Date: 2001-11-0
7 08:42:05
$
* last change: $Author: ka $ $Date: 2001-11-0
8 19:00:17
$
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
...
...
@@ -106,7 +106,7 @@ BOOL GalleryCodec::IsCoded( SvStream& rStm, UINT32& rVersion )
// -----------------------------------------------------------------------------
ULONG
GalleryCodec
::
Write
(
SvMemory
Stream
&
rStmToWrite
)
void
GalleryCodec
::
Write
(
Sv
Stream
&
rStmToWrite
)
{
UINT32
nPos
,
nCompSize
;
...
...
@@ -122,23 +122,20 @@ ULONG GalleryCodec::Write( SvMemoryStream& rStmToWrite )
ZCodec
aCodec
;
aCodec
.
BeginCompression
();
aCodec
.
Write
(
rStm
,
static_cast
<
const
BYTE
*
>
(
rStmToWrite
.
GetData
()
),
nSize
);
aCodec
.
Compress
(
rStmToWrite
,
rStm
);
aCodec
.
EndCompression
();
nCompSize
=
rStm
.
Tell
()
-
nPos
-
4UL
;
rStm
.
Seek
(
nPos
);
rStm
<<
nCompSize
;
rStm
.
Seek
(
STREAM_SEEK_TO_END
);
return
0UL
;
}
// -----------------------------------------------------------------------------
ULONG
GalleryCodec
::
Read
(
SvMemory
Stream
&
rStmToRead
)
void
GalleryCodec
::
Read
(
Sv
Stream
&
rStmToRead
)
{
UINT32
nVersion
=
0
;
UINT32
nReadBytes
=
0
;
UINT32
nVersion
=
0
;
if
(
IsCoded
(
rStm
,
nVersion
)
)
{
...
...
@@ -150,78 +147,59 @@ ULONG GalleryCodec::Read( SvMemoryStream& rStmToRead )
// decompress
if
(
1
==
nVersion
)
pUnCompressedBuffer
=
ImpReadRLEBuffer
(
rStm
,
nCompressedSize
,
nUnCompressedSize
);
else
if
(
2
==
nVersion
)
pUnCompressedBuffer
=
ImpReadZBuffer
(
rStm
,
nCompressedSize
,
nUnCompressedSize
);
if
(
pUnCompressedBuffer
)
rStmToRead
.
SetBuffer
(
reinterpret_cast
<
char
*
>
(
pUnCompressedBuffer
),
nUnCompressedSize
,
TRUE
,
nUnCompressedSize
);
}
return
nReadBytes
;
}
// -----------------------------------------------------------------------------
BYTE
*
GalleryCodec
::
ImpReadRLEBuffer
(
SvStream
&
rIStm
,
ULONG
nCompressedSize
,
ULONG
nUnCompressedSize
)
{
BYTE
*
pCompressedBuffer
=
new
BYTE
[
nCompressedSize
];
rIStm
.
Read
(
pCompressedBuffer
,
nCompressedSize
);
BYTE
*
pInBuf
=
pCompressedBuffer
;
BYTE
*
pOutBuf
=
new
BYTE
[
nUnCompressedSize
];
BYTE
*
pTmpBuf
=
pOutBuf
;
BYTE
*
pLast
=
pOutBuf
+
nUnCompressedSize
-
1
;
ULONG
nIndex
=
0UL
;
ULONG
nCountByte
;
ULONG
nRunByte
;
BOOL
bEndDecoding
=
FALSE
;
do
{
nCountByte
=
*
pInBuf
++
;
if
(
!
nCountByte
)
{
nRunByte
=
*
pInBuf
++
;
if
(
nRunByte
>
2
)
BYTE
*
pCompressedBuffer
=
new
BYTE
[
nCompressedSize
];
rStm
.
Read
(
pCompressedBuffer
,
nCompressedSize
);
BYTE
*
pInBuf
=
pCompressedBuffer
;
BYTE
*
pOutBuf
=
new
BYTE
[
nUnCompressedSize
];
BYTE
*
pTmpBuf
=
pOutBuf
;
BYTE
*
pLast
=
pOutBuf
+
nUnCompressedSize
-
1
;
ULONG
nIndex
=
0UL
,
nCountByte
,
nRunByte
;
BOOL
bEndDecoding
=
FALSE
;
do
{
// absolutes Fuellen
memcpy
(
&
pTmpBuf
[
nIndex
],
pInBuf
,
nRunByte
);
pInBuf
+=
nRunByte
;
nIndex
+=
nRunByte
;
// WORD-Alignment beachten
if
(
nRunByte
&
1
)
pInBuf
++
;
nCountByte
=
*
pInBuf
++
;
if
(
!
nCountByte
)
{
nRunByte
=
*
pInBuf
++
;
if
(
nRunByte
>
2
)
{
// absolutes Fuellen
memcpy
(
&
pTmpBuf
[
nIndex
],
pInBuf
,
nRunByte
);
pInBuf
+=
nRunByte
;
nIndex
+=
nRunByte
;
// WORD-Alignment beachten
if
(
nRunByte
&
1
)
pInBuf
++
;
}
else
if
(
nRunByte
==
1
)
// Ende des Bildes
bEndDecoding
=
TRUE
;
}
else
{
const
BYTE
cVal
=
*
pInBuf
++
;
memset
(
&
pTmpBuf
[
nIndex
],
cVal
,
nCountByte
);
nIndex
+=
nCountByte
;
}
}
else
if
(
nRunByte
==
1
)
// Ende des Bildes
bEndDecoding
=
TRUE
;
while
(
!
bEndDecoding
&&
(
pTmpBuf
<=
pLast
)
);
rStmToRead
.
Write
(
pOutBuf
,
nUnCompressedSize
);
delete
[]
pOutBuf
;
delete
[]
pCompressedBuffer
;
}
else
else
if
(
2
==
nVersion
)
{
const
BYTE
cVal
=
*
pInBuf
++
;
ZCodec
aCodec
;
memset
(
&
pTmpBuf
[
nIndex
],
cVal
,
nCountByte
);
nIndex
+=
nCountByte
;
aCodec
.
BeginCompression
();
aCodec
.
Decompress
(
rStm
,
rStmToRead
);
aCodec
.
EndCompression
();
}
}
while
(
!
bEndDecoding
&&
(
pTmpBuf
<=
pLast
)
);
delete
[]
pCompressedBuffer
;
return
pOutBuf
;
}
// -----------------------------------------------------------------------------
BYTE
*
GalleryCodec
::
ImpReadZBuffer
(
SvStream
&
rIStm
,
ULONG
nCompressedSize
,
ULONG
nUnCompressedSize
)
{
ZCodec
aCodec
;
BYTE
*
pOutBuf
=
new
BYTE
[
nUnCompressedSize
];
aCodec
.
BeginCompression
();
aCodec
.
Read
(
rIStm
,
pOutBuf
,
nUnCompressedSize
);
aCodec
.
EndCompression
();
return
pOutBuf
;
}
svx/source/gallery2/codec.hxx
Dosyayı görüntüle @
95a9655a
...
...
@@ -2,9 +2,9 @@
*
* $RCSfile: codec.hxx,v $
*
* $Revision: 1.
2
$
* $Revision: 1.
3
$
*
* last change: $Author: ka $ $Date: 2001-11-0
7 08:42:05
$
* last change: $Author: ka $ $Date: 2001-11-0
8 19:00:17
$
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
...
...
@@ -74,15 +74,12 @@ private:
SvStream
&
rStm
;
BYTE
*
ImpReadRLEBuffer
(
SvStream
&
rIStm
,
ULONG
nCompressedSize
,
ULONG
nUnCompressedSize
);
BYTE
*
ImpReadZBuffer
(
SvStream
&
rIStm
,
ULONG
nCompressedSize
,
ULONG
nUnCompressedSize
);
public
:
GalleryCodec
(
SvStream
&
rIOStm
);
~
GalleryCodec
();
ULONG
Write
(
SvMemory
Stream
&
rStmToWrite
);
ULONG
Read
(
SvMemory
Stream
&
rStmToRead
);
void
Write
(
Sv
Stream
&
rStmToWrite
);
void
Read
(
Sv
Stream
&
rStmToRead
);
static
BOOL
IsCoded
(
SvStream
&
rStm
,
UINT32
&
rVersion
);
};
svx/source/gallery2/galmisc.cxx
Dosyayı görüntüle @
95a9655a
...
...
@@ -2,9 +2,9 @@
*
* $RCSfile: galmisc.cxx,v $
*
* $Revision: 1.2
0
$
* $Revision: 1.2
1
$
*
* last change: $Author: ka $ $Date: 2001-11-0
7 08:43:31
$
* last change: $Author: ka $ $Date: 2001-11-0
8 19:03:02
$
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
...
...
@@ -306,23 +306,30 @@ BOOL CreateIMapGraphic( const FmFormModel& rModel, Graphic& rGraphic, ImageMap&
// - GetReducedString -
// --------------------
String
GetReducedString
(
const
INetURLObject
&
rURL
)
String
GetReducedString
(
const
INetURLObject
&
rURL
,
ULONG
nMaxLen
)
{
String
a
Str
;
String
a
Reduced
(
rURL
.
GetMainURL
(
INetURLObject
::
DECODE_UNAMBIGUOUS
)
)
;
if
(
rURL
.
GetMainURL
(
INetURLObject
::
DECODE_UNAMBIGUOUS
).
Len
()
>
30
)
aReduced
=
aReduced
.
GetToken
(
aReduced
.
GetTokenCount
(
'/'
)
-
1
,
'/'
);
if
(
INET_PROT_PRIV_SOFFICE
!=
rURL
.
GetProtocol
()
)
{
const
String
aName
(
rURL
.
GetName
()
);
sal_Unicode
aDelimiter
;
const
String
aPath
(
rURL
.
getFSysPath
(
INetURLObject
::
FSYS_DETECT
,
&
aDelimiter
)
);
const
String
aName
(
aReduced
);
aStr
=
rURL
.
GetMainURL
(
INetURLObject
::
DECODE_UNAMBIGUOUS
).
Copy
(
0
,
30
-
aName
.
Len
()
-
4
);
aStr
+=
String
(
RTL_CONSTASCII_USTRINGPARAM
(
"..."
)
);
aStr
+=
'/'
;
aStr
+=
aName
;
if
(
aPath
.
Len
()
>
nMaxLen
)
{
aReduced
=
aPath
.
Copy
(
0
,
(
USHORT
)(
nMaxLen
-
aName
.
Len
()
-
4
)
);
aReduced
+=
String
(
RTL_CONSTASCII_USTRINGPARAM
(
"..."
)
);
aReduced
+=
aDelimiter
;
aReduced
+=
aName
;
}
else
aReduced
=
aPath
;
}
else
aStr
=
rURL
.
GetMainURL
(
INetURLObject
::
DECODE_UNAMBIGUOUS
);
return
a
Str
;
return
a
Reduced
;
}
// -----------------------------------------------------------------------------
...
...
@@ -536,7 +543,6 @@ GalleryTransferable::GalleryTransferable( GalleryTheme* pTheme, ULONG nObjectPos
mpTheme
(
pTheme
),
meObjectKind
(
mpTheme
->
GetObjectKind
(
nObjectPos
)
),
mnObjectPos
(
nObjectPos
),
mpModel
(
NULL
),
mpGraphicObject
(
NULL
),
mpImageMap
(
NULL
),
mpURL
(
NULL
),
...
...
@@ -586,14 +592,17 @@ void GalleryTransferable::InitData()
{
Graphic
aGraphic
;
if
(
mpTheme
->
GetGraphic
(
mnObjectPos
,
aGraphic
)
)
mpGraphicObject
=
new
GraphicObject
(
aGraphic
);
m
pModel
=
new
FmFormModel
;
m
pModel
->
GetItemPool
().
FreezeIdRanges
(
);
m
xModelStream
=
new
SotStorageStream
(
String
()
)
;
m
xModelStream
->
SetBufferSize
(
16348
);
if
(
!
mpTheme
->
GetModel
(
mnObjectPos
,
*
mpModel
)
)
delete
mpModel
,
mpModel
=
NULL
;
if
(
!
mpTheme
->
GetModelStream
(
mnObjectPos
,
mxModelStream
)
)
mxModelStream
.
Clear
();
else
mxModelStream
->
Seek
(
0
);
}
break
;
...
...
@@ -615,8 +624,9 @@ void GalleryTransferable::AddSupportedFormats()
if
(
mpURL
)
AddFormat
(
FORMAT_FILE
);
if
(
m
pModel
)
if
(
m
xModelStream
.
Is
()
)
{
/*!!!
Graphic aGraphic;
ImageMap aImageMap;
...
...
@@ -628,6 +638,7 @@ void GalleryTransferable::AddSupportedFormats()
AddFormat( SOT_FORMATSTR_ID_SVIM );
}
else
*/
AddFormat
(
SOT_FORMATSTR_ID_DRAWING
);
}
...
...
@@ -657,9 +668,9 @@ sal_Bool GalleryTransferable::GetData( const ::com::sun::star::datatransfer::Dat
InitData
();
if
(
(
SOT_FORMATSTR_ID_DRAWING
==
nFormat
)
&&
m
pModel
)
if
(
(
SOT_FORMATSTR_ID_DRAWING
==
nFormat
)
&&
m
xModelStream
.
Is
()
)
{
bRet
=
SetObject
(
mpModel
,
0
,
rFlavor
);
bRet
=
SetObject
(
&
mxModelStream
,
0
,
rFlavor
);
}
else
if
(
(
SOT_FORMATSTR_ID_SVIM
==
nFormat
)
&&
mpImageMap
)
{
...
...
@@ -694,21 +705,7 @@ sal_Bool GalleryTransferable::WriteObject( SotStorageStreamRef& rxOStm, void* pU
if
(
pUserObject
)
{
FmFormModel
*
pModel
=
static_cast
<
FmFormModel
*
>
(
pUserObject
);
pModel
->
BurnInStyleSheetAttributes
();
pModel
->
SetStreamingSdrModel
(
TRUE
);
pModel
->
RemoveNotPersistentObjects
(
TRUE
);
rxOStm
->
SetBufferSize
(
16348
);
{
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
io
::
XOutputStream
>
xDocOut
(
new
utl
::
OOutputStreamWrapper
(
*
rxOStm
)
);
if
(
xDocOut
.
is
()
&&
SvxDrawingLayerExport
(
pModel
,
xDocOut
)
)
rxOStm
->
Commit
();
}
pModel
->
SetStreamingSdrModel
(
FALSE
);
*
rxOStm
<<
*
static_cast
<
SotStorageStream
*
>
(
pUserObject
);
bRet
=
(
rxOStm
->
GetError
()
==
ERRCODE_NONE
);
}
...
...
@@ -727,7 +724,7 @@ void GalleryTransferable::DragFinished( sal_Int8 nDropAction )
void
GalleryTransferable
::
ObjectReleased
()
{
delete
mpModel
,
mpModel
=
NULL
;
mxModelStream
.
Clear
()
;
delete
mpGraphicObject
,
mpGraphicObject
=
NULL
;
delete
mpImageMap
,
mpImageMap
=
NULL
;
delete
mpURL
,
mpURL
=
NULL
;
...
...
@@ -741,6 +738,7 @@ void GalleryTransferable::CopyToClipboard( Window* pWindow )
TransferableHelper
::
CopyToClipboard
(
pWindow
);
}
// ------------------------------------------------------------------------
void
GalleryTransferable
::
StartDrag
(
Window
*
pWindow
,
sal_Int8
nDragSourceActions
,
sal_Int32
nDragPointer
,
sal_Int32
nDragImage
)
...
...
svx/source/gallery2/galtheme.cxx
Dosyayı görüntüle @
95a9655a
...
...
@@ -2,9 +2,9 @@
*
* $RCSfile: galtheme.cxx,v $
*
* $Revision: 1.2
2
$
* $Revision: 1.2
3
$
*
* last change: $Author: ka $ $Date: 2001-11-0
7 08:43:31
$
* last change: $Author: ka $ $Date: 2001-11-0
8 19:03:02
$
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
...
...
@@ -1031,6 +1031,106 @@ BOOL GalleryTheme::InsertModel( const FmFormModel& rModel, ULONG nInsertPos )
// -----------------------------------------------------------------------------
BOOL
GalleryTheme
::
GetModelStream
(
ULONG
nPos
,
SotStorageStreamRef
&
rxModelStream
,
BOOL
bProgress
)
{
const
GalleryObject
*
pObject
=
ImplGetGalleryObject
(
nPos
);
BOOL
bRet
=
FALSE
;
if
(
pObject
&&
(
SGA_OBJ_SVDRAW
==
pObject
->
eObjKind
)
)
{
const
INetURLObject
aURL
(
ImplGetURL
(
pObject
)
);
SvStorageRef
xStor
(
GetSvDrawStorage
()
);
if
(
xStor
.
Is
()
)
{
const
String
aStmName
(
GetSvDrawStreamNameFromURL
(
aURL
)
);
SvStorageStreamRef
xIStm
(
xStor
->
OpenStream
(
aStmName
,
STREAM_READ
)
);
if
(
xIStm
.
Is
()
&&
!
xIStm
->
GetError
()
)
{
UINT32
nVersion
=
0
;
xIStm
->
SetBufferSize
(
16348
);
if
(
GalleryCodec
::
IsCoded
(
*
xIStm
,
nVersion
)
)
{
if
(
1
==
nVersion
)
{
FmFormModel
aModel
;
aModel
.
GetItemPool
().
FreezeIdRanges
();
if
(
GallerySvDrawImport
(
*
xIStm
,
aModel
)
)
{
aModel
.
BurnInStyleSheetAttributes
();
aModel
.
SetStreamingSdrModel
(
TRUE
);
aModel
.
RemoveNotPersistentObjects
(
TRUE
);
{
com
::
sun
::
star
::
uno
::
Reference
<
com
::
sun
::
star
::
io
::
XOutputStream
>
xDocOut
(
new
utl
::
OOutputStreamWrapper
(
*
rxModelStream
)
);
if
(
SvxDrawingLayerExport
(
&
aModel
,
xDocOut
)
)
rxModelStream
->
Commit
();
}
aModel
.
SetStreamingSdrModel
(
FALSE
);
}
}
else
if
(
2
==
nVersion
)
{
GalleryCodec
aCodec
(
*
xIStm
);
aCodec
.
Read
(
*
rxModelStream
);
}
bRet
=
(
rxModelStream
->
GetError
()
==
ERRCODE_NONE
);
}
xIStm
->
SetBufferSize
(
0
);
}
}
}
return
bRet
;
}
// -----------------------------------------------------------------------------
BOOL
GalleryTheme
::
InsertModelStream
(
const
SotStorageStreamRef
&
rxModelStream
,
ULONG
nInsertPos
)
{
INetURLObject
aURL
(
ImplCreateUniqueURL
(
SGA_OBJ_SVDRAW
)
);
SvStorageRef
xStor
(
GetSvDrawStorage
()
);
BOOL
bRet
=
FALSE
;
if
(
xStor
.
Is
()
)
{
const
String
aStmName
(
GetSvDrawStreamNameFromURL
(
aURL
)
);
SvStorageStreamRef
xOStm
(
xStor
->
OpenStream
(
aStmName
,
STREAM_WRITE
|
STREAM_TRUNC
)
);
if
(
xOStm
.
Is
()
&&
!
xOStm
->
GetError
()
)
{
GalleryCodec
aCodec
(
*
xOStm
);
SvMemoryStream
aMemStm
(
65535
,
65535
);
xOStm
->
SetBufferSize
(
16348
);
aCodec
.
Write
(
*
rxModelStream
);
if
(
!
xOStm
->
GetError
()
)
{
xOStm
->
Seek
(
0
);
SgaObjectSvDraw
aObjSvDraw
(
*
xOStm
,
aURL
);
bRet
=
InsertObject
(
aObjSvDraw
,
nInsertPos
);
}
xOStm
->
SetBufferSize
(
0L
);
xOStm
->
Commit
();
}
}
return
bRet
;
}
// -----------------------------------------------------------------------------
BOOL
GalleryTheme
::
GetURL
(
ULONG
nPos
,
INetURLObject
&
rURL
,
BOOL
bProgress
)
{
const
GalleryObject
*
pObject
=
ImplGetGalleryObject
(
nPos
);
...
...
@@ -1091,14 +1191,7 @@ BOOL GalleryTheme::InsertTransferable( const ::com::sun::star::uno::Reference< :
SotStorageStreamRef
xModelStm
;
if
(
aDataHelper
.
GetSotStorageStream
(
SOT_FORMATSTR_ID_DRAWING
,
xModelStm
)
)
{
FmFormModel
aModel
;
aModel
.
GetItemPool
().
FreezeIdRanges
();
if
(
GallerySvDrawImport
(
*
xModelStm
,
aModel
)
)
bRet
=
InsertModel
(
aModel
,
nInsertPos
);
}
bRet
=
InsertModelStream
(
xModelStm
,
nInsertPos
);
}
else
if
(
aDataHelper
.
HasFormat
(
FORMAT_FILE
)
)
{
...
...
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