Kaydet (Commit) dd70a1e3 authored tarafından Michael Stahl's avatar Michael Stahl

sw_redlinehide_3: convert SwAccessibleParagraph::_getRunAttributesImpl

There appears to be a bug here, in that the nIndex is an index into
the accessiblity string, but it was used without conversion as a
model position in SwPosition; let's try to fix that.

Change-Id: I7a43ceacfe59102577f39ab4b8fec3b495db345d
üst b38cec77
...@@ -1751,14 +1751,16 @@ void SwAccessibleParagraph::_getRunAttributesImpl( ...@@ -1751,14 +1751,16 @@ void SwAccessibleParagraph::_getRunAttributesImpl(
{ {
// create PaM for character at position <nIndex> // create PaM for character at position <nIndex>
std::unique_ptr<SwPaM> pPaM; std::unique_ptr<SwPaM> pPaM;
const TextFrameIndex nCorePos(GetPortionData().GetCoreViewPosition(nIndex));
SwTextFrame const*const pFrame(static_cast<SwTextFrame const*>(GetFrame()));
SwPosition const aModelPos(pFrame->MapViewToModelPos(nCorePos));
SwTextNode *const pTextNode(aModelPos.nNode.GetNode().GetTextNode());
{ {
const SwTextNode* pTextNode( GetTextNode() ); SwPosition const aEndPos(*pTextNode,
std::unique_ptr<SwPosition> pStartPos( new SwPosition( *pTextNode ) ); aModelPos.nContent.GetIndex() == pTextNode->Len()
pStartPos->nContent.Assign( const_cast<SwTextNode*>(pTextNode), nIndex ); ? pTextNode->Len() // ???
std::unique_ptr<SwPosition> pEndPos( new SwPosition( *pTextNode ) ); : aModelPos.nContent.GetIndex() + 1);
pEndPos->nContent.Assign( const_cast<SwTextNode*>(pTextNode), nIndex+1 ); pPaM.reset(new SwPaM(aModelPos, aEndPos));
pPaM.reset(new SwPaM( *pStartPos, *pEndPos ));
} }
// retrieve character attributes for the created PaM <pPaM> // retrieve character attributes for the created PaM <pPaM>
...@@ -1771,7 +1773,6 @@ void SwAccessibleParagraph::_getRunAttributesImpl( ...@@ -1771,7 +1773,6 @@ void SwAccessibleParagraph::_getRunAttributesImpl(
// SwXTextCursor::GetCursorAttr( *pPaM, aSet, sal_True, sal_True ); // SwXTextCursor::GetCursorAttr( *pPaM, aSet, sal_True, sal_True );
// get character attributes from automatic paragraph style and merge these into <aSet> // get character attributes from automatic paragraph style and merge these into <aSet>
{ {
const SwTextNode* pTextNode( GetTextNode() );
if ( pTextNode->HasSwAttrSet() ) if ( pTextNode->HasSwAttrSet() )
{ {
SfxItemSet aAutomaticParaStyleCharAttrs( pPaM->GetDoc()->GetAttrPool(), SfxItemSet aAutomaticParaStyleCharAttrs( pPaM->GetDoc()->GetAttrPool(),
......
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