https://bugs.documentfoundation.org/show_bug.cgi?id=170738

Mateusz Wlazłowski <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |106876
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
                 OS|Windows (All)               |All
           Keywords|                            |needsUXEval

--- Comment #8 from Mateusz Wlazłowski <[email protected]> ---
Noticed that in previous versions "replace" wasn't leaving bold. I bibisected
with linux-x64-26.2 to 

commit 78ca6a8b55fbe557b1fde54aad4a393879c3d4ec
author Bojidar Marinov <[email protected]>
committer Mike Kaganski <[email protected]> 

tdf#77786 Replace format: Replace current found string and not next one


Move the check for an empty replacement string with replacement attributes from
SwView::ExecSearch (case REPLACE) to SwView::Replace.

Thanks to it, I found that "replace" and "replace all" behave differently with
attributes:
- "replace" keeps the old attributes and sets the new from the replace
attributes
(Find: Bold & Italic, Replace: No italic & "Red Highlight", Result: Bold & "Red
Highlight")
- "replace all" resets all attributes from find to default if they aren't
present in "replace all" and adds attributes from replace attributes
(Find: Bold & Italic, Replace: "Red Highlight", Result: "Red Highlight")


Setting to new based on different implementations of "replace" and "replace
all" leading to inconsistency. 



References:

- replace attributes of "replace all":
sw/source/core/crsr/findattr.cxx
    if( bReplaceAttr )
    {
        ...
        else
        {
            ...
            do
            {
                // reset all that are not set with pool defaults
                if( !IsInvalidItem( pItem ) && SfxItemState::SET !=
                    pReplSet->GetItemState( pItem->Which(), false ))
                    aSet.Put( pPool->GetUserOrPoolDefaultItem( pItem->Which()
));
                pItem = aIter.NextItem();
            } while (pItem);
            aSet.Put( *pReplSet );
            rCursor.GetDoc().getIDocumentContentOperations().InsertItemSet(
                    rCursor, aSet, SetAttrMode::DEFAULT, m_pLayout);
        }
        return FIND_NO_RING;
    }


- replace attributes of "replace":
sw/source/uibase/uiview/viewsrch.cxx


        if( bReqReplace )
        {
            ...
            // Replace attributes
            if( bReplaced && s_xReplaceList && s_xReplaceList->Count() &&
m_pWrtShell->HasSelection() )
            {
                SfxItemSet aReplSet( m_pWrtShell->GetAttrPool(),
                                     aTextFormatCollSetRange );
                if( s_xReplaceList->Get( aReplSet ).Count() )
                {
                    ::SfxToSwPageDescAttr( *m_pWrtShell, aReplSet );
                    m_pWrtShell->SwEditShell::SetAttrSet( aReplSet );
                }
             }


Referenced Bugs:

https://bugs.documentfoundation.org/show_bug.cgi?id=106876
[Bug 106876] [META] Find & Replace with styles
-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to