openoffice-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Douglas Pitonyak <and...@pitonyak.org>
Subject Re: Codes
Date Sun, 23 Jun 2013 02:04:48 GMT

On 06/22/2013 04:46 PM, Toki Kantoor wrote:
> On 06/22/2013 05:17 PM, Dennis E. Hamilton wrote:
>> Being able to surface some UI ability to reveal the sources of the feature controls
that govern a point in the user-perceived document text may require both deep and wide modification
of current code.  That does not make the feature undesirable.  It makes it costly.  Even with
agreement among developers, there is the problem of enrolling open-source developers to investigate
and introduce it.  And it won't happen by unilateral contribution alone.  There must be serious
testing and other work to ensure that nothing is destabilized.
> Set up stylist to display _applied_ _character_ styles.
> setup the formatting bar, to display the current paragraph style name,
> along with some of the more commonly changed parameters.
>
> That setup will provide more useful information about what is going with
> the styles one is using, than the "reveal codes" extension that was
> created almost a decade ago.
>
> My guess is that that will provide the functional equivalent of "reveal
> codes" as used in WP.
>
> jonathon
I think that this is already done using the existing RevealsCodes macro. 
The irony is that the existing macro will not help a WP user in they way 
that they expect unless all formatting changes are hard-coded rather 
than style based. As an example, when I use the existing RevealCodes 
macro (well, my modified version that does not crash), it shows me where 
styles stop and start. It does not show me, however, which of those 
styles causes a particular character to be bold. One might argue 
(validly I think) that if the text is not bold, a character style 
begins, and then the characters become bold, that they know the answer. 
Things are not as clear, however, if say a character style is in force 
for an entire paragraph so you do not know which forces the change.

For those of you that try to use RevealCodes2 and it fails, find the 
function named fnDirectProperties(oTextRange):


function fnDirectProperties(oTextRange)
dim oProperties as object, i as integer, nProperties as integer, 
nTypeClass as integer, sItem as string
dim j as integer, k as integer, vValue, oPropArray, nUbound as integer
dim emptyValue        'NEW LINE
oProperties = oTextRange.propertySetinfo.Properties
nProperties = uBound(oProperties)
dim m(nProperties)
j = 0
on error resume next  'NEW LINE
for i = 0 to nProperties
     if oTextRange.getPropertyState(oProperties(i).name) <> 
com.sun.star.beans.PropertyState.DEFAULT_VALUE and _
      ((oProperties(i).attributes and 
com.sun.star.beans.PropertyAttribute.READONLY) = 0) then
         nTypeClass = oProperties(i).type.typeClass
         sItem = oProperties(i).name
         select case nTypeClass
         case com.sun.star.uno.TypeClass.CHAR to 
com.sun.star.uno.TypeClass.STRING
             vValue = emptyValue       'NEW LINE
             vValue = oTextRange.getPropertyValue(sItem)

             if sItem = "NumberingStartValue" and vValue = -1 then     
'or sItem = "ParaStyleName" then
                 'skip it
             else
                 If NOT IsEmpty(vValue) Then         'NEW LINE
                 sItem = sItem & ": " & vValue
                 m(j) = sItem
                 j = j + 1
                 End If         'NEW LINE
             end if


Although I could make it work with fewer changes, this was faster to 
implement.

Ian Laurenson did a lot of cool stuff I think

http://homepages.paradise.net.nz/hillview/OOo/

-- 
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
Info:  http://www.pitonyak.org/oo.php


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@openoffice.apache.org
For additional commands, e-mail: users-help@openoffice.apache.org


Mime
View raw message