Setting data in Writer chart from Basic

Jan Rheinländer jrheinlaender at gmx.de
Sat Jan 30 12:45:44 PST 2016


Hi Fernand,

thanks for the ideas. Sadly nothing you or anybody else posted helped.
Finally I found this hack (here xChart has type Reference< XTextContent
> xChart):

  Reference < XEmbeddedObjectSupplier2 >xEOS2(xChart, UNO_QUERY_THROW);
  Reference < XEmbeddedObject >
xEmbObj(xEOS2->getExtendedControlOverEmbeddedObject());

  if (xEmbObj->getCurrentState() ==
com::sun::star::embed::EmbedStates::LOADED)
      xEmbObj->changeState( com::sun::star::embed::EmbedStates::RUNNING);
  if (xEmbObj->getCurrentState() ==
com::sun::star::embed::EmbedStates::RUNNING)
      xEmbObj->changeState(
com::sun::star::embed::EmbedStates::INPLACE_ACTIVE);
  if (xEmbObj->getCurrentState() ==
com::sun::star::embed::EmbedStates::INPLACE_ACTIVE)
      xEmbObj->changeState( com::sun::star::embed::EmbedStates::RUNNING);

which works on Windows. On Linux this works better:

  Reference < XEmbeddedObjectSupplier > xEOS(xChart, UNO_QUERY_THROW);
  Reference < ::com::sun::star::chart::XChartDocument >
cDoc(xEOS->getEmbeddedObject(), UNO_QUERY_THROW);

  Reference< XPropertySet > dProperties(cDoc->getDiagram(),
UNO_QUERY_THROW);
  Any type = dProperties->getPropertyValue(OU("SplineType"));
  dProperties->setPropertyValue(OU("SplineType"), makeAny(sal_uInt32(0)));
  dProperties->setPropertyValue(OU("SplineType"), makeAny(sal_uInt32(1)));
  dProperties->setPropertyValue(OU("SplineType"), type);

Regards,
    Jan



More information about the LibreOffice mailing list