Trouble with SdrMeasureObj (dimension line)

Regina Henschel rb.henschel at t-online.de
Tue Dec 1 12:25:22 UTC 2020


Hi Miklos, hi all,

Regina Henschel schrieb am 20-Nov-20 um 11:46:
> Hi Miklos,
> 
> Miklos Vajna schrieb am 19-Nov-20 um 09:22:
>> Hi Regina,
>>
>> On Wed, Nov 18, 2020 at 11:56:01PM +0100, Regina Henschel 
>> <rb.henschel at t-online.de> wrote:
>>> Do you know examples for unit tests with "drag create" and for unit 
>>> tests
>>> with "create default objects"?
>>
>> I'm not sure we have such tests. But it does not seem too problematic to
>> create one. Here is how I would start:

> Good tip! I see use of a dispatcher in the call stack. That looks 
> promising.

The approach with dispatcher did not work. But after some days and 
several failed attempts I found a solution to create the default measure 
line:

    ScTabViewShell* pTabViewShell = pDocSh->GetBestViewShell(false);
    SfxRequest aReq(pTabViewShell->GetViewFrame(), SID_DRAW_MEASURELINE);
    aReq.SetModifier(8192); // Ctrl
    pTabViewShell->ExecDraw(aReq);

I had seen the magic number "8192" in uitest 
sw/qa/uitest/writer_tests7/tdf130629.py and in Visual Studio. There 
might be a "speaking" define, I don't know.

The shape is inserted and selected, so that you can manipulate it, 
changing the anchor for example. When you want to work on the sheet 
itself, hiding a column for example, you have to deactivate draw shell. 
That can be done with
    pTabViewShell->SetDrawShell(false);

Kind regards
Regina


More information about the LibreOffice mailing list