[Libreoffice] [LibreOffice] [PATCH] [GSOC 2011] Hack: Store/Restore font dropdown MRU

Marco mrcekets at gmail.com
Thu Apr 14 10:07:16 PDT 2011

Hi all,
"Store/Restore font dropdown MRU" is the required hack I worked on.
I attached the related patch.

 From the Easy Hack web page:

Background: When you open a new document, use the font dropdown and select  
a number of different fonts then the 5 or so most recently used fonts are  
shown at the top of the list. But when you open a new document then the  
dropdown resets again. It would be nice to retain the MRU list when  
opening a new document, and also save and restore the MRU on exit and  
restart. Code for the dropdown is in svtools/source/control/ctrlbox.cxx,  
see vcl/unx/source/fontmanager.cxx and "m_aCacheFile" for a sample of the  
APIs to save/load from/to a file in the users config directories.

My work:
Now when you close a window where a FontNameBox control is provided
the most recent used (mru) entries for the font control are stored
in a file, the previous saved entry list is discarded; when a
document is opened or created the mru entry list of the FontNameBox
control is populated with the one saved in the file.

The file is saved under UserPath/config and is named
fontnameboxmruentries (is there a better place/name ?)

A possible enhancement could be to save the font name box mru entries
for the last 5/10 openened documents.
(How can I get the name of the current document/window ?)

While I was working on this hack I noticed that when two or more
documents are opened spurious resetting of the FontNameBox mru entry
list may happen, I did not get the cause of that, anyway as a
workaround I added a call to FontNameBox::GetMRUEntries at the begin
of the FontNameBox::Fill method and a call to FontNameBox::SetMRUEntries
to the end of the same method in this way even with spurious calls to
the FontNameBox::Fill method the font mru entries are preserved.


Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Hack-store-restore-font-name-box-mru-entrie-libs-gui.patch
Type: application/octet-stream
Size: 6855 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110414/41ea13f6/attachment-0001.obj>

More information about the LibreOffice mailing list