<table><tr><td style="">davidllewellynjones updated this revision to Diff 70039.<br />davidllewellynjones retitled this revision from "Allow non-conforming LibreOffice PPT files to be imported" to "Relax TextPFRun validation to allow LibreOffice PPT import".<br />davidllewellynjones edited the summary of this revision. <a href="https://phabricator.kde.org/transactions/detail/PHID-XACT-DREV-eazypk6xonpkcv4/">(Show Details)</a><br />davidllewellynjones edited the test plan for this revision. <a href="https://phabricator.kde.org/transactions/detail/PHID-XACT-DREV-nfnwvyn665xcuo6/">(Show Details)</a><br />davidllewellynjones added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D25256">View Revision</a></tr></table><br /><div><div><ul class="remarkup-list">
<li class="remarkup-list-item">SVN_SILENT made messages (.desktop file) - always resolve ours</li>
<li class="remarkup-list-item">SVN_SILENT made messages (.desktop file) - always resolve ours</li>
<li class="remarkup-list-item">SVN_SILENT made messages (.desktop file) - always resolve ours</li>
<li class="remarkup-list-item">Relax TextPFRun validation to allow LibreOffice PPT import</li>
</ul>

<ol class="remarkup-list">
<li class="remarkup-list-item">Updating <a href="https://phabricator.kde.org/D25256" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;">D25256</a>: Relax TextPFRun validation to allow LibreOffice PPT import #</li>
<li class="remarkup-list-item">Enter a brief description of the changes included in this update.</li>
<li class="remarkup-list-item">The first line is used as subject, next lines as comment. #</li>
<li class="remarkup-list-item">If you intended to create a new revision, use:</li>
<li class="remarkup-list-item">$ arc diff --create</li>
</ol>

<p>Align with binschema changes</p>

<p>This updates the diff to align with the changes accepted to binschema updating mso.xml. These changes are then used to generate the files here. This change also now includes the mso.jar binary file.</p></div></div><br /><div><strong>CHANGES TO REVISION SUMMARY</strong><div><div style="white-space: pre-wrap; color: #74777D;"><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">This change allows non-conforming LibreOffice PPT files to be imported.<br />
    <br />
</span>An apparent bug in the LibreOffice PPT exporter makes it output files<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);"> </span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);"><br />
</span>which technically don't conform to the PPT specification. Calligra<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);"> </span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);"><br />
</span>refuses to load these files, which although technically may be <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">the </span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">the<br />
</span>correct behaviour, is extremely annoying for the user. LibreOffice's<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);"> </span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);"><br />
</span>deviation from the PPT spec is pretty minor, and a slight weakening <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">of </span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">of<br />
</span>Calligra's validation allows the files to be imported successfully.<br />
<span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">    </span><br />
In more detail, when loading a drawing each text paragraph in <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">the </span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">the<br />
</span>drawing has a TextPFRun structure ("A structure that specifies <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">the </span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">the<br />
</span>paragraph-level formatting of a run of text"). This starts with a mask,<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);"> </span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);"><br />
</span>followed by a sequence of fields. Only unmasked fields are included <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">in </span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">in<br />
</span>the sequence.<br />
<span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">    </span><br />
According to Section 2.9.45 of the <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">[[ https://docs.microsoft.com/en-us/openspecs/office_file_formats/ms-ppt | </span>PPT specification version 6 <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">]</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">[1</span>], <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">the </span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">the<br />
</span>following fields must be masked out:<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);"><br />
<br />
```</span><br />
<span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">    <br />
</span>masks.leftMargin<div style="padding: 8px 0;">...</div>masks.tabStops<br />
<span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">    <br />
In spite of this LibreOffice includes the leftMargin and indent fields<br />
(flags 0x100 and 0x400). I'm not familiar with the LibreOffice codebase,</span><br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">```</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">but it looks like this is the problem code. From this same code it look</span><br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">In spite of this LibreOffice includes the `leftMargin` and `indent` fields (flags 0x100 and 0x400). I'm not familiar with the LibreOffice codebase, but it looks like [[ https://cgit.freedesktop.org/libreoffice/core/tree/sd/source/filter/eppt/epptso.cxx?id=85d947d52d27b4ade68a735e23bd393bced26046#n709 | this ]] is the problem code. From this same code it look </span>like LibreOffice doesn't export the <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">`</span>defaultTabSize<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">`</span> or <span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">`</span>tabStops<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">`</span> fields<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);"> </span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);"><br />
</span>(which is correct).<br />
<span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">    </span><br />
This patch loosens Calligra's validation to allow these flags to be set<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">. I've tested this with a bunch of files which previously failed to load, including quite complex ones, and they all seem to load fine once the patch is applied.<br />
<br />
A couple of important notes</span>.<br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">  # The validation code is generated by [[ https://github.com/KDE/binschema/ | binschema ]] and I'll submit a separate patch there.</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">It applies the change in binschema [2] for the same reason used to <br />
generate the Calligra parser files (see binschma commit</span><br />
<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);">  # The `calligra/filters/libmso/generated/mso.jar` file also needs to be updated to [[ http://www.flypig.co.uk/dnload/dnload/other/mso.jar | this version ]], but I couldn't see a way to include the binary file in with this patch. <br />
</span><span style="padding: 0 2px; color: #333333; background: rgba(151, 234, 151, .6);">aca4fd06f1ad330ecadf05b9e862d7c91338f051).<br />
<br />
[1] https://docs.microsoft.com/en-us/openspecs/office_file_formats/ms-ppt<br />
[2] https://phabricator.kde.org/source/binschema/</span></div></div></div><br /><div><strong>CHANGES TO TEST PLAN</strong><div><div style="white-space: pre-wrap; color: #74777D;"><div style="padding: 8px 0;">...</div>6. Note that it loads correctly. If you used my test file, witness my amazing presentation design.<span style="padding: 0 2px; color: #333333; background: rgba(251, 175, 175, .7);"><br />
</span></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R8 Calligra</div></div></div><br /><div><strong>CHANGES SINCE LAST UPDATE</strong><div><a href="https://phabricator.kde.org/D25256?vs=69581&id=70039">https://phabricator.kde.org/D25256?vs=69581&id=70039</a></div></div><br /><div><strong>BRANCH</strong><div><div>allow-libreoffice-ppt-validation (branched from master)</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D25256">https://phabricator.kde.org/D25256</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>filters/libmso/generated/mso.jar<br />
filters/libmso/generated/simpleParser.cpp<br />
filters/libmso/generated/simpleParser.h<br />
filters/words/rtf/import/3rdparty/rtf-qt/src/controlword.cpp<br />
karbon/templates/basic/empty.desktop<br />
libs/flake/KoSnapStrategy.cpp<br />
plugins/stencilsdocker/stencils/BPMN/Text-Annotation.desktop<br />
sheets/data/templates/HomeFamily/MenuPlan.desktop</div></div></div><br /><div><strong>To: </strong>davidllewellynjones, pvuorela, dcaliste<br /><strong>Cc: </strong>Calligra-Devel-list, davidllewellynjones, dcaliste, ognarb, cochise, vandenoever<br /></div>