Protect size of individual items in a group

Hello!

I am using LibreOffice Draw 7.2.0.4.

I have two rectangles stacked on top of each other. The one on the top has it’s size protected and the one on the bottom doesn’t have any protection set.

I was expecting that when I group them together and then resize the group itself, then the rectangle on the top that has its size protected would not be resized, but this is not the case.

I want to achive a shape where I have two boxes stacked on top of each other: one acting as a header and one acting as body. When I resize this shape, I want the height of the header to stay the same and the body to be resized.

Is this supported today?

Maybe you need to use menu Shape - Group - Enter Group (F3),¹ select and resize the bottom rectagle, and Exit Group (Ctrl+F3).

¹ You can achieve the same by double clicking on the group to Enter Group, and double clicking outside the group to Exit Group.

Tested with LibreOffice 7.0.6.2 (x86); OS: Windows 6.1.

This is what I have beed doing actually and it is a pain point. It takes extra work to go in and out of the groups, and while you are in a group, selecting something else just doesn’t work, you have to exit the group first.

I was hoping there was a solution with better UX.

In fact, there is such a thing - custom shapes - that allows to define some sophisticated definitions e.g. what handles the shape has, and what happens when you use them … but creating such shapes is not trivial. I know that @Regina has created such objects - maybe she could suggest something?

(FTR: this is one recent post of @Regina about one custom shape at TDF blog.)

That is an interesting problem. I see three solutions:

  • Add a line into the custom shape, that has a fixed distance from the top.
  • Add a connector to the shape, that has a fixed distance from the top.
  • Use two custom shapes, one with fixed height for the header and a second with a fixed free area at the top.

You can see all three solutions in the attached file.
Collection of solutions.odg (15.9 KB)

In general there is no way to protect a shape from being resized, if the type of the shape allows resizing. So in the solutions the shapes themselves change their size, only that parts of it keep the height or distance from the top.

1 Like

The third option looks like exactly what I wanted! Thank you!

It is also similar to what I tried before I posted this question but I was not able to make the height fixed. Can you tell how you made the width or height of a shape fixed?

The drawing of a custom shape is build from a sequence of points. That aspect is similar to the paths of Bézier curves and polygons. But there is no UI to access the points directly. So when you want something beyond the predefined shapes, you need to edit the markup in the file or you need to write macros. I have edited the markup.

In general all point coordinates in a custom shape are relative to the shape width and height, which means you say “the x-coordinate of the point is 17% of the width of the shape”, for example.

The path in a custom shape has enhanced possibilities compared to Bèzier curves and polygons. You can not only determine a point directly by numbers, but you can use formula results too. And one of the ‘functions’ possible in a formula is ‘logheight’. It returns the current total height of the shape - not relative but as absolute value in thousandth of millimeter. My formula uses this function.

You can copy the shape into an empty Draw document and save it to the flat file format .fodg. Then you can open the file in an editor and you will see the markup. The part for the custom shape will be near the end of the document.

Older articles about creating own custom shapes are
Eisenberg, David: Custom Shapes in OpenOffice.org. 2005
http://books.evc-cit.info/books/odbook/custom_shapes_article.pdf

or my first start in Create a New Custom Shape in Source in File - Apache OpenOffice Wiki

Do you have deeper interest in this topic? Then we need to find a different way then using Ask. As mikekaganski already mentioned, creating own custom shapes is not trivial. You need some knowledge in XML markup and in geometry.

1 Like

Thanks for clearing that up. I was looking for a way to do it via the UI but it is okay if I have to edit the markup directly.

The examples you linked look like some sort of custom markup with some svg sprinkled in.

I am familiar with SVG. I’m using it for a charting library for web applications. The library programatically generates SVG markup based on data and a web browser renders it.

Can I assume that the “SVG-looking” bits follow the SVG specification?

It is near to SVG. Main differences: ODF has no relative commands and the set of possible commands is larger. You find the ODF specification in Open Document Format for Office Applications (OpenDocument) Version 1.3. Part 3: OpenDocument Schema. Relevant sections are 10.6 with a collection of internal links and section 19.145 about ‘enhanced-path’.

There exists in addition some commands, which LO has introduced to be more compatible with OOXML. That is the command G for drawing arcs by swing angle and commands H, I, J, K for lighten and darken fill color by blending with White and Black. In that case not ‘draw:enhanced-path’ but ‘drawooo:enhanced-path’ has to be used.

Tips to edit the file source are in https://wiki.documentfoundation.org/Documentation/ODF_Markup

1 Like