From 8d29f3ab72ec91ab7fad55379a14afd41112532a Mon Sep 17 00:00:00 2001 From: Marco Cecchetti Date: Tue, 12 Jan 2021 15:29:44 +0100 Subject: filter: svg: when date/time field is edited directly in mp, is not shown If a date/time or footer text field in the master page is editede directly instead of being filled through the header/footer dialog, is not displayed by the js engine. Change-Id: I4a8aa3a6b5e9931ea0b997d611ce54e8481dbbcb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109175 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar --- filter/source/svg/presentation_engine.js | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'filter') diff --git a/filter/source/svg/presentation_engine.js b/filter/source/svg/presentation_engine.js index 3d82aac0eaab..4dd876defba9 100644 --- a/filter/source/svg/presentation_engine.js +++ b/filter/source/svg/presentation_engine.js @@ -5556,9 +5556,9 @@ PlaceholderShape.prototype.init = function() } } } - this.element = aTextFieldElement; this.textElement = aPlaceholderElement; } + this.element = aTextFieldElement; } }; @@ -5769,9 +5769,10 @@ MasterPageView.prototype.initTextFieldHandler = function( sClassName, aPlaceholderShapeSet, aTextFieldContentProviderSet, aDefsElement, aTextFieldHandlerSet, sMasterSlideId ) { + var sRefId = null; var aTextFieldHandler = null; - if( aPlaceholderShapeSet[sClassName] && - aPlaceholderShapeSet[sClassName].isValid() + var aPlaceholderShape = aPlaceholderShapeSet[sClassName]; + if( aPlaceholderShape && aPlaceholderShape.isValid() && aTextFieldContentProviderSet[sClassName] ) { var sTextFieldContentProviderId = aTextFieldContentProviderSet[sClassName].sId; @@ -5780,7 +5781,7 @@ MasterPageView.prototype.initTextFieldHandler = if ( !aTextFieldHandlerSet[ sMasterSlideId ][ sTextFieldContentProviderId ] ) { aTextFieldHandlerSet[ sMasterSlideId ][ sTextFieldContentProviderId ] = - new TextFieldHandler( aPlaceholderShapeSet[sClassName], + new TextFieldHandler( aPlaceholderShape, aTextFieldContentProviderSet[sClassName] ); aTextFieldHandler = aTextFieldHandlerSet[ sMasterSlideId ][ sTextFieldContentProviderId ]; aTextFieldHandler.update(); @@ -5790,13 +5791,22 @@ MasterPageView.prototype.initTextFieldHandler = { aTextFieldHandler = aTextFieldHandlerSet[ sMasterSlideId ][ sTextFieldContentProviderId ]; } + sRefId = aTextFieldHandler.sId; + } + else if( aPlaceholderShape && aPlaceholderShape.element && aPlaceholderShape.element.firstElementChild + && !aPlaceholderShape.textElement && !aTextFieldContentProviderSet[sClassName] ) + { + sRefId = aPlaceholderShape.element.firstElementChild.getAttribute('id'); + } + if( sRefId ) + { // We create a element referring to the cloned text field and // append it to the field group element. - var aTextFieldElement = document.createElementNS( NSS['svg'], 'use' ); - aTextFieldElement.setAttribute( 'class', sClassName ); - setNSAttribute( 'xlink', aTextFieldElement, - 'href', '#' + aTextFieldHandler.sId ); + var aTextFieldElement = document.createElementNS(NSS['svg'], 'use'); + aTextFieldElement.setAttribute('class', sClassName); + setNSAttribute('xlink', aTextFieldElement, + 'href', '#' + sRefId); // node linking this.aBackgroundObjectsElement.appendChild( aTextFieldElement ); } -- cgit v1.2.3