[solved] How to remove frame in SdrCustomShape during import from docx?

Regina Henschel rb.henschel at t-online.de
Tue Nov 29 15:23:48 UTC 2022


Hi Miklos,

Miklos Vajna schrieb am 29.11.2022 um 08:18:
> Hi Regina,
> 
> On Mon, Nov 28, 2022 at 08:19:26PM +0100, Regina Henschel <rb.henschel at t-online.de> wrote:
>> I will try this now. It seems to remove the frame:
>>
>> uno::Reference<beans::XPropertySet> xPropertySet(mxShape, uno::UNO_QUERY);
>> if (xPropertySet.is())
>> {
>>       uno::Reference<text::XTextFrame> xTextBoxContent(
>>           xPropertySet->getPropertyValue("TextBoxContent"), uno::UNO_QUERY);
>>       if (xTextBoxContent.is())
>>                  xTextBoxContent->dispose();
>> }
>>
>> I need to implement the conversion to Fontwork too to see if it really
>> works.
> 
> Can you try if set setPropertyValue("TextBox", false) works? I think
> that's meant to call SwTextBoxHelper::destroy() internally, and it would
> be simpler.

Indeed
	xPropertySet->setPropertyValue("TextBox", uno::Any(false));
works, whereas
	mpShapePtr->setTextBox(false);
doesn't work.

OK. That part is solved.

Next steps will be to copy the paragraphs from the frame to the shape 
and to copy the character fill and outline values to shape fill and stroke.

BTW, we should consider to remove the frame too in case the shape is 
rotated and the text content is so simple, that it does not need a frame.

Kind regards,
Regina


More information about the LibreOffice mailing list