Re: [api-dev] Hiding buttons from a toolbar

2008-01-23 Thread Carsten Driesner

Marco Castillo schrieb:

Thank you Carsten for your kind reply. I don't want to make the changes 
persistant. I just need this changes to be done within the applet, and only in 
the applet. Could you send me some code snippets for this or show me a link 
where I can find them?

Again thank you in advance for your kind reply.


Hi Marco,

You can find the Basic macro code to set the "Save" button on the 
"Standardbar" invisible at the end of my answer. It's the non-persistent 
version. Just try it out. If you want to remove the button use 
removeByIndex() in the code below.


Regards,
Carsten

--

Sub Main
REM *** Initialize strings
sToolbar = "private:resource/toolbar/standardbar"
sCmdId   = ".uno:Save"

REM *** Retrieve the desktop service
oDesktop = createUnoService("com.sun.star.frame.Desktop")

REM *** Retrieve the current frame and layout manager
oCurrFrame = oDesktop.getCurrentFrame()
oLayoutManager = oCurrFrame.LayoutManager

REM *** Try to retrieve the toolbar from the layout manager
oToolbar = oLayoutManager.getElement( sToolbar )

REM *** Retrieve settings from toolbar ***
oToolbarSettings = oToolbar.getSettings( true )

index = -1
nCount = oToolbarSettings.getCount()
for i = 0 to nCount-1
oToolbarButton() = oToolbarSettings.getByIndex( i )
nToolbarButtonCount = ubound(oToolbarButton())
for j = 0 to nToolbarButtonCount
if oToolbarButton(j).Name = "CommandURL" then
if oToolbarButton(j).Value = sCmdId then
index = i
end if
endif
next j
next i

if index <> -1 then
REM *** Retrieve current Persistent state
REM *** from property
bPersistent = oToolbar.Persistent

REM *** To make our changes non-persistent
REM *** we have to set the Persistent property
REM *** to false
oToolbar.Persistent = false

REM *** Retrieve button settings
oButtonSettings = oToolbarSettings.getByIndex( index )

REM *** Change the visibility property of the button
for j = 0 to ubound(oButtonSettings())
if oButtonSettings(j).Name = "IsVisible" then
oButtonSettings(j).Value = FALSE
endif
next j

REM *** Replace button settings
oToolbarSettings.replaceByIndex( index, oButtonSettings )

REM *** Set new settings at our toolbar
oToolbar.setSettings( oToolbarSettings )

REM *** Reset Persistent property to old value
oToolbar.Persistent = bPersistent
 end if

End Sub

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] Bug in 2.4-dev / 680m2 ??

2008-01-23 Thread Frank Schönheit - Sun Microsystems Germany
Hi Cor,

> In 2.3.1 I can have the following line in the Basic IDE
>   oBTWAddress = ThisComponent.getCurrentSelection.getRangeAddress
> and run from there.
> 
> In 2.4-dev (690m2) it runs fine from Tools|Macro's|Run, but starting in 
> the IDE produces a run time error: Property or Method not found.
> Seems that ThisComponent is not recognized.

This is issue 85078, fixed in CWS "thiscomponent", integrated into OOH680m3.

Ciao
Frank

-- 
- Frank Schönheit, Software Engineer [EMAIL PROTECTED] -
- Sun Microsystems  http://www.sun.com/staroffice -
- OpenOffice.org Base   http://dba.openoffice.org -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[api-dev] Re: [framework-dev] Bug in 2.4-dev / 680m2 ??

2008-01-23 Thread Cor Nouws

Fridrich Strba wrote (23-1-2008 9:56)


Please check a milestone with the CWS thiscomponent integrated. That one
should have it fixed.


Thanks Fridirch. Good to read it has been fixed already. I'll check with 
the next download.


Cor


--

"The Year of 3" -2008- "Het jaar van 3"

Cor Nouws
Arnhem - Netherlands - nl.OpenOffice.org - marketing contact


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] Bug in 2.4-dev / 680m2 ??

2008-01-23 Thread Fernand Vanrie

Cor Nouws wrote:

Hi *,

Cross-posting for convenience ;-)

In 2.3.1 I can have the following line in the Basic IDE
oBTWAddress = ThisComponent.getCurrentSelection.getRangeAddress
and run from there.

In 2.4-dev (690m2) it runs fine from Tools|Macro's|Run, but starting 
in the IDE produces a run time error: Property or Method not found.

Seems that ThisComponent is not recognized.

hey Cor,

I am not sure but  i experiences already the same problem when only the 
IDE is open then there is no "thiscomponent" or thisComponent is the IDE ?


Fernand


Anything changed or a bug?

Regards,
Cor





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[api-dev] Bug in 2.4-dev / 680m2 ??

2008-01-23 Thread Cor Nouws

Hi *,

Cross-posting for convenience ;-)

In 2.3.1 I can have the following line in the Basic IDE
oBTWAddress = ThisComponent.getCurrentSelection.getRangeAddress
and run from there.

In 2.4-dev (690m2) it runs fine from Tools|Macro's|Run, but starting in 
the IDE produces a run time error: Property or Method not found.

Seems that ThisComponent is not recognized.

Anything changed or a bug?

Regards,
Cor


--

"The Year of 3" -2008- "Het jaar van 3"

Cor Nouws
Arnhem - Netherlands - nl.OpenOffice.org - marketing contact


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]