Skip to main content
Participating Frequently
April 1, 2010
Question

[CS4] Custom PageItem creating

  • April 1, 2010
  • 1 reply
  • 379 views

I want to create a line pageitem not using PathUtils.

In brief:


I created a command kNewPageItemCmdBoss and set up  INewPageItemCmdData for it:

createCommandData->Set(database, kMyOwnNewPageItemBoss, INewPageItemCmdData::kDefaultGraphicAttributes, parentUID, linePMPointList);

linePMPointList  defined, for example, as follows:

PMPointList listPoints;
            listPoints.push_back(PMPoint());
            listPoints.push_back(PMPoint(PMReal(150.0), PMReal(300.0)));

in *.fr
Class
{

     kMyOwnNewPageItemBoss,
     kSplineItemBoss,
    {
    }
}

As a result I get an object without width and height (point-like, invisible, but selectable) with the properly UID.

Question: Where and what to add that as a result to get the line?
There are several methods in the PathUtils (like CreateLineSpline, CreateOvalSpline, etc.), but all the difference is in the name of a method...

Most important is to create a line with a boss inherited from kSplineItemBoss, but CreateLineSpline method of  PathUtils does not allow a specific class except kSplineItemBoss...

Thanks a lot for help  in advance,
Viacheslav

This topic has been closed for replies.

1 reply

Participating Frequently
April 8, 2010

Problem solved.

All described above is correct.
Having UIDRef of new "custom line" incompletely formed pageitem it needs to take a pointer to its interface IPathGeometry and call  method MakeLinePath from IPathUtils.

As a result we get a line pageitem without kSplineItemBoss directly. SDK examples show  solutions only for graphic frames pageitems, where we can specify a different boss.