Bug 171061 - Feature Request: Add a command to delete all snap lines at once in Draw
Summary: Feature Request: Add a command to delete all snap lines at once in Draw
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
25.8.4.2 release
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-02-27 11:29 UTC by Enrico Cora
Modified: 2026-03-03 13:49 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
SNAP LINES TO REMOVE MANUALLY IN DRAW (406.17 KB, image/png)
2026-02-27 11:33 UTC, Enrico Cora
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Enrico Cora 2026-02-27 11:29:32 UTC
Description:
Currently, LibreOffice Draw lacks a direct way to remove all snap lines (guides) simultaneously. Users must delete them one by one or use workarounds. I propose a new command (e.g., in the View or Edit menu) with the following logic:
Logic: The command should scan the current DrawPage to identify all active snap lines.
User Confirmation: To prevent accidental data loss, a pop-up dialog should appear asking: "Are you sure you want to delete all snap lines in this page?"
Execution: Upon confirmation, the software should permanently remove all identified snap lines from the page.
This feature would significantly improve workflow efficiency for designers who use complex layout grids.

Steps to Reproduce:
1. This new command should count all snap lines in the background
2. Ask to be sure you want remove all snap lines as double confirmation
3. The confirmation should be delete all snap lines permanently

Actual Results:
I need to waste a lot of time, to remove one at time snap line

Expected Results:
Remove all snap lines, by confirmation before to proceed to complete deleting


Reproducible: Always


User Profile Reset: No

Additional Info:
Alternatively there is a running macro to perform really working now to do same action before a new release of Draw ?
Comment 1 Enrico Cora 2026-02-27 11:33:38 UTC
Created attachment 205837 [details]
SNAP LINES TO REMOVE MANUALLY IN DRAW

3 Macros tested to remove all snap lines, but fails all.

Sub DELETE_GUIDELINES0
'RimuoviTutteLeLineeGuida
    Dim oDoc As Object
    Dim oDrawPage As Object
    Dim oSnapLines As Object
    Dim i As Integer

    ' Ottieni il documento e la pagina corrente
    oDoc = ThisComponent
    oDrawPage = oDoc.CurrentController.CurrentPage
    oSnapLines = oDrawPage.getSnapLines()

    ' Rimuovi le linee partendo dall'ultima (per non sballare l'indice)
    If oSnapLines.getCount() > 0 Then
        For i = oSnapLines.getCount() - 1 To 0 Step -1
            oSnapLines.removeByIndex(i)
        Next i
        MsgBox "Tutte le linee guida sono state rimosse.", 64, "Operazione Completata"
    Else
        MsgBox "Nessuna linea guida trovata nella pagina.", 48, "Attenzione"
    End If
End Sub
'
Sub DELETE_GUIDELINES1
    Dim oDoc As Object
    Dim oDrawPage As Object
    Dim oSnapLines As Object
    Dim i As Integer

    On Error Resume Next
    oDoc = ThisComponent
    
    ' Accede alla pagina di disegno visualizzata al momento
    oDrawPage = oDoc.CurrentController.CurrentPage
    
    ' Utilizza la proprietà SnapLines direttamente
    oSnapLines = oDrawPage.SnapLines

    If Not IsNull(oSnapLines) Then
        If oSnapLines.getCount() > 0 Then
            ' Rimuove le linee partendo dall'ultima per evitare errori di indice
            For i = oSnapLines.getCount() - 1 To 0 Step -1
                oSnapLines.removeByIndex(i)
            Next i
            MsgBox "Tutte le linee guida sono state rimosse con successo.", 64, "Fine Operazione"
        Else
            MsgBox "Nessuna linea guida rilevata in questa pagina.", 48, "Info"
        End If
    Else
        MsgBox "Impossibile accedere alle linee guida su questa pagina.", 16, "Errore"
    End If
End Sub
'
Sub DELETE_GUIDELINES2
    Dim oDoc As Object
    Dim oPage As Object
    Dim oSnapLines As Object
    Dim i As Long

    oDoc = ThisComponent
    
    ' Verifichiamo che siamo in un documento che supporta le pagine di disegno
    If Not HasUnoInterfaces(oDoc, "com.sun.star.drawing.XDrawPagesSupplier") Then
        MsgBox "Questo comando funziona solo in LibreOffice Draw.", 16, "Errore Documento"
        Exit Sub
    End If

    ' Puntiamo alla pagina corrente
    oPage = oDoc.CurrentController.CurrentPage
    
    ' Proviamo ad accedere alle SnapLines tramite il metodo standard UNO
    On Error Resume Next
    oSnapLines = oPage.getSnapLines()
    On Error GoTo 0

    If IsNull(oSnapLines) Or IsEmpty(oSnapLines) Then
        MsgBox "Errore: Impossibile trovare il contenitore delle linee guida.", 16, "Errore API"
        Exit Sub
    End If

    ' Se ci sono linee, le eliminiamo
    If oSnapLines.getCount() > 0 Then
        For i = oSnapLines.getCount() - 1 To 0 Step -1
            oSnapLines.removeByIndex(i)
        Next i
        MsgBox "Tutte le linee guida rimosse con successo.", 64, "Successo"
    Else
        MsgBox "Nessuna linea guida presente in questa pagina.", 48, "Info"
    End If
End Sub
Comment 2 Regina Henschel 2026-02-28 10:01:54 UTC
I support this request.

Currently it is only possible to remove all snap lines at once by editing the file markup. There it is the view setting "SnapLinesDrawing". In packed file format it is in subfile settings.xml. This attribute contains the kind and positions of all snap lines and snap points encoded in one string. When you delete the string, the snap lines and snap points are gone.

The snap guides do not belong to a draw page but to the view. If you use two views of the same draw page, the views can have different snap guides.

You see the setting "SnapLinesDrawing" in property ViewData of the document. You can even edit it with a macro, but that will not remove the snap guides. At least I was not able to force the view to use the changed ViewData.

A place for a "Delete All" command could be the menu "Snap Guides" (.uno:SnapLinesMenu). That is available in the context menu of a page and in menu View.
Comment 3 Regina Henschel 2026-02-28 10:17:30 UTC
You're not the only one who finds that annoying.

*** This bug has been marked as a duplicate of bug 113687 ***
Comment 4 Regina Henschel 2026-02-28 11:04:42 UTC
Sorry, a different bug should have been marked "duplicate".
Comment 5 Enrico Cora 2026-03-03 11:42:19 UTC
Dear Regina,
I open Libreoffice folder here:

C:\Program Files\LibreOffice\program\python-core-3.11.14\lib\pip\_vendor\rich\

There I saw file named "markup.py".

I have edited it with NOTEPAD++, after having done a copy of original and closed LIBREOFFICE DRAW.
Searching "SnapLinesDrawing", none string in the file is found.

Another similar file I found is "_markupbase.py" here:

C:\Program Files\LibreOffice\program\python-core-3.11.14\lib\

Searching "SnapLinesDrawing", none string in the file is found.

So now, I tried to see the connected ticket "bug 113687".

Thank you,
Enrico Corà
Comment 6 Enrico Cora 2026-03-03 11:47:42 UTC
Dear Regina,
the "bug 113687" seem referred to CALC LIBREOFFICE, not ot DRAW LIBREOFFICE...

So, my opinion you have entered a wrong number...

Can you check ?

Thank you,
Enrico Corà
Comment 7 Regina Henschel 2026-03-03 12:07:05 UTC
(In reply to Enrico Cora from comment #6)
> Dear Regina,
> the "bug 113687" seem referred to CALC LIBREOFFICE, not ot DRAW
> LIBREOFFICE...
> 
> So, my opinion you have entered a wrong number...
> 
> Can you check ?

I had already done it and removed the "duplicate", see comment #4.
Comment 8 Regina Henschel 2026-03-03 13:49:26 UTC
(In reply to Enrico Cora from comment #5)
> Dear Regina,
> I open Libreoffice folder here:
> 
> C:\Program
> Files\LibreOffice\program\python-core-3.11.14\lib\pip\_vendor\rich\

For using the workaround you need to enter the individual file, e.g. by using 7-Zip. Then you have access to the subfile settings.xml. You can edit it e.g. by using Notepad++. (edit, save, close Notepad++). Back in 7-Zip you will be ask to update settings.xml. Confirm. Close 7-Zip.

To find the string in the source of LibreOffice use
 https://opengrok.libreoffice.org/
with string *snaplinesdrawing* in field `Full Search`. But that will be only of interest for a developer who is going to implement this feature.

I have not examined, whether a solution via macro is possible.