Re: [libreoffice-documentation] Guides Bullet List cleanup

2021-07-15 Thread Olivier Hallot

Thanks Pierre and Rafael for the help on cleaning the list styles

For the record, the small piece of code is
8<--
Sub CleanListStyles
  Dim sFamilies as Variant
  sFamily = ThisComponent.StyleFamilies.getByName("ParagraphStyles")
  Dim newStyle as Object
  Set newStyle = 
ThisComponent.CreateInstance("com.sun.star.style.ParagraphStyle")'

  newStyle.ParentStyle = "Standard"
  sFamily.insertByName("olivier_dummy", newStyle)
  CleanExtraBullet("List 1", "olivier_dummy")
  CleanExtraBullet("List 2", "olivier_dummy")
  CleanExtraBullet("Heading Caution", "olivier_dummy")
  CleanExtraBullet("Heading Tip", "olivier_dummy")
  CleanExtraBullet("Heading Note", "olivier_dummy")
  sFamily.removeByName("olivier_dummy")
msgbox "Finished"
End sub
8<--

where CleanExtraBullet() is the macro recording that Pierre suggested.

I am cleaning the source files of Getting Started 7.2

Regards
Olivier


Em 15/07/2021 05:50, pierre-yves.samyn escreveu:

Hi

I think you can do the macro by recording:

- Search & replace the List1 paragraph style with an unused style (e.g. 
Content10)

- Search for all paragraphs in Content10
- Apply the numbering via the toolbar
- Remove numbering via the toolbar
- Replace the paragraph style Contents10 with List1

Best regards

Pierre-Yves SAMYN




--
Olivier Hallot
LibreOffice Documentation Coordinator
Rio de Janeiro - Brasil - Local Time: UTC-03:00
LibreOffice – free and open source office suite: https://www.libreoffice.org
Respects your privacy, and gives you back control over your data
http://tdf.io/joinus

--
To unsubscribe e-mail to: documentation+unsubscr...@global.libreoffice.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/documentation/
Privacy Policy: https://www.documentfoundation.org/privacy


[libreoffice-documentation] Guides Bullet List cleanup

2021-07-15 Thread pierre-yves.samyn

Hi

I think you can do the macro by recording:

- Search & replace the List1 paragraph style with an unused style (e.g. 
Content10)

- Search for all paragraphs in Content10
- Apply the numbering via the toolbar
- Remove numbering via the toolbar
- Replace the paragraph style Contents10 with List1

Best regards

Pierre-Yves SAMYN


--
To unsubscribe e-mail to: documentation+unsubscr...@global.libreoffice.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/documentation/
Privacy Policy: https://www.documentfoundation.org/privacy


Re: [libreoffice-documentation] Guides Bullet List cleanup

2021-07-14 Thread Olivier Hallot

Thanks Rafael.

The issue is a bit more complex, possibly a bug or enhancement bug. More 
details in


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

What happens is that a list is direct-applied over the paragraph style 
which already has the same list style as property.


To say in other words, like applying direct bold character Ctrl+B to a 
word which char style is already bold.


"Clean direct formatting" does not catch direct list formatting.

With your sample code, iterating on paragraphs, the challenge is to 
catch this list direct-formatting.


OLivier


Em 14/07/2021 16:26, Rafael Lima escreveu:

Hi Olivier,

The following macro will iterate over all paragraphs and remove all of the
items that contain empty strings (both in numbered and bulleted lists).

Sub RemoveEmptyItems
  Dim oEnum, oPar
  oEnum = ThisComponent.Text.CreateEnumeration()
  Do While oEnum.HasMoreElements()
   oPar = oEnum.NextElement()
   nsName = oPar.NumberingStyleName
   If nsName <> "" Then
parText = oPar.GetString()
If parText = "" Then
 'This is reached if the list has an entry that is empty
 ThisComponent.Text.RemoveTextContent(oPar)
End If
   End If
  Loop
End Sub


On Wed, Jul 14, 2021 at 12:31 PM Olivier Hallot <
olivier.hal...@libreoffice.org> wrote:


Hi...

The situation is illustrated in the document below

https://nextcloud.documentfoundation.org/s/8YceNLp9Jy43by3

Olivier


Em 14/07/2021 12:19, Olivier Hallot escreveu:

Hi

I am looking to some clue/Basic code to detect and correct paragraphs
with bullet lists which have an extra, overlaying bullet applied.

In all guides, we use Paragraph styles List 1 and List 2  which are
connected to list styles Bullet * and Bullet - respectively.

However in many lists in the Guides there are often another bullet (* or
-) over the List 1 or 2 paragraph bullet. There no visual indication
when editing the chapters, and no problem in printing or exporting to
PDF. But when changing some para style attribute, the extra bullet pops.

The current trick I use is to select the set of bullet list paragraphs,
apply temporary the BodyText style (then the extra bullet shows), remove
the extra bullet and re-apply the para list style. That must be done in
every list in the text which is rather exhausting.

if no extra bullet pops, then I press Ctrl+Z to undo the temporary

change.


Has anybody a couple of Basic lines to detect and remove the extra
bullet? At least I'd like to know how to catch and delete this extra
bullet.

Thanks in advance.

Kind regards



--
Olivier Hallot
LibreOffice Documentation Coordinator
Rio de Janeiro - Brasil - Local Time: UTC-03:00
LibreOffice – free and open source office suite:
https://www.libreoffice.org
Respects your privacy, and gives you back control over your data
http://tdf.io/joinus

--
To unsubscribe e-mail to: documentation+unsubscr...@global.libreoffice.org
Problems?
https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/documentation/
Privacy Policy: https://www.documentfoundation.org/privacy





--
Olivier Hallot
LibreOffice Documentation Coordinator
Rio de Janeiro - Brasil - Local Time: UTC-03:00
LibreOffice – free and open source office suite: https://www.libreoffice.org
Respects your privacy, and gives you back control over your data
http://tdf.io/joinus

--
To unsubscribe e-mail to: documentation+unsubscr...@global.libreoffice.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/documentation/
Privacy Policy: https://www.documentfoundation.org/privacy


Re: [libreoffice-documentation] Guides Bullet List cleanup

2021-07-14 Thread Rafael Lima
Hi Olivier,

The following macro will iterate over all paragraphs and remove all of the
items that contain empty strings (both in numbered and bulleted lists).

Sub RemoveEmptyItems
 Dim oEnum, oPar
 oEnum = ThisComponent.Text.CreateEnumeration()
 Do While oEnum.HasMoreElements()
  oPar = oEnum.NextElement()
  nsName = oPar.NumberingStyleName
  If nsName <> "" Then
   parText = oPar.GetString()
   If parText = "" Then
'This is reached if the list has an entry that is empty
ThisComponent.Text.RemoveTextContent(oPar)
   End If
  End If
 Loop
End Sub


On Wed, Jul 14, 2021 at 12:31 PM Olivier Hallot <
olivier.hal...@libreoffice.org> wrote:

> Hi...
>
> The situation is illustrated in the document below
>
> https://nextcloud.documentfoundation.org/s/8YceNLp9Jy43by3
>
> Olivier
>
>
> Em 14/07/2021 12:19, Olivier Hallot escreveu:
> > Hi
> >
> > I am looking to some clue/Basic code to detect and correct paragraphs
> > with bullet lists which have an extra, overlaying bullet applied.
> >
> > In all guides, we use Paragraph styles List 1 and List 2  which are
> > connected to list styles Bullet * and Bullet - respectively.
> >
> > However in many lists in the Guides there are often another bullet (* or
> > -) over the List 1 or 2 paragraph bullet. There no visual indication
> > when editing the chapters, and no problem in printing or exporting to
> > PDF. But when changing some para style attribute, the extra bullet pops.
> >
> > The current trick I use is to select the set of bullet list paragraphs,
> > apply temporary the BodyText style (then the extra bullet shows), remove
> > the extra bullet and re-apply the para list style. That must be done in
> > every list in the text which is rather exhausting.
> >
> > if no extra bullet pops, then I press Ctrl+Z to undo the temporary
> change.
> >
> > Has anybody a couple of Basic lines to detect and remove the extra
> > bullet? At least I'd like to know how to catch and delete this extra
> > bullet.
> >
> > Thanks in advance.
> >
> > Kind regards
> >
>
> --
> Olivier Hallot
> LibreOffice Documentation Coordinator
> Rio de Janeiro - Brasil - Local Time: UTC-03:00
> LibreOffice – free and open source office suite:
> https://www.libreoffice.org
> Respects your privacy, and gives you back control over your data
> http://tdf.io/joinus
>
> --
> To unsubscribe e-mail to: documentation+unsubscr...@global.libreoffice.org
> Problems?
> https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
> Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
> List archive: https://listarchives.libreoffice.org/global/documentation/
> Privacy Policy: https://www.documentfoundation.org/privacy
>

-- 
To unsubscribe e-mail to: documentation+unsubscr...@global.libreoffice.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/documentation/
Privacy Policy: https://www.documentfoundation.org/privacy


Re: [libreoffice-documentation] Guides Bullet List cleanup

2021-07-14 Thread Olivier Hallot

Hi...

The situation is illustrated in the document below

https://nextcloud.documentfoundation.org/s/8YceNLp9Jy43by3

Olivier


Em 14/07/2021 12:19, Olivier Hallot escreveu:

Hi

I am looking to some clue/Basic code to detect and correct paragraphs 
with bullet lists which have an extra, overlaying bullet applied.


In all guides, we use Paragraph styles List 1 and List 2  which are 
connected to list styles Bullet * and Bullet - respectively.


However in many lists in the Guides there are often another bullet (* or 
-) over the List 1 or 2 paragraph bullet. There no visual indication 
when editing the chapters, and no problem in printing or exporting to 
PDF. But when changing some para style attribute, the extra bullet pops.


The current trick I use is to select the set of bullet list paragraphs, 
apply temporary the BodyText style (then the extra bullet shows), remove 
the extra bullet and re-apply the para list style. That must be done in 
every list in the text which is rather exhausting.


if no extra bullet pops, then I press Ctrl+Z to undo the temporary change.

Has anybody a couple of Basic lines to detect and remove the extra 
bullet? At least I'd like to know how to catch and delete this extra 
bullet.


Thanks in advance.

Kind regards



--
Olivier Hallot
LibreOffice Documentation Coordinator
Rio de Janeiro - Brasil - Local Time: UTC-03:00
LibreOffice – free and open source office suite: https://www.libreoffice.org
Respects your privacy, and gives you back control over your data
http://tdf.io/joinus

--
To unsubscribe e-mail to: documentation+unsubscr...@global.libreoffice.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/documentation/
Privacy Policy: https://www.documentfoundation.org/privacy


[libreoffice-documentation] Guides Bullet List cleanup

2021-07-14 Thread Olivier Hallot

Hi

I am looking to some clue/Basic code to detect and correct paragraphs 
with bullet lists which have an extra, overlaying bullet applied.


In all guides, we use Paragraph styles List 1 and List 2  which are 
connected to list styles Bullet * and Bullet - respectively.


However in many lists in the Guides there are often another bullet (* or 
-) over the List 1 or 2 paragraph bullet. There no visual indication 
when editing the chapters, and no problem in printing or exporting to 
PDF. But when changing some para style attribute, the extra bullet pops.


The current trick I use is to select the set of bullet list paragraphs, 
apply temporary the BodyText style (then the extra bullet shows), remove 
the extra bullet and re-apply the para list style. That must be done in 
every list in the text which is rather exhausting.


if no extra bullet pops, then I press Ctrl+Z to undo the temporary change.

Has anybody a couple of Basic lines to detect and remove the extra 
bullet? At least I'd like to know how to catch and delete this extra bullet.


Thanks in advance.

Kind regards

--
Olivier Hallot
LibreOffice Documentation Coordinator
Rio de Janeiro - Brasil - Local Time: UTC-03:00
LibreOffice – free and open source office suite: https://www.libreoffice.org
Respects your privacy, and gives you back control over your data
http://tdf.io/joinus

--
To unsubscribe e-mail to: documentation+unsubscr...@global.libreoffice.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/documentation/
Privacy Policy: https://www.documentfoundation.org/privacy