Difference between revisions of "Porting example"

From Apache OpenOffice Wiki
Jump to: navigation, search
(Step 1 Choose and object to port)
Line 1: Line 1:
 
=== Step 1 Choose an object to port ===
 
=== Step 1 Choose an object to port ===
I randomly picked the Filter object e.g. [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/com/sun/star/helper/calc/XFilter.idl XFilter] in the helperapi, then browsed the [http://api.openoffice.org/source/browse/api/helperapi/ helperapi] code. I find XFilter is implemented by [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/FilterImpl.java FilterImpl.java] but it expects to be initialised by an [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/com/sun/star/helper/calc/XAutoFilter.idl XAutoFilter] implementation [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/AutoFilterImpl.java object]
+
I randomly picked the Filter object e.g. [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/com/sun/star/helper/calc/XFilter.idl XFilter] in the helperapi, then browsed the [http://api.openoffice.org/source/browse/api/helperapi/ helperapi] code. I find XFilter is implemented by [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/FilterImpl.java FilterImpl.java] but it expects to be initialised by an [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/com/sun/star/helper/calc/XAutoFilter.idl XAutoFilter] implementation object [http://api.openoffice.org/source/browse/*checkout*/api/helperapi/impl/com/sun/star/helper/calc/AutoFilterImpl.java AutoFilterImpl]
  
 
so already we need to think about providing an implementation not only for XFilter but also for XAutoFilter
 
so already we need to think about providing an implementation not only for XFilter but also for XAutoFilter
Line 13: Line 13:
  
 
=== Step 2 Port the idl files ===
 
=== Step 2 Port the idl files ===
 +
It's worth taking a look at the [[idl]] section in the [[porting notes]]
 +
and examples of the ported idl files
 +
* [http://vba.openoffice.org/source/browse/*checkout*/vba/src/examples/port_helperapi/vbaapi-port/excel/XAutoFilter.idl XAutoFilter.idl]
 +
* [http://vba.openoffice.org/source/browse/*checkout*/vba/src/examples/port_helperapi/vbaapi-port/excel/XFilter.idl XFilter.idl]
 +
* [http://vba.openoffice.org/source/browse/*checkout*/vba/src/examples/port_helperapi/vbaapi-port/excel/XFilters.idl XFilters.idl]
 +
 +
also modifications to existing files
 +
* [http://vba.openoffice.org/source/browse/*checkout*/vba/src/examples/port_helperapi/vbaapi-port/excel/add-new-idl.diff makefile.mk] add new idl file
 +
* [http://vba.openoffice.org/source/browse/*checkout*/vba/src/examples/port_helperapi/vbaapi-port/excel/add-new-attribute.diff XWorksheet.idl] add new AutoFilter attribute

Revision as of 12:03, 23 February 2007

Step 1 Choose an object to port

I randomly picked the Filter object e.g. XFilter in the helperapi, then browsed the helperapi code. I find XFilter is implemented by FilterImpl.java but it expects to be initialised by an XAutoFilter implementation object AutoFilterImpl

so already we need to think about providing an implementation not only for XFilter but also for XAutoFilter

looking at XAutoFilter.idl we see that there is a Filters() attribute/method that returns a Collection of Filters, so additionally I now realise I also need an implementation of the XFilters object. The XAutoFilter implementation is the key object that the others are accessed/provided from. After some searching through the source code I find this is an attribute of the SheetImpl object

so, to summarize, after initially choosing one object to have a crack at porting, I find in fact I actually need to provide implementations for the following interfaces

  • XFilter
  • XAutoFilter
  • XFilters

and also I need to add a new attribute to return an XAutoFilter implementation

Step 2 Port the idl files

It's worth taking a look at the idl section in the porting notes and examples of the ported idl files

also modifications to existing files

Personal tools