ODF 1.3 and fancy-draw-fillstyles (was: Re: writing attribute style:background-transparency)

Michael Stahl mstahl at redhat.com
Fri Sep 23 13:00:56 UTC 2016


On 23.09.2016 00:40, Regina Henschel wrote:
> Hi Armin,
> 
> Armin Le Grand schrieb:
>> Hi Regina,
>>
>> tried, but could not create one (tried frames in SW, too).
>>
>> Might have to do with the change of SW FillStyle/Transparency attributes
>> to the full Draw ItemSet. These get written with the same attributes as
>> for draw objects, but before the change that attribute might have been
>> used. It would be loaded and converted at import, though.
>>
>> Thus, might be if you use an older version which had not that change and
>> insert a frame and set transparency, but no guarantees
> 
> Direct hit :)
> 
> AOO 3.4.1 writes a style:background-transparency for a Writer frame with 
> background color and transparency. LibreOffice 5.3 writes 
> style:background-transparency too, but in addition it writes draw:fill, 
> draw:fill-color and draw:opacity.
> 
> LibreOffice writes draw:fill, draw:fill-color and draw:opacity too in 
> style:page-layout-properties, however there without 
> style:background-transparency. But for draw:fill, draw:fill-color and 
> draw:opacity it is the same problem as for 
> style:background-transparency: It is not allowed in 
> style:page-layout-properties.

i wasn't aware of this problem, so <style:page-layout-properties>
appears to have the same issue as <style:paragraph-properties>, which we
discuss below.

> So my conclusion is, that a transparent property for page background is 
> indeed needed. But I would suggest not to extend the 
> style:background-transparency, but the draw:xyz attributes, because they 
> are richer and already used in LibreOffice.

thanks for bringing up this topic, it reminded me of something on my
todo-list...

unfortunately ODF has 2 sets of attributes for "backgrounds", i'm
calling them the "writer-legacy-backgrounds" and the
"fancy-draw-fillstyles" - this is presumably a result of the 2 different
implementations from StarOffice.

it turns out that the "fancy-draw-fillstyles" are more expressive than
the "writer-legacy-backgrounds", so Armin refactored Writer to use these
natively, and only create the "writer-legacy-backgrounds" as an
emulation in the UNO API for backwards compatibility and to export them
to ODF.

the ODF 1.2 <style:paragraph-properties> element allows for only the
"writer-legacy-backgrounds" attributes, but the
<style:graphics-properties> element allows both sets of attributes.

obviously the "writer-legacy-backgrounds" were never produced by
anything other than Writer.

the "writer-legacy-backgrounds" confusingly have 2 different attributes
for transparency, the "style:background-transparency" is applied if
there is a background color while there is a nested element like
<style:background-image draw:opacity="75%"> to apply transparency to an
image.

now the problem is that current LO Writer will produce the
"fancy-draw-fillstyles" also for paragraph styles (and the UI is based
around them too) but it's not allowed in ODF 1.2 so we write foreign
<loext:graphic-properties> element.

so i guess in ODF 1.3 we either need to add the
<style:graphic-properties> to paragraph styles, or add the
"fancy-draw-fillstyles" attributes to <style:paragraph-properties>.

currently the <style:graphic-properties> has a lot of attributes:

> 17.21 <style:graphic-properties>
> 
> The <style:graphic-properties> element specifies formatting properties for chart, draw, graphic, and frame elements. 
> 
> The <style:graphic-properties> element is usable within the following elements: <style:default-style> 16.4 and <style:style> 16.2.
> 
> The <style:graphic-properties> element has the following attributes:
> dr3d:ambient-color 20.67,
> dr3d:backface-culling 20.69,
> dr3d:back-scale 20.68,
> dr3d:close-back 20.70,
> dr3d:close-front 20.71,
> dr3d:depth 20.72,
> dr3d:diffuse-color 20.73,
> dr3d:edge-rounding 20.74,
> dr3d:edge-rounding-mode 20.75,
> dr3d:emissive-color 20.76,
> dr3d:end-angle 20.77,
> dr3d:horizontal-segments 20.78,
> dr3d:lighting-mode 20.79,
> dr3d:normals-direction 20.80,
> dr3d:normals-kind 20.81,
> dr3d:shadow 20.82,
> dr3d:shininess 20.83,
> dr3d:specular-color 20.84,
> dr3d:texture-filter 20.85,
> dr3d:texture-generation-mode-x 20.88,
> dr3d:texture-generation-mode-y 20.89,
> dr3d:texture-kind 20.86,
> dr3d:texture-mode 20.87,
> dr3d:vertical-segments 20.90,
> draw:auto-grow-height 20.91,
> draw:auto-grow-width 20.92,
> draw:blue 20.94,
> draw:caption-angle 20.95,
> draw:caption-angle-type 20.96,
> draw:caption-escape 20.97,
> draw:caption-escape-direction 20.98,
> draw:caption-fit-line-length 20.99,
> draw:caption-gap 20.100,
> draw:caption-line-length 20.101,
> draw:caption-type 20.102,
> draw:color-inversion 20.103,
> draw:color-mode 20.104,
> draw:contrast 20.105,
> draw:decimal-places 20.106,
> draw:draw-aspect 20.107,
> draw:end-guide 20.108,
> draw:end-line-spacing-horizontal 20.109,
> draw:end-line-spacing-vertical 20.110,
> * draw:fill 20.111,
> * draw:fill-color 20.112,
> * draw:fill-gradient-name 20.113,
> * draw:fill-hatch-name 20.114,
> * draw:fill-hatch-solid 20.115,
> * draw:fill-image-height 20.116,
> * draw:fill-image-name 20.117,
> * draw:fill-image-ref-point 20.118,
> * draw:fill-image-ref-point-x 20.119,
> * draw:fill-image-ref-point-y 20.120,
> * draw:fill-image-width 20.121,
> draw:fit-to-contour 20.122,
> draw:fit-to-size 20.123,
> draw:frame-display-border 20.124,
> draw:frame-display-scrollbar 20.126,
> draw:frame-margin-horizontal 20.125,
> draw:frame-margin-vertical 20.127,
> draw:gamma 20.128,
> * draw:gradient-step-count 20.130,
> draw:green 20.129,
> draw:guide-distance 20.131,
> draw:guide-overhang 20.132,
> draw:image-opacity 20.133,
> draw:line-distance 20.134,
> draw:luminance 20.135,
> draw:marker-end 20.136,
> draw:marker-end-center 20.137,
> draw:marker-end-width 20.138,
> draw:marker-start 20.139,
> draw:marker-start-center 20.140,
> draw:marker-start-width 20.141,
> draw:measure-align 20.142,
> draw:measure-vertical-align 20.143,
> draw:ole-draw-aspect 20.144,
> * draw:opacity 20.145,
> * draw:opacity-name 20.146,
> draw:parallel 20.147,
> draw:placing 20.148,
> draw:red 20.149,
> * draw:secondary-fill-color 20.150,
> draw:shadow 20.151,
> draw:shadow-color 20.152,
> draw:shadow-offset-x 20.153,
> draw:shadow-offset-y 20.154,
> draw:shadow-opacity 20.155,
> draw:show-unit 20.156,
> draw:start-guide 20.157,
> draw:start-line-spacing-horizontal 20.158,
> draw:start-line-spacing-vertical 20.159,
> draw:stroke 20.160,
> draw:stroke-dash 20.161,
> draw:stroke-dash-names 20.162,
> draw:stroke-linejoin 20.163,
> draw:symbol-color 20.165,
> draw:textarea-horizontal-align 20.166,
> draw:textarea-vertical-align 20.167,
> * draw:tile-repeat-offset 20.168,
> draw:unit 20.173,
> draw:visible-area-height 20.169,
> draw:visible-area-left 20.170,
> draw:visible-area-top 20.171,
> draw:visible-area-width 20.172,
> draw:wrap-influence-on-position 20.174,
> fo:background-color 20.175,
> fo:border 20.176.2,
> fo:border-bottom 20.176.3,
> fo:border-left 20.176.4,
> fo:border-right 20.176.5,
> fo:border-top 20.176.6,
> fo:clip 20.179,
> fo:margin 20.198,
> fo:margin-bottom 20.199,
> fo:margin-left 20.200,
> fo:margin-right 20.201,
> fo:margin-top 20.202,
> fo:max-height 20.203,
> fo:max-width 20.204,
> fo:min-height 20.205.1,
> fo:min-width 20.206,
> fo:padding 20.210,
> fo:padding-bottom 20.211,
> fo:padding-left 20.212,
> fo:padding-right 20.213,
> fo:padding-top 20.214,
> fo:wrap-option 20.223,
> style:background-transparency 20.240,
> style:border-line-width 20.241,
> style:border-line-width-bottom 20.242,
> style:border-line-width-left 20.243,
> style:border-line-width-right 20.244,
> style:border-line-width-top 20.245,
> style:editable 20.257,
> style:flow-with-text 20.259,
> style:horizontal-pos 20.290,
> style:horizontal-rel 20.291,
> style:mirror 20.313,
> style:number-wrapped-paragraphs 20.318,
> style:overflow-behavior 20.319,
> style:print-content 20.323.2,
> style:protect 20.326.2,
> style:rel-height 20.331,
> style:rel-width 20.332.1,
> * style:repeat 20.333,
> style:run-through 20.343,
> style:shadow 20.349,
> style:shrink-to-fit 20.350,
> style:vertical-pos 20.387,
> style:vertical-rel 20.388,
> style:wrap 20.390,
> style:wrap-contour 20.391,
> style:wrap-contour-mode 20.392,
> style:wrap-dynamic-threshold 20.393,
> style:writing-mode 20.394.2,
> svg:fill-rule 20.396,
> svg:height 20.397.1,
> svg:stroke-color 20.398,
> svg:stroke-linecap 20.164,
> svg:stroke-opacity 20.399,
> svg:stroke-width 20.400,
> svg:width 20.403,
> svg:x 20.401,
> svg:y 20.402.1,
> text:anchor-page-number 20.407,
> text:anchor-type 20.408,
> text:animation 20.409,
> text:animation-delay 20.410,
> text:animation-direction 20.411,
> text:animation-repeat 20.412,
> text:animation-start-inside 20.413,
> text:animation-steps 20.414 and text:animation-stop-inside 20.415.
> 
> The <style:graphic-properties> element has the following child elements:
> <style:background-image> 17.3,
> <style:columns> 17.12 and <text:list-style> 16.30.

i've marked the ones we actually want on paragraphs with a "*".

FillProperties.idl also has "GraphicCrop" property corresponding to
"fo:clip" but it appears not to be implemented on paragraphs.

i notice that if i insert a text box drawing object it has additional
tabs Gradients, Hatching, Bitmap, Patterns with extra options, but
Format->Paragraph only has Area / Transparency.  is that features we
don't want to support, or just currently incomplete?

now the ODF 1.2 schema already contains this:

> 	<define name="style-graphic-fill-properties-attlist">
> 		<interleave>
> 			<optional>
> 				<attribute name="draw:fill">
> 					<choice>
> 						<value>none</value>
> 						<value>solid</value>
> 						<value>bitmap</value>
> 						<value>gradient</value>
> 						<value>hatch</value>
> 					</choice>
> 				</attribute>
> 			</optional>
> 			<optional>
> 				<attribute name="draw:fill-color">
> 					<ref name="color"/>
> 				</attribute>
> 			</optional>
> 			<optional>
> 				<attribute name="draw:secondary-fill-color">
> 					<ref name="color"/>
> 				</attribute>
> 			</optional>
> 			<optional>
> 				<attribute name="draw:fill-gradient-name">
> 					<ref name="styleNameRef"/>
> 				</attribute>
> 			</optional>
> 			<optional>
> 				<attribute name="draw:gradient-step-count">
> 					<ref name="nonNegativeInteger"/>
> 				</attribute>
> 			</optional>
> 			<optional>
> 				<attribute name="draw:fill-hatch-name">
> 					<ref name="styleNameRef"/>
> 				</attribute>
> 			</optional>
> 			<optional>
> 				<attribute name="draw:fill-hatch-solid">
> 					<ref name="boolean"/>
> 				</attribute>
> 			</optional>
> 			<optional>
> 				<attribute name="draw:fill-image-name">
> 					<ref name="styleNameRef"/>
> 				</attribute>
> 			</optional>
> 			<optional>
> 				<attribute name="style:repeat">
> 					<choice>
> 						<value>no-repeat</value>
> 						<value>repeat</value>
> 						<value>stretch</value>
> 					</choice>
> 				</attribute>
> 			</optional>
> 			<optional>
> 				<attribute name="draw:fill-image-width">
> 					<choice>
> 						<ref name="length"/>
> 						<ref name="percent"/>
> 					</choice>
> 				</attribute>
> 			</optional>
> 			<optional>
> 				<attribute name="draw:fill-image-height">
> 					<choice>
> 						<ref name="length"/>
> 						<ref name="percent"/>
> 					</choice>
> 				</attribute>
> 			</optional>
> 			<optional>
> 				<attribute name="draw:fill-image-ref-point-x">
> 					<ref name="percent"/>
> 				</attribute>
> 			</optional>
> 			<optional>
> 				<attribute name="draw:fill-image-ref-point-y">
> 					<ref name="percent"/>
> 				</attribute>
> 			</optional>
> 			<optional>
> 				<attribute name="draw:fill-image-ref-point">
> 					<choice>
> 						<value>top-left</value>
> 						<value>top</value>
> 						<value>top-right</value>
> 						<value>left</value>
> 						<value>center</value>
> 						<value>right</value>
> 						<value>bottom-left</value>
> 						<value>bottom</value>
> 						<value>bottom-right</value>
> 					</choice>
> 				</attribute>
> 			</optional>
> 			<optional>
> 				<attribute name="draw:tile-repeat-offset">
> 					<list>
> 						<ref name="zeroToHundredPercent"/>
> 						<choice>
> 							<value>horizontal</value>
> 							<value>vertical</value>
> 						</choice>
> 					</list>
> 				</attribute>
> 			</optional>
> 			<optional>
> 				<attribute name="draw:opacity">
> 					<ref name="zeroToHundredPercent"/>
> 				</attribute>
> 			</optional>
> 			<optional>
> 				<attribute name="draw:opacity-name">
> 					<ref name="styleNameRef"/>
> 				</attribute>
> 			</optional>
> 			<optional>
> 				<attribute name="svg:fill-rule">
> 					<choice>
> 						<value>nonzero</value>
> 						<value>evenodd</value>
> 					</choice>
> 				</attribute>
> 			</optional>
> 		</interleave>
> 	</define>

that's quite nice, all the attributes we need, plus an additional
"svg:fill-rule", not sure what that is.

so back to the <style:page-layout-properties>: indeed it doesn't allow
the "fancy-draw-fillstyles", and the current implementation in LO is
gratuitously different from the paragraph styles: for page layouts, the
attributes are added to <style:page-layout-properties>, or to
<style:header-footer-properties> for the header/footer, but for
paragraph styles there is a separate <loext:graphic-properties> element
for the attributes - some consistency would be nice.

... ok, was there anything i've missed?




More information about the LibreOffice mailing list