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
aec29756
Kaydet (Commit)
aec29756
authored
Kas 14, 2003
tarafından
Mikhail Voitenko
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#112923# ole implementation related changes
üst
5ea5c0af
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
376 additions
and
232 deletions
+376
-232
build.lst
embeddedobj/prj/build.lst
+2
-1
embedobj.cxx
embeddedobj/source/commonembedding/embedobj.cxx
+9
-5
persistence.cxx
embeddedobj/source/commonembedding/persistence.cxx
+9
-16
commonembobj.hxx
embeddedobj/source/inc/commonembobj.hxx
+4
-4
olecomponent.cxx
embeddedobj/source/msole/olecomponent.cxx
+11
-4
olecomponent.hxx
embeddedobj/source/msole/olecomponent.hxx
+3
-2
EmbedContApp.java
embeddedobj/test/Container1/EmbedContApp.java
+321
-198
makefile.mk
embeddedobj/util/makefile.mk
+17
-2
No files found.
embeddedobj/prj/build.lst
Dosyayı görüntüle @
aec29756
...
...
@@ -2,4 +2,5 @@ es embeddedobj : offuh sal cppu cppuhelper NULL
es embeddedobj usr1 - all eo_mkout NULL
es embeddedobj\source\commonembedding nmake - all eo_commonembed NULL
es embeddedobj\source\general nmake - all eo_general NULL
es embeddedobj\util nmake - all eo_util eo_commonembed eo_general NULL
es embeddedobj\source\msole nmake - all eo_msole NULL
es embeddedobj\util nmake - all eo_util eo_commonembed eo_general eo_msole NULL
embeddedobj/source/commonembedding/embedobj.cxx
Dosyayı görüntüle @
aec29756
...
...
@@ -2,9 +2,9 @@
*
* $RCSfile: embedobj.cxx,v $
*
* $Revision: 1.
1
$
* $Revision: 1.
2
$
*
* last change: $Author: mav $ $Date: 2003-1
0-27 12:57:28
$
* last change: $Author: mav $ $Date: 2003-1
1-14 15:24:24
$
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
...
...
@@ -181,6 +181,9 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState )
if
(
!
xModif
.
is
()
)
throw
uno
::
RuntimeException
();
if
(
!
m_xClientSite
.
is
()
)
throw
embed
::
WrongStateException
();
//TODO: client site is not set!
// store document if it is modified
if
(
xModif
->
isModified
()
)
{
...
...
@@ -324,7 +327,7 @@ void SAL_CALL OCommonEmbeddedObject::doVerb( sal_Int32 nVerbID )
}
//----------------------------------------------
uno
::
Sequence
<
sal_Int32
>
SAL_CALL
OCommonEmbeddedObject
::
getSupportedVerbs
()
uno
::
Sequence
<
embed
::
VerbDescr
>
SAL_CALL
OCommonEmbeddedObject
::
getSupportedVerbs
()
throw
(
embed
::
WrongStateException
,
uno
::
RuntimeException
)
{
...
...
@@ -336,7 +339,7 @@ uno::Sequence< sal_Int32 > SAL_CALL OCommonEmbeddedObject::getSupportedVerbs()
throw
embed
::
WrongStateException
(
::
rtl
::
OUString
::
createFromAscii
(
"The object has no persistence!
\n
"
),
uno
::
Reference
<
uno
::
XInterface
>
(
reinterpret_cast
<
::
cppu
::
OWeakObject
*
>
(
this
)
)
);
uno
::
Sequence
<
sal_Int32
>
aResult
;
uno
::
Sequence
<
embed
::
VerbDescr
>
aResult
;
sal_Int32
nResLen
=
0
;
// verbs list will be set on initialization depending from document type
...
...
@@ -345,7 +348,8 @@ uno::Sequence< sal_Int32 > SAL_CALL OCommonEmbeddedObject::getSupportedVerbs()
if
(
m_aVerbTable
[
nVerbInd
][
1
]
==
m_aAcceptedStates
[
nStatesInd
]
)
{
aResult
.
realloc
(
++
nResLen
);
aResult
[
nResLen
-
1
]
=
m_aVerbTable
[
nVerbInd
][
0
];
// TODO: fill the whole structure
aResult
[
nResLen
-
1
].
VerbID
=
m_aVerbTable
[
nVerbInd
][
0
];
}
return
aResult
;
...
...
embeddedobj/source/commonembedding/persistence.cxx
Dosyayı görüntüle @
aec29756
...
...
@@ -2,9 +2,9 @@
*
* $RCSfile: persistence.cxx,v $
*
* $Revision: 1.
2
$
* $Revision: 1.
3
$
*
* last change: $Author: mav $ $Date: 2003-11-
04 14:30:19
$
* last change: $Author: mav $ $Date: 2003-11-
14 15:24:24
$
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
...
...
@@ -499,7 +499,7 @@ uno::Reference< frame::XModel > OCommonEmbeddedObject::CreateTempDocFromLink_Imp
}
//------------------------------------------------------
sal_Bool
SAL_CALL
OCommonEmbeddedObject
::
setPersistentEntry
(
void
SAL_CALL
OCommonEmbeddedObject
::
setPersistentEntry
(
const
uno
::
Reference
<
embed
::
XStorage
>&
xStorage
,
const
::
rtl
::
OUString
&
sEntName
,
sal_Int32
nEntryConnectionMode
,
...
...
@@ -547,6 +547,10 @@ sal_Bool SAL_CALL OCommonEmbeddedObject::setPersistentEntry(
::
rtl
::
OUString
::
createFromAscii
(
"The object waits for saveCompleted() call!
\n
"
),
uno
::
Reference
<
uno
::
XInterface
>
(
reinterpret_cast
<
::
cppu
::
OWeakObject
*
>
(
this
)
)
);
// TODO: the OOo link will have persistence
if
(
m_bIsLink
)
return
;
uno
::
Reference
<
container
::
XNameAccess
>
xNameAccess
(
xStorage
,
uno
::
UNO_QUERY
);
if
(
!
xNameAccess
.
is
()
)
throw
uno
::
RuntimeException
();
//TODO
...
...
@@ -565,10 +569,6 @@ sal_Bool SAL_CALL OCommonEmbeddedObject::setPersistentEntry(
m_xParentStorage
=
xStorage
;
m_aEntryName
=
sEntName
;
// the object should be based on the storage ??? TODO
if
(
bElExists
&&
!
xStorage
->
isStorageElement
(
sEntName
)
)
throw
io
::
IOException
();
// TODO access denied
if
(
nEntryConnectionMode
==
embed
::
EntryInitModes
::
ENTRY_DEFAULT_INIT
)
{
if
(
bElExists
)
...
...
@@ -593,9 +593,8 @@ sal_Bool SAL_CALL OCommonEmbeddedObject::setPersistentEntry(
if
(
nEntryConnectionMode
==
embed
::
EntryInitModes
::
ENTRY_NO_INIT
)
{
// the document just already changed its storage to store to
// the links to OOo documents will ignore this call and return false
if
(
m_bIsLink
)
return
sal_False
;
// the links to OOo documents for now ignore this call
// TODO: OOo links will have persistence so it will be switched here
}
else
if
(
nEntryConnectionMode
==
embed
::
EntryInitModes
::
ENTRY_TRUNCATE_INIT
)
{
...
...
@@ -621,8 +620,6 @@ sal_Bool SAL_CALL OCommonEmbeddedObject::setPersistentEntry(
uno
::
Reference
<
uno
::
XInterface
>
(
reinterpret_cast
<
::
cppu
::
OWeakObject
*
>
(
this
)
),
3
);
}
return
sal_True
;
}
//------------------------------------------------------
...
...
@@ -986,10 +983,6 @@ void SAL_CALL OCommonEmbeddedObject::breakLink( const uno::Reference< embed::XSt
m_xParentStorage
=
xStorage
;
m_aEntryName
=
sEntName
;
// the object should be based on the storage ??? TODO
if
(
bElExists
&&
!
xStorage
->
isStorageElement
(
sEntName
)
)
throw
io
::
IOException
();
// TODO access denied
// for linked object it means that it becomes embedded object
// the document must switch it's persistence also
...
...
embeddedobj/source/inc/commonembobj.hxx
Dosyayı görüntüle @
aec29756
...
...
@@ -2,9 +2,9 @@
*
* $RCSfile: commonembobj.hxx,v $
*
* $Revision: 1.
2
$
* $Revision: 1.
3
$
*
* last change: $Author: mav $ $Date: 2003-11-
04 14:30:20
$
* last change: $Author: mav $ $Date: 2003-11-
14 15:24:26
$
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
...
...
@@ -275,7 +275,7 @@ public:
::
com
::
sun
::
star
::
uno
::
Exception
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
virtual
::
com
::
sun
::
star
::
uno
::
Sequence
<
sal_Int32
>
SAL_CALL
getSupportedVerbs
()
virtual
::
com
::
sun
::
star
::
uno
::
Sequence
<
::
com
::
sun
::
star
::
embed
::
VerbDescr
>
SAL_CALL
getSupportedVerbs
()
throw
(
::
com
::
sun
::
star
::
embed
::
WrongStateException
,
::
com
::
sun
::
star
::
uno
::
RuntimeException
);
...
...
@@ -326,7 +326,7 @@ public:
// XEmbedPersist
virtual
sal_Bool
SAL_CALL
setPersistentEntry
(
virtual
void
SAL_CALL
setPersistentEntry
(
const
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
embed
::
XStorage
>&
xStorage
,
const
::
rtl
::
OUString
&
sEntName
,
sal_Int32
nEntryConnectionMode
,
...
...
embeddedobj/source/msole/olecomponent.cxx
Dosyayı görüntüle @
aec29756
...
...
@@ -2,9 +2,9 @@
*
* $RCSfile: olecomponent.cxx,v $
*
* $Revision: 1.
1
$
* $Revision: 1.
2
$
*
* last change: $Author: mav $ $Date: 2003-11-1
3 17:01:13
$
* last change: $Author: mav $ $Date: 2003-11-1
4 15:24:27
$
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
...
...
@@ -312,9 +312,15 @@ OleComponent::OleComponent( const uno::Reference< lang::XMultiServiceFactory >&
,
m_nAdvConn
(
0
)
,
m_nSupportedFormat
(
0
)
,
m_nSupportedMedium
(
0
)
,
m_bOleInitialized
(
sal_False
)
{
OSL_ENSURE
(
m_pUnoOleObject
,
"No owner object is provided!"
);
HRESULT
hr
=
OleInitialize
(
NULL
);
OSL_ENSURE
(
hr
==
S_OK
||
hr
==
S_FALSE
,
"The ole can not be successfuly initialized
\n
"
);
if
(
hr
==
S_OK
||
hr
==
S_FALSE
)
m_bOleInitialized
=
sal_True
;
m_pOleWrapClientSite
=
new
OleWrapperClientSite
(
(
OleComponent
*
)
this
);
m_pOleWrapClientSite
->
AddRef
();
...
...
@@ -352,6 +358,9 @@ OleComponent::~OleComponent()
delete
m_pInterfaceContainer
;
m_pInterfaceContainer
=
NULL
;
}
if
(
m_bOleInitialized
)
OleUninitialize
();
}
//----------------------------------------------
...
...
@@ -654,8 +663,6 @@ uno::Sequence< embed::VerbDescr > OleComponent::GetVerbList()
if
(
!
m_aVerbList
.
getLength
()
)
{
// InitOle(); // TODO: makes sence to do in a central place
CComPtr
<
IEnumOLEVERB
>
pEnum
;
if
(
SUCCEEDED
(
m_pOleObject
->
EnumVerbs
(
&
pEnum
)
)
)
{
...
...
embeddedobj/source/msole/olecomponent.hxx
Dosyayı görüntüle @
aec29756
...
...
@@ -2,9 +2,9 @@
*
* $RCSfile: olecomponent.hxx,v $
*
* $Revision: 1.
1
$
* $Revision: 1.
2
$
*
* last change: $Author: mav $ $Date: 2003-11-1
3 17:01:32
$
* last change: $Author: mav $ $Date: 2003-11-1
4 15:24:27
$
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
...
...
@@ -146,6 +146,7 @@ class OleComponent : public ::cppu::WeakImplHelper2< ::com::sun::star::util::XCl
sal_uInt16
m_nSupportedFormat
;
sal_uInt32
m_nSupportedMedium
;
sal_Bool
m_bOleInitialized
;
sal_Bool
InitializeObject_Impl
(
sal_uInt32
nIconHandle
);
...
...
embeddedobj/test/Container1/EmbedContApp.java
Dosyayı görüntüle @
aec29756
...
...
@@ -5,6 +5,7 @@ import java.net.*;
import
java.io.*
;
import
javax.swing.JOptionPane
;
import
javax.swing.Timer
;
import
com.sun.star.lang.XMultiServiceFactory
;
import
com.sun.star.lang.XSingleServiceFactory
;
...
...
@@ -30,7 +31,7 @@ import com.sun.star.io.XTruncate;
import
com.sun.star.embed.*
;
public
class
EmbedContApp
extends
Applet
implements
MouseListener
,
XEmbeddedClient
public
class
EmbedContApp
extends
Applet
implements
MouseListener
,
XEmbeddedClient
,
ActionListener
{
private
XMultiServiceFactory
m_xServiceFactory
;
...
...
@@ -48,6 +49,24 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
private
boolean
m_bLinkObj
=
false
;
private
String
m_aLinkURI
;
private
byte
[]
m_pActionsList
;
private
int
m_nActionsNumber
;
private
Timer
m_aTimer
;
private
boolean
m_bDestroyed
=
false
;
// Constants
private
final
byte
DESTROY
=
1
;
private
final
byte
MOUSE_CLICKED
=
2
;
private
final
byte
NEW_DOCUMENT
=
3
;
private
final
byte
SAVE_AS
=
4
;
private
final
byte
OPEN_FILE
=
5
;
private
final
byte
SAVE
=
6
;
private
final
byte
NEW_OBJECT
=
7
;
private
final
byte
OBJECT_FROM_FILE
=
8
;
private
final
byte
LINK_FROM_FILE
=
9
;
private
final
byte
CONVERT_LINK_TO_OBJECT
=
10
;
// Methods
public
EmbedContApp
(
Frame
aFrame
,
XMultiServiceFactory
xServiceFactory
)
{
m_aFrame
=
aFrame
;
...
...
@@ -61,6 +80,12 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
m_aToolkit
=
Toolkit
.
getDefaultToolkit
();
m_pActionsList
=
new
byte
[
200
];
m_nActionsNumber
=
0
;
m_aTimer
=
new
Timer
(
100
,
this
);
m_aTimer
.
start
();
// Get a menu bar.
MenuBar
aMenuBar
=
m_aFrame
.
getMenuBar
();
if
(
aMenuBar
==
null
)
...
...
@@ -108,83 +133,20 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
addMouseListener
(
this
);
}
public
void
update
(
Graphics
g
)
{
paint
(
g
);
}
public
void
paint
(
Graphics
g
)
{
super
.
paint
(
g
);
if
(
m_xEmbedObj
!=
null
)
public
void
actionPerformed
(
ActionEvent
evt
)
{
synchronized
(
this
)
{
if
(
m_aImage
!=
null
)
g
.
drawImage
(
m_aImage
,
0
,
0
,
EmbedContApp
.
this
);
}
}
}
public
void
generateNewImage
()
{
if
(
m_xEmbedObj
!=
null
)
{
try
{
int
nOldState
=
m_xEmbedObj
.
getCurrentState
();
int
nState
=
nOldState
;
if
(
nOldState
==
EmbedStates
.
EMBED_LOADED
)
{
m_xEmbedObj
.
changeState
(
EmbedStates
.
EMBED_RUNNING
);
nState
=
EmbedStates
.
EMBED_RUNNING
;
}
if
(
nState
==
EmbedStates
.
EMBED_ACTIVE
||
nState
==
EmbedStates
.
EMBED_RUNNING
)
{
XComponentSupplier
xCompProv
=
(
XComponentSupplier
)
UnoRuntime
.
queryInterface
(
XComponentSupplier
.
class
,
m_xEmbedObj
);
if
(
xCompProv
!=
null
)
{
XComponent
xComp
=
xCompProv
.
getComponent
();
XTransferable
xTransfer
=
(
XTransferable
)
UnoRuntime
.
queryInterface
(
XTransferable
.
class
,
xComp
);
if
(
xTransfer
!=
null
)
{
DataFlavor
aFlavor
=
new
DataFlavor
();
aFlavor
.
MimeType
=
"image/png"
;
aFlavor
.
HumanPresentableName
=
"Portable Network Graphics"
;
aFlavor
.
DataType
=
new
Type
(
byte
[].
class
);
byte
[]
aPNGData
=
(
byte
[])
AnyConverter
.
toArray
(
xTransfer
.
getTransferData
(
aFlavor
)
);
if
(
aPNGData
!=
null
&&
aPNGData
.
length
!=
0
)
{
synchronized
(
this
)
for
(
int
nInd
=
0
;
nInd
<
m_nActionsNumber
;
nInd
++
)
{
m_aImage
=
m_aToolkit
.
createImage
(
aPNGData
);
}
}
}
else
System
.
out
.
println
(
"paint() : can not get XTransferable for the component!\n"
);
}
else
System
.
out
.
println
(
"paint() : XComponentSupplier is not implemented!\n"
);
}
}
catch
(
com
.
sun
.
star
.
uno
.
Exception
e
)
// TODO: execute m_pActionsList[ nInd ] operation
if
(
m_pActionsList
[
nInd
]
==
DESTROY
)
{
// dialogs should not be used in paint()
System
.
out
.
println
(
"Exception in paint(): "
+
e
);
}
}
// free all resources
clearObjectAndStorage
();
m_bDestroyed
=
true
;
}
public
void
mouseClicked
(
MouseEvent
e
)
{
if
(
e
.
getModifiers
()
==
InputEvent
.
BUTTON1_MASK
)
else
if
(
m_pActionsList
[
nInd
]
==
MOUSE_CLICKED
)
{
// activate object if exists and not active
if
(
m_xEmbedObj
!=
null
)
...
...
@@ -198,71 +160,14 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
}
}
}
}
public
void
mousePressed
(
MouseEvent
e
){};
public
void
mouseEntered
(
MouseEvent
e
){};
public
void
mouseExited
(
MouseEvent
e
){};
public
void
mouseReleased
(
MouseEvent
e
){};
// XEmbeddedClient
public
void
saveObject
()
throws
com
.
sun
.
star
.
uno
.
Exception
{
if
(
m_xEmbedObj
!=
null
)
{
try
{
XEmbedPersist
xPersist
=
(
XEmbedPersist
)
UnoRuntime
.
queryInterface
(
XEmbedPersist
.
class
,
m_xEmbedObj
);
if
(
xPersist
!=
null
)
{
xPersist
.
storeOwn
();
generateNewImage
();
}
else
JOptionPane
.
showMessageDialog
(
m_aFrame
,
"No XEmbedPersist!"
,
"Error:"
,
JOptionPane
.
ERROR_MESSAGE
);
}
catch
(
Exception
e
)
{
JOptionPane
.
showMessageDialog
(
m_aFrame
,
e
,
"Exception in saveObject:"
,
JOptionPane
.
ERROR_MESSAGE
);
}
}
generateNewImage
();
repaint
();
}
public
void
onShowWindow
(
boolean
bVisible
)
{
// for now nothing to do
}
// classes
class
NewMenuItem
extends
MenuItem
implements
ActionListener
// Menu New
{
public
NewMenuItem
()
{
super
(
"New"
,
new
MenuShortcut
(
KeyEvent
.
VK_A
));
addActionListener
(
this
);
}
public
void
actionPerformed
(
ActionEvent
e
)
else
if
(
m_pActionsList
[
nInd
]
==
NEW_DOCUMENT
)
{
// clear everything
clearObjectAndStorage
();
repaint
();
}
}
class
SaveAsMenuItem
extends
MenuItem
implements
ActionListener
// Menu SaveAs...
{
public
SaveAsMenuItem
()
{
super
(
"SaveAs..."
);
addActionListener
(
this
);
}
public
void
actionPerformed
(
ActionEvent
e
)
else
if
(
m_pActionsList
[
nInd
]
==
SAVE_AS
)
{
// open SaveAs dialog and store
...
...
@@ -299,17 +204,7 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
else
JOptionPane
.
showMessageDialog
(
m_aFrame
,
"No document is embedded!"
,
"Error:"
,
JOptionPane
.
ERROR_MESSAGE
);
}
}
class
OpenFileMenuItem
extends
MenuItem
implements
ActionListener
// Menu Open
{
public
OpenFileMenuItem
()
{
super
(
"Open"
,
new
MenuShortcut
(
KeyEvent
.
VK_C
));
addActionListener
(
this
);
}
public
void
actionPerformed
(
ActionEvent
e
)
else
if
(
m_pActionsList
[
nInd
]
==
OPEN_FILE
)
{
// clear everything
clearObjectAndStorage
();
...
...
@@ -348,17 +243,7 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
generateNewImage
();
repaint
();
}
}
class
SaveMenuItem
extends
MenuItem
implements
ActionListener
// Menu Save
{
public
SaveMenuItem
()
{
super
(
"Save"
,
new
MenuShortcut
(
KeyEvent
.
VK_D
));
addActionListener
(
this
);
}
public
void
actionPerformed
(
ActionEvent
e
)
else
if
(
m_pActionsList
[
nInd
]
==
SAVE
)
{
// if has persistance store there
// if not open SaveAs dialog and store
...
...
@@ -428,17 +313,7 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
else
JOptionPane
.
showMessageDialog
(
m_aFrame
,
"No document is embedded!"
,
"Error:"
,
JOptionPane
.
ERROR_MESSAGE
);
}
}
class
NewObjectMenuItem
extends
MenuItem
implements
ActionListener
// Menu NewObject
{
public
NewObjectMenuItem
()
{
super
(
"Create"
,
new
MenuShortcut
(
KeyEvent
.
VK_N
));
addActionListener
(
this
);
}
public
void
actionPerformed
(
ActionEvent
e
)
else
if
(
m_pActionsList
[
nInd
]
==
NEW_OBJECT
)
{
// remove current object an init a new one
clearObjectAndStorage
();
...
...
@@ -449,7 +324,8 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
"com.sun.star.comp.Calc.SpreadsheetDocument"
,
"com.sun.star.comp.Draw.PresentationDocument"
,
"com.sun.star.comp.Draw.DrawingDocument"
,
"com.sun.star.comp.Math.FormulaDocument"
};
"com.sun.star.comp.Math.FormulaDocument"
,
"BitmapImage"
};
String
selectedValue
=
(
String
)
JOptionPane
.
showInputDialog
(
null
,
"DocumentType"
,
"Select"
,
JOptionPane
.
INFORMATION_MESSAGE
,
null
,
...
...
@@ -486,17 +362,7 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
generateNewImage
();
repaint
();
}
}
class
LoadObjectMenuItem
extends
MenuItem
implements
ActionListener
// Menu LoadObject
{
public
LoadObjectMenuItem
()
{
super
(
"Load from file"
,
new
MenuShortcut
(
KeyEvent
.
VK_L
));
addActionListener
(
this
);
}
public
void
actionPerformed
(
ActionEvent
e
)
else
if
(
m_pActionsList
[
nInd
]
==
OBJECT_FROM_FILE
)
{
// first remove current object
clearObjectAndStorage
();
...
...
@@ -536,17 +402,7 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
generateNewImage
();
repaint
();
}
}
class
LinkObjectMenuItem
extends
MenuItem
implements
ActionListener
// Menu LinkObject
{
public
LinkObjectMenuItem
()
{
super
(
"Create link"
,
new
MenuShortcut
(
KeyEvent
.
VK_M
));
addActionListener
(
this
);
}
public
void
actionPerformed
(
ActionEvent
e
)
else
if
(
m_pActionsList
[
nInd
]
==
LINK_FROM_FILE
)
{
// first remove current object
clearObjectAndStorage
();
...
...
@@ -589,17 +445,7 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
generateNewImage
();
repaint
();
}
}
class
ConvertLinkToEmbedMenuItem
extends
MenuItem
implements
ActionListener
// Menu LinkObject
{
public
ConvertLinkToEmbedMenuItem
()
{
super
(
"Convert link to embed"
,
new
MenuShortcut
(
KeyEvent
.
VK_M
));
addActionListener
(
this
);
}
public
void
actionPerformed
(
ActionEvent
e
)
else
if
(
m_pActionsList
[
nInd
]
==
CONVERT_LINK_TO_OBJECT
)
{
if
(
!
m_bLinkObj
)
{
...
...
@@ -641,6 +487,276 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
}
}
}
else
{
System
.
out
.
println
(
"Unknoun action is requested: "
+
m_pActionsList
[
nInd
]
+
"\n"
);
}
}
m_nActionsNumber
=
0
;
}
}
public
void
actionRegister
(
byte
nActionID
)
{
synchronized
(
this
)
{
if
(
m_nActionsNumber
<
199
&&
(
m_nActionsNumber
==
0
||
m_pActionsList
[
m_nActionsNumber
-
1
]
!=
DESTROY
)
)
m_pActionsList
[
m_nActionsNumber
++
]
=
nActionID
;
}
}
public
void
destroy
()
{
// redirect the call through the timer and call super.destroy();
actionRegister
(
DESTROY
);
for
(
int
i
=
0
;
i
<
3
&&
!
m_bDestroyed
;
i
++
)
{
try
{
Thread
.
sleep
(
200
);
}
catch
(
Exception
e
)
{}
}
if
(
!
m_bDestroyed
)
System
.
out
.
println
(
"The object application can not exit correctly!"
);
m_aTimer
.
stop
();
super
.
destroy
();
}
public
void
update
(
Graphics
g
)
{
paint
(
g
);
}
public
void
paint
(
Graphics
g
)
{
super
.
paint
(
g
);
if
(
m_xEmbedObj
!=
null
)
{
synchronized
(
this
)
{
if
(
m_aImage
!=
null
)
g
.
drawImage
(
m_aImage
,
0
,
0
,
EmbedContApp
.
this
);
}
}
}
public
void
generateNewImage
()
{
if
(
m_xEmbedObj
!=
null
)
{
try
{
int
nOldState
=
m_xEmbedObj
.
getCurrentState
();
int
nState
=
nOldState
;
if
(
nOldState
==
EmbedStates
.
EMBED_LOADED
)
{
m_xEmbedObj
.
changeState
(
EmbedStates
.
EMBED_RUNNING
);
nState
=
EmbedStates
.
EMBED_RUNNING
;
}
if
(
nState
==
EmbedStates
.
EMBED_ACTIVE
||
nState
==
EmbedStates
.
EMBED_RUNNING
)
{
XComponentSupplier
xCompProv
=
(
XComponentSupplier
)
UnoRuntime
.
queryInterface
(
XComponentSupplier
.
class
,
m_xEmbedObj
);
if
(
xCompProv
!=
null
)
{
XComponent
xComp
=
xCompProv
.
getComponent
();
XTransferable
xTransfer
=
(
XTransferable
)
UnoRuntime
.
queryInterface
(
XTransferable
.
class
,
xComp
);
if
(
xTransfer
!=
null
)
{
DataFlavor
aFlavor
=
new
DataFlavor
();
aFlavor
.
MimeType
=
"image/png"
;
aFlavor
.
HumanPresentableName
=
"Portable Network Graphics"
;
aFlavor
.
DataType
=
new
Type
(
byte
[].
class
);
byte
[]
aPNGData
=
(
byte
[])
AnyConverter
.
toArray
(
xTransfer
.
getTransferData
(
aFlavor
)
);
if
(
aPNGData
!=
null
&&
aPNGData
.
length
!=
0
)
{
synchronized
(
this
)
{
m_aImage
=
m_aToolkit
.
createImage
(
aPNGData
);
}
}
}
else
System
.
out
.
println
(
"paint() : can not get XTransferable for the component!\n"
);
}
else
System
.
out
.
println
(
"paint() : XComponentSupplier is not implemented!\n"
);
}
}
catch
(
com
.
sun
.
star
.
uno
.
Exception
e
)
{
// dialogs should not be used in paint()
System
.
out
.
println
(
"Exception in paint(): "
+
e
);
}
}
}
public
void
mouseClicked
(
MouseEvent
e
)
{
if
(
e
.
getModifiers
()
==
InputEvent
.
BUTTON1_MASK
)
{
actionRegister
(
MOUSE_CLICKED
);
}
}
public
void
mousePressed
(
MouseEvent
e
){};
public
void
mouseEntered
(
MouseEvent
e
){};
public
void
mouseExited
(
MouseEvent
e
){};
public
void
mouseReleased
(
MouseEvent
e
){};
// XEmbeddedClient
public
void
saveObject
()
throws
com
.
sun
.
star
.
uno
.
Exception
{
if
(
m_xEmbedObj
!=
null
)
{
try
{
XEmbedPersist
xPersist
=
(
XEmbedPersist
)
UnoRuntime
.
queryInterface
(
XEmbedPersist
.
class
,
m_xEmbedObj
);
if
(
xPersist
!=
null
)
{
xPersist
.
storeOwn
();
generateNewImage
();
}
else
JOptionPane
.
showMessageDialog
(
m_aFrame
,
"No XEmbedPersist!"
,
"Error:"
,
JOptionPane
.
ERROR_MESSAGE
);
}
catch
(
Exception
e
)
{
JOptionPane
.
showMessageDialog
(
m_aFrame
,
e
,
"Exception in saveObject:"
,
JOptionPane
.
ERROR_MESSAGE
);
}
}
generateNewImage
();
repaint
();
}
public
void
onShowWindow
(
boolean
bVisible
)
{
// for now nothing to do
}
// classes
class
NewMenuItem
extends
MenuItem
implements
ActionListener
// Menu New
{
public
NewMenuItem
()
{
super
(
"New"
,
new
MenuShortcut
(
KeyEvent
.
VK_A
));
addActionListener
(
this
);
}
public
void
actionPerformed
(
ActionEvent
e
)
{
actionRegister
(
NEW_DOCUMENT
);
}
}
class
SaveAsMenuItem
extends
MenuItem
implements
ActionListener
// Menu SaveAs...
{
public
SaveAsMenuItem
()
{
super
(
"SaveAs..."
);
addActionListener
(
this
);
}
public
void
actionPerformed
(
ActionEvent
e
)
{
actionRegister
(
SAVE_AS
);
}
}
class
OpenFileMenuItem
extends
MenuItem
implements
ActionListener
// Menu Open
{
public
OpenFileMenuItem
()
{
super
(
"Open"
,
new
MenuShortcut
(
KeyEvent
.
VK_C
));
addActionListener
(
this
);
}
public
void
actionPerformed
(
ActionEvent
e
)
{
actionRegister
(
OPEN_FILE
);
}
}
class
SaveMenuItem
extends
MenuItem
implements
ActionListener
// Menu Save
{
public
SaveMenuItem
()
{
super
(
"Save"
,
new
MenuShortcut
(
KeyEvent
.
VK_D
));
addActionListener
(
this
);
}
public
void
actionPerformed
(
ActionEvent
e
)
{
actionRegister
(
SAVE
);
}
}
class
NewObjectMenuItem
extends
MenuItem
implements
ActionListener
// Menu NewObject
{
public
NewObjectMenuItem
()
{
super
(
"Create"
,
new
MenuShortcut
(
KeyEvent
.
VK_N
));
addActionListener
(
this
);
}
public
void
actionPerformed
(
ActionEvent
e
)
{
actionRegister
(
NEW_OBJECT
);
}
}
class
LoadObjectMenuItem
extends
MenuItem
implements
ActionListener
// Menu LoadObject
{
public
LoadObjectMenuItem
()
{
super
(
"Load from file"
,
new
MenuShortcut
(
KeyEvent
.
VK_L
));
addActionListener
(
this
);
}
public
void
actionPerformed
(
ActionEvent
e
)
{
actionRegister
(
OBJECT_FROM_FILE
);
}
}
class
LinkObjectMenuItem
extends
MenuItem
implements
ActionListener
// Menu LinkObject
{
public
LinkObjectMenuItem
()
{
super
(
"Create link"
,
new
MenuShortcut
(
KeyEvent
.
VK_M
));
addActionListener
(
this
);
}
public
void
actionPerformed
(
ActionEvent
e
)
{
actionRegister
(
LINK_FROM_FILE
);
}
}
class
ConvertLinkToEmbedMenuItem
extends
MenuItem
implements
ActionListener
// Menu LinkObject
{
public
ConvertLinkToEmbedMenuItem
()
{
super
(
"Convert link to embed"
,
new
MenuShortcut
(
KeyEvent
.
VK_M
));
addActionListener
(
this
);
}
public
void
actionPerformed
(
ActionEvent
e
)
{
actionRegister
(
CONVERT_LINK_TO_OBJECT
);
}
}
// Helper methods
...
...
@@ -698,6 +814,13 @@ public class EmbedContApp extends Applet implements MouseListener, XEmbeddedClie
for
(
int
ind
=
0
;
ind
<
16
;
ind
++
)
pClassID
[
ind
]
=
(
byte
)
pTempClassID
[
ind
];
}
else
if
(
aServiceName
.
equals
(
"BitmapImage"
)
)
{
int
[]
pTempClassID
=
{
0xD3
,
0xE3
,
0x4B
,
0x21
,
0x9D
,
0x75
,
0x10
,
0x1A
,
0x8C
,
0x3D
,
0x00
,
0xAA
,
0x00
,
0x1A
,
0x16
,
0x52
};
for
(
int
ind
=
0
;
ind
<
16
;
ind
++
)
pClassID
[
ind
]
=
(
byte
)
pTempClassID
[
ind
];
}
if
(
pClassID
!=
null
)
{
...
...
embeddedobj/util/makefile.mk
Dosyayı görüntüle @
aec29756
...
...
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.
2
$
# $Revision: 1.
3
$
#
# last change: $Author: mav $ $Date: 2003-1
0-29 08:32:00
$
# last change: $Author: mav $ $Date: 2003-1
1-14 15:24:28
$
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
...
...
@@ -88,12 +88,27 @@ SHL1OBJS= \
$(SLO)$/
closepreventer.obj
\
$(SLO)$/
intercept.obj
SHL1OBJS
+=
\
$(SLO)$/
olecomponent.obj
\
$(SLO)$/
olepersist.obj
\
$(SLO)$/
oleembed.obj
\
$(SLO)$/
olevisual.obj
\
$(SLO)$/
olemisc.obj
\
$(SLO)$/
olewrapclient.obj
\
$(SLO)$/
advisesink.obj
SHL1STDLIBS
=
\
$(SALLIB)
\
$(CPPULIB)
\
$(CPPUHELPERLIB)
SHL1STDLIBS
+=
\
ole32.lib
\
gdi32.lib
\
uuid.lib
\
oleaut32.lib
SHL1DEF
=
$(MISC)$/$(SHL1TARGET)
.def
DEF1NAME
=
$(SHL1TARGET)
...
...
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