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
41e72962
Kaydet (Commit)
41e72962
authored
Ara 02, 2003
tarafından
Mikhail Voitenko
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#112923# allow to get view from ole component
üst
7d0303d3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
231 additions
and
8 deletions
+231
-8
graphconvert.cxx
embeddedobj/source/msole/graphconvert.cxx
+131
-0
makefile.mk
embeddedobj/source/msole/makefile.mk
+7
-2
olecomponent.cxx
embeddedobj/source/msole/olecomponent.cxx
+93
-6
No files found.
embeddedobj/source/msole/graphconvert.cxx
0 → 100644
Dosyayı görüntüle @
41e72962
/*************************************************************************
*
* $RCSfile: graphconvert.cxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: mav $ $Date: 2003-12-02 14:34:02 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
#include <com/sun/star/uno/Any.hxx>
#endif
#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
#include <com/sun/star/uno/Reference.hxx>
#endif
#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
#include <com/sun/star/uno/Sequence.hxx>
#endif
// TODO: when conversion service is ready this headers should disappear
#include <svtools/filter.hxx>
#include <vcl/graph.hxx>
using
namespace
::
com
::
sun
::
star
;
sal_Bool
ConvertBufferForFlavor
(
void
*
pBuf
,
sal_uInt32
nBufSize
,
const
datatransfer
::
DataFlavor
&
aFlavor
,
uno
::
Any
&
aResult
)
{
if
(
pBuf
)
{
SvMemoryStream
aBufStream
(
pBuf
,
nBufSize
,
STREAM_READ
);
aBufStream
.
ObjectOwnsMemory
(
sal_False
);
Graphic
aGraph
;
GraphicFilter
aGrFilter
(
sal_True
);
if
(
aGrFilter
.
ImportGraphic
(
aGraph
,
String
(),
aBufStream
)
==
ERRCODE_NONE
)
{
sal_uInt16
nFormat
=
GRFILTER_FORMAT_DONTKNOW
;
// TODO: Extend format list
if
(
aFlavor
.
MimeType
.
equalsAscii
(
"application/x-openoffice;windows_formatname=
\"
Image WMF
\"
"
)
)
nFormat
=
GFF_WMF
;
else
if
(
aFlavor
.
MimeType
.
equalsAscii
(
"application/x-openoffice;windows_formatname=
\"
Image EMF
\"
"
)
)
nFormat
=
GFF_EMF
;
else
if
(
aFlavor
.
MimeType
.
equalsAscii
(
"application/x-openoffice;windows_formatname=
\"
Bitmap
\"
"
)
)
nFormat
=
GFF_BMP
;
else
if
(
aFlavor
.
MimeType
.
equalsAscii
(
"image/png"
)
)
nFormat
=
GFF_JPG
;
// nFormat = GFF_PNG;
if
(
nFormat
!=
GRFILTER_FORMAT_DONTKNOW
)
{
SvMemoryStream
aNewStream
(
65535
,
65535
);
if
(
aGrFilter
.
ExportGraphic
(
aGraph
,
String
(),
aNewStream
,
nFormat
)
==
ERRCODE_NONE
)
{
/*
{
aNewStream.Seek( 0 );
SvFileStream aFile( String::CreateFromAscii( "file:///d:/test.png" ), STREAM_STD_READWRITE);
aFile.SetStreamSize( 0 );
aNewStream >> aFile;
}
*/
aResult
<<=
uno
::
Sequence
<
sal_Int8
>
(
reinterpret_cast
<
const
sal_Int8
*
>
(
aNewStream
.
GetData
()
),
aNewStream
.
Seek
(
STREAM_SEEK_TO_END
)
);
return
sal_True
;
}
}
}
}
return
sal_False
;
}
embeddedobj/source/msole/makefile.mk
Dosyayı görüntüle @
41e72962
...
...
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.
4
$
# $Revision: 1.
5
$
#
# last change: $Author: mav $ $Date: 2003-1
1-28 18:04:04
$
# last change: $Author: mav $ $Date: 2003-1
2-02 14:33:41
$
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
...
...
@@ -81,6 +81,7 @@ SHL1TARGET= $(TARGET)
SHL1IMPLIB
=
i
$(TARGET)
SLOFILES
=
\
$(SLO)$/
graphconvert.obj
\
$(SLO)$/
closepreventer.obj
\
$(SLO)$/
oleregister.obj
\
$(SLO)$/
xolefactory.obj
\
...
...
@@ -94,6 +95,7 @@ SLOFILES = \
EXCEPTIONSFILES
=
\
$(SLO)$/
graphconvert.obj
\
$(SLO)$/
closepreventer.obj
\
$(SLO)$/
oleregister.obj
\
$(SLO)$/
xolefactory.obj
\
...
...
@@ -111,6 +113,9 @@ SHL1STDLIBS=\
$(SALLIB)
\
$(CPPULIB)
\
$(CPPUHELPERLIB)
\
$(TOOLSLIB)
\
$(SVTOOLLIB)
\
$(VCLLIB)
\
ole32.lib
\
gdi32.lib
\
uuid.lib
\
...
...
embeddedobj/source/msole/olecomponent.cxx
Dosyayı görüntüle @
41e72962
...
...
@@ -2,9 +2,9 @@
*
* $RCSfile: olecomponent.cxx,v $
*
* $Revision: 1.
8
$
* $Revision: 1.
9
$
*
* last change: $Author: mav $ $Date: 2003-12-0
1 08:41:14
$
* last change: $Author: mav $ $Date: 2003-12-0
2 14:33:42
$
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
...
...
@@ -93,13 +93,17 @@
#include "advisesink.hxx"
#include "oleembobj.hxx"
using
namespace
::
com
::
sun
::
star
;
#define MAX_ENUM_ELE 20
const
sal_Int32
n_ConstBufferSize
=
32000
;
sal_Bool
ConvertBufferForFlavor
(
void
*
pBuf
,
sal_uInt32
nBufSize
,
const
datatransfer
::
DataFlavor
&
aFlavor
,
uno
::
Any
&
aResult
);
//----------------------------------------------
uno
::
Sequence
<
sal_Int8
>
GetSequenceClassID
(
sal_uInt32
n1
,
sal_uInt16
n2
,
sal_uInt16
n3
,
sal_uInt8
b8
,
sal_uInt8
b9
,
sal_uInt8
b10
,
sal_uInt8
b11
,
sal_uInt8
b12
,
sal_uInt8
b13
,
sal_uInt8
b14
,
sal_uInt8
b15
)
...
...
@@ -139,14 +143,95 @@ STDAPI StarObject_SwitchDisplayAspect(IUnknown *pObj, LPDWORD pdwCurAspect
//----------------------------------------------
sal_Bool
ConvertDataForFlavor
(
const
STGMEDIUM
&
aMedium
,
const
datatransfer
::
DataFlavor
&
aFlavor
,
uno
::
Any
&
aResult
)
{
// TODO: try to convert data from Medium format to specified Flavor format
return
sal_False
;
sal_Bool
bAnyIsReady
=
sal_False
;
// try to convert data from Medium format to specified Flavor format
if
(
aFlavor
.
DataType
==
getCppuType
(
(
const
uno
::
Sequence
<
sal_Int8
>*
)
0
)
)
{
// first the GDI-metafile must be generated
unsigned
char
*
pBuf
=
NULL
;
sal_uInt32
nBufSize
=
0
;
if
(
aMedium
.
tymed
==
TYMED_MFPICT
)
// Win Metafile
{
METAFILEPICT
*
pMF
=
(
METAFILEPICT
*
)
GlobalLock
(
aMedium
.
hMetaFilePict
);
if
(
pMF
)
{
// TODO: probably in future mapmode must be used in conversion
nBufSize
=
GetMetaFileBitsEx
(
pMF
->
hMF
,
0
,
NULL
);
pBuf
=
new
unsigned
char
[
nBufSize
+
22
];
*
((
long
*
)
pBuf
)
=
0x9ac6cdd7L
;
*
((
short
*
)(
pBuf
+
6
))
=
(
SHORT
)
0
;
*
((
short
*
)(
pBuf
+
8
))
=
(
SHORT
)
0
;
*
((
short
*
)(
pBuf
+
10
))
=
(
SHORT
)
pMF
->
xExt
;
*
((
short
*
)(
pBuf
+
12
))
=
(
SHORT
)
pMF
->
yExt
;
*
((
short
*
)(
pBuf
+
14
))
=
(
USHORT
)
2540
;
if
(
nBufSize
&&
nBufSize
==
GetMetaFileBitsEx
(
pMF
->
hMF
,
nBufSize
,
pBuf
+
22
)
)
{
if
(
aFlavor
.
MimeType
.
equalsAscii
(
"application/x-openoffice;windows_formatname=
\"
Image WMF
\"
"
)
)
{
aResult
<<=
uno
::
Sequence
<
sal_Int8
>
(
(
sal_Int8
*
)
pBuf
,
nBufSize
+
22
);
bAnyIsReady
=
sal_True
;
}
}
nBufSize
+=
22
;
GlobalUnlock
(
aMedium
.
hMetaFilePict
);
}
}
else
if
(
aMedium
.
tymed
==
TYMED_ENHMF
)
// Enh Metafile
{
nBufSize
=
GetEnhMetaFileBits
(
aMedium
.
hEnhMetaFile
,
0
,
NULL
);
pBuf
=
new
unsigned
char
[
nBufSize
];
if
(
nBufSize
&&
nBufSize
==
GetEnhMetaFileBits
(
aMedium
.
hEnhMetaFile
,
nBufSize
,
pBuf
)
)
{
if
(
aFlavor
.
MimeType
.
equalsAscii
(
"application/x-openoffice;windows_formatname=
\"
Image EMF
\"
"
)
)
{
aResult
<<=
uno
::
Sequence
<
sal_Int8
>
(
(
sal_Int8
*
)
pBuf
,
nBufSize
);
bAnyIsReady
=
sal_True
;
}
}
}
else
if
(
aMedium
.
tymed
==
TYMED_GDI
)
// Bitmap
{
nBufSize
=
GetBitmapBits
(
aMedium
.
hBitmap
,
0
,
NULL
);
pBuf
=
new
unsigned
char
[
nBufSize
];
if
(
nBufSize
&&
nBufSize
==
GetBitmapBits
(
aMedium
.
hBitmap
,
nBufSize
,
pBuf
)
)
{
if
(
aFlavor
.
MimeType
.
equalsAscii
(
"application/x-openoffice;windows_formatname=
\"
Bitmap
\"
"
)
)
{
aResult
<<=
uno
::
Sequence
<
sal_Int8
>
(
(
sal_Int8
*
)
pBuf
,
nBufSize
);
bAnyIsReady
=
sal_True
;
}
}
}
if
(
pBuf
&&
!
bAnyIsReady
)
bAnyIsReady
=
ConvertBufferForFlavor
(
(
void
*
)
pBuf
,
nBufSize
,
aFlavor
,
aResult
);
delete
[]
pBuf
;
}
return
bAnyIsReady
;
}
//----------------------------------------------
sal_Bool
GraphicalFlavor
(
const
datatransfer
::
DataFlavor
&
aFlavor
)
{
// TODO: just check that the requested flavour is one of supported graphical flavours
// Actually all the required graphical formats must be supported
if
(
aFlavor
.
DataType
==
getCppuType
(
(
const
uno
::
Sequence
<
sal_Int8
>*
)
0
)
)
{
// TODO: extend support for graphical formats
if
(
aFlavor
.
MimeType
.
equalsAscii
(
"application/x-openoffice;windows_formatname=
\"
GDIMetaFile
\"
"
)
||
aFlavor
.
MimeType
.
equalsAscii
(
"application/x-openoffice;windows_formatname=
\"
Image EMF
\"
"
)
||
aFlavor
.
MimeType
.
equalsAscii
(
"application/x-openoffice;windows_formatname=
\"
Image WMF
\"
"
)
||
aFlavor
.
MimeType
.
equalsAscii
(
"image/png"
)
)
return
sal_True
;
}
return
sal_False
;
}
...
...
@@ -476,6 +561,7 @@ void OleComponent::RetrieveObjectDataFlavors_Impl()
if
(
!
m_pOleObject
)
throw
embed
::
WrongStateException
();
// TODO: the object is in wrong state
/*
if ( !m_aDataFlavors.getLength() )
{
CComPtr< IDataObject > pDataObject;
...
...
@@ -506,6 +592,7 @@ void OleComponent::RetrieveObjectDataFlavors_Impl()
}
while( nNum == MAX_ENUM_ELE );
}
*/
}
//----------------------------------------------
...
...
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