Investigation into bug 35862 - allow "increase/decrease font" for text selection with multiple font sizes

Michael Meeks michael.meeks at suse.com
Mon Mar 26 02:11:03 PDT 2012


Hi Jordan,

On Sat, 2012-03-24 at 14:06 -0700, Jordan Chin wrote:
> I began investigating this bug: 
> https://bugs.freedesktop.org/show_bug.cgi?id=35862

	Lovely ! :-)

> The bug is that the "Increase Font"/"Decrease Font" button should be 
> useable when one selects text of multiple sizes in Writer.

	Right, that'd be really useful.

> I tried to find where the button was being used and found that the 
> button for, for example, increasing the font size has an ID referenced
> as FN_GROW_FONT_SIZE. I put print statements for any references I found
> and was able to find the code that is executed when the button is clicked

	Great detective work so far :-)

> but I don't know what code activates/deactivates the actual 
> buttons. I suspect that since this functionality is available in Impress
> but not Writer (which is what the bug is about), there could be some clue
> if we consider where the code between Writer/Impress differs.

	Good thought.

> Currently I suspect the file svx/sdi/svx.sdi might have information, in 
> the definition of

	So here is the sdi for this method:

sw/sdi/_textsh.sdi:    FN_GROW_FONT_SIZE // status(final|play)
sw/sdi/_textsh.sdi-    [
sw/sdi/_textsh.sdi-        ExecMethod = ExecCharAttrArgs ;
sw/sdi/_textsh.sdi-        StateMethod = GetAttrState ;
sw/sdi/_textsh.sdi-
DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
sw/sdi/_textsh.sdi-    ]

	The 'StateMethod' is used to determine whether the button should be
enabled or disabled.

> As I am new to LibreOffice, I'm wondering if anyone has any ideas where 
> I can look next?

	So - poking at that 'GetAttrState' method we see:

sw/source/ui/shells/txtattr.cxx (SwTextShell::GetAttrState)
...
            case FN_GROW_FONT_SIZE:
            case FN_SHRINK_FONT_SIZE:
            {
                SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONTHEIGHT,
                                            *rSet.GetPool() );
                aSetItem.GetItemSet().Put( aCoreSet, sal_False );
                if( !aSetItem.GetItemOfScript( rSh.GetScriptType() ))
                    rSet.DisableItem( nSlot );
                nSlot = 0;
            }
            break;

	And - I suspect - that this rSet.DisableItem is what you're wanting to
avoid :-)

	Though - of course, I may be wildly wrong, I often am.

	Thanks for working on this, looking forward to seeing it in action.

	Having said that; I guess having the ability to do some nice font size
increase across a set of selected styles would be cool too ;-)

	All the best,

		Michael.

-- 
michael.meeks at suse.com  <><, Pseudo Engineer, itinerant idiot



More information about the LibreOffice mailing list