tdf#166850 Apply converted style name to StyleRef field
As a result of e45f187870362ed4448f4a9fb96883b8431887fb the StyleRef field needs to use the modified style name with (suffix " (user)") The related JUnit test requires a German locale to detect the related issue. Otherwise there is no suffix that needs to be applied to the field. Change-Id: Iad4257568ad05900df63a6098ba81e926df701e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186150 Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de> Tested-by: Jenkins
This commit is contained in:
committed by
Thorsten Behrens
parent
6f5f479682
commit
80877c7dc4
Executable
+16
@@ -0,0 +1,16 @@
|
||||
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
|
||||
#*************************************************************************
|
||||
#
|
||||
# This file is part of the LibreOffice project.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
#*************************************************************************
|
||||
|
||||
$(eval $(call sw_ooxmlexport_test,26))
|
||||
|
||||
$(call gb_CppunitTest_get_target,sw_ooxmlexport26) : export LO_TEST_LOCALE=de
|
||||
|
||||
# vim: set noet sw=4 ts=4:
|
||||
@@ -103,6 +103,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\
|
||||
CppunitTest_sw_ooxmlexport23 \
|
||||
CppunitTest_sw_ooxmlexport24 \
|
||||
CppunitTest_sw_ooxmlexport25 \
|
||||
CppunitTest_sw_ooxmlexport26 \
|
||||
CppunitTest_sw_ooxmlexport_template \
|
||||
CppunitTest_sw_ooxmlfieldexport \
|
||||
CppunitTest_sw_ooxmllinks \
|
||||
|
||||
Binary file not shown.
Executable
+41
@@ -0,0 +1,41 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include <swmodeltestbase.hxx>
|
||||
|
||||
#include <IDocumentLayoutAccess.hxx>
|
||||
#include <wrtsh.hxx>
|
||||
|
||||
namespace
|
||||
{
|
||||
class Test : public SwModelTestBase
|
||||
{
|
||||
public:
|
||||
Test()
|
||||
: SwModelTestBase(u"/sw/qa/extras/ooxmlexport/data/"_ustr, u"Office Open XML Text"_ustr)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
//test requires German user interface otherwise it will not detect the issue
|
||||
CPPUNIT_TEST_FIXTURE(Test, testTdf166850)
|
||||
{
|
||||
createSwDoc("tdf166850.docx");
|
||||
SwDoc* pDoc = getSwDoc();
|
||||
SwViewShell* pViewShell = pDoc->getIDocumentLayoutAccess().GetCurrentViewShell();
|
||||
pViewShell->UpdateFields();
|
||||
xmlDocUniquePtr pXmlDoc = parseLayoutDump();
|
||||
assertXPath(pXmlDoc, "/root/page[2]/header/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion",
|
||||
"expand", u"Heading 1");
|
||||
}
|
||||
|
||||
} // end of anonymous namespace
|
||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
@@ -1103,19 +1103,22 @@ OUString StyleSheetTable::CloneTOCStyle(FontTablePtr const& rFontTable, StyleShe
|
||||
// the old converted name is what is applied to paragraphs
|
||||
m_pImpl->m_ClonedTOCStylesMap.emplace(pStyle->m_sConvertedStyleName, pClone->m_sConvertedStyleName);
|
||||
std::vector<StyleSheetEntryPtr> const styles{ pClone };
|
||||
ApplyStyleSheetsImpl(rFontTable, styles);
|
||||
std::vector<OUString> aRetStyleNames = ApplyStyleSheetsImpl(rFontTable, styles);
|
||||
pClone->m_sConvertedStyleName = aRetStyleNames[0];
|
||||
return pClone->m_sConvertedStyleName;
|
||||
}
|
||||
|
||||
void StyleSheetTable::ApplyStyleSheets( const FontTablePtr& rFontTable )
|
||||
{
|
||||
return ApplyStyleSheetsImpl(rFontTable, m_pImpl->m_aStyleSheetEntries);
|
||||
ApplyStyleSheetsImpl(rFontTable, m_pImpl->m_aStyleSheetEntries);
|
||||
}
|
||||
|
||||
void StyleSheetTable::ApplyStyleSheetsImpl(const FontTablePtr& rFontTable, std::vector<StyleSheetEntryPtr> const& rEntries)
|
||||
std::vector<OUString> StyleSheetTable::ApplyStyleSheetsImpl(const FontTablePtr& rFontTable, std::vector<StyleSheetEntryPtr> const& rEntries)
|
||||
{
|
||||
std::vector<OUString> aStyleUINames(rEntries.size());
|
||||
std::vector<OUString>::iterator aStyleUINamesIt = aStyleUINames.begin();
|
||||
if (!m_pImpl->m_xTextDocument)
|
||||
return;
|
||||
return aStyleUINames;
|
||||
try
|
||||
{
|
||||
rtl::Reference< SwXStyleFamilies > xStyleFamilies = m_pImpl->m_xTextDocument->getSwStyleFamilies();
|
||||
@@ -1131,6 +1134,7 @@ void StyleSheetTable::ApplyStyleSheetsImpl(const FontTablePtr& rFontTable, std::
|
||||
std::vector<beans::PropertyValue> aTableStylesVec;
|
||||
for (auto& pEntry : rEntries)
|
||||
{
|
||||
*aStyleUINamesIt = pEntry->m_sStyleName;
|
||||
if( pEntry->m_nStyleTypeCode == STYLE_TYPE_UNKNOWN && !pEntry->m_sStyleName.isEmpty() )
|
||||
pEntry->m_nStyleTypeCode = STYLE_TYPE_PARA; // unspecified style types are considered paragraph styles
|
||||
|
||||
@@ -1414,7 +1418,7 @@ void StyleSheetTable::ApplyStyleSheetsImpl(const FontTablePtr& rFontTable, std::
|
||||
aMissingParent.emplace_back( sParentStyle, xStyle );
|
||||
|
||||
xStyles->insertStyleByName( sConvertedStyleName, static_cast<SwXStyle*>(xStyle.get()) );
|
||||
|
||||
*aStyleUINamesIt = static_cast<SwXStyle*>(xStyle.get())->GetStyleUIName().toString();
|
||||
if (!m_pImpl->m_bIsNewDoc && bParaStyle)
|
||||
{
|
||||
// Remember the inserted style, which may or may not be referred during
|
||||
@@ -1443,6 +1447,7 @@ void StyleSheetTable::ApplyStyleSheetsImpl(const FontTablePtr& rFontTable, std::
|
||||
pEntry->m_pProperties->InsertProps( m_pImpl->m_pDefaultCharProps, /*bOverwrite=*/false );
|
||||
pEntry->m_pProperties->InsertProps( m_pImpl->m_pDefaultParaProps, /*bOverwrite=*/false );
|
||||
}
|
||||
++aStyleUINamesIt;
|
||||
}
|
||||
|
||||
// Update the styles that were created before their parents or next-styles
|
||||
@@ -1492,6 +1497,7 @@ void StyleSheetTable::ApplyStyleSheetsImpl(const FontTablePtr& rFontTable, std::
|
||||
{
|
||||
DBG_UNHANDLED_EXCEPTION("writerfilter", "Styles could not be imported completely");
|
||||
}
|
||||
return aStyleUINames;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ private:
|
||||
|
||||
void applyDefaults(bool bParaProperties);
|
||||
|
||||
void ApplyStyleSheetsImpl(const FontTablePtr& rFontTable, std::vector<StyleSheetEntryPtr> const& rEntries);
|
||||
std::vector<OUString> ApplyStyleSheetsImpl(const FontTablePtr& rFontTable, std::vector<StyleSheetEntryPtr> const& rEntries);
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user