|
List Info
Thread: instantiating InstanceLocker from BASIC
|
|
| instantiating InstanceLocker from BASIC |

|
2007-10-06 07:50:25 |
Hi,
when running this macro:
<BASIC>
global doc as object
sub LockerCheck
dim args(1) as new com.sun.star.beans.PropertyValue
doc = ThisComponent
args(0).Name = "xInstance"
args(0).Value = doc
args(1).Name = "nActions"
args(1).Value = 1 'com.sun.star.embed.PREVENT_CLOSE
psm = GetProcessServiceManager()
lck =
psm.createInstanceWithArguments("com.sun.star.embed.Ins
tanceLocker", args())
if NOT IsNull(lck) then lck.dispose()
end sub
</BASIC>
the answer is not 42 but a messagebox saying:
css.lang.IllegalArgumentException
Nonempty reference is expected as the first argument!
In parallel to the IDE there is only one writer doc opened
for filling
"ThisComponent" with something useful.
What's going wrong here?
TIA,
Marc
------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribe api.openoffice.org
For additional commands, e-mail: dev-help api.openoffice.org
|
|
| Re: instantiating InstanceLocker from
BASIC |

|
2007-10-06 16:45:16 |
Hello Marc,
Alle 14:50, sabato 6 ottobre 2007, Marc Santhoff ha
scritto:
> Hi,
>
> when running this macro:
>
> <BASIC>
> global doc as object
>
> sub LockerCheck
> dim args(1) as new com.sun.star.beans.PropertyValue
>
> doc = ThisComponent
> args(0).Name = "xInstance"
> args(0).Value = doc
> args(1).Name = "nActions"
> args(1).Value = 1 'com.sun.star.embed.PREVENT_CLOSE
> psm = GetProcessServiceManager()
> lck =
psm.createInstanceWithArguments("com.sun.star.embed.Ins
tanceLocker",
> args()) if NOT IsNull(lck) then lck.dispose()
> end sub
> </BASIC>
>
> the answer is not 42 but a messagebox saying:
>
> css.lang.IllegalArgumentException
> Nonempty reference is expected as the first
argument!
>
> In parallel to the IDE there is only one writer doc
opened for filling
> "ThisComponent" with something useful.
>
> What's going wrong here?
>
It seems that the problem is in the way in which you are
passing arguments.
I've tried in this way:
sub LockerCheck
doc = ThisComponent
psm = GetProcessServiceManager()
args() = Array(doc, 3)
lck = _
psm.createInstanceWithArguments("com.sun.star.embed.Ins
tanceLocker", args())
end sub
No error are raised in this case, and I'm quite sure that
arguments are
correctly processed .....but I've got some crashes :-(
It seems that there are further problems, please check.
BTW what are you trying to achieve with this code? (I'm
curious
ciao
Paolo M
------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribe api.openoffice.org
For additional commands, e-mail: dev-help api.openoffice.org
|
|
| Re: instantiating InstanceLocker from
BASIC |

|
2007-10-07 05:20:56 |
Hi Paolo,
you're right, stupid error since the argument is sequence of
any.
I tried here and had the office hang repeatedly on win98, so
there in
deed must be something wrong.
Am Samstag, den 06.10.2007, 23:45 +0200 schrieb Paolo
Mantovani:
> Hello Marc,
> It seems that the problem is in the way in which you
are passing arguments.
> I've tried in this way:
>
> sub LockerCheck
> doc = ThisComponent
> psm = GetProcessServiceManager()
> args() = Array(doc, 3)
I changed this to Array(doc, 1) to have the correct value
for closing
prevention.
> lck = _
>
psm.createInstanceWithArguments("com.sun.star.embed.Ins
tanceLocker", args())
> end sub
>
> No error are raised in this case, and I'm quite sure
that arguments are
> correctly processed .....but I've got some crashes :-(
> It seems that there are further problems, please
check.
Funny enough, with the original version having an array of
PropertyValues the InstanceLocker got created, I could
inpect it after
the exception ...
> BTW what are you trying to achieve with this code? (I'm
curious
I want to make sort of an "immutable" document
window. Noone should be
able to close it except my code.
Thanks,
Marc
------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribe api.openoffice.org
For additional commands, e-mail: dev-help api.openoffice.org
|
|
| Re: instantiating InstanceLocker from
BASIC |

|
2007-10-08 06:13:15 |
Hi again,
this time a crash report was generated. As last time there
was only one
writer doc open in parallel to the IDE. The code is:
sub testLocker
doc = ThisComponent
args() = Array(CreateUnoValue("any", doc),
CreateUnoValue("any", 1))
psm = GetProcessServiceManager()
lck =
psm.createInstanceWithArguments("com.sun.star.embed.Ins
tanceLocker", args())
msgbox "your doc is locked while this message is
shown"
lck.dispose()
end sub
But on the machine used there is no connection to the
outside. Whre
should I send it to, anyone interested?
A few lines:
<officeinfo:officeinfo xmlns:officeinfo="http://op
enoffice.org/2002/officeinfo"
build="680m5(Build:9221)"
platform="wntmsci10.pro" language=""
procpath="D:PROGRAMMEOPENOFFICE.ORG
2.3PROGRAM" exceptiontype="0xC0000005"
product="OpenOffice.org 2.3"/>
<systeminfo:systeminfo xmlns:systeminfo="http:
//openoffice.org/2002/systeminfo">
<systeminfo:System name="Windows"
version="4.10" build="67766446"
locale="0x00000407"/>
<systeminfo:CPU type="x86"/>
</systeminfo:systeminfo>
<errormail:Stack type="Win32">
<errormail:StackInfo pos="0"
ip="0x66788034" rel="0x00008034"
ordinal="uno_Environment_enter+0x0000096E"
name="CPPU3.DLL" path=""/>
<errormail:StackInfo pos="1"
ip="0x6678842B" rel="0x0000842B"
ordinal="uno_type_any_construct+0x0000001D"
name="CPPU3.DLL" path=""/>
<errormail:StackInfo pos="2"
ip="0x59B8113B" rel="0x0000113B"
ordinal="GetVersionInfo+0x0000013B"
name="COMPHELP4MSC.DLL" path=""/>
<errormail:StackInfo pos="3"
ip="0x59BC7E43" rel="0x00047E43"
ordinal="component_getFactory+0x000025CA"
name="COMPHELP4MSC.DLL" path=""/>
<errormail:StackInfo pos="4"
ip="0x5C9AD050" rel="0x0001D050"
ordinal="cppu::createSingleComponentFactory+0x00000BBA&
quot; name="CPPUHELPER3MSC.DLL"
path=""/>
<errormail:StackInfo pos="5"
ip="0x5C9AD185" rel="0x0001D185"
ordinal="cppu::createSingleComponentFactory+0x00000CEF&
quot; name="CPPUHELPER3MSC.DLL"
path=""/>
<errormail:StackInfo pos="6"
ip="0x5C9ADEE3" rel="0x0001DEE3"
ordinal="cppu::createSingleComponentFactory+0x00001A4D&
quot; name="CPPUHELPER3MSC.DLL"
path=""/>
<errormail:StackInfo pos="7"
ip="0x626063BD" rel="0x000063BD"
ordinal="component_getFactory+0x00004B06"
name="SERVICEMGR.UNO.DLL" path=""/>
<errormail:StackInfo pos="8"
ip="0x6260304D" rel="0x0000304D"
ordinal="component_getFactory+0x00001796"
name="SERVICEMGR.UNO.DLL" path=""/>
<errormail:StackInfo pos="9"
ip="0x63D61BCA" rel="0x00001BCA"
name="MSCI_UNO.DLL" path=""/>
<errormail:StackInfo pos="10"
ip="0x63D61EE4" rel="0x00001EE4"
name="MSCI_UNO.DLL" path=""/>
<errormail:StackInfo pos="11"
ip="0x63D622E2" rel="0x000022E2"
name="MSCI_UNO.DLL" path=""/>
<errormail:StackInfo pos="12"
ip="0x635F70FB" rel="0x000070FB"
ordinal="component_writeInfo+0x00004E40"
name="REFLECTION.UNO.DLL" path=""/>
Maybe this will help making a guess how I get the locking to
work ...
TIA,
Marc
------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribe api.openoffice.org
For additional commands, e-mail: dev-help api.openoffice.org
|
|
| Re: instantiating InstanceLocker from
BASIC |

|
2007-10-08 07:53:36 |
Hi Marc,
This is a bug, I have just submitted an issue to myself. It
is going to
be fixed in OOo2.4 currently. Please use the following link
to find the
issue.
http://www.openoffice.org/issues/show_bug.cgi?id=82393
Thanks,
Mikhail.
Marc Santhoff wrote:
> Hi again,
>
> this time a crash report was generated. As last time
there was only one
> writer doc open in parallel to the IDE. The code is:
>
> sub testLocker
> doc = ThisComponent
> args() = Array(CreateUnoValue("any", doc),
CreateUnoValue("any", 1))
> psm = GetProcessServiceManager()
> lck =
psm.createInstanceWithArguments("com.sun.star.embed.Ins
tanceLocker", args())
> msgbox "your doc is locked while this message is
shown"
> lck.dispose()
> end sub
>
> But on the machine used there is no connection to the
outside. Whre
> should I send it to, anyone interested?
>
> A few lines:
>
> <officeinfo:officeinfo xmlns:officeinfo="http://op
enoffice.org/2002/officeinfo"
build="680m5(Build:9221)"
platform="wntmsci10.pro" language=""
procpath="D:PROGRAMMEOPENOFFICE.ORG
2.3PROGRAM" exceptiontype="0xC0000005"
product="OpenOffice.org 2.3"/>
> <systeminfo:systeminfo xmlns:systeminfo="http:
//openoffice.org/2002/systeminfo">
> <systeminfo:System name="Windows"
version="4.10" build="67766446"
locale="0x00000407"/>
> <systeminfo:CPU type="x86"/>
> </systeminfo:systeminfo>
> <errormail:Stack type="Win32">
> <errormail:StackInfo pos="0"
ip="0x66788034" rel="0x00008034"
ordinal="uno_Environment_enter+0x0000096E"
name="CPPU3.DLL" path=""/>
> <errormail:StackInfo pos="1"
ip="0x6678842B" rel="0x0000842B"
ordinal="uno_type_any_construct+0x0000001D"
name="CPPU3.DLL" path=""/>
> <errormail:StackInfo pos="2"
ip="0x59B8113B" rel="0x0000113B"
ordinal="GetVersionInfo+0x0000013B"
name="COMPHELP4MSC.DLL" path=""/>
> <errormail:StackInfo pos="3"
ip="0x59BC7E43" rel="0x00047E43"
ordinal="component_getFactory+0x000025CA"
name="COMPHELP4MSC.DLL" path=""/>
> <errormail:StackInfo pos="4"
ip="0x5C9AD050" rel="0x0001D050"
ordinal="cppu::createSingleComponentFactory+0x00000BBA&
quot; name="CPPUHELPER3MSC.DLL"
path=""/>
> <errormail:StackInfo pos="5"
ip="0x5C9AD185" rel="0x0001D185"
ordinal="cppu::createSingleComponentFactory+0x00000CEF&
quot; name="CPPUHELPER3MSC.DLL"
path=""/>
> <errormail:StackInfo pos="6"
ip="0x5C9ADEE3" rel="0x0001DEE3"
ordinal="cppu::createSingleComponentFactory+0x00001A4D&
quot; name="CPPUHELPER3MSC.DLL"
path=""/>
> <errormail:StackInfo pos="7"
ip="0x626063BD" rel="0x000063BD"
ordinal="component_getFactory+0x00004B06"
name="SERVICEMGR.UNO.DLL" path=""/>
> <errormail:StackInfo pos="8"
ip="0x6260304D" rel="0x0000304D"
ordinal="component_getFactory+0x00001796"
name="SERVICEMGR.UNO.DLL" path=""/>
> <errormail:StackInfo pos="9"
ip="0x63D61BCA" rel="0x00001BCA"
name="MSCI_UNO.DLL" path=""/>
> <errormail:StackInfo pos="10"
ip="0x63D61EE4" rel="0x00001EE4"
name="MSCI_UNO.DLL" path=""/>
> <errormail:StackInfo pos="11"
ip="0x63D622E2" rel="0x000022E2"
name="MSCI_UNO.DLL" path=""/>
> <errormail:StackInfo pos="12"
ip="0x635F70FB" rel="0x000070FB"
ordinal="component_writeInfo+0x00004E40"
name="REFLECTION.UNO.DLL" path=""/>
>
> Maybe this will help making a guess how I get the
locking to work ...
>
> TIA,
> Marc
>
>
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: dev-unsubscribe api.openoffice.org
> For additional commands, e-mail: dev-help api.openoffice.org
>
------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribe api.openoffice.org
For additional commands, e-mail: dev-help api.openoffice.org
|
|
| Re: instantiating InstanceLocker from
BASIC |

|
2007-10-08 09:33:35 |
Hello Mikhail,
Am Montag, den 08.10.2007, 14:53 +0200 schrieb Mikhail
Voitenko:
> Hi Marc,
>
> This is a bug, I have just submitted an issue to
myself. It is going to
> be fixed in OOo2.4 currently. Please use the following
link to find the
> issue.
> http://www.openoffice.org/issues/show_bug.cgi?id=82393
Thanks for information and filing that one.
I read the issues text as "if all three parameters are
available it
should work". So I tried:
<BASIC>
global doc as object
global lck as object
sub testLocker
doc = ThisComponent
oCB = CreateUnoListener("my_",
"com.sun.star.embed.XActionsApproval")
args() = Array( CreateUnoValue("any", doc), _
CreateUnoValue("any", 1), _
oCB _
)
psm = GetProcessServiceManager()
lck =
psm.createInstanceWithArguments("com.sun.star.embed.Ins
tanceLocker", args())
end sub
function my_approveAction(nAction as long) as boolean
'msgbox "Ping!"
my_approveAction = FALSE
end function
sub ReleaseLock
if NOT IsNull(lck) then lck.dispose()
end sub
</BASIC>
And indeed the "Ping!" appeared, but after
clicking away this message
the writer doc was closed. Is there another error or did I
fail in
handing over the approve listening function?
(I did test returning TRUE in the listening callback to be
sure, no
change)
TIA,
Marc
------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribe api.openoffice.org
For additional commands, e-mail: dev-help api.openoffice.org
|
|
| Re: instantiating InstanceLocker from
BASIC |

|
2007-10-09 04:41:58 |
Hi Marc,
The approved action here is "prevent closing". So
if TRUE is returned,
the closing of the current document model should be
prevented.
But it looks like locking of the model does not prevent
closing of the
frame. Please try to register the InstanceLocker on the
frame.
Regards,
Mikhail.
Marc Santhoff wrote:
> Hello Mikhail,
>
> Am Montag, den 08.10.2007, 14:53 +0200 schrieb Mikhail
Voitenko:
>> Hi Marc,
>>
>> This is a bug, I have just submitted an issue to
myself. It is going to
>> be fixed in OOo2.4 currently. Please use the
following link to find the
>> issue.
>> http://www.openoffice.org/issues/show_bug.cgi?id=82393
>
> Thanks for information and filing that one.
>
> I read the issues text as "if all three parameters
are available it
> should work". So I tried:
>
> <BASIC>
> global doc as object
> global lck as object
>
> sub testLocker
> doc = ThisComponent
> oCB = CreateUnoListener("my_",
"com.sun.star.embed.XActionsApproval")
> args() = Array( CreateUnoValue("any", doc),
_
> CreateUnoValue("any", 1), _
> oCB _
> )
> psm = GetProcessServiceManager()
> lck =
psm.createInstanceWithArguments("com.sun.star.embed.Ins
tanceLocker", args())
> end sub
>
> function my_approveAction(nAction as long) as boolean
> 'msgbox "Ping!"
> my_approveAction = FALSE
> end function
>
> sub ReleaseLock
> if NOT IsNull(lck) then lck.dispose()
> end sub
> </BASIC>
>
> And indeed the "Ping!" appeared, but after
clicking away this message
> the writer doc was closed. Is there another error or
did I fail in
> handing over the approve listening function?
>
> (I did test returning TRUE in the listening callback to
be sure, no
> change)
>
> TIA,
> Marc
>
>
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: dev-unsubscribe api.openoffice.org
> For additional commands, e-mail: dev-help api.openoffice.org
>
------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribe api.openoffice.org
For additional commands, e-mail: dev-help api.openoffice.org
|
|
| Re: instantiating InstanceLocker from
BASIC |

|
2007-10-09 06:42:56 |
Hi Mikhail!
Yes, you're right. It was a matter of brain usage ... ;)
Am Dienstag, den 09.10.2007, 11:41 +0200 schrieb Mikhail
Voitenko:
> Hi Marc,
>
> The approved action here is "prevent
closing". So if TRUE is returned,
> the closing of the current document model should be
prevented.
And it is. That exactly was the cause of a hanging office
process after
the office was closed by me. I only didn't identify it
because I had
done some other things leaving a process active sometimes.
If don't do
this dangerous actions in parallel the process holding the
modell stays
in memory.
So holding a reference to a not closable model *does work*.
> But it looks like locking of the model does not prevent
closing of the
> frame. Please try to register the InstanceLocker on the
frame.
Yes, if I do exchange the model for the frame I does work as
expected,
the frame stays open as it should.
So this works, too.
Many thanks for helping out and waking me up,
Marc
> Regards,
> Mikhail.
>
> Marc Santhoff wrote:
> > Hello Mikhail,
> >
> > Am Montag, den 08.10.2007, 14:53 +0200 schrieb
Mikhail Voitenko:
> >> Hi Marc,
> >>
> >> This is a bug, I have just submitted an issue
to myself. It is going to
> >> be fixed in OOo2.4 currently. Please use the
following link to find the
> >> issue.
> >> http://www.openoffice.org/issues/show_bug.cgi?id=82393
> >
> > Thanks for information and filing that one.
> >
> > I read the issues text as "if all three
parameters are available it
> > should work". So I tried:
> >
> > <BASIC>
> > global doc as object
> > global lck as object
> >
> > sub testLocker
> > doc = ThisComponent
> > oCB = CreateUnoListener("my_",
"com.sun.star.embed.XActionsApproval")
> > args() = Array( CreateUnoValue("any",
doc), _
> > CreateUnoValue("any", 1), _
> > oCB _
> > )
> > psm = GetProcessServiceManager()
> > lck =
psm.createInstanceWithArguments("com.sun.star.embed.Ins
tanceLocker", args())
> > end sub
> >
> > function my_approveAction(nAction as long) as
boolean
> > 'msgbox "Ping!"
> > my_approveAction = FALSE
> > end function
> >
> > sub ReleaseLock
> > if NOT IsNull(lck) then lck.dispose()
> > end sub
> > </BASIC>
> >
> > And indeed the "Ping!" appeared, but
after clicking away this message
> > the writer doc was closed. Is there another error
or did I fail in
> > handing over the approve listening function?
> >
> > (I did test returning TRUE in the listening
callback to be sure, no
> > change)
> >
> > TIA,
> > Marc
> >
> >
> >
------------------------------------------------------------
---------
> > To unsubscribe, e-mail: dev-unsubscribe api.openoffice.org
> > For additional commands, e-mail: dev-help api.openoffice.org
> >
>
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: dev-unsubscribe api.openoffice.org
> For additional commands, e-mail: dev-help api.openoffice.org
>
>
------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribe api.openoffice.org
For additional commands, e-mail: dev-help api.openoffice.org
|
|
[1-8]
|
|