Bug 111731 - changing properties of inserted graphic-objects via macro (Basic) causes file store error
Summary: changing properties of inserted graphic-objects via macro (Basic) causes file...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.3.1.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: needsDevAdvice
Depends on:
Blocks: Macro
  Show dependency treegraph
 
Reported: 2017-08-12 15:51 UTC by Thomas Krumbein
Modified: 2022-12-22 11:15 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
error message during storing prozess (120.35 KB, image/png)
2017-08-12 15:51 UTC, Thomas Krumbein
Details
testfile with macro (69.99 KB, application/vnd.oasis.opendocument.text)
2017-08-12 15:52 UTC, Thomas Krumbein
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Krumbein 2017-08-12 15:51:09 UTC
Created attachment 135491 [details]
error message during storing prozess

situation:

You do have a writer document and insert a picture/graphic via UI (Icon or menu insert-> picture). 
- store that file.  

Everything is ok.

Now you manipulate the properties of ths graphic object via API - in ths case with basic macros. 

- I checked size, position and some others.

- works fine during processing and visible on screen (UI).

Try to store document afterwards it will cause a error message, that the "content.xml" can not be written. (see attaches pic 1).

You cannot store document - not even with "store as".

You can kill the document.... or delete the manipulated graphic. this takes away the error. 

Attached is a sample-file to show the behaviour:
Store the file on a local drive. Open it. accept Macros.

add same text or something. store the file  -> ok

select the graphic, run the macro. Pic ist reduced in size. 

now try to store the doc again.....


Included small macro just for test:

#######
Sub ChangeBildSize

  oDoc = thisComponent

  sName = oDoc.CurrentController.ViewCursor.textframe.name
  
'msgbox sName

  oObj = oDoc.GraphicObjects.getbyName(sName) 
REM Change size
  oSize = oObj.getSize()
  oSize.Height = oSize.Height/2
  oSize.Width = oSize.Width/2
  oObj.setSize(oSize)

End Sub
#######
Comment 1 Thomas Krumbein 2017-08-12 15:52:30 UTC
Created attachment 135492 [details]
testfile with macro
Comment 2 Thomas Krumbein 2017-08-12 16:46:54 UTC
Some more information:

problem causes in this line:

  sName = oDoc.CurrentController.ViewCursor.textframe.name

I do not know why, but this line removes the supported service "com.sun.star.text.TextGraphicObject" out of the graphic-object - and couses in the descripted problems.

Just removing this line and pass the name of the pic manually 

sName = "Bild1"

and all manipulations works fine inclusive storing. 

so, maybe it helps you?
Comment 3 Regina Henschel 2017-08-12 22:53:44 UTC
If the document is in this state it hangs in a loop while automatic saving and process needs to be killed.
Comment 4 Xisco Faulí 2018-10-19 12:17:35 UTC
Hi Thomas,
Some changes have been done to image handling in 6.1 version
Could you please try to reproduce it with the latest version of LibreOffice
from https://www.libreoffice.org/download/libreoffice-fresh/ ?
I have set the bug's status to 'NEEDINFO'. Please change it back to
'UNCONFIRMED' if the bug is still present in the latest version.
Comment 5 Thomas Krumbein 2018-10-25 06:11:31 UTC
Just tested with LibreOffice 6.1.0.3 (x64) on Windows 10 : 

Still the same behaviour. No change.

Status is set to UNCONFIRMED
Comment 6 Xisco Faulí 2019-04-30 08:41:59 UTC
Reproduced in

Version: 6.3.0.0.alpha0+
Build ID: f45f8d0c6eb1d5d28a92399b82d13c2894f06069
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); UI-Language: en-US
Calc: threaded

in previous versions

Version: 4.3.0.0.alpha1+
Build ID: c15927f20d4727c3b8de68497b6949e72f9e6e9e

LibreOffice 3.3.0 
OOO330m19 (Build:6)
tag libreoffice-3.3.0.4

it crashes at export time...

@Miklos, I thought you might be interested in this issue...
Comment 7 QA Administrators 2021-04-30 04:01:28 UTC Comment hidden (obsolete)
Comment 8 Andreas Heinisch 2022-12-22 11:15:32 UTC
In:
Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 73e062be1ff10e2dd889d9ec9c2d07b692077f62
CPU threads: 16; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-US
Calc: CL threaded

The following line does not work anymore:
sName = oDoc.CurrentController.ViewCursor.textframe.name