Kaydet (Commit) b14259b9 authored tarafından Caolán McNamara's avatar Caolán McNamara

Resolves: rhbz#1193971 clear hard-coded char props in table cells...

like we do already for shapes. So now when attempting to set replacement char
properties on the entire cell, clear any hard-coded sub ranges within the
existing paragraphs.

This extends the effort of
commit a217f3cb
Author: Matúš Kukan <matus.kukan@collabora.com>
Date:   Tue Aug 26 10:16:34 2014 +0200

    bnc#770711: Make changing table text color in impress always work

to encompass all character properties, not just color

Change-Id: If8b426c3531b4678868d8351426db32c3c558650
üst 1f893617
...@@ -953,6 +953,26 @@ void SdrEditView::MergeAttrFromMarked(SfxItemSet& rAttr, bool bOnlyHardAttr) con ...@@ -953,6 +953,26 @@ void SdrEditView::MergeAttrFromMarked(SfxItemSet& rAttr, bool bOnlyHardAttr) con
} }
} }
std::vector<sal_uInt16> GetAllCharPropIds(const SfxItemSet& rSet)
{
std::vector<sal_uInt16> aCharWhichIds;
{
SfxItemIter aIter(rSet);
const SfxPoolItem* pItem=aIter.FirstItem();
while (pItem!=NULL)
{
if (!IsInvalidItem(pItem))
{
sal_uInt16 nWhich = pItem->Which();
if (nWhich>=EE_CHAR_START && nWhich<=EE_CHAR_END)
aCharWhichIds.push_back( nWhich );
}
pItem=aIter.NextItem();
}
}
return aCharWhichIds;
}
void SdrEditView::SetAttrToMarked(const SfxItemSet& rAttr, bool bReplaceAll) void SdrEditView::SetAttrToMarked(const SfxItemSet& rAttr, bool bReplaceAll)
{ {
if (AreObjectsMarked()) if (AreObjectsMarked())
...@@ -977,25 +997,11 @@ void SdrEditView::SetAttrToMarked(const SfxItemSet& rAttr, bool bReplaceAll) ...@@ -977,25 +997,11 @@ void SdrEditView::SetAttrToMarked(const SfxItemSet& rAttr, bool bReplaceAll)
} }
#endif #endif
// #103836# if the user thets character attributes to the complete shape, // #103836# if the user sets character attributes to the complete shape,
// we want to remove all hard set character attributes with same // we want to remove all hard set character attributes with same
// which ids from the text. We do that later but here we remember // which ids from the text. We do that later but here we remember
// all character attribute which id's that are set. // all character attribute which id's that are set.
std::vector<sal_uInt16> aCharWhichIds; std::vector<sal_uInt16> aCharWhichIds(GetAllCharPropIds(rAttr));
{
SfxItemIter aIter(rAttr);
const SfxPoolItem* pItem=aIter.FirstItem();
while( pItem!=NULL )
{
if (!IsInvalidItem(pItem))
{
sal_uInt16 nWhich = pItem->Which();
if (nWhich>=EE_CHAR_START && nWhich<=EE_CHAR_END)
aCharWhichIds.push_back( nWhich );
}
pItem=aIter.NextItem();
}
}
// To make Undo reconstruct text attributes correctly after Format.Standard // To make Undo reconstruct text attributes correctly after Format.Standard
bool bHasEEItems=SearchOutlinerItems(rAttr,bReplaceAll); bool bHasEEItems=SearchOutlinerItems(rAttr,bReplaceAll);
......
...@@ -139,6 +139,8 @@ SdrText* CellTextProvider::getText(sal_Int32 nIndex) const ...@@ -139,6 +139,8 @@ SdrText* CellTextProvider::getText(sal_Int32 nIndex) const
} }
extern std::vector<sal_uInt16> GetAllCharPropIds(const SfxItemSet& rSet);
namespace sdr namespace sdr
{ {
namespace properties namespace properties
...@@ -261,12 +263,21 @@ namespace sdr ...@@ -261,12 +263,21 @@ namespace sdr
sal_Int32 nParaCount(pOutliner->GetParagraphCount()); sal_Int32 nParaCount(pOutliner->GetParagraphCount());
// if the user sets character attributes to the complete
// cell we want to remove all hard set character attributes
// with same which ids from the text
std::vector<sal_uInt16> aCharWhichIds(GetAllCharPropIds(rSet));
for(sal_Int32 nPara = 0; nPara < nParaCount; nPara++) for(sal_Int32 nPara = 0; nPara < nParaCount; nPara++)
{ {
SfxItemSet aSet(pOutliner->GetParaAttribs(nPara)); SfxItemSet aSet(pOutliner->GetParaAttribs(nPara));
aSet.Put(rSet); aSet.Put(rSet);
if (aSet.GetItemState(EE_CHAR_COLOR, false) == SfxItemState::SET)
pOutliner->RemoveCharAttribs( nPara, EE_CHAR_COLOR ); for (std::vector<sal_uInt16>::const_iterator aI = aCharWhichIds.begin(); aI != aCharWhichIds.end(); ++aI)
{
pOutliner->RemoveCharAttribs(nPara, *aI);
}
pOutliner->SetParaAttribs(nPara, aSet); pOutliner->SetParaAttribs(nPara, aSet);
} }
......
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