[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 4 commits - extras/source scripting/examples sw/source wizards/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sat Dec 8 01:08:02 UTC 2018
dev/null |binary
extras/source/templates/wizard/bitmap/FormWizard_1.png |binary
extras/source/templates/wizard/bitmap/FormWizard_2.png |binary
extras/source/templates/wizard/bitmap/webwizard.png |binary
scripting/examples/beanshell/WordCount/wordcount.bsh | 77 ++++++------
sw/source/ui/dialog/wordcountdialog.src | 104 ++++++++---------
wizards/source/formwizard/FormWizard.xba | 32 ++---
wizards/source/webwizard/HtmlAutoPilotBasic.xba | 36 ++---
wizards/source/webwizard/Language.xba | 12 -
9 files changed, 132 insertions(+), 129 deletions(-)
New commits:
commit d14c9556e9ba12c0be5ac225a6b0fb08457436fd
Author: Matthias Seidel <mseidel at apache.org>
AuthorDate: Sat Dec 8 00:05:31 2018 +0000
Commit: Matthias Seidel <mseidel at apache.org>
CommitDate: Sat Dec 8 00:05:31 2018 +0000
Cleaned up resource file for word count
diff --git a/sw/source/ui/dialog/wordcountdialog.src b/sw/source/ui/dialog/wordcountdialog.src
index c29167f70b59..a03bda22261b 100644
--- a/sw/source/ui/dialog/wordcountdialog.src
+++ b/sw/source/ui/dialog/wordcountdialog.src
@@ -20,92 +20,96 @@
*************************************************************/
+
#include <helpid.h>
#include <dialog.hrc>
#include <wordcountdialog.hrc>
+
ModalDialog DLG_WORDCOUNT
{
HelpID = HID_DLG_WORDCOUNT ;
OutputSize = TRUE ;
SVLook = TRUE ;
- Size = MAP_APPFONT ( 170 , 108 ) ;
+ Size = MAP_APPFONT ( 170, 108 ) ;
Text [ en-US ] = "Word Count" ;
Moveable = TRUE ;
- FixedLine FL_CURRENT
+ FixedLine FL_CURRENT
{
- Pos = MAP_APPFONT ( 6 , 3 ) ;
- Size = MAP_APPFONT ( 158 , 8 ) ;
- Text [ en-US ] = "Current selection";
+ Pos = MAP_APPFONT ( 6, 3 ) ;
+ Size = MAP_APPFONT ( 158, 8 ) ;
+ Text [ en-US ] = "Current selection" ;
};
- FixedText FT_CURRENTWORD
+ FixedText FT_CURRENTWORD
{
- Pos = MAP_APPFONT ( 12 , 14 ) ;
- Size = MAP_APPFONT ( 80 , 8 ) ;
- Text [ en-US ] = "Words:";
+ Pos = MAP_APPFONT ( 12, 14 ) ;
+ Size = MAP_APPFONT ( 80, 8 ) ;
+ Text [ en-US ] = "Words:" ;
};
- FixedText FI_CURRENTWORD
+ FixedText FI_CURRENTWORD
{
- Pos = MAP_APPFONT ( 111 , 14 ) ;
- Size = MAP_APPFONT ( 50 , 8 ) ;
- Right = TRUE;
+ Pos = MAP_APPFONT ( 111, 14 ) ;
+ Size = MAP_APPFONT ( 50, 8 ) ;
+ Right = TRUE ;
};
- FixedText FT_CURRENTCHARACTER
+ FixedText FT_CURRENTCHARACTER
{
- Pos = MAP_APPFONT ( 12 , 26 ) ;
- Size = MAP_APPFONT ( 80 , 8 ) ;
- Text [ en-US ] = "Characters:";
+ Pos = MAP_APPFONT ( 12, 26 ) ;
+ Size = MAP_APPFONT ( 80, 8 ) ;
+ Text [ en-US ] = "Characters:" ;
};
- FixedText FI_CURRENTCHARACTER
+ FixedText FI_CURRENTCHARACTER
{
- Pos = MAP_APPFONT ( 111 , 26 ) ;
- Size = MAP_APPFONT ( 50 , 8 ) ;
- Right = TRUE;
+ Pos = MAP_APPFONT ( 111, 26 ) ;
+ Size = MAP_APPFONT ( 50, 8 ) ;
+ Right = TRUE ;
};
- FixedLine FL_DOC
+ FixedLine FL_DOC
{
- Pos = MAP_APPFONT ( 6, 40 ) ;
- Size = MAP_APPFONT ( 158 , 8 ) ;
- Text [ en-US ] = "Whole document";
+ Pos = MAP_APPFONT ( 6, 40 ) ;
+ Size = MAP_APPFONT ( 158, 8 ) ;
+ Text [ en-US ] = "Whole document" ;
};
- FixedText FT_DOCWORD
+ FixedText FT_DOCWORD
{
- Pos = MAP_APPFONT ( 12, 51 ) ;
- Size = MAP_APPFONT ( 80 , 8 ) ;
- Text [ en-US ] = "Words:";
+ Pos = MAP_APPFONT ( 12, 51 ) ;
+ Size = MAP_APPFONT ( 80, 8 ) ;
+ Text [ en-US ] = "Words:" ;
};
- FixedText FI_DOCWORD
+ FixedText FI_DOCWORD
{
- Pos = MAP_APPFONT ( 111 , 51 ) ;
- Size = MAP_APPFONT ( 50 , 8 ) ;
- Right = TRUE;
+ Pos = MAP_APPFONT ( 111, 51 ) ;
+ Size = MAP_APPFONT ( 50, 8 ) ;
+ Right = TRUE ;
};
- FixedText FT_DOCCHARACTER
+ FixedText FT_DOCCHARACTER
{
- Pos = MAP_APPFONT ( 12 , 63 ) ;
- Size = MAP_APPFONT ( 80 , 8 ) ;
- Text [ en-US ] = "Characters:";
+ Pos = MAP_APPFONT ( 12, 63 ) ;
+ Size = MAP_APPFONT ( 80, 8 ) ;
+ Text [ en-US ] = "Characters:" ;
};
- FixedText FI_DOCCHARACTER
+ FixedText FI_DOCCHARACTER
{
- Pos = MAP_APPFONT ( 111, 63 ) ;
- Size = MAP_APPFONT ( 50, 8 ) ;
- Right = TRUE;
+ Pos = MAP_APPFONT ( 111, 63 ) ;
+ Size = MAP_APPFONT ( 50, 8 ) ;
+ Right = TRUE ;
};
- FixedLine FL_BOTTOM
+ FixedLine FL_BOTTOM
{
- Pos = MAP_APPFONT ( 6 , 77 ) ;
- Size = MAP_APPFONT ( 158 , 8 ) ;
+ Pos = MAP_APPFONT ( 6, 77 ) ;
+ Size = MAP_APPFONT ( 158, 8 ) ;
};
- OKButton PB_OK
+ OKButton PB_OK
{
- Pos = MAP_APPFONT ( 61 , 88 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
+ Pos = MAP_APPFONT ( 61, 88 ) ;
+ Size = MAP_APPFONT ( 50, 14 ) ;
DefButton = TRUE ;
};
- HelpButton PB_HELP
+ HelpButton PB_HELP
{
- Pos = MAP_APPFONT ( 114 , 88 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
+ Pos = MAP_APPFONT ( 114, 88 ) ;
+ Size = MAP_APPFONT ( 50, 14 ) ;
};
};
+
+// ********************************************************************** EOF
commit c594b8f6b5ff8d7a93bd20edd994da83289214f0
Author: Matthias Seidel <mseidel at apache.org>
AuthorDate: Sat Dec 8 00:04:28 2018 +0000
Commit: Matthias Seidel <mseidel at apache.org>
CommitDate: Sat Dec 8 00:04:28 2018 +0000
Cleaning up WebWizard, moving graphics from bmp to png
diff --git a/extras/source/templates/wizard/bitmap/webwizard.bmp b/extras/source/templates/wizard/bitmap/webwizard.bmp
deleted file mode 100644
index f9e79411d945..000000000000
Binary files a/extras/source/templates/wizard/bitmap/webwizard.bmp and /dev/null differ
diff --git a/extras/source/templates/wizard/bitmap/webwizard.png b/extras/source/templates/wizard/bitmap/webwizard.png
new file mode 100644
index 000000000000..74300d70cbed
Binary files /dev/null and b/extras/source/templates/wizard/bitmap/webwizard.png differ
diff --git a/wizards/source/webwizard/HtmlAutoPilotBasic.xba b/wizards/source/webwizard/HtmlAutoPilotBasic.xba
index 1666a87fa23e..cec802062c1c 100644
--- a/wizards/source/webwizard/HtmlAutoPilotBasic.xba
+++ b/wizards/source/webwizard/HtmlAutoPilotBasic.xba
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<!--***********************************************************
- *
+ *
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -9,16 +9,16 @@
* to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
+ *
***********************************************************-->
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="HtmlAutoPilotBasic" script:language="StarBasic">' Variables must be declared
Option Explicit
@@ -174,10 +174,10 @@ Dim OldWebPageIndex as Integer
CurrentHome$ = GraphicsDir + Style(CurWebPageIndex, 4)
CurrentTop$ = GraphicsDir + Style(CurWebPageIndex, 5)
With oBaseDocument.DocumentProperties.UserDefinedProperties
- .AutoPilotName1 = ExtractGraphicNames(CurWebPageIndex,2)
- .AutoPilotName2 = ExtractGraphicNames(CurWebPageIndex, 4)
- .AutoPilotBullet = Style(CurWebPageIndex, 6)
- .AutoPilotBackground = Style(CurWebPageIndex, 7)
+ .AutoPilotName1 = ExtractGraphicNames(CurWebPageIndex,2)
+ .AutoPilotName2 = ExtractGraphicNames(CurWebPageIndex, 4)
+ .AutoPilotBullet = Style(CurWebPageIndex, 6)
+ .AutoPilotBackground = Style(CurWebPageIndex, 7)
End With
SetBulletAndGraphics()
CheckControls(oBaseDocument.DrawPage)
@@ -191,7 +191,7 @@ End Sub
Function ExtractGraphicNames(CurIndex as Integer, i as Integer) as String
Dim FieldValue as String
FieldValue = GetFileNameWithoutExtension(Style(CurIndex, i))
- FieldValue = FieldValue & " " & GetFileNameWithoutExtension(Style(CurIndex, i+1))
+ FieldValue = FieldValue & " " & GetFileNameWithoutExtension(Style(CurIndex, i+1))
ExtractGraphicNames = FieldValue
End Function
@@ -257,7 +257,7 @@ Dim oGraphic as Object
Dim i as Integer
Dim udProps as Object
Dim SavePath as String
- BasicLibraries.LoadLibrary("Tools")
+ BasicLibraries.LoadLibrary("Tools")
oUcb = createUnoService("com.sun.star.ucb.SimpleFileAccess")
GetWebWizardPaths()
oBaseDocument = ThisComponent
@@ -276,11 +276,11 @@ Dim SavePath as String
BulletUrlsToSavePath(SavePath)
- udProps = oBaseDocument.DocumentProperties.UserDefinedProperties
- udProps.addProperty("AutoPilotName1", 0, "")
- udProps.addProperty("AutoPilotName2", 0, "")
- udProps.addProperty("AutoPilotBullet", 0, "")
- udProps.addProperty("AutoPilotBackground", 0, "")
+ udProps = oBaseDocument.DocumentProperties.UserDefinedProperties
+ udProps.addProperty("AutoPilotName1", 0, "")
+ udProps.addProperty("AutoPilotName2", 0, "")
+ udProps.addProperty("AutoPilotBullet", 0, "")
+ udProps.addProperty("AutoPilotBackground", 0, "")
AttachBasicMacroToEvent(oBaseDocument,"OnSaveDone", "")
AttachBasicMacroToEvent(oBaseDocument,"OnSaveAsDone", "")
@@ -370,9 +370,9 @@ Dim sExtension as String
sFieldList() = ArrayoutofString(sField, " ", MaxIndex)
For s = 0 To MaxIndex
If m < 6 Then
- List(a,m) = sFieldList(s) & ".gif"
+ List(a,m) = sFieldList(s) & ".gif"
Else
- List(a,m) = sFieldList(s)
+ List(a,m) = sFieldList(s)
End If
m = m + 1
Next s
@@ -437,7 +437,7 @@ End Sub
Sub RepaintHeaderPreview()
Dim Bitmap As Object
Dim sBitmapPath as String
- sBitmapPath = SOBitmapPath & "webwizard.bmp"
+ sBitmapPath = SOBitmapPath & "webwizard.png"
WebWzrd.ImagePreview.ImageURL = sBitmapPath
End Sub
diff --git a/wizards/source/webwizard/Language.xba b/wizards/source/webwizard/Language.xba
index 368f4424348b..63b7f90e5442 100644
--- a/wizards/source/webwizard/Language.xba
+++ b/wizards/source/webwizard/Language.xba
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<!--***********************************************************
- *
+ *
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -9,16 +9,16 @@
* to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
+ *
***********************************************************-->
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Language" script:language="StarBasic">Option Explicit
@@ -85,7 +85,7 @@ Sub OpenWebDialog()
.optArea.Label = GetResText(1008)
.chkSaveasTemplate.Label = GetResText(1010)
End With
-
+
BufferNames() = ArrayfromMultiArray(Layout, 1)
DialogModel.lbTemplate.StringItemList() = BufferNames()
DialogModel.lbTemplate.SelectedItems() = SelList()
@@ -94,7 +94,7 @@ Sub OpenWebDialog()
BufferNames() = ArrayfromMultiArray(Style, 1)
DialogModel.lbStyles.StringItemList() = BufferNames()
DialogModel.lbStyles.SelectedItems() = SelList()
- sBitmapPath = SOBitmapPath & "webwizard.bmp"
+ sBitmapPath = SOBitmapPath & "webwizard.png"
DialogModel.ImagePreview.ImageURL = sBitmapPath
ToggleOptionButtons(DialogModel, bWithBackGraphic)
commit 6e5c06d0fe430c9e71c6705c14b160c950fc2c59
Author: Matthias Seidel <mseidel at apache.org>
AuthorDate: Sat Dec 8 00:00:11 2018 +0000
Commit: Matthias Seidel <mseidel at apache.org>
CommitDate: Sat Dec 8 00:00:11 2018 +0000
Cleaning up FormWizard, moving graphics from bmp to png
diff --git a/extras/source/templates/wizard/bitmap/FormWizard_1.bmp b/extras/source/templates/wizard/bitmap/FormWizard_1.bmp
deleted file mode 100644
index aa7cb4940d1d..000000000000
Binary files a/extras/source/templates/wizard/bitmap/FormWizard_1.bmp and /dev/null differ
diff --git a/extras/source/templates/wizard/bitmap/FormWizard_1.png b/extras/source/templates/wizard/bitmap/FormWizard_1.png
new file mode 100644
index 000000000000..75e25dc6f20f
Binary files /dev/null and b/extras/source/templates/wizard/bitmap/FormWizard_1.png differ
diff --git a/extras/source/templates/wizard/bitmap/FormWizard_2.bmp b/extras/source/templates/wizard/bitmap/FormWizard_2.bmp
deleted file mode 100644
index 347c8c36e52b..000000000000
Binary files a/extras/source/templates/wizard/bitmap/FormWizard_2.bmp and /dev/null differ
diff --git a/extras/source/templates/wizard/bitmap/FormWizard_2.png b/extras/source/templates/wizard/bitmap/FormWizard_2.png
new file mode 100644
index 000000000000..b56bdaf84f7f
Binary files /dev/null and b/extras/source/templates/wizard/bitmap/FormWizard_2.png differ
diff --git a/wizards/source/formwizard/FormWizard.xba b/wizards/source/formwizard/FormWizard.xba
index d61a3f73e4e1..df36a6e1fad6 100644
--- a/wizards/source/formwizard/FormWizard.xba
+++ b/wizards/source/formwizard/FormWizard.xba
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<!--***********************************************************
- *
+ *
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -9,16 +9,16 @@
* to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
+ *
***********************************************************-->
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="FormWizard" script:language="StarBasic">Option Explicit
@@ -189,7 +189,7 @@ Dim LocList() as String
ControlCaptionsToStandardLayout()
oDocument.GetCurrentController().Frame.ComponentWindow.Enable = True
oProgressBar.Value = 90
- DialogModel.imgTheme.ImageURL = FormPath & "FormWizard_1.bmp"
+ DialogModel.imgTheme.ImageURL = FormPath & "FormWizard_1.png"
DialogModel.imgTheme.BackGroundColor = RGB(0,60,126)
ToggleDatabasePage(True)
oProgressBar.Value = 100
@@ -202,11 +202,11 @@ Dim LocList() as String
oFormDocuments = oDataSource.getFormDocuments()
DlgFormDB.Dispose()
oDocument.dispose()
- Dim bLinkExists as Boolean
+ Dim bLinkExists as Boolean
i = 1
- Dim FormBaseName as String
+ Dim FormBaseName as String
FormBaseName = FormName
- Do
+ Do
bLinkExists = oFormDocuments.HasbyHierarchicalName(FormName)
If bLinkExists Then
i = i + 1
@@ -227,7 +227,7 @@ Dim LocList() as String
End If
If ((Not IsNull(oDBConnection)) And (Not bConnectionIsovergiven)) Then
oDBConnection.Dispose()
- End If
+ End If
WIZARDERROR:
If Err <> 0 Then
Msgbox(sMsgErrMsg, 16, GetProductName())
@@ -262,7 +262,7 @@ Dim QueryIndex as Integer
CurCommandType = iCommandTypes(SelIndex)
End If
If CurCommandType = com.sun.star.sdb.CommandType.QUERY Then
- QueryIndex = SelIndex - Ubound(Tablenames()) - 1
+ QueryIndex = SelIndex - Ubound(Tablenames()) - 1
Tablename = QueryNames(QueryIndex)
oColumns = oDBConnection.Queries.GetByName(TableName).Columns
Else
@@ -292,7 +292,7 @@ Sub PreviousStep()
.cmdGoOn.Enabled = True
.lstSelFields.Tag = Not bControlsareCreated
.cmdGoOn.Label = sGoOn
- .imgTheme.ImageUrl = FormPath & "FormWizard_1.bmp"
+ .imgTheme.ImageUrl = FormPath & "FormWizard_1.png"
End With
FormSetMoveRights()
WIZARDERROR:
@@ -327,7 +327,7 @@ Sub NextStep()
DlgFormDB.EndExecute()
exit Sub
End Select
- DialogModel.imgTheme.ImageUrl = FormPath & "FormWizard_" & DialogModel.Step & ".bmp"
+ DialogModel.imgTheme.ImageUrl = FormPath & "FormWizard_" & DialogModel.Step & ".png"
DlgFormDB.Title = WizardTitle(DialogModel.Step)
WIZARDERROR:
If Err <> 0 Then
@@ -391,7 +391,7 @@ End Sub
Sub StoreFormInDatabase()
- Dim NoArgs() as new com.sun.star.beans.PropertyValue
+ Dim NoArgs() as new com.sun.star.beans.PropertyValue
FormName = "Form_" & sDBName & "_" & TableName & ".sxw"
sFormUrl = TempPath & "/" & FormName
oDocument.StoreAsUrl(sFormUrl, NoArgs())
@@ -400,7 +400,6 @@ Sub StoreFormInDatabase()
End Sub
-
Sub StoreForm()
Dim sTargetPath as String
Dim TypeNames(0,2) as String
@@ -416,7 +415,6 @@ Dim oTypes() as Object
End Sub
-
Sub EmptyFieldsListboxes()
Dim NullList() as String
ToggleListboxControls(DialogModel, False)
@@ -438,9 +436,9 @@ dim iSelPos as Integer
sFirstItem = oListBox.getItem(0)
If sFirstItem = DelEntryName Then
iSelPos = oListBox.getSelectedItemPos()
- oListBox.removeItems(0, 1)
+ oListBox.removeItems(0, 1)
If iSelPos > 0 Then
- oListBox.selectItemPos(iSelPos-1, True)
+ oListBox.selectItemPos(iSelPos-1, True)
End If
End If
End Sub
commit 31df7841adbd74c9f32cc5cfce86c148d365e01f
Author: Matthias Seidel <mseidel at apache.org>
AuthorDate: Fri Dec 7 23:54:02 2018 +0000
Commit: Matthias Seidel <mseidel at apache.org>
CommitDate: Fri Dec 7 23:54:02 2018 +0000
Fixed typo, deleted whitespace
diff --git a/scripting/examples/beanshell/WordCount/wordcount.bsh b/scripting/examples/beanshell/WordCount/wordcount.bsh
index 3ee4c66a8d77..2b832114aaa7 100644
--- a/scripting/examples/beanshell/WordCount/wordcount.bsh
+++ b/scripting/examples/beanshell/WordCount/wordcount.bsh
@@ -1,5 +1,5 @@
/**************************************************************
- *
+ *
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -7,18 +7,19 @@
* to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
+ *
*************************************************************/
-//Provides a word count of the selected text in A Writer document.
+
+//Provides a word count of the selected text in a Writer document.
import com.sun.star.uno.UnoRuntime;
import com.sun.star.frame.XModel;
import com.sun.star.view.XSelectionSupplier;
@@ -29,55 +30,55 @@ import com.sun.star.script.provider.XScriptContext;
// display the count in a Swing dialog
void doDisplay(numWords) {
- wordsLabel = new JLabel("Word count = " + numWords);
- closeButton = new JButton("Close");
- frame = new JFrame("Word Count");
- closeButton.addActionListener(new ActionListener() {
- actionPerformed(ActionEvent e) {
- frame.setVisible(false);
- }
- });
- 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);
+ wordsLabel = new JLabel("Word count = " + numWords);
+ closeButton = new JButton("Close");
+ frame = new JFrame("Word Count");
+ closeButton.addActionListener(new ActionListener() {
+ actionPerformed(ActionEvent e) {
+ frame.setVisible(false);
+ }
+ });
+ 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);
}
int wordcount() {
- result = 0;
+ 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());
- // use the standard J2SE delimiters to tokenize the string
- // obtained from the XTextRange
- strTok = new StringTokenizer(xTextRange.getString());
- result += strTok.countTokens();
- }
+ // 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());
+ // use the standard J2SE delimiters to tokenize the string
+ // obtained from the XTextRange
+ strTok = new StringTokenizer(xTextRange.getString());
+ result += strTok.countTokens();
+ }
- doDisplay(result);
- return result;
+ doDisplay(result);
+ return result;
}
// The XSCRIPTCONTEXT variable is of type XScriptContext and is available to
// all BeanShell scripts executed by the Script Framework
xModel = (XModel)
- UnoRuntime.queryInterface(XModel.class, XSCRIPTCONTEXT.getDocument());
+ UnoRuntime.queryInterface(XModel.class, XSCRIPTCONTEXT.getDocument());
//the writer controller impl supports the css.view.XSelectionSupplier interface
xSelectionSupplier = (XSelectionSupplier)
- UnoRuntime.queryInterface(XSelectionSupplier.class, xModel.getCurrentController());
+ 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());
+ UnoRuntime.queryInterface(XIndexAccess.class, xSelectionSupplier.getSelection());
count = wordcount();
System.out.println("count = "+count);
More information about the Libreoffice-commits
mailing list