AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 1070857
Accepted
damadam
damadam
Asked: 2018-09-01 04:18:41 +0800 CST2018-09-01 04:18:41 +0800 CST 2018-09-01 04:18:41 +0800 CST

LibreOffice Impress 带有方形/圆形的进度条

  • 772

我想使用 LibreOffice Impress 在我的实习演示文稿中添加一个进度条,但我只能使用宏找到这种类型的进度条

在此处输入图像描述

如您所见,即使我可以添加进度百分比,也很难知道这部分有多少张幻灯片,在完成演示之前有多少张。这个宏可以在这个链接中找到:

https://github.com/dasaki/Impress-Progress-Bar

现在,我想要一些看起来像波纹管的东西(对不起,GIMP 不是画线或正方形的最佳图片编辑器):

在此处输入图像描述

如果有人有解决方案或指向执行类似操作的宏的链接,我不想手动进行方形/圆形进度,这会很脏,而且真的需要一些时间来处理它。谢谢

libreoffice
  • 2 2 个回答
  • 2448 Views

2 个回答

  • Voted
  1. Best Answer
    user.dz
    2019-10-31T15:52:20+08:002019-10-31T15:52:20+08:00

    好吧,可能没有那么复杂。我本来希望从分叉该存储库开始,但最终还是从头开始编写。

    当前状态,它正在运行(LibreOffice v6.0.2.1)。但是,设置不显示在 GUI 中。

    设置

    1. 工具 > 宏 > 组织宏 > LibreOffice Basic...
    2. 我的宏 > 标准:新模块将其命名为“ProgressLine”或其他名称。
    3. 选择它然后编辑,将下面的代码复制到其中

      REM  *****  BASIC  *****
      
      Dim iFileNumber As Integer
      Dim iSectionCount As Integer
      Dim iSectionPage As Integer
      Dim iSectionIndex As Integer
      Dim iSectionIndexCurrent As Integer
      
      Dim oDocument As Object
      Dim oPage As Object
      Dim iPageCount As Integer
      Dim oPositionPageMark As New com.sun.star.awt.Point
      Dim oSizePageMark As New com.sun.star.awt.Size
      Dim oSizeSectionTitle As New com.sun.star.awt.Size
      
      
      Sub ProgressLine
      
          'Default values
          'sBulletShape = "com.sun.star.drawing.RectangleShape"
          sBulletShape = "com.sun.star.drawing.EllipseShape"
          'Values are fracture of page width
          oSizePageMark_Width = 0.02
          oSizePageMark_Height = 0.02
          oSizeSectionTitle_Width = 0.20
          oSizeSectionTitle_Height = 0.03
          dSeparationRatioSection = 3.0
          dMargin_Start = 0.05
          dMargin_End = 0.10
          dMargin_Side = 0.03
      
          oFillColorPageMarkActive = RGB(255,0,0)
          oFillColorPageMarkInactive = RGB(240, 200, 200)
          oCharColorSectionTitleActive = RGB(255, 0, 0)
          oCharColorSectionTitleInactive = RGB(150, 150, 150)
      
      
          ProgressLineRemove()
      
          oDocument = ThisComponent
          If oDocument.supportsService("com.sun.star.drawing.GenericDrawingDocument") Then
              'Load index
              sIndexPath = oDocument.URL
              sIndexPath = Mid( Left(sIndexPath, InStr(sIndexPath, ".odp")-1) & ".index",1,Len(sIndexPath)+2)
              iFileNumber = Freefile
              Open sIndexPath For Input As #iFileNumber
              'First line is section total count
              If Not eof(#iFileNumber) Then
                  Line Input #iFileNumber, sLine
                  If sLine<>"" Then
                      iSectionCount = Int(sLine)
                  End If
              End If
              'Remaining lines for sections: page, title
              iPageCount = oDocument.DrawPages.Count
              Dim sSectionTitle(iPageCount) As String
              While Not eof(#iFileNumber)
                  Line Input #iFileNumber, sLine
                  If sLine<>"" Then
                      iSectionPage = Int(Left(sLine, InStr(sLine, ",")-1))
                      sSectionTitle(iSectionPage-1) = Right(sLine, Len(sLine)-InStr(sLine, ","))
                  End If
              Wend
      
              'loop over pages
              iSectionIndex=-1
              For iPageIndex=0 To iPageCount-1
                  If sSectionTitle(iPageIndex)<>"" Then
                      iSectionIndex = iSectionIndex+1
                  End If
                  oPage = oDocument.DrawPages(iPageIndex)
                  oSizePageMark.Width = oPage.Width*oSizePageMark_Width
                  oSizePageMark.Height = oPage.Width*oSizePageMark_Height
                  dSeparation = (oPage.Width*(1-dMargin_Start-dMargin_End)-oSizePageMark.Width*iPageCount)/((iPageCount-iSectionCount)+(iSectionCount-1)*dSeparationRatioSection)
      
      
                  'Place new shapes, loop over page for progress
                  iSectionIndexCurrent=-1
                  For iPageIndexCurrent=0 To iPageCount-1
                      If sSectionTitle(iPageIndexCurrent)<>"" Then
                          iSectionIndexCurrent = iSectionIndexCurrent+1
                      End If
                      oShape = oDocument.createInstance(sBulletShape)
                      oPositionPageMark.x = (iPageIndexCurrent+iSectionIndexCurrent*(dSeparationRatioSection-1))*dSeparation+iPageIndexCurrent*oSizePageMark.Width+oPage.Width*dMargin_Start
                      oPositionPageMark.y = oPage.Height-oPage.Width*dMargin_Side-oSizePageMark.Height
                      oShape.Size = oSizePageMark
                      oShape.Position = oPositionPageMark
                      oShape.LineStyle = none
                      If (iPageIndexCurrent=iPageIndex) Then
                          oShape.FillColor = oFillColorPageMarkActive
                      Else
                          oShape.FillColor = oFillColorPageMarkInactive
                      End If
                      oShape.Name = "Progress Line RS_" + (iPageIndex+1)+"_"+(iPageIndexCurrent+1)
                      oPage.add(oShape)
      
                      'Section titles, skip dummy title: "_"
                      If sSectionTitle(iPageIndexCurrent)<>"" And sSectionTitle(iPageIndexCurrent)<>"_" Then        
                          oShape = oDocument.createInstance("com.sun.star.drawing.RectangleShape")    
                          oShape.TextVerticalAdjust = com.sun.star.drawing.TextVerticalAdjust.TOP
                          oShape.TextHorizontalAdjust = com.sun.star.drawing.TextHorizontalAdjust.LEFT
                          oShape.TextLeftDistance = 0
                          oSizeSectionTitle.Width = oPage.Width*oSizeSectionTitle_Width
                          oSizeSectionTitle.Height = oPage.Width*oSizeSectionTitle_Height
                          oShape.Size = oSizeSectionTitle
                          oPositionPageMark.y = oPositionPageMark.y-oSizeSectionTitle.Height
                          oShape.Position = oPositionPageMark
                          oShape.LineStyle = none
                          oShape.FillStyle = none
                          oShape.Name = "Progress Line TS_" + (iPageIndex+1)+"_"+(iPageIndexCurrent+1)
                          oPage.add(oShape)
                          oShape.String = sSectionTitle(iPageIndexCurrent)
                          oShape.CharWeight = com.sun.star.awt.FontWeight.BOLD  
                          oShape.CharFontName = "Arial" 'todo: doesn't work
      
                          If iSectionIndexCurrent=iSectionIndex Then
                              oShape.CharColor = oCharColorSectionTitleActive
                          Else
                              oShape.CharColor = oCharColorSectionTitleInactive
                          End If 
      
                      End If
                  Next iPageIndexCurrent
              Next iPageIndex
              Close #iFileNumber
          End If
      End Sub
      
      Sub ProgressLineRemove
          oDocument = ThisComponent
          If oDocument.supportsService("com.sun.star.drawing.GenericDrawingDocument") Then
              'loop over pages
              iSectionIndexCurrent=0
              For iPageIndex=0 To oDocument.DrawPages.Count-1
                  oPage = oDocument.DrawPages(iPageIndex)
                  'Cleanup old shapes
                  iShapeIndex = oPage.getCount-1
                  Do While (iShapeIndex>=0)
                      oShape = oPage.getByIndex(iShapeIndex)
                      If (InStr(oShape.Name, "Progress Line") <> 0) Then
                          oPage.remove(oShape)
                      End If
                      iShapeIndex = iShapeIndex-1
                  Loop
              Next iPageIndex
          End If
      End Sub
      
    4. 保存

    工作流程

    添加进度线

    1. 在同名但.index扩展名相同的文件夹中创建索引,一个文本文件

      5
      1,_
      2,H2_a
      4,H2_b
      7,H2_c
      10,_
      
      • 第一行是部分的总数
      • 这种格式的剩余行:页,节标题
      • _专门用于没有标题的部分
    2. 打开您的演示文稿

    3. 工具 > 宏 > 组织宏 > LibreOffice Basic...:运行ProgressLine

    删除进度线

    • 工具 > 宏 > 组织宏 > LibreOffice Basic...:运行ProgressLineRemove

    笔记

    • 大多数设置都集中在脚本的顶部,因此调整它应该很容易。

    LibreOffice-OpenOffice Impress-Presentation 进度条带部分顶部轮廓

    • 2
  2. S Parxz
    2019-01-26T01:50:56+08:002019-01-26T01:50:56+08:00

    很好的主意。我也下载了进度条。它确实给出了一个百分比数字“x %”,但没有什么像你的绘图那样精细。我不是开发人员,只是进入 LibreOffice 宏。

    我的猜测是解决方案是使用 LibreOffice Writer 目录 (TOC),转换为 Presenter。

    如果可以将 TOC 条目标记为“里程碑”,并且一旦达到,则发送 Abbreviated 缩小字体文本框,并将图标切换为占位符。

    我想必须制作多组占位符模板。例如 10, 20, 30, 40, 50, 60, 70, 80, 90, 100。在幻灯片增量或减量时自动调用模板。

    文本和切换填充图标的颜色将是需要克服的棘手部分。如果从一开始就将其设置在母版幻灯片上,那将有所帮助。

    我期待(即“进步”!)比我更了解宏编程的人,试一试。

    • 0

相关问题

  • 批量打印 ODT 文档

  • 11.04 将使用什么办公套件?

  • 如何安装 LibreOffice?(替换 OpenOffice.org)

  • OpenOffice 和新创建的 LibreOffice 有什么区别?

  • 如何强制面板不在顶部?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve