10#include <config_feature_desktop.h>
11#include <config_options.h>
12#include <config_vclplug.h>
16#include <unordered_map>
17#include <com/sun/star/accessibility/AccessibleRole.hpp>
23#include <officecfg/Office/Common.hxx>
24#include <osl/module.hxx>
65#include <bitmaps.hlst>
77#include <calendar.hxx>
88#if defined(DISABLE_DYNLOADING) || defined(LINUX)
92static bool toBool(std::string_view rValue)
94 return (!rValue.empty() && (rValue[0] ==
't' || rValue[0] ==
'T' || rValue[0] ==
'1'));
99 OUString mapStockToImageResource(std::u16string_view sType)
101 if (sType == u
"view-refresh")
102 return SV_RESID_BITMAP_REFRESH;
103 else if (sType == u
"dialog-error")
105 else if (sType == u
"list-add")
107 else if (sType == u
"list-remove")
109 else if (sType == u
"edit-copy")
111 else if (sType == u
"edit-paste")
113 else if (sType == u
"document-open")
115 else if (sType == u
"open-menu-symbolic")
117 else if (sType == u
"window-close-symbolic")
118 return SV_RESID_BITMAP_CLOSEDOC;
119 else if (sType == u
"x-office-calendar")
129 if (
sType ==
u"media-skip-forward")
131 else if (
sType ==
u"media-skip-backward")
133 else if (
sType ==
u"media-playback-start")
135 else if (
sType ==
u"media-playback-stop")
137 else if (
sType ==
u"go-first")
139 else if (
sType ==
u"go-last")
141 else if (
sType ==
u"go-previous")
143 else if (
sType ==
u"go-next")
145 else if (
sType ==
u"go-up")
147 else if (
sType ==
u"go-down")
149 else if (
sType ==
u"missing-image")
151 else if (
sType ==
u"help-browser" ||
sType ==
u"help-browser-symbolic")
153 else if (
sType ==
u"window-close")
155 else if (
sType ==
u"document-new")
157 else if (
sType ==
u"pan-down-symbolic")
159 else if (
sType ==
u"pan-up-symbolic")
161 else if (!mapStockToImageResource(
sType).isEmpty())
170#if defined SAL_LOG_WARN
208 else if (rUIFile ==
u"modules/scalc/ui/inputbar.ui")
235 auto it = std::find_if(
236 rList.begin(), rList.end(),
237 [&rUnit](
const std::pair<OUString, FieldUnit>& rItem) { return rItem.second == rUnit; });
238 if (it != rList.end())
246 signal_value_changed();
251 OUString sNewText(format_number(rSpinButton.get_value()));
252 if (sNewText != rSpinButton.get_text())
253 rSpinButton.set_text(sNewText);
262 int chars = ceil(width /
m_xSpinButton->get_approximate_digit_width());
269 for (
unsigned int i = 0;
i <
n; ++
i)
278 if ((
nValue < (std::numeric_limits<sal_Int64>::min() + nFactor)) ||
279 (
nValue > (std::numeric_limits<sal_Int64>::max() - nFactor)))
284 const int nHalf = nFactor / 2;
287 return (
nValue - nHalf) / nFactor;
288 return (
nValue + nHalf) / nFactor;
313 OUString sDoublePrime =
u"\u2033";
314 if (aSuffix !=
"\"" && aSuffix != sDoublePrime)
317 aSuffix = sDoublePrime;
321 OUString sPrime =
u"\u2032";
322 if (aSuffix !=
"'" && aSuffix != sPrime)
370 bool bRet =
vcl::TextToValue(get_text(), fResult, 0, m_xSpinButton->get_digits(), rLocaleData, m_eSrcUnit);
383 : m_xEntry(
std::move(xEntry))
384 , m_xTreeView(
std::move(xTreeView))
392 m_xEntry->set_text(rView.get_selected_text());
393 m_aChangeHdl.Call(*
this);
398 m_aChangeHdl.Call(*
this);
403 int nHeight = nRows == -1 ? -1 :
m_xTreeView->get_height_rows(nRows);
411 std::unique_ptr<weld::TreeIter> xEntry(rTreeView.
make_iterator(&rIter));
415 while (xEntry && rTreeView.
iter_compare(*xEntry, rIter) != 0)
431 std::unique_ptr<weld::TreeIter> xEntry(rTreeView.
make_iterator(&rIter));
432 bool bRetVal =
false;
446 OString sID, css::uno::Reference<css::frame::XFrame> xFrame,
448 : m_pNotebookBarAddonsItem(pNotebookBarAddonsItem
451 , m_sID(
std::move(sID))
455 , m_bToplevelParentFound(false)
470 OUString sUri = sUIDir + sUIFile;
478 catch (
const css::uno::Exception &rExcept)
486 for (
auto const& mnemonicWidget :
m_pParserState->m_aMnemonicWidgetMaps)
488 FixedText *pOne = get<FixedText>(mnemonicWidget.m_sID);
490 SAL_WARN_IF(!pOne || !pOther,
"vcl",
"missing either source " << mnemonicWidget.m_sID
491 <<
" or target " << mnemonicWidget.m_sValue <<
" member of Mnemonic Widget Mapping");
502 for (
auto const& elemMap : rMap)
504 const OString &rType = elemMap.first;
505 const OUString &rParam = elemMap.second;
509 if (role != com::sun::star::accessibility::AccessibleRole::UNKNOWN)
515 SAL_WARN_IF(!pTarget,
"vcl",
"missing parameter of a11y relation: " << rParam);
518 if (rType ==
"labelled-by")
520 else if (rType ==
"label-for")
524 SAL_WARN(
"vcl.builder",
"unhandled a11y relation :" << rType);
534 RadioButton *pOther = get<RadioButton>(elem.m_sValue);
535 SAL_WARN_IF(!pOne || !pOther,
"vcl",
"missing member of radiobutton group");
539 pOne->
group(*pOther);
542 pOther->
group(*pOne);
554 assert(models.
insert(elem.m_sValue).second &&
"a liststore or treestore is used in duplicate widgets");
561 SAL_WARN_IF(!pListBoxTarget && !pComboBoxTarget && !pTreeBoxTarget && !
dynamic_cast<IconView*
>(pTarget),
"vcl",
"missing elements of combobox");
562 if (pListBoxTarget && pStore)
563 mungeModel(*pListBoxTarget, *pStore, elem.m_nActiveId);
564 else if (pComboBoxTarget && pStore)
565 mungeModel(*pComboBoxTarget, *pStore, elem.m_nActiveId);
566 else if (pTreeBoxTarget && pStore)
567 mungeModel(*pTreeBoxTarget, *pStore, elem.m_nActiveId);
575 SAL_WARN_IF(!pTarget || !pBuffer,
"vcl",
"missing elements of textview/textbuffer");
576 if (pTarget && pBuffer)
581 for (
auto const& elem :
m_pParserState->m_aNumericFormatterAdjustmentMaps)
583 NumericFormatter *pTarget =
dynamic_cast<NumericFormatter*
>(
get(elem.m_sID));
585 SAL_WARN_IF(!pTarget,
"vcl",
"missing NumericFormatter element of spinbutton/adjustment");
586 SAL_WARN_IF(!pAdjustment,
"vcl",
"missing Adjustment element of spinbutton/adjustment");
587 if (pTarget && pAdjustment)
591 for (
auto const& elem :
m_pParserState->m_aFormattedFormatterAdjustmentMaps)
595 SAL_WARN_IF(!pTarget,
"vcl",
"missing FormattedField element of spinbutton/adjustment");
596 SAL_WARN_IF(!pAdjustment,
"vcl",
"missing Adjustment element of spinbutton/adjustment");
597 if (pTarget && pAdjustment)
604 ScrollBar *pTarget = get<ScrollBar>(elem.m_sID);
606 SAL_WARN_IF(!pTarget || !pAdjustment,
"vcl",
"missing elements of scrollbar/adjustment");
607 if (pTarget && pAdjustment)
616 SAL_WARN_IF(!pTarget || !pAdjustment,
"vcl",
"missing elements of scale(slider)/adjustment");
617 if (pTarget && pAdjustment)
626 std::shared_ptr<VclSizeGroup> xGroup(std::make_shared<VclSizeGroup>());
628 for (
auto const& elem : sizeGroup.m_aProperties)
630 const OString &rKey = elem.first;
631 const OUString &rValue = elem.second;
632 xGroup->set_property(rKey, rValue);
635 for (
auto const& elem : sizeGroup.m_aWidgets)
643 std::set<OUString> aImagesToBeRemoved;
648 Button *pTarget =
nullptr;
652 pTargetButton = get<PushButton>(elem.m_sID);
653 pTarget = pTargetButton;
657 pTargetRadio = get<RadioButton>(elem.m_sID);
658 pTarget = pTargetRadio;
661 FixedImage *pImage = get<FixedImage>(elem.m_sValue.toUtf8());
663 "vcl",
"missing elements of button/image/stock");
664 if (!pTarget || !pImage)
666 aImagesToBeRemoved.insert(elem.m_sValue);
699 auto aFind =
m_pParserState->m_aImageSizeMap.find(elem.m_sValue.toUtf8());
702 switch (aFind->second)
720 SAL_WARN(
"vcl.builder",
"unsupported image size " << aFind->second);
729 for (
auto const& elem : aImagesToBeRemoved)
737 MenuButton *pTarget = get<MenuButton>(elem.m_sID);
740 "vcl",
"missing elements of button/menu");
741 if (!pTarget || !pMenu)
748 for (
auto const& elem :
m_pParserState->m_aRedundantParentWidgets)
761 elem->set_label(pLabelWidget->
GetText());
770 elem->create_message_area();
776 "Requested top level widget \"" <<
m_sID <<
"\" not found in " << sUIFile);
778#if defined SAL_LOG_WARN
782 bool bHasDefButton =
false;
785 if (isButtonType(child.m_pWindow->GetType()))
790 bHasDefButton =
true;
795 SAL_WARN_IF(nButtons && !bHasDefButton,
"vcl.builder",
"No default button defined in " << sUIFile);
800 officecfg::Office::Common::Help::HelpRootURL::get().isEmpty();
815 for (std::vector<WinAndId>::reverse_iterator aI =
m_aChildren.rbegin(),
818 aI->m_pWindow.disposeAndClear();
822 for (std::vector<MenuAndId>::reverse_iterator aI =
m_aMenus.rbegin(),
823 aEnd =
m_aMenus.rend(); aI != aEnd; ++aI)
825 aI->m_pMenu.disposeAndClear();
835 bool bHasFrame =
true;
836 VclBuilder::stringmap::iterator aFind = rMap.find(
"has-frame");
837 if (aFind != rMap.end())
839 bHasFrame =
toBool(aFind->second);
847 bool bDrawValue =
true;
848 VclBuilder::stringmap::iterator aFind = rMap.find(
"draw-value");
849 if (aFind != rMap.end())
851 bDrawValue =
toBool(aFind->second);
860 VclBuilder::stringmap::iterator aFind = rMap.find(
"popup");
861 if (aFind != rMap.end())
863 sRet = aFind->second;
872 VclBuilder::stringmap::iterator aFind = rMap.find(
"name");
873 if (aFind != rMap.end())
875 sRet = aFind->second;
883 OUString sRet(
"top");
884 VclBuilder::stringmap::iterator aFind = rMap.find(
"value-pos");
885 if (aFind != rMap.end())
887 sRet = aFind->second;
895 OUString sRet(
"normal");
896 VclBuilder::stringmap::iterator aFind = rMap.find(
"type-hint");
897 if (aFind != rMap.end())
899 sRet = aFind->second;
907 bool bResizable =
true;
908 VclBuilder::stringmap::iterator aFind = rMap.find(
"resizable");
909 if (aFind != rMap.end())
911 bResizable =
toBool(aFind->second);
917#if HAVE_FEATURE_DESKTOP
921 VclBuilder::stringmap::iterator aFind = rMap.find(
"modal");
922 if (aFind != rMap.end())
924 bModal =
toBool(aFind->second);
933 bool bDecorated =
true;
934 VclBuilder::stringmap::iterator aFind = rMap.find(
"decorated");
935 if (aFind != rMap.end())
937 bDecorated =
toBool(aFind->second);
945 bool bCloseable =
true;
946 VclBuilder::stringmap::iterator aFind = rMap.find(
"deletable");
947 if (aFind != rMap.end())
949 bCloseable =
toBool(aFind->second);
957 bool bHasEntry =
false;
958 VclBuilder::stringmap::iterator aFind = rMap.find(
"has-entry");
959 if (aFind != rMap.end())
961 bHasEntry =
toBool(aFind->second);
969 bool bVertical =
false;
970 VclBuilder::stringmap::iterator aFind = rMap.find(
"orientation");
971 if (aFind != rMap.end())
973 bVertical = aFind->second.equalsIgnoreAsciiCase(
"vertical");
981 bool bVertical =
false;
982 VclBuilder::stringmap::iterator aFind = rMap.find(
"tab-pos");
983 if (aFind != rMap.end())
985 bVertical = aFind->second.equalsIgnoreAsciiCase(
"left") ||
986 aFind->second.equalsIgnoreAsciiCase(
"right");
994 bool bInconsistent =
false;
995 VclBuilder::stringmap::iterator aFind = rMap.find(
"inconsistent");
996 if (aFind != rMap.end())
998 bInconsistent =
toBool(aFind->second);
1001 return bInconsistent;
1009 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"pixbuf"));
1010 if (aFind != rMap.end())
1012 sIconName = aFind->second;
1017 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"icon-name"));
1018 if (aFind != rMap.end())
1020 sIconName = aFind->second;
1024 if (sIconName ==
"missing-image")
1026 OUString sReplace = mapStockToImageResource(sIconName);
1027 return !sReplace.isEmpty() ? sReplace : sIconName;
1033 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"relief"));
1034 if (aFind != rMap.end())
1036 assert(aFind->second !=
"half" &&
"relief of 'half' unsupported");
1037 if (aFind->second ==
"none")
1047 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"label"));
1048 if (aFind != rMap.end())
1050 sType = aFind->second;
1058 OUString sActionName;
1059 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"action-name"));
1060 if (aFind != rMap.end())
1062 sActionName = aFind->second;
1071 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"visible"));
1072 if (aFind != rMap.end())
1074 bRet =
toBool(aFind->second);
1082 OUString sWidthRequest(
"0");
1083 OUString sHeightRequest(
"0");
1084 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"width-request"));
1085 if (aFind != rMap.end())
1087 sWidthRequest = aFind->second;
1090 aFind = rMap.find(
"height-request");
1091 if (aFind != rMap.end())
1093 sHeightRequest = aFind->second;
1096 return Size(sWidthRequest.toInt32(), sHeightRequest.toInt32());
1101 OUString sTooltipText;
1102 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"tooltip-text"));
1103 if (aFind == rMap.end())
1104 aFind = rMap.find(OString(
"tooltip-markup"));
1105 if (aFind != rMap.end())
1107 sTooltipText = aFind->second;
1110 return sTooltipText;
1116 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"alignment"));
1117 if (aFind != rMap.end())
1119 f = aFind->second.toFloat();
1128 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"title"));
1129 if (aFind != rMap.end())
1131 sTitle = aFind->second;
1139 bool bHeadersVisible =
true;
1140 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"headers-visible"));
1141 if (aFind != rMap.end())
1143 bHeadersVisible =
toBool(aFind->second);
1146 return bHeadersVisible;
1151 bool bSortIndicator =
false;
1152 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"sort-indicator"));
1153 if (aFind != rMap.end())
1155 bSortIndicator =
toBool(aFind->second);
1158 return bSortIndicator;
1163 bool bClickable =
false;
1164 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"clickable"));
1165 if (aFind != rMap.end())
1167 bClickable =
toBool(aFind->second);
1178 OUString
aCommand(extractActionName(rMap));
1189 if (!aTooltip.isEmpty())
1204 nBits |= extractRelief(rMap);
1214 nBits |= extractRelief(rMap);
1224 nBits |= extractRelief(rMap);
1233 if (extractResizable(rMap))
1235 if (extractCloseable(rMap))
1237 if (!extractDecorated(rMap))
1239 OUString
sType(extractTypeHint(rMap));
1240 if (sType ==
"utility")
1242 else if (sType ==
"popup-menu")
1244 else if (sType ==
"dock")
1254 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"group"));
1255 if (aFind != rMap.end())
1257 OUString sID = aFind->second;
1258 sal_Int32 nDelim = sID.indexOf(
':');
1260 sID = sID.copy(0, nDelim);
1268 if (!rAdjustment.isEmpty())
1269 m_pParserState->m_aNumericFormatterAdjustmentMaps.emplace_back(
id, rAdjustment);
1274 if (!rAdjustment.isEmpty())
1275 m_pParserState->m_aFormattedFormatterAdjustmentMaps.emplace_back(
id, rAdjustment);
1280 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"adjustment"));
1281 if (aFind != rMap.end())
1283 rAdjustmentMap.emplace_back(
id, aFind->second);
1294 sal_Int32 nActiveId = 0;
1295 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"active"));
1296 if (aFind != rMap.end())
1298 nActiveId = aFind->second.toInt32();
1306 bool bSelectable =
false;
1307 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"selectable"));
1308 if (aFind != rMap.end())
1310 bSelectable =
toBool(aFind->second);
1318 OUString sAdjustment;
1319 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"adjustment"));
1320 if (aFind != rMap.end())
1322 sAdjustment= aFind->second;
1331 bool bDrawIndicator =
false;
1332 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"draw-indicator"));
1333 if (aFind != rMap.end())
1335 bDrawIndicator =
toBool(aFind->second);
1338 return bDrawIndicator;
1344 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"model"));
1345 if (aFind != rMap.end())
1348 extractActive(rMap));
1355 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"buffer"));
1356 if (aFind != rMap.end())
1358 m_pParserState->m_aTextBufferMaps.emplace_back(
id, aFind->second);
1366 auto aFind = rMap.find(OString(
"icon-size"));
1367 if (aFind != rMap.end())
1368 nSize = aFind->second.toInt32();
1374 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"image"));
1375 if (aFind != rMap.end())
1377 m_pParserState->m_aButtonImageWidgetMaps.emplace_back(
id, aFind->second, bRadio);
1384 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"mnemonic-widget"));
1385 if (aFind != rMap.end())
1387 OUString sID = aFind->second;
1388 sal_Int32 nDelim = sID.indexOf(
':');
1390 sID = sID.copy(0, nDelim);
1391 m_pParserState->m_aMnemonicWidgetMaps.emplace_back(rLabelID, sID);
1405 rWinStyle |= nScrollBits;
1418 rMap[OString(
"width-request")] = OUString::number(nWidthReq);
1420 rMap[OString(
"height-request")] = OUString::number(nHeightReq);
1422 m_pParserState->m_aRedundantParentWidgets[pScrollParent] = pWindow;
1425#ifndef DISABLE_DYNLOADING
1432class NoAutoUnloadModule :
public osl::Module
1435 ~NoAutoUnloadModule() { release(); }
1440typedef std::map<OUString, std::shared_ptr<NoAutoUnloadModule>>
ModuleMap;
1444static std::shared_ptr<NoAutoUnloadModule> g_pMergedLib = std::make_shared<NoAutoUnloadModule>();
1447#ifndef SAL_DLLPREFIX
1448# define SAL_DLLPREFIX ""
1457#ifndef DISABLE_DYNLOADING
1464 static const char *aWidgetLibs[] = {
1467 for (
const auto & lib : aWidgetLibs)
1469 std::unique_ptr<NoAutoUnloadModule> pModule(
new NoAutoUnloadModule);
1471 if (pModule->loadRelative(&
thisModule, sModule))
1472 g_aModuleMap.insert(std::make_pair(sModule, std::move(pModule)));
1480#if defined DISABLE_DYNLOADING && !HAVE_FEATURE_DESKTOP
1487#elif defined EMSCRIPTEN && !ENABLE_QT5
1505 {
"makeNotebookbarTabControl", makeNotebookbarTabControl },
1511 for (
size_t i = 0;
i <
sizeof(custom_widgets) /
sizeof(custom_widgets[0]);
i++)
1512 if (strcmp(name, custom_widgets[i].name) == 0)
1513 return custom_widgets[i].func;
1524 const OString
name = rName ==
"sfxlo-SidebarToolBox" ?
"sfxlo-NotebookbarToolBox" : rName;
1526 if (sal_Int32 nDelim =
name.indexOf(
'-'); nDelim != -1)
1528 const OString aFunction(OString::Concat(
"make") +
name.subView(nDelim + 1));
1529 const OUString sFunction(OStringToOUString(aFunction, RTL_TEXTENCODING_UTF8));
1531#ifndef DISABLE_DYNLOADING
1533 + OStringToOUString(
name.subView(0, nDelim), RTL_TEXTENCODING_UTF8)
1538 std::shared_ptr<NoAutoUnloadModule> pModule;
1540 if (!g_pMergedLib->is())
1543 g_pMergedLib->getFunctionSymbol(sFunction))))
1544 pModule = g_pMergedLib;
1548 pModule = std::make_shared<NoAutoUnloadModule>();
1549 bool ok = pModule->loadRelative(&
thisModule, sModule);
1560 assert(ok &&
"couldn't even directly dlsym the sFunction (available via preload)");
1563 assert(ok &&
"bad module name in .ui");
1568 pModule->getFunctionSymbol(sFunction));
1575 aI->second->getFunctionSymbol(sFunction));
1576#elif !HAVE_FEATURE_DESKTOP || (defined EMSCRIPTEN && !ENABLE_QT5)
1579 pFunction = lo_get_custom_widget_func(sFunction.toUtf8().getStr());
1580 SAL_WARN_IF(!pFunction,
"vcl.builder",
"Could not find " << sFunction);
1584 osl_getFunctionSymbol((oslModule)RTLD_DEFAULT, sFunction.pData));
1594 bool bIsPlaceHolder =
name.isEmpty();
1595 bool bVertical =
false;
1600 bool bTopLevel(
name ==
"GtkDialog" ||
name ==
"GtkMessageDialog" ||
1601 name ==
"GtkWindow" ||
name ==
"GtkPopover" ||
name ==
"GtkAssistant");
1609 sal_uInt16 nNewPageCount = pTabControl->
GetPageCount()+1;
1610 sal_uInt16 nNewPageId = nNewPageCount;
1611 pTabControl->
InsertPage(nNewPageId, OUString());
1613 SAL_WARN_IF(bIsPlaceHolder,
"vcl.builder",
"we should have no placeholders for tabpages");
1614 if (!bIsPlaceHolder)
1622 OString::number(nNewPageCount);
1623 m_aChildren.emplace_back(sTabPageId, pPage,
false);
1634 SAL_WARN_IF(bIsPlaceHolder,
"vcl.builder",
"we should have no placeholders for tabpages");
1635 if (!bIsPlaceHolder)
1641 if (bIsPlaceHolder ||
name ==
"GtkTreeSelection")
1649 if (
name ==
"GtkDialog" ||
name ==
"GtkAssistant")
1655 if (extractResizable(rMap))
1657 if (extractCloseable(rMap))
1660 if (
name ==
"GtkAssistant")
1664#if HAVE_FEATURE_DESKTOP
1665 if (!extractModal(rMap))
1669 else if (
name ==
"GtkMessageDialog")
1672 if (extractResizable(rMap))
1683 else if (
name ==
"GtkBox" ||
name ==
"GtkStatusbar")
1685 bVertical = extractOrientation(rMap);
1691 else if (
name ==
"GtkPaned")
1693 bVertical = extractOrientation(rMap);
1699 else if (
name ==
"GtkHBox")
1701 else if (
name ==
"GtkVBox")
1703 else if (
name ==
"GtkButtonBox")
1705 bVertical = extractOrientation(rMap);
1711 else if (
name ==
"GtkHButtonBox")
1713 else if (
name ==
"GtkVButtonBox")
1715 else if (
name ==
"GtkGrid")
1717 else if (
name ==
"GtkFrame")
1719 else if (
name ==
"GtkExpander")
1723 xWindow = pExpander;
1729 if (sMenu.isEmpty())
1730 xButton = extractStockAndBuildPushButton(pParent, rMap,
name ==
"GtkToggleButton");
1733 assert(
m_bLegacy &&
"use GtkMenuButton");
1734 xButton = extractStockAndBuildMenuButton(pParent, rMap);
1738 setupFromActionName(xButton, rMap,
m_xFrame);
1741 else if (
name ==
"GtkMenuButton")
1745 OUString sMenu = extractPopupMenu(rMap);
1746 if (!sMenu.isEmpty())
1749 OUString
sType = extractWidgetName(rMap);
1750 if (
sType.isEmpty())
1752 xButton = extractStockAndBuildMenuButton(pParent, rMap);
1757 xButton = extractStockAndBuildMenuToggleButton(pParent, rMap);
1762 if (!extractDrawIndicator(rMap))
1765 setupFromActionName(xButton, rMap,
m_xFrame);
1772 assert(sMenu.getLength() &&
"not implemented yet");
1773 xButton = extractStockAndBuildMenuToggleButton(pParent, rMap);
1776 setupFromActionName(xButton, rMap,
m_xFrame);
1779 else if (
name ==
"GtkRadioButton")
1787 else if (
name ==
"GtkCheckButton")
1790 bool bIsTriState = extractInconsistent(rMap);
1799 xWindow = xCheckBox;
1801 else if (
name ==
"GtkSpinButton")
1803 OUString sAdjustment = extractAdjustment(rMap);
1806 if (extractHasFrame(rMap))
1811 xField->GetFormatter().SetMinValue(0);
1814 else if (
name ==
"GtkLinkButton")
1816 else if (
name ==
"GtkComboBox" ||
name ==
"GtkComboBoxText")
1827 if (extractEntry(rMap))
1830 xComboBox->EnableAutoSize(
true);
1831 xWindow = xComboBox;
1836 xListBox->EnableAutoSize(
true);
1840 else if (
name ==
"VclOptionalBox" ||
name ==
"sfxlo-OptionalBox")
1845 else if (
name ==
"svtlo-ManagedMenuButton")
1851 if (!sMenu.isEmpty())
1855 else if (
name ==
"sfxlo-PriorityMergedHBox")
1860 else if (
name ==
"sfxlo-PriorityHBox")
1865 else if (
name ==
"sfxlo-DropdownBox")
1870 else if (
name ==
"sfxlo-ContextVBox")
1875 else if (
name ==
"GtkIconView")
1877 assert(rMap.find(OString(
"model")) != rMap.end() &&
"GtkIconView must have a model");
1887 xWindowForPackingProps = xBox;
1893 if (pRealParent != pParent)
1896 else if (
name ==
"GtkTreeView")
1900 assert(rMap.find(OString(
"model")) != rMap.end() &&
"GtkTreeView must have a model");
1926 xWindowForPackingProps = xWindow;
1931 bool bHeadersVisible = extractHeadersVisible(rMap);
1932 if (bHeadersVisible)
1935 OString containerid(
id +
"-container");
1937 m_aChildren.emplace_back(containerid, xContainer,
true);
1940 xHeader->set_width_request(0);
1941 OString headerid(
id +
"-header");
1943 m_aChildren.emplace_back(headerid, xHeader,
true);
1946 xHeaderBox->InitHeaderBar(xHeader);
1951 xWindowForPackingProps = xContainer;
1956 xWindowForPackingProps = xBox;
1965 if (pRealParent != pParent)
1968 else if (
name ==
"GtkTreeViewColumn")
1976 if (extractClickable(rMap))
1978 if (extractSortIndicator(rMap))
1980 float fAlign = extractAlignment(rMap);
1983 else if (fAlign == 1.0)
1985 else if (fAlign == 0.5)
1987 auto nItemId = pHeaderBar->GetItemCount() + 1;
1988 OUString sTitle(extractTitle(rMap));
1989 pHeaderBar->InsertItem(nItemId, sTitle, 100, nBits);
1993 else if (
name ==
"GtkLabel")
1997 if (extractSelectable(rMap))
2002 else if (
name ==
"GtkImage")
2005 OUString sIconName = extractIconName(rMap);
2006 if (!sIconName.isEmpty())
2009 xWindow = xFixedImage;
2015 rMap[
"visible"] =
"false";
2018 else if (
name ==
"GtkSeparator")
2020 bVertical = extractOrientation(rMap);
2023 else if (
name ==
"GtkScrollbar")
2026 bVertical = extractOrientation(rMap);
2029 else if (
name ==
"GtkProgressBar")
2032 bVertical = extractOrientation(rMap);
2035 else if (
name ==
"GtkScrolledWindow")
2039 else if (
name ==
"GtkViewport")
2043 else if (
name ==
"GtkEventBox")
2047 else if (
name ==
"GtkEntry")
2050 if (extractHasFrame(rMap))
2055 else if (
name ==
"GtkNotebook")
2057 if (!extractVerticalTabPos(rMap))
2062 else if (
name ==
"GtkDrawingArea")
2066 else if (
name ==
"GtkTextView")
2074 if (pRealParent != pParent)
2077 else if (
name ==
"GtkSpinner")
2081 else if (
name ==
"GtkScale")
2084 bool bDrawValue = extractDrawValue(rMap);
2087 OUString sValuePos = extractValuePos(rMap);
2090 bVertical = extractOrientation(rMap);
2096 else if (
name ==
"GtkToolbar")
2100 else if(
name ==
"NotebookBarAddonsToolMergePoint")
2102 customMakeWidget pFunction = GetCustomMakeWidget(
"sfxlo-NotebookbarToolBox");
2103 if(pFunction !=
nullptr)
2107 else if (
name ==
"GtkToolButton" ||
name ==
"GtkMenuToolButton" ||
2108 name ==
"GtkToggleToolButton" ||
name ==
"GtkRadioToolButton" ||
name ==
"GtkToolItem")
2112 OUString
aCommand(extractActionName(rMap));
2116 if (
name ==
"GtkMenuToolButton")
2118 else if (
name ==
"GtkToggleToolButton")
2120 else if (
name ==
"GtkRadioToolButton")
2138 OUString sTooltip(extractTooltipText(rMap));
2139 if (!sTooltip.isEmpty())
2142 OUString sIconName(extractIconName(rMap));
2143 if (!sIconName.isEmpty())
2146 if (!extractVisible(rMap))
2154 else if (
name ==
"GtkSeparatorToolItem")
2162 else if (
name ==
"GtkWindow")
2164 WinBits nBits = extractDeferredBits(rMap);
2170 else if (
name ==
"GtkPopover")
2172 WinBits nBits = extractDeferredBits(rMap);
2175 else if (
name ==
"GtkCalendar")
2177 WinBits nBits = extractDeferredBits(rMap);
2184 pFunction(xWindow, pParent, rMap);
2190 if (!sMenu.isEmpty())
2197 SAL_INFO_IF(!xWindow,
"vcl.builder",
"probably need to implement " <<
name <<
" or add a make" <<
name <<
" function");
2205 SAL_INFO(
"vcl.builder",
"for name '" <<
name <<
"' and id '" <<
id <<
2206 "', created " << xWindow.
get() <<
" child of " <<
2230 bool isConsideredGtkPseudo(
vcl::Window const *pWindow)
2252 for (
auto const& prop : rProps)
2254 const OString &rKey = prop.first;
2255 const OUString &rValue = prop.second;
2262 OUStringBuffer aRet(rIn);
2263 for (sal_Int32 nI = 0; nI < aRet.getLength(); ++nI)
2265 if (aRet[nI] ==
'_' && nI+1 < aRet.getLength())
2267 if (aRet[nI+1] !=
'_')
2274 return aRet.makeStringAndClear();
2279 OUString sCustomProperty;
2280 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"customproperty"));
2281 if (aFind != rMap.end())
2283 sCustomProperty = aFind->second;
2286 return sCustomProperty;
2291 OString sWidthChars(
"width-chars");
2292 VclBuilder::stringmap::iterator aFind = rMap.find(sWidthChars);
2293 if (aFind == rMap.end())
2294 rMap[sWidthChars] =
"20";
2299 bool bDropdown =
true;
2300 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"dropdown"));
2301 if (aFind != rMap.end())
2303 bDropdown =
toBool(aFind->second);
2324 for (
size_t i = 0;
i < rChilds.size(); ++
i)
2333 WinBits nBits = rChilds[
i]->GetStyle();
2337 rChilds[
i]->SetStyle(nBits);
2345 static const std::unordered_map<OString, sal_Int16> aAtkRoleToAccessibleRole = {
2347 {
"invalid", AccessibleRole::UNKNOWN },
2348 {
"accelerator label", AccessibleRole::UNKNOWN },
2349 {
"alert", AccessibleRole::ALERT },
2350 {
"animation", AccessibleRole::UNKNOWN },
2351 {
"arrow", AccessibleRole::UNKNOWN },
2352 {
"calendar", AccessibleRole::UNKNOWN },
2353 {
"canvas", AccessibleRole::CANVAS },
2354 {
"check box", AccessibleRole::CHECK_BOX },
2355 {
"check menu item", AccessibleRole::CHECK_MENU_ITEM },
2356 {
"color chooser", AccessibleRole::COLOR_CHOOSER },
2357 {
"column header", AccessibleRole::COLUMN_HEADER },
2358 {
"combo box", AccessibleRole::COMBO_BOX },
2359 {
"date editor", AccessibleRole::DATE_EDITOR },
2360 {
"desktop icon", AccessibleRole::DESKTOP_ICON },
2361 {
"desktop frame", AccessibleRole::DESKTOP_PANE },
2362 {
"dial", AccessibleRole::UNKNOWN },
2363 {
"dialog", AccessibleRole::DIALOG },
2364 {
"directory pane", AccessibleRole::DIRECTORY_PANE },
2365 {
"drawing area", AccessibleRole::UNKNOWN },
2366 {
"file chooser", AccessibleRole::FILE_CHOOSER },
2367 {
"filler", AccessibleRole::FILLER },
2368 {
"font chooser", AccessibleRole::FONT_CHOOSER },
2369 {
"frame", AccessibleRole::FRAME },
2370 {
"glass pane", AccessibleRole::GLASS_PANE },
2371 {
"html container", AccessibleRole::UNKNOWN },
2372 {
"icon", AccessibleRole::ICON },
2373 {
"image", AccessibleRole::GRAPHIC },
2374 {
"internal frame", AccessibleRole::INTERNAL_FRAME },
2375 {
"label", AccessibleRole::LABEL },
2376 {
"layered pane", AccessibleRole::LAYERED_PANE },
2377 {
"list", AccessibleRole::LIST },
2378 {
"list item", AccessibleRole::LIST_ITEM },
2379 {
"menu", AccessibleRole::MENU },
2380 {
"menu bar", AccessibleRole::MENU_BAR },
2381 {
"menu item", AccessibleRole::MENU_ITEM },
2382 {
"option pane", AccessibleRole::OPTION_PANE },
2383 {
"page tab", AccessibleRole::PAGE_TAB },
2384 {
"page tab list", AccessibleRole::PAGE_TAB_LIST },
2385 {
"panel", AccessibleRole::PANEL },
2386 {
"password text", AccessibleRole::PASSWORD_TEXT },
2387 {
"popup menu", AccessibleRole::POPUP_MENU },
2388 {
"progress bar", AccessibleRole::PROGRESS_BAR },
2389 {
"push button", AccessibleRole::PUSH_BUTTON },
2390 {
"radio button", AccessibleRole::RADIO_BUTTON },
2391 {
"radio menu item", AccessibleRole::RADIO_MENU_ITEM },
2392 {
"root pane", AccessibleRole::ROOT_PANE },
2393 {
"row header", AccessibleRole::ROW_HEADER },
2394 {
"scroll bar", AccessibleRole::SCROLL_BAR },
2395 {
"scroll pane", AccessibleRole::SCROLL_PANE },
2396 {
"separator", AccessibleRole::SEPARATOR },
2397 {
"slider", AccessibleRole::SLIDER },
2398 {
"split pane", AccessibleRole::SPLIT_PANE },
2399 {
"spin button", AccessibleRole::SPIN_BOX },
2400 {
"statusbar", AccessibleRole::STATUS_BAR },
2401 {
"table", AccessibleRole::TABLE },
2402 {
"table cell", AccessibleRole::TABLE_CELL },
2403 {
"table column header", AccessibleRole::COLUMN_HEADER },
2404 {
"table row header", AccessibleRole::ROW_HEADER },
2405 {
"tear off menu item", AccessibleRole::UNKNOWN },
2406 {
"terminal", AccessibleRole::UNKNOWN },
2407 {
"text", AccessibleRole::TEXT },
2408 {
"toggle button", AccessibleRole::TOGGLE_BUTTON },
2409 {
"tool bar", AccessibleRole::TOOL_BAR },
2410 {
"tool tip", AccessibleRole::TOOL_TIP },
2411 {
"tree", AccessibleRole::TREE },
2412 {
"tree table", AccessibleRole::TREE_TABLE },
2413 {
"unknown", AccessibleRole::UNKNOWN },
2414 {
"viewport", AccessibleRole::VIEW_PORT },
2415 {
"window", AccessibleRole::WINDOW },
2416 {
"header", AccessibleRole::HEADER },
2417 {
"footer", AccessibleRole::FOOTER },
2418 {
"paragraph", AccessibleRole::PARAGRAPH },
2419 {
"ruler", AccessibleRole::RULER },
2420 {
"application", AccessibleRole::UNKNOWN },
2421 {
"autocomplete", AccessibleRole::UNKNOWN },
2422 {
"edit bar", AccessibleRole::EDIT_BAR },
2423 {
"embedded", AccessibleRole::EMBEDDED_OBJECT },
2424 {
"entry", AccessibleRole::UNKNOWN },
2425 {
"chart", AccessibleRole::CHART },
2426 {
"caption", AccessibleRole::CAPTION },
2427 {
"document frame", AccessibleRole::DOCUMENT },
2428 {
"heading", AccessibleRole::HEADING },
2429 {
"page", AccessibleRole::PAGE },
2430 {
"section", AccessibleRole::SECTION },
2431 {
"redundant object", AccessibleRole::UNKNOWN },
2432 {
"form", AccessibleRole::FORM },
2433 {
"link", AccessibleRole::HYPER_LINK },
2434 {
"input method window", AccessibleRole::UNKNOWN },
2435 {
"table row", AccessibleRole::UNKNOWN },
2436 {
"tree item", AccessibleRole::TREE_ITEM },
2437 {
"document spreadsheet", AccessibleRole::DOCUMENT_SPREADSHEET },
2438 {
"document presentation", AccessibleRole::DOCUMENT_PRESENTATION },
2439 {
"document text", AccessibleRole::DOCUMENT_TEXT },
2440 {
"document web", AccessibleRole::DOCUMENT },
2441 {
"document email", AccessibleRole::DOCUMENT },
2442 {
"comment", AccessibleRole::COMMENT },
2443 {
"list box", AccessibleRole::UNKNOWN },
2444 {
"grouping", AccessibleRole::GROUP_BOX },
2445 {
"image map", AccessibleRole::IMAGE_MAP },
2446 {
"notification", AccessibleRole::NOTIFICATION },
2447 {
"info bar", AccessibleRole::UNKNOWN },
2448 {
"level bar", AccessibleRole::UNKNOWN },
2449 {
"title bar", AccessibleRole::UNKNOWN },
2450 {
"block quote", AccessibleRole::UNKNOWN },
2451 {
"audio", AccessibleRole::UNKNOWN },
2452 {
"video", AccessibleRole::UNKNOWN },
2453 {
"definition", AccessibleRole::UNKNOWN },
2454 {
"article", AccessibleRole::UNKNOWN },
2455 {
"landmark", AccessibleRole::UNKNOWN },
2456 {
"log", AccessibleRole::UNKNOWN },
2457 {
"marquee", AccessibleRole::UNKNOWN },
2458 {
"math", AccessibleRole::UNKNOWN },
2459 {
"rating", AccessibleRole::UNKNOWN },
2460 {
"timer", AccessibleRole::UNKNOWN },
2461 {
"description list", AccessibleRole::UNKNOWN },
2462 {
"description term", AccessibleRole::UNKNOWN },
2463 {
"description value", AccessibleRole::UNKNOWN },
2464 {
"static", AccessibleRole::STATIC },
2465 {
"math fraction", AccessibleRole::UNKNOWN },
2466 {
"math root", AccessibleRole::UNKNOWN },
2467 {
"subscript", AccessibleRole::UNKNOWN },
2468 {
"superscript", AccessibleRole::UNKNOWN },
2469 {
"footnote", AccessibleRole::FOOTNOTE },
2472 auto it = aAtkRoleToAccessibleRole.find(roleName);
2473 if (it == aAtkRoleToAccessibleRole.end())
2474 return AccessibleRole::UNKNOWN;
2504 if (pCurrentChild->
GetHelpId().isEmpty())
2507 SAL_INFO(
"vcl.builder",
"for toplevel dialog " <<
this <<
" " <<
2508 rID <<
", set helpid " << pCurrentChild->
GetHelpId());
2519 pCurrentChild =
makeObject(pParent, rClass, rID, rProps);
2524 pCurrentChild->
set_id(OStringToOUString(rID, RTL_TEXTENCODING_UTF8));
2533 VclBuilder::stringmap::iterator aSize = rPango.find(OString(
"size"));
2534 if (aSize != rPango.end())
2537 rPango.erase(aSize);
2539 for (
auto const& elem : rPango)
2541 const OString &rKey = elem.first;
2542 const OUString &rValue = elem.second;
2558 return pCurrentChild;
2566 std::vector<OString> sIDs;
2571 std::vector<vcl::EnumContext::Context> context;
2579 xmlreader::XmlReader::Text::NONE, &
name, &nsId);
2581 if (res == xmlreader::XmlReader::Result::Begin)
2584 if (
name ==
"object")
2591 OString sID(
name.begin,
name.length);
2592 sal_Int32 nDelim = sID.indexOf(
':');
2595 OString sPattern = sID.copy(nDelim+1);
2596 aProperties[OString(
"customproperty")] = OUString::fromUtf8(sPattern);
2597 sID = sID.copy(0, nDelim);
2599 sIDs.push_back(sID);
2603 else if (
name ==
"style")
2609 else if (
name ==
"property")
2611 else if (pTabControl &&
name ==
"child")
2619 if (res == xmlreader::XmlReader::Result::End)
2625 if (res == xmlreader::XmlReader::Result::Done)
2634 assert(pTabControl || pVerticalTabControl);
2635 VclBuilder::stringmap::iterator aFind =
aProperties.find(OString(
"label"));
2638 OUString sTooltip(extractTooltipText(
aProperties));
2645 if (!context.empty())
2648 pPage->SetContext(std::move(context));
2651 for (
auto const& prop : aAtkProperties)
2653 const OString &rKey = prop.first;
2654 const OUString &rValue = prop.second;
2656 if (rKey ==
"AtkObject::accessible-name")
2658 else if (rKey ==
"AtkObject::accessible-description")
2661 SAL_INFO(
"vcl.builder",
"unhandled atk property: " << rKey);
2693 if (nLeftA < nLeftB)
2695 if (nLeftA > nLeftB)
2700 if (ePackA < ePackB)
2702 if (ePackA > ePackB)
2707 if (!bVerticalContainer)
2710 if (bPackA > bPackB)
2712 if (bPackA < bPackB)
2718 if (bPackA < bPackB)
2720 if (bPackA > bPackB)
2728 if (nPackA < nPackB)
2730 if (nPackA > nPackB)
2739 int nFramePosA = (pA == pLabel) ? 0 : 1;
2740 int nFramePosB = (pB == pLabel) ? 0 : 1;
2741 return nFramePosA < nFramePosB;
2753 OString
sType, sInternalChild;
2762 else if (
name ==
"internal-child")
2765 sInternalChild = OString(
name.begin,
name.length);
2779 xmlreader::XmlReader::Text::NONE, &
name, &nsId);
2781 if (res == xmlreader::XmlReader::Result::Begin)
2783 if (
name ==
"object" ||
name ==
"placeholder")
2787 bool bObjectInserted = pCurrentChild && pParent != pCurrentChild;
2789 if (bObjectInserted)
2793 if (!sInternalChild.isEmpty())
2794 pCurrentChild->
Show();
2809 if (
sType ==
"label")
2812 pFrameParent->designate_label(pCurrentChild);
2814 if (sInternalChild.startsWith(
"vbox") || sInternalChild.startsWith(
"messagedialog-vbox"))
2816 if (
Dialog *pBoxParent =
dynamic_cast<Dialog*
>(pParent))
2817 pBoxParent->set_content_area(
static_cast<VclBox*
>(pCurrentChild));
2819 else if (sInternalChild.startsWith(
"action_area") || sInternalChild.startsWith(
"messagedialog-action_area"))
2824 pBoxParent->set_action_area(
static_cast<VclButtonBox*
>(pCurrentChild));
2828 bool bIsButtonBox =
dynamic_cast<VclButtonBox*
>(pCurrentChild) !=
nullptr;
2832 std::vector<vcl::Window*> aChilds;
2839 pPushButton->setAction(
true);
2842 aChilds.push_back(pChild);
2852 else if (
name ==
"packing")
2856 else if (
name ==
"interface")
2860 if (
name ==
"domain")
2873 if (res == xmlreader::XmlReader::Result::End)
2879 if (res == xmlreader::XmlReader::Result::Done)
2899 else if (span ==
"value")
2906 if (!sProperty.isEmpty())
2907 rMap[sProperty] = OUString::fromUtf8(sValue);
2925 else if (span ==
"target")
2929 sal_Int32 nDelim = sValue.indexOf(
':');
2931 sValue = sValue.copy(0, nDelim);
2935 if (!sProperty.isEmpty())
2936 rMap[sProperty] = OUString::fromUtf8(sValue);
2955 if (!sProperty.isEmpty())
2956 rMap[
"role"] = OUString::fromUtf8(sProperty);
2971 xmlreader::XmlReader::Text::NONE, &
name, &nsId);
2973 if (res == xmlreader::XmlReader::Result::Done)
2976 if (res == xmlreader::XmlReader::Result::Begin)
2981 bool bTranslated =
false;
2990 nId = OString(
name.begin,
name.length).toUInt32();
2996 else if (
name ==
"context")
2999 sContext = OString(
name.begin,
name.length);
3004 xmlreader::XmlReader::Text::Raw, &
name, &nsId);
3006 OString sValue(
name.begin,
name.length);
3007 OUString sFinalValue;
3013 sFinalValue = OUString::fromUtf8(sValue);
3016 if (aRow.size() <
nId+1)
3018 aRow[
nId] = sFinalValue;
3022 if (res == xmlreader::XmlReader::Result::End)
3044 xmlreader::XmlReader::Text::NONE, &
name, &nsId);
3046 if (res == xmlreader::XmlReader::Result::Done)
3049 if (res == xmlreader::XmlReader::Result::Begin)
3053 bool bNotTreeStore = rClass !=
"GtkTreeStore";
3056 assert(bNotTreeStore &&
"gtk, as the time of writing, doesn't support data in GtkTreeStore serialization");
3062 if (res == xmlreader::XmlReader::Result::End)
3084 xmlreader::XmlReader::Text::NONE, &
name, &nsId);
3086 if (res == xmlreader::XmlReader::Result::Done)
3089 if (res == xmlreader::XmlReader::Result::Begin)
3092 if (
name ==
"property")
3096 if (res == xmlreader::XmlReader::Result::End)
3111 for (
auto const& prop : rProperties)
3113 const OString &rKey = prop.first;
3114 const OUString &rValue = prop.second;
3116 if (pWindow && rKey.match(
"AtkObject::"))
3117 pWindow->
set_property(rKey.copy(RTL_CONSTASCII_LENGTH(
"AtkObject::")), rValue);
3119 SAL_WARN(
"vcl.builder",
"unhandled atk prop: " << rKey);
3127 std::vector<ComboBoxTextItem> aItems;
3135 xmlreader::XmlReader::Text::NONE, &
name, &nsId);
3137 if (res == xmlreader::XmlReader::Result::Done)
3140 if (res == xmlreader::XmlReader::Result::Begin)
3145 bool bTranslated =
false;
3146 OString sContext,
sId;
3154 else if (
name ==
"context")
3157 sContext = OString(
name.begin,
name.length);
3159 else if (
name ==
"id")
3167 xmlreader::XmlReader::Text::Raw, &
name, &nsId);
3169 OString sValue(
name.begin,
name.length);
3170 OUString sFinalValue;
3176 sFinalValue = OUString::fromUtf8(sValue);
3179 sFinalValue = (*m_pStringReplace)(sFinalValue);
3181 aItems.emplace_back(sFinalValue,
sId);
3185 if (res == xmlreader::XmlReader::Result::End)
3205 pCurrentMenu->
set_id(OStringToOUString(rID, RTL_TEXTENCODING_UTF8));
3217 xmlreader::XmlReader::Text::NONE, &
name, &nsId);
3219 if (res == xmlreader::XmlReader::Result::Done)
3222 if (res == xmlreader::XmlReader::Result::Begin)
3224 if (
name ==
"child")
3231 if (
name ==
"property")
3236 if (res == xmlreader::XmlReader::Result::End)
3245 m_aMenus.emplace_back(rID, pCurrentMenu);
3247 return pCurrentMenu;
3259 xmlreader::XmlReader::Text::NONE, &
name, &nsId);
3261 if (res == xmlreader::XmlReader::Result::Begin)
3263 if (
name ==
"object" ||
name ==
"placeholder")
3271 if (res == xmlreader::XmlReader::Result::End)
3277 if (res == xmlreader::XmlReader::Result::Done)
3286 OUString sCustomProperty;
3294 if (
name ==
"class")
3297 sClass = OString(
name.begin,
name.length);
3299 else if (
name ==
"id")
3302 sID = OString(
name.begin,
name.length);
3305 sal_Int32 nDelim = sID.indexOf(
':');
3308 sCustomProperty = OUString::fromUtf8(sID.subView(nDelim+1));
3309 sID = sID.copy(0, nDelim);
3321 if (!sCustomProperty.isEmpty())
3322 aProperties[OString(
"customproperty")] = sCustomProperty;
3327 xmlreader::XmlReader::Text::NONE, &
name, &nsId);
3329 if (res == xmlreader::XmlReader::Result::Done)
3332 if (res == xmlreader::XmlReader::Result::Begin)
3334 if (
name ==
"child")
3336 size_t nChildMenuIdx =
m_aMenus.size();
3338 bool bSubMenuInserted =
m_aMenus.size() > nChildMenuIdx;
3339 if (bSubMenuInserted)
3345 if (
name ==
"property")
3347 else if (
name ==
"accelerator")
3352 if (res == xmlreader::XmlReader::Result::End)
3377 xmlreader::XmlReader::Text::NONE, &
name, &nsId);
3379 if (res == xmlreader::XmlReader::Result::Done)
3382 if (res == xmlreader::XmlReader::Result::Begin)
3385 if (
name ==
"widget")
3392 OString sWidget(
name.begin,
name.length);
3393 sal_Int32 nDelim = sWidget.indexOf(
':');
3395 sWidget = sWidget.copy(0, nDelim);
3402 if (
name ==
"property")
3407 if (res == xmlreader::XmlReader::Result::End)
3419 vcl::KeyCode makeKeyCode(
const std::pair<OString,OString> &rKey)
3421 bool bShift = rKey.second.indexOf(
"GDK_SHIFT_MASK") != -1;
3422 bool bMod1 = rKey.second.indexOf(
"GDK_CONTROL_MASK") != -1;
3423 bool bMod2 = rKey.second.indexOf(
"GDK_ALT_MASK") != -1;
3424 bool bMod3 = rKey.second.indexOf(
"GDK_MOD2_MASK") != -1;
3426 if (rKey.first ==
"Insert")
3428 else if (rKey.first ==
"Delete")
3430 else if (rKey.first ==
"Return")
3432 else if (rKey.first ==
"Up")
3434 else if (rKey.first ==
"Down")
3436 else if (rKey.first ==
"Left")
3438 else if (rKey.first ==
"Right")
3440 else if (rKey.first ==
"asterisk")
3442 else if (rKey.first.getLength() > 1 && rKey.first[0] ==
'F')
3445 assert(nIndex >= 1 && nIndex <= 26);
3449 assert (rKey.first.getLength() == 1);
3450 char cChar = rKey.first.toChar();
3452 if (cChar >=
'a' && cChar <=
'z')
3454 else if (cChar >=
'A' && cChar <=
'Z')
3456 else if (cChar >=
'0' && cChar <=
'9')
3459 return vcl::KeyCode(cChar, bShift, bMod1, bMod2, bMod3);
3469 if(rClass ==
"NotebookBarAddonsMenuMergePoint")
3474 else if (rClass ==
"GtkMenuItem")
3477 OUString
aCommand(extractActionName(rProps));
3483 else if (rClass ==
"GtkCheckMenuItem")
3486 OUString
aCommand(extractActionName(rProps));
3490 else if (rClass ==
"GtkRadioMenuItem")
3493 OUString
aCommand(extractActionName(rProps));
3497 else if (rClass ==
"GtkSeparatorMenuItem")
3507 if (!extractVisible(rProps))
3510 for (
auto const& prop : rProps)
3512 const OString &rKey = prop.first;
3513 const OUString &rValue = prop.second;
3515 if (rKey ==
"tooltip-markup")
3517 else if (rKey ==
"tooltip-text")
3520 SAL_INFO(
"vcl.builder",
"unhandled property: " << rKey);
3523 for (
auto const& prop : rAtkProps)
3525 const OString &rKey = prop.first;
3526 const OUString &rValue = prop.second;
3528 if (rKey ==
"AtkObject::accessible-name")
3530 else if (rKey ==
"AtkObject::accessible-description")
3533 SAL_INFO(
"vcl.builder",
"unhandled atk property: " << rKey);
3536 for (
auto const& accel : rAccels)
3538 const OString &rSignal = accel.first;
3539 const auto &rValue = accel.second;
3541 if (rSignal ==
"activate")
3542 pParent->
SetAccelKey(nNewId, makeKeyCode(rValue));
3544 SAL_INFO(
"vcl.builder",
"unhandled accelerator for: " << rSignal);
3554 std::vector<std::unique_ptr<OUString>>& rUserData,
3555 const std::vector<ComboBoxTextItem> &rItems)
3557 T *pContainer =
dynamic_cast<T*
>(pWindow);
3561 sal_uInt16 nActiveId = extractActive(rMap);
3562 for (
auto const& item : rItems)
3564 sal_Int32
nPos = pContainer->InsertEntry(item.m_sItem);
3565 if (!item.m_sId.isEmpty())
3567 rUserData.emplace_back(std::make_unique<OUString>(OUString::fromUtf8(item.m_sId)));
3568 pContainer->SetEntryData(
nPos, rUserData.back().get());
3571 if (nActiveId < rItems.size())
3572 pContainer->SelectEntryPos(nActiveId);
3581 OUString sCustomProperty;
3588 if (
name ==
"class")
3591 sClass = OString(
name.begin,
name.length);
3593 else if (
name ==
"id")
3596 sID = OString(
name.begin,
name.length);
3599 sal_Int32 nDelim = sID.indexOf(
':');
3602 sCustomProperty = OUString::fromUtf8(sID.subView(nDelim+1));
3603 sID = sID.copy(0, nDelim);
3609 if (sClass ==
"GtkListStore" || sClass ==
"GtkTreeStore")
3614 else if (sClass ==
"GtkMenu")
3619 else if (sClass ==
"GtkMenuBar")
3623 pTopLevel->SetMenuBar(
dynamic_cast<MenuBar*
>(xMenu.
get()));
3626 else if (sClass ==
"GtkSizeGroup")
3631 else if (sClass ==
"AtkObject")
3633 assert((pParent || pAtkProps) &&
"must have one set");
3634 assert(!(pParent && pAtkProps) &&
"must not have both");
3639 *pAtkProps = aAtkProperties;
3647 std::vector<ComboBoxTextItem> aItems;
3649 if (!sCustomProperty.isEmpty())
3650 aProperties[OString(
"customproperty")] = sCustomProperty;
3656 xmlreader::XmlReader::Text::NONE, &
name, &nsId);
3658 if (res == xmlreader::XmlReader::Result::Done)
3661 if (res == xmlreader::XmlReader::Result::Begin)
3663 if (
name ==
"child")
3672 else if (
name ==
"items")
3674 else if (
name ==
"style")
3677 std::vector<vcl::EnumContext::Context> aContext =
handleStyle(reader, nPriority);
3680 vcl::IPrioritable* pPrioritable =
dynamic_cast<vcl::IPrioritable*
>(pCurrentChild.
get());
3681 SAL_WARN_IF(!pPrioritable,
"vcl",
"priority set for not supported item");
3683 pPrioritable->SetPriority(nPriority);
3685 if (!aContext.empty())
3687 vcl::IContext* pContextControl =
dynamic_cast<vcl::IContext*
>(pCurrentChild.
get());
3688 SAL_WARN_IF(!pContextControl,
"vcl",
"context set for not supported item");
3689 if (pContextControl)
3690 pContextControl->SetContext(std::move(aContext));
3696 if (
name ==
"property")
3698 else if (
name ==
"attribute")
3700 else if (
name ==
"relation")
3702 else if (
name ==
"role")
3704 else if (
name ==
"action-widget")
3709 if (res == xmlreader::XmlReader::Result::End)
3718 if (sClass ==
"GtkAdjustment")
3723 else if (sClass ==
"GtkTextBuffer")
3732 aPangoAttributes, aAtkAttributes);
3735 if (!aItems.empty())
3742 return pCurrentChild;
3755 xmlreader::XmlReader::Text::NONE, &
name, &nsId);
3757 if (res == xmlreader::XmlReader::Result::Done)
3760 if (res == xmlreader::XmlReader::Result::Begin)
3763 if (
name ==
"property")
3767 if (res == xmlreader::XmlReader::Result::End)
3786 ToolBox *pToolBoxParent =
nullptr;
3787 if (pCurrent == pParent)
3788 pToolBoxParent =
dynamic_cast<ToolBox*
>(pParent);
3798 pCurrent = aFind->second;
3808 OString sKey(
name.begin,
name.length);
3809 sKey = sKey.replace(
'_',
'-');
3811 xmlreader::XmlReader::Text::Raw, &
name, &nsId);
3812 OString sValue(
name.begin,
name.length);
3814 if (sKey ==
"expand" || sKey ==
"resize")
3816 bool bTrue = (!sValue.isEmpty() && (sValue[0] ==
't' || sValue[0] ==
'T' || sValue[0] ==
'1'));
3829 bool bTrue = (!sValue.isEmpty() && (sValue[0] ==
't' || sValue[0] ==
'T' || sValue[0] ==
'1'));
3832 else if (sKey ==
"pack-type")
3837 else if (sKey ==
"left-attach")
3841 else if (sKey ==
"top-attach")
3845 else if (sKey ==
"width")
3849 else if (sKey ==
"height")
3853 else if (sKey ==
"padding")
3857 else if (sKey ==
"position")
3861 else if (sKey ==
"secondary")
3865 else if (sKey ==
"non-homogeneous")
3869 else if (sKey ==
"homogeneous")
3875 SAL_WARN_IF(sKey !=
"shrink",
"vcl.builder",
"unknown packing: " << sKey);
3883 std::vector<vcl::EnumContext::Context> aContext;
3893 xmlreader::XmlReader::Text::NONE, &
name, &nsId);
3895 if (res == xmlreader::XmlReader::Result::Done)
3898 if (res == xmlreader::XmlReader::Result::Begin)
3901 if (
name ==
"class")
3905 if (classStyle.startsWith(
"context-"))
3907 OString sContext = classStyle.copy(classStyle.indexOf(
'-') + 1);
3908 OUString sContext2(sContext.getStr(), sContext.getLength(), RTL_TEXTENCODING_UTF8);
3911 else if (classStyle.startsWith(
"priority-"))
3913 OString aPriority = classStyle.copy(classStyle.indexOf(
'-') + 1);
3914 OUString aPriority2(aPriority.getStr(), aPriority.getLength(), RTL_TEXTENCODING_UTF8);
3915 nPriority = aPriority2.toInt32();
3917 else if (classStyle !=
"small-button" && classStyle !=
"destructive-action" && classStyle !=
"suggested-action")
3919 SAL_WARN(
"vcl.builder",
"unknown class: " << classStyle);
3924 if (res == xmlreader::XmlReader::Result::End)
3947 aRet = OString (
name.begin,
name.length);
3959 OString sProperty, sContext;
3961 bool bTranslated =
false;
3968 sProperty = OString(
name.begin,
name.length);
3970 else if (
name ==
"context")
3973 sContext = OString(
name.begin,
name.length);
3981 (void)reader.
nextItem(xmlreader::XmlReader::Text::Raw, &
name, &nsId);
3982 OString sValue(
name.begin,
name.length);
3983 OUString sFinalValue;
3989 sFinalValue = OUString::fromUtf8(sValue);
3991 if (!sProperty.isEmpty())
3993 sProperty = sProperty.replace(
'_',
'-');
3995 sFinalValue = (*m_pStringReplace)(sFinalValue);
3996 rMap[sProperty] = sFinalValue;
4009 if (
name ==
"response")
4012 sResponse = OString(
name.begin,
name.length);
4016 (void)reader.
nextItem(xmlreader::XmlReader::Text::Raw, &
name, &nsId);
4017 OString sID(
name.begin,
name.length);
4018 sal_Int32 nDelim = sID.indexOf(
':');
4020 sID = sID.copy(0, nDelim);
4038 sValue = OString(
name.begin,
name.length);
4040 else if (
name ==
"signal")
4043 sProperty = OString(
name.begin,
name.length);
4045 else if (
name ==
"modifiers")
4048 sModifiers = OString(
name.begin,
name.length);
4052 if (!sProperty.isEmpty() && !sValue.isEmpty())
4054 rMap[sProperty] = std::make_pair(sValue, sModifiers);
4067 if (child.m_sID == sID)
4068 return child.m_pWindow;
4078 if (menu.m_sID == sID)
4079 return dynamic_cast<PopupMenu*
>(menu.m_pMenu.get());
4108 assert(nResponse >= 100 &&
"keep non-canned responses in range 100+ to avoid collision with vcl RET_*");
4114 if (child.m_sID == sID)
4117 assert(pPushButton);
4120 pDialog->
add_button(pPushButton, nResponse,
false);
4131 [&sID](
WinAndId& rItem) { return rItem.m_sID == sID; });
4134 aI->m_pWindow.disposeAndClear();
4148 [&pWindow](
WinAndId& rItem) { return rItem.m_pWindow == pWindow; });
4157 if (child.m_pWindow == pWindow)
4174 if (child.m_pWindow == pPropHolder)
4175 return child.m_aPackingData;
4185 if (child.m_pWindow == pWindow)
4186 child.m_aPackingData.m_nPosition = nPosition;
4192 std::map<OString, ListStore>::const_iterator aI =
m_pParserState->m_aModels.find(sID);
4194 return &(aI->second);
4200 std::map<OString, TextBuffer>::const_iterator aI =
m_pParserState->m_aTextBuffers.find(sID);
4202 return &(aI->second);
4208 std::map<OString, Adjustment>::const_iterator aI =
m_pParserState->m_aAdjustments.find(sID);
4210 return &(aI->second);
4219 sal_uInt16 nEntry =
rTarget.InsertEntry(rRow[0]);
4220 if (rRow.size() > 1)
4224 sal_Int32
nValue = rRow[1].toInt32();
4225 rTarget.SetEntryData(nEntry,
reinterpret_cast<void*
>(
nValue));
4229 if (!rRow[1].isEmpty())
4231 m_aUserData.emplace_back(std::make_unique<OUString>(rRow[1]));
4238 rTarget.SelectEntryPos(nActiveId);
4246 sal_uInt16 nEntry =
rTarget.InsertEntry(rRow[0]);
4247 if (rRow.size() > 1)
4251 sal_Int32
nValue = rRow[1].toInt32();
4252 rTarget.SetEntryData(nEntry,
reinterpret_cast<void*
>(
nValue));
4256 if (!rRow[1].isEmpty())
4258 m_aUserData.emplace_back(std::make_unique<OUString>(rRow[1]));
4265 rTarget.SelectEntryPos(nActiveId);
4273 auto pEntry =
rTarget.InsertEntry(rRow[0]);
4274 if (rRow.size() > 1)
4278 sal_Int32
nValue = rRow[1].toInt32();
4279 pEntry->SetUserData(
reinterpret_cast<void*
>(
nValue));
4283 if (!rRow[1].isEmpty())
4285 m_aUserData.emplace_back(std::make_unique<OUString>(rRow[1]));
4300 int nMul = rtl_math_pow10Exp(1,
rTarget.GetDecimalDigits());
4302 for (
auto const& elem : rAdjustment)
4304 const OString &rKey = elem.first;
4305 const OUString &rValue = elem.second;
4307 if (rKey ==
"upper")
4309 sal_Int64 nUpper = rValue.toDouble() * nMul;
4313 else if (rKey ==
"lower")
4315 sal_Int64 nLower = rValue.toDouble() * nMul;
4319 else if (rKey ==
"value")
4321 sal_Int64
nValue = rValue.toDouble() * nMul;
4324 else if (rKey ==
"step-increment")
4326 sal_Int64 nSpinSize = rValue.toDouble() * nMul;
4327 rTarget.SetSpinSize(nSpinSize);
4331 SAL_INFO(
"vcl.builder",
"unhandled property :" << rKey);
4338 double nMaxValue = 0, nMinValue = 0,
nValue = 0, nSpinSize = 0;
4340 for (
auto const& elem : rAdjustment)
4342 const OString &rKey = elem.first;
4343 const OUString &rValue = elem.second;
4345 if (rKey ==
"upper")
4346 nMaxValue = rValue.toDouble();
4347 else if (rKey ==
"lower")
4348 nMinValue = rValue.toDouble();
4349 else if (rKey ==
"value")
4350 nValue = rValue.toDouble();
4351 else if (rKey ==
"step-increment")
4352 nSpinSize = rValue.toDouble();
4354 SAL_INFO(
"vcl.builder",
"unhandled property :" << rKey);
4366 for (
auto const& elem : rAdjustment)
4368 const OString &rKey = elem.first;
4369 const OUString &rValue = elem.second;
4371 if (rKey ==
"upper")
4372 rTarget.SetRangeMax(rValue.toInt32());
4373 else if (rKey ==
"lower")
4374 rTarget.SetRangeMin(rValue.toInt32());
4375 else if (rKey ==
"value")
4376 rTarget.SetThumbPos(rValue.toInt32());
4377 else if (rKey ==
"step-increment")
4378 rTarget.SetLineSize(rValue.toInt32());
4379 else if (rKey ==
"page-increment")
4380 rTarget.SetPageSize(rValue.toInt32());
4383 SAL_INFO(
"vcl.builder",
"unhandled property :" << rKey);
4390 for (
auto const& elem : rAdjustment)
4392 const OString &rKey = elem.first;
4393 const OUString &rValue = elem.second;
4395 if (rKey ==
"upper")
4396 rTarget.SetRangeMax(rValue.toInt32());
4397 else if (rKey ==
"lower")
4398 rTarget.SetRangeMin(rValue.toInt32());
4399 else if (rKey ==
"value")
4400 rTarget.SetThumbPos(rValue.toInt32());
4401 else if (rKey ==
"step-increment")
4402 rTarget.SetLineSize(rValue.toInt32());
4403 else if (rKey ==
"page-increment")
4404 rTarget.SetPageSize(rValue.toInt32());
4407 SAL_INFO(
"vcl.builder",
"unhandled property :" << rKey);
4414 for (
auto const& elem : rTextBuffer)
4416 const OString &rKey = elem.first;
4417 const OUString &rValue = elem.second;
4423 SAL_INFO(
"vcl.builder",
"unhandled property :" << rKey);
4429 : m_nLastToolbarId(0)
4430 , m_nLastMenuItemId(0)
PropertiesInfo aProperties
css::uno::Reference< css::lang::XComponent > m_xFrame
static bool insertItems(vcl::Window *pWindow, VclBuilder::stringmap &rMap, std::vector< std::unique_ptr< OUString > > &rUserData, const std::vector< ComboBoxTextItem > &rItems)
Insert items to a ComboBox or a ListBox.
std::map< OUString, std::shared_ptr< NoAutoUnloadModule > > ModuleMap
static ModuleMap g_aModuleMap
static bool toBool(std::string_view rValue)
static OUString GetUIRootDir()
const LocaleDataWrapper & GetLocaleDataWrapper() const
static weld::Window * GetFrameWeld(const css::uno::Reference< css::awt::XWindow > &rWindow)
static std::unique_ptr< weld::Builder > CreateInterimBuilder(vcl::Window *pParent, const OUString &rUIFile, bool bAllowCycleFocusOut, sal_uInt64 nLOKWindowId=0)
static const AllSettings & GetSettings()
Gets the application's settings.
static std::unique_ptr< weld::Builder > CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false, sal_uInt64 nLOKWindowId=0)
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage)
void EnableTriState(bool bTriState=true)
void SetState(TriState eState)
A widget used to choose from a list of items and which has an entry.
virtual void SetText(const OUString &rStr) override
virtual Size GetOptimalSize() const override
static void addKeyValue(SAL_UNUSED_PARAMETER const OUString &, SAL_UNUSED_PARAMETER const OUString &, SAL_UNUSED_PARAMETER tAddKeyHandling)
@ Default
Use given parent or get a default one using GetDefaultParent(...)
void add_button(PushButton *pButton, int nResponse, bool bTransferOwnership)
virtual void doDeferredInit(WinBits nBits)
const Image & GetImage() const
static Image loadThemeImage(const OUString &rFileName)
void SetImage(const Image &rImage)
void set_mnemonic_widget(vcl::Window *pWindow)
OUString GetStock() const
Size GetSizePixel() const
static std::unique_ptr< JSInstanceBuilder > CreateSidebarBuilder(weld::Widget *pParent, const OUString &rUIRoot, const OUString &rUIFile, sal_uInt64 nLOKWindowId=0)
static std::unique_ptr< JSInstanceBuilder > CreateNotebookbarBuilder(vcl::Window *pParent, const OUString &rUIRoot, const OUString &rUIFile, const css::uno::Reference< css::frame::XFrame > &rFrame, sal_uInt64 nWindowId=0)
static std::unique_ptr< JSInstanceBuilder > CreateFormulabarBuilder(vcl::Window *pParent, const OUString &rUIRoot, const OUString &rUIFile, sal_uInt64 nLOKWindowId)
static std::unique_ptr< JSInstanceBuilder > CreatePopupBuilder(weld::Widget *pParent, const OUString &rUIRoot, const OUString &rUIFile)
static std::unique_ptr< JSInstanceBuilder > CreateDialogBuilder(weld::Widget *pParent, const OUString &rUIRoot, const OUString &rUIFile)
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage)
A widget used to choose from a list of items and which has no entry.
OUString getNum(sal_Int64 nNumber, sal_uInt16 nDecimals, bool bUseThousandSep=true, bool bTrailingZeros=true) const
const LanguageTag & getLanguageTag() const
virtual std::unique_ptr< weld::Builder > CreateBuilder(weld::Widget *pParent, const OUString &rUIRoot, const OUString &rUIFile)
virtual weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage)
virtual std::unique_ptr< weld::Builder > CreateInterimBuilder(vcl::Window *pParent, const OUString &rUIRoot, const OUString &rUIFile, bool bAllowCycleFocusOut, sal_uInt64 nLOKWindowId=0)
virtual weld::Window * GetFrameWeld(const css::uno::Reference< css::awt::XWindow > &rWindow)
constexpr tools::Long Height() const
tools::Long AdjustHeight(tools::Long n)
tools::Long AdjustWidth(tools::Long n)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
void SetSpaceBetweenEntries(short nSpace)
void SetEntryHeight(short nHeight)
void SetHighlightRange(sal_uInt16 nFirstTab=0, sal_uInt16 nLastTab=0xffff)
void SetNoAutoCurEntry(bool b)
void SetQuickSearch(bool bEnable)
virtual void doDeferredInit(WinBits nBits)
sal_uInt16 GetPageCount() const
void SetPageName(sal_uInt16 nPageId, const OString &rName) const
void SetAccessibleDescription(sal_uInt16 nItemId, const OUString &rStr)
void SetTabPage(sal_uInt16 nPageId, TabPage *pPage)
void SetAccessibleName(sal_uInt16 nItemId, const OUString &rStr)
TabPage * GetTabPage(sal_uInt16 nPageId) const
void SetCurPageId(sal_uInt16 nPageId)
void InsertPage(sal_uInt16 nPageId, const OUString &rText, sal_uInt16 nPos=TAB_APPEND)
sal_uInt16 GetCurPageId() const
sal_uInt16 GetPageId(sal_uInt16 nPos) const
void SetHelpText(sal_uInt16 nPageId, const OUString &rText)
void SetPageText(sal_uInt16 nPageId, const OUString &rText)
void RemovePage(sal_uInt16 nPageId)
bool operator()(const vcl::Window *pA, const vcl::Window *pB) const
static OString getStyleClass(xmlreader::XmlReader &reader)
void handleListStore(xmlreader::XmlReader &reader, const OString &rID, std::string_view rClass)
stringmap m_aDeferredProperties
static std::vector< vcl::EnumContext::Context > handleStyle(xmlreader::XmlReader &reader, int &nPriority)
void handleActionWidget(xmlreader::XmlReader &reader)
void connectNumericFormatterAdjustment(const OString &id, const OUString &rAdjustment)
VclBuilder(vcl::Window *pParent, const OUString &sUIRootDir, const OUString &sUIFile, OString sID=OString(), css::uno::Reference< css::frame::XFrame > xFrame=css::uno::Reference< css::frame::XFrame >(), bool bLegacy=true, const NotebookBarAddonsItem *pNotebookBarAddonsItem=nullptr)
static vcl::Window * prepareWidgetOwnScrolling(vcl::Window *pParent, WinBits &rWinStyle)
void(* customMakeWidget)(VclPtr< vcl::Window > &rRet, const VclPtr< vcl::Window > &pParent, stringmap &rVec)
These functions create a new widget with parent pParent and return it in rRet.
PackingData get_window_packing_data(const vcl::Window *pWindow) const
VclPtr< vcl::Window > m_pParent
void mungeModel(ListBox &rTarget, const ListStore &rStore, sal_uInt16 nActiveId)
const TextBuffer * get_buffer_by_name(const OString &sID) const
vcl::Window * get_widget_root()
css::uno::Reference< css::frame::XFrame > m_xFrame
XFrame to be able to extract labels and other properties of the UNO commands (like of ....
VclPtr< vcl::Window > handleObject(vcl::Window *pParent, stringmap *pAtkProps, xmlreader::XmlReader &reader)
void extractGroup(const OString &id, stringmap &rVec)
void extractBuffer(const OString &id, stringmap &rVec)
static void applyAtkProperties(vcl::Window *pWindow, const stringmap &rProperties)
void extractButtonImage(const OString &id, stringmap &rMap, bool bRadio)
const Adjustment * get_adjustment_by_name(const OString &sID) const
void extractModel(const OString &id, stringmap &rVec)
static void collectAtkRelationAttribute(xmlreader::XmlReader &reader, stringmap &rMap)
bool m_bToplevelHasDeferredInit
static void mungeTextBuffer(VclMultiLineEdit &rTarget, const TextBuffer &rTextBuffer)
void insertMenuObject(Menu *pParent, PopupMenu *pSubMenu, const OString &rClass, const OString &rID, stringmap &rProps, stringmap &rAtkProps, accelmap &rAccels)
VclPtr< vcl::Window > insertObject(vcl::Window *pParent, const OString &rClass, const OString &rID, stringmap &rProps, stringmap &rPangoAttributes, stringmap &rAtkProps)
std::vector< WinAndId > m_aChildren
std::map< OString, OUString > stringmap
bool m_bToplevelHasDeferredProperties
void set_response(std::string_view sID, short nResponse)
void cleanupWidgetOwnScrolling(vcl::Window *pScrollParent, vcl::Window *pWindow, stringmap &rMap)
std::vector< std::unique_ptr< OUString > > m_aUserData
ResHookProc m_pStringReplace
bool m_bToplevelParentFound
std::map< OString, std::pair< OString, OString > > accelmap
static void collectAccelerator(xmlreader::XmlReader &reader, accelmap &rMap)
void set_window_packing_position(const vcl::Window *pWindow, sal_Int32 nPosition)
void collectProperty(xmlreader::XmlReader &reader, stringmap &rVec) const
static void collectAtkRoleAttribute(xmlreader::XmlReader &reader, stringmap &rMap)
T * get(VclPtr< T > &ret, const OString &sID)
void extractMnemonicWidget(const OString &id, stringmap &rMap)
static int getImageSize(const stringmap &rMap)
std::vector< MenuAndId > m_aMenus
vcl::Window * get_by_name(std::string_view sID)
std::unique_ptr< ParserState > m_pParserState
static bool extractAdjustmentToMap(const OString &id, stringmap &rVec, std::vector< WidgetAdjustmentMap > &rAdjustmentMap)
OString get_by_window(const vcl::Window *pWindow) const
const ListStore * get_model_by_name(const OString &sID) const
stringmap handleAtkObject(xmlreader::XmlReader &reader) const
void handleRow(xmlreader::XmlReader &reader, const OString &rID)
void handleChild(vcl::Window *pParent, stringmap *pAtkProps, xmlreader::XmlReader &reader)
void handleMenuObject(Menu *pParent, xmlreader::XmlReader &reader)
void drop_ownership(const vcl::Window *pWindow)
void setDeferredProperties()
void handleSizeGroup(xmlreader::XmlReader &reader)
void delete_by_window(vcl::Window *pWindow)
static void mungeAdjustment(NumericFormatter &rTarget, const Adjustment &rAdjustment)
void applyPackingProperty(vcl::Window *pCurrent, vcl::Window *pParent, xmlreader::XmlReader &reader)
void disposeBuilder()
releases references and disposes all children.
void delete_by_name(const OString &sID)
void handleTabChild(vcl::Window *pParent, xmlreader::XmlReader &reader)
static SymbolType mapStockToSymbol(std::u16string_view icon_name)
void handleMenuChild(Menu *pParent, xmlreader::XmlReader &reader)
static void collectPangoAttribute(xmlreader::XmlReader &reader, stringmap &rMap)
VclPtr< Menu > handleMenu(xmlreader::XmlReader &reader, const OString &rID, bool bMenuBar)
void handlePacking(vcl::Window *pCurrent, vcl::Window *pParent, xmlreader::XmlReader &reader)
VclPtr< vcl::Window > makeObject(vcl::Window *pParent, const OString &rClass, const OString &rID, stringmap &rVec)
std::vector< ComboBoxTextItem > handleItems(xmlreader::XmlReader &reader) const
void connectFormattedFormatterAdjustment(const OString &id, const OUString &rAdjustment)
std::unique_ptr< NotebookBarAddonsItem > m_pNotebookBarAddonsItem
PopupMenu * get_menu(std::string_view sID)
vcl::Window * get_label_widget()
A construction helper for a temporary VclPtr.
reference_type * get() const
Get the body.
static VclPtr< reference_type > Create(Arg &&... arg)
A construction helper for VclPtr.
void InsertPage(const OString &rPageId, const OUString &rLabel, const Image &rImage, const OUString &rTooltip, VclPtr< vcl::Window > xPage, int nPos=-1)
vcl::Window * GetPageParent()
VclPtr< vcl::Window > mpRealParent
VclPtr< vcl::Window > mpBorderWindow
VclPtr< vcl::Window > mpParent
std::pair< const_iterator, bool > insert(Value &&x)
static OUString formatPercent(double dNumber, const LanguageTag &rLangTag)
static Context GetContextEnum(const OUString &rsContextName)
void SetStyle(WinBits nStyle)
vcl::Window * GetParent() const
bool IsControlFont() const
WindowType GetType() const
void set_padding(sal_Int32 nPadding)
virtual void SetSizePixel(const Size &rNewSize)
Size get_preferred_size() const
vcl::Window * GetWindow(GetWindowType nType) const
void set_border_width(sal_Int32 nBorderWidth)
void set_grid_left_attach(sal_Int32 nAttach)
Dialog * GetParentDialog() const
void set_height_request(sal_Int32 nHeightRequest)
void set_id(const OUString &rID)
Sets an ID.
VclPackType get_pack_type() const
void reorderWithinParent(sal_uInt16 nNewPosition)
void set_grid_height(sal_Int32 nRows)
bool set_font_attribute(const OString &rKey, std::u16string_view rValue)
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)
const OString & GetHelpId() const
vcl::Font GetControlFont() const
void set_pack_type(VclPackType ePackType)
bool get_secondary() const
SystemWindow * GetSystemWindow() const
void SetAccessibleRole(sal_uInt16 nRole)
bool IsDockingWindow() const
SAL_DLLPRIVATE WindowImpl * ImplGetWindowImpl() const
void SetHelpId(const OString &)
sal_Int32 get_height_request() const
void add_to_size_group(const std::shared_ptr< VclSizeGroup > &xGroup)
sal_Int32 get_grid_left_attach() const
sal_Int32 get_grid_top_attach() const
void set_width_request(sal_Int32 nWidthRequest)
bool IsSystemWindow() const
virtual Size GetSizePixel() const
virtual bool set_property(const OString &rKey, const OUString &rValue)
sal_Int32 get_width_request() const
void set_secondary(bool bSecondary)
void set_expand(bool bExpand)
void set_grid_top_attach(sal_Int32 nAttach)
void SetQuickHelpText(const OUString &rHelpText)
virtual OUString GetText() const
void set_fill(bool bFill)
void SetAccessibleRelationLabelFor(vcl::Window *pLabelFor)
vcl::Window * ImplGetWindow() const
if this is a proxy return the client, otherwise itself
void set_non_homogeneous(bool bNonHomogeneous)
void SetType(WindowType nType)
void set_grid_width(sal_Int32 nCols)
void SetAccessibleRelationLabeledBy(vcl::Window *pLabeledBy)
std::unique_ptr< Entry > m_xEntry
EntryTreeView(std::unique_ptr< Entry > xEntry, std::unique_ptr< TreeView > xTreeView)
void set_height_request_by_rows(int nRows)
std::unique_ptr< TreeView > m_xTreeView
virtual std::unique_ptr< TreeIter > make_iterator(const TreeIter *pOrig=nullptr) const =0
virtual bool get_row_expanded(const TreeIter &rIter) const =0
virtual bool get_iter_first(TreeIter &rIter) const =0
virtual bool iter_parent(TreeIter &rIter) const =0
virtual bool iter_next(TreeIter &rIter) const =0
virtual int iter_compare(const TreeIter &a, const TreeIter &b) const =0
virtual int get_iter_depth(const TreeIter &rIter) const =0
Result nextItem(Text reportText, Span *data, int *nsId)
bool nextAttribute(int *nsId, Span *localName)
Span getAttributeValue(bool fullyNormalize)
#define DBG_UNHANDLED_EXCEPTION(...)
constexpr sal_uInt16 KEY_RETURN
constexpr sal_uInt16 KEY_0
constexpr sal_uInt16 KEY_LEFT
constexpr sal_uInt16 KEY_UP
constexpr sal_uInt16 KEY_F1
constexpr sal_uInt16 KEY_A
constexpr sal_uInt16 KEY_RIGHT
constexpr sal_uInt16 KEY_DELETE
constexpr sal_uInt16 KEY_DOWN
constexpr sal_uInt16 KEY_INSERT
constexpr sal_uInt16 KEY_MULTIPLY
#define LINK(Instance, Class, Member)
#define SAL_INFO_IF(condition, area, stream)
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
void ensureDefaultWidthChars(VclBuilder::stringmap &rMap)
sal_Int16 getRoleFromName(const OString &roleName)
void set_properties(vcl::Window *pWindow, const VclBuilder::stringmap &rProps)
OUString convertMnemonicMarkup(std::u16string_view rIn)
bool extractDropdown(VclBuilder::stringmap &rMap)
OUString extractCustomProperty(VclBuilder::stringmap &rMap)
void reorderWithinParent(vcl::Window &rWindow, sal_uInt16 nNewPosition)
void MergeNotebookBarAddons(vcl::Window *pParent, const VclBuilder::customMakeWidget &pFunction, const css::uno::Reference< css::frame::XFrame > &m_xFrame, const NotebookBarAddonsItem &aNotebookBarAddonsItem, VclBuilder::stringmap &rMap)
void MergeNotebookBarMenuAddons(Menu *pPopupMenu, sal_Int16 nItemId, const OString &sItemIdName, NotebookBarAddonsItem &aNotebookBarAddonsItem)
ResHookProc GetReadStringHook()
std::locale Create(std::string_view aPrefixName, const LanguageTag &rLocale)
OUString get(TranslateId sContextAndId, const std::locale &loc)
bool isInterimBuilderEnabledForNotebookbar(std::u16string_view rUIFile)
bool isBuilderEnabledForSidebar(std::u16string_view rUIFile)
bool isBuilderEnabled(std::u16string_view rUIFile, bool bMobile)
bool isBuilderEnabledForPopup(std::u16string_view rUIFile)
sal_uInt32 toUInt32(std::u16string_view str, sal_Int16 radix=10)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
Sequence< beans::PropertyValue > GetCommandProperties(const OUString &rsCommandName, const OUString &rsModuleName)
Return a label for the given command.
OUString GetTooltipForCommand(const OUString &rsCommandName, const css::uno::Sequence< css::beans::PropertyValue > &rProperties, const Reference< frame::XFrame > &rxFrame)
OUString GetModuleIdentifier(const Reference< frame::XFrame > &rxFrame)
Image GetImageForCommand(const OUString &rsCommandName, const Reference< frame::XFrame > &rxFrame, vcl::ImageType eImageType)
OUString GetLabelForCommand(const css::uno::Sequence< css::beans::PropertyValue > &rProperties)
Return a label for the given command.
void VclBuilderPreload()
Pre-loads all modules containing UI information.
bool TextToValue(const OUString &rStr, double &rValue, sal_Int64 nBaseValue, sal_uInt16 nDecDigits, const LocaleDataWrapper &rLocaleDataWrapper, FieldUnit eUnit)
sal_Int64 ConvertValue(sal_Int64 nValue, sal_Int64 mnBaseValue, sal_uInt16 nDecDigits, FieldUnit eInUnit, FieldUnit eOutUnit)
IMPL_LINK_NOARG(HexColorControl, OnAsyncModifyHdl, void *, void)
size_t GetAbsPos(const weld::TreeView &rTreeView, const weld::TreeIter &rIter)
bool IsEntryVisible(const weld::TreeView &rTreeView, const weld::TreeIter &rIter)
IMPL_LINK(CustomWeld, DoResize, const Size &, rSize, void)
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
std::vector< row > m_aEntries
std::vector< OUString > row
MenuAndId(OString sId, Menu *pMenu)
std::vector< OString > m_aWidgets
Reference< XFrame > xFrame
ImplSVData * ImplGetSVData()
const FieldUnitStringList & ImplGetFieldUnits()
std::vector< std::pair< OUString, FieldUnit > > FieldUnitStringList