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
b62d8e6b
Kaydet (Commit)
b62d8e6b
authored
Tem 11, 2013
tarafından
Stephan Bergmann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Adapt example to use retrofitted UNO service ctors
Change-Id: I85bf8e3fe76ff107cc3e611cc1103ca1f27fc00f
üst
386af689
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
21 deletions
+9
-21
Clipboard.java
...amples/DevelopersGuide/OfficeDev/Clipboard/Clipboard.java
+9
-21
No files found.
odk/examples/DevelopersGuide/OfficeDev/Clipboard/Clipboard.java
Dosyayı görüntüle @
b62d8e6b
...
@@ -32,15 +32,16 @@
...
@@ -32,15 +32,16 @@
*
*
*************************************************************************/
*************************************************************************/
import
com.sun.star.lang.XMultiComponentFactory
;
import
com.sun.star.uno.XComponentContext
;
import
com.sun.star.uno.XComponentContext
;
import
com.sun.star.uno.UnoRuntime
;
import
com.sun.star.uno.UnoRuntime
;
import
com.sun.star.frame.XComponentLoader
;
import
com.sun.star.frame.Desktop
;
import
com.sun.star.frame.XDesktop2
;
import
com.sun.star.datatransfer.DataFlavor
;
import
com.sun.star.datatransfer.DataFlavor
;
import
com.sun.star.datatransfer.UnsupportedFlavorException
;
import
com.sun.star.datatransfer.UnsupportedFlavorException
;
import
com.sun.star.datatransfer.XTransferable
;
import
com.sun.star.datatransfer.XTransferable
;
import
com.sun.star.datatransfer.clipboard.XClipboard
;
import
com.sun.star.datatransfer.clipboard.XClipboard
;
import
com.sun.star.datatransfer.clipboard.XClipboardNotifier
;
import
com.sun.star.datatransfer.clipboard.SystemClipboard
;
import
com.sun.star.datatransfer.clipboard.XSystemClipboard
;
import
com.sun.star.text.XTextDocument
;
import
com.sun.star.text.XTextDocument
;
import
com.sun.star.uno.AnyConverter
;
import
com.sun.star.uno.AnyConverter
;
...
@@ -59,18 +60,11 @@ public class Clipboard
...
@@ -59,18 +60,11 @@ public class Clipboard
XComponentContext
xOfficeContext
=
XComponentContext
xOfficeContext
=
com
.
sun
.
star
.
comp
.
helper
.
Bootstrap
.
bootstrap
();
com
.
sun
.
star
.
comp
.
helper
.
Bootstrap
.
bootstrap
();
System
.
out
.
println
(
"Connected to a running office ..."
);
System
.
out
.
println
(
"Connected to a running office ..."
);
// get the service manager from the office context
XMultiComponentFactory
xServiceManager
=
xOfficeContext
.
getServiceManager
();
// create a new test document
// create a new test document
Object
oDesktop
=
xServiceManager
.
createInstanceWithContext
(
XDesktop2
xDesktop
=
Desktop
.
create
(
xOfficeContext
);
"com.sun.star.frame.Desktop"
,
xOfficeContext
);
XComponentLoader
xCompLoader
=
UnoRuntime
.
queryInterface
(
XComponentLoader
.
class
,
oDesktop
);
com
.
sun
.
star
.
lang
.
XComponent
xComponent
=
com
.
sun
.
star
.
lang
.
XComponent
xComponent
=
x
CompLoader
.
loadComponentFromURL
(
"private:factory/swriter"
,
x
Desktop
.
loadComponentFromURL
(
"private:factory/swriter"
,
"_blank"
,
0
,
new
com
.
sun
.
star
.
beans
.
PropertyValue
[
0
]);
"_blank"
,
0
,
new
com
.
sun
.
star
.
beans
.
PropertyValue
[
0
]);
{
{
XTextDocument
xDoc
=
UnoRuntime
.
queryInterface
(
XTextDocument
.
class
,
xComponent
);
XTextDocument
xDoc
=
UnoRuntime
.
queryInterface
(
XTextDocument
.
class
,
xComponent
);
...
@@ -93,21 +87,15 @@ public class Clipboard
...
@@ -93,21 +87,15 @@ public class Clipboard
}
}
// test document will be closed later
// test document will be closed later
Object
oClipboard
=
xServiceManager
.
createInstanceWithContext
(
XSystemClipboard
xClipboard
=
SystemClipboard
.
create
(
xOfficeContext
);
"com.sun.star.datatransfer.clipboard.SystemClipboard"
,
xOfficeContext
);
XClipboard
xClipboard
=
UnoRuntime
.
queryInterface
(
XClipboard
.
class
,
oClipboard
);
//---------------------------------------------------
//---------------------------------------------------
// registering as clipboard listener
// registering as clipboard listener
//---------------------------------------------------
//---------------------------------------------------
XClipboardNotifier
xClipNotifier
=
UnoRuntime
.
queryInterface
(
XClipboardNotifier
.
class
,
oClipboard
);
ClipboardListener
aClipListener
=
new
ClipboardListener
();
ClipboardListener
aClipListener
=
new
ClipboardListener
();
xClip
Notifier
.
addClipboardListener
(
aClipListener
);
xClip
board
.
addClipboardListener
(
aClipListener
);
// Read ClipBoard
// Read ClipBoard
readClipBoard
(
xClipboard
);
readClipBoard
(
xClipboard
);
...
@@ -145,7 +133,7 @@ public class Clipboard
...
@@ -145,7 +133,7 @@ public class Clipboard
//---------------------------------------------------
//---------------------------------------------------
// unregistering as clipboard listener
// unregistering as clipboard listener
//---------------------------------------------------
//---------------------------------------------------
xClip
Notifier
.
removeClipboardListener
(
aClipListener
);
xClip
board
.
removeClipboardListener
(
aClipListener
);
// close test document
// close test document
com
.
sun
.
star
.
util
.
XCloseable
xCloseable
=
UnoRuntime
.
queryInterface
(
com
.
sun
.
star
.
util
.
XCloseable
.
class
,
com
.
sun
.
star
.
util
.
XCloseable
xCloseable
=
UnoRuntime
.
queryInterface
(
com
.
sun
.
star
.
util
.
XCloseable
.
class
,
...
...
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