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
33a6649f
Kaydet (Commit)
33a6649f
authored
Mar 31, 2003
tarafından
Duncan Foster
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Tidy up layout & add comments
üst
00b722f8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
wordcount.bsh
scripting/examples/beanshell/WordCount/wordcount.bsh
+11
-4
No files found.
scripting/examples/beanshell/WordCount/wordcount.bsh
Dosyayı görüntüle @
33a6649f
...
...
@@ -15,10 +15,12 @@ void doDisplay(numWords) {
frame.setVisible(false);
}
});
frame.getContentPane().setLayout(new
GridLayout(2,1
));
frame.getContentPane().add(wordsLabel);
frame.getContentPane().add(closeButton);
frame.getContentPane().setLayout(new
BorderLayout(
));
frame.getContentPane().add(wordsLabel
, BorderLayout.CENTER
);
frame.getContentPane().add(closeButton
, BorderLayout.SOUTH
);
frame.pack();
frame.setSize(190,90);
frame.setLocation(430,430);
frame.setVisible(true);
}
...
...
@@ -26,11 +28,15 @@ int wordcount() {
result = 0;
// iterate through each of the selections
count = xIndexAccess.getCount();
for(i=0;i<count;i++) {
// get the XTextRange of the selection
xTextRange = (XTextRange)
UnoRuntime.queryInterface(XTextRange.class, xIndexAccess.getByIndex(i));
System.out.println("string: "+xTextRange.getString());
//System.out.println("string: "+xTextRange.getString());
// use the standard J2SE delimiters to tokenize the string
// obtained from the XTextRange
strTok = new StringTokenizer(xTextRange.getString());
result += strTok.countTokens();
}
...
...
@@ -47,6 +53,7 @@ xModel = (XModel)
xSelectionSupplier = (XSelectionSupplier)
UnoRuntime.queryInterface(XSelectionSupplier.class, xModel.getCurrentController());
//see section 7.5.1 of developers' guide
// the getSelection provides an XIndexAccess to the one or more selections
xIndexAccess = (XIndexAccess)
UnoRuntime.queryInterface(XIndexAccess.class, xSelectionSupplier.getSelection());
...
...
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