1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 // ACHTUNG: es wird angenommen, dass StarView-Clipboard-Foamatnummern
22 // und Windows-Formatnummern identisch sind! Ist dies einmal nicht der
23 // Fall, muessen die Routinen hier angepasst werden. Die Implementation
24 // verwendet die hier defineirten Konversionen.
30 #include <svl/svdde.hxx>
32 #include <osl/thread.h>
34 // --- DdeData::DdeData() ------------------------------------------
38 pImp
= new DdeDataImp
;
45 // --- DdeData::DdeData() ------------------------------------------
47 DdeData::DdeData( const void* p
, long n
, sal_uLong f
)
49 pImp
= new DdeDataImp
;
51 pImp
->pData
= (LPBYTE
)p
;
56 // --- DdeData::DdeData() ------------------------------------------
58 DdeData::DdeData( const OUString
& s
)
60 pImp
= new DdeDataImp
;
62 pImp
->pData
= (LPBYTE
)s
.getStr();
63 pImp
->nData
= s
.getLength()+1;
67 // --- DdeData::DdeData() ------------------------------------------
69 DdeData::DdeData( const DdeData
& rData
)
71 pImp
= new DdeDataImp
;
72 pImp
->hData
= rData
.pImp
->hData
;
73 pImp
->nData
= rData
.pImp
->nData
;
74 pImp
->pData
= rData
.pImp
->pData
;
75 pImp
->nFmt
= rData
.pImp
->nFmt
;
79 // --- DdeData::~DdeData() -----------------------------------------
83 if ( pImp
&& pImp
->hData
)
84 DdeUnaccessData( pImp
->hData
);
88 // --- DdeData::Lock() ---------------------------------------------
93 pImp
->pData
= DdeAccessData( pImp
->hData
, (LPDWORD
) &pImp
->nData
);
96 // --- DdeData::GetFormat() ----------------------------------------
98 sal_uLong
DdeData::GetFormat() const
103 void DdeData::SetFormat( sal_uLong nFmt
)
108 // --- DdeData::operator const char*() -----------------------------
110 DdeData::operator const void*() const
115 // --- DdeData::operator long() ------------------------------------
117 DdeData::operator long() const
122 // --- DdeData::operator =() ---------------------------------------
124 DdeData
& DdeData::operator = ( const DdeData
& rData
)
126 if ( &rData
!= this )
128 DdeData
tmp( rData
);
137 sal_uLong
DdeData::GetExternalFormat( sal_uLong nFmt
)
147 case FORMAT_GDIMETAFILE
:
148 nFmt
= CF_METAFILEPICT
;
154 OUString
aName( SotExchange::GetFormatName( nFmt
) );
155 if( !aName
.isEmpty() )
156 nFmt
= RegisterClipboardFormat( reinterpret_cast<LPCWSTR
>(aName
.getStr()) );
163 sal_uLong
DdeData::GetInternalFormat( sal_uLong nFmt
)
168 nFmt
= FORMAT_STRING
;
172 nFmt
= FORMAT_BITMAP
;
175 case CF_METAFILEPICT
:
176 nFmt
= FORMAT_GDIMETAFILE
;
185 if( GetClipboardFormatName( nFmt
, szName
, sizeof(szName
) ) )
186 nFmt
= SotExchange::RegisterFormatName( OUString(reinterpret_cast<const sal_Unicode
*>(szName
)) );
194 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */