odfstudio: synchronize with LibreOffice upstream
This commit is contained in:
+2
-4
@@ -113,8 +113,6 @@ $(eval $(call gb_Library_add_exception_objects,cui,\
|
||||
cui/source/customize/SvxConfigPageHelper \
|
||||
cui/source/customize/SvxMenuConfigPage \
|
||||
cui/source/customize/SvxToolbarConfigPage \
|
||||
cui/source/customize/SvxNotebookbarConfigPage \
|
||||
cui/source/customize/CustomNotebookbarGenerator \
|
||||
cui/source/dialogs/about \
|
||||
$(call gb_Helper_optional,EXTENSIONS, \
|
||||
cui/source/dialogs/AdditionsDialog) \
|
||||
@@ -142,7 +140,6 @@ $(eval $(call gb_Library_add_exception_objects,cui,\
|
||||
cui/source/dialogs/screenshotannotationdlg \
|
||||
cui/source/dialogs/pastedlg \
|
||||
cui/source/dialogs/postdlg \
|
||||
cui/source/dialogs/querydialog \
|
||||
cui/source/dialogs/QrCodeGenDialog \
|
||||
cui/source/dialogs/GraphicTestsDialog \
|
||||
cui/source/dialogs/ImageViewerDialog \
|
||||
@@ -192,7 +189,6 @@ $(eval $(call gb_Library_add_exception_objects,cui,\
|
||||
cui/source/options/optgenrl \
|
||||
cui/source/options/opthtml \
|
||||
cui/source/options/optlanguagetool \
|
||||
cui/source/options/optdeepl \
|
||||
cui/source/options/optinet2 \
|
||||
cui/source/options/optjava \
|
||||
cui/source/options/optjsearch \
|
||||
@@ -222,6 +218,7 @@ $(eval $(call gb_Library_add_exception_objects,cui,\
|
||||
cui/source/tabpages/numpages \
|
||||
cui/source/tabpages/page \
|
||||
cui/source/tabpages/paragrph \
|
||||
cui/source/tabpages/SvxPresetListBox \
|
||||
cui/source/tabpages/swpossizetabpage \
|
||||
cui/source/tabpages/tabarea \
|
||||
cui/source/tabpages/tabline \
|
||||
@@ -242,6 +239,7 @@ $(eval $(call gb_Library_add_exception_objects,cui,\
|
||||
cui/source/tabpages/tptrans \
|
||||
cui/source/tabpages/transfrm \
|
||||
cui/source/util/FontFeatures \
|
||||
cui/source/util/GetDocumentModel \
|
||||
cui/source/dialogs/widgettestdlg \
|
||||
))
|
||||
|
||||
|
||||
@@ -137,7 +137,6 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\
|
||||
cui/uiconfig/ui/optbasicidepage \
|
||||
cui/uiconfig/ui/optctlpage \
|
||||
cui/uiconfig/ui/optchartcolorspage \
|
||||
cui/uiconfig/ui/optdeeplpage \
|
||||
cui/uiconfig/ui/optemailpage \
|
||||
cui/uiconfig/ui/optfltrpage \
|
||||
cui/uiconfig/ui/optfltrembedpage \
|
||||
@@ -185,7 +184,6 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\
|
||||
cui/uiconfig/ui/querydeletehatchdialog \
|
||||
cui/uiconfig/ui/querydeletelineenddialog \
|
||||
cui/uiconfig/ui/querydeletelinestyledialog \
|
||||
cui/uiconfig/ui/querydialog \
|
||||
cui/uiconfig/ui/queryduplicatedialog \
|
||||
cui/uiconfig/ui/querynoloadedfiledialog \
|
||||
cui/uiconfig/ui/querynosavefiledialog \
|
||||
|
||||
@@ -89,6 +89,4 @@ inline constexpr OUString RID_SVXBMP_TOTD_DRAW = u"res/tipoftheday_d.png"_ustr;
|
||||
inline constexpr OUString RID_SVXBMP_TOTD_IMPRESS = u"res/tipoftheday_i.png"_ustr;
|
||||
inline constexpr OUString RID_SVXBMP_TOTD_SOFFICE = u"res/tipoftheday.png"_ustr;
|
||||
|
||||
inline constexpr OUString RID_CUIBMP_QUERY = u"res/query.png"_ustr;
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
||||
|
||||
@@ -161,7 +161,6 @@
|
||||
#include <vcl/vectorgraphicdata.hxx>
|
||||
#include <vcl/virdev.hxx>
|
||||
#include <vcl/wall.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <vcl/window.hxx>
|
||||
#include <vcl/windowstate.hxx>
|
||||
#include <vcl/wintypes.hxx>
|
||||
@@ -308,7 +307,6 @@
|
||||
#include <editeng/outliner.hxx>
|
||||
#include <editeng/outlobj.hxx>
|
||||
#include <editeng/overflowingtxt.hxx>
|
||||
#include <editeng/paragraphdata.hxx>
|
||||
#include <editeng/svxenum.hxx>
|
||||
#include <editeng/svxfont.hxx>
|
||||
#include <i18nlangtag/lang.h>
|
||||
|
||||
+14
-1
@@ -266,6 +266,7 @@
|
||||
#define RID_CUISTR_OPT_GRAMMAR_BY NC_("RID_SVXSTR_OPT_GRAMMAR_BY", "~Grammar By")
|
||||
#define STR_MODIFY NC_("STR_MODIFY", "~Replace")
|
||||
#define RID_CUISTR_CONFIRM_SET_LANGUAGE NC_("RID_SVXSTR_CONFIRM_SET_LANGUAGE", "Do you want to change the '%1' dictionary language?")
|
||||
#define RID_CUISTR_OPT_DICT_SEARCH_PLACEHOLDER NC_("RID_SVXSTR_OPT_DICT_SEARCH_PLACEHOLDER", "Type to search...")
|
||||
|
||||
#define RID_CUISTR_COLOR_CONFIG_DELETE NC_("RID_SVXSTR_COLOR_CONFIG_DELETE", "Do you really want to delete the color scheme?")
|
||||
#define RID_CUISTR_COLOR_CONFIG_DELETE_TITLE NC_("RID_SVXSTR_COLOR_CONFIG_DELETE_TITLE", "Color Scheme Deletion")
|
||||
@@ -307,6 +308,8 @@
|
||||
#define RID_CUISTR_DESC_COLOR NC_("RID_SVXSTR_DESC_COLOR", "Please enter a name for the new color:")
|
||||
#define RID_CUISTR_TABLE NC_("RID_SVXSTR_TABLE", "Table")
|
||||
#define RID_CUISTR_DESC_LINEEND NC_("RID_SVXSTR_DESC_LINEEND", "Please enter a name for the new arrow style:")
|
||||
// To translators: The %1 will be replaced with a font style name like “No Bold”, ie, it’s the word
|
||||
// “no” and not an abbreviation for “number”
|
||||
#define RID_CUISTR_CHARNAME_NOSTYLE NC_("RID_SVXSTR_CHARNAME_NOSTYLE", "No %1")
|
||||
#define RID_CUISTR_CHARNAME_FAMILY NC_("RID_SVXSTR_CHARNAME_FAMILY", "Family:")
|
||||
#define RID_CUISTR_CHARNAME_FONT NC_("RID_SVXSTR_CHARNAME_FONT", "Font:")
|
||||
@@ -325,6 +328,7 @@
|
||||
#define RID_CUISTR_ORDINAL NC_("RID_SVXSTR_ORDINAL", "Format ordinal numbers suffixes (1st -> 1^st)")
|
||||
#define RID_CUISTR_OLD_HUNGARIAN NC_("RID_SVXSTR_OLD_HUNGARIAN", "Transliterate to Old Hungarian if the text direction is from right to left")
|
||||
#define RID_CUISTR_ANGLE_QUOTES NC_("RID_SVXSTR_ANGLE_QUOTES", "Replace two inequality signs (<< or >>) with angle quotes")
|
||||
#define RID_CUISTR_ESPERANTO_HATS NC_("RID_CUISTR_ESPERANTO_HATS", "Replace x’s with circumflexes in Esperanto text")
|
||||
#define RID_CUISTR_DEL_EMPTY_PARA NC_("RID_SVXSTR_DEL_EMPTY_PARA", "Remove blank paragraphs")
|
||||
#define RID_CUISTR_USER_STYLE NC_("RID_SVXSTR_USER_STYLE", "Replace Custom Styles")
|
||||
#define RID_CUISTR_BULLET NC_("RID_SVXSTR_BULLET", "Replace bullets with: %1")
|
||||
@@ -385,7 +389,12 @@
|
||||
#define RID_CUISTR_ADDITIONS_THEMES NC_("RID_SVXSTR_ADDITIONS_THEMES", "Extensions: Color Themes")
|
||||
#define RID_CUISTR_ADDITIONS_TEMPLATES NC_("RID_SVXSTR_ADDITIONS_TEMPLATES", "Extensions: Templates")
|
||||
|
||||
#define RID_CUISTR_UI_APPLY NC_("RID_SVXSTR_UI_APPLY", "Apply to %MODULE")
|
||||
// Application names for the “Apply to X” button in the UI chooser dialog
|
||||
#define RID_CUISTR_UI_APPLY_TO_WRITER NC_("RID_CUISTR_UI_APPLY_TO_WRITER", "Apply to Writer")
|
||||
#define RID_CUISTR_UI_APPLY_TO_CALC NC_("RID_CUISTR_UI_APPLY_TO_CALC", "Apply to Calc")
|
||||
#define RID_CUISTR_UI_APPLY_TO_IMPRESS NC_("RID_CUISTR_UI_APPLY_TO_IMPRESS", "Apply to Impress")
|
||||
#define RID_CUISTR_UI_APPLY_TO_DRAW NC_("RID_CUISTR_UI_APPLY_TO_DRAW", "Apply to Draw")
|
||||
|
||||
#define RID_CUISTR_UI_APPLYALL NC_("RID_SVXSTR_UI_APPLYALL", "Apply to All")
|
||||
|
||||
#define RID_CUISTR_OLE_INSERT NC_("RID_SVXSTR_OLE_INSERT", "Inserting OLE object...")
|
||||
@@ -528,6 +537,10 @@
|
||||
#define REG_SQLCOMMENT NC_("REG_SQLCOMMENT", "SQL Comment")
|
||||
#define REG_WINDOWCOLOR NC_("REG_WINDOWCOLOR", "Window color")
|
||||
#define REG_WINDOWTEXTCOLOR NC_("REG_WINDOWTEXTCOLOR", "Window text color")
|
||||
#define REG_WRITERNOTEBOOKBARCOLOR NC_("REG_WRITERNOTEBOOKBARCOLOR", "Writer Notebookbar color")
|
||||
#define REG_CALCNOTEBOOKBARCOLOR NC_("REG_CALCNOTEBOOKBARCOLOR", "Calc Notebookbar color")
|
||||
#define REG_IMPRESSNOTEBOOKBARCOLOR NC_("REG_IMPRESSNOTEBOOKBARCOLOR", "Impress Notebookbar color")
|
||||
#define REG_DRAWNOTEBOOKBARCOLOR NC_("REG_DRAWNOTEBOOKBARCOLOR", "Draw Notebookbar color")
|
||||
#define REG_BASECOLOR NC_("REG_BASECOLOR", "Base color")
|
||||
#define REG_BUTTONCOLOR NC_("REG_BUTTONCOLOR", "Button color")
|
||||
#define REG_BUTTONTEXTCOLOR NC_("REG_BUTTONTEXTCOLOR", "Button text color")
|
||||
|
||||
+17
-15
@@ -54,7 +54,7 @@ const std::tuple<TranslateId, OUString, OUString, tipModule> TIPOFTHEDAY_STRINGA
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "%PRODUCTNAME offers a variety of user interface options to make you feel at home"), ".uno:UIPicker", "toolbarmode.png", soffice},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Need to allow changes to parts of a read-only document in Writer? Insert frames or sections that can authorize changes."), "https://help.libreoffice.org/%PRODUCTVERSION/%LANGUAGENAME/text/swriter/guide/section_edit.html", "", swriter}, //local help missing
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "To print the notes of your slides go to File ▸ Print ▸ %PRODUCTNAME Impress tab and select Notes under Document ▸ Type."), "", "printnote.png", soffice},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "To start temporarily with a fresh user profile, or to restore a non-working %PRODUCTNAME, use Help ▸ Restart in Safe Mode."), "svx/ui/safemodedialog/SafeModeDialog", "", soffice}, //https://help.libreoffice.org/%PRODUCTVERSION/%LANGUAGENAME/text/shared/01/profile_safe_mode.html
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "To start temporarily with a fresh user profile, or to restore a non-working %PRODUCTNAME, use Help ▸ Restart in Troubleshoot Mode."), "svx/ui/safemodedialog/SafeModeDialog", "", soffice}, //https://help.libreoffice.org/%PRODUCTVERSION/%LANGUAGENAME/text/shared/01/profile_safe_mode.html
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Writing a book? %PRODUCTNAME master document lets you manage large documents as a container for individual %PRODUCTNAME Writer files."), "https://help.libreoffice.org/%PRODUCTVERSION/%LANGUAGENAME/text/swriter/guide/globaldoc.html", "", swriter}, //local help missing
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "You can create editable Hybrid PDFs with %PRODUCTNAME."), "https://wiki.documentfoundation.org/Documentation/HowTo/CreateAHybridPDF", "hybrid_pdf.png", soffice},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Explore the ten different functions in the status bar (at the bottom of the document window). Place the cursor over each field for an explanation. If not visible, use View ▸ Status Bar."), "", "", swriter},
|
||||
@@ -84,18 +84,18 @@ const std::tuple<TranslateId, OUString, OUString, tipModule> TIPOFTHEDAY_STRINGA
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Want to sort a series in %PRODUCTNAME Calc such as A1, A2, A3, A11, A15, not in alphabetical order but on the number? Enable natural sort in the Options tab."), "modules/scalc/ui/sortoptionspage/SortOptionsPage", "", scalc}, //https://help.libreoffice.org/%PRODUCTVERSION/%LANGUAGENAME/text/scalc/01/12030200.html
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "You can change the default function in the status bar: right click on the area."), "", "statusbar.png", scalc},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Want to add many of the same shapes in Draw/Impress? Double-click a tool in the drawing toolbar to use it for repeated tasks."), "", "", sdraw},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "%MOD1+Shift+F9 recalculates all formulas in all spreadsheets."), "", "", scalc},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "%MOD1+%SHIFT+F9 recalculates all formulas in all spreadsheets."), "", "", scalc},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Want to keep a part of an editable document as read-only? Insert ▸ Section. Add text to the section, then right-click “Edit Section” and check “Protect”."), "", "", swriter},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Use the Backspace key instead of Delete in Calc. You can choose what to delete."), "", "", scalc},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "The best way to fix bad-looking MS Word table cells is via Table ▸ Size ▸ Optimal Row Height / Column Width."), "", "", swriter},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "To repeat a table heading when a table spans over a page, use Table ▸ Table Properties ▸ Text Flow ▸ Repeat heading."), "", "", swriter},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "To repeat a table header when a table spans over a page, use Table ▸ Table Properties ▸ Text Flow ▸ Repeat header."), "", "", swriter},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Want to quickly insert or delete rows? Select the desired number of rows (or columns) and press %MOD1+Plus sign (+) to add or %MOD1+Minus sign (-) to delete."), "modules/scalc/ui/insertcells/InsertCellsDialog", "", scalc},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "To repeat rows/columns on every pages use Format ▸ Print Ranges ▸ Edit."), "", "", scalc},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Insert images and photos into shapes in Draw and Impress. Right-click on a shape, choose Area ▸ Image ▸ Add / Import, and use Options to adjust appearance."), "", "", sdraw},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Need to insert the date in a spreadsheet cell? Type %MOD1+; or Shift+%MOD1+; to insert the time."), "", "", scalc},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Need to insert the date in a spreadsheet cell? Type %MOD1+; or %SHIFT+%MOD1+; to insert the time."), "", "", scalc},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Insert your metadata in your document with Insert ▸ Fields ▸ More Fields… ▸ Document or DocInformation."), "", "", swriter},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Get help from the community via the Ask portal."), "https://ask.libreoffice.org", "", soffice},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Use Shift+Space to select the current row and %MOD3+Space to select the current column."), "", "", scalc},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Use %SHIFT+Space to select the current row and %MOD3+Space to select the current column."), "", "", scalc},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "You can move an object to another layer by holding it until its edges flash, then drag it to the tab of the layer you want to move it to."), "", "", sdraw},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Data ▸ Validity allows you to create drop-down lists where the user selects a value instead of typing."), "https://help.libreoffice.org/%PRODUCTVERSION/%LANGUAGENAME/text/scalc/guide/validity.html", "", scalc}, //local help missing
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Hold down %MOD1 and turn the mouse wheel to change the zoom factor."), "", "", soffice},
|
||||
@@ -118,7 +118,7 @@ const std::tuple<TranslateId, OUString, OUString, tipModule> TIPOFTHEDAY_STRINGA
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Want to find words containing 10 or more characters? Edit ▸ Find and Replace ▸ Search ▸ \\w{10,} ▸ Other Options ▸ check Regular expressions."), "", "", swriter},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Open a CSV file as a new sheet in the current spreadsheet via Sheet ▸ Sheet from file."), "", "", scalc},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "You can continue writing with the default formatting attributes after manually applying bold, italic or underline by pressing %MOD1+M."), "", "", swriter},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Use %MOD1+%MOD2+Shift+V to paste the contents of the clipboard as unformatted text."), "", "", swriter},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Use %MOD1+%MOD2+%SHIFT+V to paste the contents of the clipboard as unformatted text."), "", "", swriter},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Customize footnote appearance with Tools ▸ Footnote/Endnote Settings…"), ".uno:FootnoteDialog", "", swriter},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "With Slide Show ▸ Custom Slide Show, reorder and pick slides to fit a slideshow to the needs of your viewers."), "", "", simpress},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Want to change spell checking for some part of the text? Click in the language zone of the status bar or better, apply a style."), "", "", swriter},
|
||||
@@ -138,7 +138,7 @@ const std::tuple<TranslateId, OUString, OUString, tipModule> TIPOFTHEDAY_STRINGA
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Left-handed? Enable Tools ▸ Options ▸ Languages and Locales ▸ General ▸ Asian and check Tools ▸ Options ▸ %PRODUCTNAME Writer ▸ View ▸ Ruler ▸ Right-aligned, which displays the scrollbar to the left."), "", "", swriter},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Want headings to always begin a page? Edit the paragraph style applied to the headings. Check “Insert” on the “Text Flow” tab, with Type “Page” and Position “Before”."), "cui/ui/textflowpage/checkInsert", "", swriter},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Date/time value is just a number of days since a chosen day zero; in the number, integer part represents date, and fractional part is time (elapsed part of a day), with 0.5 representing noon."), "", "", scalc},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Shift+%MOD1+Del deletes from cursor to the end of the current sentence."), "", "", swriter},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "%SHIFT+%MOD1+Del deletes from cursor to the end of the current sentence."), "", "", swriter},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Use column or row labels in formulas. For example, if you have two columns, “Time” and “KM”, use =Time/KM to get minutes per kilometer."), "", "", scalc},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Annoyed by the “marching ants” around cells in Calc? Press escape to stop them; the copied content will remain available for pasting."), "", "marchingants.gif", scalc},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Want to become a %PRODUCTNAME Ambassador? There are certifications for developers, admins, and trainers."), "https://www.documentfoundation.org/certification/program/", "", soffice},
|
||||
@@ -174,13 +174,13 @@ const std::tuple<TranslateId, OUString, OUString, tipModule> TIPOFTHEDAY_STRINGA
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Want to manage the presentation of hyperlinks in a spreadsheet? Insert them with the HYPERLINK function."), "https://help.libreoffice.org/%PRODUCTVERSION/%LANGUAGENAME/text/scalc/01/04060109.html", "", scalc}, //local help missing
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Uncheck Tools ▸ Options ▸ %PRODUCTNAME Calc ▸ View ▸ Zoom: “Synchronize sheets” so that each sheet in Calc has its own zoom factor."), "", "", scalc},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "You can set a color for each tab: right-click the tab or use Sheet ▸ Sheet Tab Color."), "", "", scalc},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Trace cells used in a formula, precedents (Shift+F9) or dependents (Shift+F5) (or use Tools ▸ Detective). For each hit you go one more step in the chain."), "https://help.libreoffice.org/%PRODUCTVERSION/%LANGUAGENAME/text/scalc/01/06030000.html", "", scalc}, //local help missing
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Trace cells used in a formula, precedents (%SHIFT+F9) or dependents (%SHIFT+F5) (or use Tools ▸ Detective). For each hit you go one more step in the chain."), "https://help.libreoffice.org/%PRODUCTVERSION/%LANGUAGENAME/text/scalc/01/06030000.html", "", scalc}, //local help missing
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Insert and number your formulas in one step: type fn then F3. An AutoText is inserted with formula and number aligned in a table."), "", "", swriter},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "You can create an illustration index from object names, not only from captions."), "cui/ui/objectnamedialog/ObjectNameDialog", "", swriter}, //https://help.libreoffice.org/%PRODUCTVERSION/%LANGUAGENAME/text/shared/01/05190000.html
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Use your Android or iPhone to remotely control your Impress presentation."), "https://help.libreoffice.org/%PRODUCTVERSION/he/text/simpress/guide/impress_remote.html", "", simpress}, //local help missing
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Want to know how many days there are in the current month? Use the DAYSINMONTH(TODAY()) function."), "", "", scalc},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Your numbers are displayed as ### in your spreadsheet? The column is too narrow to display all digits."), "", "", scalc},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Enable massive parallel calculations of formula cells via Tools ▸ Options ▸ %PRODUCTNAME Calc ▸ Calculate ▸ OpenCL Options."), "cui/ui/optcalculatepage/OptOpenCLPage", "", scalc}, //https://help.libreoffice.org/%PRODUCTVERSION/%LANGUAGENAME/text/shared/optionen/opencl.html
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Enable massive parallel calculations of formula cells via Tools ▸ Options ▸ %PRODUCTNAME Calc ▸ Calculate ▸ CPU Threading Settings."), "cui/ui/optcalculatepage/OptOpenCLPage", "", scalc}, //https://help.libreoffice.org/%PRODUCTVERSION/%LANGUAGENAME/text/shared/optionen/opencl.html
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Use the Connector tool from the Drawing toolbar in Draw/Impress to create nice flow charts and optionally copy/paste the object into Writer."), "", "", sdraw},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Your donations support our worldwide community."), "https://www.libreoffice.org/donate/", "", soffice},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "You want to add x months to a date? Use =EDATE(date;months)."), "https://help.libreoffice.org/%PRODUCTVERSION/%LANGUAGENAME/text/scalc/01/func_edate.html", "", scalc}, //local help missing
|
||||
@@ -207,7 +207,7 @@ const std::tuple<TranslateId, OUString, OUString, tipModule> TIPOFTHEDAY_STRINGA
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "You want to start working with Basic macros? Take a look at the examples under Tools ▸ Macros ▸ Edit Macros."), "", "", soffice},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Apply Heading paragraph styles in Writer with shortcut keys: %MOD1+1 applies Heading 1, %MOD1+2 applies Heading 2, etc."), "", "", swriter},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Do not get lost in large documents. Use the Navigator (F5) to find your way through the content."), "", "", swriter},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Edit ▸ Find and Replace lets you insert special characters directly: right click in input fields or press Shift+%MOD1+S."), "", "", soffice},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Edit ▸ Find and Replace lets you insert special characters directly: right click in input fields or press %SHIFT+%MOD1+S."), "", "", soffice},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Need custom contents for metadata properties? File ▸ Properties ▸ Custom Properties tab lets you create what you want."), "", "", soffice},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Want to see, but not print, an object in Draw? Draw it on a layer for which the “Printable” flag is not set (right-click the layer’s tab and choose “Modify Layer”)."), "", "", sdraw},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "To insert the current date in your document, use Insert ▸ Field ▸ Date."), "", "", swriter},
|
||||
@@ -224,7 +224,7 @@ const std::tuple<TranslateId, OUString, OUString, tipModule> TIPOFTHEDAY_STRINGA
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Use font embedding for greater interoperability with other office suites at File ▸ Properties ▸ Font."), "", "", swriter},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "To convert a formula into static values you do not need to copy/paste; use Data ▸ Calculate ▸ Formula to Value."), "", "", scalc},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "You can reformat all comments in a document by clicking the down arrow in a comment and choose “Format all Comments”."), "", "", swriter},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Writer helps you to make backups: with File ▸ Save a Copy you create a new document continuing to work on the original."), "", "", swriter},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Create a backup of your document in Writer by selecting File ▸ Save a Copy while continuing to work on the original."), "", "", swriter},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "When you have created a Style based on another, you can enter a percentage value or a point value (e.g. 110% or −2pt or +5pt)."), "", "", swriter},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "To copy a comment without losing the content of the target cell you should use Paste Special and uncheck everything except “Comments” in dialog. Use Operations “Add” to not override existing content."), "", "", scalc},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Batch-convert your Microsoft Office documents to the OpenDocument format by using the Document Converter wizard in menu File ▸ Wizards ▸ Document Converter."), "", "", soffice},
|
||||
@@ -236,7 +236,7 @@ const std::tuple<TranslateId, OUString, OUString, tipModule> TIPOFTHEDAY_STRINGA
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Want to return to default after applying a list style? Click Bullets or Numbering On/Off tool on the Formatting toolbar."), "", "", swriter},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Delete all of your printing areas in one step: select all sheets, then Format ▸ Print Ranges ▸ Clear."), "", "", scalc},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Add background images to spreadsheets via Insert ▸ Image or drag a background from the Gallery, then Format ▸ Arrange ▸ To Background."), "", "", scalc},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Having trouble pasting text from PDF files or webpages into documents? Try to paste as unformatted text (%MOD1+%MOD2+Shift+V)."), "", "", swriter},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Having trouble pasting text from PDF files or webpages into documents? Try to paste as unformatted text (%MOD1+%MOD2+%SHIFT+V)."), "", "", swriter},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "In Calc use TRIMMEAN() to return the mean of a data set excluding the highest and lowest values."), "https://help.libreoffice.org/%PRODUCTVERSION/%LANGUAGENAME/text/scalc/01/04060182.html?DbPAR=CALC#bm_id3152966", "", scalc}, //local help missing
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "The 4th optional parameter of VLOOKUP Calc function indicates whether the first column of data is sorted. If not, enter FALSE or zero."), "", "", scalc},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Toolbars are contextual—they open depending on the context. If you do not want that, uncheck them from View ▸ Toolbars."), "", "", soffice},
|
||||
@@ -262,7 +262,7 @@ const std::tuple<TranslateId, OUString, OUString, tipModule> TIPOFTHEDAY_STRINGA
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Apart from table of contents, %PRODUCTNAME can create Alphabetical, Illustrations, Tables, Objects, Bibliography, User-Defined indexes."), "modules/swriter/ui/tocdialog/TocDialog", "", swriter}, //https://help.libreoffice.org/%PRODUCTVERSION/%LANGUAGENAME/text/swriter/guide/indices_toc.html
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Unable to modify or delete a custom cell style? Check all sheets, none should be protected."), "", "", scalc},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "You need to fill a series? Select the cell range and Sheet ▸ Fill Cells ▸ Fill Series and choose between Linear, Growth, Date and AutoFill."), "https://help.libreoffice.org/%PRODUCTVERSION/%LANGUAGENAME/text/scalc/guide/calc_series.html", "", scalc}, //local help missing
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Want to know if a cell is referred in formulas of other cells? Tools ▸ Detective ▸ Trace Dependents (Shift+F5)."), "", "", scalc},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Want to know if a cell is referred in formulas of other cells? Tools ▸ Detective ▸ Trace Dependents (%SHIFT+F5)."), "", "", scalc},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "In the replace input field of auto correct options you can use the wildcards .*"), "", "", swriter},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Want to duplicate the above line? Press %MOD1+D or use Sheet ▸ Fill Cells ▸ Fill Down."), "", "", scalc},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "To search in several spreadsheets, select them before you start the search."), "", "", scalc},
|
||||
@@ -273,10 +273,10 @@ const std::tuple<TranslateId, OUString, OUString, tipModule> TIPOFTHEDAY_STRINGA
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Drag a formatted object to the Styles and Formatting window. A dialog box opens, just enter the name of the new style."), "", "", swriter},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "New versions of %PRODUCTNAME provide new features, bug fixes, and security patches. Keep your software updated!"), "SFX2_HID_DLG_CHECKFORONLINEUPDATE", "", soffice},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Developing new XSLT and XML filters?"), "https://fridrich.blogspot.com/2013/08/extending-swiss-army-knife-overview.html", "", soffice},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Press Shift+F1 to see any available extended tooltips in dialog boxes, when \"Extended tips\" is not enabled in Tools ▸ Options ▸ %PRODUCTNAME ▸ General."), "https://help.libreoffice.org/%PRODUCTVERSION/%LANGUAGENAME/text/shared/05/00000120.html", "", soffice},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Press %SHIFT+F1 to see any available extended tooltips in dialog boxes, when \"Extended tips\" is not enabled in Tools ▸ Options ▸ %PRODUCTNAME ▸ General."), "https://help.libreoffice.org/%PRODUCTVERSION/%LANGUAGENAME/text/shared/05/00000120.html", "", soffice},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Never use certain arrow styles? Remove them by using the Delete button on the Format ▸ Text Box and Shape ▸ Line ▸ Arrow Styles tab."), "cui/ui/lineendstabpage/BTN_MODIFY", "", sdraw},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Don’t like the position of some icons on your toolbar? Change it with Tools ▸ Customize ▸ Toolbars tab ▸ Target."), "CUI_HID_SVX_CONFIG_TOOLBAR", "", soffice},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Can’t find a command in the menus? Try Shift+ESC."), ".uno:CommandPopup", "", soffice},
|
||||
{ NC_("RID_CUI_TIPOFTHEDAY", "Can’t find a command in the menus? Try %SHIFT+ESC."), ".uno:CommandPopup", "", soffice},
|
||||
};
|
||||
|
||||
#define STR_HELP_LINK NC_("STR_HELP_LINK", "%PRODUCTNAME Help")
|
||||
@@ -284,7 +284,9 @@ const std::tuple<TranslateId, OUString, OUString, tipModule> TIPOFTHEDAY_STRINGA
|
||||
#define STR_UNO_LINK NC_("STR_UNO_LINK", "Run this action now...")
|
||||
#define STR_TITLE NC_("STR_TITLE", "Tip of the Day: %CURRENT/%TOTAL")
|
||||
#define STR_CMD NC_("STR_CMD", "⌘ Cmd") //use narrow no-break space U+202F here
|
||||
#define STR_CTRL_MAC NC_("STR_CTRL_MAC", "⌃ Ctrl")
|
||||
#define STR_CTRL NC_("STR_CTRL", "Ctrl")
|
||||
#define STR_SHIFT NC_("STR_SHIFT", "⇧ Shift") //use narrow no-break space U+202F here
|
||||
#define STR_Alt NC_("STR_CMD", "Alt")
|
||||
#define STR_Option NC_("STR_CTRL", "⌥ Opt") //use narrow no-break space U+202F here
|
||||
|
||||
|
||||
+1
-2
@@ -54,8 +54,7 @@ const std::pair<TranslateId, sal_uInt16> SID_LANGUAGE_OPTIONS_RES[] =
|
||||
{ NC_("SID_LANGUAGE_OPTIONS_RES", "Searching in Japanese"), RID_SVXPAGE_JSEARCH_OPTIONS },
|
||||
{ NC_("SID_LANGUAGE_OPTIONS_RES", "Asian Layout"), RID_SVXPAGE_ASIAN_LAYOUT },
|
||||
{ NC_("SID_LANGUAGE_OPTIONS_RES", "Complex Text Layout"), RID_SVXPAGE_OPTIONS_CTL },
|
||||
{ NC_("SID_LANGUAGE_OPTIONS_RES", "LanguageTool Server"), RID_SVXPAGE_LANGTOOL_OPTIONS },
|
||||
{ NC_("SID_LANGUAGE_OPTIONS_RES", "DeepL Server"), RID_SVXPAGE_DEEPL_OPTIONS }
|
||||
{ NC_("SID_LANGUAGE_OPTIONS_RES", "LanguageTool Server"), RID_SVXPAGE_LANGTOOL_OPTIONS }
|
||||
};
|
||||
|
||||
const std::pair<TranslateId, sal_uInt16> SID_INET_DLG_RES[] =
|
||||
|
||||
@@ -10,9 +10,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <tools/link.hxx>
|
||||
#include <vcl/weld/Button.hxx>
|
||||
#include <vcl/weld/DialogController.hxx>
|
||||
#include <vcl/weld/TreeView.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <vcl/weld/Window.hxx>
|
||||
|
||||
class WidgetTestDialog final : public weld::GenericDialogController
|
||||
{
|
||||
|
||||
@@ -11,6 +11,8 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
|
||||
from uitest.uihelper.common import get_state_as_dict
|
||||
from com.sun.star.awt import KeyEvent
|
||||
from com.sun.star.awt import Key
|
||||
from com.sun.star.ui import GlobalAcceleratorConfiguration
|
||||
from com.sun.star.ui import ModuleAcceleratorConfiguration
|
||||
from com.sun.star.container import NoSuchElementException
|
||||
|
||||
def select_key(xShortcuts, key_name):
|
||||
@@ -70,30 +72,29 @@ class Test(UITestCase):
|
||||
with self.ui_test.create_doc_in_start_center("writer") as xComponent:
|
||||
# Set a shortcut on the global scope
|
||||
with self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog") as xDialog:
|
||||
self.assign_key(xDialog, "office", "F7", ".uno:Credits")
|
||||
self.assign_key(xDialog, "office", "F7", "Credits Online")
|
||||
|
||||
# Check that the key made it into the global config
|
||||
xGlobalAccelCfg = self.xContext.ServiceManager.createInstance(
|
||||
'com.sun.star.ui.GlobalAcceleratorConfiguration')
|
||||
xGlobalAccelCfg = GlobalAcceleratorConfiguration.create(self.xContext)
|
||||
xKeyEvent = KeyEvent()
|
||||
xKeyEvent.KeyCode = Key.F7
|
||||
self.assertEqual(xGlobalAccelCfg.getCommandByKeyEvent(xKeyEvent), ".uno:Credits")
|
||||
|
||||
# Set a shortcut on the module scope
|
||||
with self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog") as xDialog:
|
||||
self.assign_key(xDialog, "module", "F8", ".uno:EditBookmark")
|
||||
self.assign_key(xDialog, "module", "F8", "Bookmark")
|
||||
|
||||
# Check that the key made it into the module config
|
||||
xModuleAccelCfg = self.xContext.ServiceManager.createInstanceWithArguments(
|
||||
'com.sun.star.ui.ModuleAcceleratorConfiguration',
|
||||
('com.sun.star.text.TextDocument',))
|
||||
xModuleAccelCfg = ModuleAcceleratorConfiguration.createWithModuleIdentifier(
|
||||
self.xContext,
|
||||
'com.sun.star.text.TextDocument')
|
||||
xKeyEvent = KeyEvent()
|
||||
xKeyEvent.KeyCode = Key.F8
|
||||
self.assertEqual(xModuleAccelCfg.getCommandByKeyEvent(xKeyEvent), ".uno:EditBookmark")
|
||||
self.assertEqual(xModuleAccelCfg.getCommandByKeyEvent(xKeyEvent), ".uno:InsertBookmark")
|
||||
|
||||
# Set a shortcut on the document scope
|
||||
with self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog") as xDialog:
|
||||
self.assign_key(xDialog, "Untitled 1", "F9", ".uno:OptionsSecurityDialog")
|
||||
self.assign_key(xDialog, "Untitled 1", "F9", "Security Options")
|
||||
|
||||
# Check that the key made it into the document config
|
||||
xDocAccelCfg = xComponent.getUIConfigurationManager().getShortCutManager()
|
||||
@@ -131,7 +132,7 @@ class Test(UITestCase):
|
||||
with self.ui_test.create_doc_in_start_center("writer") as xDoc1, \
|
||||
self.ui_test.load_empty_file("writer"), \
|
||||
self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog") as xDialog:
|
||||
self.assign_key(xDialog, "Untitled 1", "F7", ".uno:Credits")
|
||||
self.assign_key(xDialog, "Untitled 1", "F7", "Credits Online")
|
||||
xFrame1 = xDoc1.getCurrentController().getFrame()
|
||||
self.xUITest.executeCommandForProvider(".uno:CloseDoc", xFrame1)
|
||||
|
||||
@@ -143,7 +144,7 @@ class Test(UITestCase):
|
||||
with self.ui_test.create_doc_in_start_center("writer") as xComponent:
|
||||
with self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog") as xDialog:
|
||||
# Assign a key
|
||||
self.assign_key(xDialog, "Untitled 1", "F7", ".uno:Credits")
|
||||
self.assign_key(xDialog, "Untitled 1", "F7", "Credits Online")
|
||||
# … but then press reset before pressing OK
|
||||
xReset = xDialog.getChild("AccelConfigPage").getChild("reset")
|
||||
xReset.executeAction("CLICK", tuple())
|
||||
@@ -188,13 +189,13 @@ class Test(UITestCase):
|
||||
self.ui_test.load_empty_file("writer") as xDoc2:
|
||||
with self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog") as xDialog:
|
||||
# Set a shortcut on the global scope
|
||||
self.assign_key(xDialog, "office", "F7", ".uno:EditBookmark")
|
||||
self.assign_key(xDialog, "office", "F7", "Bookmark")
|
||||
# Set a shortcut on the module scope
|
||||
self.assign_key(xDialog, "module", "F7", ".uno:Credits")
|
||||
self.assign_key(xDialog, "module", "F7", "Credits Online")
|
||||
# Set a shortcut in the first document
|
||||
self.assign_key(xDialog, "Untitled 1", "F7", "Spelling")
|
||||
# Set a shortcut in the second document
|
||||
self.assign_key(xDialog, "Untitled 2", "F7", ".uno:OptionsSecurityDialog")
|
||||
self.assign_key(xDialog, "Untitled 2", "F7", "Security Options")
|
||||
|
||||
# Switch back to the first document and make sure the binding is still in the list
|
||||
xAcceleratorPage = xDialog.getChild("AccelConfigPage")
|
||||
@@ -206,15 +207,14 @@ class Test(UITestCase):
|
||||
"Spelling")
|
||||
|
||||
# Check that all the accelerators made it into the configs
|
||||
xGlobalAccelCfg = self.xContext.ServiceManager.createInstance(
|
||||
'com.sun.star.ui.GlobalAcceleratorConfiguration')
|
||||
xGlobalAccelCfg = GlobalAcceleratorConfiguration.create(self.xContext)
|
||||
xKeyEvent = KeyEvent()
|
||||
xKeyEvent.KeyCode = Key.F7
|
||||
self.assertEqual(xGlobalAccelCfg.getCommandByKeyEvent(xKeyEvent), ".uno:EditBookmark")
|
||||
self.assertEqual(xGlobalAccelCfg.getCommandByKeyEvent(xKeyEvent), ".uno:InsertBookmark")
|
||||
|
||||
xModuleAccelCfg = self.xContext.ServiceManager.createInstanceWithArguments(
|
||||
'com.sun.star.ui.ModuleAcceleratorConfiguration',
|
||||
('com.sun.star.text.TextDocument',))
|
||||
xModuleAccelCfg = ModuleAcceleratorConfiguration.createWithModuleIdentifier(
|
||||
self.xContext,
|
||||
'com.sun.star.text.TextDocument')
|
||||
self.assertEqual(xModuleAccelCfg.getCommandByKeyEvent(xKeyEvent), ".uno:Credits")
|
||||
|
||||
xDocAccelCfg = xDoc1.getUIConfigurationManager().getShortCutManager()
|
||||
@@ -225,4 +225,30 @@ class Test(UITestCase):
|
||||
self.assertEqual(xDocAccelCfg.getCommandByKeyEvent(xKeyEvent),
|
||||
".uno:OptionsSecurityDialog")
|
||||
|
||||
def test_start_center(self):
|
||||
# Try opening the customization dialog from the start center
|
||||
with self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog") as xDialog:
|
||||
select_keyboard_tab(xDialog)
|
||||
|
||||
xAcceleratorPage = xDialog.getChild("AccelConfigPage")
|
||||
|
||||
# All of the radio controls apart from the global one should be hidden
|
||||
xGlobal = xAcceleratorPage.getChild("office")
|
||||
self.assertEqual(get_state_as_dict(xGlobal)["Visible"], "true")
|
||||
xModule = xAcceleratorPage.getChild("module")
|
||||
self.assertEqual(get_state_as_dict(xModule)["Visible"], "false")
|
||||
xDocument = xAcceleratorPage.getChild("document")
|
||||
self.assertEqual(get_state_as_dict(xDocument)["Visible"], "false")
|
||||
xScope = xAcceleratorPage.getChild("savein")
|
||||
self.assertEqual(get_state_as_dict(xScope)["Visible"], "false")
|
||||
|
||||
# Assign a key
|
||||
self.assign_key(xDialog, "office", "F7", "Edit Macros")
|
||||
|
||||
# Check that the key made it into the global config
|
||||
xGlobalAccelCfg = GlobalAcceleratorConfiguration.create(self.xContext)
|
||||
xKeyEvent = KeyEvent()
|
||||
xKeyEvent.KeyCode = Key.F7
|
||||
self.assertEqual(xGlobalAccelCfg.getCommandByKeyEvent(xKeyEvent), ".uno:BasicIDEAppear")
|
||||
|
||||
# vim: set shiftwidth=4 softtabstop=4 expandtab:
|
||||
|
||||
@@ -93,9 +93,10 @@ class Test(UITestCase):
|
||||
floatWindow = self.xUITest.getFloatWindow()
|
||||
paletteSelector = floatWindow.getChild("palette_listbox")
|
||||
select_by_text(paletteSelector, "Theme colors")
|
||||
colorSet = floatWindow.getChild("colorset")
|
||||
# 4 would be accent1, +12 is the first from the effect variants.
|
||||
colorSet.executeAction("CHOOSE", mkPropertyValues({"POS": "16"}))
|
||||
colorIconView = floatWindow.getChild("coloriconview")
|
||||
# 3 would be accent1, +12 is the first from the effect variants.
|
||||
colorIconView.executeAction("SELECT", mkPropertyValues({"POS": "15"}))
|
||||
colorIconView.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
|
||||
|
||||
# Then make sure the doc model has the correct color theme index:
|
||||
drawPage = component.getDrawPages()[0]
|
||||
@@ -160,5 +161,36 @@ class Test(UITestCase):
|
||||
# i.e. the auto color lost its alpha component and appeared as white.
|
||||
self.assertEqual(get_state_as_dict(xFontColorLB)["Text"], "Automatic")
|
||||
|
||||
def testTdf152396CharStyleNameSubFamily(self):
|
||||
# tdf#152396: an extended style (say a width such as "Condensed")
|
||||
# chosen in the Character dialog must be stored as the typographic
|
||||
# subfamily (CharFontStyleName), not silently dropped because only the
|
||||
# family name is unchanged.
|
||||
with self.ui_test.create_doc_in_start_center("writer") as component:
|
||||
doc = self.xUITest.getTopFocusWindow()
|
||||
editWin = doc.getChild("writer_edit")
|
||||
editWin.executeAction("TYPE", mkPropertyValues({"TEXT": "t"}))
|
||||
self.xUITest.executeCommand(".uno:SelectAll")
|
||||
|
||||
# Choose an extended style name on the Fonts tab.
|
||||
with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog:
|
||||
select_pos(xDialog.getChild("tabcontrol"), "0")
|
||||
xStyle = xDialog.getChild("cbWestStyle")
|
||||
xStyle.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"}))
|
||||
xStyle.executeAction("TYPE", mkPropertyValues({"TEXT": "Condensed"}))
|
||||
|
||||
# The chosen subfamily reaches the model. Without the fix the
|
||||
# style-name-only change was dropped and this was an empty string.
|
||||
paragraph = component.Text.createEnumeration().nextElement()
|
||||
portion = paragraph.createEnumeration().nextElement()
|
||||
self.assertEqual(portion.CharFontStyleName, "Condensed")
|
||||
|
||||
# Reopening the dialog shows the stored subfamily, not a
|
||||
# weight/posture-derived name.
|
||||
with self.ui_test.execute_dialog_through_command(".uno:FontDialog", close_button="cancel") as xDialog:
|
||||
select_pos(xDialog.getChild("tabcontrol"), "0")
|
||||
xStyle = xDialog.getChild("cbWestStyle")
|
||||
self.assertEqual(get_state_as_dict(xStyle)["Text"], "Condensed")
|
||||
|
||||
|
||||
# vim: set shiftwidth=4 softtabstop=4 expandtab:
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
|
||||
#
|
||||
# This file is part of the LibreOffice project.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
from uitest.framework import UITestCase
|
||||
from uitest.uihelper.common import get_state_as_dict, type_text
|
||||
from libreoffice.uno.propertyvalue import mkPropertyValues
|
||||
|
||||
class EditDictionaryFilterTest(UITestCase):
|
||||
def test_dictionary_live_filter(self):
|
||||
with self.ui_test.create_doc_in_start_center("writer"):
|
||||
# 1. Open Tools -> Options -> Language Settings -> Writing Aids
|
||||
with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog", close_button="cancel") as xOptionsDlg:
|
||||
xPages = xOptionsDlg.getChild("pages")
|
||||
xLangSettings = xPages.getChild('2') # Language Settings
|
||||
xLangSettings.executeAction("EXPAND", tuple())
|
||||
xWritingAids = xLangSettings.getChild('1') # Writing Aids
|
||||
xWritingAids.executeAction("SELECT", tuple())
|
||||
|
||||
dictionaries = xOptionsDlg.getChild("lingudicts")
|
||||
hasEditableDictionary = False
|
||||
for i in dictionaries.getChildren():
|
||||
entry = dictionaries.getChild(i)
|
||||
entry_label = get_state_as_dict(entry)["Text"]
|
||||
if entry_label == "List of Ignored Words [All]":
|
||||
hasEditableDictionary = True
|
||||
entry.executeAction("SELECT", tuple())
|
||||
break
|
||||
|
||||
self.assertTrue(hasEditableDictionary, "No editable dictionary found")
|
||||
|
||||
# 2. Click "Edit..." button under User-defined dictionaries
|
||||
xEditDictBtn = xOptionsDlg.getChild("lingudictsedit")
|
||||
|
||||
with self.ui_test.execute_blocking_action(xEditDictBtn.executeAction, args=("CLICK", ()), close_button="close") as xDictDlg:
|
||||
xWordInput = xDictDlg.getChild("word")
|
||||
xWordsList = xDictDlg.getChild("words")
|
||||
|
||||
# 3. Add a new test word to ensure there is something to filter
|
||||
xWordInput.executeAction("TYPE", mkPropertyValues({"TEXT": "uitestword"}))
|
||||
xNewBtn = xDictDlg.getChild("newreplace")
|
||||
xNewBtn.executeAction("CLICK", tuple())
|
||||
|
||||
# 4. Prove the filter HIDES words (type gibberish)
|
||||
xWordInput.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"}))
|
||||
xWordInput.executeAction("TYPE", mkPropertyValues({"TEXT": "zzxyy"}))
|
||||
|
||||
children_count = int(get_state_as_dict(xWordsList)["Children"])
|
||||
self.assertEqual(children_count, 0, "Filter should hide words and return 0 matches for gibberish")
|
||||
|
||||
# 5. Prove the filter FINDS the correct word
|
||||
xWordInput.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"}))
|
||||
xWordInput.executeAction("TYPE", mkPropertyValues({"TEXT": "uitest"}))
|
||||
|
||||
children_count = int(get_state_as_dict(xWordsList)["Children"])
|
||||
self.assertTrue(children_count >= 1, "Filter should return at least 1 match for prefix")
|
||||
|
||||
# 6. Safe Clean up: Filter for the exact word first so it's guaranteed at POS: 0
|
||||
xWordInput.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"}))
|
||||
xWordInput.executeAction("TYPE", mkPropertyValues({"TEXT": "uitestword"}))
|
||||
|
||||
xDelBtn = xDictDlg.getChild("delete")
|
||||
xDelBtn.executeAction("CLICK", tuple())
|
||||
|
||||
# vim: set shiftwidth=4 softtabstop=4 expandtab:
|
||||
@@ -0,0 +1,360 @@
|
||||
# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
|
||||
#
|
||||
# This file is part of the LibreOffice project.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
|
||||
from com.sun.star.beans import PropertyValue
|
||||
from com.sun.star.script.provider import ScriptURIHelper
|
||||
from com.sun.star.ucb import SimpleFileAccess
|
||||
from libreoffice.uno.eventlistener import EventListener
|
||||
from uitest.framework import UITestCase
|
||||
from uitest.test import DEFAULT_SLEEP
|
||||
from uitest.uihelper.common import get_state_as_dict, type_text, mkPropertyValues
|
||||
import uno
|
||||
|
||||
import contextlib
|
||||
import tempfile
|
||||
import time
|
||||
import os
|
||||
|
||||
|
||||
def get_user_script_directory(context):
|
||||
uriHelper = ScriptURIHelper.create(context, "Python", "user")
|
||||
uri = uriHelper.getRootStorageURI()
|
||||
return uno.fileUrlToSystemPath(uri)
|
||||
|
||||
|
||||
def generate_test_script_for_directory(directory):
|
||||
# Generate a python script that creates a file in the given directory
|
||||
return f"""
|
||||
import os.path
|
||||
|
||||
def MyMacro():
|
||||
with open(os.path.join(r'{directory}', 'script-ran'), 'x'):
|
||||
pass
|
||||
"""
|
||||
|
||||
|
||||
class MacroManagerTest(UITestCase):
|
||||
def find_child_node(self, xNode, name):
|
||||
# Find the child node with the given name
|
||||
try:
|
||||
return next(x for x in map(lambda name: xNode.getChild(name),
|
||||
xNode.getChildren())
|
||||
if get_state_as_dict(x)["Text"] == name)
|
||||
except StopIteration:
|
||||
self.fail(f"Couldn’t find tree child {name}")
|
||||
|
||||
def select_tree_node(self, xNode, *parts):
|
||||
for i, part in enumerate(parts):
|
||||
if i > 0:
|
||||
xNode.executeAction("EXPAND", tuple())
|
||||
|
||||
xNode = self.find_child_node(xNode, part)
|
||||
|
||||
xNode.executeAction("SELECT", tuple())
|
||||
|
||||
return xNode
|
||||
|
||||
def select_macro(self, xDialog, *parts):
|
||||
self.select_tree_node(xDialog.getChild("scriptcontainers"), *parts[0:-1])
|
||||
self.select_tree_node(xDialog.getChild("scripts"), parts[-1])
|
||||
|
||||
def run_macro(self, *parts):
|
||||
with self.ui_test.execute_dialog_through_command(".uno:MacroManager",
|
||||
close_button="run") as xDialog:
|
||||
self.select_macro(xDialog, *parts)
|
||||
|
||||
def run_user_script(self):
|
||||
script_dir = get_user_script_directory(self.xContext)
|
||||
os.makedirs(script_dir, exist_ok=True)
|
||||
|
||||
# Create a temporary directory in the script directory to contain our test script
|
||||
with tempfile.TemporaryDirectory(dir=script_dir) as temp_script_dir:
|
||||
# Create a temporary directory to create the check file in
|
||||
with tempfile.TemporaryDirectory() as check_file_dir:
|
||||
# Create a script with a known name
|
||||
with open(os.path.join(temp_script_dir, "MyScript.py"), "w", encoding="utf-8") as f:
|
||||
print(generate_test_script_for_directory(check_file_dir), file=f)
|
||||
|
||||
self.run_macro("My Macros", "Python", os.path.basename(temp_script_dir), "MyScript",
|
||||
"MyMacro")
|
||||
|
||||
# Return whether the test file was created
|
||||
return os.path.exists(os.path.join(check_file_dir, 'script-ran'))
|
||||
|
||||
def test_delete(self):
|
||||
# Create a new BASIC library using the macro manager
|
||||
with EventListener(self.xContext, "OnNew") as event:
|
||||
with self.ui_test.execute_dialog_through_command(".uno:MacroManager",
|
||||
close_button=
|
||||
"librarymoduledialogedit") \
|
||||
as xDialog:
|
||||
xContainers = xDialog.getChild("scriptcontainers")
|
||||
xStandard = self.select_tree_node(xContainers, "My Macros", "Basic", "Standard")
|
||||
|
||||
# Delete all other modules in the library. If we don’t do this then the BASIC editor
|
||||
# will create an EditorWindow for every module and we won’t be able get access to
|
||||
# the one we want.
|
||||
xDelete = xDialog.getChild("librarymoduledialogdelete")
|
||||
xStandard.executeAction("EXPAND", tuple())
|
||||
while get_state_as_dict(xStandard)["Children"] != '0':
|
||||
xStandard.getChild('0').executeAction("SELECT", tuple())
|
||||
with self.ui_test.execute_blocking_action(xDelete.executeAction,
|
||||
args=("CLICK", tuple()),
|
||||
close_button="yes") as xConfirm:
|
||||
pass
|
||||
|
||||
xNewModule = xDialog.getChild("newmodule")
|
||||
with self.ui_test.execute_blocking_action(xNewModule.executeAction,
|
||||
args=("CLICK", tuple()),
|
||||
close_button="ok") as xConfirm:
|
||||
xNameEntry = xConfirm.getChild("name_entry")
|
||||
type_text(xNameEntry, "TestDelete")
|
||||
|
||||
self.select_tree_node(xContainers, "My Macros", "Basic", "Standard", "TestDelete")
|
||||
|
||||
while not event.executed:
|
||||
time.sleep(DEFAULT_SLEEP)
|
||||
|
||||
self.xUITest.executeCommand(".uno:SelectAll")
|
||||
|
||||
xEditorWindow = self.xUITest.getTopFocusWindow().getChild("EditorWindow")
|
||||
|
||||
code = "\n\n".join(map(lambda x: f"Sub {x}\nEnd Sub", ["first", "middle", "last"]))
|
||||
|
||||
for line in code.splitlines():
|
||||
type_text(xEditorWindow, line)
|
||||
xEditorWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
|
||||
|
||||
text = get_state_as_dict(xEditorWindow)["Text"]
|
||||
self.assertFalse(text.find("Sub middle") == -1)
|
||||
|
||||
# Open the macro manager
|
||||
with self.ui_test.execute_dialog_through_command(".uno:MacroManager",
|
||||
close_button="close") as xDialog:
|
||||
self.select_macro(xDialog, "My Macros", "Basic", "Standard", "TestDelete", "middle")
|
||||
|
||||
# Delete the middle macro
|
||||
xDelete = xDialog.getChild("macrodelete")
|
||||
with self.ui_test.execute_blocking_action(xDelete.executeAction, ("CLICK", tuple()),
|
||||
close_button="yes"):
|
||||
pass
|
||||
|
||||
# Make sure the macro isn’t in the list any more
|
||||
xScripts = xDialog.getChild("scripts")
|
||||
self.assertEqual(get_state_as_dict(xScripts)["Children"], '2')
|
||||
self.assertEqual(get_state_as_dict(xScripts.getChild(0))["Text"], "first")
|
||||
self.assertEqual(get_state_as_dict(xScripts.getChild(1))["Text"], "last")
|
||||
|
||||
# Make sure the macro has disappeared from the macro editor source code
|
||||
text = get_state_as_dict(xEditorWindow)["Text"]
|
||||
self.assertEqual(text.find("Sub middle"), -1)
|
||||
|
||||
def test_start_center(self):
|
||||
# Try running a script directly from the start center. See tdf#171924
|
||||
self.assertTrue(self.run_user_script())
|
||||
|
||||
def test_embedded_script(self):
|
||||
# Create a temporary directory to create the check file in
|
||||
with tempfile.TemporaryDirectory() as check_file_dir:
|
||||
# Create a new document with a temporary filename and add a test script to it
|
||||
with tempfile.NamedTemporaryFile(suffix=".odt") as doc_file:
|
||||
with self.ui_test.create_doc_in_start_center("writer") as xComponent:
|
||||
xFileAccess = SimpleFileAccess.create(self.xContext)
|
||||
xFileAccess.createFolder("vnd.sun.star.tdoc:/1/Scripts/python")
|
||||
|
||||
with tempfile.NamedTemporaryFile(suffix=".py", mode="w+",
|
||||
encoding="utf-8") as script_file:
|
||||
print(generate_test_script_for_directory(check_file_dir),
|
||||
file=script_file)
|
||||
script_file.flush()
|
||||
|
||||
xFileAccess.copy(uno.systemPathToFileUrl(script_file.name),
|
||||
"vnd.sun.star.tdoc:/1/Scripts/python/MyScript.py")
|
||||
|
||||
# Save the document to the temporary file
|
||||
save_opts = (
|
||||
PropertyValue(Name="Overwrite", Value=True),
|
||||
PropertyValue(Name="FilterName", Value="writer8"),
|
||||
)
|
||||
xComponent.storeAsURL(uno.systemPathToFileUrl(doc_file.name), save_opts)
|
||||
|
||||
# Open the document we just created
|
||||
with self.ui_test.load_file(uno.systemPathToFileUrl(doc_file.name)):
|
||||
# We should be able to run user macros even though we’re looking at a document
|
||||
# with macros in it
|
||||
self.assertTrue(self.run_user_script())
|
||||
|
||||
# We shouldn’t be able to run the embedded script because the security policy
|
||||
# disallows it
|
||||
with contextlib.ExitStack() as stack:
|
||||
xDialog = stack.enter_context(
|
||||
self.ui_test.execute_dialog_through_command(".uno:MacroManager",
|
||||
close_button="run"))
|
||||
self.select_macro(xDialog, os.path.basename(doc_file.name), "Python",
|
||||
"MyScript", "MyMacro")
|
||||
# We want to start the EventListener for the blocking action of showing the
|
||||
# error dialog *after* creating the run macro dialog so that it doesn’t pick
|
||||
# up the wrong event.
|
||||
with self.ui_test.execute_blocking_action(stack.close):
|
||||
pass
|
||||
|
||||
self.assertFalse(os.path.exists(os.path.join(check_file_dir, 'script-ran')))
|
||||
|
||||
# Temporarily disable macro security
|
||||
with self.ui_test.set_config("/org.openoffice.Office.Common/Security/Scripting/"
|
||||
"MacroSecurityLevel", 0):
|
||||
with self.ui_test.load_file(uno.systemPathToFileUrl(doc_file.name)):
|
||||
# Now we should be able to run the embedded script
|
||||
self.run_macro(os.path.basename(doc_file.name), "Python", "MyScript",
|
||||
"MyMacro")
|
||||
self.assertTrue(os.path.exists(os.path.join(check_file_dir, 'script-ran')))
|
||||
|
||||
# Tests copying and pasting Python scripts into an empty node, an
|
||||
# unexpanded node and an expanded node
|
||||
def test_copy_paste(self):
|
||||
with contextlib.ExitStack() as stack:
|
||||
script_dir = get_user_script_directory(self.xContext)
|
||||
os.makedirs(script_dir, exist_ok=True)
|
||||
|
||||
# Make a temporary directory with a script to copy from
|
||||
src_dir = stack.enter_context(tempfile.TemporaryDirectory(dir=script_dir))
|
||||
with open(os.path.join(src_dir, "MyScript.py"), "w", encoding='utf-8') as f:
|
||||
print("def MyMacro():\n pass", file=f)
|
||||
|
||||
# Make an empty directory
|
||||
empty_dir = stack.enter_context(tempfile.TemporaryDirectory(dir=script_dir))
|
||||
|
||||
# Make a directory and script for the unexpanded node
|
||||
unexpanded_dir = stack.enter_context(tempfile.TemporaryDirectory(dir=script_dir))
|
||||
with open(os.path.join(unexpanded_dir, "MyOtherScript.py"), "w", encoding='utf-8') as f:
|
||||
print("def MyMacro():\n pass", file=f)
|
||||
|
||||
# Make a directory and script for the expanded node
|
||||
expanded_dir = stack.enter_context(tempfile.TemporaryDirectory(dir=script_dir))
|
||||
with open(os.path.join(expanded_dir, "MyOtherScript.py"), "w", encoding='utf-8') as f:
|
||||
print("def MyMacro():\n pass", file=f)
|
||||
|
||||
xDialog = stack.enter_context(
|
||||
self.ui_test.execute_dialog_through_command(".uno:MacroManager",
|
||||
close_button="close"))
|
||||
xContainers = xDialog.getChild("scriptcontainers")
|
||||
|
||||
# Copy the source script
|
||||
source_node = self.select_tree_node(
|
||||
xContainers, "My Macros", "Python", os.path.basename(src_dir), "MyScript")
|
||||
copy_button = xDialog.getChild("modulecopy")
|
||||
copy_button.executeAction("CLICK", tuple())
|
||||
|
||||
python_node = self.select_tree_node(xContainers, "My Macros", "Python")
|
||||
|
||||
# Paste into the empty node
|
||||
empty_node = self.find_child_node(python_node, os.path.basename(empty_dir))
|
||||
empty_node.executeAction("SELECT", tuple())
|
||||
paste_button = xDialog.getChild("modulepaste")
|
||||
paste_button.executeAction("CLICK", tuple())
|
||||
|
||||
# The new node should be selected
|
||||
self.assertEqual(get_state_as_dict(xContainers)["SelectEntryText"], "MyScript")
|
||||
# The empty node should now have exactly one child
|
||||
empty_node = self.find_child_node(python_node, os.path.basename(empty_dir))
|
||||
self.assertEqual(get_state_as_dict(empty_node)["Children"], "1")
|
||||
pasted_node = empty_node.getChild("0")
|
||||
self.assertEqual(get_state_as_dict(pasted_node)["Text"], "MyScript")
|
||||
# The file should have been created
|
||||
self.assertTrue(os.path.exists(os.path.join(empty_dir, "MyScript.py")))
|
||||
|
||||
# Paste into the unexpanded node
|
||||
unexpanded_node = self.find_child_node(python_node, os.path.basename(unexpanded_dir))
|
||||
unexpanded_node.executeAction("SELECT", tuple())
|
||||
paste_button.executeAction("CLICK", tuple())
|
||||
|
||||
# The new node should be selected
|
||||
self.assertEqual(get_state_as_dict(xContainers)["SelectEntryText"], "MyScript")
|
||||
# The newly expanded node should now have exactly two children
|
||||
unexpanded_node = self.find_child_node(python_node, os.path.basename(unexpanded_dir))
|
||||
self.assertEqual(get_state_as_dict(unexpanded_node)["Children"], "2")
|
||||
child_names = list(sorted(get_state_as_dict(unexpanded_node.getChild(str(i)))["Text"]
|
||||
for i in range(2)))
|
||||
self.assertEqual(child_names, ["MyOtherScript", "MyScript"])
|
||||
|
||||
# Make the expanded node live up to its name
|
||||
expanded_node = self.find_child_node(python_node, os.path.basename(expanded_dir))
|
||||
expanded_node.executeAction("EXPAND", tuple())
|
||||
|
||||
# Paste into the expanded node
|
||||
expanded_node = self.find_child_node(python_node, os.path.basename(expanded_dir))
|
||||
expanded_node.executeAction("SELECT", tuple())
|
||||
paste_button.executeAction("CLICK", tuple())
|
||||
|
||||
# The new node should be selected
|
||||
self.assertEqual(get_state_as_dict(xContainers)["SelectEntryText"], "MyScript")
|
||||
# The expanded node should now have exactly two children
|
||||
expanded_node = self.find_child_node(python_node, os.path.basename(expanded_dir))
|
||||
self.assertEqual(get_state_as_dict(expanded_node)["Children"], "2")
|
||||
child_names = list(sorted(get_state_as_dict(expanded_node.getChild(str(i)))["Text"]
|
||||
for i in range(2)))
|
||||
self.assertEqual(child_names, ["MyOtherScript", "MyScript"])
|
||||
|
||||
# Tests copying a Python script into a Writer document and back
|
||||
def test_copy_to_document(self):
|
||||
with self.ui_test.create_doc_in_start_center("writer") as xComponent:
|
||||
script_dir = get_user_script_directory(self.xContext)
|
||||
os.makedirs(script_dir, exist_ok=True)
|
||||
|
||||
# Make a temporary directory with a script to copy from
|
||||
with tempfile.TemporaryDirectory(dir=script_dir) as src_dir:
|
||||
with open(os.path.join(src_dir, "MyScript.py"), "w", encoding='utf-8') as f:
|
||||
print("def MyMacro():\n"
|
||||
" XSCRIPTCONTEXT.getDocument().getText()."
|
||||
"setString(\"test_copy_to_document\")",
|
||||
file=f)
|
||||
|
||||
# Copy the script into the document using the dialog
|
||||
with self.ui_test.execute_dialog_through_command(".uno:MacroManager",
|
||||
close_button="close") as xDialog:
|
||||
xContainers = xDialog.getChild("scriptcontainers")
|
||||
self.select_tree_node(xContainers, "My Macros", "Python",
|
||||
os.path.basename(src_dir), "MyScript")
|
||||
xDialog.getChild("modulecopy").executeAction("CLICK", tuple())
|
||||
|
||||
self.select_tree_node(xContainers, "Untitled 1", "Python")
|
||||
xDialog.getChild("modulepaste").executeAction("CLICK", tuple())
|
||||
|
||||
# Make sure the script now appears in the tree
|
||||
xDocumentNode = self.select_tree_node(xContainers, "Untitled 1", "Python")
|
||||
self.assertEqual(get_state_as_dict(xDocumentNode)["Children"], "1")
|
||||
xNewNode = xDocumentNode.getChild("0")
|
||||
self.assertEqual(get_state_as_dict(xNewNode)["Text"], "MyScript")
|
||||
|
||||
# The temporary script in the user directory should now be deleted, so the only
|
||||
# remaining copy of it should be in the document. Let’s try running it.
|
||||
with self.ui_test.execute_dialog_through_command(".uno:MacroManager",
|
||||
close_button="run") as xDialog:
|
||||
xContainers = xDialog.getChild("scriptcontainers")
|
||||
self.select_tree_node(xContainers, "Untitled 1", "Python", "MyScript")
|
||||
|
||||
# Make sure the macro successfully put text into the document
|
||||
self.assertEqual(xComponent.getText().getString(), "test_copy_to_document")
|
||||
|
||||
# Make a temporary directory to copy the script back into
|
||||
with tempfile.TemporaryDirectory(dir=script_dir) as dest_dir:
|
||||
# Copy the script into the temporary directory using the dialog
|
||||
with self.ui_test.execute_dialog_through_command(".uno:MacroManager",
|
||||
close_button="close") as xDialog:
|
||||
xContainers = xDialog.getChild("scriptcontainers")
|
||||
self.select_tree_node(xContainers, "Untitled 1", "Python", "MyScript")
|
||||
xDialog.getChild("modulecopy").executeAction("CLICK", tuple())
|
||||
self.select_tree_node(xContainers, "My Macros", "Python",
|
||||
os.path.basename(dest_dir))
|
||||
xDialog.getChild("modulepaste").executeAction("CLICK", tuple())
|
||||
|
||||
self.assertTrue(os.path.exists(os.path.join(dest_dir, "MyScript.py")))
|
||||
|
||||
|
||||
# vim: set shiftwidth=4 softtabstop=4 expandtab:
|
||||
@@ -10,7 +10,9 @@
|
||||
from uitest.framework import UITestCase
|
||||
from uitest.uihelper.common import get_state_as_dict
|
||||
from libreoffice.uno.propertyvalue import mkPropertyValues
|
||||
from com.sun.star.beans import PropertyValue
|
||||
from com.sun.star.script.provider import ScriptURIHelper
|
||||
from com.sun.star.ucb import SimpleFileAccess
|
||||
import uno
|
||||
|
||||
import tempfile
|
||||
@@ -189,5 +191,75 @@ class PythonMacroOrganizerTest(UITestCase):
|
||||
xScript = xTestLibrary.getChild(0)
|
||||
self.assertEqual(get_state_as_dict(xScript)["Text"], "My Script")
|
||||
|
||||
def test_macros_disabled(self):
|
||||
# Create a new document with a temporary filename and add a test script to it
|
||||
with tempfile.NamedTemporaryFile(suffix=".odt") as doc_file:
|
||||
with self.ui_test.create_doc_in_start_center("writer") as xComponent:
|
||||
xFileAccess = SimpleFileAccess.create(self.xContext)
|
||||
xFileAccess.createFolder("vnd.sun.star.tdoc:/1/Scripts/python")
|
||||
|
||||
with tempfile.NamedTemporaryFile(suffix=".py", mode="w+",
|
||||
encoding="utf-8") as script_file:
|
||||
print("def addHello():\n"
|
||||
" XSCRIPTCONTEXT.getDocument().getText().setString(\"hello\")",
|
||||
file=script_file)
|
||||
script_file.flush()
|
||||
|
||||
xFileAccess.copy(uno.systemPathToFileUrl(script_file.name),
|
||||
"vnd.sun.star.tdoc:/1/Scripts/python/MyScript.py")
|
||||
|
||||
# Save the document to the temporary file
|
||||
save_opts = (
|
||||
PropertyValue(Name="Overwrite", Value=True),
|
||||
PropertyValue(Name="FilterName", Value="writer8"),
|
||||
)
|
||||
xComponent.storeAsURL(uno.systemPathToFileUrl(doc_file.name), save_opts)
|
||||
|
||||
# Helper function to select the macro
|
||||
def select_macro(xDialog):
|
||||
xScripts = xDialog.getChild("scripts")
|
||||
# Find the library for the temporary document
|
||||
xDocLibrary = \
|
||||
next(x for x in map(lambda i: xScripts.getChild(i),
|
||||
range(int(get_state_as_dict(xScripts)["Children"])))
|
||||
if get_state_as_dict(x)["Text"] == os.path.basename(doc_file.name))
|
||||
xDocLibrary.executeAction("EXPAND", tuple())
|
||||
xScript = xDocLibrary.getChild(0)
|
||||
xScript.executeAction("EXPAND", tuple())
|
||||
xMacro = xScript.getChild(0)
|
||||
xMacro.executeAction("SELECT", tuple())
|
||||
|
||||
# Open the document we just created
|
||||
with self.ui_test.load_file(uno.systemPathToFileUrl(doc_file.name)) as xComponent:
|
||||
# We shouldn’t be able to run the embedded script because the security policy
|
||||
# disallows it
|
||||
with self.ui_test.execute_dialog_through_command(
|
||||
".uno:ScriptOrganizer?ScriptOrganizer.Language:string=Python",
|
||||
close_button="close") as xDialog:
|
||||
select_macro(xDialog)
|
||||
|
||||
# Clicking run should pop up a nested modal dialog reporting the problem
|
||||
xRun = xDialog.getChild("ok")
|
||||
with self.ui_test.execute_blocking_action(xRun.executeAction,
|
||||
args=("CLICK", tuple())):
|
||||
pass
|
||||
|
||||
# The macro shouldn’t have run so the document text should still be empty
|
||||
self.assertEqual(xComponent.getText().getString(), "")
|
||||
|
||||
# Temporarily disable macro security
|
||||
with self.ui_test.set_config("/org.openoffice.Office.Common/Security/Scripting/"
|
||||
"MacroSecurityLevel", 0):
|
||||
with self.ui_test.load_file(uno.systemPathToFileUrl(doc_file.name)) as xComponent:
|
||||
# Now we should be able to run the embedded script
|
||||
with self.ui_test.execute_dialog_through_command(
|
||||
".uno:ScriptOrganizer?ScriptOrganizer.Language:string=Python",
|
||||
close_button="ok") as xDialog:
|
||||
select_macro(xDialog)
|
||||
|
||||
# The script should have run so the document should contain the text that it
|
||||
# added
|
||||
self.assertEqual(xComponent.getText().getString(), "hello")
|
||||
|
||||
|
||||
# vim: set shiftwidth=4 softtabstop=4 expandtab:
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
|
||||
#
|
||||
# This file is part of the LibreOffice project.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
|
||||
from uitest.framework import UITestCase
|
||||
from uitest.uihelper.common import get_state_as_dict
|
||||
from libreoffice.uno.propertyvalue import mkPropertyValues
|
||||
from com.sun.star.beans import PropertyValue
|
||||
from com.sun.star.script.provider import ScriptURIHelper
|
||||
from com.sun.star.ucb import SimpleFileAccess
|
||||
import uno
|
||||
|
||||
import contextlib
|
||||
import tempfile
|
||||
import os
|
||||
|
||||
|
||||
def get_user_script_directory(context):
|
||||
uriHelper = ScriptURIHelper.create(context, "Python", "user")
|
||||
uri = uriHelper.getRootStorageURI()
|
||||
return uno.fileUrlToSystemPath(uri)
|
||||
|
||||
|
||||
def generate_test_script_for_directory(directory):
|
||||
# Generate a python script that creates a file in the given directory
|
||||
return f"""
|
||||
import os.path
|
||||
|
||||
def MyMacro():
|
||||
with open(os.path.join(r'{directory}', 'script-ran'), 'x'):
|
||||
pass
|
||||
"""
|
||||
|
||||
|
||||
class RunMacroTest(UITestCase):
|
||||
def select_macro(self, xDialog, *parts):
|
||||
xNode = xDialog.getChild("categories")
|
||||
|
||||
for i, part in enumerate(parts):
|
||||
if i > 0:
|
||||
xNode.executeAction("EXPAND", tuple())
|
||||
|
||||
# Find the node in the tree with this part name
|
||||
xNode = \
|
||||
next(x for x in map(lambda i: xNode.getChild(i),
|
||||
range(int(get_state_as_dict(xNode)["Children"])))
|
||||
if get_state_as_dict(x)["Text"] == part)
|
||||
|
||||
xNode.executeAction("SELECT", tuple())
|
||||
|
||||
def run_macro(self, *parts):
|
||||
with self.ui_test.execute_dialog_through_command(".uno:RunMacro") as xDialog:
|
||||
self.select_macro(xDialog, *parts)
|
||||
|
||||
def run_user_script(self):
|
||||
script_dir = get_user_script_directory(self.xContext)
|
||||
os.makedirs(script_dir, exist_ok=True)
|
||||
|
||||
# Create a temporary directory in the script directory to contain our test script
|
||||
with tempfile.TemporaryDirectory(dir=script_dir) as temp_script_dir:
|
||||
# Create a temporary directory to create the check file in
|
||||
with tempfile.TemporaryDirectory() as check_file_dir:
|
||||
# Create a script with a known name
|
||||
with open(os.path.join(temp_script_dir, "MyScript.py"), "w", encoding="utf-8") as f:
|
||||
print(generate_test_script_for_directory(check_file_dir), file=f)
|
||||
|
||||
self.run_macro("My Macros", os.path.basename(temp_script_dir), "MyScript")
|
||||
|
||||
# Return whether the test file was created
|
||||
return os.path.exists(os.path.join(check_file_dir, 'script-ran'))
|
||||
|
||||
def test_start_center(self):
|
||||
# Try running a script directly from the start center. See tdf#171924
|
||||
self.assertTrue(self.run_user_script())
|
||||
|
||||
def test_embedded_script(self):
|
||||
# Create a temporary directory to create the check file in
|
||||
with tempfile.TemporaryDirectory() as check_file_dir:
|
||||
# Create a new document with a temporary filename and add a test script to it
|
||||
with tempfile.NamedTemporaryFile(suffix=".odt") as doc_file:
|
||||
with self.ui_test.create_doc_in_start_center("writer") as xComponent:
|
||||
xFileAccess = SimpleFileAccess.create(self.xContext)
|
||||
xFileAccess.createFolder("vnd.sun.star.tdoc:/1/Scripts/python")
|
||||
|
||||
with tempfile.NamedTemporaryFile(suffix=".py", mode="w+",
|
||||
encoding="utf-8") as script_file:
|
||||
print(generate_test_script_for_directory(check_file_dir),
|
||||
file=script_file)
|
||||
script_file.flush()
|
||||
|
||||
xFileAccess.copy(uno.systemPathToFileUrl(script_file.name),
|
||||
"vnd.sun.star.tdoc:/1/Scripts/python/MyScript.py")
|
||||
|
||||
# Save the document to the temporary file
|
||||
save_opts = (
|
||||
PropertyValue(Name="Overwrite", Value=True),
|
||||
PropertyValue(Name="FilterName", Value="writer8"),
|
||||
)
|
||||
xComponent.storeAsURL(uno.systemPathToFileUrl(doc_file.name), save_opts)
|
||||
|
||||
# Open the document we just created
|
||||
with self.ui_test.load_file(uno.systemPathToFileUrl(doc_file.name)):
|
||||
# We should be able to run user macros even though we’re looking at a document
|
||||
# with macros in it
|
||||
self.assertTrue(self.run_user_script())
|
||||
|
||||
# We shouldn’t be able to run the embedded script because the security policy
|
||||
# disallows it
|
||||
with contextlib.ExitStack() as stack:
|
||||
xDialog = stack.enter_context(
|
||||
self.ui_test.execute_dialog_through_command(".uno:RunMacro"))
|
||||
self.select_macro(xDialog, os.path.basename(doc_file.name), "MyScript")
|
||||
# We want to start the EventListener for the blocking action of showing the
|
||||
# error dialog *after* creating the run macro dialog so that it doesn’t pick
|
||||
# up the wrong event.
|
||||
with self.ui_test.execute_blocking_action(stack.close):
|
||||
pass
|
||||
|
||||
self.assertFalse(os.path.exists(os.path.join(check_file_dir, 'script-ran')))
|
||||
|
||||
# Temporarily disable macro security
|
||||
with self.ui_test.set_config("/org.openoffice.Office.Common/Security/Scripting/"
|
||||
"MacroSecurityLevel", 0):
|
||||
with self.ui_test.load_file(uno.systemPathToFileUrl(doc_file.name)):
|
||||
# Now we should be able to run the embedded script
|
||||
self.run_macro(os.path.basename(doc_file.name), "MyScript")
|
||||
self.assertTrue(os.path.exists(os.path.join(check_file_dir, 'script-ran')))
|
||||
|
||||
|
||||
# vim: set shiftwidth=4 softtabstop=4 expandtab:
|
||||
@@ -23,7 +23,7 @@ class Test(UITestCase):
|
||||
chartsEntryDefaultColorsEntry.executeAction("SELECT", tuple())
|
||||
|
||||
chartsColors = xDialog.getChild("colors")
|
||||
colorTable = xDialog.getChild("table")
|
||||
colorTable = xDialog.getChild("tableiconview")
|
||||
|
||||
# Chart Data Series default colors
|
||||
dataSeriesDefaultColors = ["004586",
|
||||
@@ -42,7 +42,8 @@ class Test(UITestCase):
|
||||
for i in range(len(dataSeriesDefaultColors)):
|
||||
chartsColorsDataSeriesEntry = chartsColors.getChild(i)
|
||||
chartsColorsDataSeriesEntry.executeAction("SELECT", tuple())
|
||||
self.assertEqual(get_state_as_dict(colorTable)["CurrColorPos"], str(i))
|
||||
self.assertEqual(get_state_as_dict(colorTable)["RGB"], self.hex_to_rgb(dataSeriesDefaultColors[i]))
|
||||
self.assertEqual(get_state_as_dict(colorTable)["SelectedItemPos"], str(i))
|
||||
# ID is the RGB color value in hex
|
||||
self.assertEqual(get_state_as_dict(colorTable)["SelectedItemId"].lower(), dataSeriesDefaultColors[i])
|
||||
|
||||
# vim: set shiftwidth=4 softtabstop=4 expandtab:
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
|
||||
#
|
||||
# This file is part of the LibreOffice project.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
|
||||
from uitest.framework import UITestCase
|
||||
from uitest.uihelper.common import get_state_as_dict
|
||||
|
||||
|
||||
class PageTabTest(UITestCase):
|
||||
# Tests that the “Resize all pages” checkbox is only visible when the dialog is opened from a
|
||||
# Draw or Impress document and not from Writer or Calc. See tdf#173170
|
||||
def test_resize_all_visibility(self):
|
||||
with self.ui_test.create_doc_in_start_center("impress") as xComponent:
|
||||
xTemplate = self.xUITest.getTopFocusWindow()
|
||||
self.ui_test.close_dialog_through_button(xTemplate.getChild("close"))
|
||||
|
||||
with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as xDialog:
|
||||
xResizeCheckBox = xDialog.getChild("checkResizeAllPages")
|
||||
self.assertEqual(get_state_as_dict(xResizeCheckBox)["ReallyVisible"], "true")
|
||||
|
||||
with self.ui_test.create_doc_in_start_center("draw") as xComponent:
|
||||
with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as xDialog:
|
||||
xResizeCheckBox = xDialog.getChild("checkResizeAllPages")
|
||||
self.assertEqual(get_state_as_dict(xResizeCheckBox)["ReallyVisible"], "true")
|
||||
|
||||
with self.ui_test.create_doc_in_start_center("writer") as xComponent:
|
||||
with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog:
|
||||
xResizeCheckBox = xDialog.getChild("checkResizeAllPages")
|
||||
self.assertEqual(get_state_as_dict(xResizeCheckBox)["ReallyVisible"], "false")
|
||||
|
||||
with self.ui_test.create_doc_in_start_center("calc") as xComponent:
|
||||
with self.ui_test.execute_dialog_through_command(".uno:PageFormatDialog") as xDialog:
|
||||
xResizeCheckBox = xDialog.getChild("checkResizeAllPages")
|
||||
self.assertEqual(get_state_as_dict(xResizeCheckBox)["ReallyVisible"], "false")
|
||||
|
||||
|
||||
# vim: set shiftwidth=4 softtabstop=4 expandtab:
|
||||
@@ -55,8 +55,9 @@ class Test(UITestCase):
|
||||
btnColor.executeAction("CLICK", tuple())
|
||||
paletteSelector = xDialog.getChild("paletteselector")
|
||||
select_by_text(paletteSelector, "Theme colors")
|
||||
colorSelector = xDialog.getChild("colorset")
|
||||
colorSelector.executeAction("CHOOSE", mkPropertyValues({"POS": "4"}))
|
||||
colorSelector = xDialog.getChild("coloriconview")
|
||||
colorSelector.executeAction("SELECT", mkPropertyValues({"POS": "3"}))
|
||||
colorSelector.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
|
||||
|
||||
# Then make sure the doc model is updated accordingly:
|
||||
shape = drawPage[0]
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include <comphelper/processfactory.hxx>
|
||||
#include <comphelper/sequenceashashmap.hxx>
|
||||
#include <comphelper/SetFlagContextHelper.hxx>
|
||||
#include <comphelper/scriptbrowse.hxx>
|
||||
#include <comphelper/string.hxx>
|
||||
#include <officecfg/Office/Common.hxx>
|
||||
#include <i18nlangtag/languagetag.hxx>
|
||||
@@ -66,29 +67,6 @@ CommandCategoryListBox::~CommandCategoryListBox() { ClearAll(); }
|
||||
|
||||
void CommandCategoryListBox::ClearAll()
|
||||
{
|
||||
// Clear objects from m_aGroupInfo vector to avoid memory leak
|
||||
for (const auto& It : m_aGroupInfo)
|
||||
{
|
||||
if (It->nKind == SfxCfgKind::GROUP_STYLES && It->pObject)
|
||||
{
|
||||
SfxStyleInfo_Impl* pStyle = static_cast<SfxStyleInfo_Impl*>(It->pObject);
|
||||
delete pStyle;
|
||||
}
|
||||
else if (It->nKind == SfxCfgKind::FUNCTION_SCRIPT && It->pObject)
|
||||
{
|
||||
OUString* pScriptURI = static_cast<OUString*>(It->pObject);
|
||||
delete pScriptURI;
|
||||
}
|
||||
else if (It->nKind == SfxCfgKind::GROUP_SCRIPTCONTAINER && It->pObject)
|
||||
{
|
||||
css::uno::XInterface* xi = static_cast<css::uno::XInterface*>(It->pObject);
|
||||
if (xi != nullptr)
|
||||
{
|
||||
xi->release();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_aGroupInfo.clear();
|
||||
m_xControl->clear();
|
||||
}
|
||||
@@ -132,8 +110,8 @@ void CommandCategoryListBox::Init(const css::uno::Reference<css::uno::XComponent
|
||||
if (nGroupsLength > 0)
|
||||
{
|
||||
// Add the category of "All commands"
|
||||
m_aGroupInfo.push_back(
|
||||
std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_ALLFUNCTIONS, 0));
|
||||
m_aGroupInfo.push_back(std::make_unique<SfxGroupInfo_Impl>(
|
||||
SfxGroupInfo_Data(SfxCfgKindAsIndex<SfxCfgKind::GROUP_ALLFUNCTIONS>), 0));
|
||||
m_xControl->append(weld::toId(m_aGroupInfo.back().get()),
|
||||
CuiResId(RID_CUISTR_ALLFUNCTIONS));
|
||||
}
|
||||
@@ -178,8 +156,8 @@ void CommandCategoryListBox::Init(const css::uno::Reference<css::uno::XComponent
|
||||
{
|
||||
const OUString& rGroupName = a.first;
|
||||
sal_Int16 nGroupID = a.second;
|
||||
m_aGroupInfo.push_back(
|
||||
std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_FUNCTION, nGroupID));
|
||||
m_aGroupInfo.push_back(std::make_unique<SfxGroupInfo_Impl>(
|
||||
SfxGroupInfo_Data(SfxCfgKindAsIndex<SfxCfgKind::GROUP_FUNCTION>), nGroupID));
|
||||
m_xControl->append(weld::toId(m_aGroupInfo.back().get()), rGroupName);
|
||||
}
|
||||
|
||||
@@ -187,14 +165,14 @@ void CommandCategoryListBox::Init(const css::uno::Reference<css::uno::XComponent
|
||||
m_xControl->append_separator(u""_ustr);
|
||||
|
||||
// Add macros category
|
||||
m_aGroupInfo.push_back(
|
||||
std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_SCRIPTCONTAINER, 0, nullptr));
|
||||
m_aGroupInfo.push_back(std::make_unique<SfxGroupInfo_Impl>(
|
||||
SfxGroupInfo_Data(SfxCfgKindAsIndex<SfxCfgKind::GROUP_SCRIPTCONTAINER>), 0));
|
||||
m_xControl->append(weld::toId(m_aGroupInfo.back().get()), CuiResId(RID_CUISTR_MACROS));
|
||||
|
||||
// Add styles category
|
||||
//TODO: last param should contain user data?
|
||||
m_aGroupInfo.push_back(
|
||||
std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_STYLES, 0, nullptr));
|
||||
m_aGroupInfo.push_back(std::make_unique<SfxGroupInfo_Impl>(
|
||||
SfxGroupInfo_Data(SfxCfgKindAsIndex<SfxCfgKind::GROUP_STYLES>), 0));
|
||||
m_xControl->append(weld::toId(m_aGroupInfo.back().get()),
|
||||
CuiResId(RID_CUISTR_GROUP_STYLES));
|
||||
}
|
||||
@@ -251,7 +229,8 @@ void CommandCategoryListBox::FillFunctionsList(
|
||||
if (pCurrentSaveInData)
|
||||
xImage = pCurrentSaveInData->GetImage(rInfo.Command);
|
||||
|
||||
m_aGroupInfo.push_back(std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::FUNCTION_SLOT, 0));
|
||||
m_aGroupInfo.push_back(std::make_unique<SfxGroupInfo_Impl>(
|
||||
SfxGroupInfo_Data(SfxCfgKindAsIndex<SfxCfgKind::FUNCTION_SLOT>), 0));
|
||||
SfxGroupInfo_Impl* pGrpInfo = m_aGroupInfo.back().get();
|
||||
pGrpInfo->sCommand = rInfo.Command;
|
||||
pGrpInfo->sLabel = sUIName;
|
||||
@@ -300,7 +279,7 @@ void CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctio
|
||||
pFunctionListBox->freeze();
|
||||
pFunctionListBox->ClearAll();
|
||||
|
||||
switch (pInfo->nKind)
|
||||
switch (pInfo->getKind())
|
||||
{
|
||||
case SfxCfgKind::GROUP_ALLFUNCTIONS:
|
||||
{
|
||||
@@ -316,7 +295,7 @@ void CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctio
|
||||
if (!pCurrentInfo) //separator
|
||||
continue;
|
||||
|
||||
if (pCurrentInfo->nKind == SfxCfgKind::GROUP_FUNCTION)
|
||||
if (pCurrentInfo->getKind() == SfxCfgKind::GROUP_FUNCTION)
|
||||
{
|
||||
css::uno::Sequence<css::frame::DispatchInformation> lCommands;
|
||||
try
|
||||
@@ -366,20 +345,16 @@ void CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctio
|
||||
|
||||
if (rootNode.is() && rootNode->hasChildNodes())
|
||||
{
|
||||
//We call acquire on the XBrowseNode so that it does not
|
||||
//get autodestructed and become invalid when accessed later.
|
||||
rootNode->acquire();
|
||||
|
||||
m_aGroupInfo.push_back(std::make_unique<SfxGroupInfo_Impl>(
|
||||
SfxCfgKind::GROUP_SCRIPTCONTAINER, 0, static_cast<void*>(rootNode.get())));
|
||||
SfxGroupInfo_Data(SfxCfgKindAsIndex<SfxCfgKind::GROUP_SCRIPTCONTAINER>,
|
||||
rootNode),
|
||||
0));
|
||||
|
||||
// Add main macro groups
|
||||
const css::uno::Sequence<css::uno::Reference<css::script::browse::XBrowseNode>>
|
||||
aChildNodes = rootNode->getChildNodes();
|
||||
const std::vector<css::uno::Reference<css::script::browse::XBrowseNode>> aChildNodes
|
||||
= comphelper::scriptbrowse::getChildNodes(rootNode);
|
||||
for (auto const& childGroup : aChildNodes)
|
||||
{
|
||||
childGroup->acquire();
|
||||
|
||||
if (childGroup->hasChildNodes())
|
||||
{
|
||||
OUString sUIName;
|
||||
@@ -402,7 +377,8 @@ void CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctio
|
||||
}
|
||||
|
||||
m_aGroupInfo.push_back(std::make_unique<SfxGroupInfo_Impl>(
|
||||
SfxCfgKind::GROUP_SCRIPTCONTAINER, 0));
|
||||
SfxGroupInfo_Data(SfxCfgKindAsIndex<SfxCfgKind::GROUP_SCRIPTCONTAINER>),
|
||||
0));
|
||||
std::unique_ptr<weld::TreeIter> xMacroGroup(pFunctionListBox->tree_append(
|
||||
weld::toId(m_aGroupInfo.back().get()), sUIName));
|
||||
|
||||
@@ -442,8 +418,8 @@ void CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctio
|
||||
continue;
|
||||
}
|
||||
|
||||
m_aGroupInfo.push_back(
|
||||
std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_STYLES, 0));
|
||||
m_aGroupInfo.push_back(std::make_unique<SfxGroupInfo_Impl>(
|
||||
SfxGroupInfo_Data(SfxCfgKindAsIndex<SfxCfgKind::GROUP_STYLES>), 0));
|
||||
// pIt.sLabel is Name of the style family
|
||||
std::unique_ptr<weld::TreeIter> xFuncEntry(pFunctionListBox->tree_append(
|
||||
weld::toId(m_aGroupInfo.back().get()), pIt.sLabel));
|
||||
@@ -468,13 +444,15 @@ void CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctio
|
||||
continue;
|
||||
}
|
||||
|
||||
SfxStyleInfo_Impl* pStyle = new SfxStyleInfo_Impl(pStyleIt);
|
||||
auto pStyle = std::make_unique<SfxStyleInfo_Impl>(pStyleIt);
|
||||
|
||||
m_aGroupInfo.push_back(
|
||||
std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_STYLES, 0, pStyle));
|
||||
m_aGroupInfo.push_back(std::make_unique<SfxGroupInfo_Impl>(
|
||||
SfxGroupInfo_Data(SfxCfgKindAsIndex<SfxCfgKind::GROUP_STYLES>,
|
||||
std::move(pStyle)),
|
||||
0));
|
||||
|
||||
m_aGroupInfo.back()->sCommand = pStyle->sCommand;
|
||||
m_aGroupInfo.back()->sLabel = pStyle->sLabel;
|
||||
m_aGroupInfo.back()->sCommand = pStyleIt.sCommand;
|
||||
m_aGroupInfo.back()->sLabel = pStyleIt.sLabel;
|
||||
|
||||
pFunctionListBox->append(weld::toId(m_aGroupInfo.back().get()), sUIName,
|
||||
xFuncEntry.get());
|
||||
@@ -495,8 +473,7 @@ void CommandCategoryListBox::categorySelected(CuiConfigFunctionListBox* pFunctio
|
||||
}
|
||||
default:
|
||||
// Do nothing, the list box will stay empty
|
||||
SAL_INFO("cui.customize",
|
||||
"Ignoring unexpected SfxCfgKind: " << static_cast<int>(pInfo->nKind));
|
||||
SAL_INFO("cui.customize", "Ignoring unexpected SfxCfgKind: " << pInfo->aData.index());
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -522,19 +499,16 @@ void CommandCategoryListBox::addChildren(
|
||||
m_searchOptions.searchString = filterTerm;
|
||||
utl::TextSearch textSearch(m_searchOptions);
|
||||
|
||||
const css::uno::Sequence<css::uno::Reference<css::script::browse::XBrowseNode>> aChildNodes
|
||||
= parentNode->getChildNodes();
|
||||
const std::vector<css::uno::Reference<css::script::browse::XBrowseNode>> aChildNodes
|
||||
= comphelper::scriptbrowse::getSortedChildNodes(parentNode);
|
||||
for (auto const& child : aChildNodes)
|
||||
{
|
||||
// Acquire to prevent auto-destruction
|
||||
child->acquire();
|
||||
|
||||
if (child->hasChildNodes())
|
||||
{
|
||||
OUString sUIName = child->getName();
|
||||
|
||||
m_aGroupInfo.push_back(std::make_unique<SfxGroupInfo_Impl>(
|
||||
SfxCfgKind::GROUP_SCRIPTCONTAINER, 0, static_cast<void*>(child.get())));
|
||||
SfxGroupInfo_Data(SfxCfgKindAsIndex<SfxCfgKind::GROUP_SCRIPTCONTAINER>, child), 0));
|
||||
std::unique_ptr<weld::TreeIter> xNewEntry(pFunctionListBox->tree_append(
|
||||
weld::toId(m_aGroupInfo.back().get()), sUIName, parentEntry));
|
||||
|
||||
@@ -587,14 +561,12 @@ void CommandCategoryListBox::addChildren(
|
||||
description = CuiResId(RID_CUISTR_NOMACRODESC);
|
||||
}
|
||||
|
||||
OUString* pScriptURI = new OUString(uri);
|
||||
|
||||
css::uno::Reference<css::graphic::XGraphic> xImage;
|
||||
if (pCurrentSaveInData)
|
||||
xImage = pCurrentSaveInData->GetImage(uri);
|
||||
|
||||
m_aGroupInfo.push_back(
|
||||
std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::FUNCTION_SCRIPT, 0, pScriptURI));
|
||||
m_aGroupInfo.push_back(std::make_unique<SfxGroupInfo_Impl>(
|
||||
SfxGroupInfo_Data(SfxCfgKindAsIndex<SfxCfgKind::FUNCTION_SCRIPT>, uri), 0));
|
||||
m_aGroupInfo.back()->sCommand = uri;
|
||||
m_aGroupInfo.back()->sLabel = sUIName;
|
||||
m_aGroupInfo.back()->sHelpText = description;
|
||||
|
||||
@@ -1,283 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#include <comphelper/processfactory.hxx>
|
||||
#include <rtl/bootstrap.hxx>
|
||||
#include <config_folders.h>
|
||||
#include <CustomNotebookbarGenerator.hxx>
|
||||
#include <osl/file.hxx>
|
||||
#include <osl/thread.h>
|
||||
#include <vcl/EnumContext.hxx>
|
||||
#include <vcl/settings.hxx>
|
||||
#include <sfx2/viewfrm.hxx>
|
||||
#include <com/sun/star/frame/ModuleManager.hpp>
|
||||
#include <unotools/confignode.hxx>
|
||||
#include <libxml/parser.h>
|
||||
#include <o3tl/string_view.hxx>
|
||||
|
||||
using namespace css;
|
||||
|
||||
CustomNotebookbarGenerator::CustomNotebookbarGenerator() {}
|
||||
|
||||
static OUString lcl_activeAppName(vcl::EnumContext::Application eApp)
|
||||
{
|
||||
switch (eApp)
|
||||
{
|
||||
case vcl::EnumContext::Application::Writer:
|
||||
return u"ActiveWriter"_ustr;
|
||||
case vcl::EnumContext::Application::Calc:
|
||||
return u"ActiveCalc"_ustr;
|
||||
case vcl::EnumContext::Application::Impress:
|
||||
return u"ActiveImpress"_ustr;
|
||||
case vcl::EnumContext::Application::Draw:
|
||||
return u"ActiveDraw"_ustr;
|
||||
default:
|
||||
return OUString();
|
||||
}
|
||||
}
|
||||
|
||||
static OUString lcl_getAppName(vcl::EnumContext::Application eApp)
|
||||
{
|
||||
switch (eApp)
|
||||
{
|
||||
case vcl::EnumContext::Application::Writer:
|
||||
return u"Writer"_ustr;
|
||||
case vcl::EnumContext::Application::Calc:
|
||||
return u"Calc"_ustr;
|
||||
case vcl::EnumContext::Application::Impress:
|
||||
return u"Impress"_ustr;
|
||||
case vcl::EnumContext::Application::Draw:
|
||||
return u"Draw"_ustr;
|
||||
default:
|
||||
return OUString();
|
||||
}
|
||||
}
|
||||
|
||||
static OUString getAppNameRegistryPath()
|
||||
{
|
||||
vcl::EnumContext::Application eApp = vcl::EnumContext::Application::Any;
|
||||
|
||||
if (SfxViewFrame* pViewFrame = SfxViewFrame::Current())
|
||||
{
|
||||
const Reference<frame::XFrame>& xFrame = pViewFrame->GetFrame().GetFrameInterface();
|
||||
const Reference<frame::XModuleManager> xModuleManager
|
||||
= frame::ModuleManager::create(::comphelper::getProcessComponentContext());
|
||||
eApp = vcl::EnumContext::GetApplicationEnum(xModuleManager->identify(xFrame));
|
||||
}
|
||||
|
||||
OUString sAppName(lcl_getAppName(eApp));
|
||||
return "org.openoffice.Office.UI.ToolbarMode/Applications/" + sAppName;
|
||||
}
|
||||
|
||||
static OUString customizedUIPathBuffer()
|
||||
{
|
||||
OUString sDirPath(u"${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE(
|
||||
"bootstrap") ":UserInstallation}/user/config/soffice.cfg/"_ustr);
|
||||
rtl::Bootstrap::expandMacros(sDirPath);
|
||||
return sDirPath;
|
||||
}
|
||||
|
||||
OUString CustomNotebookbarGenerator::getCustomizedUIPath()
|
||||
{
|
||||
OUString sAppName, sNotebookbarUIFileName;
|
||||
CustomNotebookbarGenerator::getFileNameAndAppName(sAppName, sNotebookbarUIFileName);
|
||||
return customizedUIPathBuffer() + "modules/s" + sAppName.toAsciiLowerCase() + "/ui/"
|
||||
+ sNotebookbarUIFileName;
|
||||
}
|
||||
|
||||
OUString CustomNotebookbarGenerator::getOriginalUIPath()
|
||||
{
|
||||
OUString sAppName, sNotebookbarUIFileName;
|
||||
CustomNotebookbarGenerator::getFileNameAndAppName(sAppName, sNotebookbarUIFileName);
|
||||
return AllSettings::GetUIRootDir() + "modules/s" + sAppName.toAsciiLowerCase() + "/ui/"
|
||||
+ sNotebookbarUIFileName;
|
||||
}
|
||||
|
||||
static OUString getUIDirPath()
|
||||
{
|
||||
OUString sAppName, sNotebookbarUIFileName;
|
||||
CustomNotebookbarGenerator::getFileNameAndAppName(sAppName, sNotebookbarUIFileName);
|
||||
OUString sUIDirPath
|
||||
= customizedUIPathBuffer() + "modules/s" + sAppName.toAsciiLowerCase() + "/ui/";
|
||||
return sUIDirPath;
|
||||
}
|
||||
|
||||
OString CustomNotebookbarGenerator::getSystemPath(OUString const& sURL)
|
||||
{
|
||||
if (sURL.isEmpty())
|
||||
return OString();
|
||||
OUString sSystemPathSettings;
|
||||
if (osl_getSystemPathFromFileURL(sURL.pData, &sSystemPathSettings.pData) != osl_File_E_None)
|
||||
{
|
||||
SAL_WARN("cui.customnotebookbar", "Cannot get system path for :" << sURL);
|
||||
return OString();
|
||||
}
|
||||
OString osSystemPathSettings
|
||||
= OUStringToOString(sSystemPathSettings, osl_getThreadTextEncoding());
|
||||
return osSystemPathSettings;
|
||||
}
|
||||
|
||||
static void changeNodeValue(xmlNode* pNodePtr, const char* pProperty, const char* pValue)
|
||||
{
|
||||
pNodePtr = pNodePtr->xmlChildrenNode;
|
||||
while (pNodePtr)
|
||||
{
|
||||
if (!(xmlStrcmp(pNodePtr->name, reinterpret_cast<const xmlChar*>("property"))))
|
||||
{
|
||||
xmlChar* UriValue = xmlGetProp(pNodePtr, reinterpret_cast<const xmlChar*>("name"));
|
||||
if (!(xmlStrcmp(UriValue, reinterpret_cast<const xmlChar*>(pProperty))))
|
||||
xmlNodeSetContent(pNodePtr, reinterpret_cast<const xmlChar*>(pValue));
|
||||
xmlFree(UriValue);
|
||||
break;
|
||||
}
|
||||
pNodePtr = pNodePtr->next;
|
||||
}
|
||||
}
|
||||
|
||||
static void searchNodeAndAttribute(xmlNode* pNodePtr, const char* pUIItemID, const char* pProperty,
|
||||
const char* pValue)
|
||||
{
|
||||
pNodePtr = pNodePtr->xmlChildrenNode;
|
||||
while (pNodePtr)
|
||||
{
|
||||
if (pNodePtr->type == XML_ELEMENT_NODE)
|
||||
{
|
||||
if (!(xmlStrcmp(pNodePtr->name, reinterpret_cast<const xmlChar*>("object"))))
|
||||
{
|
||||
xmlChar* UriValue = xmlGetProp(pNodePtr, reinterpret_cast<const xmlChar*>("id"));
|
||||
if (!(xmlStrcmp(UriValue, reinterpret_cast<const xmlChar*>(pUIItemID))))
|
||||
changeNodeValue(pNodePtr, pProperty, pValue);
|
||||
xmlFree(UriValue);
|
||||
}
|
||||
searchNodeAndAttribute(pNodePtr, pUIItemID, pProperty, pValue);
|
||||
}
|
||||
pNodePtr = pNodePtr->next;
|
||||
}
|
||||
}
|
||||
|
||||
static xmlDocPtr notebookbarXMLParser(const OString& rDocName, const OString& rUIItemID,
|
||||
const OString& rProperty, const OString& rValue)
|
||||
{
|
||||
xmlDocPtr pDocPtr = xmlParseFile(rDocName.getStr());
|
||||
xmlNodePtr pNodePtr = xmlDocGetRootElement(pDocPtr);
|
||||
searchNodeAndAttribute(pNodePtr, rUIItemID.getStr(), rProperty.getStr(), rValue.getStr());
|
||||
return pDocPtr;
|
||||
}
|
||||
|
||||
void CustomNotebookbarGenerator::modifyCustomizedUIFile(const Sequence<OUString>& sUIItemProperties)
|
||||
{
|
||||
const OUString sUIPath = getCustomizedUIPath();
|
||||
if (osl::File(sUIPath).open(osl_File_OpenFlag_Read) != osl::FileBase::E_None)
|
||||
createCustomizedUIFile();
|
||||
|
||||
const OString sCustomizedUIPath = getSystemPath(sUIPath);
|
||||
for (auto const& aValue : sUIItemProperties)
|
||||
{
|
||||
constexpr sal_Int32 aUIPropertiesCount = 3;
|
||||
std::vector<OString> aProperties(aUIPropertiesCount);
|
||||
for (sal_Int32 aIndex = 0; aIndex < aUIPropertiesCount; aIndex++)
|
||||
{
|
||||
sal_Int32 nPos = aIndex;
|
||||
std::u16string_view sToken = o3tl::getToken(aValue, nPos, ',', nPos);
|
||||
aProperties[aIndex] = OUStringToOString(sToken, RTL_TEXTENCODING_UTF8);
|
||||
}
|
||||
xmlDocPtr doc = notebookbarXMLParser(sCustomizedUIPath, aProperties[0], aProperties[1],
|
||||
aProperties[2]);
|
||||
|
||||
if (doc != nullptr)
|
||||
{
|
||||
xmlSaveFormatFile(sCustomizedUIPath.getStr(), doc, 1);
|
||||
xmlFreeDoc(doc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CustomNotebookbarGenerator::getFileNameAndAppName(OUString& sAppName,
|
||||
OUString& sNotebookbarUIFileName)
|
||||
{
|
||||
SfxViewFrame* pFrame = SfxViewFrame::Current();
|
||||
if (!pFrame)
|
||||
return;
|
||||
|
||||
const auto& xContext = comphelper::getProcessComponentContext();
|
||||
utl::OConfigurationTreeRoot aRoot(xContext, u"org.openoffice.Office.UI.ToolbarMode/"_ustr,
|
||||
false);
|
||||
const Reference<frame::XFrame>& xFrame = pFrame->GetFrame().GetFrameInterface();
|
||||
const Reference<frame::XModuleManager> xModuleManager = frame::ModuleManager::create(xContext);
|
||||
|
||||
vcl::EnumContext::Application eApp
|
||||
= vcl::EnumContext::GetApplicationEnum(xModuleManager->identify(xFrame));
|
||||
OUString sActiveAppName(lcl_activeAppName(eApp));
|
||||
sAppName = lcl_getAppName(eApp);
|
||||
const Any aValue = aRoot.getNodeValue(sActiveAppName);
|
||||
aValue >>= sNotebookbarUIFileName;
|
||||
}
|
||||
|
||||
void CustomNotebookbarGenerator::createCustomizedUIFile()
|
||||
{
|
||||
OUString sUserUIDir = getUIDirPath();
|
||||
OUString sOriginalUIPath = getOriginalUIPath();
|
||||
OUString sCustomizedUIPath = getCustomizedUIPath();
|
||||
|
||||
sal_uInt32 nflag = osl_File_OpenFlag_Read | osl_File_OpenFlag_Write;
|
||||
osl::Directory aDirectory(sUserUIDir);
|
||||
if (aDirectory.open() != osl::FileBase::E_None)
|
||||
osl::Directory::create(sUserUIDir, nflag);
|
||||
else
|
||||
SAL_WARN("cui.customnotebookbar",
|
||||
"Cannot create the directory or directory was present :" << sUserUIDir);
|
||||
|
||||
osl::File aFile(sCustomizedUIPath);
|
||||
if (aFile.open(nflag) != osl::FileBase::E_None)
|
||||
osl::File::copy(sOriginalUIPath, sCustomizedUIPath);
|
||||
else
|
||||
SAL_WARN("cui.customnotebookbar",
|
||||
"Cannot copy the file or file was present :" << sCustomizedUIPath);
|
||||
}
|
||||
|
||||
Sequence<OUString>
|
||||
CustomNotebookbarGenerator::getCustomizedUIItem(const OUString& sNotebookbarConfigType)
|
||||
{
|
||||
OUString aPath = getAppNameRegistryPath();
|
||||
const utl::OConfigurationTreeRoot aAppNode(::comphelper::getProcessComponentContext(), aPath,
|
||||
false);
|
||||
|
||||
const utl::OConfigurationNode aModesNode = aAppNode.openNode(u"Modes"_ustr);
|
||||
const utl::OConfigurationNode aModeNode(aModesNode.openNode(sNotebookbarConfigType));
|
||||
const Any aValue = aModeNode.getNodeValue(u"UIItemProperties"_ustr);
|
||||
Sequence<OUString> aValues;
|
||||
aValue >>= aValues;
|
||||
return aValues;
|
||||
}
|
||||
|
||||
void CustomNotebookbarGenerator::setCustomizedUIItem(const Sequence<OUString>& rUIItemProperties,
|
||||
const OUString& rNotebookbarConfigType)
|
||||
{
|
||||
OUString aPath = getAppNameRegistryPath();
|
||||
const utl::OConfigurationTreeRoot aAppNode(::comphelper::getProcessComponentContext(), aPath,
|
||||
true);
|
||||
const utl::OConfigurationNode aModesNode = aAppNode.openNode(u"Modes"_ustr);
|
||||
const utl::OConfigurationNode aModeNode(aModesNode.openNode(rNotebookbarConfigType));
|
||||
|
||||
css::uno::Any aUIItemProperties(rUIItemProperties);
|
||||
aModeNode.setNodeValue(u"UIItemProperties"_ustr, aUIItemProperties);
|
||||
aAppNode.commit();
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
@@ -151,7 +151,7 @@ OUString SvxConfigPageHelper::generateCustomMenuURL(SvxEntries* entries, sal_Int
|
||||
if (!entries)
|
||||
return url;
|
||||
|
||||
// now check is there is an already existing entry with this url
|
||||
// now check if there is an already existing entry with this url
|
||||
bool bFoundEntry = false;
|
||||
for (auto const& entry : *entries)
|
||||
{
|
||||
@@ -182,7 +182,7 @@ OUString SvxConfigPageHelper::generateCustomURL(SvxEntries* entries)
|
||||
// use a random number to minimize possible clash with existing custom toolbars
|
||||
OUString::number(generateRandomValue(), 16);
|
||||
|
||||
// now check is there is an already existing entry with this url
|
||||
// now check if there is an already existing entry with this url
|
||||
bool bFoundEntry = false;
|
||||
for (auto const& entry : *entries)
|
||||
{
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include <vcl/weld/Builder.hxx>
|
||||
#include <vcl/weld/Menu.hxx>
|
||||
#include <vcl/weld/MessageDialog.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vcl/commandevent.hxx>
|
||||
#include <vcl/vclenum.hxx>
|
||||
|
||||
@@ -1,569 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#include <sal/config.h>
|
||||
|
||||
#include <vcl/commandinfoprovider.hxx>
|
||||
#include <vcl/event.hxx>
|
||||
#include <vcl/weld/Builder.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
|
||||
#include <helpids.h>
|
||||
#include <strings.hrc>
|
||||
|
||||
#include <cfg.hxx>
|
||||
#include <SvxNotebookbarConfigPage.hxx>
|
||||
#include <SvxConfigPageHelper.hxx>
|
||||
#include <dialmgr.hxx>
|
||||
#include <libxml/parser.h>
|
||||
#include <osl/file.hxx>
|
||||
#include <CustomNotebookbarGenerator.hxx>
|
||||
#include <sfx2/notebookbar/SfxNotebookBar.hxx>
|
||||
#include <unotools/configmgr.hxx>
|
||||
#include <vcl/weld/MessageDialog.hxx>
|
||||
#include <comphelper/processfactory.hxx>
|
||||
#include <o3tl/string_view.hxx>
|
||||
#include <com/sun/star/frame/theUICommandDescription.hpp>
|
||||
|
||||
namespace uno = css::uno;
|
||||
namespace frame = css::frame;
|
||||
namespace container = css::container;
|
||||
namespace beans = css::beans;
|
||||
|
||||
static bool isCategoryAvailable(std::u16string_view sClassId, std::u16string_view sUIItemId,
|
||||
std::u16string_view sActiveCategory, bool& isCategory)
|
||||
{
|
||||
if (sUIItemId == sActiveCategory)
|
||||
return true;
|
||||
else if ((sClassId == u"GtkMenu" || sClassId == u"GtkGrid") && sUIItemId != sActiveCategory)
|
||||
{
|
||||
isCategory = false;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static OUString charToString(const char* cString)
|
||||
{
|
||||
return OUString(cString, strlen(cString), RTL_TEXTENCODING_UTF8);
|
||||
}
|
||||
|
||||
static OUString getFileName(std::u16string_view aFileName)
|
||||
{
|
||||
if (aFileName == u"notebookbar.ui")
|
||||
return CuiResId(RID_CUISTR_TABBED);
|
||||
else if (aFileName == u"notebookbar_compact.ui")
|
||||
return CuiResId(RID_CUISTR_TABBED_COMPACT);
|
||||
else if (aFileName == u"notebookbar_groupedbar_full.ui")
|
||||
return CuiResId(RID_CUISTR_GROUPEDBAR);
|
||||
else if (aFileName == u"notebookbar_groupedbar_compact.ui")
|
||||
return CuiResId(RID_CUISTR_GROUPEDBAR_COMPACT);
|
||||
else
|
||||
return u"None"_ustr;
|
||||
}
|
||||
|
||||
static OUString getModuleId(std::u16string_view sModuleName)
|
||||
{
|
||||
if (sModuleName == u"Writer")
|
||||
return u"com.sun.star.text.TextDocument"_ustr;
|
||||
else if (sModuleName == u"Draw")
|
||||
return u"com.sun.star.drawing.DrawingDocument"_ustr;
|
||||
else if (sModuleName == u"Impress")
|
||||
return u"com.sun.star.presentation.PresentationDocument"_ustr;
|
||||
else if (sModuleName == u"Calc")
|
||||
return u"com.sun.star.sheet.SpreadsheetDocument"_ustr;
|
||||
else
|
||||
return u"None"_ustr;
|
||||
}
|
||||
|
||||
SvxNotebookbarConfigPage::SvxNotebookbarConfigPage(weld::Container* pPage,
|
||||
weld::DialogController* pController,
|
||||
const SfxItemSet& rSet)
|
||||
: SvxConfigPage(pPage, pController, rSet)
|
||||
{
|
||||
m_xCommandCategoryListBox->set_visible(false);
|
||||
m_xDescriptionFieldLb->set_visible(false);
|
||||
m_xSearchEdit->set_visible(false);
|
||||
m_xDescriptionField->set_visible(false);
|
||||
m_xMoveUpButton->set_visible(false);
|
||||
m_xMoveDownButton->set_visible(false);
|
||||
m_xCommandButtons->set_visible(false);
|
||||
m_xLeftFunctionLabel->set_visible(false);
|
||||
m_xSearchLabel->set_visible(false);
|
||||
m_xCategoryLabel->set_visible(false);
|
||||
m_xCustomizeBox->set_visible(false);
|
||||
m_xCustomizeLabel->set_visible(false);
|
||||
|
||||
weld::TreeView& rCommandCategoryBox = m_xFunctions->get_widget();
|
||||
rCommandCategoryBox.hide();
|
||||
|
||||
m_xContentsListBox.reset(
|
||||
new SvxNotebookbarEntriesListBox(m_xBuilder->weld_tree_view(u"toolcontents"_ustr), this));
|
||||
m_xDropTargetHelper.reset(new SvxConfigPageFunctionDropTarget(
|
||||
*this, m_xContentsListBox->get_widget(), rCommandCategoryBox, Link<int, void>()));
|
||||
weld::TreeView& rTreeView = m_xContentsListBox->get_widget();
|
||||
Size aSize(m_xFunctions->get_size_request());
|
||||
rTreeView.set_size_request(aSize.Width(), aSize.Height());
|
||||
|
||||
rTreeView.set_hexpand(true);
|
||||
rTreeView.set_vexpand(true);
|
||||
rTreeView.set_help_id(HID_SVX_CONFIG_NOTEBOOKBAR_CONTENTS);
|
||||
rTreeView.show();
|
||||
}
|
||||
|
||||
SvxNotebookbarConfigPage::~SvxNotebookbarConfigPage() {}
|
||||
|
||||
void SvxNotebookbarConfigPage::DeleteSelectedTopLevel() {}
|
||||
|
||||
void SvxNotebookbarConfigPage::DeleteSelectedContent() {}
|
||||
|
||||
void SvxNotebookbarConfigPage::Init()
|
||||
{
|
||||
m_xTopLevelListBox->clear();
|
||||
m_xContentsListBox->clear();
|
||||
m_xSaveInListBox->clear();
|
||||
OUString sNotebookbarInterface = getFileName(m_sFileName);
|
||||
|
||||
OUString sScopeName
|
||||
= utl::ConfigManager::getProductName() + " " + m_sAppName + " - " + sNotebookbarInterface;
|
||||
OUString sSaveInListBoxID = notebookbarTabScope;
|
||||
|
||||
m_xSaveInListBox->append(sSaveInListBoxID, sScopeName);
|
||||
m_xSaveInListBox->set_active_id(sSaveInListBoxID);
|
||||
|
||||
m_xTopLevelListBox->append(u"NotebookBar"_ustr, CuiResId(RID_CUISTR_ALL_COMMANDS));
|
||||
m_xTopLevelListBox->set_active_id(u"NotebookBar"_ustr);
|
||||
SelectElement();
|
||||
}
|
||||
|
||||
SaveInData* SvxNotebookbarConfigPage::CreateSaveInData(
|
||||
const css::uno::Reference<css::ui::XUIConfigurationManager>& xCfgMgr,
|
||||
const css::uno::Reference<css::ui::XUIConfigurationManager>& xParentCfgMgr,
|
||||
const OUString& aModuleId, bool bDocConfig)
|
||||
{
|
||||
return static_cast<SaveInData*>(
|
||||
new ToolbarSaveInData(xCfgMgr, xParentCfgMgr, aModuleId, bDocConfig));
|
||||
}
|
||||
|
||||
void SvxNotebookbarConfigPage::UpdateButtonStates() {}
|
||||
|
||||
short SvxNotebookbarConfigPage::QueryReset()
|
||||
{
|
||||
OUString msg = CuiResId(RID_CUISTR_CONFIRM_TOOLBAR_RESET);
|
||||
|
||||
OUString saveInName = m_xSaveInListBox->get_active_text();
|
||||
|
||||
OUString label = SvxConfigPageHelper::replaceSaveInName(msg, saveInName);
|
||||
|
||||
std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(
|
||||
GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo, label));
|
||||
int nValue = xQueryBox->run();
|
||||
if (nValue == RET_YES)
|
||||
{
|
||||
osl::File::remove(CustomNotebookbarGenerator::getCustomizedUIPath());
|
||||
|
||||
OUString sNotebookbarInterface = getFileName(m_sFileName);
|
||||
Sequence<OUString> sSequenceEntries;
|
||||
CustomNotebookbarGenerator::setCustomizedUIItem(sSequenceEntries, sNotebookbarInterface);
|
||||
OUString sUIPath = "modules/s" + m_sAppName.toAsciiLowerCase() + "/ui/";
|
||||
sfx2::SfxNotebookBar::ReloadNotebookBar(sUIPath);
|
||||
}
|
||||
return nValue;
|
||||
}
|
||||
|
||||
void SvxConfigPage::InsertEntryIntoNotebookbarTabUI(std::u16string_view sClassId,
|
||||
const OUString& sUIItemId,
|
||||
const OUString& sUIItemCommand,
|
||||
weld::TreeView& rTreeView,
|
||||
const weld::TreeIter& rIter)
|
||||
{
|
||||
css::uno::Reference<css::container::XNameAccess> m_xCommandToLabelMap;
|
||||
const uno::Reference<uno::XComponentContext>& xContext
|
||||
= ::comphelper::getProcessComponentContext();
|
||||
uno::Reference<container::XNameAccess> xNameAccess(
|
||||
css::frame::theUICommandDescription::get(xContext));
|
||||
|
||||
uno::Sequence<beans::PropertyValue> aPropSeq;
|
||||
|
||||
xNameAccess->getByName(getModuleId(m_sAppName)) >>= m_xCommandToLabelMap;
|
||||
|
||||
try
|
||||
{
|
||||
uno::Any aModuleVal = m_xCommandToLabelMap->getByName(sUIItemCommand);
|
||||
|
||||
aModuleVal >>= aPropSeq;
|
||||
}
|
||||
catch (container::NoSuchElementException&)
|
||||
{
|
||||
}
|
||||
|
||||
OUString aLabel;
|
||||
for (auto const& prop : aPropSeq)
|
||||
if (prop.Name == "Name")
|
||||
prop.Value >>= aLabel;
|
||||
|
||||
OUString aName = SvxConfigPageHelper::stripHotKey(aLabel);
|
||||
|
||||
if (sClassId == u"GtkSeparatorMenuItem" || sClassId == u"GtkSeparator")
|
||||
{
|
||||
rTreeView.set_text(rIter, u"--------------------------------------------"_ustr, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (aName.isEmpty())
|
||||
aName = sUIItemId;
|
||||
auto xImage = GetSaveInData()->GetImage(sUIItemCommand);
|
||||
if (xImage.is())
|
||||
rTreeView.set_image(rIter, xImage, -1);
|
||||
rTreeView.set_text(rIter, aName, 0);
|
||||
rTreeView.set_id(rIter, sUIItemId);
|
||||
}
|
||||
}
|
||||
|
||||
void SvxNotebookbarConfigPage::getNodeValue(xmlNode* pNodePtr, NotebookbarEntries& aNodeEntries)
|
||||
{
|
||||
pNodePtr = pNodePtr->xmlChildrenNode;
|
||||
while (pNodePtr)
|
||||
{
|
||||
if (!(xmlStrcmp(pNodePtr->name, reinterpret_cast<const xmlChar*>("property"))))
|
||||
{
|
||||
xmlChar* UriValue = xmlGetProp(pNodePtr, reinterpret_cast<const xmlChar*>("name"));
|
||||
if (!(xmlStrcmp(UriValue, reinterpret_cast<const xmlChar*>("visible"))))
|
||||
{
|
||||
xmlChar* aValue = xmlNodeGetContent(pNodePtr);
|
||||
const char* cVisibleValue = reinterpret_cast<const char*>(aValue);
|
||||
aNodeEntries.sVisibleValue = charToString(cVisibleValue);
|
||||
xmlFree(aValue);
|
||||
}
|
||||
if (!(xmlStrcmp(UriValue, reinterpret_cast<const xmlChar*>("action_name"))))
|
||||
{
|
||||
xmlChar* aValue = xmlNodeGetContent(pNodePtr);
|
||||
const char* cActionName = reinterpret_cast<const char*>(aValue);
|
||||
aNodeEntries.sActionName = charToString(cActionName);
|
||||
xmlFree(aValue);
|
||||
}
|
||||
xmlFree(UriValue);
|
||||
}
|
||||
pNodePtr = pNodePtr->next;
|
||||
}
|
||||
}
|
||||
|
||||
void SvxNotebookbarConfigPage::searchNodeandAttribute(std::vector<NotebookbarEntries>& aEntries,
|
||||
std::vector<CategoriesEntries>& aCategoryList,
|
||||
OUString& sActiveCategory,
|
||||
CategoriesEntries& aCurItemEntry,
|
||||
xmlNode* pNodePtr, bool isCategory)
|
||||
{
|
||||
pNodePtr = pNodePtr->xmlChildrenNode;
|
||||
while (pNodePtr)
|
||||
{
|
||||
if (pNodePtr->type == XML_ELEMENT_NODE)
|
||||
{
|
||||
const char* cNodeName = reinterpret_cast<const char*>(pNodePtr->name);
|
||||
if (strcmp(cNodeName, "object") == 0)
|
||||
{
|
||||
OUString sSecondVal;
|
||||
|
||||
xmlChar* UriValue = xmlGetProp(pNodePtr, reinterpret_cast<const xmlChar*>("id"));
|
||||
const char* cUIItemID = reinterpret_cast<const char*>(UriValue);
|
||||
OUString sUIItemId = charToString(cUIItemID);
|
||||
xmlFree(UriValue);
|
||||
|
||||
UriValue = xmlGetProp(pNodePtr, reinterpret_cast<const xmlChar*>("class"));
|
||||
const char* cClassId = reinterpret_cast<const char*>(UriValue);
|
||||
OUString sClassId = charToString(cClassId);
|
||||
xmlFree(UriValue);
|
||||
|
||||
CategoriesEntries aCategoryEntry;
|
||||
if (sClassId == "sfxlo-PriorityHBox")
|
||||
{
|
||||
aCategoryEntry.sDisplayName = sUIItemId;
|
||||
aCategoryEntry.sUIItemId = sUIItemId;
|
||||
aCategoryEntry.sClassType = sClassId;
|
||||
aCategoryList.push_back(aCategoryEntry);
|
||||
|
||||
aCurItemEntry = std::move(aCategoryEntry);
|
||||
}
|
||||
else if (sClassId == "sfxlo-PriorityMergedHBox")
|
||||
{
|
||||
aCategoryEntry.sDisplayName = aCurItemEntry.sDisplayName + " | " + sUIItemId;
|
||||
aCategoryEntry.sUIItemId = sUIItemId;
|
||||
aCategoryEntry.sClassType = sClassId;
|
||||
|
||||
if (aCurItemEntry.sClassType == sClassId)
|
||||
{
|
||||
sal_Int32 rPos = 0;
|
||||
aCategoryEntry.sDisplayName
|
||||
= OUString::Concat(
|
||||
o3tl::getToken(aCurItemEntry.sDisplayName, rPos, ' ', rPos))
|
||||
+ " | " + sUIItemId;
|
||||
}
|
||||
aCategoryList.push_back(aCategoryEntry);
|
||||
aCurItemEntry = std::move(aCategoryEntry);
|
||||
}
|
||||
else if (sClassId == "svtlo-ManagedMenuButton")
|
||||
{
|
||||
sal_Int32 rPos = 1;
|
||||
sSecondVal = sUIItemId.getToken(rPos, ':', rPos);
|
||||
if (!sSecondVal.isEmpty())
|
||||
{
|
||||
aCategoryEntry.sDisplayName
|
||||
= aCurItemEntry.sDisplayName + " | " + sSecondVal;
|
||||
aCategoryEntry.sUIItemId = sSecondVal;
|
||||
aCategoryList.push_back(aCategoryEntry);
|
||||
}
|
||||
}
|
||||
|
||||
NotebookbarEntries nodeEntries;
|
||||
if (isCategoryAvailable(sClassId, sUIItemId, sActiveCategory, isCategory)
|
||||
|| isCategory)
|
||||
{
|
||||
isCategory = true;
|
||||
if (sClassId == "GtkMenuItem" || sClassId == "GtkToolButton"
|
||||
|| sClassId == "GtkMenuToolButton"
|
||||
|| (sClassId == "svtlo-ManagedMenuButton" && sSecondVal.isEmpty()))
|
||||
{
|
||||
nodeEntries.sClassId = sClassId;
|
||||
nodeEntries.sUIItemId = sUIItemId;
|
||||
nodeEntries.sDisplayName = sUIItemId;
|
||||
|
||||
getNodeValue(pNodePtr, nodeEntries);
|
||||
aEntries.push_back(nodeEntries);
|
||||
}
|
||||
else if (sClassId == "GtkSeparatorMenuItem" || sClassId == "GtkSeparator")
|
||||
{
|
||||
nodeEntries.sClassId = sClassId;
|
||||
nodeEntries.sUIItemId = sUIItemId;
|
||||
nodeEntries.sDisplayName = "Null";
|
||||
nodeEntries.sVisibleValue = "Null";
|
||||
nodeEntries.sActionName = "Null";
|
||||
aEntries.push_back(nodeEntries);
|
||||
}
|
||||
else if (sClassId == "sfxlo-PriorityHBox"
|
||||
|| sClassId == "sfxlo-PriorityMergedHBox"
|
||||
|| sClassId == "svtlo-ManagedMenuButton")
|
||||
{
|
||||
nodeEntries.sClassId = sClassId;
|
||||
nodeEntries.sUIItemId = sUIItemId;
|
||||
nodeEntries.sDisplayName
|
||||
= aCategoryList[aCategoryList.size() - 1].sDisplayName;
|
||||
nodeEntries.sVisibleValue = "Null";
|
||||
nodeEntries.sActionName = "Null";
|
||||
aEntries.push_back(nodeEntries);
|
||||
}
|
||||
}
|
||||
}
|
||||
searchNodeandAttribute(aEntries, aCategoryList, sActiveCategory, aCurItemEntry,
|
||||
pNodePtr, isCategory);
|
||||
}
|
||||
pNodePtr = pNodePtr->next;
|
||||
}
|
||||
}
|
||||
|
||||
void SvxNotebookbarConfigPage::FillFunctionsList(xmlNodePtr pRootNodePtr,
|
||||
std::vector<NotebookbarEntries>& aEntries,
|
||||
std::vector<CategoriesEntries>& aCategoryList,
|
||||
OUString& sActiveCategory)
|
||||
{
|
||||
CategoriesEntries aCurItemEntry;
|
||||
searchNodeandAttribute(aEntries, aCategoryList, sActiveCategory, aCurItemEntry, pRootNodePtr,
|
||||
false);
|
||||
}
|
||||
|
||||
void SvxNotebookbarConfigPage::SelectElement()
|
||||
{
|
||||
OString sUIFileUIPath = CustomNotebookbarGenerator::getSystemPath(
|
||||
CustomNotebookbarGenerator::getCustomizedUIPath());
|
||||
xmlDocPtr pDoc = xmlParseFile(sUIFileUIPath.getStr());
|
||||
if (!pDoc)
|
||||
{
|
||||
sUIFileUIPath = CustomNotebookbarGenerator::getSystemPath(
|
||||
CustomNotebookbarGenerator::getOriginalUIPath());
|
||||
pDoc = xmlParseFile(sUIFileUIPath.getStr());
|
||||
}
|
||||
|
||||
if (!pDoc)
|
||||
return;
|
||||
xmlNodePtr pNodePtr = xmlDocGetRootElement(pDoc);
|
||||
|
||||
std::vector<NotebookbarEntries> aEntries;
|
||||
std::vector<CategoriesEntries> aCategoryList;
|
||||
OUString sActiveCategory = m_xTopLevelListBox->get_active_id();
|
||||
FillFunctionsList(pNodePtr, aEntries, aCategoryList, sActiveCategory);
|
||||
|
||||
if (m_xTopLevelListBox->get_count() == 1)
|
||||
{
|
||||
for (const auto& rCategory : aCategoryList)
|
||||
m_xTopLevelListBox->append(rCategory.sUIItemId, rCategory.sDisplayName);
|
||||
}
|
||||
tools::ULong nStart = 0;
|
||||
if (aEntries[nStart].sClassId == "sfxlo-PriorityHBox"
|
||||
|| aEntries[nStart].sClassId == "sfxlo-PriorityMergedHBox")
|
||||
nStart = 1;
|
||||
|
||||
std::vector<NotebookbarEntries> aTempEntries;
|
||||
for (std::size_t nIdx = nStart; nIdx < aEntries.size(); nIdx++)
|
||||
{
|
||||
if (aEntries[nIdx].sClassId == "svtlo-ManagedMenuButton")
|
||||
{
|
||||
aTempEntries.push_back(aEntries[nIdx]);
|
||||
sal_Int32 rPos = 1;
|
||||
sActiveCategory = aEntries[nIdx].sUIItemId.getToken(rPos, ':', rPos);
|
||||
FillFunctionsList(pNodePtr, aTempEntries, aCategoryList, sActiveCategory);
|
||||
}
|
||||
else
|
||||
aTempEntries.push_back(aEntries[nIdx]);
|
||||
}
|
||||
|
||||
aEntries = std::move(aTempEntries);
|
||||
|
||||
static_cast<SvxNotebookbarEntriesListBox*>(m_xContentsListBox.get())->GetTooltipMap().clear();
|
||||
weld::TreeView& rTreeView = m_xContentsListBox->get_widget();
|
||||
rTreeView.bulk_insert_for_each(
|
||||
aEntries.size(), [this, &rTreeView, &aEntries](weld::TreeIter& rIter, int nIdx) {
|
||||
if (aEntries[nIdx].sActionName != "Null")
|
||||
{
|
||||
if (aEntries[nIdx].sVisibleValue == "True")
|
||||
{
|
||||
rTreeView.set_toggle(rIter, TRISTATE_TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
rTreeView.set_toggle(rIter, TRISTATE_FALSE);
|
||||
}
|
||||
}
|
||||
InsertEntryIntoNotebookbarTabUI(aEntries[nIdx].sClassId, aEntries[nIdx].sDisplayName,
|
||||
aEntries[nIdx].sActionName, rTreeView, rIter);
|
||||
if (aEntries[nIdx].sClassId != u"GtkSeparatorMenuItem"
|
||||
&& aEntries[nIdx].sClassId != u"GtkSeparator")
|
||||
{
|
||||
static_cast<SvxNotebookbarEntriesListBox*>(m_xContentsListBox.get())
|
||||
->GetTooltipMap()[aEntries[nIdx].sDisplayName]
|
||||
= aEntries[nIdx].sActionName;
|
||||
}
|
||||
});
|
||||
|
||||
aEntries.clear();
|
||||
|
||||
xmlFreeDoc(pDoc);
|
||||
}
|
||||
|
||||
SvxNotebookbarEntriesListBox::SvxNotebookbarEntriesListBox(std::unique_ptr<weld::TreeView> xParent,
|
||||
SvxConfigPage* pPg)
|
||||
: SvxMenuEntriesListBox(std::move(xParent), pPg)
|
||||
{
|
||||
m_xControl->connect_toggled(LINK(this, SvxNotebookbarEntriesListBox, CheckButtonHdl));
|
||||
m_xControl->connect_key_press(Link<const KeyEvent&, bool>());
|
||||
m_xControl->connect_key_press(LINK(this, SvxNotebookbarEntriesListBox, KeyInputHdl));
|
||||
// remove the inherited connect_query_tooltip then add the new one
|
||||
m_xControl->connect_query_tooltip(Link<const weld::TreeIter&, OUString>());
|
||||
m_xControl->connect_query_tooltip(LINK(this, SvxNotebookbarEntriesListBox, QueryTooltip));
|
||||
}
|
||||
|
||||
SvxNotebookbarEntriesListBox::~SvxNotebookbarEntriesListBox() {}
|
||||
|
||||
static void EditRegistryFile(std::u16string_view sUIItemId, const OUString& sSetEntry,
|
||||
const OUString& sNotebookbarInterface)
|
||||
{
|
||||
int nFlag = 0;
|
||||
Sequence<OUString> aOldEntries
|
||||
= CustomNotebookbarGenerator::getCustomizedUIItem(sNotebookbarInterface);
|
||||
Sequence<OUString> aNewEntries(aOldEntries.getLength() + 1);
|
||||
auto pNewEntries = aNewEntries.getArray();
|
||||
for (int nIdx = 0; nIdx < aOldEntries.getLength(); nIdx++)
|
||||
{
|
||||
sal_Int32 rPos = 0;
|
||||
std::u16string_view sFirstValue = o3tl::getToken(aOldEntries[nIdx], rPos, ',', rPos);
|
||||
if (sFirstValue == sUIItemId)
|
||||
{
|
||||
aOldEntries.getArray()[nIdx] = sSetEntry;
|
||||
nFlag = 1;
|
||||
break;
|
||||
}
|
||||
pNewEntries[nIdx] = aOldEntries[nIdx];
|
||||
}
|
||||
|
||||
if (nFlag == 0)
|
||||
{
|
||||
pNewEntries[aOldEntries.getLength()] = sSetEntry;
|
||||
CustomNotebookbarGenerator::setCustomizedUIItem(aNewEntries, sNotebookbarInterface);
|
||||
}
|
||||
else
|
||||
{
|
||||
CustomNotebookbarGenerator::setCustomizedUIItem(aOldEntries, sNotebookbarInterface);
|
||||
}
|
||||
}
|
||||
|
||||
void SvxNotebookbarEntriesListBox::ChangedVisibility(int nRow)
|
||||
{
|
||||
OUString sUIItemId = m_xControl->get_selected_id();
|
||||
OUString sNotebookbarInterface = getFileName(m_pPage->GetFileName());
|
||||
|
||||
OUString sVisible;
|
||||
if (m_xControl->get_toggle(nRow) == TRISTATE_TRUE)
|
||||
sVisible = "True";
|
||||
else
|
||||
sVisible = "False";
|
||||
OUString sSetEntries = sUIItemId + ",visible," + sVisible;
|
||||
Sequence<OUString> sSeqOfEntries{ sSetEntries };
|
||||
EditRegistryFile(sUIItemId, sSetEntries, sNotebookbarInterface);
|
||||
CustomNotebookbarGenerator::modifyCustomizedUIFile(sSeqOfEntries);
|
||||
OUString sUIPath = "modules/s" + m_pPage->GetAppName().toAsciiLowerCase() + "/ui/";
|
||||
sfx2::SfxNotebookBar::ReloadNotebookBar(sUIPath);
|
||||
}
|
||||
|
||||
IMPL_LINK(SvxNotebookbarEntriesListBox, CheckButtonHdl, const weld::TreeView::iter_col&, rRowCol,
|
||||
void)
|
||||
{
|
||||
ChangedVisibility(m_xControl->get_iter_index_in_parent(rRowCol.first));
|
||||
}
|
||||
|
||||
IMPL_LINK(SvxNotebookbarEntriesListBox, KeyInputHdl, const KeyEvent&, rKeyEvent, bool)
|
||||
{
|
||||
if (rKeyEvent.GetKeyCode() == KEY_SPACE)
|
||||
{
|
||||
int nRow = m_xControl->get_selected_index();
|
||||
m_xControl->set_toggle(nRow, m_xControl->get_toggle(nRow) == TRISTATE_TRUE ? TRISTATE_FALSE
|
||||
: TRISTATE_TRUE);
|
||||
ChangedVisibility(nRow);
|
||||
return true;
|
||||
}
|
||||
return SvxMenuEntriesListBox::KeyInputHdl(rKeyEvent);
|
||||
}
|
||||
|
||||
IMPL_LINK(SvxNotebookbarEntriesListBox, QueryTooltip, const weld::TreeIter&, rIter, OUString)
|
||||
{
|
||||
const OUString& rsCommand = m_aTooltipMap[m_xControl->get_id(rIter)];
|
||||
if (rsCommand.isEmpty())
|
||||
return OUString();
|
||||
OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(m_pPage->GetFrame()));
|
||||
auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(rsCommand, aModuleName);
|
||||
OUString sTooltipLabel = vcl::CommandInfoProvider::GetTooltipForCommand(rsCommand, aProperties,
|
||||
m_pPage->GetFrame());
|
||||
return CuiResId(RID_CUISTR_COMMANDLABEL) + ": "
|
||||
+ m_xControl->get_text(rIter).replaceFirst("~", "") + "\n"
|
||||
+ CuiResId(RID_CUISTR_COMMANDNAME) + ": " + rsCommand + "\n"
|
||||
+ CuiResId(RID_CUISTR_COMMANDTIP) + ": " + sTooltipLabel.replaceFirst("~", "");
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <vcl/weld/Builder.hxx>
|
||||
#include <vcl/weld/Menu.hxx>
|
||||
#include <vcl/weld/MessageDialog.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vcl/commandevent.hxx>
|
||||
|
||||
|
||||
@@ -65,6 +65,7 @@
|
||||
#include <svtools/acceleratorexecute.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vcl/weld/Builder.hxx>
|
||||
#include <vcl/weld/WaitObject.hxx>
|
||||
#include <comphelper/sequenceashashmap.hxx>
|
||||
#include <config_features.h>
|
||||
#include <unotools/configmgr.hxx>
|
||||
@@ -1111,13 +1112,16 @@ void SfxAcceleratorConfigPage::InitAccCfg()
|
||||
// get global accelerator configuration
|
||||
m_xGlobal = css::ui::GlobalAcceleratorConfiguration::create(m_xContext);
|
||||
|
||||
// get module accelerator configuration
|
||||
|
||||
uno::Reference<ui::XModuleUIConfigurationManagerSupplier> xModuleCfgSupplier(
|
||||
ui::theModuleUIConfigurationManagerSupplier::get(m_xContext));
|
||||
uno::Reference<ui::XUIConfigurationManager> xUICfgManager
|
||||
= xModuleCfgSupplier->getUIConfigurationManager(m_sModuleLongName);
|
||||
m_xModule = xUICfgManager->getShortCutManager();
|
||||
// get module accelerator configuration, unless it’s the start module in which case we’ll
|
||||
// only allow configuring the global configuration
|
||||
if (m_sModuleLongName != "com.sun.star.frame.StartModule")
|
||||
{
|
||||
uno::Reference<ui::XModuleUIConfigurationManagerSupplier> xModuleCfgSupplier(
|
||||
ui::theModuleUIConfigurationManagerSupplier::get(m_xContext));
|
||||
uno::Reference<ui::XUIConfigurationManager> xUICfgManager
|
||||
= xModuleCfgSupplier->getUIConfigurationManager(m_sModuleLongName);
|
||||
m_xModule = xUICfgManager->getShortCutManager();
|
||||
}
|
||||
}
|
||||
catch (const uno::RuntimeException&)
|
||||
{
|
||||
@@ -1250,7 +1254,7 @@ IMPL_LINK_NOARG(SfxAcceleratorConfigPage, ImplUpdateDataHdl, Timer*, void)
|
||||
SelectHdl(m_xGroupLBox->get_widget());
|
||||
}
|
||||
|
||||
IMPL_LINK_NOARG(SfxAcceleratorConfigPage, SearchUpdateHdl, weld::Entry&, void)
|
||||
IMPL_LINK_NOARG(SfxAcceleratorConfigPage, SearchUpdateHdl, weld::TextWidget&, void)
|
||||
{
|
||||
m_aUpdateDataTimer.Start();
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#include <vcl/weld/Builder.hxx>
|
||||
#include <vcl/weld/Dialog.hxx>
|
||||
#include <vcl/weld/MessageDialog.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <vcl/decoview.hxx>
|
||||
#include <vcl/virdev.hxx>
|
||||
#include <vcl/weld/ScrolledWindow.hxx>
|
||||
@@ -57,10 +56,8 @@
|
||||
|
||||
#include <acccfg.hxx>
|
||||
#include <cfg.hxx>
|
||||
#include <CustomNotebookbarGenerator.hxx>
|
||||
#include <SvxMenuConfigPage.hxx>
|
||||
#include <SvxToolbarConfigPage.hxx>
|
||||
#include <SvxNotebookbarConfigPage.hxx>
|
||||
#include <SvxConfigPageHelper.hxx>
|
||||
#include "eventdlg.hxx"
|
||||
#include <dialmgr.hxx>
|
||||
@@ -189,12 +186,6 @@ static std::unique_ptr<SfxTabPage> CreateKeyboardConfigPage( weld::Container* pP
|
||||
return std::make_unique<SfxAcceleratorConfigPage>(pPage, pController, *rSet);
|
||||
}
|
||||
|
||||
static std::unique_ptr<SfxTabPage> CreateSvxNotebookbarConfigPage(weld::Container* pPage, weld::DialogController* pController,
|
||||
const SfxItemSet* rSet)
|
||||
{
|
||||
return std::make_unique<SvxNotebookbarConfigPage>(pPage, pController, *rSet);
|
||||
}
|
||||
|
||||
static std::unique_ptr<SfxTabPage> CreateSvxToolbarConfigPage( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet )
|
||||
{
|
||||
return std::make_unique<SvxToolbarConfigPage>(pPage, pController, *rSet);
|
||||
@@ -221,8 +212,6 @@ SvxConfigDialog::SvxConfigDialog(weld::Window * pParent, const SfxItemSet* pInSe
|
||||
RID_L + RID_TAB_MENUS.sIconName);
|
||||
AddTabPage(u"toolbars"_ustr, TabResId(RID_TAB_TOOLBARS.aLabel), CreateSvxToolbarConfigPage,
|
||||
RID_L + RID_TAB_TOOLBARS.sIconName);
|
||||
AddTabPage(u"notebookbar"_ustr, TabResId(RID_TAB_NOTEBOOKBARS.aLabel),
|
||||
CreateSvxNotebookbarConfigPage, RID_L + RID_TAB_NOTEBOOKBARS.sIconName);
|
||||
AddTabPage(u"contextmenus"_ustr, TabResId(RID_TAB_CONTEXTMENUS.aLabel),
|
||||
CreateSvxContextMenuConfigPage, RID_L + RID_TAB_CONTEXTMENUS.sIconName);
|
||||
AddTabPage(u"keyboard"_ustr, TabResId(RID_TAB_KEYBOARD.aLabel), CreateKeyboardConfigPage,
|
||||
@@ -258,16 +247,6 @@ void SvxConfigDialog::ActivatePage(const OUString& rPage)
|
||||
void SvxConfigDialog::SetFrame(const css::uno::Reference<css::frame::XFrame>& xFrame)
|
||||
{
|
||||
m_xFrame = xFrame;
|
||||
OUString aModuleId = SvxConfigPage::GetFrameWithDefaultAndIdentify(m_xFrame);
|
||||
|
||||
if (aModuleId != "com.sun.star.text.TextDocument" &&
|
||||
aModuleId != "com.sun.star.sheet.SpreadsheetDocument" &&
|
||||
aModuleId != "com.sun.star.presentation.PresentationDocument" &&
|
||||
aModuleId != "com.sun.star.drawing.DrawingDocument")
|
||||
RemoveTabPage(u"notebookbar"_ustr);
|
||||
|
||||
if (aModuleId == "com.sun.star.frame.StartModule")
|
||||
RemoveTabPage(u"keyboard"_ustr);
|
||||
}
|
||||
|
||||
void SvxConfigDialog::PageCreated(const OUString &rId, SfxTabPage& rPage)
|
||||
@@ -955,7 +934,7 @@ SvxMenuEntriesListBox::SvxMenuEntriesListBox(std::unique_ptr<weld::TreeView> xCo
|
||||
, m_xDropDown(m_xControl->create_virtual_device())
|
||||
, m_pPage(pPg)
|
||||
{
|
||||
m_xControl->enable_toggle_buttons(weld::ColumnToggleType::Check);
|
||||
m_xControl->enable_toggle_buttons();
|
||||
CreateDropDown();
|
||||
m_xControl->connect_key_press(LINK(this, SvxMenuEntriesListBox, KeyInputHdl));
|
||||
m_xControl->connect_query_tooltip(LINK(this, SvxMenuEntriesListBox, QueryTooltip));
|
||||
@@ -1038,8 +1017,6 @@ SvxConfigPage::SvxConfigPage(weld::Container* pPage, weld::DialogController* pCo
|
||||
, m_xAddCommandButton(m_xBuilder->weld_button(u"add"_ustr))
|
||||
, m_xRemoveCommandButton(m_xBuilder->weld_button(u"remove"_ustr))
|
||||
{
|
||||
CustomNotebookbarGenerator::getFileNameAndAppName(m_sAppName, m_sFileName);
|
||||
|
||||
m_xTopLevelListBox->connect_changed(LINK(this, SvxConfigPage, SelectElementHdl));
|
||||
|
||||
weld::TreeView& rTreeView = m_xFunctions->get_widget();
|
||||
@@ -1336,9 +1313,9 @@ OUString SvxConfigPage::GetScriptURL() const
|
||||
SfxGroupInfo_Impl *pData = weld::fromId<SfxGroupInfo_Impl*>(m_xFunctions->get_selected_id());
|
||||
if (pData)
|
||||
{
|
||||
if ( ( pData->nKind == SfxCfgKind::FUNCTION_SLOT ) ||
|
||||
( pData->nKind == SfxCfgKind::FUNCTION_SCRIPT ) ||
|
||||
( pData->nKind == SfxCfgKind::GROUP_STYLES ) )
|
||||
if ( ( pData->getKind() == SfxCfgKind::FUNCTION_SLOT ) ||
|
||||
( pData->getKind() == SfxCfgKind::FUNCTION_SCRIPT ) ||
|
||||
( pData->getKind() == SfxCfgKind::GROUP_STYLES ) )
|
||||
{
|
||||
result = pData->sCommand;
|
||||
}
|
||||
@@ -1706,7 +1683,7 @@ IMPL_LINK_NOARG(SvxConfigPage, ImplUpdateDataHdl, Timer*, void)
|
||||
SelectFunctionHdl(m_xFunctions->get_widget());
|
||||
}
|
||||
|
||||
IMPL_LINK_NOARG(SvxConfigPage, SearchUpdateHdl, weld::Entry&, void)
|
||||
IMPL_LINK_NOARG(SvxConfigPage, SearchUpdateHdl, weld::TextWidget&, void)
|
||||
{
|
||||
m_aUpdateDataTimer.Start();
|
||||
}
|
||||
@@ -1867,7 +1844,7 @@ SvxMainMenuOrganizerDialog::~SvxMainMenuOrganizerDialog()
|
||||
{
|
||||
}
|
||||
|
||||
IMPL_LINK_NOARG(SvxMainMenuOrganizerDialog, ModifyHdl, weld::Entry&, void)
|
||||
IMPL_LINK_NOARG(SvxMainMenuOrganizerDialog, ModifyHdl, weld::TextWidget&, void)
|
||||
{
|
||||
// if the Edit control is empty do not change the name
|
||||
if (m_xMenuNameEdit->get_text().isEmpty())
|
||||
|
||||
+129
-135
@@ -38,13 +38,16 @@
|
||||
#include <tools/urlobj.hxx>
|
||||
#include <strings.hrc>
|
||||
#include <bitmaps.hlst>
|
||||
#include <GetDocumentModel.hxx>
|
||||
#include <sfx2/minfitem.hxx>
|
||||
#include <comphelper/SetFlagContextHelper.hxx>
|
||||
#include <comphelper/documentinfo.hxx>
|
||||
#include <comphelper/lok.hxx>
|
||||
#include <comphelper/processfactory.hxx>
|
||||
#include <comphelper/scriptbrowse.hxx>
|
||||
#include <comphelper/sequenceashashmap.hxx>
|
||||
#include <svtools/imagemgr.hxx>
|
||||
#include <svtools/viewoptions.hxx>
|
||||
#include <sal/log.hxx>
|
||||
#include <osl/diagnose.h>
|
||||
#include <dialmgr.hxx>
|
||||
@@ -56,10 +59,10 @@
|
||||
#include <vcl/weld/Builder.hxx>
|
||||
#include <vcl/weld/Dialog.hxx>
|
||||
#include <vcl/weld/Menu.hxx>
|
||||
#include <vcl/weld/weldutils.hxx>
|
||||
|
||||
#include <sfx2/sidebar/ResourceManager.hxx>
|
||||
#include <sfx2/sidebar/Context.hxx>
|
||||
#include <unotools/viewoptions.hxx>
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
using namespace ::com::sun::star::uno;
|
||||
@@ -250,11 +253,11 @@ OUString CuiConfigFunctionListBox::GetCommandHelpText()
|
||||
SfxGroupInfo_Impl *pData = weld::fromId<SfxGroupInfo_Impl*>(get_selected_id());
|
||||
if (pData)
|
||||
{
|
||||
if ( pData->nKind == SfxCfgKind::FUNCTION_SLOT )
|
||||
if ( pData->getKind() == SfxCfgKind::FUNCTION_SLOT )
|
||||
{
|
||||
return Application::GetHelp()->GetHelpText(pData->sCommand);
|
||||
}
|
||||
else if ( pData->nKind == SfxCfgKind::FUNCTION_SCRIPT )
|
||||
else if ( pData->getKind() == SfxCfgKind::FUNCTION_SCRIPT )
|
||||
{
|
||||
return pData->sHelpText;
|
||||
}
|
||||
@@ -311,27 +314,6 @@ void CuiConfigFunctionListBox::ClearAll()
|
||||
possibly existing MacroInfo.
|
||||
*/
|
||||
{
|
||||
sal_uInt16 nCount = aArr.size();
|
||||
for ( sal_uInt16 i=0; i<nCount; ++i )
|
||||
{
|
||||
SfxGroupInfo_Impl *pData = aArr[i].get();
|
||||
|
||||
if ( pData->nKind == SfxCfgKind::FUNCTION_SCRIPT )
|
||||
{
|
||||
OUString* pScriptURI = static_cast<OUString*>(pData->pObject);
|
||||
delete pScriptURI;
|
||||
}
|
||||
|
||||
if ( pData->nKind == SfxCfgKind::GROUP_SCRIPTCONTAINER )
|
||||
{
|
||||
XInterface* xi = static_cast<XInterface *>(pData->pObject);
|
||||
if (xi != nullptr)
|
||||
{
|
||||
xi->release();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
aArr.clear();
|
||||
m_xTreeView->clear();
|
||||
}
|
||||
@@ -339,8 +321,8 @@ void CuiConfigFunctionListBox::ClearAll()
|
||||
OUString CuiConfigFunctionListBox::GetSelectedScriptURI() const
|
||||
{
|
||||
SfxGroupInfo_Impl *pData = weld::fromId<SfxGroupInfo_Impl*>(get_selected_id());
|
||||
if (pData && pData->nKind == SfxCfgKind::FUNCTION_SCRIPT)
|
||||
return *static_cast<OUString*>(pData->pObject);
|
||||
if (pData && pData->getKind() == SfxCfgKind::FUNCTION_SCRIPT)
|
||||
return std::get<size_t(SfxCfgKind::FUNCTION_SCRIPT)>(pData->aData).sUrl;
|
||||
return OUString();
|
||||
}
|
||||
|
||||
@@ -439,30 +421,6 @@ CuiConfigGroupListBox::~CuiConfigGroupListBox()
|
||||
|
||||
void CuiConfigGroupListBox::ClearAll()
|
||||
{
|
||||
sal_uInt16 nCount = aArr.size();
|
||||
for ( sal_uInt16 i=0; i<nCount; ++i )
|
||||
{
|
||||
SfxGroupInfo_Impl *pData = aArr[i].get();
|
||||
if (pData->nKind == SfxCfgKind::GROUP_STYLES && pData->pObject)
|
||||
{
|
||||
SfxStyleInfo_Impl* pStyle = static_cast<SfxStyleInfo_Impl*>(pData->pObject);
|
||||
delete pStyle;
|
||||
}
|
||||
else if (pData->nKind == SfxCfgKind::FUNCTION_SCRIPT && pData->pObject )
|
||||
{
|
||||
OUString* pScriptURI = static_cast<OUString*>(pData->pObject);
|
||||
delete pScriptURI;
|
||||
}
|
||||
else if (pData->nKind == SfxCfgKind::GROUP_SCRIPTCONTAINER)
|
||||
{
|
||||
XInterface* xi = static_cast<XInterface *>(pData->pObject);
|
||||
if (xi != nullptr)
|
||||
{
|
||||
xi->release();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
aArr.clear();
|
||||
m_xTreeView->clear();
|
||||
}
|
||||
@@ -493,7 +451,9 @@ sal_Int32 CuiConfigGroupListBox::InitModule()
|
||||
catch(const css::container::NoSuchElementException&)
|
||||
{ continue; }
|
||||
|
||||
aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_FUNCTION, nGroupID ) );
|
||||
aArr.push_back(
|
||||
std::make_unique<SfxGroupInfo_Impl>(
|
||||
SfxGroupInfo_Data(SfxCfgKindAsIndex<SfxCfgKind::GROUP_FUNCTION>), nGroupID ) );
|
||||
m_xTreeView->append(weld::toId(aArr.back().get()), sGroupName);
|
||||
nAddedGroups++;
|
||||
}
|
||||
@@ -507,6 +467,7 @@ sal_Int32 CuiConfigGroupListBox::InitModule()
|
||||
}
|
||||
|
||||
void CuiConfigGroupListBox::FillScriptList(const css::uno::Reference< css::script::browse::XBrowseNode >& xRootNode,
|
||||
const css::uno::Reference< css::frame::XModel >& xParentDocumentModel,
|
||||
const weld::TreeIter* pParentEntry)
|
||||
{
|
||||
try {
|
||||
@@ -515,8 +476,8 @@ void CuiConfigGroupListBox::FillScriptList(const css::uno::Reference< css::scrip
|
||||
// tdf#120362: Don't ask to enable disabled Java when filling script list
|
||||
css::uno::ContextLayer layer(comphelper::NoEnableJavaInteractionContext());
|
||||
|
||||
const Sequence< Reference< browse::XBrowseNode > > children =
|
||||
xRootNode->getChildNodes();
|
||||
std::vector< Reference< browse::XBrowseNode > > children =
|
||||
comphelper::scriptbrowse::getChildNodes(xRootNode);
|
||||
bool bIsRootNode = false;
|
||||
|
||||
OUString user(u"user"_ustr);
|
||||
@@ -525,6 +486,10 @@ void CuiConfigGroupListBox::FillScriptList(const css::uno::Reference< css::scrip
|
||||
{
|
||||
bIsRootNode = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
comphelper::scriptbrowse::sortNodes(children);
|
||||
}
|
||||
|
||||
//To mimic current starbasic behaviour we
|
||||
//need to make sure that only the current document
|
||||
@@ -546,6 +511,7 @@ void CuiConfigGroupListBox::FillScriptList(const css::uno::Reference< css::scrip
|
||||
|
||||
bool bDisplay = true;
|
||||
OUString uiName = theChild->getName();
|
||||
Reference< XModel > xDocumentModel;
|
||||
if ( bIsRootNode )
|
||||
{
|
||||
if ( ! (uiName == user || uiName == share ||
|
||||
@@ -563,20 +529,24 @@ void CuiConfigGroupListBox::FillScriptList(const css::uno::Reference< css::scrip
|
||||
{
|
||||
uiName = xImp->m_sProdMacros;
|
||||
}
|
||||
else
|
||||
{
|
||||
xDocumentModel = getDocumentModel(m_xContext, uiName);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
xDocumentModel = xParentDocumentModel;
|
||||
}
|
||||
if (theChild->getType() != browse::BrowseNodeTypes::SCRIPT && bDisplay )
|
||||
{
|
||||
// We call acquire on the XBrowseNode so that it does not
|
||||
// get autodestructed and become invalid when accessed later.
|
||||
theChild->acquire();
|
||||
|
||||
bool bChildOnDemand = false;
|
||||
|
||||
if ( theChild->hasChildNodes() )
|
||||
{
|
||||
const Sequence< Reference< browse::XBrowseNode > > grandchildren =
|
||||
theChild->getChildNodes();
|
||||
const std::vector< Reference< browse::XBrowseNode > > grandchildren =
|
||||
comphelper::scriptbrowse::getChildNodes(theChild);
|
||||
|
||||
for ( const auto& rxNode : grandchildren )
|
||||
{
|
||||
@@ -593,8 +563,12 @@ void CuiConfigGroupListBox::FillScriptList(const css::uno::Reference< css::scrip
|
||||
|
||||
OUString aImage = GetImage(theChild, m_xContext, bIsRootNode);
|
||||
|
||||
aArr.push_back( std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_SCRIPTCONTAINER,
|
||||
0, static_cast<void *>( theChild.get())));
|
||||
aArr.push_back(
|
||||
std::make_unique<SfxGroupInfo_Impl>(
|
||||
SfxGroupInfo_Data(
|
||||
SfxCfgKindAsIndex<SfxCfgKind::GROUP_SCRIPTCONTAINER>, theChild,
|
||||
xDocumentModel),
|
||||
0));
|
||||
|
||||
OUString sId(weld::toId(aArr.back().get()));
|
||||
m_xTreeView->insert(pParentEntry, -1, &uiName, &sId, nullptr, nullptr, bChildOnDemand, m_xScratchIter.get());
|
||||
@@ -616,7 +590,8 @@ void CuiConfigGroupListBox::FillFunctionsList(const css::uno::Sequence<DispatchI
|
||||
auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(rInfo.Command, m_sModuleLongName);
|
||||
|
||||
OUString sUIName = MapCommand2UIName(rInfo.Command);
|
||||
aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::FUNCTION_SLOT, 0 ) );
|
||||
aArr.push_back( std::make_unique<SfxGroupInfo_Impl>(
|
||||
SfxGroupInfo_Data(SfxCfgKindAsIndex<SfxCfgKind::FUNCTION_SLOT>), 0 ) );
|
||||
SfxGroupInfo_Impl* pGrpInfo = aArr.back().get();
|
||||
pGrpInfo->sCommand = rInfo.Command;
|
||||
pGrpInfo->sLabel = sUIName;
|
||||
@@ -669,7 +644,8 @@ void CuiConfigGroupListBox::Init(const css::uno::Reference< css::uno::XComponent
|
||||
// add All Commands to the top
|
||||
if ( bEventMode && nAddedGroups )
|
||||
{
|
||||
aArr.insert(aArr.begin(), std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_ALLFUNCTIONS, 0));
|
||||
aArr.insert(aArr.begin(), std::make_unique<SfxGroupInfo_Impl>(
|
||||
SfxGroupInfo_Data(SfxCfgKindAsIndex<SfxCfgKind::GROUP_ALLFUNCTIONS>), 0));
|
||||
OUString sId(weld::toId(aArr.front().get()));
|
||||
OUString s(CuiResId(RID_CUISTR_ALLFUNCTIONS));
|
||||
m_xTreeView->insert(nullptr, 0, &s, &sId, nullptr, nullptr, false, nullptr);
|
||||
@@ -680,12 +656,11 @@ void CuiConfigGroupListBox::Init(const css::uno::Reference< css::uno::XComponent
|
||||
{
|
||||
if ( bEventMode )
|
||||
{
|
||||
//We call acquire on the XBrowseNode so that it does not
|
||||
//get autodestructed and become invalid when accessed later.
|
||||
rootNode->acquire();
|
||||
|
||||
aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_SCRIPTCONTAINER, 0,
|
||||
static_cast<void *>(rootNode.get())));
|
||||
aArr.push_back(
|
||||
std::make_unique<SfxGroupInfo_Impl>(
|
||||
SfxGroupInfo_Data(SfxCfgKindAsIndex<SfxCfgKind::GROUP_SCRIPTCONTAINER>,
|
||||
rootNode),
|
||||
0) );
|
||||
OUString aTitle(xImp->m_sDlgMacros);
|
||||
OUString sId(weld::toId(aArr.back().get()));
|
||||
m_xTreeView->insert(nullptr, -1, &aTitle, &sId, nullptr, nullptr, true, nullptr);
|
||||
@@ -694,19 +669,24 @@ void CuiConfigGroupListBox::Init(const css::uno::Reference< css::uno::XComponent
|
||||
{
|
||||
//We are only showing scripts not slot APIs so skip
|
||||
//Root node and show location nodes
|
||||
FillScriptList(rootNode, nullptr);
|
||||
FillScriptList(rootNode, css::uno::Reference<css::frame::XModel>(), nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
// add styles and sidebar decks to the end
|
||||
if ( bEventMode )
|
||||
{
|
||||
aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_STYLES, 0, nullptr ) ); // TODO last parameter should contain user data
|
||||
aArr.push_back( std::make_unique<SfxGroupInfo_Impl>(
|
||||
// TODO last parameter should contain user data
|
||||
SfxGroupInfo_Data(SfxCfgKindAsIndex<SfxCfgKind::GROUP_STYLES>),
|
||||
0 ) );
|
||||
OUString sStyle(xImp->m_aStrGroupStyles);
|
||||
OUString sId(weld::toId(aArr.back().get()));
|
||||
m_xTreeView->insert(nullptr, -1, &sStyle, &sId, nullptr, nullptr, true, nullptr);
|
||||
|
||||
aArr.push_back( std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_SIDEBARDECKS, 0));
|
||||
aArr.push_back(
|
||||
std::make_unique<SfxGroupInfo_Impl>(
|
||||
SfxGroupInfo_Data(SfxCfgKindAsIndex<SfxCfgKind::GROUP_SIDEBARDECKS>), 0) );
|
||||
OUString sSidebarDecks(xImp->m_aStrGroupSidebarDecks);
|
||||
sId = weld::toId(aArr.back().get());
|
||||
m_xTreeView->insert(nullptr, -1, &sSidebarDecks, &sId, nullptr, nullptr, false, nullptr);
|
||||
@@ -776,34 +756,6 @@ OUString CuiConfigGroupListBox::GetImage(
|
||||
return aImage;
|
||||
}
|
||||
|
||||
Reference< XInterface >
|
||||
CuiConfigGroupListBox::getDocumentModel( Reference< XComponentContext > const & xCtx, std::u16string_view docName )
|
||||
{
|
||||
Reference< XInterface > xModel;
|
||||
Reference< frame::XDesktop2 > desktop = frame::Desktop::create( xCtx );
|
||||
|
||||
Reference< container::XEnumerationAccess > componentsAccess =
|
||||
desktop->getComponents();
|
||||
Reference< container::XEnumeration > components =
|
||||
componentsAccess->createEnumeration();
|
||||
while (components->hasMoreElements())
|
||||
{
|
||||
Reference< frame::XModel > model(
|
||||
components->nextElement(), UNO_QUERY );
|
||||
if ( model.is() )
|
||||
{
|
||||
OUString sTdocUrl =
|
||||
::comphelper::DocumentInfo::getDocumentTitle( model );
|
||||
if( sTdocUrl == docName )
|
||||
{
|
||||
xModel = model;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return xModel;
|
||||
}
|
||||
|
||||
OUString CuiConfigGroupListBox::MapCommand2UIName(const OUString& sCommand)
|
||||
{
|
||||
OUString sUIName;
|
||||
@@ -845,7 +797,7 @@ void CuiConfigGroupListBox::GroupSelected()
|
||||
m_pFunctionListBox->freeze();
|
||||
m_pFunctionListBox->ClearAll();
|
||||
|
||||
switch ( pInfo->nKind )
|
||||
switch ( pInfo->getKind() )
|
||||
{
|
||||
case SfxCfgKind::GROUP_ALLFUNCTIONS:
|
||||
{
|
||||
@@ -854,7 +806,7 @@ void CuiConfigGroupListBox::GroupSelected()
|
||||
while (bValidIter)
|
||||
{
|
||||
SfxGroupInfo_Impl *pCurrentInfo = weld::fromId<SfxGroupInfo_Impl*>(m_xTreeView->get_id(*xIter));
|
||||
if (pCurrentInfo->nKind == SfxCfgKind::GROUP_FUNCTION)
|
||||
if (pCurrentInfo->getKind() == SfxCfgKind::GROUP_FUNCTION)
|
||||
{
|
||||
css::uno::Sequence< css::frame::DispatchInformation > lCommands;
|
||||
try
|
||||
@@ -882,14 +834,14 @@ void CuiConfigGroupListBox::GroupSelected()
|
||||
|
||||
case SfxCfgKind::GROUP_SCRIPTCONTAINER:
|
||||
{
|
||||
Reference< browse::XBrowseNode > rootNode(
|
||||
static_cast< browse::XBrowseNode* >( pInfo->pObject ) ) ;
|
||||
const SfxScriptContainer_Data& rContainerData =
|
||||
std::get<size_t(SfxCfgKind::GROUP_SCRIPTCONTAINER)>(pInfo->aData);
|
||||
|
||||
try {
|
||||
if ( rootNode->hasChildNodes() )
|
||||
if ( rContainerData.xBrowseNode->hasChildNodes() )
|
||||
{
|
||||
const Sequence< Reference< browse::XBrowseNode > > children =
|
||||
rootNode->getChildNodes();
|
||||
const std::vector< Reference< browse::XBrowseNode > > children =
|
||||
comphelper::scriptbrowse::getSortedChildNodes(rContainerData.xBrowseNode);
|
||||
|
||||
for ( const Reference< browse::XBrowseNode >& childNode : children )
|
||||
{
|
||||
@@ -919,10 +871,13 @@ void CuiConfigGroupListBox::GroupSelected()
|
||||
// do nothing, the description will be empty
|
||||
}
|
||||
|
||||
OUString* pScriptURI = new OUString( uri );
|
||||
|
||||
OUString aImage = GetImage(childNode, Reference< XComponentContext >(), false);
|
||||
m_pFunctionListBox->aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::FUNCTION_SCRIPT, 0, pScriptURI ));
|
||||
m_pFunctionListBox->aArr.push_back(
|
||||
std::make_unique<SfxGroupInfo_Impl>(
|
||||
SfxGroupInfo_Data(
|
||||
SfxCfgKindAsIndex<SfxCfgKind::FUNCTION_SCRIPT>, uri,
|
||||
rContainerData.xModel),
|
||||
0 ));
|
||||
m_pFunctionListBox->aArr.back()->sCommand = uri;
|
||||
m_pFunctionListBox->aArr.back()->sLabel = childNode->getName();
|
||||
m_pFunctionListBox->aArr.back()->sHelpText = description;
|
||||
@@ -941,18 +896,24 @@ void CuiConfigGroupListBox::GroupSelected()
|
||||
|
||||
case SfxCfgKind::GROUP_STYLES :
|
||||
{
|
||||
SfxStyleInfo_Impl* pFamily = static_cast<SfxStyleInfo_Impl*>(pInfo->pObject);
|
||||
SfxStyleInfo_Impl* pFamily
|
||||
= std::get<size_t(SfxCfgKind::GROUP_STYLES)>(pInfo->aData).get();
|
||||
|
||||
if (pFamily)
|
||||
{
|
||||
const std::vector< SfxStyleInfo_Impl > lStyles = m_pStylesInfo->getStyles(pFamily->sFamily);
|
||||
for (auto const& lStyle : lStyles)
|
||||
{
|
||||
SfxStyleInfo_Impl* pStyle = new SfxStyleInfo_Impl(lStyle);
|
||||
m_pFunctionListBox->aArr.push_back(std::make_unique<SfxGroupInfo_Impl>(SfxCfgKind::GROUP_STYLES, 0, pStyle));
|
||||
m_pFunctionListBox->aArr.back()->sCommand = pStyle->sCommand;
|
||||
m_pFunctionListBox->aArr.back()->sLabel = pStyle->sLabel;
|
||||
auto pStyle = std::make_unique<SfxStyleInfo_Impl>(lStyle);
|
||||
m_pFunctionListBox->aArr.push_back(
|
||||
std::make_unique<SfxGroupInfo_Impl>(
|
||||
SfxGroupInfo_Data(SfxCfgKindAsIndex<SfxCfgKind::GROUP_STYLES>,
|
||||
std::move(pStyle)),
|
||||
0));
|
||||
m_pFunctionListBox->aArr.back()->sCommand = lStyle.sCommand;
|
||||
m_pFunctionListBox->aArr.back()->sLabel = lStyle.sLabel;
|
||||
OUString sId(weld::toId(m_pFunctionListBox->aArr.back().get()));
|
||||
m_pFunctionListBox->append(sId, pStyle->sLabel);
|
||||
m_pFunctionListBox->append(sId, lStyle.sLabel);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -968,9 +929,9 @@ void CuiConfigGroupListBox::GroupSelected()
|
||||
for (auto const& rDeck : aDecks)
|
||||
{
|
||||
const OUString sCommand = ".uno:SidebarDeck." + rDeck.msId;
|
||||
m_pFunctionListBox->aArr.push_back(std::make_unique<SfxGroupInfo_Impl>(
|
||||
SfxCfgKind::GROUP_SIDEBARDECKS, 0,
|
||||
nullptr));
|
||||
m_pFunctionListBox->aArr.push_back(
|
||||
std::make_unique<SfxGroupInfo_Impl>(
|
||||
SfxGroupInfo_Data(SfxCfgKindAsIndex<SfxCfgKind::GROUP_SIDEBARDECKS>), 0));
|
||||
m_pFunctionListBox->aArr.back()->sCommand = sCommand;
|
||||
m_pFunctionListBox->aArr.back()->sLabel = rDeck.msId;
|
||||
m_pFunctionListBox->aArr.back()->sTooltip =
|
||||
@@ -984,7 +945,7 @@ void CuiConfigGroupListBox::GroupSelected()
|
||||
|
||||
default:
|
||||
// Do nothing, the list box will stay empty
|
||||
SAL_INFO( "cui.customize", "Ignoring unexpected SfxCfgKind: " << static_cast<int>(pInfo->nKind) );
|
||||
SAL_INFO( "cui.customize", "Ignoring unexpected SfxCfgKind: " << pInfo->aData.index() );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1000,15 +961,15 @@ void CuiConfigGroupListBox::GroupSelected()
|
||||
IMPL_LINK(CuiConfigGroupListBox, ExpandingHdl, const weld::TreeIter&, rIter, bool)
|
||||
{
|
||||
SfxGroupInfo_Impl *pInfo = weld::fromId<SfxGroupInfo_Impl*>(m_xTreeView->get_id(rIter));
|
||||
switch ( pInfo->nKind )
|
||||
switch ( pInfo->getKind() )
|
||||
{
|
||||
case SfxCfgKind::GROUP_SCRIPTCONTAINER:
|
||||
{
|
||||
if (!m_xTreeView->iter_has_child(rIter))
|
||||
{
|
||||
Reference< browse::XBrowseNode > rootNode(
|
||||
static_cast< browse::XBrowseNode* >( pInfo->pObject ) ) ;
|
||||
FillScriptList(rootNode, &rIter);
|
||||
const SfxScriptContainer_Data& rContainerData =
|
||||
std::get<size_t(SfxCfgKind::GROUP_SCRIPTCONTAINER)>(pInfo->aData);
|
||||
FillScriptList(rContainerData.xBrowseNode, rContainerData.xModel, &rIter);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1020,10 +981,14 @@ IMPL_LINK(CuiConfigGroupListBox, ExpandingHdl, const weld::TreeIter&, rIter, boo
|
||||
const std::vector<SfxStyleInfo_Impl> lStyleFamilies = m_pStylesInfo->getStyleFamilies();
|
||||
for (auto const& lStyleFamily : lStyleFamilies)
|
||||
{
|
||||
SfxStyleInfo_Impl* pFamily = new SfxStyleInfo_Impl(lStyleFamily);
|
||||
aArr.push_back( std::make_unique<SfxGroupInfo_Impl>( SfxCfgKind::GROUP_STYLES, 0, pFamily ));
|
||||
auto pFamily = std::make_unique<SfxStyleInfo_Impl>(lStyleFamily);
|
||||
aArr.push_back(
|
||||
std::make_unique<SfxGroupInfo_Impl>(
|
||||
SfxGroupInfo_Data(SfxCfgKindAsIndex<SfxCfgKind::GROUP_STYLES>,
|
||||
std::move(pFamily)),
|
||||
0 ));
|
||||
OUString sId(weld::toId(aArr.back().get()));
|
||||
m_xTreeView->insert(&rIter, -1, &pFamily->sLabel, &sId, nullptr, nullptr, false, nullptr);
|
||||
m_xTreeView->insert(&rIter, -1, &lStyleFamily.sLabel, &sId, nullptr, nullptr, false, nullptr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1301,9 +1266,9 @@ SvxScriptSelectorDialog::GetScriptURL() const
|
||||
if (std::unique_ptr<weld::TreeIter> xIter = m_xCommands->get_selected())
|
||||
{
|
||||
SfxGroupInfo_Impl *pData = weld::fromId<SfxGroupInfo_Impl*>(m_xCommands->get_id(*xIter));
|
||||
if ( ( pData->nKind == SfxCfgKind::FUNCTION_SLOT )
|
||||
|| ( pData->nKind == SfxCfgKind::FUNCTION_SCRIPT )
|
||||
|| ( pData->nKind == SfxCfgKind::GROUP_STYLES )
|
||||
if ( ( pData->getKind() == SfxCfgKind::FUNCTION_SLOT )
|
||||
|| ( pData->getKind() == SfxCfgKind::FUNCTION_SCRIPT )
|
||||
|| ( pData->getKind() == SfxCfgKind::GROUP_STYLES )
|
||||
)
|
||||
{
|
||||
result = pData->sCommand;
|
||||
@@ -1313,6 +1278,31 @@ SvxScriptSelectorDialog::GetScriptURL() const
|
||||
return result;
|
||||
}
|
||||
|
||||
css::uno::Reference<css::frame::XModel>
|
||||
SvxScriptSelectorDialog::GetScriptModel() const
|
||||
{
|
||||
Reference<frame::XModel> xModel;
|
||||
|
||||
if (std::unique_ptr<weld::TreeIter> xIter = m_xCommands->get_selected())
|
||||
{
|
||||
SfxGroupInfo_Impl *pData = weld::fromId<SfxGroupInfo_Impl*>(m_xCommands->get_id(*xIter));
|
||||
|
||||
switch (pData->getKind())
|
||||
{
|
||||
case SfxCfgKind::FUNCTION_SCRIPT:
|
||||
xModel = std::get<size_t(SfxCfgKind::FUNCTION_SCRIPT)>(pData->aData).xModel;
|
||||
break;
|
||||
case SfxCfgKind::GROUP_SCRIPTCONTAINER:
|
||||
xModel = std::get<size_t(SfxCfgKind::GROUP_SCRIPTCONTAINER)>(pData->aData).xModel;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return xModel;
|
||||
}
|
||||
|
||||
void
|
||||
SvxScriptSelectorDialog::SaveLastUsedMacro()
|
||||
{
|
||||
@@ -1380,12 +1370,16 @@ SvxScriptSelectorDialog::LoadLastUsedMacro()
|
||||
xCategories.expand_row(*xIter);
|
||||
nOpenedNodes++;
|
||||
}
|
||||
if (xCategories.iter_has_child(*xIter))
|
||||
if (nOpenedNodes < nInfoParts - 1)
|
||||
{
|
||||
if (!xCategories.iter_has_child(*xIter))
|
||||
{
|
||||
// If the number of levels in the tree is smaller than the number of parts in the
|
||||
// macro info string, then return
|
||||
return;
|
||||
}
|
||||
(void)xCategories.iter_children(*xIter);
|
||||
else if (nOpenedNodes < nInfoParts - 1)
|
||||
// If the number of levels in the tree is smaller than the
|
||||
// number of parts in the macro info string, then return
|
||||
return;
|
||||
}
|
||||
}
|
||||
xCategories.select(*xIter);
|
||||
xCategories.scroll_to_row(*xIter);
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <vcl/weld/ComboBox.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <vcl/weld/Container.hxx>
|
||||
|
||||
#include <macropg.hxx>
|
||||
|
||||
#include <com/sun/star/frame/XFrame.hpp>
|
||||
|
||||
@@ -20,10 +20,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <svl/itemset.hxx>
|
||||
#include <vcl/weld/Button.hxx>
|
||||
#include <vcl/weld/DialogController.hxx>
|
||||
#include <vcl/weld/Entry.hxx>
|
||||
#include <vcl/weld/TreeView.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <vcl/weld/Window.hxx>
|
||||
|
||||
class SvxMacroTabPage_Impl
|
||||
{
|
||||
|
||||
@@ -719,7 +719,7 @@ bool AdditionsItem::getExtensionFile(OUString& sExtensionFile)
|
||||
|
||||
IMPL_LINK_NOARG(AdditionsDialog, ImplUpdateDataHdl, Timer*, void) { RefreshUI(); }
|
||||
|
||||
IMPL_LINK_NOARG(AdditionsDialog, SearchUpdateHdl, weld::Entry&, void)
|
||||
IMPL_LINK_NOARG(AdditionsDialog, SearchUpdateHdl, weld::TextWidget&, void)
|
||||
{
|
||||
m_aSearchDataTimer.Start();
|
||||
}
|
||||
|
||||
@@ -14,15 +14,19 @@
|
||||
#include <bitmaps.hlst>
|
||||
#include <cfgutil.hxx>
|
||||
#include <dialmgr.hxx>
|
||||
#include <GetDocumentModel.hxx>
|
||||
#include <scriptdlg.hxx>
|
||||
#include <strings.hrc>
|
||||
#include <basctl/basctldllpublic.hxx>
|
||||
#include <basctl/sbxitem.hxx>
|
||||
#include <basctl/scriptdocument.hxx>
|
||||
#include <basic/basmgr.hxx>
|
||||
#include <basic/sbmeth.hxx>
|
||||
#include <comphelper/SetFlagContextHelper.hxx>
|
||||
#include <comphelper/diagnose_ex.hxx>
|
||||
#include <comphelper/documentinfo.hxx>
|
||||
#include <comphelper/processfactory.hxx>
|
||||
#include <comphelper/scriptbrowse.hxx>
|
||||
#include <osl/file.hxx>
|
||||
#include <rtl/ustrbuf.hxx>
|
||||
#include <sfx2/app.hxx>
|
||||
@@ -34,8 +38,9 @@
|
||||
#include <svl/itemset.hxx>
|
||||
#include <svl/stritem.hxx>
|
||||
#include <svtools/dlgname.hxx>
|
||||
#include <svtools/viewoptions.hxx>
|
||||
#include <svx/passwd.hxx>
|
||||
#include <unotools/viewoptions.hxx>
|
||||
#include <tools/debug.hxx>
|
||||
#include <vcl/commandevent.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vcl/vclenum.hxx>
|
||||
@@ -43,6 +48,8 @@
|
||||
#include <vcl/weld/Dialog.hxx>
|
||||
#include <vcl/weld/MessageDialog.hxx>
|
||||
#include <vcl/weld/Menu.hxx>
|
||||
#include <vcl/weld/WaitObject.hxx>
|
||||
#include <vcl/weld/weldutils.hxx>
|
||||
|
||||
#include <com/sun/star/beans/XPropertySet.hpp>
|
||||
#include <com/sun/star/frame/XFrame.hpp>
|
||||
@@ -51,10 +58,10 @@
|
||||
#include <com/sun/star/script/browse/BrowseNodeTypes.hpp>
|
||||
#include <com/sun/star/script/browse/theBrowseNodeFactory.hpp>
|
||||
#include <com/sun/star/script/browse/BrowseNodeFactoryViewTypes.hpp>
|
||||
#include <com/sun/star/script/browse/XCopyableBrowseNode.hpp>
|
||||
#include <com/sun/star/script/XLibraryContainer2.hpp>
|
||||
#include <com/sun/star/script/XLibraryContainerPassword.hpp>
|
||||
#include <com/sun/star/script/XPersistentLibraryContainer.hpp>
|
||||
#include <com/sun/star/script/XInvocation.hpp>
|
||||
#include <com/sun/star/script/XStorageBasedLibraryContainer.hpp>
|
||||
#include <com/sun/star/uno/RuntimeException.hpp>
|
||||
|
||||
@@ -220,6 +227,7 @@ void ScriptContainersListBox::Fill(const weld::TreeIter* pEntryIter)
|
||||
weld::WaitObject aWait(m_pMacroManagerDialog->getDialog());
|
||||
|
||||
css::uno::Reference<css::script::browse::XBrowseNode> xNode;
|
||||
css::uno::Reference<css::frame::XModel> xParentDocumentModel;
|
||||
if (pEntryIter == nullptr)
|
||||
{
|
||||
ClearAll();
|
||||
@@ -245,6 +253,7 @@ void ScriptContainersListBox::Fill(const weld::TreeIter* pEntryIter)
|
||||
= weld::fromId<ScriptContainerInfo*>(m_xTreeView->get_id(*pEntryIter));
|
||||
|
||||
xNode.set(pScriptContainerInfoEntry->pBrowseNode);
|
||||
xParentDocumentModel.set(pScriptContainerInfoEntry->xModel);
|
||||
|
||||
Remove(pEntryIter, /*bRemoveEntryIter*/ false);
|
||||
}
|
||||
@@ -282,8 +291,12 @@ void ScriptContainersListBox::Fill(const weld::TreeIter* pEntryIter)
|
||||
currentDocTitle = comphelper::DocumentInfo::getDocumentTitle(xModel);
|
||||
}
|
||||
|
||||
const css::uno::Sequence<css::uno::Reference<css::script::browse::XBrowseNode>> children
|
||||
= xNode->getChildNodes();
|
||||
std::vector<css::uno::Reference<css::script::browse::XBrowseNode>> children
|
||||
= comphelper::scriptbrowse::getChildNodes(xNode);
|
||||
|
||||
if (!bIsRootNode)
|
||||
comphelper::scriptbrowse::sortNodes(children);
|
||||
|
||||
for (css::uno::Reference<css::script::browse::XBrowseNode> const& theChild : children)
|
||||
{
|
||||
if (!theChild.is())
|
||||
@@ -296,6 +309,7 @@ void ScriptContainersListBox::Fill(const weld::TreeIter* pEntryIter)
|
||||
continue;
|
||||
|
||||
OUString uiName = theChild->getName();
|
||||
css::uno::Reference<css::frame::XModel> xDocumentModel;
|
||||
if (bIsRootNode)
|
||||
{
|
||||
if (uiName == user)
|
||||
@@ -314,6 +328,14 @@ void ScriptContainersListBox::Fill(const weld::TreeIter* pEntryIter)
|
||||
// containers.
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
xDocumentModel = getDocumentModel(m_xContext, uiName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
xDocumentModel = xParentDocumentModel;
|
||||
}
|
||||
|
||||
// We call acquire on the XBrowseNode so that it does not
|
||||
@@ -324,8 +346,8 @@ void ScriptContainersListBox::Fill(const weld::TreeIter* pEntryIter)
|
||||
|
||||
if (theChild->hasChildNodes())
|
||||
{
|
||||
const css::uno::Sequence<css::uno::Reference<css::script::browse::XBrowseNode>>
|
||||
grandchildren = theChild->getChildNodes();
|
||||
const std::vector<css::uno::Reference<css::script::browse::XBrowseNode>>
|
||||
grandchildren = comphelper::scriptbrowse::getChildNodes(theChild);
|
||||
for (const auto& rxNode : grandchildren)
|
||||
{
|
||||
if (!rxNode.is())
|
||||
@@ -339,7 +361,7 @@ void ScriptContainersListBox::Fill(const weld::TreeIter* pEntryIter)
|
||||
}
|
||||
|
||||
OUString aImage = CuiConfigGroupListBox::GetImage(theChild, m_xContext, bIsRootNode);
|
||||
Insert(theChild, pEntryIter, uiName, aImage, bChildOnDemand);
|
||||
Insert(theChild, xDocumentModel, pEntryIter, uiName, aImage, bChildOnDemand);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -376,7 +398,8 @@ void ScriptContainersListBox::Fill(const weld::TreeIter* pEntryIter)
|
||||
|
||||
for (const OUString& rDlgName : aDocument.getObjectNames(basctl::E_DIALOGS, aLibName))
|
||||
{
|
||||
Insert(nullptr, pEntryIter, rDlgName, RID_CUIBMP_DIALOG, false);
|
||||
Insert(nullptr, xParentDocumentModel, pEntryIter, rDlgName, RID_CUIBMP_DIALOG,
|
||||
false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -384,12 +407,13 @@ void ScriptContainersListBox::Fill(const weld::TreeIter* pEntryIter)
|
||||
|
||||
void ScriptContainersListBox::Insert(
|
||||
const css::uno::Reference<css::script::browse::XBrowseNode>& xInsertNode,
|
||||
const weld::TreeIter* pIter, const OUString& rsUiName, const OUString& rsImage,
|
||||
bool bChildOnDemand, int nPos, weld::TreeIter* pRet)
|
||||
const css::uno::Reference<css::frame::XModel>& xDocumentModel, const weld::TreeIter* pIter,
|
||||
const OUString& rsUiName, const OUString& rsImage, bool bChildOnDemand, int nPos,
|
||||
weld::TreeIter* pRet)
|
||||
{
|
||||
std::unique_ptr<weld::TreeIter> xNewEntryIter = m_xTreeView->make_iterator();
|
||||
|
||||
OUString sId(weld::toId(new ScriptContainerInfo(xInsertNode.get())));
|
||||
OUString sId(weld::toId(new ScriptContainerInfo(xInsertNode.get(), xDocumentModel)));
|
||||
m_xTreeView->insert(pIter, nPos, &rsUiName, &sId, nullptr, nullptr, bChildOnDemand,
|
||||
xNewEntryIter.get());
|
||||
m_xTreeView->set_image(*xNewEntryIter, rsImage);
|
||||
@@ -456,8 +480,8 @@ void ScriptContainersListBox::ScriptContainerSelected()
|
||||
{
|
||||
if (xBrowseNode->hasChildNodes())
|
||||
{
|
||||
const css::uno::Sequence<css::uno::Reference<css::script::browse::XBrowseNode>>
|
||||
children = xBrowseNode->getChildNodes();
|
||||
const std::vector<css::uno::Reference<css::script::browse::XBrowseNode>> children
|
||||
= comphelper::scriptbrowse::getSortedChildNodes(xBrowseNode);
|
||||
|
||||
for (const css::uno::Reference<css::script::browse::XBrowseNode>& childNode :
|
||||
children)
|
||||
@@ -498,8 +522,8 @@ void ScriptContainersListBox::ScriptContainerSelected()
|
||||
|
||||
childNode->acquire();
|
||||
|
||||
m_pScriptsListBox->aArr.push_back(
|
||||
std::make_unique<ScriptInfo>(childNode.get(), sURI, sDescription));
|
||||
m_pScriptsListBox->aArr.push_back(std::make_unique<ScriptInfo>(
|
||||
childNode.get(), sURI, sDescription, pScriptContainerInfo->xModel));
|
||||
|
||||
OUString sId(weld::toId(m_pScriptsListBox->aArr.back().get()));
|
||||
m_pScriptsListBox->append(sId, childNode->getName(), RID_CUIBMP_MACRO);
|
||||
@@ -656,6 +680,8 @@ MacroManagerDialog::MacroManagerDialog(weld::Window* pParent,
|
||||
, m_xMacroDeleteButton(m_xBuilder->weld_button(u"macrodelete"_ustr))
|
||||
, m_xMacroCreateButton(m_xBuilder->weld_button(u"macrocreate"_ustr))
|
||||
, m_xMacroRenameButton(m_xBuilder->weld_button(u"macrorename"_ustr))
|
||||
, m_xModuleCopyButton(m_xBuilder->weld_button(u"modulecopy"_ustr))
|
||||
, m_xModulePasteButton(m_xBuilder->weld_button(u"modulepaste"_ustr))
|
||||
, m_xAssignButton(m_xBuilder->weld_button(u"assign"_ustr))
|
||||
{
|
||||
m_aScriptsListBoxLabelBaseStr = m_xScriptsListBoxLabel->get_label();
|
||||
@@ -686,6 +712,8 @@ MacroManagerDialog::MacroManagerDialog(weld::Window* pParent,
|
||||
m_xMacroEditButton->connect_clicked(LINK(this, MacroManagerDialog, ClickHdl));
|
||||
m_xMacroRenameButton->connect_clicked(LINK(this, MacroManagerDialog, ClickHdl));
|
||||
m_xMacroDeleteButton->connect_clicked(LINK(this, MacroManagerDialog, ClickHdl));
|
||||
m_xModuleCopyButton->connect_clicked(LINK(this, MacroManagerDialog, ClickHdl));
|
||||
m_xModulePasteButton->connect_clicked(LINK(this, MacroManagerDialog, ClickHdl));
|
||||
|
||||
StartListening(*SfxGetpApp());
|
||||
}
|
||||
@@ -903,23 +931,6 @@ IMPL_LINK(MacroManagerDialog, ContextMenuHdl, const CommandEvent&, rCEvt, bool)
|
||||
return true;
|
||||
}
|
||||
|
||||
// same as OUString SvxScriptOrgDialog::getBoolProperty((Reference<beans::XPropertySet> const& xProps, OUString const& propName)
|
||||
// cui/source/dialogs/scriptdlg.cxx
|
||||
bool MacroManagerDialog::getBoolProperty(
|
||||
css::uno::Reference<css::beans::XPropertySet> const& xProps, OUString const& propName)
|
||||
{
|
||||
bool result = false;
|
||||
try
|
||||
{
|
||||
xProps->getPropertyValue(propName) >>= result;
|
||||
}
|
||||
catch (css::uno::Exception&)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
css::uno::Reference<css::script::browse::XBrowseNode>
|
||||
MacroManagerDialog::getBrowseNode(const weld::TreeView& rTreeView, const weld::TreeIter& rTreeIter)
|
||||
{
|
||||
@@ -989,6 +1000,8 @@ void MacroManagerDialog::CheckButtons()
|
||||
bool bSensitiveLibraryPasswordButton = false;
|
||||
bool bSensitiveLibraryImportButton = false;
|
||||
bool bSensitiveLibraryExportButton = false;
|
||||
bool bSensitiveModuleCopyButton = false;
|
||||
bool bSensitiveModulePasteButton = false;
|
||||
|
||||
bool bSensitiveMacroRunButton = false;
|
||||
bool bSensitiveMacroCreateButton = false;
|
||||
@@ -1032,14 +1045,9 @@ void MacroManagerDialog::CheckButtons()
|
||||
rScriptContainersTreeView, *xScriptContainersSelectedIter);
|
||||
if (node.is())
|
||||
{
|
||||
css::uno::Reference<css::beans::XPropertySet> xProps(
|
||||
node, css::uno::UNO_QUERY);
|
||||
if (xProps.is())
|
||||
if (comphelper::scriptbrowse::isCreatable(node))
|
||||
{
|
||||
if (getBoolProperty(xProps, "Creatable"))
|
||||
{
|
||||
bSensitiveNewLibraryButton = true;
|
||||
}
|
||||
bSensitiveNewLibraryButton = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1122,34 +1130,43 @@ void MacroManagerDialog::CheckButtons()
|
||||
}
|
||||
}
|
||||
|
||||
if (!bSharedLocationContainer && nSelectedIterDepth > 1)
|
||||
if (!bSharedLocationContainer)
|
||||
{
|
||||
css::uno::Reference<css::script::browse::XBrowseNode> node
|
||||
= getBrowseNode(rScriptContainersTreeView, *xScriptContainersSelectedIter);
|
||||
if (node.is())
|
||||
{
|
||||
css::uno::Reference<css::beans::XPropertySet> xProps(node, css::uno::UNO_QUERY);
|
||||
if (xProps.is())
|
||||
if (nSelectedIterDepth > 1)
|
||||
{
|
||||
if (getBoolProperty(xProps, "Creatable")
|
||||
if (comphelper::scriptbrowse::isCreatable(node)
|
||||
&& rScriptContainersTreeView.get_iter_depth(
|
||||
*xScriptContainersSelectedIter)
|
||||
== 2) // library entry
|
||||
{
|
||||
bSensitiveMacroCreateButton = true;
|
||||
}
|
||||
if (getBoolProperty(xProps, "Editable"))
|
||||
if (comphelper::scriptbrowse::isEditable(node))
|
||||
{
|
||||
bSensitiveLibraryModuleDialogEditButton = true;
|
||||
}
|
||||
if (getBoolProperty(xProps, "Deletable"))
|
||||
if (comphelper::scriptbrowse::isDeletable(node))
|
||||
{
|
||||
bSensitiveLibraryModuleDialogDeleteButton = true;
|
||||
}
|
||||
if (getBoolProperty(xProps, "Renamable"))
|
||||
if (comphelper::scriptbrowse::isRenamable(node))
|
||||
{
|
||||
bSensitiveLibraryModuleDialogRenameButton = true;
|
||||
}
|
||||
|
||||
css::uno::Reference<css::script::browse::XCopyableBrowseNode> xCopyableNode(
|
||||
node, css::uno::UNO_QUERY);
|
||||
if (xCopyableNode.is() && xCopyableNode->isCopyableNode())
|
||||
bSensitiveModuleCopyButton = true;
|
||||
}
|
||||
|
||||
if (m_xCopiedNode.is() && m_xCopiedNode->nodeCanBeCopiedTo(node))
|
||||
{
|
||||
bSensitiveModulePasteButton = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1161,29 +1178,28 @@ void MacroManagerDialog::CheckButtons()
|
||||
{
|
||||
bSensitiveAssignButton = true;
|
||||
|
||||
if (bBasic)
|
||||
bSensitiveMacroDeleteButton = true;
|
||||
|
||||
css::uno::Reference<css::script::browse::XBrowseNode> node;
|
||||
node = getBrowseNode(rScriptsTreeView, *xScriptsSelectedIter);
|
||||
if (node.is())
|
||||
{
|
||||
bSensitiveMacroRunButton = true;
|
||||
|
||||
css::uno::Reference<css::beans::XPropertySet> xProps(node, css::uno::UNO_QUERY);
|
||||
if (xProps.is())
|
||||
if (comphelper::scriptbrowse::isEditable(node))
|
||||
{
|
||||
if (getBoolProperty(xProps, "Editable"))
|
||||
bSensitiveMacroEditButton = true;
|
||||
}
|
||||
if (!bSharedLocationContainer)
|
||||
{
|
||||
if (comphelper::scriptbrowse::isDeletable(node))
|
||||
{
|
||||
bSensitiveMacroEditButton = true;
|
||||
bSensitiveMacroDeleteButton = true;
|
||||
}
|
||||
if (!bSharedLocationContainer)
|
||||
if (comphelper::scriptbrowse::isRenamable(node))
|
||||
{
|
||||
if (getBoolProperty(xProps, "Deletable"))
|
||||
{
|
||||
bSensitiveMacroDeleteButton = true;
|
||||
}
|
||||
if (getBoolProperty(xProps, "Renamable"))
|
||||
{
|
||||
bSensitiveMacroRenameButton = true;
|
||||
}
|
||||
bSensitiveMacroRenameButton = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1205,6 +1221,8 @@ void MacroManagerDialog::CheckButtons()
|
||||
m_xMacroEditButton->set_sensitive(bSensitiveMacroEditButton);
|
||||
m_xMacroRenameButton->set_sensitive(bSensitiveMacroRenameButton);
|
||||
m_xMacroDeleteButton->set_sensitive(bSensitiveMacroDeleteButton);
|
||||
m_xModuleCopyButton->set_sensitive(bSensitiveModuleCopyButton);
|
||||
m_xModulePasteButton->set_sensitive(bSensitiveModulePasteButton);
|
||||
m_xAssignButton->set_sensitive(bSensitiveAssignButton);
|
||||
}
|
||||
|
||||
@@ -1557,9 +1575,7 @@ IMPL_LINK(MacroManagerDialog, ClickHdl, weld::Button&, rButton, void)
|
||||
}
|
||||
else if (&rButton == m_xMacroDeleteButton.get())
|
||||
{
|
||||
// todo
|
||||
// see: void MacroChooser::DeleteMacro()
|
||||
return;
|
||||
BasicScriptsMacroDelete();
|
||||
}
|
||||
else if (&rButton == m_xAssignButton.get())
|
||||
{
|
||||
@@ -1604,21 +1620,17 @@ IMPL_LINK(MacroManagerDialog, ClickHdl, weld::Button&, rButton, void)
|
||||
return; // should never happen
|
||||
css::uno::Reference<css::script::browse::XBrowseNode> node
|
||||
= getBrowseNode(rTreeView, *xSelectedIter);
|
||||
css::uno::Reference<css::script::XInvocation> xInv(node, css::uno::UNO_QUERY);
|
||||
if (xInv.is())
|
||||
if (node.is())
|
||||
{
|
||||
m_xDialog->response(RET_CANCEL);
|
||||
css::uno::Sequence<css::uno::Any> args(0);
|
||||
css::uno::Sequence<css::uno::Any> outArgs(0);
|
||||
css::uno::Sequence<sal_Int16> outIndex;
|
||||
try
|
||||
{
|
||||
// ISSUE need code to run script here
|
||||
xInv->invoke(u"Editable"_ustr, args, outIndex, outArgs);
|
||||
comphelper::scriptbrowse::editNode(node);
|
||||
}
|
||||
catch (css::uno::Exception const&)
|
||||
{
|
||||
TOOLS_WARN_EXCEPTION("cui.dialogs", "Caught exception trying to invoke");
|
||||
TOOLS_WARN_EXCEPTION("cui.dialogs", "Caught exception trying to edit");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1671,6 +1683,26 @@ IMPL_LINK(MacroManagerDialog, ClickHdl, weld::Button&, rButton, void)
|
||||
aRequest.AppendItem(aMacroInfoItem);
|
||||
SfxGetpApp()->ExecuteSlot(aRequest);
|
||||
}
|
||||
else if (&rButton == m_xModuleCopyButton.get())
|
||||
{
|
||||
weld::TreeView& rTreeView = m_xScriptContainersListBox->get_widget();
|
||||
std::unique_ptr<weld::TreeIter> xSelectedIter = rTreeView.get_selected();
|
||||
if (!xSelectedIter)
|
||||
return; // should never happen
|
||||
m_xCopiedNode.set(getBrowseNode(rTreeView, *xSelectedIter), css::uno::UNO_QUERY);
|
||||
CheckButtons();
|
||||
}
|
||||
else if (&rButton == m_xModulePasteButton.get())
|
||||
{
|
||||
if (!m_xCopiedNode.is())
|
||||
return;
|
||||
|
||||
weld::TreeView& rTreeView = m_xScriptContainersListBox->get_widget();
|
||||
std::unique_ptr<weld::TreeIter> xSelectedIter = rTreeView.get_selected();
|
||||
if (!xSelectedIter)
|
||||
return; // should never happen
|
||||
ScriptingFrameworkScriptsPasteEntry(rTreeView, *xSelectedIter);
|
||||
}
|
||||
}
|
||||
|
||||
bool MacroManagerDialog::IsLibraryReadOnlyOrFailedPasswordQuery(
|
||||
@@ -2031,6 +2063,27 @@ void MacroManagerDialog::BasicScriptsMacroEdit(const basctl::ScriptDocument& rDo
|
||||
m_xDialog->response(0);
|
||||
}
|
||||
|
||||
void MacroManagerDialog::BasicScriptsMacroDelete()
|
||||
{
|
||||
SbMethod* pMethod = GetSelectedBasicMethod();
|
||||
|
||||
DBG_ASSERT(pMethod, "BasicScriptsMacroDelete: no macro found!");
|
||||
|
||||
if (!pMethod || !basctl::QueryDelMacro(pMethod->GetName(), m_xDialog.get()))
|
||||
return;
|
||||
|
||||
// Remove the macro from the list. We need to do this before calling DeleteMacro because that
|
||||
// can trigger a notification which will cause the list of macros to be reloaded so if we do it
|
||||
// after we’ll delete the wrong node.
|
||||
if (std::unique_ptr<weld::TreeIter> xScriptsEntryIter
|
||||
= m_xScriptsListBox->get_widget().get_selected())
|
||||
{
|
||||
m_xScriptsListBox->Remove(*xScriptsEntryIter);
|
||||
}
|
||||
|
||||
basctl::DeleteMacro(*pMethod);
|
||||
}
|
||||
|
||||
// modified version of void SvxScriptOrgDialog::renameEntry(const weld::TreeIter& rEntry)
|
||||
// cui/source/dialogs/scriptdlg.cxx
|
||||
void MacroManagerDialog::ScriptingFrameworkScriptsRenameEntry(weld::TreeView& rTreeView,
|
||||
@@ -2038,9 +2091,8 @@ void MacroManagerDialog::ScriptingFrameworkScriptsRenameEntry(weld::TreeView& rT
|
||||
{
|
||||
css::uno::Reference<css::script::browse::XBrowseNode> xBrowseNode
|
||||
= getBrowseNode(rTreeView, rEntry);
|
||||
css::uno::Reference<css::script::XInvocation> xInv(xBrowseNode, css::uno::UNO_QUERY);
|
||||
|
||||
if (xInv.is())
|
||||
if (xBrowseNode.is())
|
||||
{
|
||||
OUString aNewName = xBrowseNode->getName();
|
||||
sal_Int32 extnPos = aNewName.lastIndexOf('.');
|
||||
@@ -2071,17 +2123,14 @@ void MacroManagerDialog::ScriptingFrameworkScriptsRenameEntry(weld::TreeView& rT
|
||||
|
||||
aNewName = aNameDialog.GetName();
|
||||
|
||||
css::uno::Sequence<css::uno::Any> args{ css::uno::Any(aNewName) };
|
||||
css::uno::Sequence<css::uno::Any> outArgs;
|
||||
css::uno::Sequence<sal_Int16> outIndex;
|
||||
try
|
||||
{
|
||||
css::uno::Any aResult = xInv->invoke(u"Renamable"_ustr, args, outIndex, outArgs);
|
||||
xBrowseNode.set(aResult, css::uno::UNO_QUERY);
|
||||
xBrowseNode = comphelper::scriptbrowse::renameNode(xBrowseNode, aNewName);
|
||||
}
|
||||
catch (css::uno::Exception const&)
|
||||
{
|
||||
TOOLS_WARN_EXCEPTION("cui.dialogs", "Caught exception trying to Rename");
|
||||
xBrowseNode.clear();
|
||||
}
|
||||
}
|
||||
if (xBrowseNode.is())
|
||||
@@ -2127,6 +2176,50 @@ void MacroManagerDialog::ScriptingFrameworkScriptsRenameEntry(weld::TreeView& rT
|
||||
}
|
||||
}
|
||||
|
||||
void MacroManagerDialog::ScriptingFrameworkScriptsPasteEntry(weld::TreeView& rTreeView,
|
||||
const weld::TreeIter& rEntry)
|
||||
{
|
||||
css::uno::Reference<css::script::browse::XBrowseNode> node = getBrowseNode(rTreeView, rEntry);
|
||||
if (!node.is() || !m_xCopiedNode->nodeCanBeCopiedTo(node))
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
node = m_xCopiedNode->copyNode(node);
|
||||
}
|
||||
catch (const css::uno::Exception&)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// If we don’t expand the row before filling it then it will end up with two copies of all the
|
||||
// entries
|
||||
rTreeView.expand_row(rEntry);
|
||||
m_xScriptContainersListBox->Fill(&rEntry);
|
||||
// Filling it causes the node to close so we need to expand it again
|
||||
rTreeView.expand_row(rEntry);
|
||||
|
||||
// Try to select the new entry
|
||||
if (rTreeView.iter_has_child(rEntry))
|
||||
{
|
||||
OUString sNodeName = node->getName();
|
||||
|
||||
std::unique_ptr<weld::TreeIter> xIter = rTreeView.make_iterator(&rEntry);
|
||||
if (rTreeView.iter_children(*xIter))
|
||||
{
|
||||
do
|
||||
{
|
||||
if (rTreeView.get_text(*xIter) == sNodeName)
|
||||
{
|
||||
rTreeView.select(*xIter);
|
||||
SelectHdl(rTreeView);
|
||||
break;
|
||||
}
|
||||
} while (rTreeView.iter_next_sibling(*xIter));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// for Scripting Framework entries
|
||||
// duplicate of OUString SvxScriptOrgDialog::getListOfChildren
|
||||
// cui/source/dialogs/scriptdlg.cxx
|
||||
@@ -2144,8 +2237,8 @@ OUString MacroManagerDialog::getListOfChildren(
|
||||
{
|
||||
if (node->hasChildNodes())
|
||||
{
|
||||
const css::uno::Sequence<css::uno::Reference<css::script::browse::XBrowseNode>> children
|
||||
= node->getChildNodes();
|
||||
const std::vector<css::uno::Reference<css::script::browse::XBrowseNode>> children
|
||||
= comphelper::scriptbrowse::getSortedChildNodes(node);
|
||||
for (const css::uno::Reference<css::script::browse::XBrowseNode>& n : children)
|
||||
{
|
||||
result.append(getListOfChildren(n, depth + 1));
|
||||
@@ -2177,16 +2270,12 @@ void MacroManagerDialog::ScriptingFrameworkScriptsDeleteEntry(weld::TreeView& rT
|
||||
return;
|
||||
}
|
||||
|
||||
css::uno::Reference<css::script::XInvocation> xInv(node, css::uno::UNO_QUERY);
|
||||
if (xInv.is())
|
||||
if (node.is())
|
||||
{
|
||||
css::uno::Sequence<css::uno::Any> args(0);
|
||||
css::uno::Sequence<css::uno::Any> outArgs(0);
|
||||
css::uno::Sequence<sal_Int16> outIndex;
|
||||
try
|
||||
{
|
||||
css::uno::Any aResult = xInv->invoke(u"Deletable"_ustr, args, outIndex, outArgs);
|
||||
aResult >>= result; // or do we just assume true if no exception ?
|
||||
result = comphelper::scriptbrowse::deleteNode(node);
|
||||
// or do we just assume true if no exception ?
|
||||
}
|
||||
catch (css::uno::Exception const&)
|
||||
{
|
||||
@@ -2229,10 +2318,8 @@ void MacroManagerDialog::ScriptingFrameworkScriptsCreateEntry(InputDialogMode eI
|
||||
css::uno::Reference<css::script::browse::XBrowseNode> aChildNode;
|
||||
css::uno::Reference<css::script::browse::XBrowseNode> xBrowseNode
|
||||
= getBrowseNode(rTreeView, *xSelectedIter);
|
||||
css::uno::Reference<css::script::XInvocation> xInv(xBrowseNode, css::uno::UNO_QUERY);
|
||||
|
||||
// Currently, invocation is not implemented for python, only beanshell, javascript, and java.
|
||||
if (xInv.is())
|
||||
if (xBrowseNode.is())
|
||||
{
|
||||
OUString aNewName;
|
||||
OUString aNewStdName;
|
||||
@@ -2248,7 +2335,7 @@ void MacroManagerDialog::ScriptingFrameworkScriptsCreateEntry(InputDialogMode eI
|
||||
bool bValid = false;
|
||||
sal_Int32 i = 1;
|
||||
|
||||
css::uno::Sequence<css::uno::Reference<css::script::browse::XBrowseNode>> childNodes;
|
||||
std::vector<css::uno::Reference<css::script::browse::XBrowseNode>> childNodes;
|
||||
// no children => ok to create Parcel1 or Script1 without checking ?
|
||||
try
|
||||
{
|
||||
@@ -2259,7 +2346,7 @@ void MacroManagerDialog::ScriptingFrameworkScriptsCreateEntry(InputDialogMode eI
|
||||
}
|
||||
else
|
||||
{
|
||||
childNodes = xBrowseNode->getChildNodes();
|
||||
childNodes = comphelper::scriptbrowse::getChildNodes(xBrowseNode);
|
||||
}
|
||||
}
|
||||
catch (css::uno::Exception&)
|
||||
@@ -2272,7 +2359,7 @@ void MacroManagerDialog::ScriptingFrameworkScriptsCreateEntry(InputDialogMode eI
|
||||
{
|
||||
aNewName = aNewStdName + OUString::number(i);
|
||||
bool bFound = false;
|
||||
if (childNodes.hasElements())
|
||||
if (!childNodes.empty())
|
||||
{
|
||||
OUString nodeName = childNodes[0]->getName();
|
||||
sal_Int32 extnPos = nodeName.lastIndexOf('.');
|
||||
@@ -2353,13 +2440,9 @@ void MacroManagerDialog::ScriptingFrameworkScriptsCreateEntry(InputDialogMode eI
|
||||
// open up parent node (which ensures it's loaded)
|
||||
rTreeView.expand_row(*xSelectedIter);
|
||||
|
||||
css::uno::Sequence<css::uno::Any> args{ css::uno::Any(aNewName) };
|
||||
css::uno::Sequence<css::uno::Any> outArgs;
|
||||
css::uno::Sequence<sal_Int16> outIndex;
|
||||
try
|
||||
{
|
||||
css::uno::Any aResult = xInv->invoke(u"Creatable"_ustr, args, outIndex, outArgs);
|
||||
aChildNode.set(aResult, css::uno::UNO_QUERY);
|
||||
aChildNode = comphelper::scriptbrowse::createNode(xBrowseNode, aNewName);
|
||||
}
|
||||
catch (css::uno::Exception const&)
|
||||
{
|
||||
@@ -2405,6 +2488,20 @@ OUString MacroManagerDialog::GetScriptURL() const
|
||||
return result;
|
||||
}
|
||||
|
||||
css::uno::Reference<css::frame::XModel> MacroManagerDialog::GetScriptModel() const
|
||||
{
|
||||
css::uno::Reference<css::frame::XModel> xModel;
|
||||
|
||||
if (std::unique_ptr<weld::TreeIter> xIter = m_xScriptsListBox->get_selected())
|
||||
{
|
||||
ScriptInfo* pScriptInfo = weld::fromId<ScriptInfo*>(m_xScriptsListBox->get_id(*xIter));
|
||||
if (pScriptInfo)
|
||||
xModel = pScriptInfo->xModel;
|
||||
}
|
||||
|
||||
return xModel;
|
||||
}
|
||||
|
||||
constexpr OUString MACRO_MANAGER_CONFIGNAME = u"MacroManagerDialog"_ustr;
|
||||
constexpr OUString LAST_RUN_MACRO_INFO = u"LastRunMacro"_ustr;
|
||||
|
||||
@@ -2511,4 +2608,56 @@ void MacroManagerDialog::LoadLastUsedMacro()
|
||||
UpdateUI();
|
||||
}
|
||||
|
||||
SbModule* MacroManagerDialog::GetSelectedBasicModule() const
|
||||
{
|
||||
weld::TreeView& rScriptContainersTreeView = m_xScriptContainersListBox->get_widget();
|
||||
std::unique_ptr<weld::TreeIter> xIter = rScriptContainersTreeView.get_selected();
|
||||
|
||||
if (!xIter)
|
||||
return nullptr;
|
||||
|
||||
OUString aParts[3];
|
||||
|
||||
// The selected node needs to be at least 4 branches deep, ie,
|
||||
// Document->Language->Library->Module. Here we store the names of the last three and also check
|
||||
// that the language part has a parent node.
|
||||
for (auto& aPart : aParts)
|
||||
{
|
||||
aPart = rScriptContainersTreeView.get_text(*xIter);
|
||||
|
||||
if (!rScriptContainersTreeView.iter_parent(*xIter))
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (aParts[2] != u"Basic"_ustr)
|
||||
return nullptr;
|
||||
|
||||
basctl::ScriptDocument aDocument = m_xScriptContainersListBox->GetScriptDocument(xIter.get());
|
||||
BasicManager* pBasicManager = aDocument.getBasicManager();
|
||||
|
||||
if (!pBasicManager)
|
||||
return nullptr;
|
||||
|
||||
StarBASIC* pLibrary = pBasicManager->GetLib(aParts[1]);
|
||||
if (!pLibrary)
|
||||
return nullptr;
|
||||
|
||||
return pLibrary->FindModule(aParts[0]);
|
||||
}
|
||||
|
||||
SbMethod* MacroManagerDialog::GetSelectedBasicMethod() const
|
||||
{
|
||||
SbModule* pModule = GetSelectedBasicModule();
|
||||
|
||||
if (!pModule)
|
||||
return nullptr;
|
||||
|
||||
OUString sScriptName = m_xScriptsListBox->GetSelectedScriptName();
|
||||
|
||||
if (sScriptName.getLength() <= 0)
|
||||
return nullptr;
|
||||
|
||||
return pModule->FindMethod(sScriptName, SbxClassType::Method);
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <svx/xoutbmp.hxx>
|
||||
#include <utility>
|
||||
#include <vcl/graph.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <svx/signaturelinehelper.hxx>
|
||||
#include <tools/urlobj.hxx>
|
||||
#include <vcl/weld/Builder.hxx>
|
||||
@@ -172,7 +171,10 @@ IMPL_LINK_NOARG(SignSignatureLineDialog, chooseCertificate, weld::Button&, void)
|
||||
ValidateFields();
|
||||
}
|
||||
|
||||
IMPL_LINK_NOARG(SignSignatureLineDialog, entryChanged, weld::Entry&, void) { ValidateFields(); }
|
||||
IMPL_LINK_NOARG(SignSignatureLineDialog, entryChanged, weld::TextWidget&, void)
|
||||
{
|
||||
ValidateFields();
|
||||
}
|
||||
|
||||
void SignSignatureLineDialog::ValidateFields()
|
||||
{
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include <comphelper/xmltools.hxx>
|
||||
#include <utility>
|
||||
#include <vcl/weld/Builder.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <svx/signaturelinehelper.hxx>
|
||||
|
||||
#include <com/sun/star/beans/XPropertySet.hpp>
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <vcl/weld/weld.hxx>
|
||||
|
||||
using namespace css;
|
||||
using namespace css::uno;
|
||||
using namespace css::frame;
|
||||
|
||||
@@ -48,7 +48,6 @@
|
||||
#include <vcl/texteng.hxx>
|
||||
#include <vcl/weld/Builder.hxx>
|
||||
#include <vcl/weld/Dialog.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <svx/SpellDialogChildWindow.hxx>
|
||||
#include <SpellDialog.hxx>
|
||||
#include <optlingu.hxx>
|
||||
@@ -499,7 +498,7 @@ IMPL_LINK_NOARG(SpellDialog, CheckGrammarHdl, weld::Toggleable&, void)
|
||||
|
||||
void SpellDialog::StartSpellOptDlg_Impl()
|
||||
{
|
||||
auto xSet = std::make_shared<SfxItemSetFixed<SID_AUTOSPELL_CHECK,SID_AUTOSPELL_CHECK>>( SfxGetpApp()->GetPool() );
|
||||
auto xSet = std::make_shared<SfxItemSet>(SfxItemSet::makeFixedSfxItemSet<SID_AUTOSPELL_CHECK,SID_AUTOSPELL_CHECK>( SfxGetpApp()->GetPool() ));
|
||||
m_xOptionsDlg = std::make_shared<SfxSingleTabDialogController>(
|
||||
m_xDialog.get(), xSet.get(), "content", "cui/ui/spelloptionsdialog.ui", "SpellOptionsDialog");
|
||||
|
||||
@@ -2143,7 +2142,7 @@ svx::SpellPortions SentenceEditWindow_Impl::CreateSpellPortions() const
|
||||
aPortion1.eLanguage = eLang;
|
||||
|
||||
aPortion1.sText = m_xEditEngine->GetText(ESelection(0, nStart, 0, aStart->nPosition));
|
||||
bool bIsIgnoreError = m_aIgnoreErrorsAt.find( nStart ) != m_aIgnoreErrorsAt.end();
|
||||
bool bIsIgnoreError = m_aIgnoreErrorsAt.contains( nStart );
|
||||
if( bIsIgnoreError )
|
||||
{
|
||||
aPortion1.bIgnoreThisError = true;
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include <vcl/settings.hxx> //GetSettings
|
||||
#include <vcl/svapp.hxx> //Application::
|
||||
#include <vcl/weld/Builder.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <unotools/resmgr.hxx> //Translate
|
||||
|
||||
#include <config_buildid.h> //EXTRA_BUILDID
|
||||
@@ -166,9 +165,6 @@ OUString AboutDialog::GetVersionString()
|
||||
#endif
|
||||
|
||||
return version;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
OUString AboutDialog::GetBuildString()
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include <vcl/weld/Builder.hxx>
|
||||
#include <vcl/weld/Dialog.hxx>
|
||||
#include <vcl/weld/MessageDialog.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <vcl/wintypes.hxx>
|
||||
#include <dialmgr.hxx>
|
||||
#include <sfx2/app.hxx>
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <vcl/weld/Builder.hxx>
|
||||
#include <vcl/weld/Dialog.hxx>
|
||||
#include <vcl/weld/MessageDialog.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <vcl/weld/WaitObject.hxx>
|
||||
#include <avmedia/mediawindow.hxx>
|
||||
#include <unotools/pathoptions.hxx>
|
||||
#include <sfx2/filedlghelper.hxx>
|
||||
|
||||
+1451
-1435
File diff suppressed because it is too large
Load Diff
@@ -20,13 +20,15 @@
|
||||
#include <dialmgr.hxx>
|
||||
#include <o3tl/any.hxx>
|
||||
#include <comphelper/propertyvalue.hxx>
|
||||
#include <unotools/viewoptions.hxx>
|
||||
#include <svtools/viewoptions.hxx>
|
||||
#include <vcl/bitmap.hxx>
|
||||
#include <vcl/graph.hxx>
|
||||
#include <vcl/vclenum.hxx>
|
||||
#include <vcl/windowstate.hxx>
|
||||
#include <vcl/weld/Builder.hxx>
|
||||
#include <vcl/weld/Dialog.hxx>
|
||||
#include <vcl/weld/WaitObject.hxx>
|
||||
#include <vcl/weld/weldutils.hxx>
|
||||
|
||||
// UNO-Stuff
|
||||
#include <comphelper/processfactory.hxx>
|
||||
@@ -364,8 +366,9 @@ int SvxHlinkDlgMarkWnd::FillTree( const uno::Reference< container::XNameAccess >
|
||||
sal_Int32 nOutlineLevel = *o3tl::doAccess<sal_Int32>(aAny);
|
||||
|
||||
// pop until the top of stack entry has an outline level less than
|
||||
// the to be inserted heading outline level
|
||||
while (nOutlineLevel <= aHeadingsParentEntryStack.top().second)
|
||||
// the to be inserted heading outline level, but keep the sentinel
|
||||
while (aHeadingsParentEntryStack.size() > 1
|
||||
&& nOutlineLevel <= aHeadingsParentEntryStack.top().second)
|
||||
aHeadingsParentEntryStack.pop();
|
||||
|
||||
mxLbTree->insert(aHeadingsParentEntryStack.top().first.get(), -1,
|
||||
|
||||
@@ -43,8 +43,9 @@ HyperlinkDialog::HyperlinkDialog(weld::Window* pParent, SfxChildWindow* /*pChild
|
||||
|
||||
SfxItemSet* HyperlinkDialog::CreateInputItemSet(const OUString&)
|
||||
{
|
||||
m_pInputSet = std::make_unique<SfxItemSetFixed<SID_HYPERLINK_GETLINK, SID_HYPERLINK_SETLINK>>(
|
||||
SfxGetpApp()->GetPool());
|
||||
m_pInputSet = std::make_unique<SfxItemSet>(
|
||||
SfxItemSet::makeFixedSfxItemSet<SID_HYPERLINK_GETLINK, SID_HYPERLINK_SETLINK>(
|
||||
SfxGetpApp()->GetPool()));
|
||||
return m_pInputSet.get();
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <sfx2/viewfrm.hxx>
|
||||
#include <sfx2/filedlghelper.hxx>
|
||||
#include <osl/file.hxx>
|
||||
#include <vcl/weld/WaitObject.hxx>
|
||||
#include <comphelper/lok.hxx>
|
||||
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
|
||||
#include <hlmarkwn_def.hxx>
|
||||
@@ -230,7 +231,7 @@ IMPL_LINK_NOARG(HyperlinkDocTabPage, ModifiedPathHdl_Impl, weld::ComboBox&, void
|
||||
m_xFtFullURL->set_label(maStrURL);
|
||||
}
|
||||
|
||||
IMPL_LINK_NOARG(HyperlinkDocTabPage, ModifiedTargetHdl_Impl, weld::Entry&, void)
|
||||
IMPL_LINK_NOARG(HyperlinkDocTabPage, ModifiedTargetHdl_Impl, weld::TextWidget&, void)
|
||||
{
|
||||
maStrURL = GetCurrentURL();
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <hyperlinkinternettabpage.hxx>
|
||||
#include <tools/urlobj.hxx>
|
||||
#include <o3tl/string_view.hxx>
|
||||
#include <vcl/weld/WaitObject.hxx>
|
||||
#include <com/sun/star/datatransfer/UnsupportedFlavorException.hpp>
|
||||
#include <sot/exchange.hxx>
|
||||
#include <hlmarkwn_def.hxx>
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#include <unotools/ucbstreamhelper.hxx>
|
||||
#include <unotools/ucbhelper.hxx>
|
||||
#include <vcl/weld/MessageDialog.hxx>
|
||||
#include <vcl/weld/WaitObject.hxx>
|
||||
#include <vcl/weld/weldutils.hxx>
|
||||
#include <osl/file.hxx>
|
||||
#include <comphelper/processfactory.hxx>
|
||||
#include <com/sun/star/frame/XFrame.hpp>
|
||||
|
||||
@@ -265,8 +265,9 @@ IMPL_LINK_NOARG(HyperlinkTabPageBase, ClickScriptHdl, weld::Button&, void)
|
||||
if (!m_aMacroTable.empty())
|
||||
aItem.SetMacroTable(m_aMacroTable);
|
||||
|
||||
auto xItemSet = std::make_unique<SfxItemSetFixed<SID_ATTR_MACROITEM, SID_ATTR_MACROITEM>>(
|
||||
SfxGetpApp()->GetPool());
|
||||
auto xItemSet = std::make_unique<SfxItemSet>(
|
||||
SfxItemSet::makeFixedSfxItemSet<SID_ATTR_MACROITEM, SID_ATTR_MACROITEM>(
|
||||
SfxGetpApp()->GetPool()));
|
||||
xItemSet->Put(aItem);
|
||||
|
||||
weld::Window* pWin = GetFrameWeld();
|
||||
|
||||
@@ -50,7 +50,6 @@
|
||||
#include <vcl/weld/Builder.hxx>
|
||||
#include <vcl/weld/Dialog.hxx>
|
||||
#include <vcl/weld/MessageDialog.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <comphelper/classids.hxx>
|
||||
#include <sfx2/filedlghelper.hxx>
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include <vcl/weld/Builder.hxx>
|
||||
#include <vcl/weld/Dialog.hxx>
|
||||
#include <vcl/weld/MessageDialog.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <vcl/weld/weldutils.hxx>
|
||||
|
||||
#include <strings.hrc>
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <vcl/weld/Builder.hxx>
|
||||
#include <vcl/weld/Dialog.hxx>
|
||||
#include <vcl/weld/MessageDialog.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
|
||||
#include <multipat.hxx>
|
||||
#include <dialmgr.hxx>
|
||||
@@ -198,7 +197,8 @@ SvxMultiPathDialog::SvxMultiPathDialog(weld::Window* pParent)
|
||||
{
|
||||
m_xRadioLB->set_size_request(m_xRadioLB->get_approximate_digit_width() * 60,
|
||||
m_xRadioLB->get_text_height() * 10);
|
||||
m_xRadioLB->enable_toggle_buttons(weld::ColumnToggleType::Radio);
|
||||
m_xRadioLB->enable_toggle_buttons();
|
||||
m_xRadioLB->set_toggle_button_type(weld::ColumnToggleType::Radio);
|
||||
m_xRadioLB->connect_toggled(LINK(this, SvxMultiPathDialog, CheckHdl_Impl));
|
||||
m_xRadioLB->connect_selection_changed(LINK(this, SvxMultiPathDialog, SelectHdl_Impl));
|
||||
|
||||
|
||||
@@ -36,9 +36,9 @@ IMPL_LINK_NOARG(PasswordToOpenModifyDialog, OkBtnClickHdl, weld::Button&, void)
|
||||
m_xPasswdToModifyED->get_text().isEmpty();
|
||||
if (bInvalidState)
|
||||
{
|
||||
m_xErrorBox.reset(Application::CreateMessageDialog(m_xDialog.get(),
|
||||
VclMessageType::Warning, VclButtonsType::Ok,
|
||||
m_bIsPasswordToModify? m_aInvalidStateForOkButton : m_aInvalidStateForOkButton_v2));
|
||||
m_xErrorBox = Application::CreateMessageDialog(
|
||||
m_xDialog.get(), VclMessageType::Warning, VclButtonsType::Ok,
|
||||
m_bIsPasswordToModify ? m_aInvalidStateForOkButton : m_aInvalidStateForOkButton_v2);
|
||||
m_xErrorBox->runAsync(m_xErrorBox, [](sal_Int32 /*nResult*/) {});
|
||||
}
|
||||
else // check for mismatched passwords and password policy
|
||||
@@ -66,9 +66,9 @@ IMPL_LINK_NOARG(PasswordToOpenModifyDialog, OkBtnClickHdl, weld::Button&, void)
|
||||
const int nMismatch = (bToOpenMatch? 0 : 1) + (bToModifyMatch? 0 : 1);
|
||||
if (nMismatch > 0)
|
||||
{
|
||||
m_xErrorBox.reset(Application::CreateMessageDialog(m_xDialog.get(),
|
||||
VclMessageType::Warning, VclButtonsType::Ok,
|
||||
nMismatch == 1 ? m_aOneMismatch : m_aTwoMismatch));
|
||||
m_xErrorBox = Application::CreateMessageDialog(
|
||||
m_xDialog.get(), VclMessageType::Warning, VclButtonsType::Ok,
|
||||
nMismatch == 1 ? m_aOneMismatch : m_aTwoMismatch);
|
||||
m_xErrorBox->runAsync(m_xErrorBox, [this, bToOpenMatch, nMismatch](sal_Int32 /*nResult*/)
|
||||
{
|
||||
weld::Entry* pEdit = !bToOpenMatch ? m_xPasswdToOpenED.get() : m_xPasswdToModifyED.get();
|
||||
@@ -95,8 +95,9 @@ IMPL_LINK_NOARG(PasswordToOpenModifyDialog, OkBtnClickHdl, weld::Button&, void)
|
||||
}
|
||||
}
|
||||
|
||||
IMPL_LINK(PasswordToOpenModifyDialog, ChangeHdl, weld::Entry&, rEntry, void)
|
||||
IMPL_LINK(PasswordToOpenModifyDialog, ChangeHdl, weld::TextWidget&, rTextWidget, void)
|
||||
{
|
||||
weld::Entry& rEntry = dynamic_cast<weld::Entry&>(rTextWidget);
|
||||
auto aPasswordText = rEntry.get_text();
|
||||
|
||||
weld::Label* pIndicator = nullptr;
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#include <querydialog.hxx>
|
||||
#include <bitmaps.hlst>
|
||||
#include <vcl/weld/Builder.hxx>
|
||||
|
||||
QueryDialog::QueryDialog(weld::Window* pParent, const OUString& sTitle, const OUString& sText,
|
||||
const OUString& sQuestion, bool bShowAgain)
|
||||
: GenericDialogController(pParent, u"cui/ui/querydialog.ui"_ustr, u"QueryDialog"_ustr)
|
||||
, m_pTitle(m_xBuilder->weld_label(u"lbTitle"_ustr))
|
||||
, m_pText(m_xBuilder->weld_label(u"lbText"_ustr))
|
||||
, m_pQuestion(m_xBuilder->weld_label(u"lbQuestion"_ustr))
|
||||
, m_pImage(m_xBuilder->weld_image(u"imQuery"_ustr))
|
||||
, m_pCheckBox(m_xBuilder->weld_check_button(u"cbDontShowAgain"_ustr))
|
||||
, m_pYes(m_xBuilder->weld_button(u"btnYes"_ustr))
|
||||
, m_pNo(m_xBuilder->weld_button(u"btnNo"_ustr))
|
||||
{
|
||||
m_pTitle->set_label(sTitle);
|
||||
m_pText->set_label(sText);
|
||||
m_pQuestion->set_label(sQuestion);
|
||||
m_pImage->set_from_icon_name(RID_CUIBMP_QUERY);
|
||||
|
||||
if (!bShowAgain)
|
||||
m_pCheckBox->hide();
|
||||
}
|
||||
@@ -47,11 +47,11 @@
|
||||
#include <vcl/salgtype.hxx>
|
||||
#include <vcl/virdev.hxx>
|
||||
#include <vcl/weld/Builder.hxx>
|
||||
#include <vcl/weld/Button.hxx>
|
||||
#include <vcl/weld/Dialog.hxx>
|
||||
#include <vcl/weld/ScreenshotEntry.hxx>
|
||||
#include <vcl/weld/TextView.hxx>
|
||||
#include <vcl/weld/customweld.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
|
||||
#include <svtools/optionsdrawinglayer.hxx>
|
||||
#include <basegfx/matrix/b2dhommatrix.hxx>
|
||||
#include <set>
|
||||
|
||||
@@ -22,17 +22,22 @@
|
||||
#include <utility>
|
||||
|
||||
#include <sfx2/objsh.hxx>
|
||||
#include <sfx2/sfxresid.hxx>
|
||||
#include <sfx2/strings.hrc>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vcl/weld/Builder.hxx>
|
||||
#include <vcl/weld/Dialog.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <vcl/weld/Label.hxx>
|
||||
#include <vcl/weld/weldutils.hxx>
|
||||
|
||||
#include <strings.hrc>
|
||||
#include <bitmaps.hlst>
|
||||
#include <scriptdlg.hxx>
|
||||
#include <dialmgr.hxx>
|
||||
#include <GetDocumentModel.hxx>
|
||||
|
||||
#include <com/sun/star/uno/XComponentContext.hpp>
|
||||
#include <com/sun/star/reflection/InvocationTargetException.hpp>
|
||||
#include <com/sun/star/script/provider/ScriptFrameworkErrorException.hpp>
|
||||
#include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
|
||||
#include <com/sun/star/script/provider/XScriptProvider.hpp>
|
||||
@@ -46,12 +51,12 @@
|
||||
#include <com/sun/star/frame/Desktop.hpp>
|
||||
#include <com/sun/star/frame/ModuleManager.hpp>
|
||||
#include <com/sun/star/frame/XModel3.hpp>
|
||||
#include <com/sun/star/script/XInvocation.hpp>
|
||||
#include <com/sun/star/document/XEmbeddedScripts.hpp>
|
||||
|
||||
#include <comphelper/SetFlagContextHelper.hxx>
|
||||
#include <comphelper/documentinfo.hxx>
|
||||
#include <comphelper/processfactory.hxx>
|
||||
#include <comphelper/scriptbrowse.hxx>
|
||||
#include <o3tl/string_view.hxx>
|
||||
|
||||
#include <svtools/imagemgr.hxx>
|
||||
@@ -129,7 +134,7 @@ void SvxScriptOrgDialog::Init( std::u16string_view language )
|
||||
const Reference< XComponentContext >& xCtx(
|
||||
comphelper::getProcessComponentContext() );
|
||||
|
||||
Sequence< Reference< browse::XBrowseNode > > children;
|
||||
std::vector< Reference< browse::XBrowseNode > > children;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -140,7 +145,7 @@ void SvxScriptOrgDialog::Init( std::u16string_view language )
|
||||
|
||||
if ( rootNode.is() && rootNode->hasChildNodes() )
|
||||
{
|
||||
children = rootNode->getChildNodes();
|
||||
children = comphelper::scriptbrowse::getChildNodes(rootNode);
|
||||
}
|
||||
}
|
||||
catch( const Exception& )
|
||||
@@ -167,7 +172,7 @@ void SvxScriptOrgDialog::Init( std::u16string_view language )
|
||||
}
|
||||
else
|
||||
{
|
||||
xDocumentModel.set(getDocumentModel(xCtx, uiName ), UNO_QUERY);
|
||||
xDocumentModel = getDocumentModel(xCtx, uiName);
|
||||
|
||||
if ( xDocumentModel.is() )
|
||||
{
|
||||
@@ -202,33 +207,6 @@ void SvxScriptOrgDialog::Init( std::u16string_view language )
|
||||
m_xScriptsBox->thaw();
|
||||
}
|
||||
|
||||
Reference< XInterface >
|
||||
SvxScriptOrgDialog::getDocumentModel( Reference< XComponentContext > const & xCtx, std::u16string_view docName )
|
||||
{
|
||||
Reference< XInterface > xModel;
|
||||
Reference< frame::XDesktop2 > desktop = frame::Desktop::create(xCtx);
|
||||
|
||||
Reference< container::XEnumerationAccess > componentsAccess =
|
||||
desktop->getComponents();
|
||||
Reference< container::XEnumeration > components =
|
||||
componentsAccess->createEnumeration();
|
||||
while (components->hasMoreElements())
|
||||
{
|
||||
Reference< frame::XModel > model(
|
||||
components->nextElement(), UNO_QUERY );
|
||||
if ( model.is() )
|
||||
{
|
||||
OUString sTdocUrl = ::comphelper::DocumentInfo::getDocumentTitle( model );
|
||||
if( sTdocUrl == docName )
|
||||
{
|
||||
xModel = model;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return xModel;
|
||||
}
|
||||
|
||||
Reference< browse::XBrowseNode >
|
||||
SvxScriptOrgDialog::getLangNodeFromRootNode( Reference< browse::XBrowseNode > const & rootNode, std::u16string_view language )
|
||||
{
|
||||
@@ -237,7 +215,8 @@ SvxScriptOrgDialog::getLangNodeFromRootNode( Reference< browse::XBrowseNode > co
|
||||
try
|
||||
{
|
||||
auto tryFind = [&] {
|
||||
const Sequence<Reference<browse::XBrowseNode>> children = rootNode->getChildNodes();
|
||||
const std::vector<Reference<browse::XBrowseNode>> children
|
||||
= comphelper::scriptbrowse::getChildNodes(rootNode);
|
||||
const auto it = std::find_if(children.begin(), children.end(),
|
||||
[&](const Reference<browse::XBrowseNode>& child) {
|
||||
return child->getName() == language;
|
||||
@@ -271,10 +250,10 @@ void SvxScriptOrgDialog::RequestSubEntries(const weld::TreeIter& rRootEntry, Ref
|
||||
return;
|
||||
}
|
||||
|
||||
Sequence< Reference< browse::XBrowseNode > > children;
|
||||
std::vector< Reference< browse::XBrowseNode > > children;
|
||||
try
|
||||
{
|
||||
children = node->getChildNodes();
|
||||
children = comphelper::scriptbrowse::getSortedChildNodes(node);
|
||||
}
|
||||
catch ( Exception& )
|
||||
{
|
||||
@@ -452,68 +431,13 @@ void SvxScriptOrgDialog::CheckButtons( Reference< browse::XBrowseNode > const &
|
||||
{
|
||||
if ( node.is() )
|
||||
{
|
||||
if ( node->getType() == browse::BrowseNodeTypes::SCRIPT)
|
||||
{
|
||||
m_xRunButton->set_sensitive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_xRunButton->set_sensitive(false);
|
||||
}
|
||||
Reference< beans::XPropertySet > xProps( node, UNO_QUERY );
|
||||
m_xRunButton->set_sensitive(node->getType() == browse::BrowseNodeTypes::SCRIPT &&
|
||||
Reference<beans::XPropertySet>::query(node).is());
|
||||
|
||||
if ( !xProps.is() )
|
||||
{
|
||||
m_xEditButton->set_sensitive(false);
|
||||
m_xDelButton->set_sensitive(false);
|
||||
m_xCreateButton->set_sensitive(false);
|
||||
m_xRunButton->set_sensitive(false);
|
||||
return;
|
||||
}
|
||||
|
||||
OUString sName(u"Editable"_ustr);
|
||||
|
||||
if ( getBoolProperty( xProps, sName ) )
|
||||
{
|
||||
m_xEditButton->set_sensitive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_xEditButton->set_sensitive(false);
|
||||
}
|
||||
|
||||
sName = "Deletable";
|
||||
|
||||
if ( getBoolProperty( xProps, sName ) )
|
||||
{
|
||||
m_xDelButton->set_sensitive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_xDelButton->set_sensitive(false);
|
||||
}
|
||||
|
||||
sName = "Creatable";
|
||||
|
||||
if ( getBoolProperty( xProps, sName ) )
|
||||
{
|
||||
m_xCreateButton->set_sensitive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_xCreateButton->set_sensitive(false);
|
||||
}
|
||||
|
||||
sName = "Renamable";
|
||||
|
||||
if ( getBoolProperty( xProps, sName ) )
|
||||
{
|
||||
m_xRenameButton->set_sensitive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_xRenameButton->set_sensitive(false);
|
||||
}
|
||||
m_xEditButton->set_sensitive(comphelper::scriptbrowse::isEditable(node));
|
||||
m_xDelButton->set_sensitive(comphelper::scriptbrowse::isDeletable(node));
|
||||
m_xCreateButton->set_sensitive(comphelper::scriptbrowse::isCreatable(node));
|
||||
m_xRenameButton->set_sensitive(comphelper::scriptbrowse::isRenamable(node));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -595,7 +519,11 @@ IMPL_LINK(SvxScriptOrgDialog, ButtonHdl, weld::Button&, rButton, void)
|
||||
|
||||
if (!xEmbeddedScripts->getAllowMacroExecution())
|
||||
{
|
||||
// Please FIXME: Show a message box if AllowMacroExecution is false
|
||||
std::unique_ptr<weld::MessageDialog> xBox(
|
||||
Application::CreateMessageDialog(m_xDialog.get(), VclMessageType::Warning,
|
||||
VclButtonsType::Ok,
|
||||
SfxResId(STR_CANNOTRUNMACRO)));
|
||||
xBox->run();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -645,23 +573,16 @@ IMPL_LINK(SvxScriptOrgDialog, ButtonHdl, weld::Button&, rButton, void)
|
||||
}
|
||||
else if ( &rButton == m_xEditButton.get() )
|
||||
{
|
||||
Reference< script::XInvocation > xInv( node, UNO_QUERY );
|
||||
if ( xInv.is() )
|
||||
StoreCurrentSelection();
|
||||
m_xDialog->response(RET_CANCEL);
|
||||
try
|
||||
{
|
||||
StoreCurrentSelection();
|
||||
m_xDialog->response(RET_CANCEL);
|
||||
Sequence< Any > args(0);
|
||||
Sequence< Any > outArgs( 0 );
|
||||
Sequence< sal_Int16 > outIndex;
|
||||
try
|
||||
{
|
||||
// ISSUE need code to run script here
|
||||
xInv->invoke( u"Editable"_ustr, args, outIndex, outArgs );
|
||||
}
|
||||
catch( Exception const & )
|
||||
{
|
||||
TOOLS_WARN_EXCEPTION("cui.dialogs", "Caught exception trying to invoke" );
|
||||
}
|
||||
// ISSUE need code to run script here
|
||||
comphelper::scriptbrowse::editNode(node);
|
||||
}
|
||||
catch( Exception const & )
|
||||
{
|
||||
TOOLS_WARN_EXCEPTION("cui.dialogs", "Caught exception trying to edit" );
|
||||
}
|
||||
}
|
||||
else if ( &rButton == m_xCreateButton.get() )
|
||||
@@ -705,9 +626,8 @@ void SvxScriptOrgDialog::createEntry(const weld::TreeIter& rEntry)
|
||||
|
||||
Reference< browse::XBrowseNode > aChildNode;
|
||||
Reference< browse::XBrowseNode > node = getBrowseNode( rEntry );
|
||||
Reference< script::XInvocation > xInv( node, UNO_QUERY );
|
||||
|
||||
if ( xInv.is() )
|
||||
if ( node.is() )
|
||||
{
|
||||
OUString aNewName;
|
||||
OUString aNewStdName;
|
||||
@@ -726,7 +646,7 @@ void SvxScriptOrgDialog::createEntry(const weld::TreeIter& rEntry)
|
||||
bool bValid = false;
|
||||
sal_Int32 i = 1;
|
||||
|
||||
Sequence< Reference< browse::XBrowseNode > > childNodes;
|
||||
std::vector< Reference< browse::XBrowseNode > > childNodes;
|
||||
// no children => ok to create Parcel1 or Script1 without checking
|
||||
try
|
||||
{
|
||||
@@ -737,7 +657,7 @@ void SvxScriptOrgDialog::createEntry(const weld::TreeIter& rEntry)
|
||||
}
|
||||
else
|
||||
{
|
||||
childNodes = node->getChildNodes();
|
||||
childNodes = comphelper::scriptbrowse::getChildNodes(node);
|
||||
}
|
||||
}
|
||||
catch ( Exception& )
|
||||
@@ -750,7 +670,7 @@ void SvxScriptOrgDialog::createEntry(const weld::TreeIter& rEntry)
|
||||
{
|
||||
aNewName = aNewStdName + OUString::number(i);
|
||||
bool bFound = false;
|
||||
if(childNodes.hasElements() )
|
||||
if(!childNodes.empty() )
|
||||
{
|
||||
OUString nodeName = childNodes[0]->getName();
|
||||
sal_Int32 extnPos = nodeName.lastIndexOf( '.' );
|
||||
@@ -814,14 +734,9 @@ void SvxScriptOrgDialog::createEntry(const weld::TreeIter& rEntry)
|
||||
// open up parent node (which ensures it's loaded)
|
||||
m_xScriptsBox->expand_row(rEntry);
|
||||
|
||||
Sequence< Any > args{ Any(aNewName) };
|
||||
Sequence< Any > outArgs;
|
||||
Sequence< sal_Int16 > outIndex;
|
||||
try
|
||||
{
|
||||
Any aResult = xInv->invoke( u"Creatable"_ustr, args, outIndex, outArgs );
|
||||
aChildNode.set(aResult, UNO_QUERY);
|
||||
|
||||
aChildNode = comphelper::scriptbrowse::createNode(node, aNewName);
|
||||
}
|
||||
catch( Exception const & )
|
||||
{
|
||||
@@ -878,9 +793,8 @@ void SvxScriptOrgDialog::renameEntry(const weld::TreeIter& rEntry)
|
||||
|
||||
Reference< browse::XBrowseNode > aChildNode;
|
||||
Reference< browse::XBrowseNode > node = getBrowseNode(rEntry);
|
||||
Reference< script::XInvocation > xInv( node, UNO_QUERY );
|
||||
|
||||
if ( xInv.is() )
|
||||
if ( node.is() )
|
||||
{
|
||||
OUString aNewName = node->getName();
|
||||
sal_Int32 extnPos = aNewName.lastIndexOf( '.' );
|
||||
@@ -896,14 +810,9 @@ void SvxScriptOrgDialog::renameEntry(const weld::TreeIter& rEntry)
|
||||
|
||||
aNewName = aNewDlg.GetObjectName();
|
||||
|
||||
Sequence< Any > args{ Any(aNewName) };
|
||||
Sequence< Any > outArgs;
|
||||
Sequence< sal_Int16 > outIndex;
|
||||
try
|
||||
{
|
||||
Any aResult = xInv->invoke( u"Renamable"_ustr, args, outIndex, outArgs );
|
||||
aChildNode.set(aResult, UNO_QUERY);
|
||||
|
||||
aChildNode = comphelper::scriptbrowse::renameNode(node, aNewName);
|
||||
}
|
||||
catch( Exception const & )
|
||||
{
|
||||
@@ -942,16 +851,12 @@ void SvxScriptOrgDialog::deleteEntry(const weld::TreeIter& rEntry)
|
||||
return;
|
||||
}
|
||||
|
||||
Reference< script::XInvocation > xInv( node, UNO_QUERY );
|
||||
if ( xInv.is() )
|
||||
if ( node.is() )
|
||||
{
|
||||
Sequence< Any > args( 0 );
|
||||
Sequence< Any > outArgs( 0 );
|
||||
Sequence< sal_Int16 > outIndex;
|
||||
try
|
||||
{
|
||||
Any aResult = xInv->invoke( u"Deletable"_ustr, args, outIndex, outArgs );
|
||||
aResult >>= result; // or do we just assume true if no exception ?
|
||||
result = comphelper::scriptbrowse::deleteNode(node);
|
||||
// or do we just assume true if no exception ?
|
||||
}
|
||||
catch( Exception const & )
|
||||
{
|
||||
@@ -975,21 +880,6 @@ void SvxScriptOrgDialog::deleteEntry(const weld::TreeIter& rEntry)
|
||||
|
||||
}
|
||||
|
||||
bool SvxScriptOrgDialog::getBoolProperty( Reference< beans::XPropertySet > const & xProps,
|
||||
OUString const & propName )
|
||||
{
|
||||
bool result = false;
|
||||
try
|
||||
{
|
||||
xProps->getPropertyValue( propName ) >>= result;
|
||||
}
|
||||
catch ( Exception& )
|
||||
{
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
OUString SvxScriptOrgDialog::getListOfChildren( const Reference< browse::XBrowseNode >& node, int depth )
|
||||
{
|
||||
OUStringBuffer result = "\n";
|
||||
@@ -1003,8 +893,8 @@ OUString SvxScriptOrgDialog::getListOfChildren( const Reference< browse::XBrowse
|
||||
{
|
||||
if ( node->hasChildNodes() )
|
||||
{
|
||||
const Sequence< Reference< browse::XBrowseNode > > children
|
||||
= node->getChildNodes();
|
||||
const std::vector< Reference< browse::XBrowseNode > > children
|
||||
= comphelper::scriptbrowse::getSortedChildNodes(node);
|
||||
for( const Reference< browse::XBrowseNode >& n : children )
|
||||
{
|
||||
result.append( getListOfChildren( n , depth+1 ) );
|
||||
@@ -1322,11 +1212,8 @@ IMPL_STATIC_LINK( SvxScriptErrorDialog, ShowDialog, void*, p, void )
|
||||
message = CuiResId( RID_CUISTR_ERROR_TITLE );
|
||||
|
||||
std::shared_ptr<weld::MessageDialog> xBox;
|
||||
xBox.reset(Application::CreateMessageDialog(
|
||||
xData->pParent,
|
||||
VclMessageType::Warning,
|
||||
VclButtonsType::Ok,
|
||||
message));
|
||||
xBox = Application::CreateMessageDialog(xData->pParent, VclMessageType::Warning,
|
||||
VclButtonsType::Ok, message);
|
||||
|
||||
xBox->set_title(CuiResId(RID_CUISTR_ERROR_TITLE));
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ SvxSearchAttributeDialog::SvxSearchAttributeDialog(weld::Window* pParent,
|
||||
m_xAttrLB->set_size_request(m_xAttrLB->get_approximate_digit_width() * 50,
|
||||
m_xAttrLB->get_height_rows(12));
|
||||
|
||||
m_xAttrLB->enable_toggle_buttons(weld::ColumnToggleType::Check);
|
||||
m_xAttrLB->enable_toggle_buttons();
|
||||
|
||||
m_xOKBtn->connect_clicked(LINK( this, SvxSearchAttributeDialog, OKHdl));
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ IMPL_LINK_NOARG( SvxThesaurusDialog, ModifyTimer_Hdl, Timer *, void )
|
||||
m_aModifyIdle.Stop();
|
||||
}
|
||||
|
||||
IMPL_LINK_NOARG(SvxThesaurusDialog, ReplaceEditHdl_Impl, weld::Entry&, void)
|
||||
IMPL_LINK_NOARG(SvxThesaurusDialog, ReplaceEditHdl_Impl, weld::TextWidget&, void)
|
||||
{
|
||||
m_xReplaceBtn->set_sensitive(!m_xReplaceEdit->get_text().isEmpty());
|
||||
}
|
||||
|
||||
@@ -163,16 +163,19 @@ void TipOfTheDayDialog::UpdateTip()
|
||||
#ifdef MACOSX
|
||||
const OUString aMOD1 = CuiResId(STR_CMD);
|
||||
const OUString aMOD2 = CuiResId(STR_Option);
|
||||
const OUString aMOD3 = CuiResId(STR_CTRL);
|
||||
const OUString aMOD3 = CuiResId(STR_CTRL_MAC);
|
||||
const OUString aSHIFT = CuiResId(STR_SHIFT);
|
||||
#else
|
||||
const OUString aMOD1 = CuiResId(STR_CTRL);
|
||||
const OUString aMOD2 = CuiResId(STR_Alt);
|
||||
const OUString& aMOD3 = aMOD1;
|
||||
const OUString aSHIFT = CuiResId(STR_SHIFT);
|
||||
#endif
|
||||
m_pText->set_label(CuiResId(sTip)
|
||||
.replaceAll("%MOD1", aMOD1)
|
||||
.replaceAll("%MOD2", aMOD2)
|
||||
.replaceAll("%MOD3", aMOD3));
|
||||
.replaceAll("%MOD3", aMOD3)
|
||||
.replaceAll("%SHIFT", aSHIFT));
|
||||
|
||||
// hyperlink
|
||||
if (sLink.isEmpty())
|
||||
|
||||
@@ -22,6 +22,33 @@
|
||||
#include <vcl/tabs.hrc>
|
||||
#include <vcl/weld/Builder.hxx>
|
||||
|
||||
namespace
|
||||
{
|
||||
OUString lcl_GetApplyToText()
|
||||
{
|
||||
if (std::optional<vcl::EnumContext::Application> sApp = UITabPage::GetCurrentAppEnum())
|
||||
{
|
||||
switch (*sApp)
|
||||
{
|
||||
case vcl::EnumContext::Application::Writer:
|
||||
return CuiResId(RID_CUISTR_UI_APPLY_TO_WRITER);
|
||||
case vcl::EnumContext::Application::Calc:
|
||||
return CuiResId(RID_CUISTR_UI_APPLY_TO_CALC);
|
||||
case vcl::EnumContext::Application::Impress:
|
||||
return CuiResId(RID_CUISTR_UI_APPLY_TO_IMPRESS);
|
||||
case vcl::EnumContext::Application::Draw:
|
||||
return CuiResId(RID_CUISTR_UI_APPLY_TO_DRAW);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
assert(!"UI picker dialog used for unsupported application");
|
||||
|
||||
return OUString();
|
||||
}
|
||||
}
|
||||
|
||||
UIPickerDialog::UIPickerDialog(weld::Window* pParent)
|
||||
: SfxTabDialogController(pParent, u"cui/ui/uipickerdialog.ui"_ustr, u"UIPickerDialog"_ustr)
|
||||
, m_xOKBtn(m_xBuilder->weld_button(u"ok"_ustr))
|
||||
@@ -39,8 +66,7 @@ UIPickerDialog::UIPickerDialog(weld::Window* pParent)
|
||||
|
||||
// it's mandatory for gtk3 to set the icon before changing the label
|
||||
m_xApplyBtn->set_from_icon_name("sw/res/sc20558.png");
|
||||
m_xApplyBtn->set_label(
|
||||
CuiResId(RID_CUISTR_UI_APPLY).replaceFirst("%MODULE", UITabPage::GetCurrentApp()));
|
||||
m_xApplyBtn->set_label(lcl_GetApplyToText());
|
||||
m_xResetBtn->set_label(CuiResId(RID_CUISTR_UI_APPLYALL));
|
||||
m_xApplyBtn->connect_clicked(LINK(this, UIPickerDialog, OnApplyClick));
|
||||
m_xResetBtn->connect_clicked(LINK(this, UIPickerDialog, OnApplyClick));
|
||||
|
||||
@@ -82,15 +82,27 @@ OUString UITabPage::GetCurrentMode()
|
||||
return sResult;
|
||||
}
|
||||
|
||||
OUString UITabPage::GetCurrentApp()
|
||||
std::optional<vcl::EnumContext::Application> UITabPage::GetCurrentAppEnum()
|
||||
{
|
||||
OUString sResult;
|
||||
if (SfxViewFrame* pViewFrame = SfxViewFrame::Current())
|
||||
{
|
||||
const auto xCurrentFrame = pViewFrame->GetFrame().GetFrameInterface();
|
||||
const auto& xContext = comphelper::getProcessComponentContext();
|
||||
const auto xModuleManager = css::frame::ModuleManager::create(xContext);
|
||||
switch (vcl::EnumContext::GetApplicationEnum(xModuleManager->identify(xCurrentFrame)))
|
||||
return vcl::EnumContext::GetApplicationEnum(xModuleManager->identify(xCurrentFrame));
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
OUString UITabPage::GetCurrentApp()
|
||||
{
|
||||
OUString sResult;
|
||||
if (std::optional<vcl::EnumContext::Application> aAppEnum = GetCurrentAppEnum())
|
||||
{
|
||||
switch (*aAppEnum)
|
||||
{
|
||||
case vcl::EnumContext::Application::Writer:
|
||||
sResult = "Writer";
|
||||
|
||||
@@ -67,7 +67,7 @@ WelcomeDialog::WelcomeDialog(weld::Window* pParent, const bool bIsFirstStart)
|
||||
void WelcomeDialog::ImplDestroy()
|
||||
{
|
||||
m_xTabCtrl->set_current_page(sNewsTab); // ensure next start with the first page
|
||||
if (!m_xShowAgain->get_active())
|
||||
if (m_xShowAgain->get_active())
|
||||
{
|
||||
std::shared_ptr<comphelper::ConfigurationChanges> xChanges(
|
||||
comphelper::ConfigurationChanges::create());
|
||||
|
||||
@@ -23,7 +23,7 @@ WidgetTestDialog::WidgetTestDialog(weld::Window* pParent)
|
||||
|
||||
m_xOKButton->connect_clicked(LINK(this, WidgetTestDialog, OkHdl));
|
||||
m_xCancelButton->connect_clicked(LINK(this, WidgetTestDialog, CancelHdl));
|
||||
m_xTreeView2->connect_column_clicked(LINK(this, WidgetTestDialog, HeaderBarClick));
|
||||
m_xTreeView2->connect_column_header_clicked(LINK(this, WidgetTestDialog, HeaderBarClick));
|
||||
|
||||
FillTreeView();
|
||||
}
|
||||
|
||||
@@ -97,11 +97,12 @@
|
||||
#include <DiagramDialog.hxx>
|
||||
#include <fileextcheckdlg.hxx>
|
||||
#include <TextColumnsPage.hxx>
|
||||
#include <querydialog.hxx>
|
||||
#include <welcomedlg.hxx>
|
||||
|
||||
#include <MacroManagerDialog.hxx>
|
||||
|
||||
#include <svtools/querydialog.hxx>
|
||||
|
||||
using namespace ::com::sun::star::frame;
|
||||
using namespace ::com::sun::star::container;
|
||||
|
||||
@@ -241,7 +242,7 @@ VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateCustomizeTabDialo
|
||||
return VclPtr<CuiAbstractTabController_Impl<SvxConfigDialog>>::Create(std::move(xDlg1));
|
||||
}
|
||||
|
||||
// TabDialog that use functionality of the drawing layer
|
||||
// TabDialog that uses functionality of the drawing layer
|
||||
VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateTextTabDialog(weld::Window* pParent,
|
||||
const SfxItemSet* pAttrSet,
|
||||
SdrView* pView)
|
||||
@@ -251,7 +252,7 @@ VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateTextTabDialog(wel
|
||||
|
||||
namespace
|
||||
{
|
||||
// AbstractSvxCaptionDialog implementations just forwards everything to the dialog
|
||||
// AbstractSvxCaptionDialog implementation just forwards everything to the dialog
|
||||
class AbstractSvxCaptionDialog_Impl final
|
||||
: public vcl::AbstractDialogImpl_Async<AbstractSvxCaptionDialog, SvxCaptionTabDialog>
|
||||
{
|
||||
@@ -272,7 +273,7 @@ public:
|
||||
};
|
||||
}
|
||||
|
||||
// TabDialog that use functionality of the drawing layer and add AnchorTypes -- for SvxCaptionTabDialog
|
||||
// TabDialog that uses functionality of the drawing layer and adds AnchorTypes -- for SvxCaptionTabDialog
|
||||
VclPtr<AbstractSvxCaptionDialog> AbstractDialogFactory_Impl::CreateCaptionDialog(weld::Window* pParent,
|
||||
const SdrView* pView,
|
||||
SvxAnchorIds nAnchorTypes)
|
||||
@@ -482,6 +483,7 @@ class AbstractScriptSelectorDialog_Impl final
|
||||
public:
|
||||
using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE;
|
||||
OUString GetScriptURL() const override { return m_pDlg->GetScriptURL(); }
|
||||
Reference<frame::XModel> GetScriptModel() const override { return m_pDlg->GetScriptModel(); }
|
||||
void SetRunLabel() override { m_pDlg->SetRunLabel(); }
|
||||
};
|
||||
}
|
||||
@@ -501,6 +503,7 @@ class AbstractMacroManagerDialog_Impl final
|
||||
public:
|
||||
using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE;
|
||||
OUString GetScriptURL() const override { return m_pDlg->GetScriptURL(); }
|
||||
Reference<frame::XModel> GetScriptModel() const override { return m_pDlg->GetScriptModel(); }
|
||||
void LoadLastUsedMacro() const override { m_pDlg->LoadLastUsedMacro(); }
|
||||
};
|
||||
}
|
||||
@@ -1548,27 +1551,4 @@ AbstractDialogFactory_Impl::CreateFileExtCheckDialog(weld::Window* pParent, cons
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
class AbstractQueryDialog_Impl final
|
||||
: public vcl::AbstractDialogImpl_Async<AbstractQueryDialog,
|
||||
QueryDialog>
|
||||
{
|
||||
public:
|
||||
using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE;
|
||||
bool ShowAgain() const override { return m_pDlg->ShowAgain(); }
|
||||
void SetYesLabel(const OUString& sLabel) override { m_pDlg->SetYesLabel(sLabel); }
|
||||
void SetNoLabel(const OUString& sLabel) override { m_pDlg->SetNoLabel(sLabel); }
|
||||
};
|
||||
}
|
||||
|
||||
VclPtr<AbstractQueryDialog>
|
||||
AbstractDialogFactory_Impl::CreateQueryDialog(
|
||||
weld::Window* pParent,
|
||||
const OUString& sTitle, const OUString& sText, const OUString& sQuestion,
|
||||
bool bShowAgain)
|
||||
{
|
||||
return VclPtr<AbstractQueryDialog_Impl>::Create(pParent, sTitle, sText, sQuestion, bShowAgain);
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include <svx/svxdlg.hxx>
|
||||
|
||||
//AbstractDialogFactory_Impl implementations
|
||||
// AbstractDialogFactory_Impl implementation
|
||||
class AbstractDialogFactory_Impl : public SvxAbstractDialogFactory
|
||||
{
|
||||
public:
|
||||
@@ -224,11 +224,6 @@ public:
|
||||
weld::Window* pParent,
|
||||
SdrObjGroup& rDiagram) override;
|
||||
|
||||
virtual VclPtr<AbstractQueryDialog> CreateQueryDialog(
|
||||
weld::Window* pParent,
|
||||
const OUString& sTitle, const OUString& sText, const OUString& sQuestion,
|
||||
bool bShowAgain) override;
|
||||
|
||||
#ifdef _WIN32
|
||||
virtual VclPtr<VclAbstractDialog> CreateFileExtCheckDialog(weld::Window* pParent,
|
||||
const OUString& sTitle,
|
||||
|
||||
@@ -12,12 +12,16 @@
|
||||
|
||||
#include <salhelper/thread.hxx>
|
||||
#include <rtl/ref.hxx>
|
||||
#include <vcl/weld/Box.hxx>
|
||||
#include <vcl/weld/Button.hxx>
|
||||
#include <vcl/weld/Builder.hxx>
|
||||
#include <vcl/weld/Entry.hxx>
|
||||
#include <vcl/weld/DialogController.hxx>
|
||||
#include <vcl/weld/Image.hxx>
|
||||
#include <vcl/weld/Label.hxx>
|
||||
#include <vcl/weld/LinkButton.hxx>
|
||||
#include <vcl/weld/MenuButton.hxx>
|
||||
#include <vcl/weld/ScrolledWindow.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
|
||||
// Detect changes on the UI
|
||||
#include <vcl/timer.hxx>
|
||||
@@ -63,7 +67,7 @@ private:
|
||||
Timer m_aSearchDataTimer;
|
||||
|
||||
DECL_LINK(GearHdl, const OUString&, void);
|
||||
DECL_LINK(SearchUpdateHdl, weld::Entry&, void);
|
||||
DECL_LINK(SearchUpdateHdl, weld::TextWidget&, void);
|
||||
DECL_LINK(ImplUpdateDataHdl, Timer*, void);
|
||||
DECL_LINK(FocusOut_Impl, weld::Widget&, void);
|
||||
DECL_LINK(CloseButtonHdl, weld::Button&, void);
|
||||
|
||||
@@ -63,8 +63,8 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
Signals that a command category has been selected.
|
||||
And updates the functions list box to include
|
||||
Signals that a command category has been selected,
|
||||
and updates the functions list box to include
|
||||
the commands in the selected category.
|
||||
*/
|
||||
void categorySelected(CuiConfigFunctionListBox* pFunctionListBox, const OUString& filterTerm,
|
||||
@@ -78,8 +78,6 @@ public:
|
||||
CuiConfigFunctionListBox* pFunctionListBox, const OUString& filterTerm,
|
||||
SaveInData* pCurrentSaveInData,
|
||||
std::vector<std::unique_ptr<weld::TreeIter>>& rNodesToExpand);
|
||||
|
||||
void set_visible(bool bVisible) { m_xControl->set_visible(bVisible); }
|
||||
};
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <com/sun/star/uno/Sequence.hxx>
|
||||
#include <rtl/ustring.hxx>
|
||||
|
||||
using namespace css::uno;
|
||||
|
||||
class CustomNotebookbarGenerator
|
||||
{
|
||||
public:
|
||||
CustomNotebookbarGenerator();
|
||||
static OUString getCustomizedUIPath();
|
||||
static OUString getOriginalUIPath();
|
||||
static OString getSystemPath(OUString const& sURL);
|
||||
static Sequence<OUString> getCustomizedUIItem(const OUString& sNotebookbarConfigType);
|
||||
static void getFileNameAndAppName(OUString& sAppName, OUString& sNotebookbarUIFileName);
|
||||
static void modifyCustomizedUIFile(const Sequence<OUString>& sUIItemProperties);
|
||||
static void createCustomizedUIFile();
|
||||
static void setCustomizedUIItem(const Sequence<OUString>& rUIItemProperties,
|
||||
const OUString& rNotebookbarConfigType);
|
||||
};
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
@@ -10,10 +10,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <tools/link.hxx>
|
||||
#include <vcl/weld/Button.hxx>
|
||||
#include <vcl/weld/DialogController.hxx>
|
||||
#include <vcl/weld/TextView.hxx>
|
||||
#include <vcl/weld/TreeView.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <vcl/weld/Window.hxx>
|
||||
|
||||
class SdrObjGroup;
|
||||
|
||||
|
||||
@@ -12,10 +12,14 @@
|
||||
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vcl/weld/Builder.hxx>
|
||||
#include <vcl/weld/CheckButton.hxx>
|
||||
#include <vcl/weld/ComboBox.hxx>
|
||||
#include <vcl/weld/DialogController.hxx>
|
||||
#include <vcl/weld/Grid.hxx>
|
||||
#include <vcl/weld/Label.hxx>
|
||||
#include <vcl/weld/ScrolledWindow.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <vcl/weld/TriStateEnabled.hxx>
|
||||
#include <vcl/weld/Window.hxx>
|
||||
#include <vcl/font/Feature.hxx>
|
||||
#include <svx/fntctrl.hxx>
|
||||
#include <memory>
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <sal/config.h>
|
||||
|
||||
#include <com/sun/star/uno/Reference.hxx>
|
||||
|
||||
namespace com::sun::star::uno
|
||||
{
|
||||
class XComponentContext;
|
||||
}
|
||||
|
||||
namespace com::sun::star::frame
|
||||
{
|
||||
class XModel;
|
||||
}
|
||||
|
||||
css::uno::Reference<css::frame::XModel>
|
||||
getDocumentModel(const css::uno::Reference<css::uno::XComponentContext>& xContext,
|
||||
std::u16string_view sDocName);
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
||||
@@ -9,11 +9,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <vcl/bitmap.hxx>
|
||||
#include <vcl/weld/Box.hxx>
|
||||
#include <vcl/weld/Builder.hxx>
|
||||
#include <vcl/weld/Button.hxx>
|
||||
#include <vcl/weld/Container.hxx>
|
||||
#include <vcl/weld/Dialog.hxx>
|
||||
#include <vcl/weld/DialogController.hxx>
|
||||
#include <vcl/weld/Label.hxx>
|
||||
#include <vcl/weld/TextView.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <tools/link.hxx>
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include <vcl/bitmap.hxx>
|
||||
#include <vcl/weld/DialogController.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <vcl/weld/Image.hxx>
|
||||
|
||||
class ImageViewerDialog : public weld::GenericDialogController
|
||||
{
|
||||
|
||||
@@ -15,7 +15,9 @@
|
||||
#include <basctl/scriptdocument.hxx>
|
||||
#include <svx/passwd.hxx>
|
||||
#include <svl/lstner.hxx>
|
||||
#include <vcl/weld/Button.hxx>
|
||||
#include <vcl/weld/DialogController.hxx>
|
||||
#include <vcl/weld/Frame.hxx>
|
||||
#include <vcl/weld/TextView.hxx>
|
||||
#include <vcl/weld/TreeView.hxx>
|
||||
|
||||
@@ -24,12 +26,23 @@
|
||||
#include <com/sun/star/script/browse/XBrowseNode.hpp>
|
||||
#include <com/sun/star/uno/XComponentContext.hpp>
|
||||
|
||||
class SbModule;
|
||||
class SbMethod;
|
||||
|
||||
namespace com::sun::star::script::browse
|
||||
{
|
||||
class XCopyableBrowseNode;
|
||||
}
|
||||
|
||||
struct ScriptContainerInfo
|
||||
{
|
||||
css::script::browse::XBrowseNode* pBrowseNode;
|
||||
css::uno::Reference<css::frame::XModel> xModel;
|
||||
|
||||
ScriptContainerInfo(css::script::browse::XBrowseNode* pObj)
|
||||
ScriptContainerInfo(css::script::browse::XBrowseNode* pObj,
|
||||
const css::uno::Reference<css::frame::XModel>& xModel_)
|
||||
: pBrowseNode(pObj)
|
||||
, xModel(xModel_)
|
||||
{
|
||||
}
|
||||
};
|
||||
@@ -39,12 +52,14 @@ struct ScriptInfo
|
||||
css::script::browse::XBrowseNode* pBrowseNode;
|
||||
OUString sURL;
|
||||
OUString sDescription;
|
||||
css::uno::Reference<css::frame::XModel> xModel;
|
||||
|
||||
ScriptInfo(css::script::browse::XBrowseNode* pObj, const OUString& rsUrl,
|
||||
const OUString& rsDesc)
|
||||
const OUString& rsDesc, const css::uno::Reference<css::frame::XModel>& xModel_)
|
||||
: pBrowseNode(pObj)
|
||||
, sURL(rsUrl)
|
||||
, sDescription(rsDesc)
|
||||
, xModel(xModel_)
|
||||
{
|
||||
}
|
||||
};
|
||||
@@ -160,6 +175,7 @@ public:
|
||||
void ScriptContainerSelected();
|
||||
|
||||
void Insert(const css::uno::Reference<css::script::browse::XBrowseNode>& xInsertNode,
|
||||
const css::uno::Reference<css::frame::XModel>& xDocumentModel,
|
||||
const weld::TreeIter* pParentEntry, const OUString& rsUiName,
|
||||
const OUString& rsImage, bool bChildOnDemand = false, int nPos = -1,
|
||||
weld::TreeIter* pRet = nullptr);
|
||||
@@ -198,8 +214,13 @@ class MacroManagerDialog : public weld::GenericDialogController, public SfxListe
|
||||
std::unique_ptr<weld::Button> m_xMacroDeleteButton;
|
||||
std::unique_ptr<weld::Button> m_xMacroCreateButton;
|
||||
std::unique_ptr<weld::Button> m_xMacroRenameButton;
|
||||
std::unique_ptr<weld::Button> m_xModuleCopyButton;
|
||||
std::unique_ptr<weld::Button> m_xModulePasteButton;
|
||||
std::unique_ptr<weld::Button> m_xAssignButton;
|
||||
|
||||
// Node that is selected via the “copy” button to be later pasted with the “paste” button.
|
||||
css::uno::Reference<css::script::browse::XCopyableBrowseNode> m_xCopiedNode;
|
||||
|
||||
DECL_LINK(ClickHdl, weld::Button&, void);
|
||||
DECL_LINK(SelectHdl, weld::ItemView&, void);
|
||||
DECL_LINK(FunctionDoubleClickHdl, const weld::TreeIter&, bool);
|
||||
@@ -214,6 +235,7 @@ class MacroManagerDialog : public weld::GenericDialogController, public SfxListe
|
||||
void BasicScriptsLibraryModuleDialogDelete(const basctl::ScriptDocument& rDocument);
|
||||
void BasicScriptsLibraryPassword(const basctl::ScriptDocument& rDocument);
|
||||
void BasicScriptsMacroEdit(const basctl::ScriptDocument& rDocument);
|
||||
void BasicScriptsMacroDelete();
|
||||
bool IsLibraryReadOnlyOrFailedPasswordQuery(const basctl::ScriptDocument& rDocument,
|
||||
const weld::TreeIter* pIter);
|
||||
|
||||
@@ -222,8 +244,8 @@ class MacroManagerDialog : public weld::GenericDialogController, public SfxListe
|
||||
const weld::TreeIter& rEntry);
|
||||
void ScriptingFrameworkScriptsDeleteEntry(weld::TreeView& rTreeView,
|
||||
const weld::TreeIter& rEntry);
|
||||
static bool getBoolProperty(css::uno::Reference<css::beans::XPropertySet> const& xProps,
|
||||
OUString const& propName);
|
||||
void ScriptingFrameworkScriptsPasteEntry(weld::TreeView& rTreeView,
|
||||
const weld::TreeIter& rEntry);
|
||||
OUString getListOfChildren(const css::uno::Reference<css::script::browse::XBrowseNode>& node,
|
||||
int depth);
|
||||
|
||||
@@ -233,6 +255,9 @@ class MacroManagerDialog : public weld::GenericDialogController, public SfxListe
|
||||
void UpdateUI();
|
||||
void CheckButtons();
|
||||
|
||||
SbModule* GetSelectedBasicModule() const;
|
||||
SbMethod* GetSelectedBasicMethod() const;
|
||||
|
||||
virtual void Notify(SfxBroadcaster&, const SfxHint& rHint) override;
|
||||
|
||||
public:
|
||||
@@ -241,6 +266,7 @@ public:
|
||||
virtual ~MacroManagerDialog() override;
|
||||
|
||||
OUString GetScriptURL() const;
|
||||
css::uno::Reference<css::frame::XModel> GetScriptModel() const;
|
||||
|
||||
void SaveLastUsedMacro();
|
||||
void LoadLastUsedMacro();
|
||||
|
||||
@@ -12,9 +12,10 @@
|
||||
|
||||
#include <vcl/weld/ComboBox.hxx>
|
||||
#include <vcl/weld/DialogController.hxx>
|
||||
#include <vcl/weld/Label.hxx>
|
||||
#include <vcl/weld/RadioButton.hxx>
|
||||
#include <vcl/weld/SpinButton.hxx>
|
||||
#include <vcl/weld/TextView.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
|
||||
#include <com/sun/star/frame/XModel.hpp>
|
||||
#include <com/sun/star/uno/Reference.hxx>
|
||||
|
||||
@@ -14,7 +14,9 @@
|
||||
#include <com/sun/star/graphic/XGraphic.hpp>
|
||||
#include <com/sun/star/security/XCertificate.hpp>
|
||||
#include <com/sun/star/uno/Reference.hxx>
|
||||
#include <vcl/weld/Button.hxx>
|
||||
#include <vcl/weld/Entry.hxx>
|
||||
#include <vcl/weld/Label.hxx>
|
||||
#include <vcl/weld/TextView.hxx>
|
||||
|
||||
class SignSignatureLineDialog : public SignatureLineDialogBase
|
||||
@@ -50,7 +52,7 @@ private:
|
||||
DECL_LINK(clearImage, weld::Button&, void);
|
||||
DECL_LINK(loadImage, weld::Button&, void);
|
||||
DECL_LINK(chooseCertificate, weld::Button&, void);
|
||||
DECL_LINK(entryChanged, weld::Entry&, void);
|
||||
DECL_LINK(entryChanged, weld::TextWidget&, void);
|
||||
};
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
#include <com/sun/star/beans/XPropertySet.hpp>
|
||||
#include <com/sun/star/uno/Reference.hxx>
|
||||
#include <vcl/weld/CheckButton.hxx>
|
||||
#include <vcl/weld/Entry.hxx>
|
||||
#include <vcl/weld/TextView.hxx>
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include <string_view>
|
||||
|
||||
#include <vcl/weld/DialogController.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
|
||||
#include <com/sun/star/frame/XModel.hpp>
|
||||
#include <com/sun/star/uno/Reference.hxx>
|
||||
|
||||
@@ -28,8 +28,12 @@
|
||||
#include <svl/undo.hxx>
|
||||
#include <svx/weldeditview.hxx>
|
||||
#include <editeng/SpellPortions.hxx>
|
||||
#include <vcl/weld/Button.hxx>
|
||||
#include <vcl/weld/CheckButton.hxx>
|
||||
#include <vcl/weld/ComboBox.hxx>
|
||||
#include <vcl/weld/DrawingArea.hxx>
|
||||
#include <vcl/weld/Label.hxx>
|
||||
#include <vcl/weld/LinkButton.hxx>
|
||||
#include <vcl/weld/MenuButton.hxx>
|
||||
#include <vcl/weld/ScrolledWindow.hxx>
|
||||
#include <vcl/weld/Toolbar.hxx>
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include <vcl/weld/ComboBox.hxx>
|
||||
#include <vcl/weld/DialogController.hxx>
|
||||
#include <vcl/weld/TreeView.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
|
||||
#include "cfg.hxx" //for SvxConfigPage and SaveInData
|
||||
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <libxml/parser.h>
|
||||
#include <vcl/weld/TreeView.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "cfg.hxx" //for SvxConfigPage and SaveInData
|
||||
|
||||
class SvxNotebookbarConfigPage : public SvxConfigPage
|
||||
{
|
||||
private:
|
||||
void UpdateButtonStates() override;
|
||||
short QueryReset() override;
|
||||
void Init() override;
|
||||
void DeleteSelectedContent() override;
|
||||
void DeleteSelectedTopLevel() override;
|
||||
virtual void SelectElement() override;
|
||||
void SetElement();
|
||||
|
||||
public:
|
||||
struct NotebookbarEntries
|
||||
{
|
||||
OUString sUIItemId;
|
||||
OUString sClassId;
|
||||
OUString sActionName;
|
||||
OUString sDisplayName;
|
||||
OUString sVisibleValue;
|
||||
};
|
||||
struct CategoriesEntries
|
||||
{
|
||||
OUString sDisplayName;
|
||||
OUString sUIItemId;
|
||||
OUString sClassType;
|
||||
};
|
||||
SvxNotebookbarConfigPage(weld::Container* pPage, weld::DialogController* pController,
|
||||
const SfxItemSet& rItemSet);
|
||||
virtual ~SvxNotebookbarConfigPage() override;
|
||||
SaveInData* CreateSaveInData(const css::uno::Reference<css::ui::XUIConfigurationManager>&,
|
||||
const css::uno::Reference<css::ui::XUIConfigurationManager>&,
|
||||
const OUString& aModuleId, bool docConfig) override;
|
||||
static void FillFunctionsList(xmlNodePtr pRootNodePtr,
|
||||
std::vector<NotebookbarEntries>& aEntries,
|
||||
std::vector<CategoriesEntries>& aCategoryList,
|
||||
OUString& sActiveCategory);
|
||||
static void searchNodeandAttribute(std::vector<NotebookbarEntries>& aEntries,
|
||||
std::vector<CategoriesEntries>& aCategoryList,
|
||||
OUString& sActiveCategory,
|
||||
CategoriesEntries& aCurCategoryEntry, xmlNode* pNodePtr,
|
||||
bool isCategory);
|
||||
static void getNodeValue(xmlNode* pNodePtr, NotebookbarEntries& aNodeEntries);
|
||||
};
|
||||
|
||||
class SvxNotebookbarEntriesListBox final : public SvxMenuEntriesListBox
|
||||
{
|
||||
typedef std::unordered_map<OUString, OUString> TooltipMap;
|
||||
TooltipMap m_aTooltipMap;
|
||||
|
||||
void ChangedVisibility(int nRow);
|
||||
DECL_LINK(CheckButtonHdl, const weld::TreeView::iter_col&, void);
|
||||
DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
|
||||
DECL_LINK(QueryTooltip, const weld::TreeIter& rIter, OUString);
|
||||
|
||||
public:
|
||||
SvxNotebookbarEntriesListBox(std::unique_ptr<weld::TreeView> xControl, SvxConfigPage* pPg);
|
||||
virtual ~SvxNotebookbarEntriesListBox() override;
|
||||
|
||||
TooltipMap& GetTooltipMap() { return m_aTooltipMap; }
|
||||
};
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
@@ -16,28 +16,44 @@
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vcl/weld/DialogController.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <svx/xtable.hxx>
|
||||
#include <tools/gen.hxx>
|
||||
#include <tools/link.hxx>
|
||||
#include <vcl/event.hxx>
|
||||
|
||||
class QueryDialog final : public weld::GenericDialogController
|
||||
namespace weld
|
||||
{
|
||||
private:
|
||||
std::unique_ptr<weld::Label> m_pTitle;
|
||||
std::unique_ptr<weld::Label> m_pText;
|
||||
std::unique_ptr<weld::Label> m_pQuestion;
|
||||
std::unique_ptr<weld::Image> m_pImage;
|
||||
std::unique_ptr<weld::CheckButton> m_pCheckBox;
|
||||
std::unique_ptr<weld::Button> m_pYes;
|
||||
std::unique_ptr<weld::Button> m_pNo;
|
||||
class IconView;
|
||||
}
|
||||
|
||||
class SvxPresetListBox final
|
||||
{
|
||||
weld::IconView& m_rIconView;
|
||||
|
||||
Size m_aIconSize;
|
||||
Link<int, void> maRenameHdl;
|
||||
Link<int, void> maDeleteHdl;
|
||||
|
||||
DECL_LINK(CommandHdl, const CommandEvent&, bool);
|
||||
DECL_LINK(KeyPressHdl, const KeyEvent&, bool);
|
||||
|
||||
template <typename ListType> void FillPresetListBoxImpl(ListType& rList);
|
||||
|
||||
public:
|
||||
QueryDialog(weld::Window* pParent, const OUString& sTitle, const OUString& sText,
|
||||
const OUString& sQuestion, bool bShowAgain = true);
|
||||
bool ShowAgain() const { return m_pCheckBox->get_active(); }
|
||||
void SetYesLabel(const OUString& sLabel) { m_pYes->set_label(sLabel); }
|
||||
void SetNoLabel(const OUString& sLabel) { m_pNo->set_label(sLabel); }
|
||||
SvxPresetListBox(weld::IconView& rIconView);
|
||||
|
||||
Size const& GetIconSize() const { return m_aIconSize; }
|
||||
|
||||
void SetRenameHdl(const Link<int, void>& rLink) { maRenameHdl = rLink; }
|
||||
void SetDeleteHdl(const Link<int, void>& rLink) { maDeleteHdl = rLink; }
|
||||
|
||||
void FillPresetListBox(XGradientList& rList);
|
||||
void FillPresetListBox(XHatchList& rList);
|
||||
void FillPresetListBox(XBitmapList& rList);
|
||||
void FillPresetListBox(XPatternList& rList);
|
||||
};
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#include <vcl/weld/ComboBox.hxx>
|
||||
#include <vcl/weld/TreeView.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
||||
@@ -18,8 +18,12 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <vcl/weld/Button.hxx>
|
||||
#include <vcl/weld/DialogController.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <vcl/weld/Image.hxx>
|
||||
#include <vcl/weld/Label.hxx>
|
||||
#include <vcl/weld/LinkButton.hxx>
|
||||
#include <vcl/weld/Window.hxx>
|
||||
|
||||
class AboutDialog : public weld::GenericDialogController
|
||||
{
|
||||
|
||||
@@ -27,8 +27,10 @@
|
||||
#include <sfx2/tabdlg.hxx>
|
||||
#include <vcl/timer.hxx>
|
||||
#include <vcl/keycod.hxx>
|
||||
#include <vcl/weld/Button.hxx>
|
||||
#include <vcl/weld/ComboBox.hxx>
|
||||
#include <vcl/weld/Entry.hxx>
|
||||
#include <vcl/weld/RadioButton.hxx>
|
||||
#include <i18nutil/searchopt.hxx>
|
||||
#include <config_features.h>
|
||||
#include "cfgutil.hxx"
|
||||
@@ -109,7 +111,7 @@ private:
|
||||
DECL_LINK(ChangeHdl, weld::Button&, void);
|
||||
DECL_LINK(RemoveHdl, weld::Button&, void);
|
||||
DECL_LINK(SelectHdl, weld::ItemView&, void);
|
||||
DECL_LINK(SearchUpdateHdl, weld::Entry&, void);
|
||||
DECL_LINK(SearchUpdateHdl, weld::TextWidget&, void);
|
||||
DECL_LINK(Save, weld::Button&, void);
|
||||
DECL_LINK(Load, weld::Button&, void);
|
||||
DECL_LINK(Default, weld::Button&, void);
|
||||
|
||||
@@ -42,9 +42,11 @@ enum VerticalAlign {
|
||||
#include <svtools/valueset.hxx>
|
||||
#include <svx/dialcontrol.hxx>
|
||||
#include <svx/frmdirlbox.hxx>
|
||||
#include <vcl/weld/CheckButton.hxx>
|
||||
#include <vcl/weld/ComboBox.hxx>
|
||||
#include <vcl/weld/Label.hxx>
|
||||
#include <vcl/weld/MetricSpinButton.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <vcl/weld/TriStateEnabled.hxx>
|
||||
|
||||
class SvxJustifyMethodItem;
|
||||
|
||||
|
||||
@@ -21,7 +21,10 @@
|
||||
#include <sfx2/tabdlg.hxx>
|
||||
#include <svx/langbox.hxx>
|
||||
#include <unotools/collatorwrapper.hxx>
|
||||
#include <vcl/weld/Button.hxx>
|
||||
#include <vcl/weld/CheckButton.hxx>
|
||||
#include <vcl/weld/Entry.hxx>
|
||||
#include <vcl/weld/Label.hxx>
|
||||
#include <vcl/weld/SpinButton.hxx>
|
||||
#include <vcl/weld/TreeIter.hxx>
|
||||
|
||||
@@ -195,7 +198,7 @@ private:
|
||||
DECL_LINK(NewDelButtonHdl, weld::Button&, void);
|
||||
DECL_LINK(NewDelActionHdl, weld::Entry&, bool);
|
||||
DECL_LINK(EntrySizeAllocHdl, const Size&, void);
|
||||
DECL_LINK(ModifyHdl, weld::Entry&, void);
|
||||
DECL_LINK(ModifyHdl, weld::TextWidget&, void);
|
||||
bool NewDelHdl(const weld::Widget*);
|
||||
|
||||
void RefillReplaceBox( bool bFromReset,
|
||||
@@ -251,7 +254,7 @@ private:
|
||||
DECL_LINK(NewDelButtonHdl, weld::Button&, void);
|
||||
DECL_LINK(NewDelActionHdl, weld::Entry&, bool);
|
||||
DECL_LINK(SelectHdl, weld::ItemView&, void);
|
||||
DECL_LINK(ModifyHdl, weld::Entry&, void);
|
||||
DECL_LINK(ModifyHdl, weld::TextWidget&, void);
|
||||
bool NewDelHdl(const weld::Widget*);
|
||||
/// Box filled with new language
|
||||
void RefillReplaceBoxes(bool bFromReset,
|
||||
@@ -281,6 +284,7 @@ private:
|
||||
OUString sOrdinal;
|
||||
OUString sTransliterateRTL;
|
||||
OUString sAngleQuotes;
|
||||
OUString sEsperantoHats;
|
||||
|
||||
sal_UCS4 cSglStartQuote;
|
||||
sal_UCS4 cSglEndQuote;
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <sfx2/tabdlg.hxx>
|
||||
#include <vcl/weld/Window.hxx>
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Description: bunch the border background pages
|
||||
|
||||
@@ -20,10 +20,11 @@
|
||||
|
||||
#include <editeng/shaditem.hxx>
|
||||
#include <svtools/ctrlbox.hxx>
|
||||
#include <vcl/weld/CheckButton.hxx>
|
||||
#include <vcl/weld/ComboBox.hxx>
|
||||
#include <vcl/weld/IconView.hxx>
|
||||
#include <vcl/weld/Label.hxx>
|
||||
#include <vcl/weld/MetricSpinButton.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <sfx2/tabdlg.hxx>
|
||||
#include <svx/algitem.hxx>
|
||||
#include <svx/colorbox.hxx>
|
||||
|
||||
+4
-12
@@ -20,13 +20,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <vcl/timer.hxx>
|
||||
#include <vcl/weld/Button.hxx>
|
||||
#include <vcl/weld/ComboBox.hxx>
|
||||
#include <vcl/weld/DialogController.hxx>
|
||||
#include <vcl/weld/Entry.hxx>
|
||||
#include <vcl/weld/Label.hxx>
|
||||
#include <vcl/weld/MenuButton.hxx>
|
||||
#include <vcl/weld/TextView.hxx>
|
||||
#include <vcl/weld/TreeView.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <vcl/weld/weldutils.hxx>
|
||||
#include <svtools/valueset.hxx>
|
||||
|
||||
@@ -386,7 +387,7 @@ private:
|
||||
bool bInitialised;
|
||||
SaveInData* pCurrentSaveInData;
|
||||
|
||||
DECL_LINK(SearchUpdateHdl, weld::Entry&, void);
|
||||
DECL_LINK(SearchUpdateHdl, weld::TextWidget&, void);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -434,9 +435,6 @@ protected:
|
||||
std::unique_ptr<weld::Button> m_xAddCommandButton;
|
||||
std::unique_ptr<weld::Button> m_xRemoveCommandButton;
|
||||
|
||||
OUString m_sAppName;
|
||||
OUString m_sFileName;
|
||||
|
||||
SvxConfigPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet&);
|
||||
|
||||
DECL_LINK(MoveHdl, weld::Button&, void);
|
||||
@@ -472,10 +470,6 @@ protected:
|
||||
weld::TreeView& rTreeView, weld::TreeIter& rIter,
|
||||
bool bMenu = false);
|
||||
|
||||
void InsertEntryIntoNotebookbarTabUI(std::u16string_view sClassId, const OUString& sUIItemId,
|
||||
const OUString& sUIItemCommand,
|
||||
weld::TreeView& rTreeView, const weld::TreeIter& rIter);
|
||||
|
||||
SvxEntries* FindParentForChild( SvxEntries* pParentEntries,
|
||||
SvxConfigEntry* pChildData );
|
||||
|
||||
@@ -493,8 +487,6 @@ public:
|
||||
static bool CanConfig( std::u16string_view rModuleId );
|
||||
|
||||
SaveInData* GetSaveInData() { return pCurrentSaveInData; }
|
||||
const OUString& GetAppName() const { return m_sAppName; }
|
||||
const OUString& GetFileName() const { return m_sFileName; }
|
||||
|
||||
int AddFunction(int nTarget,
|
||||
bool bAllowDuplicates,
|
||||
@@ -548,7 +540,7 @@ class SvxMainMenuOrganizerDialog : public weld::GenericDialogController
|
||||
void UpdateButtonStates();
|
||||
|
||||
DECL_LINK(MoveHdl, weld::Button&, void);
|
||||
DECL_LINK(ModifyHdl, weld::Entry&, void);
|
||||
DECL_LINK(ModifyHdl, weld::TextWidget&, void);
|
||||
DECL_LINK(SelectHdl, weld::ItemView&, void);
|
||||
|
||||
public:
|
||||
|
||||
+66
-16
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <string_view>
|
||||
@@ -30,10 +31,14 @@
|
||||
#include <com/sun/star/container/XNameAccess.hpp>
|
||||
#include <com/sun/star/script/browse/XBrowseNode.hpp>
|
||||
#include <com/sun/star/uno/XComponentContext.hpp>
|
||||
#include <vcl/weld/Button.hxx>
|
||||
#include <vcl/weld/DialogController.hxx>
|
||||
#include <vcl/weld/Frame.hxx>
|
||||
#include <vcl/weld/Label.hxx>
|
||||
#include <vcl/weld/TextView.hxx>
|
||||
#include <vcl/weld/TreeView.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <vcl/weld/Window.hxx>
|
||||
|
||||
#include <config_features.h>
|
||||
|
||||
#if HAVE_FEATURE_SCRIPTING
|
||||
@@ -79,29 +84,76 @@ public:
|
||||
static OUString generateCommand(std::u16string_view sFamily, std::u16string_view sStyle);
|
||||
};
|
||||
|
||||
struct SfxScriptContainer_Data
|
||||
{
|
||||
SfxScriptContainer_Data(
|
||||
const css::uno::Reference<css::script::browse::XBrowseNode>& xBrowseNode_ = nullptr,
|
||||
const css::uno::Reference<css::frame::XModel>& xModel_ = nullptr)
|
||||
: xBrowseNode(xBrowseNode_)
|
||||
, xModel(xModel_)
|
||||
{
|
||||
}
|
||||
|
||||
css::uno::Reference<css::script::browse::XBrowseNode> xBrowseNode;
|
||||
css::uno::Reference<css::frame::XModel> xModel;
|
||||
};
|
||||
|
||||
struct SfxScriptFunction_Data
|
||||
{
|
||||
SfxScriptFunction_Data(
|
||||
const OUString& sUrl_ = OUString(),
|
||||
const css::uno::Reference<css::frame::XModel> &xModel_ = nullptr)
|
||||
: sUrl(sUrl_)
|
||||
, xModel(xModel_)
|
||||
{
|
||||
}
|
||||
|
||||
OUString sUrl;
|
||||
css::uno::Reference<css::frame::XModel> xModel;
|
||||
};
|
||||
|
||||
enum class SfxCfgKind
|
||||
{
|
||||
GROUP_FUNCTION = 1,
|
||||
FUNCTION_SLOT = 2,
|
||||
GROUP_SCRIPTCONTAINER = 3,
|
||||
FUNCTION_SCRIPT = 4,
|
||||
GROUP_STYLES = 5,
|
||||
GROUP_ALLFUNCTIONS = 6,
|
||||
GROUP_SIDEBARDECKS = 7
|
||||
GROUP_FUNCTION,
|
||||
FUNCTION_SLOT,
|
||||
GROUP_SCRIPTCONTAINER,
|
||||
FUNCTION_SCRIPT,
|
||||
GROUP_STYLES,
|
||||
GROUP_ALLFUNCTIONS,
|
||||
GROUP_SIDEBARDECKS,
|
||||
};
|
||||
|
||||
// Used to construct SfxGroupInfo_Data by selecting the variant as an index tag
|
||||
template <SfxCfgKind K>
|
||||
constexpr std::in_place_index_t<size_t(K)> SfxCfgKindAsIndex {};
|
||||
|
||||
// The types must match the order of the values of SfxCfgKind
|
||||
typedef std::variant<
|
||||
std::monostate, // GROUP_FUNCTION
|
||||
std::monostate, // FUNCTION_SLOT
|
||||
SfxScriptContainer_Data, // GROUP_SCRIPTCONTAINER
|
||||
SfxScriptFunction_Data, // FUNCTION_SCRIPT
|
||||
std::unique_ptr<SfxStyleInfo_Impl>, // GROUP_STYLES
|
||||
std::monostate, // GROUP_ALLFUNCTIONS
|
||||
std::monostate // GROUP_SIDEBARDECKS
|
||||
> SfxGroupInfo_Data;
|
||||
|
||||
struct SfxGroupInfo_Impl
|
||||
{
|
||||
SfxCfgKind nKind;
|
||||
SfxGroupInfo_Data aData;
|
||||
sal_uInt16 nUniqueID;
|
||||
void* pObject;
|
||||
OUString sCommand;
|
||||
OUString sLabel;
|
||||
OUString sHelpText;
|
||||
OUString sTooltip;
|
||||
|
||||
SfxGroupInfo_Impl( SfxCfgKind n, sal_uInt16 nr, void* pObj = nullptr ) :
|
||||
nKind( n ), nUniqueID( nr ), pObject( pObj ) {}
|
||||
SfxGroupInfo_Impl( SfxGroupInfo_Data ad, sal_uInt16 nr )
|
||||
: aData( std::move(ad) )
|
||||
, nUniqueID( nr )
|
||||
{
|
||||
}
|
||||
|
||||
SfxCfgKind getKind() const { return static_cast<SfxCfgKind>(aData.index()); }
|
||||
};
|
||||
|
||||
typedef std::vector<std::unique_ptr<SfxGroupInfo_Impl> > SfxGroupInfoArr_Impl;
|
||||
@@ -202,12 +254,9 @@ class CuiConfigGroupListBox
|
||||
std::unique_ptr<weld::TreeView> m_xTreeView;
|
||||
std::unique_ptr<weld::TreeIter> m_xScratchIter;
|
||||
|
||||
static css::uno::Reference< css::uno::XInterface > getDocumentModel(
|
||||
css::uno::Reference< css::uno::XComponentContext > const & xCtx,
|
||||
std::u16string_view docName);
|
||||
|
||||
sal_Int32 InitModule();
|
||||
void FillScriptList(const css::uno::Reference< css::script::browse::XBrowseNode >& xRootNode,
|
||||
const css::uno::Reference< css::frame::XModel >& xParentDocumentModel,
|
||||
const weld::TreeIter* pParentEntry);
|
||||
void FillFunctionsList(const css::uno::Sequence< css::frame::DispatchInformation >& xCommands);
|
||||
OUString MapCommand2UIName(const OUString& sCommand);
|
||||
@@ -272,6 +321,7 @@ public:
|
||||
virtual ~SvxScriptSelectorDialog() override;
|
||||
|
||||
OUString GetScriptURL() const;
|
||||
css::uno::Reference<css::frame::XModel> GetScriptModel() const;
|
||||
void SetRunLabel();
|
||||
void SaveLastUsedMacro();
|
||||
void LoadLastUsedMacro();
|
||||
|
||||
@@ -23,12 +23,19 @@
|
||||
#include <svx/fntctrl.hxx>
|
||||
#include <svx/colorbox.hxx>
|
||||
#include <svx/langbox.hxx>
|
||||
#include <vcl/weld/Button.hxx>
|
||||
#include <vcl/weld/CheckButton.hxx>
|
||||
#include <vcl/weld/ComboBox.hxx>
|
||||
#include <vcl/weld/DialogController.hxx>
|
||||
#include <vcl/weld/EntryTreeView.hxx>
|
||||
#include <vcl/weld/Frame.hxx>
|
||||
#include <vcl/weld/Label.hxx>
|
||||
#include <vcl/weld/MetricSpinButton.hxx>
|
||||
#include <vcl/weld/Notebook.hxx>
|
||||
#include <vcl/weld/RadioButton.hxx>
|
||||
#include <vcl/weld/TreeView.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <vcl/weld/TriStateEnabled.hxx>
|
||||
|
||||
#include <memory>
|
||||
|
||||
// forward ---------------------------------------------------------------
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
#include <svx/connctrl.hxx>
|
||||
#include <sfx2/tabdlg.hxx>
|
||||
#include <vcl/weld/ComboBox.hxx>
|
||||
#include <vcl/weld/Label.hxx>
|
||||
#include <vcl/weld/MetricSpinButton.hxx>
|
||||
#include <vcl/weld/customweld.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <sfx2/basedlgs.hxx>
|
||||
|
||||
class SdrView;
|
||||
|
||||
@@ -22,9 +22,13 @@
|
||||
#include <com/sun/star/sdbc/XResultSet.hpp>
|
||||
|
||||
#include <svx/fmsearch.hxx>
|
||||
#include <vcl/weld/Button.hxx>
|
||||
#include <vcl/weld/CheckButton.hxx>
|
||||
#include <vcl/weld/ComboBox.hxx>
|
||||
#include <vcl/weld/DialogController.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <vcl/weld/Label.hxx>
|
||||
#include <vcl/weld/RadioButton.hxx>
|
||||
#include <vcl/weld/Window.hxx>
|
||||
#include <tools/link.hxx>
|
||||
#include <rtl/ustring.hxx>
|
||||
|
||||
|
||||
@@ -30,9 +30,13 @@
|
||||
#include <com/sun/star/media/XPlayer.hpp>
|
||||
#include <com/sun/star/ui/dialogs/XFolderPicker2.hpp>
|
||||
#include <svtools/dialogclosedlistener.hxx>
|
||||
#include <vcl/weld/Button.hxx>
|
||||
#include <vcl/weld/CheckButton.hxx>
|
||||
#include <vcl/weld/ComboBox.hxx>
|
||||
#include <vcl/weld/DialogController.hxx>
|
||||
#include <vcl/weld/Entry.hxx>
|
||||
#include <vcl/weld/Image.hxx>
|
||||
#include <vcl/weld/Label.hxx>
|
||||
#include <vcl/weld/TreeView.hxx>
|
||||
|
||||
#include <string_view>
|
||||
|
||||
@@ -22,10 +22,12 @@
|
||||
#include <vcl/timer.hxx>
|
||||
#include <svx/dlgctrl.hxx>
|
||||
#include <svx/rectenum.hxx>
|
||||
#include <vcl/weld/CheckButton.hxx>
|
||||
#include <vcl/weld/DialogController.hxx>
|
||||
#include <vcl/weld/DrawingArea.hxx>
|
||||
#include <vcl/weld/MetricSpinButton.hxx>
|
||||
#include <vcl/weld/SpinButton.hxx>
|
||||
#include <vcl/weld/Window.hxx>
|
||||
|
||||
class CuiGraphicPreviewWindow : public weld::CustomWidgetController
|
||||
{
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include <vcl/weld/DialogController.hxx>
|
||||
#include <vcl/weld/Entry.hxx>
|
||||
#include <vcl/weld/TextView.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <sfx2/frame.hxx>
|
||||
|
||||
class URLDlg : public weld::GenericDialogController
|
||||
|
||||
@@ -21,8 +21,10 @@
|
||||
// include ---------------------------------------------------------------
|
||||
|
||||
#include <sfx2/tabdlg.hxx>
|
||||
#include <vcl/weld/Button.hxx>
|
||||
#include <vcl/weld/CheckButton.hxx>
|
||||
#include <vcl/weld/Entry.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <vcl/weld/Label.hxx>
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -60,7 +62,7 @@ private:
|
||||
OUString msCurrentSigningKey;
|
||||
OUString msCurrentEncryptionKey;
|
||||
|
||||
DECL_LINK( ModifyHdl_Impl, weld::Entry&, void );
|
||||
DECL_LINK(ModifyHdl_Impl, weld::TextWidget&, void);
|
||||
DECL_LINK( ChooseKeyButtonHdl, weld::Button&, void );
|
||||
DECL_LINK( RemoveKeyButtonHdl, weld::Button&, void );
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include <i18nutil/transliteration.hxx>
|
||||
#include <sfx2/basedlgs.hxx>
|
||||
#include <vcl/weld/Window.hxx>
|
||||
|
||||
class SvxJSearchOptionsPage;
|
||||
|
||||
|
||||
@@ -18,20 +18,27 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <svtools/valueset.hxx>
|
||||
#include "SvxPresetListBox.hxx"
|
||||
|
||||
#include <svx/ColorIconView.hxx>
|
||||
#include <svx/dlgctrl.hxx>
|
||||
#include <svx/xflasit.hxx>
|
||||
#include <svx/tabarea.hxx>
|
||||
#include <svx/SvxColorValueSet.hxx>
|
||||
#include <svx/SvxPresetListBox.hxx>
|
||||
#include <svx/PaletteManager.hxx>
|
||||
#include <svx/svdview.hxx>
|
||||
#include <vcl/hexcolorcontrol.hxx>
|
||||
#include <vcl/weld/Button.hxx>
|
||||
#include <vcl/weld/CheckButton.hxx>
|
||||
#include <vcl/weld/ComboBox.hxx>
|
||||
#include <vcl/weld/DrawingArea.hxx>
|
||||
#include <vcl/weld/Entry.hxx>
|
||||
#include <vcl/weld/IconView.hxx>
|
||||
#include <vcl/weld/Label.hxx>
|
||||
#include <vcl/weld/MetricSpinButton.hxx>
|
||||
#include <vcl/weld/RadioButton.hxx>
|
||||
#include <vcl/weld/Scale.hxx>
|
||||
#include <vcl/weld/SpinButton.hxx>
|
||||
#include <vcl/weld/ToggleButton.hxx>
|
||||
|
||||
class ColorListBox;
|
||||
class SdrModel;
|
||||
@@ -393,20 +400,20 @@ private:
|
||||
std::unique_ptr<weld::MetricSpinButton> m_xMtrColorFrom;
|
||||
std::unique_ptr<ColorListBox> m_xLbColorTo;
|
||||
std::unique_ptr<weld::MetricSpinButton> m_xMtrColorTo;
|
||||
std::unique_ptr<weld::IconView> m_xGradientPresets;
|
||||
std::unique_ptr<SvxPresetListBox> m_xGradientLB;
|
||||
std::unique_ptr<weld::SpinButton> m_xMtrIncrement;
|
||||
std::unique_ptr<weld::CheckButton> m_xCbIncrement;
|
||||
std::unique_ptr<weld::Button> m_xBtnAdd;
|
||||
std::unique_ptr<weld::Button> m_xBtnModify;
|
||||
std::unique_ptr<weld::CustomWeld> m_xCtlPreview;
|
||||
std::unique_ptr<weld::CustomWeld> m_xGradientLBWin;
|
||||
|
||||
DECL_LINK( ClickAddHdl_Impl, weld::Button&, void );
|
||||
DECL_LINK( ClickModifyHdl_Impl, weld::Button&, void );
|
||||
DECL_LINK( ChangeGradientHdl, ValueSet*, void );
|
||||
DECL_LINK(ChangeGradientHdl, const weld::TreeIter&, bool);
|
||||
void ChangeGradientHdl_Impl();
|
||||
DECL_LINK( ClickRenameHdl_Impl, SvxPresetListBox*, void );
|
||||
DECL_LINK( ClickDeleteHdl_Impl, SvxPresetListBox*, void );
|
||||
DECL_LINK(ClickRenameHdl_Impl, int, void);
|
||||
DECL_LINK(ClickDeleteHdl_Impl, int, void);
|
||||
DECL_LINK( ModifiedEditHdl_Impl, weld::SpinButton&, void );
|
||||
DECL_LINK( ModifiedMetricHdl_Impl, weld::MetricSpinButton&, void );
|
||||
DECL_LINK( ModifiedColorListBoxHdl_Impl, ColorListBox&, void );
|
||||
@@ -467,13 +474,13 @@ private:
|
||||
std::unique_ptr<ColorListBox> m_xLbLineColor;
|
||||
std::unique_ptr<weld::CheckButton> m_xCbBackgroundColor;
|
||||
std::unique_ptr<ColorListBox> m_xLbBackgroundColor;
|
||||
std::unique_ptr<weld::IconView> m_xHatchPresets;
|
||||
std::unique_ptr<SvxPresetListBox> m_xHatchLB;
|
||||
std::unique_ptr<weld::Button> m_xBtnAdd;
|
||||
std::unique_ptr<weld::Button> m_xBtnModify;
|
||||
std::unique_ptr<weld::CustomWeld> m_xHatchLBWin;
|
||||
std::unique_ptr<weld::CustomWeld> m_xCtlPreview;
|
||||
|
||||
DECL_LINK(ChangeHatchHdl, ValueSet*, void);
|
||||
DECL_LINK(ChangeHatchHdl, const weld::TreeIter&, bool);
|
||||
void ChangeHatchHdl_Impl();
|
||||
DECL_LINK( ModifiedEditHdl_Impl, weld::MetricSpinButton&, void );
|
||||
DECL_LINK( ModifiedListBoxHdl_Impl, weld::ComboBox&, void );
|
||||
@@ -484,8 +491,8 @@ private:
|
||||
void ModifiedHdl_Impl(void const *);
|
||||
DECL_LINK( ClickAddHdl_Impl, weld::Button&, void );
|
||||
DECL_LINK( ClickModifyHdl_Impl, weld::Button&, void );
|
||||
DECL_LINK( ClickRenameHdl_Impl, SvxPresetListBox*, void );
|
||||
DECL_LINK( ClickDeleteHdl_Impl, SvxPresetListBox*, void );
|
||||
DECL_LINK(ClickRenameHdl_Impl, int, void);
|
||||
DECL_LINK(ClickDeleteHdl_Impl, int, void);
|
||||
|
||||
sal_Int32 SearchHatchList(std::u16string_view rHatchName);
|
||||
|
||||
@@ -516,26 +523,6 @@ public:
|
||||
|
||||
class SvxBitmapTabPage : public SfxTabPage
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
class SvxPresetListBoxValueSet : public SvxPresetListBox
|
||||
{
|
||||
public:
|
||||
SvxPresetListBoxValueSet(std::unique_ptr<weld::ScrolledWindow> pWindow);
|
||||
virtual bool KeyInput(const KeyEvent& rKEvt) override;
|
||||
|
||||
void SetDialog(SvxBitmapTabPage* pSvxBitmapTabPage)
|
||||
{
|
||||
m_pSvxBitmapTabPage = pSvxBitmapTabPage;
|
||||
}
|
||||
|
||||
private:
|
||||
SvxBitmapTabPage* m_pSvxBitmapTabPage;
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
const SfxItemSet& m_rOutAttrs;
|
||||
|
||||
XBitmapListRef m_pBitmapList;
|
||||
@@ -550,12 +537,13 @@ private:
|
||||
const SdrView* mpView;
|
||||
MapUnit mePoolUnit;
|
||||
FieldUnit meFieldUnit;
|
||||
Size rBitmapSize;
|
||||
Size rFilledSize;
|
||||
Size rZoomedSize;
|
||||
Size m_aBitmapSize;
|
||||
Size m_aFilledSize;
|
||||
Size m_aZoomedSize;
|
||||
|
||||
SvxXRectPreview m_aCtlBitmapPreview;
|
||||
std::unique_ptr<SvxPresetListBoxValueSet> m_xBitmapLB;
|
||||
std::unique_ptr<weld::IconView> m_xBitmapsPresets;
|
||||
std::unique_ptr<SvxPresetListBox> m_xBitmapLB;
|
||||
std::unique_ptr<weld::ComboBox> m_xBitmapStyleLB;
|
||||
std::unique_ptr<weld::Container> m_xSizeBox;
|
||||
std::unique_ptr<weld::CheckButton> m_xTsbScale;
|
||||
@@ -571,23 +559,21 @@ private:
|
||||
std::unique_ptr<weld::MetricSpinButton> m_xTileOffset;
|
||||
std::unique_ptr<weld::Button> m_xBtnImport;
|
||||
std::unique_ptr<weld::CustomWeld> m_xCtlBitmapPreview;
|
||||
std::unique_ptr<weld::CustomWeld> m_xBitmapLBWin;
|
||||
|
||||
DECL_LINK( ModifyBitmapHdl, ValueSet*, void );
|
||||
DECL_LINK(ModifyBitmapHdl, const weld::TreeIter&, bool);
|
||||
DECL_LINK( ClickScaleHdl, weld::Toggleable&, void );
|
||||
DECL_LINK( ModifyBitmapStyleHdl, weld::ComboBox&, void );
|
||||
DECL_LINK( ModifyBitmapSizeHdl, weld::MetricSpinButton&, void );
|
||||
DECL_LINK( ModifyBitmapPositionHdl, weld::ComboBox&, void );
|
||||
DECL_LINK( ModifyPositionOffsetHdl, weld::MetricSpinButton&, void );
|
||||
DECL_LINK( ModifyTileOffsetHdl, weld::MetricSpinButton&, void );
|
||||
DECL_LINK( ClickRenameHdl, SvxPresetListBox*, void );
|
||||
DECL_LINK( ClickDeleteHdl, SvxPresetListBox*, void );
|
||||
DECL_LINK(ClickRenameHdl, int, void);
|
||||
DECL_LINK(ClickDeleteHdl, int, void);
|
||||
DECL_LINK( ClickImportHdl, weld::Button&, void );
|
||||
void ClickBitmapHdl_Impl();
|
||||
void CalculateBitmapPresetSize();
|
||||
void DeleteBitmapHdl_Impl(const sal_uInt16 nId);
|
||||
sal_Int32 SearchBitmapList(std::u16string_view rBitmapName);
|
||||
sal_Int32 SearchBitmapList(const GraphicObject& rGraphicObject);
|
||||
void UpdateBitmap();
|
||||
tools::Long AddBitmap(const GraphicObject& rGraphicObject, const OUString& rName,
|
||||
bool bOnlyForThisDocument = false);
|
||||
|
||||
@@ -628,21 +614,22 @@ private:
|
||||
std::unique_ptr<SvxPixelCtl> m_xCtlPixel;
|
||||
std::unique_ptr<ColorListBox> m_xLbColor;
|
||||
std::unique_ptr<ColorListBox> m_xLbBackgroundColor;
|
||||
std::unique_ptr<weld::IconView> m_xPatternPresets;
|
||||
std::unique_ptr<SvxPresetListBox> m_xPatternLB;
|
||||
std::unique_ptr<weld::Button> m_xBtnAdd;
|
||||
std::unique_ptr<weld::Button> m_xBtnModify;
|
||||
std::unique_ptr<weld::CustomWeld> m_xCtlPixelWin;
|
||||
std::unique_ptr<weld::CustomWeld> m_xCtlPreview;
|
||||
std::unique_ptr<weld::CustomWeld> m_xPatternLBWin;
|
||||
std::unique_ptr<SvxBitmapCtl> m_xBitmapCtl;
|
||||
|
||||
DECL_LINK( ClickAddHdl_Impl, weld::Button&, void );
|
||||
DECL_LINK( ClickModifyHdl_Impl, weld::Button&, void );
|
||||
DECL_LINK( ChangePatternHdl_Impl, ValueSet*, void );
|
||||
DECL_LINK(ChangePatternHdl_Impl, const weld::TreeIter&, bool);
|
||||
DECL_LINK( ChangeColorHdl_Impl, ColorListBox&, void );
|
||||
DECL_LINK( ClickRenameHdl_Impl, SvxPresetListBox*, void );
|
||||
DECL_LINK( ClickDeleteHdl_Impl, SvxPresetListBox*, void );
|
||||
DECL_LINK(ClickRenameHdl_Impl, int, void);
|
||||
DECL_LINK(ClickDeleteHdl_Impl, int, void);
|
||||
|
||||
void UpdatePattern();
|
||||
sal_Int32 SearchPatternList(std::u16string_view rPatternName);
|
||||
|
||||
public:
|
||||
@@ -695,8 +682,8 @@ private:
|
||||
PaletteManager maPaletteManager;
|
||||
SvxXRectPreview m_aCtlPreviewOld;
|
||||
SvxXRectPreview m_aCtlPreviewNew;
|
||||
std::unique_ptr<SvxColorValueSet> m_xValSetColorList;
|
||||
std::unique_ptr<SvxColorValueSet> m_xValSetRecentList;
|
||||
ColorIconView m_aColorIconView;
|
||||
ColorIconView m_aRecentIconView;
|
||||
std::unique_ptr<weld::ComboBox> m_xSelectPalette;
|
||||
std::unique_ptr<weld::RadioButton> m_xRbRGB;
|
||||
std::unique_ptr<weld::RadioButton> m_xRbCMYK;
|
||||
@@ -726,16 +713,13 @@ private:
|
||||
std::unique_ptr<weld::Button> m_xMoreColors;
|
||||
std::unique_ptr<weld::CustomWeld> m_xCtlPreviewOld;
|
||||
std::unique_ptr<weld::CustomWeld> m_xCtlPreviewNew;
|
||||
std::unique_ptr<weld::CustomWeld> m_xValSetColorListWin;
|
||||
std::unique_ptr<weld::CustomWeld> m_xValSetRecentListWin;
|
||||
|
||||
static void ConvertColorValues (Color& rColor, ColorModel eModell);
|
||||
static void ConvertColorValues (Color& rColor, ColorModel eModel);
|
||||
static void RgbToCmyk_Impl( Color& rColor, sal_uInt16& rK );
|
||||
static void CmykToRgb_Impl( Color& rColor, const sal_uInt16 nKey );
|
||||
sal_uInt16 ColorToPercent_Impl( sal_uInt16 nColor );
|
||||
sal_uInt16 PercentToColor_Impl( sal_uInt16 nPercent );
|
||||
|
||||
void ImpColorCountChanged();
|
||||
void FillPaletteLB();
|
||||
|
||||
DECL_LINK(ClickAddHdl_Impl, weld::Button&, void);
|
||||
@@ -744,8 +728,10 @@ private:
|
||||
DECL_LINK(OnMoreColorsClick, weld::Button&, void);
|
||||
|
||||
DECL_LINK(SelectPaletteLBHdl, weld::ComboBox&, void);
|
||||
DECL_LINK( SelectValSetHdl_Impl, ValueSet*, void );
|
||||
DECL_LINK(ActivatePaletteColorHdl, const Color&, void);
|
||||
DECL_LINK(ActivateRecentColorHdl, const Color&, void);
|
||||
DECL_LINK( SelectColorModeHdl_Impl, weld::Toggleable&, void );
|
||||
void UpdateToSelectedColor(const NamedColor& rNamedColor);
|
||||
void ChangeColor(const NamedColor &rNewColor, bool bUpdatePreset = true);
|
||||
void SetColorModel(ColorModel eModel);
|
||||
void ChangeColorModel();
|
||||
@@ -754,8 +740,6 @@ private:
|
||||
DECL_LINK(MetricSpinValueHdl_Impl, weld::MetricSpinButton&, void);
|
||||
DECL_LINK(ModifiedHdl_Impl, weld::Entry&, void);
|
||||
|
||||
void UpdateModified();
|
||||
|
||||
static sal_Int32 FindInCustomColors( std::u16string_view aColorName );
|
||||
sal_Int32 FindInPalette( const Color& rColor );
|
||||
|
||||
|
||||
@@ -29,9 +29,12 @@
|
||||
#include <svx/xtable.hxx>
|
||||
#include <svx/dlgctrl.hxx>
|
||||
#include <tools/fldunit.hxx>
|
||||
#include <vcl/weld/Button.hxx>
|
||||
#include <vcl/weld/CheckButton.hxx>
|
||||
#include <vcl/weld/Entry.hxx>
|
||||
#include <vcl/weld/Menu.hxx>
|
||||
#include <vcl/weld/MenuButton.hxx>
|
||||
#include <vcl/weld/MetricSpinButton.hxx>
|
||||
#include <vcl/weld/SpinButton.hxx>
|
||||
#include <vcl/weld/customweld.hxx>
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include <vcl/weld/DialogController.hxx>
|
||||
#include <vcl/weld/SpinButton.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <vcl/weld/Window.hxx>
|
||||
|
||||
class FmInputRecordNoDialog : public weld::GenericDialogController
|
||||
{
|
||||
|
||||
@@ -22,7 +22,9 @@
|
||||
#include <rtl/ustring.hxx>
|
||||
#include <sfx2/basedlgs.hxx>
|
||||
#include <sfx2/tabdlg.hxx>
|
||||
#include <vcl/weld/Button.hxx>
|
||||
#include <vcl/weld/TreeIter.hxx>
|
||||
#include <vcl/weld/TreeView.hxx>
|
||||
|
||||
namespace svx
|
||||
{
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
||||
// const -----------------------------------------------------------------
|
||||
|
||||
const short RET_BTN_1 = 100;
|
||||
const short RET_BTN_2 = 101;
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
@@ -20,8 +20,11 @@
|
||||
|
||||
#include <sal/config.h>
|
||||
|
||||
#include <vcl/weld/Button.hxx>
|
||||
#include <vcl/weld/CheckButton.hxx>
|
||||
#include <vcl/weld/DialogController.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <vcl/weld/Label.hxx>
|
||||
#include <vcl/weld/Window.hxx>
|
||||
|
||||
class FileExtCheckDialog : public weld::GenericDialogController
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user