Re: XStorable object thrown an exception with error code 283

2015-11-30 Thread Bernard Marcelly

Hi,
This is, in OpenOffice Basic, an equivalent to OpenOffice Basic ConvertToURL()

Function convertAddressToURL(SystemPath As String)
Dim fcp As Object

' I suppose you know how to instantiate a service in your language...
fcp = CreateUnoService("com.sun.star.ucb.FileContentProvider")
convertAddressToURL = fcp.getFileURLFromSystemPath("", SystemPath)
End Function

Compare your simple method to this example with a non-ASCII character:

Dim s As String, t As String

s = "C:\Composers\Camille Saint-Saëns"
t = convertAddressToURL(s)
MsgBox t


If possible I would like to get access to
SaveFile Dialog of this document and set FileName property as well as File
filter so the user just click save as and close the document.


Without any programming:
Menu Tools > Options, Load/Save > General
Document type : Spreadsheet
Always save as : Microsoft Excel 97/2000/XP

Regards/Bernard

khammonh a écrit le 2015-11-30 06:41 :

Bonjour Bernard et merci bien pour votre conseil , Je suis desole que je
n'ecrire pas bien en Francais . Depuis 20 ans que je ne parle pas et n'ecrire
pas en Francais donc je vais ecrirer en Anglais tout de suit.

I couldn't find the class from which I could cast (convert) to
unoidl.com.sun.star.ucb.XFileIdentifierConverter as the method you mentioned
here is the member of this interface and interface as we know couldn't
instantiate with a sub New so it is not possible to invoke the method without a
proper casting . So I did the conversion the URL from file path by using
String.Replace function it work perfectly and I can save as URL.
By doing this the instant of Spreadsheet object still alive and need to close .
Actually I don't want to confuse the user with this (they may not aware that the
file has been saved programmatically as they still see the document name
untitled at the top left Corner)  . If possible I would like to get access to
SaveFile Dialog of this document and set FileName property as well as File
filter so the user just click save as and close the document.
Any suggestion or advise.

Regards
Khammonh

-Original Message- From: Bernard Marcelly
Sent: Saturday, November 28, 2015 3:13 AM
To: api@openoffice.apache.org
Subject: Re: XStorable object thrown an exception with error code 283

Hi,
An URL is not a Windows address preceded by "file:///".
Even if you change \ into / it may still be incorrect, depending on the
characters in the path.
Example:
  C:\Docs OpenOffice\Report_20151127
URL : file:///C:/Docs%20OpenOffice/Report_20151127
You can convert a system address into an URL with method
getFileURLFromSystemPath() of service com.sun.star.ucb.FileContentProvider

If the argument Filter is absent, you provide a null object. This is not
incorrect, you must provide at least an empty array.
The Overwrite option is True by default, so you don't need it.

Bernard


khammonh a écrit le 2015-11-27 10:18 :

Hi there
I have some problem when implementing Interface XStorable of
unoidl.com.sun.star.frame class .
I developed my own Library base on SDK here are method body of SaveDocAs and
SaveDocToFile

Public Sub SaveDocAs(ByVal FileName As String, Optional ByVal Filter As
SpreadSheetFileFilter = SpreadSheetFileFilter.MS_Excel_97)
   Dim Store As XStorable
   Dim Prop() As PropertyValue = {New PropertyValue, New PropertyValue}
   'Dim MyUrl As String = FileName
   Dim MyUrl As String = "file:///" + FileName
   Store = CType(m_mxDocument, XStorable)
   If Filter = SpreadSheetFileFilter.DefaultOpenOffice Then
   Prop = Nothing
   Else
   Prop(0).Name = "FilterName"
   Prop(0).Value = New uno.Any(ParserFilter(Filter))
   Prop(1).Name = "Overwrite"
   Prop(1).Value = New uno.Any(True)
   End If

   Store.storeAsURL(MyUrl, Prop)
   End Sub

Public Sub SaveDocToFile(ByVal FileName As String, Optional ByVal Filter As
SpreadSheetFileFilter = SpreadSheetFileFilter.MS_Excel_97)
Dim Store As XStorable
Dim Prop() As PropertyValue = {New PropertyValue, New PropertyValue}
Dim MyUrl As String = "file:///" + FileName
Store = CType(m_mxDocument, XStorable)
Prop(0).Name = "FilterName"
Prop(0).Value = New uno.Any(ParserFilter(Filter))
Prop(1).Name = "Overwrite"
Prop(1).Value = New uno.Any(True)
Store.storeToURL(MyUrl, Prop)
End Sub

when invoke this method on client application with the code fragment bellow

   ExcelAttach = ExcelRoot & "\" & "Report_" &
ReportDate.ToShortDateString

OO.SaveDocToFile(ExcelAttach,
OOClass.SpreadSheetHelper.SpreadSheetFileFilter.MS_Excel_97)
where ExcelAttach is a file path
I got an exception with error code 283

Actua

Re: XStorable object thrown an exception with error code 283

2015-11-27 Thread Bernard Marcelly

Hi,
An URL is not a Windows address preceded by "file:///".
Even if you change \ into / it may still be incorrect, depending on the 
characters in the path.

Example:
 C:\Docs OpenOffice\Report_20151127
URL : file:///C:/Docs%20OpenOffice/Report_20151127
You can convert a system address into an URL with method 
getFileURLFromSystemPath() of service com.sun.star.ucb.FileContentProvider


If the argument Filter is absent, you provide a null object. This is not 
incorrect, you must provide at least an empty array.

The Overwrite option is True by default, so you don't need it.

Bernard


khammonh a écrit le 2015-11-27 10:18 :

Hi there
I have some problem when implementing Interface XStorable of 
unoidl.com.sun.star.frame class .
I developed my own Library base on SDK here are method body of SaveDocAs and 
SaveDocToFile

Public Sub SaveDocAs(ByVal FileName As String, Optional ByVal Filter As 
SpreadSheetFileFilter = SpreadSheetFileFilter.MS_Excel_97)
   Dim Store As XStorable
   Dim Prop() As PropertyValue = {New PropertyValue, New PropertyValue}
   'Dim MyUrl As String = FileName
   Dim MyUrl As String = "file:///" + FileName
   Store = CType(m_mxDocument, XStorable)
   If Filter = SpreadSheetFileFilter.DefaultOpenOffice Then
   Prop = Nothing
   Else
   Prop(0).Name = "FilterName"
   Prop(0).Value = New uno.Any(ParserFilter(Filter))
   Prop(1).Name = "Overwrite"
   Prop(1).Value = New uno.Any(True)
   End If

   Store.storeAsURL(MyUrl, Prop)
   End Sub

Public Sub SaveDocToFile(ByVal FileName As String, Optional ByVal Filter As 
SpreadSheetFileFilter = SpreadSheetFileFilter.MS_Excel_97)
Dim Store As XStorable
Dim Prop() As PropertyValue = {New PropertyValue, New PropertyValue}
Dim MyUrl As String = "file:///" + FileName
Store = CType(m_mxDocument, XStorable)
Prop(0).Name = "FilterName"
Prop(0).Value = New uno.Any(ParserFilter(Filter))
Prop(1).Name = "Overwrite"
Prop(1).Value = New uno.Any(True)
Store.storeToURL(MyUrl, Prop)
End Sub

when invoke this method on client application with the code fragment bellow

   ExcelAttach = ExcelRoot & "\" & "Report_" & 
ReportDate.ToShortDateString

OO.SaveDocToFile(ExcelAttach, 
OOClass.SpreadSheetHelper.SpreadSheetFileFilter.MS_Excel_97)
where ExcelAttach is a file path
I got an exception with error code 283

Actually the document is opened by the app from a template file then the app 
filled the sheets with content and need to save this file with above mentioned 
method.
If I could set file location and filter of Document SaveFile dialog it would be 
more easy then use these 2 methods . But I don’t know how to interact with 
SaveFile dialog of OpenOffice .
Please if any body can help me.

Thank in advance.

Regards
Khammonh



-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Re: zip/unzip jar archive or add/remove file using a Basic macro?

2015-10-12 Thread Bernard Marcelly

Hi Regina,

You have to use the service com.sun.star.packages.Package

Examples
Reading a text file from a zip :
  
Writing a zip file :
  in BasicAddonBuilder, see Basic module "zip"

Regards
  Bernard

Regina Henschel a écrit le 2015-10-11 20:31 :

Hi all,

I want to write a Basic macro to preview an .xhp file while editing it. Viewing
such file works fine with LoadComponentFromUrl with protocol
"vnd.sun.star.help", if the file is inside a .jar container.

But how can I modify or create or zip/unzip the content of such container using
a Basic macro? A SimpleFileAccess sees it only as file, not as folder.

Kind regards
Regina



-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Re: Integrating help texts and tool tips for extension

2015-09-13 Thread Bernard Marcelly

Hi Keith,
Your need is similar to a question asked here some months ago.
Read my answer in archives :


Regards
Bernard

Keith Alcock a écrit le 2015-09-11 18:55 :

Tsutomu,

Thank you, however this doesn't work for me on OpenOffice 4.0.1 and
Windows.  I will double check on Linux.

2015-09-08 5:19 GMT+09:00 Keith Alcock :


API,

I noticed that the standard menus for Writer (File, Edit, View,...)

when

open and hovered over will show tooltips.  For Edit, this is "This

menu

contains commands for editing the contents of the current document."

My

extension also has a menu, specified in Addons.xcu, but there is no

such

tooltip.


-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Re: Is the view-cursor in the table of contents?

2015-07-28 Thread Bernard Marcelly

Hi Jörg,

Dim v_cur As Object, dix As Object

v_cur = ThisComponent.CurrentController.ViewCursor
dix = nothing
On Error Resume Next
dix = v_cur.DocumentIndex
On Error GoTo 0
if IsNull(dix)  then
  MsgBox("Not in an index")
else
  MsgBox("Index, service : " & dix.ServiceName)
end if

The error handling is necessary because outside of an index, property 
DocumentIndex does not exist.


Reminder: a Table of Contents is a particular type of document index.


Regards
  Bernard


Jörg Schmidt a écrit le 2015-07-28 08:56 :

Hello,

in a text document is my view-cursor:

v_cur = ThisComponent.CurrentController.ViewCursor


How can I reliably(!) test whether this view-cursor currently located in the 
table of contents?


note:
Ok, I can, for example, check:

Msgbox v_cur.Textsection.LinkDisplayName

but I think this is not reliable because ".LinkDisplayName" is just a name that 
can be changed.



Greetings,
Jörg



-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Re: 4.1.2_release_blocker requested: [Issue 126376] SystemFilePicker getFiles() returns an incorrect list of files

2015-07-18 Thread Bernard Marcelly

Andrea,
I am aware that the software bugs I have requested for resolution in 4.1.2 have 
no yet a patch. As I don't understand OpenOffice source code, I can't provide one.
I wanted to remind that they are important bugs for API users, and perhaps not 
so complicated to correct. Hopefully, some designer will investigate and propose 
a patch?


I did not mention the numerous other bug reports on FilePicker because, at least 
on Windows, the designer should have a good understanding of the FilePicker and 
its "templates", and of Windows API since Vista. See bugs 96720, 110141, 116333, 
123544.


(System)FilePicker dialog is an essential mechanism for many script designers. 
It's a pity that it has accumulated bugs and is no longer usable.



Regards
  Bernard

Andrea Pescetti a écrit le 2015-07-18 10:43 :

On 15/07/2015 bugzilla wrote:

bmarcelly has asked  for 4.1.2_release_blocker:
Issue 126376: SystemFilePicker getFiles() returns an incorrect list of files
https://bz.apache.org/ooo/show_bug.cgi?id=126376


For both this one and the other issue related to the FilePicker (issue 126377)
we need evaluation on the API list for sure, and we don't have a patch
available. I'm CCing the API list. I've put a more detailed comment in the 
issue.

Regards,
   Andrea.


-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Re: Set property of selected cell range in a textable in Writer

2015-07-08 Thread Bernard Marcelly

Hi Mark,
You should use Xray to help you explore the API.
All my indications here can be found by a study of what Xray displays (and then 
reading of API docs).



- You can find if your selection is inside a paragraph of a cell, and then find 
the cell and its table:


Dim firstSelection As Object
Dim currentCell As Variant, currentTable As Variant

firstSelection = oCurrentSelection.getByIndex(0)
currentCell = firstSelection.Cell
if not IsEmpty(currentCell) then
  currentCell.WritingMode = com.sun.star.text.WritingMode2.TB_RL
  currentTable = oCurrentSelection.TextTable
else
  MsgBox("First selection is not in a table")
end if


- A table has a property WritingMode. Perhaps it can set WritingMode to all 
cells at once (not tested).


- Enumerate all cells of a table : the table has method getCellNames() that 
returns an array of all the cell names.



Regards
  Bernard


Hung Mark a écrit le 2015-07-08 13:52 :

Hi Mathias,

While invoking setPropertyValue for ParaAdjust works, it is a Paragraph
property instead of a cell property.

Sub ModifyCells
Dim oCurrentSelection As Variant

oCurrentSelection = ThisComponent.getCurrentSelection()
oCurrentSelection.setPropertyValue( "WritingMode",
com.sun.star.text.WritingMode2.TB_RL ) ' doesn't work
oCurrentSelection.setPropertyValue( "VertOrient",
  com.sun.star.text.VertOrientation.BOTTOM ) ' doesn't work
oCurrentSelection.setPropertyValue( "ParaAdjust",
com.sun.star.style.ParagraphAdjust.RIGHT ) ' works
oCurrentSelection.setPropertyValue( "ParaBackColor",RGB(100,0,0) ) '
works

End Sub



-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Re: How can I define long tooltips for toolbars?

2015-06-23 Thread Bernard Marcelly

Jörg Schmidt a écrit le 2015-06-21 12:56 :

Hello,

In toolbars of OpenOffice, there are buttons with long tooltips.

For example, has in the Format-toolbar the button "bold", the tooltip (in a 
german OO):
"Stellt den ausgewählten Text fett dar. Befindet sich der Cursor in einem Wort, so 
wird das gesamte Wort fett dargestellt. Wenn die Auswahl bzw. das Wort bereits fett ist, 
wird diese Formatierung aufgehoben."

But how I can for your own macros (in Extensions) realize such long tooltips? 
Is there for example a solution using the addon.xcu, see:
https://wiki.openoffice.org/wiki/Extensions/Extensions_and_Apache_OpenOffice_4.0#addons.xcu_changes



Hi Jörg,
This feature is called : Extended tip. You can enable or disable extended tips 
display in Tools > Options > OpenOffice > General dialog page. Or, by pressing 
Shift+F1, you can show extended tips for the objects under the mouse pointer.


Note that:
- few users know of the Shift-F1 trick, or use it
- most users disable the automatic display of extended tips
- texts of extended tips cannot have formatting
- information is more clear with help pages.

Extended tip is handled by the Application Help, using the help pages of the 
extension. Creating help pages is complex.


With my tool Extension Compiler you can create an extension with help pages. 
Extension Compiler provides a helper to write these files, and add Extended Tips 
for your commands.



Be prepared to spend some time reading and understanding the document, and 
creating/testing your extension and its help.


Regards / Bernard

-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Re: Disable underline - UnoControlFixedHyperlinkModel

2015-04-23 Thread Bernard Marcelly

Hi Jörg,
That's the usual problem of a structure inside a structure : you must use a 
temporary variable.


Dim fd As Object

With fhm
  ' 
  fd = .FontDescriptor
  fd.Underline = com.sun.star.awt.FontUnderline.NONE
  .FontDescriptor = fd
End With

Remark : there is a side effect, the text color is now black. If you want to 
color the text, add this instruction:


  .TextColor = RGB(0,0,250)

Regards / Bernard

Jörg Schmidt a écrit le 2015-04-23 08:26 :

Hello,

How can I stop underlining of hyperlinks in UnoControlFixedHyperlinkModel?

My current code is:

Dim dia_ueber
Dim frm_ueber
Dim fhm

GlobalScope.BasicLibraries.LoadLibrary("jum")
GlobalScope.DialogLibraries.LoadLibrary("jum")
frm_ueber = DialogLibraries.jum.dlg_ueber
dia_ueber = CreateUnoDialog(frm_ueber)

'dia_ueber.Model.getByName("lbl_version").Label = ex_ver

fhm = 
dia_ueber.Model.createInstance("com.sun.star.awt.UnoControlFixedHyperlinkModel")
With fhm
.Name = "Hyperlink1"
.PositionX = 10
.PositionY = 64
.Width = 80
.Height = 14
.Label = "www.jm-schmidt.de"
.URL = "http://www.jm-schmidt.de/";
End With
dia_ueber.Model.insertByName(fhm.Name, fhm)

dia_ueber.execute


An experiment with:

With fhm
'...
.FontDescriptor.Underline = 0
End With

it does not work.


Gretings,

Jörg


-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Re: OpenOffice Calc Javascript Function

2015-03-15 Thread Bernard Marcelly

Igal @ Lucee.org a écrit le 2015-03-15 20:41 :

it works.  thank you Bernard!

one last question -- how do I get the libraries to "refresh"?  when I
make a change to the libraries, sometimes it's visible immediately, and
some times I need to close OpenOffice and re-open it in order to make
sure that the new code is running.  is there a better way to refresh the
libs?


I have not seen such problem, using the Rhino JavaScript debugger.
Don't forget to save from the Rhino window (Ctrl-N or File > Save).



thanks,

Igal Sapir
Lucee Core Developer
Lucee.org 



-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Re: OpenOffice Calc Javascript Function

2015-03-15 Thread Bernard Marcelly

Sorry, correction of my correction...

if the JavaScript script is in My Macros the location becomes user

oDocScriptProvider.getScript("vnd.sun.star.script:Library1.ExistsTerm.js?language=JavaScript&location=user")

The URI spec of the Scripting Framework is somewhat complex...
<https://wiki.openoffice.org/wiki/Documentation/DevGuide/Scripting/Scripting_Framework_URI_Specification>



Bernard Marcelly a écrit le 2015-03-15 14:56 :

On 3/13/2015 6:09 AM, Bernard Marcelly wrote:
- Create in your document a JavaScript library named Library1


You created the macro in OpenOffice application (My Macros), not in the 
document.

If you really want to have your macro in My Macros, you have to change the call
to the macro:
oDocScriptProvider.getScript("vnd.sun.star.script:Library1.ExistsTerm.js?language=JavaScript&location=share")


The location is changed from "document" to "share"


when I enter into a cell =contains("abc", "b") I get Err:508

In a Calc function, arguments are separated by ; instead of ,

Reminder : your Basic function contains() must be in the Standard library of
your document. Not in the Standard library of My Macros (getting the Script
Provider would be different).

Bernard


Igal @ Lucee.org a écrit le 2015-03-14 23:43 :

hi Bernard,

thank you for your reply.  I created a javascript library named "JSLib1" and in
it a macro named "StringContains", and I placed in it your example JS code.



then in OpenOffice Basic Macros I have the module "Module1".  you can see the
code at
https://gist.github.com/TwentyOneSolutions/38f38c1ebf99a85b6da5

when I enter into a cell =getScriptVersion() I see the expected value of 1.04

when I enter into a cell =contains("abc", "b") I get Err:508 which according to
https://wiki.openoffice.org/wiki/Calc_Error_Codes means that a parenthesis is
not closed properly.

trying to call the macro TestJsCall shows the following error:



Macro Library JSLib1 not found, which seems to be different from Err:508.

what am I missing?

thanks again,

Igal Sapir
Lucee Core Developer
Lucee.org <http://lucee.org/>

On 3/13/2015 6:09 AM, Bernard Marcelly wrote:

Hi,

If you intend to use a JavaScript function in a cell formula, forget about it.
First, you cannot directly call a JavaScript function from a cell formula. The
formula should call a Basic function that calls the JavaScript function.
Second, the formula will provide an error at document loading, because at this
instant the script library is not yet accessible.
_

If you want to use a JavaScript function from a Basic macro, you have to use
the script provider.

Suppose you want to create function ExistsTerm(arg1, arg2) in JavaScript.

- Create in your document a JavaScript library named Library1
- Then create a JavaScript module named : ExistsTerm
- Edit this module : replace all the lines by this line:
ARGUMENTS[0].indexOf(ARGUMENTS[1]) > -1;
  Explanations:
- The name of the function is the name of the module.
- ARGUMENTS is an array of all the arguments.
- The result of the function is by default the last evaluation.

Here is a Basic macro that uses the JavaScript function. Attention, the email
has split long lines.

Sub Main3
Dim oDocScriptProvider As Object, oScript As Object
Dim result As Variant

oDocScriptProvider = ThisComponent.getScriptProvider()
oScript =
oDocScriptProvider.getScript("vnd.sun.star.script:Library1.ExistsTerm.js?language=JavaScript&location=document")


result = oScript.invoke(Array("Apache OpenOffice is the best", "OpenOffice"),
Array(), Array())
MsgBox("Term exists : " & result)
End Sub

The Scripting Framework is described in the Developer's Guide
<https://wiki.openoffice.org/wiki/Documentation/DevGuide/Scripting/Scripting_Framework>



The arguments of the invoke method is described in
<https://www.openoffice.org/api/docs/common/ref/com/sun/star/script/XInvocation.html#invoke>






Igal @ Lucee.org a écrit le 2015-03-13 06:50 :

Hi all,

I want to write a simple function to be used in OpenOffice Calc.

It would return true if the cell's value contains a substring, e.g.

|function contains(string, substring) {

 return (string.indexOf(substring) > -1);
}|

But I can't find any documentation or examples on that.

Any ideas?

TIA

p.s. this is a crosspost with
http://stackoverflow.com/questions/29025195/openoffice-calc-javascript-function




-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org





-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffic

Re: OpenOffice Calc Javascript Function

2015-03-15 Thread Bernard Marcelly

Correction:

if the JavaScript script is in My Macros the location becomes application

oDocScriptProvider.getScript("vnd.sun.star.script:Library1.ExistsTerm.js?language=JavaScript&location=application")



Bernard Marcelly a écrit le 2015-03-15 14:56 :

On 3/13/2015 6:09 AM, Bernard Marcelly wrote:
- Create in your document a JavaScript library named Library1


You created the macro in OpenOffice application (My Macros), not in the 
document.

If you really want to have your macro in My Macros, you have to change the call
to the macro:
oDocScriptProvider.getScript("vnd.sun.star.script:Library1.ExistsTerm.js?language=JavaScript&location=share")

The location is changed from "document" to "share"


when I enter into a cell =contains("abc", "b") I get Err:508

In a Calc function, arguments are separated by ; instead of ,

Reminder : your Basic function contains() must be in the Standard library of
your document. Not in the Standard library of My Macros (getting the Script
Provider would be different).

Bernard


Igal @ Lucee.org a écrit le 2015-03-14 23:43 :

hi Bernard,

thank you for your reply.  I created a javascript library named "JSLib1" and in
it a macro named "StringContains", and I placed in it your example JS code.



then in OpenOffice Basic Macros I have the module "Module1".  you can see the
code at
https://gist.github.com/TwentyOneSolutions/38f38c1ebf99a85b6da5

when I enter into a cell =getScriptVersion() I see the expected value of 1.04

when I enter into a cell =contains("abc", "b") I get Err:508 which according to
https://wiki.openoffice.org/wiki/Calc_Error_Codes means that a parenthesis is
not closed properly.

trying to call the macro TestJsCall shows the following error:



Macro Library JSLib1 not found, which seems to be different from Err:508.

what am I missing?

thanks again,

Igal Sapir
Lucee Core Developer
Lucee.org <http://lucee.org/>

On 3/13/2015 6:09 AM, Bernard Marcelly wrote:

Hi,

If you intend to use a JavaScript function in a cell formula, forget about it.
First, you cannot directly call a JavaScript function from a cell formula. The
formula should call a Basic function that calls the JavaScript function.
Second, the formula will provide an error at document loading, because at this
instant the script library is not yet accessible.
_

If you want to use a JavaScript function from a Basic macro, you have to use
the script provider.

Suppose you want to create function ExistsTerm(arg1, arg2) in JavaScript.

- Create in your document a JavaScript library named Library1
- Then create a JavaScript module named : ExistsTerm
- Edit this module : replace all the lines by this line:
ARGUMENTS[0].indexOf(ARGUMENTS[1]) > -1;
  Explanations:
- The name of the function is the name of the module.
- ARGUMENTS is an array of all the arguments.
- The result of the function is by default the last evaluation.

Here is a Basic macro that uses the JavaScript function. Attention, the email
has split long lines.

Sub Main3
Dim oDocScriptProvider As Object, oScript As Object
Dim result As Variant

oDocScriptProvider = ThisComponent.getScriptProvider()
oScript =
oDocScriptProvider.getScript("vnd.sun.star.script:Library1.ExistsTerm.js?language=JavaScript&location=document")

result = oScript.invoke(Array("Apache OpenOffice is the best", "OpenOffice"),
Array(), Array())
MsgBox("Term exists : " & result)
End Sub

The Scripting Framework is described in the Developer's Guide
<https://wiki.openoffice.org/wiki/Documentation/DevGuide/Scripting/Scripting_Framework>


The arguments of the invoke method is described in
<https://www.openoffice.org/api/docs/common/ref/com/sun/star/script/XInvocation.html#invoke>





Igal @ Lucee.org a écrit le 2015-03-13 06:50 :

Hi all,

I want to write a simple function to be used in OpenOffice Calc.

It would return true if the cell's value contains a substring, e.g.

|function contains(string, substring) {

 return (string.indexOf(substring) > -1);
}|

But I can't find any documentation or examples on that.

Any ideas?

TIA

p.s. this is a crosspost with
http://stackoverflow.com/questions/29025195/openoffice-calc-javascript-function



-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org





-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Re: OpenOffice Calc Javascript Function

2015-03-15 Thread Bernard Marcelly

On 3/13/2015 6:09 AM, Bernard Marcelly wrote:
- Create in your document a JavaScript library named Library1


You created the macro in OpenOffice application (My Macros), not in the 
document.

If you really want to have your macro in My Macros, you have to change the call 
to the macro:

oDocScriptProvider.getScript("vnd.sun.star.script:Library1.ExistsTerm.js?language=JavaScript&location=share")
The location is changed from "document" to "share"


when I enter into a cell =contains("abc", "b") I get Err:508

In a Calc function, arguments are separated by ; instead of ,

Reminder : your Basic function contains() must be in the Standard library of 
your document. Not in the Standard library of My Macros (getting the Script 
Provider would be different).


Bernard


Igal @ Lucee.org a écrit le 2015-03-14 23:43 :

hi Bernard,

thank you for your reply.  I created a javascript library named "JSLib1" and in
it a macro named "StringContains", and I placed in it your example JS code.



then in OpenOffice Basic Macros I have the module "Module1".  you can see the
code at
https://gist.github.com/TwentyOneSolutions/38f38c1ebf99a85b6da5

when I enter into a cell =getScriptVersion() I see the expected value of 1.04

when I enter into a cell =contains("abc", "b") I get Err:508 which according to
https://wiki.openoffice.org/wiki/Calc_Error_Codes means that a parenthesis is
not closed properly.

trying to call the macro TestJsCall shows the following error:



Macro Library JSLib1 not found, which seems to be different from Err:508.

what am I missing?

thanks again,

Igal Sapir
Lucee Core Developer
Lucee.org <http://lucee.org/>

On 3/13/2015 6:09 AM, Bernard Marcelly wrote:

Hi,

If you intend to use a JavaScript function in a cell formula, forget about it.
First, you cannot directly call a JavaScript function from a cell formula. The
formula should call a Basic function that calls the JavaScript function.
Second, the formula will provide an error at document loading, because at this
instant the script library is not yet accessible.
_

If you want to use a JavaScript function from a Basic macro, you have to use
the script provider.

Suppose you want to create function ExistsTerm(arg1, arg2) in JavaScript.

- Create in your document a JavaScript library named Library1
- Then create a JavaScript module named : ExistsTerm
- Edit this module : replace all the lines by this line:
ARGUMENTS[0].indexOf(ARGUMENTS[1]) > -1;
  Explanations:
- The name of the function is the name of the module.
- ARGUMENTS is an array of all the arguments.
- The result of the function is by default the last evaluation.

Here is a Basic macro that uses the JavaScript function. Attention, the email
has split long lines.

Sub Main3
Dim oDocScriptProvider As Object, oScript As Object
Dim result As Variant

oDocScriptProvider = ThisComponent.getScriptProvider()
oScript =
oDocScriptProvider.getScript("vnd.sun.star.script:Library1.ExistsTerm.js?language=JavaScript&location=document")
result = oScript.invoke(Array("Apache OpenOffice is the best", "OpenOffice"),
Array(), Array())
MsgBox("Term exists : " & result)
End Sub

The Scripting Framework is described in the Developer's Guide
<https://wiki.openoffice.org/wiki/Documentation/DevGuide/Scripting/Scripting_Framework>

The arguments of the invoke method is described in
<https://www.openoffice.org/api/docs/common/ref/com/sun/star/script/XInvocation.html#invoke>




Igal @ Lucee.org a écrit le 2015-03-13 06:50 :

Hi all,

I want to write a simple function to be used in OpenOffice Calc.

It would return true if the cell's value contains a substring, e.g.

|function contains(string, substring) {

 return (string.indexOf(substring) > -1);
}|

But I can't find any documentation or examples on that.

Any ideas?

TIA

p.s. this is a crosspost with
http://stackoverflow.com/questions/29025195/openoffice-calc-javascript-function



-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org





-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Re: OpenOffice Calc Javascript Function

2015-03-13 Thread Bernard Marcelly

Hi,

If you intend to use a JavaScript function in a cell formula, forget about it.
First, you cannot directly call a JavaScript function from a cell formula. The 
formula should call a Basic function that calls the JavaScript function.
Second, the formula will provide an error at document loading, because at this 
instant the script library is not yet accessible.

_

If you want to use a JavaScript function from a Basic macro, you have to use the 
script provider.


Suppose you want to create function ExistsTerm(arg1, arg2) in JavaScript.

- Create in your document a JavaScript library named Library1
- Then create a JavaScript module named : ExistsTerm
- Edit this module : replace all the lines by this line:
ARGUMENTS[0].indexOf(ARGUMENTS[1]) > -1;
  Explanations:
- The name of the function is the name of the module.
- ARGUMENTS is an array of all the arguments.
- The result of the function is by default the last evaluation.

Here is a Basic macro that uses the JavaScript function. Attention, the email 
has split long lines.


Sub Main3
Dim oDocScriptProvider As Object, oScript As Object
Dim result As Variant

oDocScriptProvider = ThisComponent.getScriptProvider()
oScript = 
oDocScriptProvider.getScript("vnd.sun.star.script:Library1.ExistsTerm.js?language=JavaScript&location=document")
result = oScript.invoke(Array("Apache OpenOffice is the best", "OpenOffice"), 
Array(), Array())

MsgBox("Term exists : " & result)
End Sub

The Scripting Framework is described in the Developer's Guide

The arguments of the invoke method is described in




Igal @ Lucee.org a écrit le 2015-03-13 06:50 :

Hi all,

I want to write a simple function to be used in OpenOffice Calc.

It would return true if the cell's value contains a substring, e.g.

|function contains(string, substring) {

 return (string.indexOf(substring) > -1);
}|

But I can't find any documentation or examples on that.

Any ideas?

TIA

p.s. this is a crosspost with
http://stackoverflow.com/questions/29025195/openoffice-calc-javascript-function



-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Re: [QUESTION] On (Local) Error GoTo

2015-02-23 Thread Bernard Marcelly

Hello,

In the Internet, someone said about Access 2000 VBA :
"On Local Error is a remnant from older versions of BASIC (before Visual Basic 
for Applications). In current versions it acts the same as On Error and there is 
no particular reason to use it any more."


I could not find a case where "On Error Local" is different from "On Error".
What is said in the help is also valid with "On Error" : an error handling in a 
called routine suspends the error handling of the caller, until the error 
handling is deactivated or until the called routine terminates. Example hereafter.


Regards
  Bernard

REM  *  BASIC  *

Sub Main
Dim c, d
On Error GoTo xx2
d = 0
tata(d)
c = 4/d
MsgBox("Finished")
Exit Sub

xx2:
  MsgBox("Error Main line " & erl)
  Resume Next
End Sub


Sub tata(b)
Dim a
On Error GoTo xx1
titi(b)
a = 3/b
MsgBox("Exit tata")
Exit Sub

xx1:
  MsgBox("Error tata line " & erl)
  Resume Next
End Sub


Sub titi(b)
Dim a
On Error GoTo xx3
a = 3/b
MsgBox("Exit titi")
Exit Sub

xx3:
  MsgBox("Error titi line " & erl)
  Resume Next
End Sub


Message de Mathias Röllig  date 2015-02-22 17:37 :

Hello!

Can anyone give me an example where
On Error GoTo
and
On Local Error GoTo
shows a difference?

In my tests I can't find any difference if I use
On Local Error GoTo
in a subroutine.

If I understand right the help the error handling should be reset if the
subroutine was quit.

Regards, Mathias



-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Re: a API-problem with .HeaderBackColor

2015-01-12 Thread Bernard Marcelly

Hello,
The IDL description of most of the properties of Header and Footer says :
[ maybevoid ]
Except for HeaderIsOn and FooterIsOn.

If the API was designed to accept values when Header/Footer is off, then the 
properties would always be available, with default values.

IMO this design is on purpose. You have to live with it.

 Bernard

Message de Jörg Schmidt  date 2015-01-11 20:26 :

Hello,

There is a nasty problem with .HeaderBackColor in Writer page-templates.

When I read all PropertyValues of a page-style "A" and transfer them to page-style 
"B", the reading is done in a certain, specified by the API, order:

BorderDistance|HeaderText|GridLines|HeaderBorderDistance|TopBorder|GridPrint|FootnoteLineRelativeWidth|Width|FooterRightMargin|ShadowFormat|DisplayName|LeftBorder|BackGraphicLocation|BottomBorderDistance|FootnoteLineColor|HeaderRightMargin|*FooterIsOn*|FootnoteHeight|HeaderHeight|FootnoteLineTextDistance|FollowStyle|BottomMargin|RightBorderDistance|HeaderIsShared|GridBaseWidth|FooterTextRight|Height|PrinterPaperTray|HeaderBackGraphicFilter|RegisterParagraphStyle|GridColor|HeaderLeftBorderDistance|StandardPageMode|GridSnapToChars|FooterIsShared|HeaderRightBorder|HeaderBottomBorder|NumberingType|FooterLeftMargin|IsLandscape|*HeaderBackColor*|HeaderIsDynamicHeight|FooterBackGraphicLocation|HeaderShadowFormat|GridMode|BottomBorder|*HeaderIsOn*|TextColumns|*FooterBackColor*|FooterShadowFormat
 ...

--> Please observing the order: "FooterIsOn" before "FooterBackColor", but "HeaderIsOn" 
after "HeaderBackColor".

This has the the effect that, when in "B", the header is not turned on, the background 
color of the header of "A" is not transmitted because this can only be written if the 
header is switched on.


I think this is a deficiency in the API? What do you think?


Greetigs
Jörg


-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Re: [EXT][UI] Static text hyperlink in a dialog

2014-11-17 Thread Bernard Marcelly

Hi,

Since OpenOffice.org version 3.3 there is a control called FixedHyperlink.
However it is not available in the palette of controls in the IDE. So you have 
to insert it by program.

Suppose your dialog is in variable dlg.

Dim dlg As Object
Dim fhm As Object

dlg = CreateUnoDialog(.)

fhm = dlg.Model.createInstance("com.sun.star.awt.UnoControlFixedHyperlinkModel")
With fhm
  .Name = "Hyperlink1"
  .PositionX = 10
  .PositionY = 10
  .Width = 50
  .Height = 15
  .Label = "Apache OpenOffice"
  .URL = "http://www.openoffice.org/";
End With
dlg.Model.insertByName(fhm.Name, fhm)

dlg.execute


Regards
  Bernard


Message de W. Amenel VOGLOZIN  date 2014-11-17 16:42 :

Hi,

I would like to add a static text (Label Field) to a dialog and the text would act as an 
HTTP hyperlink. It would be similar (including the hand pointer) to the "Get more 
extensions online" that can be found in the lower right corner of the Extension 
Manager and the text would trigger the opening of the specified link in a Web browser.


Unfortunately, I don't see in the developer guide and published service 
specifications anything that would allow me to do just that. Could someone 
point me into the right direction?

Thank you.



-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Re: Programmatically (C++) closing frame with chance to save

2014-10-28 Thread Bernard Marcelly

Hi Keith,
Method close() does what it says...
You have to verify if the document was modified.
Use method isModified() from interface com.sun.star.util.XModifiable.
Then you ask for saving, and store it with interface 
com.sunstar.frame.XStorable.

See 



Regards
  Bernard

Message de Keith Alcock  date 2014-10-28 15:32 :

API experts,

I need to close some of the open document windows from within a C++
addon.  Some of the documents may have been modified, so there should
be a chance to save them or even abort the close, just like you get
with the Close command from the UI.  It seems like XCloseable is just
the thing for this, but when I perform xCloseable->close() on either
the XFrame or XModel, the window summarily closes even with a modified
document.  Am I calling it on the wrong object or is this not how the
functionality should be implemented or is something else wrong?  Here
is an incomplete code that approximates what I'm doing:

Reference xEnumerationAccess = xDesktop->getComponents();
Reference xEnumeration = xEnumerationAccess->createEnumeration();

while (xEnumeration->hasMoreElements() == sal_True) {
 Reference xComponent;
 Any any = xEnumeration->nextElement();
 any >>= xComponent;

 Reference xModel(xComponent, UNO_QUERY);
 Reference xController = xModel->getCurrentController();
 Reference xFrame = xController->getFrame();

 Reference xCloseableFrame(xFrame, UNO_QUERY);
 xCloseableFrame->close(sal_True);
 return;
}

The frame closes nicely, but no messages about needing to save the
document appear.  Any ideas?  Thanks.

Keith

-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Re: RTF parsing with OOo

2014-08-22 Thread Bernard Marcelly

Hello Elena,

When OpenOffice opens a text document, it looks the same from the API, be it a 
.rtf or .doc or .odt document. There is no "RTF parsing" available from the API, 
the job is done by the import filter during loading of the document.


With the API you can load a .rtf document and find if it contains a form and if 
the form contains controls of the type you want.
The explanations in the Developer's Guide are indeed very abstract (chapter 
Forms). In fact it is simply embedded containers.

- a text document has a DrawPage
- the Drawpage "contains" shapes, and gives access to a container of Forms.
- the container of Forms may contain one form, rarely several forms.
- a Form is a container of controls
- each type of control supports a specific service.

So you can explore your document and find the controls it contains.
Here is an example in OpenOffice Basic (I don't practice Java). It may help 
understand the Java examples of the Developer's Guide.


Dim aDoc As Object, aPage As Object
Dim allForms As Object, allControls As Object
Dim aForm As Object, aControl As Object
Dim x As Long, y As Long
Dim nbCheckBox As Long, nbTextF As Long, nbCtrl As Long

nbCheckBox = 0
nbTextF = 0
nbCtrl = 0
aDoc = ThisComponent

aPage = aDoc.getDrawpage()
allForms = aPage.getForms()
for x = 0 to allForms.getCount() -1
  aForm = allForms.getByIndex(x)
  nbCtrl = nbCtrl +aForm.getCount()
  for y = 0 to aForm.getCount() -1
aControl = aForm.getByIndex(y)
if aControl.supportsService("com.sun.star.form.component.CheckBox")  then
  nbCheckBox = nbCheckBox +1
end if
if aControl.supportsService("com.sun.star.form.component.TextField")  then
  nbTextF = nbTextF +1
end if
  next
next

MsgBox("Number of controls : " & nbCtrl & chr(13) & _
  "CheckBoxes : " & nbCheckBox & "  TextFields : " & nbTextF)


Regards
  Bernard

Message de Elena Sergienko  date 2014-08-21 16:49 :

Dear OpenOffice API community,

I have a set of RTF files. My project is to write a Java program to
identify which of those files contain form elements like checkboxes and
edit fields. Upon my long hours of researching online on how to do it I was
not able to find an obvious way to parse RTF file structure and identify
its elements besides the plain text. I installed OOo 4.1.0 and OOo SDK
4.1.0 hoping that it offers RTF parsing.
Please confirm whether OOo has the relative to my problem solution, and if
so I am hoping you can point me in the right direction.

Thank you,
Elena



-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Re: selecting more than one sheet (Calc / StarBasic)

2014-08-12 Thread Bernard Marcelly

Hello Jörg,
Use the dispatcher.

Dim dispatcher As Object, curWin As Object
Dim args(0) As New com.sun.star.beans.PropertyValue

curWin = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
args(0).Name = "Tables"
args(0).Value = Array(1,2,4) ' list of sheet numbers to select
dispatcher.executeDispatch(curWin, ".uno:SelectTables", "", 0, args())


Regards
  Bernard


Message de Jörg Schmidt  date 2014-08-12 08:57 :

Hello,

I want to select multiple sheets in Calc simultaneously with StarBasic.
Is there only the indirect method via the range-object? for example: 
https://forum.openoffice.org/en/forum/viewtopic.php?f=20&t=45389&hilit=select+sheets#p209791



-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Re: how to delete a table row in writer

2014-07-22 Thread Bernard Marcelly

Message de IMMO WETZEL  date 2014-07-17 01:58 :

Hi,

how can I delete all rows with text  in one column in a table in 
writer with pure api functions from VB.net ?
Are there any ideas ?

Regards Immo




Hi,
You asked this same question 3 weeks ago, and 3 answers were given.
Look in your mailbox, or read the archives here :


Regards/Bernard

-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Re: how to find the current row in a table in writer to delete this one

2014-06-28 Thread Bernard Marcelly

Hi,
I suppose :
- you are working on a Writer document
- your tables are simple, regularly squared : no cell merged, no split cells.

This example works on a table, explores lines from bottom to top, deletes lines 
where the first cell has a specific string.


REM  *  BASIC  ***
Dim aTable As Object, allRows As Object, firstCell As Object
Dim y As Long

aTable = ThisComponent.getTextTables.getByIndex(0)
allRows = aTable.getRows
for y = allRows.getCount -1 to 0 step -1
  firstCell = aTable.getCellByPosition(0,y)
  if firstCell.String = "dd"  then
allRows.removeByIndex(y, 1)
  end if
next

Questions like this are more easily answered in the community forum 



Regards
  Bernard

Message de IMMO WETZEL  date 2014-06-26 09:25 :

I'm working on a huge document with a lot of tables and images and so on.
Now I have to modify a table and to delete empty/unused rows. Every Row has an 
unique text string in the first cell.

How can I delete these rows without knowing the exact position of this row.

Are the any way to fill the removebyindex function with data ?

I guess there must be something like

-  Search the text

-  Detect the row number

-  Remove the row
But I couldn't find it


Immo




-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Re: Borders around XColumnRowRange

2014-06-13 Thread Bernard Marcelly

Message de Steele, Raymond  date 2014-06-13 02:08 :

I want to determine if my XColumnRowRange has a border around all the outside 
cells.   The first row cells should have a  TopLine. The first column cells 
should have a LeftLine. The last column cells should have a RightLine. The last 
rows cells should have a BottomLine.  What is the best way to check this?



Hi Raymond,

So you have a table in Calc, and you want to have a border around the table.
Your table is a CellRange. This CellRange has a property TableBorder which 
covers the entire range.


References:
- service c.s.s.table.CellProperties, property TableBorder
- structure c.s.s.table.TableBorder
- Doc 



Instead of checking each border, a simpler way is to set each border as you need 
it, then copy the complete structure to TableBorder.


Regards
  Bernard

-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Re: Is it possible to install an image container with extension?

2014-05-05 Thread Bernard Marcelly

Message de Hung Mark  date 2014-05-04 19:05 :

Hi

I'm packaging an old extension,which is installed by extracting
archive to overwrite user data.
Its icon is defined by image file and an lc_imagelist.xml.
It seems that there isn't such a file type for META-INF/manifest.xml.

Is there anyway to install the image container with extension, or just
impossible?



Hi,
This seems to be a hack.
What is the use of the images ?

If you want to add a new gallery of images, then look at any of the extensions 
doing this.
If you want to have some icons for the buttons of your extension, this is done 
but putting the images in the oxt file (or a sub-folder of it) and referencing 
it from the Addons.xcu file.
If you want to use images from the code of your extension, simply put the images 
in the oxt file. By code you can get the location of the installed extension.


Regards
  Bernard

-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Re: Some questions about "undo"

2014-03-07 Thread Bernard Marcelly

Hello,
For your information, the rework of the Undo manager was done in january 2011.
See 

See also the messages titled "info/CWS undoapi: ..." in the archives of the 
defunct interface-announce mailing-list.



Regards
  Bernard


-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Re: Help with pdf import extension download

2014-01-15 Thread Bernard Marcelly

Hello Melinda,
Your message does not show us which version of OpenOffice you use, and from 
which adddress you downloaded the extension. And your image did not pass through.


There is currently a pitfall when searching for PDF import.
Oracle PDF import extension appears as the most popular extension. However it is 
_not_ the correct extension for Apache OpenOffice 4.0.


You can see an ambiguous phrase at top of the description : "If you are using 
Apache OpenOffice 4.0, use this version."
Few people will remark that "this version" is a link to another extension, 
specific to Apache OpenOffice.



The extension PDF Import for Apache OpenOffice is available from

Click on the green button to display the download page.
I downloaded the oxt file without problem.

Regards
  Bernard

Message de Melinda Marasch  date 2014-01-15 19:19 :

Hi,

I've tried several times to download the pdf import extension for OpenOffice & I
keep getting this error.

Inline image 1



-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Re: Detect page break in long tables (Writer)

2014-01-11 Thread Bernard Marcelly

Hi Ralf,
You have to put the view cursor in a cell. The view cursor shows the page number 
where it is situated.


Here is a proof of concept, in OpenOffice Basic.
In a Writer document, insert a table with only one row (the title row).
The macro will insert 100 lines and show you the row numbers where the page has 
changed:


Sub Main1
Dim myDoc As Object, tb As Object, rws As Object
Dim vCurs As Object, curs1 As Object
Dim p1 As Long, p2 As Long, x As Long

myDoc = ThisComponent
tb = myDoc.getTextTables.getByIndex(0)
rws = tb.getRows
curs1 = tb.getCellByPosition(0,0)
myDoc.getCurrentController.select(curs1)
vCurs = myDoc.getCurrentController.getViewCursor
p1 = vCurs.getPage
for x = 1 to 100
  rws.insertByIndex(rws.getCount, 1)
  vCurs.goDown(1, False)
  p2 = vCurs.getPage
  if p2 <> p1  then
MsgBox("New page at line " & x)
p1 = p2
  end if
next
End Sub


Regards
  Bernard

Message de Ralf Heydenreich  date 2014-01-10 21:47 :

Hi all,
I've a Writer document with a table an some placeholders in it. Now, if
I replace these placeholders from my Java application, the table
sometimes gets too long and split over multiple pages. Since it is a
kind of invoice table I want to put a subtotal at the end of each page.
How can I achieve this? How can I detect a page break while filling the
placeholders?

TIA,
Ralf.

-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Re: pdf impor extension

2013-12-03 Thread Bernard Marcelly

Hi,
For Apache OpenOffice 4.0, use the latest version of :

PDF Import for Apache OpenOffice



Regards
  Bernard

Message de Dan Karmon  date 2013-12-03 18:19 :

Can't load the Oracle pdf import extension. Repeated
failures.. I get a long "loading component library failed:"
message.  I can however, install other extensions.
Any advice? Thank you  Dan



-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Re: install oracle pdf import failed

2013-11-29 Thread Bernard Marcelly

Bonjour,
Cette liste utilise l'anglais, et traite seulement Apache OpenOffice.

LibreOffice traite l'import pdf différemment que sur Apache OpenOffice. 
LibreOffice ouvre directement (Fichier > Ouvrir) un fichier pdf.


Posez plutôt votre question sur la liste us...@fr.libreoffice.org
Voir à cette page
https://wiki.documentfoundation.org/Local_Mailing_Lists#French


Regards
  Bernard

Message de Thomas DUMONT  date 2013-11-29 19:33 :

Bonjour,

Je ne peux installer l'extension oracle pdf import sur libre-office.

Je suis sur PC en 64 bits.
Sous linux 12.04


-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Re: com.sun.star.text.SectionFileLink

2013-10-12 Thread Bernard Marcelly

Message de Peter Eberlein  date 2013-10-11 15:50 :

Hi,

if I break the link of a TextSection (which is linked to another section in
another document) by setting the FileLink property (FileURL is empty), then the
content of the section vanishes.

If I do the same with GUI, then the content isn't lost.

Any ideas how to preserve the content?



Hi,
If you simply do this instead :
   yourSection.dispose()
then the text content of the section remains, but the section is removed.


Regards
  Bernard

-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Re: Basic macro – Retrieve folder of the current spreadsheet

2013-09-29 Thread Bernard Marcelly

Message de Johnny Rosenberg  date 2013-09-28 17:03 :


Is there a similar way to get the folder name directly? I couldn't find it


Not directly. But you can use a routine from the Tools library:

Dim docFolder As String

GlobalScope.BasicLibraries.loadLibrary("Tools")
docFolder = DirectoryNameoutofPath(ThisComponent.URL, "/")
MsgBox(docFolder, 0, "Folder of this document")

And, referring to your code, you don't need to ConvertToURL() what is already an 
URL address ;-)


Regards
  Bernard

-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Re: Backward incompatibility of System Mail API

2013-07-30 Thread Bernard Marcelly

Hanya's page should be inserted or linked to in the official AOO 4.0 Release 
Notes.

Regards
  Bernard

Message de Alexandro Colorado  date 2013-07-29 22:03 :

Good link, this should be a blog post letting people know the changes as
well as generate documentation to transition to the 4.0 API.

My question here is this is the definite list or are there other's missing
on the latest iterations?


On Mon, Jul 29, 2013 at 1:48 PM, Mauricio Baeza
wrote:


On 07/29/2013 01:43 PM, Bernard Marcelly wrote:

Hi,
I compared the IDL references of Apache OpenOffice 3.4.1 and 4.0.0.

I found that these services are no longer present:
com.sun.star.system.SimpleCommandMail
com.sun.star.system.SimpleSystemMail

They are replaced by com.sun.star.system.SystemMailProvider.


This is not described in the AOO 4.0 Release Notes. I think it should
be indicated in the chapter "Changes that Impact Backwards
Compatibility".


Regards
   Bernard



There are more services method and changed ... Here are some:

http://wiki.openoffice.org/wiki/User:Hanya/API_Changes_on_4.0_since_3.4


Best regards



-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Backward incompatibility of System Mail API

2013-07-29 Thread Bernard Marcelly

Hi,
I compared the IDL references of Apache OpenOffice 3.4.1 and 4.0.0.

I found that these services are no longer present: 
com.sun.star.system.SimpleCommandMail

com.sun.star.system.SimpleSystemMail

They are replaced by com.sun.star.system.SystemMailProvider.


This is not described in the AOO 4.0 Release Notes. I think it should be 
indicated in the chapter "Changes that Impact Backwards Compatibility".



Regards
  Bernard

-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Re: UNP API

2013-04-12 Thread Bernard Marcelly

Message de k.misha  date 2013-04-10 12:34 :


How can I select a sheet in calc document?



You probably mean : display a particular sheet of a spreadsheet document.
The currently displayed sheet is called the Active Sheet.
You have to set it with the desired sheet object as argument.

REM -- With OpenOffice Basic easy coding ! ---
Dim myDoc As Object, mySheet As Object
myDoc = ThisComponent
mySheet =  myDoc.Sheets.getByName("October")
myDoc.CurrentController.ActiveSheet = mySheet


With Java or C++ you will have to query and use the methods:

Methodfrom  interface
.getSheets()  com.sun.star.sheet.XSpreadsheetDocument
.getCurrentController() com.sun.star.frame.XModel
.setActiveSheet(mySheet)  com.sun.star.sheet.XSpreadsheetView


Regards
  Bernard

-
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org



Re: Incompatible change for extensions

2013-01-25 Thread Bernard Marcelly

Message de Jürgen Schmidt  date 2013-01-25 13:55 :

On 1/25/13 12:44 AM, Andrea Pescetti wrote:

Rob Weir wrote:

I also like the idea of marking a function as deprecated, maybe even
supporting the new and old together for a release, to give time for
transition.


If at all feasible, I would be for this. Ideally, we should be able to
install a legacy extension by: recognizing it's using legacy APIs or
conventions; displaying a warning; running it anyway, trying to be as
compatible as possible.


this would be indeed nice and if easy possible we would probably do
that. But the reality is that we don't have the resources to spent
enough time on this.


OK, we don't have enough resources, but then why spend scarce resources on 
secondary aspects of the API ? Even if it is simple to do, it's not a sufficient 
reason. Better develop or correct something that was requested by bug reports 
and that appears within available resources.


I am not against incompatible changes, if it is inevitable in order to provide a 
new feature very valuable for the API users. But the changes proposed by Ariel, 
as far as they are described, do not add anything useful for the API user.



We have as deprecated marked API's and I am sure that people will still
use it. These API's are probably deprecated since > 3-4 versions and we
should be save to remove them. But I am sure people would complain about
it if there macro, solution won't run anymore.


That's why I would prefer adding new services/interfaces, and keep the old ones 
with a mention : DEPRECATED, see so-and-so. A perfect example is service 
com.sun.star.document.DocumentInfo. You can be sure that there are still many 
users of this now obsolete service. They are not aware of the new service, and 
don't care.


But you can also find many IDL pages flagged DEPRECATED without indication of an 
alternative, nor simply saying that the feature is killed. This is not helpful 
for the poor API user.


  Bernard



Re: Incompatible change for extensions

2013-01-23 Thread Bernard Marcelly

Message de Jürgen Schmidt  date 2013-01-23 10:12 :


exactly and that means a minor code change and a rebuild. If this kind
of cleanup changes are not allowed with a major release than we do
something wrong. You should not forget the benefit for new developers
that we want to reach. A cleaner and better API is much easier to learn
for them. Existing developers will have no trouble with adapting the
changes but all new ones will benefit.

If you were reading real user questions in forums you would be appalled by the 
low programming level of those wanting to automate tasks, whether in social 
clubs, small businesses, administrations and even big companies. They are often 
non-programmers, or young trainees, that create applications that become 
indispensable. Don't suppose that they have time and knowledge to quickly debug 
a program that used to work for months or years. It will be hard for them to 
find out which change happened in the API and how to modify.


If you think that these changes will make the API easier, you are wrong. 
OpenOffice API is and will remain huge and complex for the casual programmer, 
because it was created by highly qualified programmers, to be understood and 
used by their peers; contrary to VBA that is customer oriented.



On 1/23/13 9:36 AM, Bernard Marcelly wrote:

There is not enough good designers; better spend efforts on correcting
reported real bugs, or on useful improvements (e.g. a real integration
of Python into OpenOffice, like Basic; or add the new dialog controls in
the IDE toolbox).


feel free to join the project and help to improve things like the Python
support, or improving the basic IDE. Remember volunteers are working on
the code base and you can't force them what they should do.

It's funny that people request and take more than they gave back. Really
if you think certain areas of the program need improvements please join
us and help to improve it.

I know my limits. I don't have the knowledge to modify OpenOffice code and don't 
like C++ as a language.
I can say that I have given back a lot since 2003. Up to now 275 bugs reported; 
thousands of answers in users-fr, prog-fr mailing-lists, french and english web 
forums; corrections/improvements in the Wiki Dev'Guide and Basic Programming 
Guide; a french book of 900 pages demystifying OpenOffice programming; several 
free tools that help API users.
I am not the only one with such background, others have done same in other 
countries/languages. I am just giving my advice: you are on the wrong path.


Regards
  Bernard


Re: Incompatible change for extensions

2013-01-23 Thread Bernard Marcelly

Hi Ariel and all,

Bug 121582 is very vague and does not detail the proposed changes. It looks like 
an intended obfuscation, so that nobody will react in time.

The XSimpleFileAccess is indicated as merely an example, but I will develop on 
it.

If bug 121582 proposes for Apache OpenOffice 4.0 to create a new 
service+interface _and_ suppress the old service+interfaces, then it is exactly 
the same problem and methodology error as bug 121577 : force application 
developers to change working code without benefits. The change is only for 
esthetical reason.


I remember a saying: "If it ain't broke don't fix it".

And for the current multiplication of XSimpleFileAccess interfaces : this is 
completely transparent for programmers in OpenOffice Basic, Python, and 
COM-Automation, since they don't have to query interfaces. And they represent 
probably 90 per cent of all application codes.


If bug 121582 proposes to transfer the functions of XSimpleFileAccess2 and 
XSimpleFileAccess3 into XSimpleFileAccess, and then delete XSimpleFileAccess2 
and XSimpleFileAccess3 : the change will "only" affect Java, BeanShell, 
Javascript, C++ developers. I doubt they will appreciate.



As says Hans Zybura, in the real world, various versions of OpenOffice are used 
in schools, companies, etc. Forcing different codes between versions is in fact 
a strong incentive to _not_ update existing and working versions.


There is not enough good designers; better spend efforts on correcting reported 
real bugs, or on useful improvements (e.g. a real integration of Python into 
OpenOffice, like Basic; or add the new dialog controls in the IDE toolbox).


Regards
  Bernard


Message de Ariel Constenla-Haile  date 2013-01-22 12:51 :

Hi *,

Replaying in general to the thread, that is based mainly on bug 121577.

The discussion about incompatibility, centered on this bug, is
meaningless: bug https://issues.apache.org/ooo/show_bug.cgi?id=121582 is
the real code-incompatible change, every extension developer will have
to check the code and adapt it to API changes introduced by this task.

It would be interesting to hear arguments against implementing the
changes needed to perform the task for bug 121582.



Re: Incompatible change for extensions

2013-01-17 Thread Bernard Marcelly

Message de Jürgen Schmidt  date 2013-01-17 13:19 :


I disagree, the old mechanism is a design bug and should be resolved. It
was always planned to fix this a major release. Now with 4.0 we can make
such changes and we had long discussions about incompatible changes for
major releases. Extensions can be easy updated and by the way it is
always a good idea to add a max version dependency and release a new
version of your extension if you have ensured that it works with the
newest office version. How many unpublished API's are used in extensions
that can change at any time?

We probably don't have enough time to fix many more design bugs in the
API for 4.0 but this one is definitely worth the change. We will
document it and the fix is easy. But for all new extensions the usage is
much more intuitive and less error prone.



The current mechanism is not a design bug (because it works), rather a clumsy 
design.


To create a toolbar with the same name in Calc, Draw, Impress, you have to:
- create one WindowState xcu file
- make 2 copies of this file
- modify one line in each copy
- add entries for these files in the manifest.xml
Is this really complex, error prone ? I don't think so, compared to all other 
features of an extension.


About max version dependency : application developers don't see the future. It's 
not possible to know in advance when (and why) an extension will become 
incompatible.


In the context of a company that has created a specific extension, happily used 
for years, Apache OpenOffice 4.0 will be a bad surprise.
Releasing a new version will be difficult: the original developer may have gone, 
or have forgotten the building details of an extension; a new developer has to 
learn the syntax of an oxt file, and find out what has to be changed to make it 
work again. Costs, delays. Benefits ? None.


Regards
  Bernard


Incompatible change for extensions

2013-01-17 Thread Bernard Marcelly

Hello,

I read report 121577 and did not notice the problem.


Then I found this in the dev mailing list :

"I noticed that add-on extensions with toolbars have a problem on trunk.
The ext can be installed but the toolbar is not visible and also not in
the View -> Toolbars menu. Top-level menus coming with the same ext are
visible. I am currently don't know if it is related to the bigger
changes with the name or something else in the context of add-on, means
the framework part."

As you can read in answers to this thread, it means that the next version of 
Apache OpenOffice will be _incompatible_ with _all_ extensions created before.


Such a case should only happen for a compelling reason.
I think this is not the case. Bug 121577 is introduced only for a futile 
purpose:
"the extension developer has to create a configuration file 
WindowState.xcu for every office module where the toolbar is to be 
displayed, even if the toolbar name will be exactly the same in every module."


This is futile because it is not a big simplification of the creation of the 
various xml files of an extension. In fact the only "human" way of creating the 
numerous files of an extension is to use a tool. Then the invoked complexity or 
tediousness (almost) disappears. See :



Of course an extension packager can be modified to the new addon syntax.
The problem is not here, it is that all existing extensions will not work as 
designed unless they are each modified. And modified extensions will not be 
compatible with previous versions or with LibreOffice.


Regards
  Bernard


Re: Java Object Inspector Download URL

2013-01-11 Thread Bernard Marcelly

Message de Alexandro Colorado  date 2013-01-11 23:24 :

Hi I am looking for the current place of the Java Object Inspector
since it seems the URL is sort of outdate and would need to document
the current URL.

I have looked on the SVN and found the URL to the source code, but I
am still missing on the binary package.
https://svn.apache.org/repos/asf/incubator/ooo/trunk/main/odk/examples/java/Inspector/

I guess I should have an oxt somewhere around the tree.

Regards.


Hi,

Object inspector 1.0 extension file is available at


According to Serge Moutou, Object inspector 2.0 was less usable

I could not find its oxt.

In fact, Object inspector project is superseded by the introduction of extension 
MRI (written in Python, but usable from many languages).


Basic programmers will prefer Xray (it is not an extension). See my web site for 
the latest version.



Regards
  Bernard


Re: Document updated or not updated

2013-01-09 Thread Bernard Marcelly

Message de Galileo Teco Juárez  date 2013-01-09 23:21 :

anyone?


2013/1/8 Galileo Teco Juárez 


where I can find the latest information? about the new features



The Developer's Guide lists and explains all the current extension features.


Regards
  Bernard


Re: Looking for the dependencies specification for extension document

2013-01-08 Thread Bernard Marcelly

Message de Alexandro Colorado  date 2013-01-08 06:20 :

Seems there are some documents that were lost during the site
migration, I am currently looking for the specifications for
extensions called to this URL
http://specs.openoffice.org/source/browse/*checkout*/specs/www/appwide/packagemanager/extensiondependencies1.odt

Anyone has the new URL were the wiki can point to?


Hello,
A simple search in the web gives me this address

The document last change date is : Nov 18, 2008

The dependencies are explaiend in the Developer's Guide



Regards
  Bernard


Extension repository is spammed

2013-01-06 Thread Bernard Marcelly

Hello,
Can someone delete the fake extensions (spam messages) introduced recently in 
the repository ?

Displaying the most recent extensions, I counted 8 "spam extensions".

Regards
  Bernard


Re: Prevent closing with InstanceLocker

2012-12-27 Thread Bernard Marcelly

Does the InstanceLocker work if you provide an XActionsApproval (in
Basic, via a UNO listener)? In a dummy test, AOO crashed.


Indeed, it works for me if there is another OpenOffice window in the background. 
But running my routine allowClose still closes the window.


If the document is the unique window, the closing attempt still freezes 
OpenOffice.
Here is my new code.

Option Explicit

Global dontClose As Object, closeDenier As Object

Sub denyClose
if IsNull(dontClose)  then
  closeDenier = CreateUnoListener("nono_", 
"com.sun.star.embed.XActionsApproval")
  dontClose = 
com.sun.star.embed.InstanceLocker.InstanceLockerCtor2(StarDesktop.CurrentFrame, 
com.sun.star.embed.Actions.PREVENT_CLOSE, closeDenier)

end if
End Sub


Sub allowClose
if not IsNull(dontClose)  then
  dontClose.dispose
  closeDenier = Nothing
  dontClose = Nothing
end if
End Sub


function nono_approveAction(nAction As Long) As Boolean
nono_approveAction = True
end function



Another thing that does not work is that disposing the InstanceLocker
that is vetoing the closing of the frame, the frame gets closed even if
I don't close it manually. I understood the specification as saying that
disposing the InstanceLocker will remove the close listener, not close
the instance. How do you interpret this?



"After creation the service adds a listener of requested type ( close, terminate 
and/or etc. ) to the controlled object and let the listener throw related veto 
exception until the service is disposed."


I have the same interpretation. After disposal of the service the programmer 
should be free to let the window (or the document) open or close it.


Useful references from old mailing lists:
  Annoucement of service InstanceLocker (May 2006)

  Problem with InstanceLocker in Basic (Oct 2007)


Regards
  Bernard




Prevent closing with InstanceLocker

2012-12-26 Thread Bernard Marcelly

Hello,

With OpenOffice Basic, I want to prevent a document from closing.
I tried this simple code, stored in a Writer document:

Option Explicit

Global dontClose As Object

Sub denyClose
if IsNull(dontClose)  then
  dontClose = 
com.sun.star.embed.InstanceLocker.InstanceLockerCtor1(ThisComponent, 
com.sun.star.embed.Actions.PREVENT_CLOSE)

end if
End Sub

Sub allowClose
if not IsNull(dontClose)  then
  dontClose.dispose
  dontClose = Nothing
end if
End Sub


The code was tested on AOO 3.4.1 with Windows XP Home.
1 - I run macro denyClose. I still can close the document.
2 - I load the document again, I run macro denyClose. Then I run macro 
allowClose : the document closes.


I changed the argument ThisComponent to : StarDesktop.CurrentFrame

I run macro denyClose. I can't close the document. But OpenOffice freezes and I 
have to kill it.


Does anybody have a working code in Basic ?

Regards
  Bernard