1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: storinfo.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sot.hxx"
35 #include <storinfo.hxx>
36 #include <sot/exchange.hxx>
39 /************** class SvStorageInfoList **********************************
40 *************************************************************************/
41 PRV_SV_IMPL_OWNER_LIST(SvStorageInfoList
,SvStorageInfo
)
43 const SvStorageInfo
* SvStorageInfoList::Get( const String
& rEleName
)
45 for( ULONG i
= 0; i
< Count(); i
++ )
47 const SvStorageInfo
& rType
= GetObject( i
);
48 if( rType
.GetName() == rEleName
)
54 /************** class SvStorageInfo **************************************
55 *************************************************************************/
56 ULONG
ReadClipboardFormat( SvStream
& rStm
)
58 sal_uInt32 nFormat
= 0;
62 rStm
.SetError( SVSTREAM_GENERALERROR
);
66 sal_Char
* p
= new sal_Char
[ nLen
];
67 if( rStm
.Read( p
, nLen
) == (ULONG
) nLen
)
69 nFormat
= SotExchange::RegisterFormatName( String::CreateFromAscii( p
, short(nLen
-1) ) );
72 rStm
.SetError( SVSTREAM_GENERALERROR
);
75 else if( nLen
== -1L )
76 // Windows clipboard format
77 // SV und Win stimmen ueberein (bis einschl. FORMAT_GDIMETAFILE)
79 else if( nLen
== -2L )
82 // Mac clipboard format
83 // ??? not implemented
84 rStm
.SetError( SVSTREAM_GENERALERROR
);
89 rStm
.SetError( SVSTREAM_GENERALERROR
);
94 void WriteClipboardFormat( SvStream
& rStm
, ULONG nFormat
)
96 // determine the clipboard format string
98 if( nFormat
> FORMAT_GDIMETAFILE
)
99 aCbFmt
= SotExchange::GetFormatName( nFormat
);
102 ByteString
aAsciiCbFmt( aCbFmt
, RTL_TEXTENCODING_ASCII_US
);
103 rStm
<< (INT32
) (aAsciiCbFmt
.Len() + 1);
104 rStm
<< (const char *)aAsciiCbFmt
.GetBuffer();
108 rStm
<< (INT32
) -1 // for Windows
111 rStm
<< (INT32
) 0; // no clipboard format