Bug 127169 - Auto-redaction doesn't cover the title completely
Summary: Auto-redaction doesn't cover the title completely
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.4.0.0.alpha1+
Hardware: All All
: medium normal
Assignee: Onur Yılmaz
URL:
Whiteboard: target:6.5.0
Keywords: difficultyInteresting, easyHack, skillCpp, topicDebug
Depends on:
Blocks: Redaction
  Show dependency treegraph
 
Reported: 2019-08-26 15:46 UTC by Aron Budea
Modified: 2020-01-28 08:35 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Input ODT (25.33 KB, application/vnd.oasis.opendocument.text)
2019-08-26 15:46 UTC, Aron Budea
Details
PDF output from redaction (28.01 KB, application/pdf)
2019-08-26 15:47 UTC, Aron Budea
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aron Budea 2019-08-26 15:46:15 UTC
Created attachment 153668 [details]
Input ODT

- Open the attached simple document.
- Open Tools -> Auto-Redact (you might have to add via Tools -> Customize before bug 127163's fix).
- Add a Target with type Text and Content "lorem".
- Add a Target with type Text and Content "ipsum".
- Press OK to start redaction.

=> Note how the title ("Lorem ipsum") isn't completely covered.

Observed using LO 6.4.0.0.alpha0+ (d3d13140f0036c53aa74820b41acfeffa3572168 ) / Windows 7.
Comment 1 Aron Budea 2019-08-26 15:47:40 UTC
Created attachment 153669 [details]
PDF output from redaction

Here's the PDF output from redaction (not the white/black one).
Comment 2 Xisco Faulí 2019-11-26 09:53:17 UTC
Hi Muhammet,
are you still working on this issue ?
Comment 3 Muhammet Kara 2019-11-26 11:48:53 UTC
(In reply to Xisco Faulí from comment #2)
> Hi Muhammet,
> are you still working on this issue ?

Busy with other work at the moment. Changing to new until I get the time to do it.

If someone likes to take it in the meantime, here are some dev notes / code pointers:

SfxRedactionHelper::searchInMetaFile() is the source of this issue. Especially this part:

// If found the string, add the corresponding rectangle to the collection
            while (bFound)
            {
                OutputDevice* pOutputDevice
                    = SfxObjectShell::GetShellFromComponent(xComponent)->GetDocumentRefDev();
                tools::Rectangle aNewRect(
                    ImplCalcActionBounds(*pMetaTextArrayAction, *pOutputDevice, nStart, nEnd));

                if (!aNewRect.IsEmpty())
                    aRedactionRectangles.push_back(aNewRect);

                // Search for the next occurence
                nStart = nEnd;
                nEnd = sText.getLength();
                bFound = textSearch.SearchForward(sText, &nStart, &nEnd);
            }


The problem is aNewRect, created by ImplCalcActionBounds does have the correct width, but incorrect height. So looking the ImplCalcActionBounds() method is what you actually need to fix.

The source file: sfx2/source/doc/SfxRedactionHelper.cxx
Header file: sfx2/inc/SfxRedactionHelper.hxx
Comment 4 Commit Notification 2020-01-28 07:36:42 UTC
Onur Yilmaz committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/0025b74e8099ed79e7824a8d22335e882e0c635c

tdf#127169: Auto-redaction doesn't cover the title completely

It will be available in 6.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.