Kaydet (Commit) 2c8010f6 authored tarafından Mark Hung's avatar Mark Hung Kaydeden (comit) Andras Timar

Fix tdf#77881,tdf#80520,tdf#89525 bulllets lost issue.

Replace bullet char before write out font description
since it may be altered if bullet font has been changed
(i.e. StarSymbol to WingDings ).

Change-Id: I0461cc0a5e4628b36177602bba7ed7f74a0751eb
Reviewed-on: https://gerrit.libreoffice.org/17376Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNorbert Thiebaud <nthiebaud@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/18318Reviewed-by: 's avatarMark Hung <marklh9@gmail.com>
üst 1df90368
...@@ -1746,10 +1746,14 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa ...@@ -1746,10 +1746,14 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa
mpFS->singleElementNS( XML_a, XML_buSzPct, mpFS->singleElementNS( XML_a, XML_buSzPct,
XML_val, IS( std::max( (sal_Int32)25000, std::min( (sal_Int32)400000, 1000*( (sal_Int32)nBulletRelSize ) ) ) ), FSEND ); XML_val, IS( std::max( (sal_Int32)25000, std::min( (sal_Int32)400000, 1000*( (sal_Int32)nBulletRelSize ) ) ) ), FSEND );
if( bHasFontDesc ) if( bHasFontDesc )
{
if ( SVX_NUM_CHAR_SPECIAL == nNumberingType )
aBulletChar = SubstituteBullet( aBulletChar, aFontDesc );
mpFS->singleElementNS( XML_a, XML_buFont, mpFS->singleElementNS( XML_a, XML_buFont,
XML_typeface, aFontDesc.Name.toUtf8().getStr(), XML_typeface, aFontDesc.Name.toUtf8().getStr(),
XML_charset, (aFontDesc.CharSet == awt::CharSet::SYMBOL) ? "2" : NULL, XML_charset, (aFontDesc.CharSet == awt::CharSet::SYMBOL) ? "2" : NULL,
FSEND ); FSEND );
}
OUString pAutoNumType = GetAutoNumType( nNumberingType, bSDot, bPBehind, bPBoth ); OUString pAutoNumType = GetAutoNumType( nNumberingType, bSDot, bPBehind, bPBoth );
...@@ -1762,7 +1766,6 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa ...@@ -1762,7 +1766,6 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa
} }
else else
{ {
aBulletChar = SubstituteBullet( aBulletChar, aFontDesc );
mpFS->singleElementNS(XML_a, XML_buChar, XML_char, USS( OUString( aBulletChar ) ), FSEND); mpFS->singleElementNS(XML_a, XML_buChar, XML_char, USS( OUString( aBulletChar ) ), FSEND);
} }
} }
......
...@@ -56,6 +56,7 @@ ...@@ -56,6 +56,7 @@
#include <com/sun/star/chart2/data/XDataSequence.hpp> #include <com/sun/star/chart2/data/XDataSequence.hpp>
#include <com/sun/star/chart2/data/XNumericalDataSequence.hpp> #include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
#include <com/sun/star/awt/XBitmap.hpp> #include <com/sun/star/awt/XBitmap.hpp>
#include <com/sun/star/awt/FontDescriptor.hpp>
#include <com/sun/star/graphic/XGraphic.hpp> #include <com/sun/star/graphic/XGraphic.hpp>
#include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/frame/XStorable.hpp>
#include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/drawing/FillStyle.hpp>
...@@ -100,6 +101,7 @@ public: ...@@ -100,6 +101,7 @@ public:
void testRightToLeftParaghraph(); void testRightToLeftParaghraph();
void testTableCellBorder(); void testTableCellBorder();
void testBulletColor(); void testBulletColor();
void testBulletCharAndFont();
void testBulletMarginAndIndentation(); void testBulletMarginAndIndentation();
void testParaMarginAndindentation(); void testParaMarginAndindentation();
...@@ -134,6 +136,7 @@ public: ...@@ -134,6 +136,7 @@ public:
CPPUNIT_TEST(testRightToLeftParaghraph); CPPUNIT_TEST(testRightToLeftParaghraph);
CPPUNIT_TEST(testTableCellBorder); CPPUNIT_TEST(testTableCellBorder);
CPPUNIT_TEST(testBulletColor); CPPUNIT_TEST(testBulletColor);
CPPUNIT_TEST(testBulletCharAndFont);
CPPUNIT_TEST(testBulletMarginAndIndentation); CPPUNIT_TEST(testBulletMarginAndIndentation);
CPPUNIT_TEST(testParaMarginAndindentation); CPPUNIT_TEST(testParaMarginAndindentation);
...@@ -937,6 +940,38 @@ void SdExportTest::testBulletColor() ...@@ -937,6 +940,38 @@ void SdExportTest::testBulletColor()
CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bullet's color is wrong!", sal_uInt32(0xff0000),pNumFmt->GetNumRule()->GetLevel(0).GetBulletColor().GetColor()); CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bullet's color is wrong!", sal_uInt32(0xff0000),pNumFmt->GetNumRule()->GetLevel(0).GetBulletColor().GetColor());
} }
void SdExportTest::testBulletCharAndFont()
{
::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/odp/bulletCharAndFont.odp"), ODP);
xDocShRef = saveAndReload( xDocShRef, PPTX );
uno::Reference< drawing::XDrawPagesSupplier > xDoc( xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
uno::Reference< drawing::XDrawPage > xPage( xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW );
uno::Reference< drawing::XShape > xShape(xPage->getByIndex(0), uno::UNO_QUERY);
uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY_THROW)->getText();
uno::Reference<container::XEnumerationAccess> paraEnumAccess;
paraEnumAccess.set(xText, uno::UNO_QUERY);
uno::Reference<container::XEnumeration> paraEnum = paraEnumAccess->createEnumeration();
uno::Reference<text::XTextRange> const xParagraph(paraEnum->nextElement(), uno::UNO_QUERY_THROW);
uno::Reference< beans::XPropertySet > xPropSet( xParagraph, uno::UNO_QUERY_THROW );
uno::Reference<container::XIndexAccess> xLevels(xPropSet->getPropertyValue("NumberingRules"), uno::UNO_QUERY);
uno::Sequence<beans::PropertyValue> aProps;
xLevels->getByIndex(0) >>= aProps; // 1st level
OUString sBulletChar(sal_Unicode(0xf06c));
for (int i = 0; i < aProps.getLength(); ++i)
{
const beans::PropertyValue& rProp = aProps[i];
if (rProp.Name == "BulletChar")
CPPUNIT_ASSERT_EQUAL_MESSAGE( "BulletChar incorrect.", sBulletChar ,rProp.Value.get<OUString>());
if (rProp.Name == "BulletFont")
{
awt::FontDescriptor aFontDescriptor;
rProp.Value >>= aFontDescriptor;
CPPUNIT_ASSERT_EQUAL_MESSAGE( "BulletFont incorrect.", OUString("Wingdings"),aFontDescriptor.Name);
}
}
xDocShRef->DoClose();
}
#if !defined WNT #if !defined WNT
void SdExportTest::testBnc822341() void SdExportTest::testBnc822341()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment