summaryrefslogtreecommitdiffstats
path: root/writerfilter
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2018-05-17 18:45:21 +0900
committerTomaž Vajngerl <quikee@gmail.com>2018-05-20 05:18:37 +0200
commit486d340423f28c94348efb807e3364bc94b18105 (patch)
treee478423cc19eaf331942d952d72be99fc641a922 /writerfilter
parentsvx: Avoid looking up system clock twice for current datetime (diff)
downloadcore-486d340423f28c94348efb807e3364bc94b18105.tar.gz
core-486d340423f28c94348efb807e3364bc94b18105.zip
tdf#117502 fix graphical bullets for OOXML and RTF
This change has multiple parts: - Move "BulletAsImage" test from ODT only to globalfilter and run it on ODT, DOC, DOCX, RTF formats and extend checks of the XGraphic used for the bullets and the size. - Check if GIF is animated as we need to know this in unloaded graphic or bullets aren't rendered correctly if we assume they are animated. - Use "Graphic" property in writerfilter to get the graphic from a XShape and not the "Bitmap" property which returns a Graphic as a MetaFile and not the original Graphic. - Make sure "GraphicBitmap" is filled with XBitmap and not with XGraphic. - Change "testFDO74215" to use the expected bullet size as it is in the original document. Looks like the initial bug was just asserting the bullet size is set to a value (non-zero). Change-Id: I6b151c0bf9f426669e07522f0fc699fbb652046b Reviewed-on: https://gerrit.libreoffice.org/54477 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/GraphicImport.hxx2
-rw-r--r--writerfilter/source/dmapper/NumberingManager.cxx28
-rw-r--r--writerfilter/source/dmapper/NumberingManager.hxx7
3 files changed, 19 insertions, 18 deletions
diff --git a/writerfilter/source/dmapper/GraphicImport.hxx b/writerfilter/source/dmapper/GraphicImport.hxx
index c0943ce1a4f4..92c8ea5100cf 100644
--- a/writerfilter/source/dmapper/GraphicImport.hxx
+++ b/writerfilter/source/dmapper/GraphicImport.hxx
@@ -24,6 +24,8 @@
#include "LoggedResources.hxx"
+#include <com/sun/star/graphic/XGraphic.hpp>
+
namespace com { namespace sun { namespace star {
namespace uno
{
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx
index c76c3824f70c..8e14b3a32dbc 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -34,6 +34,7 @@
#include <com/sun/star/text/PositionAndSpaceMode.hpp>
#include <com/sun/star/text/XChapterNumberingSupplier.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/awt/XBitmap.hpp>
#include <osl/diagnose.h>
#include <rtl/ustring.hxx>
@@ -242,7 +243,7 @@ uno::Sequence<beans::PropertyValue> ListLevel::GetLevelProperties(bool bDefaults
sal_Int16 nNumberFormat = ConversionHelper::ConvertNumberingType(m_nNFC);
if( m_nNFC >= 0)
{
- if (m_sGraphicBitmap.is())
+ if (m_xGraphicBitmap.is())
nNumberFormat = style::NumberingType::BITMAP;
else if (m_sBulletChar.isEmpty() && nNumberFormat != style::NumberingType::CHAR_SPECIAL)
// w:lvlText is empty, that means no numbering in Word.
@@ -269,9 +270,9 @@ uno::Sequence<beans::PropertyValue> ListLevel::GetLevelProperties(bool bDefaults
aNumberingProperties.push_back(lcl_makePropVal<sal_Unicode>(PROP_BULLET_CHAR, 0));
}
}
- if (m_sGraphicBitmap.is())
+ if (m_xGraphicBitmap.is())
{
- aNumberingProperties.push_back(lcl_makePropVal(PROP_GRAPHIC_BITMAP, m_sGraphicBitmap));
+ aNumberingProperties.push_back(lcl_makePropVal(PROP_GRAPHIC_BITMAP, m_xGraphicBitmap));
aNumberingProperties.push_back(lcl_makePropVal(PROP_GRAPHIC_SIZE, m_aGraphicSize));
}
}
@@ -883,19 +884,16 @@ void ListsManager::lcl_sprm( Sprm& rSprm )
uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY);
try
{
- uno::Any aAny = xPropertySet->getPropertyValue("GraphicBitmap");
+ uno::Any aAny = xPropertySet->getPropertyValue("Graphic");
if (aAny.has<uno::Reference<graphic::XGraphic>>() && pCurrentLevel)
- pCurrentLevel->SetGraphicBitmap(aAny.get<uno::Reference<graphic::XGraphic>>());
- }
- catch (const beans::UnknownPropertyException&)
- {}
-
- try
- {
- uno::Any aAny = xPropertySet->getPropertyValue("Bitmap");
- if (aAny.has<uno::Reference<graphic::XGraphic>>() && pCurrentLevel)
- pCurrentLevel->SetGraphicBitmap(aAny.get<uno::Reference<graphic::XGraphic>>());
-
+ {
+ auto xGraphic = aAny.get<uno::Reference<graphic::XGraphic>>();
+ if (xGraphic.is())
+ {
+ uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
+ pCurrentLevel->SetGraphicBitmap(xBitmap);
+ }
+ }
}
catch (const beans::UnknownPropertyException&)
{}
diff --git a/writerfilter/source/dmapper/NumberingManager.hxx b/writerfilter/source/dmapper/NumberingManager.hxx
index f93269b5b1f9..98e029d2188b 100644
--- a/writerfilter/source/dmapper/NumberingManager.hxx
+++ b/writerfilter/source/dmapper/NumberingManager.hxx
@@ -29,6 +29,7 @@
#include <com/sun/star/container/XIndexReplace.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/awt/XBitmap.hpp>
namespace writerfilter {
namespace dmapper {
@@ -47,7 +48,7 @@ class ListLevel : public PropertyMap
sal_Int16 m_nXChFollow; //LN_IXCHFOLLOW
OUString m_sBulletChar;
css::awt::Size m_aGraphicSize;
- css::uno::Reference<css::graphic::XGraphic> m_sGraphicBitmap;
+ css::uno::Reference<css::awt::XBitmap> m_xGraphicBitmap;
sal_Int32 m_nTabstop;
std::shared_ptr< StyleSheetEntry > m_pParaStyle;
bool m_outline;
@@ -71,8 +72,8 @@ public:
void SetBulletChar( const OUString& sValue ) { m_sBulletChar = sValue; };
void SetGraphicSize( const css::awt::Size& aValue ) { m_aGraphicSize = aValue; };
- void SetGraphicBitmap(css::uno::Reference<css::graphic::XGraphic> const& sValue)
- { m_sGraphicBitmap = sValue; }
+ void SetGraphicBitmap(css::uno::Reference<css::awt::XBitmap> const& xGraphicBitmap)
+ { m_xGraphicBitmap = xGraphicBitmap; }
void SetParaStyle( const std::shared_ptr< StyleSheetEntry >& pStyle );
// Getters