tdf#166191 character style properties only applied if repeated
Reset character properties that are not repated at run level also if
- the text run is in a table
- there is no style with the index 0 ('Normal')
Change-Id: I840178d727a157b628cb359e5c2798c1455cd555
Change-Id: Id04a501e156e33804e6b99b13688eef1cb899e6e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184277
Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
Tested-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
Tested-by: Jenkins
This commit is contained in:
committed by
Gabor Kelemen
parent
f5cca58c2e
commit
5268e13d39
+1
@@ -0,0 +1 @@
|
||||
,CIB/Olivers,twisterix2,16.04.2025 16:29,file:///D:/develop/LO/old_build/core-master/instdir;
|
||||
@@ -0,0 +1,7 @@
|
||||
{\rtf1
|
||||
{\stylesheet{\*\cs10 \additive \rtlch\fcs1
|
||||
\ab\af0\afs32 \ltrch\fcs0 \b\fs32\lang1031\langfe0\kerning32\loch\f31502\hich\af31502\dbch\af31501\langnp1031\langfenp0 \sbasedon10 \slink1 \slocked \spriority9 \'dcberschrift 1 Zchn;}}
|
||||
\pard Simple text \par
|
||||
\pard \cs10 Simple text with char style\par
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <swmodeltestbase.hxx>
|
||||
|
||||
#include <com/sun/star/awt/FontDescriptor.hpp>
|
||||
#include <com/sun/star/awt/FontWeight.hpp>
|
||||
#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
|
||||
#include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
|
||||
#include <com/sun/star/drawing/FillStyle.hpp>
|
||||
@@ -997,6 +998,15 @@ CPPUNIT_TEST_FIXTURE(Test, testColumnBreak)
|
||||
getProperty<style::BreakType>(getParagraph(2), u"BreakType"_ustr));
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_FIXTURE(Test, testTdf166191)
|
||||
{
|
||||
createSwDoc("tdf166191.rtf");
|
||||
//text of second paragraph should be in 12pt and not bold
|
||||
uno::Reference<text::XTextRange> textRun = getRun(getParagraph(2), 1);
|
||||
CPPUNIT_ASSERT_EQUAL(awt::FontWeight::NORMAL, getProperty<float>(textRun, u"CharWeight"_ustr));
|
||||
CPPUNIT_ASSERT_EQUAL(12.0f, getProperty<float>(textRun, u"CharHeight"_ustr));
|
||||
}
|
||||
|
||||
// tests should only be added to rtfIMPORT *if* they fail round-tripping in rtfEXPORT
|
||||
} // end of anonymous namespace
|
||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||
|
||||
@@ -513,7 +513,8 @@ static void lcl_copyFlatten(RTFReferenceProperties& rProps, RTFSprms& rStyleAttr
|
||||
}
|
||||
|
||||
writerfilter::Reference<Properties>::Pointer_t
|
||||
RTFDocumentImpl::getProperties(const RTFSprms& rAttributes, RTFSprms const& rSprms, Id nStyleType)
|
||||
RTFDocumentImpl::getProperties(const RTFSprms& rAttributes, RTFSprms const& rSprms, Id nStyleType,
|
||||
bool bReplay)
|
||||
{
|
||||
RTFSprms aSprms(rSprms);
|
||||
RTFValue::Pointer_t pAbstractList;
|
||||
@@ -539,12 +540,22 @@ RTFDocumentImpl::getProperties(const RTFSprms& rAttributes, RTFSprms const& rSpr
|
||||
auto it = m_aInvalidListTableFirstIndents.find(nAbstractListId);
|
||||
if (it != m_aInvalidListTableFirstIndents.end())
|
||||
aSprms.deduplicateList(it->second);
|
||||
aSprms.duplicateList(pAbstractList);
|
||||
}
|
||||
|
||||
int nStyle = 0;
|
||||
if (!m_aStates.empty())
|
||||
nStyle = m_aStates.top().getCurrentStyleIndex();
|
||||
auto it = m_pStyleTableEntries->find(nStyle);
|
||||
if (!nStyle && it == m_pStyleTableEntries->end())
|
||||
{
|
||||
RTFSprms aAttributes;
|
||||
writerfilter::Reference<Properties>::Pointer_t pProps(
|
||||
new RTFReferenceProperties(aAttributes));
|
||||
writerfilter::Reference<Properties>::Pointer_t const pProp(pProps);
|
||||
m_pStyleTableEntries->insert(std::make_pair(0, pProp));
|
||||
it = m_pStyleTableEntries->find(nStyle);
|
||||
}
|
||||
|
||||
if (it != m_pStyleTableEntries->end())
|
||||
{
|
||||
@@ -553,7 +564,29 @@ RTFDocumentImpl::getProperties(const RTFSprms& rAttributes, RTFSprms const& rSpr
|
||||
auto itChar = m_pStyleTableEntries->end();
|
||||
if (!m_aStates.empty())
|
||||
{
|
||||
int nCharStyle = m_aStates.top().getCurrentCharacterStyleIndex();
|
||||
int nCharStyle = -1;
|
||||
if (bReplay)
|
||||
{
|
||||
auto pCharStyleName = aSprms.find(NS_ooxml::LN_EG_RPrBase_rStyle);
|
||||
if (pCharStyleName)
|
||||
{
|
||||
for (auto& rCharStyle : *m_pStyleTableEntries)
|
||||
{
|
||||
RTFReferenceProperties& rCharStyleProps
|
||||
= *static_cast<RTFReferenceProperties*>(rCharStyle.second.get());
|
||||
auto rEntryStyleName
|
||||
= rCharStyleProps.getSprms().find(NS_ooxml::LN_CT_Style_name);
|
||||
if (rEntryStyleName
|
||||
&& pCharStyleName->getString() == rEntryStyleName->getString())
|
||||
{
|
||||
nCharStyle = rCharStyle.first;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
nCharStyle = m_aStates.top().getCurrentCharacterStyleIndex();
|
||||
itChar = m_pStyleTableEntries->find(nCharStyle);
|
||||
}
|
||||
|
||||
@@ -581,8 +614,6 @@ RTFDocumentImpl::getProperties(const RTFSprms& rAttributes, RTFSprms const& rSpr
|
||||
return new RTFReferenceProperties(std::move(attributes), std::move(sprms));
|
||||
}
|
||||
|
||||
if (pAbstractList)
|
||||
aSprms.duplicateList(pAbstractList);
|
||||
writerfilter::Reference<Properties>::Pointer_t pRet
|
||||
= new RTFReferenceProperties(rAttributes, std::move(aSprms));
|
||||
return pRet;
|
||||
@@ -1773,7 +1804,8 @@ void RTFDocumentImpl::replayBuffer(RTFBuffer_t& rBuffer, RTFSprms* const pSprms,
|
||||
writerfilter::Reference<Properties>::Pointer_t const pProp(getProperties(
|
||||
std::get<1>(aTuple)->getAttributes(), std::get<1>(aTuple)->getSprms(),
|
||||
std::get<0>(aTuple) == BUFFER_PROPS_CHAR ? NS_ooxml::LN_Value_ST_StyleType_character
|
||||
: 0));
|
||||
: 0,
|
||||
std::get<0>(aTuple) == BUFFER_PROPS_CHAR));
|
||||
Mapper().props(pProp);
|
||||
}
|
||||
else if (std::get<0>(aTuple) == BUFFER_NESTROW)
|
||||
|
||||
@@ -784,8 +784,10 @@ private:
|
||||
void runBreak();
|
||||
void parBreak();
|
||||
void tableBreak();
|
||||
writerfilter::Reference<Properties>::Pointer_t
|
||||
getProperties(const RTFSprms& rAttributes, RTFSprms const& rSprms, Id nStyleType);
|
||||
writerfilter::Reference<Properties>::Pointer_t getProperties(const RTFSprms& rAttributes,
|
||||
RTFSprms const& rSprms,
|
||||
Id nStyleType,
|
||||
bool bReplay = false);
|
||||
void checkNeedPap();
|
||||
void handleFontTableEntry();
|
||||
void sectBreak(bool bFinal = false);
|
||||
|
||||
Reference in New Issue
Block a user