Andrew Douglas Pitonyak さんは書きました:
> On 08/21/2010 05:08 AM, Thomas Blasejewicz wrote:
>
>> Andrew Douglas Pitonyak さんは書きました:
>>
>>> What do you mean by "Highlight"?
>>>
>>> Can you write a single macro to do this?
>>>
>> By "highlight" I mean applying a colored background to the selected text
>> (in the form of a fluorescent marker).
>> Naturally, that makes the text stand out.
>>
>>
> I have good news and bad news :-)
>
> There is a background attribute which contains the color for the
> background. You can grab the cursor and check to see if the background
> is set to your special background color (or if it is set to anything at
> all). Then, you can make your decision of what to do based on that
> (clear it or set it). There may be a few difficulties based on the
> complexity of your selection and things such as cursor position. For
> example, what happens if you select a range of text and only part of it
> has the background set and part does not? Also, if the cursor is
> positioned at the end of the text with the background, you may
> experience a different result than if it is at the front. I could ramble
> on, but, no reason at this point.
>
> As to how to find the macro, well, this depends on where you stored it
> in the first place. The macro may be stored in a single document, in
> which case it should only be available in a single document. It is most
> likely stored in the OOo Standard library.
>
> Use Tools > Macros > Organize Macros > OpenOffice.org Basic to open the
> OOo Macros dialog.
>
> In the left side of the screen, scroll to the top of the list labeled
> "Macro From". Expand "My Macros". There should be a Library named
> "Standard". I would look there first. Highlight a module (probably named
> "Module 1" and click Edit.
>
>
Below I copy the text from the two macros. Highlight first,
removehighlight next.
But, with your permission, this is not really about macros.
It is about keyboard customization.
Under Tools -> customize -> keyboard you can assign to keys of your
choice functions/attributes etc. of your choice.
THERE: Ctrl+Shift+P = superscript. Same key combination toggles
superscript ON/OFF.
This has been there from the beginning and is NOT MY doing.
All I want to do is assign this "function" = "turn the font background a
specific color"
to a key combination of my choice. Which will then turn this feature ON
and OFF.
THAT is the way it works in Word, Wordperfect and I suppose in other
software too, but there I usually do not need it,
so I cannot tell.
And since it DOES(!) work for superscript, I fail to see why it DOES NOT
work for "background color" elsewhere called "hightlight".
The latter one is a font attribute I can apply using the mouse = same as
superscript.
So, what is the difference between the one font attribute and the other???
If I could assign this font attribute to a key, I would not need any macros.
Below, a lot of text (macros) I do not understand.
************************************************
REM ***** BASIC *****
Sub Main
End Sub
sub savetoR
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(2) as new com.sun.star.beans.PropertyValue
args1(0).Name = "URL"
args1(0).Value = "file:///R:/TK%20dye%20patent.ods"
args1(1).Name = "FilterName"
args1(1).Value = "calc8"
args1(2).Name = "SelectionOnly"
args1(2).Value = true
dispatcher.executeDispatch(document, ".uno:SaveAs", "", 0, args1())
end sub
sub eckigklammer
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(1) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Symbols"
args1(0).Value = "["
args1(1).Name = "FontName"
args1(1).Value = "Verdana"
dispatcher.executeDispatch(document, ".uno:InsertSymbol", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(1) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Symbols"
args2(0).Value = "]"
args2(1).Name = "FontName"
args2(1).Value = "Verdana"
dispatcher.executeDispatch(document, ".uno:InsertSymbol", "", 0, args2())
end sub
sub highlight
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "BackColor"
args1(0).Value = 16776960
dispatcher.executeDispatch(document, ".uno:BackColor", "", 0, args1())
end sub
sub removehighlight
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "BackColor"
args1(0).Value = 16777215
dispatcher.executeDispatch(document, ".uno:BackColor", "", 0, args1())
end sub
sub applyhangindent
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "DesignerDialog"
args1(0).Value = true
dispatcher.executeDispatch(document, ".uno:DesignerDialog", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(1) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Template"
args2(0).Value = "hangindent"
args2(1).Name = "Family"
args2(1).Value = 2
dispatcher.executeDispatch(document, ".uno:StyleApply", "", 0, args2())
rem ----------------------------------------------------------------------
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "DesignerDialog"
args3(0).Value = false
dispatcher.executeDispatch(document, ".uno:DesignerDialog", "", 0, args3())
end sub
sub superscript
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(2) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Escapement.Escapement"
args1(0).Value = 101
args1(1).Name = "Escapement.Height"
args1(1).Value = 58
args1(2).Name = "Escapement.Auto"
args1(2).Value = true
dispatcher.executeDispatch(document, ".uno:Escapement", "", 0, args1())
end sub
sub subscript
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(2) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Escapement.Escapement"
args1(0).Value = -101
args1(1).Name = "Escapement.Height"
args1(1).Value = 58
args1(2).Name = "Escapement.Auto"
args1(2).Value = true
dispatcher.executeDispatch(document, ".uno:Escapement", "", 0, args1())
end sub
sub normscript
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(2) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Escapement.Escapement"
args1(0).Value = 0
args1(1).Name = "Escapement.Height"
args1(1).Value = 100
args1(2).Name = "Escapement.Auto"
args1(2).Value = false
dispatcher.executeDispatch(document, ".uno:Escapement", "", 0, args1())
end sub
REM ***** BASIC *****
Sub Main
End Sub
sub savetoR
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(2) as new com.sun.star.beans.PropertyValue
args1(0).Name = "URL"
args1(0).Value = "file:///R:/TK%20dye%20patent.ods"
args1(1).Name = "FilterName"
args1(1).Value = "calc8"
args1(2).Name = "SelectionOnly"
args1(2).Value = true
dispatcher.executeDispatch(document, ".uno:SaveAs", "", 0, args1())
end sub
sub eckigklammer
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(1) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Symbols"
args1(0).Value = "["
args1(1).Name = "FontName"
args1(1).Value = "Verdana"
dispatcher.executeDispatch(document, ".uno:InsertSymbol", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(1) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Symbols"
args2(0).Value = "]"
args2(1).Name = "FontName"
args2(1).Value = "Verdana"
dispatcher.executeDispatch(document, ".uno:InsertSymbol", "", 0, args2())
end sub
sub highlight
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "BackColor"
args1(0).Value = 16776960
dispatcher.executeDispatch(document, ".uno:BackColor", "", 0, args1())
end sub
sub removehighlight
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "BackColor"
args1(0).Value = 16777215
dispatcher.executeDispatch(document, ".uno:BackColor", "", 0, args1())
end sub
sub applyhangindent
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "DesignerDialog"
args1(0).Value = true
dispatcher.executeDispatch(document, ".uno:DesignerDialog", "", 0, args1())
rem ----------------------------------------------------------------------
dim args2(1) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Template"
args2(0).Value = "hangindent"
args2(1).Name = "Family"
args2(1).Value = 2
dispatcher.executeDispatch(document, ".uno:StyleApply", "", 0, args2())
rem ----------------------------------------------------------------------
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "DesignerDialog"
args3(0).Value = false
dispatcher.executeDispatch(document, ".uno:DesignerDialog", "", 0, args3())
end sub
sub superscript
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(2) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Escapement.Escapement"
args1(0).Value = 101
args1(1).Name = "Escapement.Height"
args1(1).Value = 58
args1(2).Name = "Escapement.Auto"
args1(2).Value = true
dispatcher.executeDispatch(document, ".uno:Escapement", "", 0, args1())
end sub
sub subscript
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(2) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Escapement.Escapement"
args1(0).Value = -101
args1(1).Name = "Escapement.Height"
args1(1).Value = 58
args1(2).Name = "Escapement.Auto"
args1(2).Value = true
dispatcher.executeDispatch(document, ".uno:Escapement", "", 0, args1())
end sub
sub normscript
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(2) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Escapement.Escapement"
args1(0).Value = 0
args1(1).Name = "Escapement.Height"
args1(1).Value = 100
args1(2).Name = "Escapement.Auto"
args1(2).Value = false
dispatcher.executeDispatch(document, ".uno:Escapement", "", 0, args1())
end sub
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]