Clamp extrusion light level to allowed range for ODF
With import of shapes in 3D-mode from pptx files, the internal values for light level might be outside the range 0..100 and thus not allowed in ODF. These high levels are needed to get a similar rendering to MS Office. The export to ODF clamps them now to the allowed range. I do not intend to change the export to loext namespace, because the extrusion mode of custom shapes needs a totally new handling. But that will not be possible timely for version 24.8. Change-Id: I839903cbaf1b304c1e0c4374080963bc70352e61 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164948 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
This commit is contained in:
BIN
xmloff/qa/unit/data/Scene3d_LightRig_threePt.pptx
Normal file
BIN
xmloff/qa/unit/data/Scene3d_LightRig_threePt.pptx
Normal file
Binary file not shown.
@@ -810,6 +810,18 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTdf157018_ThemeImportDraw)
|
||||
CPPUNIT_ASSERT_EQUAL(Color(0x0A0A0A), pColorSet->getColor(model::ThemeColorType::Hyperlink));
|
||||
CPPUNIT_ASSERT_EQUAL(Color(0x440000), pColorSet->getColor(model::ThemeColorType::Accent1));
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_FIXTURE(XmloffDrawTest, test_scene3d_ooxml_light)
|
||||
{
|
||||
// The document has a shape in 3D mode. The import of ooxml light rigs can produce light
|
||||
// levels outside the 0..100 range allowed in ODF. Such high levels are needed for rendering
|
||||
// similar to MS Office.
|
||||
loadFromFile(u"Scene3d_LightRig_threePt.pptx");
|
||||
|
||||
// Without fix this would have failed with validation error.
|
||||
save("impress8");
|
||||
}
|
||||
|
||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
@@ -125,6 +125,7 @@
|
||||
#include <XMLBase64Export.hxx>
|
||||
#include <XMLImageMapExport.hxx>
|
||||
#include <memory>
|
||||
#include <algorithm>
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
using namespace ::xmloff::EnhancedCustomShapeToken;
|
||||
@@ -4523,6 +4524,8 @@ static void ImpExportEnhancedGeometry( SvXMLExport& rExport, const uno::Referenc
|
||||
double fExtrusionFirstLightLevel = 0;
|
||||
if ( rProp.Value >>= fExtrusionFirstLightLevel )
|
||||
{
|
||||
fExtrusionFirstLightLevel =
|
||||
std::clamp(fExtrusionFirstLightLevel, 0.0, 100.0);
|
||||
::sax::Converter::convertDouble(
|
||||
aStrBuffer,
|
||||
fExtrusionFirstLightLevel,
|
||||
@@ -4540,6 +4543,8 @@ static void ImpExportEnhancedGeometry( SvXMLExport& rExport, const uno::Referenc
|
||||
double fExtrusionSecondLightLevel = 0;
|
||||
if ( rProp.Value >>= fExtrusionSecondLightLevel )
|
||||
{
|
||||
fExtrusionSecondLightLevel =
|
||||
std::clamp(fExtrusionSecondLightLevel, 0.0, 100.0);
|
||||
::sax::Converter::convertDouble(
|
||||
aStrBuffer,
|
||||
fExtrusionSecondLightLevel,
|
||||
|
Reference in New Issue
Block a user