Re: GOffice components



Le mardi 09 mai 2006 �3:07 +0200, Robert Staudinger a �it :
> On 5/9/06, Jean Br�rt <jean brefort normalesup org> wrote:
> > Le mardi 09 mai 2006 �1:37 +0200, Robert Staudinger a �it :
> > > Hi Jean,
> > >
> > > On 3/12/06, Jean Br�rt <jean brefort normalesup org> wrote:
> > > [...]
> > > > Here is the relevant part of the API (still very unstable):
> > > >
> > > > * retrieving general information:
> > > >
> > > >
> > > > GSList *go_components_get_mime_types (void);
> > > >
> > > > Gets the list of mime types supported by at least one plugin
> > > >
> > > >
> > > > GOMimePriority go_components_get_priority (char const *mime_type);
> > > >
> > > > Gets the level of support. The returned value is one of the following:
> > > > GO_MIME_PRIORITY_INVALID: an error occurred (this should never happen)
> > > > GO_MIME_PRIORITY_DISPLAY: the component can just display the contents.
> > > > GO_MIME_PRIORITY_PRINT: the component can display and print the
> > > > contents.
> > > > GO_MIME_PRIORITY_PARTIAL: there is some editing capacity, but not all
> > > > features are supported.
> > > > GO_MIME_PRIORITY_FULL: full editing support.
> > > > GO_MIME_PRIORITY_NATIVE: the same as above, but the plugin is provided
> > > > by the application which is associated with the mime type.
> > > [...]
> > >
> > > A minor nitpick of course, but is _PRINT really a subset of _PARTIAL
> > > and a superset of _DISPLAY, especially for non-native apps? Sure, the
> > > (gtk/gnome) world is moving towards cairo and the gtk printing
> > > support, hmm.
> >
> > With _PRINT, you cannot edit or create a new embedded object. PARTIAL
> > has some support for that.
> 
> Hmm, assume i'd be thinking about a rich text component based on
> gecko. It's basically a gtk widget (maybe could be made to draw on a
> GdkWindow provided by the hosting application).
> Would such a component be possible with the current (and planned goffice)?
> What about expose events, would i have to trigger expose in the
> draw_cairo() function?

There is also an alternative approach using the GtkPlug/GtkSocket, but
it is not the best approach IMHO (I might be wrong, of course). Editing
the contents of an object should occur in a separate window (to avoid
the ui-merge nightmare).
You do not need to care about expose events in the plugin. The client
application must take care of drawing events and, eventually, call the
appropriate component method.

> What about printing? It's possible to create postscript output of a
> document, but anything more advanced (e.g. rendering a part of a page
> for embedding) seems hard.

Not so a problem, you can attach properties to an embedded object. For
the gnumeric case, the component has five properties (although a string
as "Sheet1!A1:E10" would work too, so this might change before the first
release of this code):

  g_object_class_install_property (obj_klass, COMPONENT_PROP_START_ROW,
    g_param_spec_int ("gnm-start-row", _("Start row"),
      _("First displayed row"),
      0, SHEET_MAX_ROWS - 1, 0,
      G_PARAM_READWRITE | GOC_PARAM_PERSISTENT));
  g_object_class_install_property (obj_klass, COMPONENT_PROP_END_ROW,
    g_param_spec_int ("gnm-end-row", _("End row"),
      _("Last displayed row"),
      0, SHEET_MAX_ROWS - 1, 9,
      G_PARAM_READWRITE | GOC_PARAM_PERSISTENT));
  g_object_class_install_property (obj_klass, COMPONENT_PROP_START_COL,
    g_param_spec_int ("gnm-start-col", _("Start column"),
      _("First displayed column"),
      0, SHEET_MAX_COLS - 1, 0,
      G_PARAM_READWRITE | GOC_PARAM_PERSISTENT));
  g_object_class_install_property (obj_klass, COMPONENT_PROP_END_COL,
    g_param_spec_int ("gnm-end-col", _("End column"),
      _("Last displayed column"),
      0, SHEET_MAX_COLS - 1, 4,
      G_PARAM_READWRITE | GOC_PARAM_PERSISTENT));
  g_object_class_install_property (obj_klass, COMPONENT_PROP_END_COL,
    g_param_spec_int ("gnm-sheet", _("Sheet"),
      _("Index of displayed sheet"),
      0,  G_MAXINT32, 0,
      G_PARAM_READWRITE | GOC_PARAM_PERSISTENT));

With this, only the specified range is displayed and printed. The
GOC_PARAM_PERSISTENT flag tells the client application that it must save
these properties. This is already implemented in abigoffice.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]