User:Hanya/Distribute SymbolStyles by Extension

From Apache OpenOffice Wiki
< User:Hanya
Revision as of 13:35, 13 June 2012 by Hanya (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The content of this page is "not started" to implement as feature. Just a consideration and code reading.

A few style symbols are gone after 3.4.0, tango and crystal. But someone want to use it issued 119805 and new style symbol is requested to add in issue 119669. If style symbol can be distributed and installed by extension system, these issues can be solved.

Current implementation

The style symbol is packed in zip archive and placed under share/config, current default style is images.zip, named Galaxy. It has images used in the help content also.

The ImplImageTree class defined in vcl module is used to load images from the archive. It is lived as singleton in the office instance. In most case (not checked all situation), the singleton is used through static method vcl::ImageRepository::loadImage.

There are several styles and they are managed by numerical id defined in vcl/inc/vcl/settings.hxx. They are hard coded and thay can not be changed without recompilation. And the ids are used to hold current style.

There are brand specific images stored in $BRAND_BASE_DIR/program/edition/images.zip, $BRAND_BASE_DIR/share/config and $BRAND_BASE_DIR/share/config/images_brand.zip. It seems they are introduced to brand well the office by Sun. It seems they are not used anymore.

When an image is requested to load, the current style name is taken by Application::GetSettings().GetStyleSettings().GetCurrentSymbolsStyleName() call in vcl::ImageRepository::loadImage. And the image is loaded by its name.

MenuBarManager of framework module keeps current style id and it is used to check the changes of style. MenuBarManager uses framework::GetImageFromURL function to get image. The function uses image producer function pfunc_getImage and it is initialized in SfxApplication::GetOrCreate method in main/sfx2/source/appl/app.cxx. The real function named GetImage is defined in main/sfx2/source/appl/imagemgr.cxx. Its implementation uses XImageManager interface taken from configuration manager of the document. The imag manager is implemented in main/framework/source/uiconfiguration/imagemanagerimpl.cxx. Its wrapper is moduleimagemanager.cxx. The image is managed by ImageList class and each images are loaded by ImplImageTree class.

Configuration dialog shows list of symbols to choose one from them.

Propsed

Move definitions of style symbols to configuration like:

Schema:

 <group oor:name="SymbolStyle">
   <info>
     <desc>Installed style names.</desc>
   </info>
   <prop oor:name="Name" oor:type="xs:string">
     <info>
       <desc>User readable style name.</desc>
     </info>
     <value/>
   </prop>
   <prop oor:name="Path" oor:type="xs:string">
     <info>
       <desc>URL to zip archive containes symbol images.</desc>
     </info>
     <value/>
   </prop>
 </group>
 <set oor:name="SymbolStyles" oor:node-type="SymbolStyle">
   <info>
     <desc>Defined symbol styles.</desc>
   </info>
 </set>

Data:

   <node oor:name="SymbolStyles">
     <node oor:name="default" oor:op="replace">
       <prop oor:name="Name" oor:type="xs:string">
         <value xml:lang="en-US">Galaxy</value>
       </prop>
       <prop oor:name="Path" oor:type="xs:string">
         <value>$(insturl)/share/images.zip</value>
       </prop>
     </node>
     <node oor:name="hicontrast" oor:op="replace">
       <prop oor:name="Name" oor:type="xs:string">
         <value xml:lang="en-US">High Contrast</value>
       </prop>
       <prop oor:name="Path" oor:type="xs:string">
         <value>$(insturl)/share/images_hicontrast.zip</value>
       </prop>
     </node>
     <node oor:name="industrial" oor:op="replace">
       <prop oor:name="Name" oor:type="xs:string">
         <value xml:lang="en-US">Industrial</value>
       </prop>
       <prop oor:name="Path" oor:type="xs:string">
         <value>$(insturl)/share/images_industrial.zip</value>
       </prop>
     </node>
     <node oor:name="classic" oor:op="replace">
       <prop oor:name="Name" oor:type="xs:string">
         <value xml:lang="en-US">Classic</value>
       </prop>
       <prop oor:name="Path" oor:type="xs:string">
         <value>$(insturl)/share/images_classic.zip</value>
       </prop>
     </node>
   </node>

Internal name of symbol style is defined as node name and its localizable name is in Name property. Path property specifies path to the image archive.

The current style name is stored as its internal name in the configuration, /org.openoffice.Office.Common.Misc/SymbolStyle. The above change does not influence to it. But constraints of its property is not required anymore.

To hold current style would be changed from id to style name.

Additional Idea

Current style archive contains help images. Make them packed into another archive. When the help contents are shifted to wiki or static web pages (maybe on the local), image files can be distributed as separated images.

Personal tools