sw/qa/extras/ooxmlexport/ooxmlexport9.cxx       |   12 ++++++++++++
 writerfilter/source/dmapper/StyleSheetTable.cxx |   14 ++++++++++++++
 2 files changed, 26 insertions(+)

New commits:
commit 0f4038abcd3d5f93847f7f27ffbb990f6a19c4ba
Author: Justin Luth <justin_l...@sil.org>
Date:   Sat Jun 3 20:09:48 2017 +0300

    tdf#82173 writerfilter: copy Xnote Characters -> Xnote anchor
    
    In MSWord, Footnote Reference applies to both in-text and in-footnote
    formating of the reference number, while LO uses two.
    Convert into one style, and copy into the other style.
    
    Change-Id: I8cf731d5d1236c86fc1c82e798d8a459ca95d0ba
    Reviewed-on: https://gerrit.libreoffice.org/38374
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Justin Luth <justin_l...@sil.org>
    Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk>

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 2ad863161780..39af9d435af7 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -527,6 +527,10 @@ DECLARE_OOXMLEXPORT_TEST(testTdf82173_footnoteStyle, 
"tdf82173_footnoteStyle.doc
     uno::Reference<beans::XPropertySet> 
xPageStyle(getStyles("CharacterStyles")->getByName("Footnote Characters"), 
uno::UNO_QUERY);
     CPPUNIT_ASSERT_EQUAL( sal_Int32(58),       getProperty< sal_Int32 
>(xPageStyle, "CharEscapementHeight") );
     CPPUNIT_ASSERT_EQUAL( sal_Int32(0x00FF00), getProperty< sal_Int32 
>(xPageStyle, "CharColor") );
+
+    xPageStyle.set(getStyles("CharacterStyles")->getByName("Footnote anchor"), 
uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL( sal_Int32(58),       getProperty< sal_Int32 
>(xPageStyle, "CharEscapementHeight") );
+    CPPUNIT_ASSERT_EQUAL( sal_Int32(0x00FF00), getProperty< sal_Int32 
>(xPageStyle, "CharColor") );
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTdf82173_endnoteStyle, 
"tdf82173_endnoteStyle.docx")
@@ -538,6 +542,14 @@ DECLARE_OOXMLEXPORT_TEST(testTdf82173_endnoteStyle, 
"tdf82173_endnoteStyle.docx"
     // character properties were previously not assigned to the 
footnote/endnote in-text anchor.
     CPPUNIT_ASSERT_EQUAL( 24.0f, getProperty< float >(xEndnote->getAnchor(), 
"CharHeight") );
     CPPUNIT_ASSERT_EQUAL( sal_Int32(0xFF0000), getProperty< sal_Int32 
>(xEndnote->getAnchor(), "CharColor") );
+
+    uno::Reference<beans::XPropertySet> 
xPageStyle(getStyles("CharacterStyles")->getByName("Endnote Characters"), 
uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL( sal_Int32(58),       getProperty< sal_Int32 
>(xPageStyle, "CharEscapementHeight") );
+    CPPUNIT_ASSERT_EQUAL( sal_Int32(0xFF00FF), getProperty< sal_Int32 
>(xPageStyle, "CharColor") );
+
+    xPageStyle.set(getStyles("CharacterStyles")->getByName("Endnote anchor"), 
uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL( sal_Int32(58),       getProperty< sal_Int32 
>(xPageStyle, "CharEscapementHeight") );
+    CPPUNIT_ASSERT_EQUAL( sal_Int32(0xFF00FF), getProperty< sal_Int32 
>(xPageStyle, "CharColor") );
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTdf104162, "tdf104162.docx")
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx 
b/writerfilter/source/dmapper/StyleSheetTable.cxx
index dd90f543427b..53fb4c1b3d0c 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -1135,6 +1135,20 @@ void StyleSheetTable::ApplyStyleSheets( const 
FontTablePtr& rFontTable )
                         {
                             uno::Reference< beans::XMultiPropertySet > 
xMultiPropertySet( xStyle, uno::UNO_QUERY_THROW);
                             xMultiPropertySet->setPropertyValues( 
aSortedPropVals.getNames(), aSortedPropVals.getValues() );
+
+                            // Duplicate MSWord's single footnote reference 
into Footnote Characters and Footnote anchor
+                            if( 
pEntry->sStyleName.equalsIgnoreAsciiCase("footnote reference")
+                                || 
pEntry->sStyleName.equalsIgnoreAsciiCase("endnote reference") )
+                            {
+                                uno::Reference< style::XStyle > xCopyStyle;
+                                if( 
pEntry->sStyleName.equalsIgnoreAsciiCase("footnote reference") )
+                                    xStyles->getByName( "Footnote anchor" ) 
>>= xCopyStyle;
+                                else
+                                    xStyles->getByName( "Endnote anchor" ) >>= 
xCopyStyle;
+
+                                xMultiPropertySet.set( xCopyStyle, 
uno::UNO_QUERY_THROW);
+                                xMultiPropertySet->setPropertyValues( 
aSortedPropVals.getNames(), aSortedPropVals.getValues() );
+                            }
                         }
                         catch( const lang::WrappedTargetException& rWrapped)
                         {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to