10 #include <config_feature_desktop.h>
11 #include <config_options.h>
14 #include <string_view>
15 #include <unordered_map>
16 #include <com/sun/star/accessibility/AccessibleRole.hpp>
20 #include <officecfg/Office/Common.hxx>
21 #include <osl/module.hxx>
61 #include <bitmaps.hlst>
72 #include <calendar.hxx>
75 #include <strings.hrc>
83 #if defined(DISABLE_DYNLOADING) || defined(LINUX)
87 static bool toBool(std::string_view rValue)
89 return (!rValue.empty() && (rValue[0] ==
't' || rValue[0] ==
'T' || rValue[0] ==
'1'));
94 OUString mapStockToImageResource(std::u16string_view sType)
96 if (sType == u
"view-refresh")
97 return SV_RESID_BITMAP_REFRESH;
98 else if (sType == u
"dialog-error")
100 else if (sType == u
"list-add")
102 else if (sType == u
"list-remove")
104 else if (sType == u
"edit-copy")
106 else if (sType == u
"edit-paste")
116 if (sType ==
u"media-skip-forward")
118 else if (sType ==
u"media-skip-backward")
120 else if (sType ==
u"media-playback-start")
122 else if (sType ==
u"media-playback-stop")
124 else if (sType ==
u"go-first")
126 else if (sType ==
u"go-last")
128 else if (sType ==
u"go-previous")
130 else if (sType ==
u"go-next")
132 else if (sType ==
u"go-up")
134 else if (sType ==
u"go-down")
136 else if (sType ==
u"missing-image")
138 else if (sType ==
u"help-browser")
140 else if (sType ==
u"window-close")
142 else if (sType ==
u"document-new")
144 else if (sType ==
u"pan-down-symbolic")
146 else if (sType ==
u"pan-up-symbolic")
148 else if (!mapStockToImageResource(sType).isEmpty())
157 #if defined SAL_LOG_WARN
160 return nType == WindowType::PUSHBUTTON ||
161 nType == WindowType::OKBUTTON ||
162 nType == WindowType::CANCELBUTTON ||
163 nType == WindowType::HELPBUTTON ||
164 nType == WindowType::IMAGEBUTTON ||
165 nType == WindowType::MENUBUTTON ||
166 nType == WindowType::MOREBUTTON ||
167 nType == WindowType::SPINBUTTON;
175 bool bUseJSBuilder =
false;
181 if (rUIFile ==
"modules/swriter/ui/wordcount-mobile.ui" ||
182 rUIFile ==
"svx/ui/findreplacedialog-mobile.ui" ||
183 rUIFile ==
"modules/swriter/ui/watermarkdialog.ui" ||
184 rUIFile ==
"modules/scalc/ui/validationdialog.ui" ||
185 rUIFile ==
"modules/scalc/ui/validationcriteriapage.ui" ||
186 rUIFile ==
"modules/scalc/ui/validationhelptabpage-mobile.ui" ||
187 rUIFile ==
"modules/scalc/ui/erroralerttabpage-mobile.ui" ||
188 rUIFile ==
"modules/scalc/ui/validationdialog.ui")
190 bUseJSBuilder =
true;
194 if (rUIFile ==
"modules/scalc/ui/pivottablelayoutdialog.ui"
195 || rUIFile ==
"modules/scalc/ui/selectsource.ui"
196 || rUIFile ==
"modules/scalc/ui/managenamesdialog.ui"
197 || rUIFile ==
"modules/scalc/ui/definename.ui"
198 || rUIFile ==
"cui/ui/macroselectordialog.ui"
199 || rUIFile ==
"modules/scalc/ui/correlationdialog.ui"
200 || rUIFile ==
"modules/scalc/ui/samplingdialog.ui"
201 || rUIFile ==
"modules/scalc/ui/descriptivestatisticsdialog.ui"
202 || rUIFile ==
"modules/scalc/ui/analysisofvariancedialog.ui"
203 || rUIFile ==
"modules/scalc/ui/covariancedialog.ui"
204 || rUIFile ==
"modules/scalc/ui/exponentialsmoothingdialog.ui"
205 || rUIFile ==
"modules/scalc/ui/movingaveragedialog.ui"
206 || rUIFile ==
"modules/scalc/ui/regressiondialog.ui"
207 || rUIFile ==
"modules/scalc/ui/ttestdialog.ui"
208 || rUIFile ==
"modules/scalc/ui/ttestdialog.ui"
209 || rUIFile ==
"modules/scalc/ui/ztestdialog.ui"
210 || rUIFile ==
"modules/scalc/ui/chisquaretestdialog.ui"
211 || rUIFile ==
"modules/scalc/ui/fourieranalysisdialog.ui"
212 || rUIFile ==
"uui/ui/macrowarnmedium.ui"
213 || rUIFile ==
"modules/scalc/ui/datafielddialog.ui"
214 || rUIFile ==
"modules/scalc/ui/pivotfielddialog.ui"
215 || rUIFile ==
"modules/scalc/ui/datafieldoptionsdialog.ui"
216 || rUIFile ==
"svx/ui/fontworkgallerydialog.ui")
218 bUseJSBuilder =
true;
232 && (rUIFile ==
"svx/ui/stylespreview.ui"
233 || rUIFile ==
"modules/scalc/ui/numberbox.ui"))
238 && (rUIFile ==
"modules/scalc/ui/filterdropdown.ui"))
267 auto it = std::find_if(
268 rList.begin(), rList.end(),
269 [&rUnit](
const std::pair<OUString, FieldUnit>& rItem) {
return rItem.second == rUnit; });
270 if (it != rList.end())
278 signal_value_changed();
283 OUString sNewText(format_number(rSpinButton.get_value()));
284 if (sNewText != rSpinButton.get_text())
285 rSpinButton.set_text(sNewText);
294 int chars = ceil(width /
m_xSpinButton->get_approximate_digit_width());
301 for (
unsigned int i = 0;
i < n; ++
i)
312 return nValue / nFactor;
315 const int nHalf = nFactor / 2;
318 return (nValue - nHalf) / nFactor;
319 return (nValue + nHalf) / nFactor;
332 double fValue = nValue;
338 aStr = rLocaleData.
getNum(nValue, nDecimalDigits,
true,
true);
344 OUString sDoublePrime =
u"\u2033";
345 if (aSuffix !=
"\"" && aSuffix != sDoublePrime)
348 aSuffix = sDoublePrime;
352 OUString sPrime =
u"\u2032";
353 if (aSuffix !=
"'" && aSuffix != sPrime)
406 bool bRet =
vcl::TextToValue(get_text(), fResult, 0, m_xSpinButton->get_digits(), rLocaleData, m_eSrcUnit);
419 : m_xEntry(
std::move(xEntry))
428 m_xEntry->set_text(rView.get_selected_text());
429 m_aChangeHdl.Call(*
this);
434 m_aChangeHdl.Call(*
this);
439 int nHeight = nRows == -1 ? -1 :
m_xTreeView->get_height_rows(nRows);
447 std::unique_ptr<weld::TreeIter> xEntry(rTreeView.
make_iterator(&rIter));
451 while (xEntry && rTreeView.
iter_compare(*xEntry, rIter) != 0)
467 std::unique_ptr<weld::TreeIter> xEntry(rTreeView.
make_iterator(&rIter));
468 bool bRetVal =
false;
482 const OString& sID,
const css::uno::Reference<css::frame::XFrame>& rFrame,
484 : m_pNotebookBarAddonsItem(pNotebookBarAddonsItem
491 , m_bToplevelParentFound(
false)
493 , m_pParserState(
new ParserState)
496 m_bToplevelHasDeferredInit = pParent &&
497 ((pParent->IsSystemWindow() &&
static_cast<SystemWindow*
>(pParent)->isDeferredInit()) ||
498 (pParent->IsDockingWindow() &&
static_cast<DockingWindow*
>(pParent)->isDeferredInit()));
499 m_bToplevelHasDeferredProperties = m_bToplevelHasDeferredInit;
501 sal_Int32 nIdx = m_sHelpRoot.lastIndexOf(
'.');
503 m_sHelpRoot = m_sHelpRoot.copy(0, nIdx);
504 m_sHelpRoot += OString(
'/');
506 OUString sUri = sUIDir + sUIFile;
512 handleChild(pParent,
nullptr, reader);
514 catch (
const css::uno::Exception &rExcept)
522 for (
auto const& mnemonicWidget : m_pParserState->m_aMnemonicWidgetMaps)
524 FixedText *pOne = get<FixedText>(mnemonicWidget.m_sID);
525 vcl::Window *pOther =
get(mnemonicWidget.m_sValue.toUtf8());
526 SAL_WARN_IF(!pOne || !pOther,
"vcl",
"missing either source " << mnemonicWidget.m_sID
527 <<
" or target " << mnemonicWidget.m_sValue <<
" member of Mnemonic Widget Mapping");
533 for (
auto const& elemAtk : m_pParserState->m_aAtkInfo)
536 const stringmap &rMap = elemAtk.second;
538 for (
auto const& elemMap : rMap)
540 const OString &rType = elemMap.first;
541 const OUString &rParam = elemMap.second;
545 if (role != com::sun::star::accessibility::AccessibleRole::UNKNOWN)
551 SAL_WARN_IF(!pTarget,
"vcl",
"missing parameter of a11y relation: " << rParam);
554 if (rType ==
"labelled-by")
556 else if (rType ==
"label-for")
558 else if (rType ==
"member-of")
562 SAL_WARN(
"vcl.builder",
"unhandled a11y relation :" << rType);
569 for (
auto const& elem : m_pParserState->m_aGroupMaps)
572 RadioButton *pOther = get<RadioButton>(elem.m_sValue);
573 SAL_WARN_IF(!pOne || !pOther,
"vcl",
"missing member of radiobutton group");
577 pOne->
group(*pOther);
580 pOther->group(*pOne);
581 std::stable_sort(pOther->m_xGroup->begin(), pOther->m_xGroup->end(), sortIntoBestTabTraversalOrder(
this));
587 for (
auto const& elem : m_pParserState->m_aModelMaps)
594 const ListStore *pStore = get_model_by_name(elem.m_sValue.toUtf8());
595 SAL_WARN_IF(!pListBoxTarget && !pComboBoxTarget && !pTreeBoxTarget,
"vcl",
"missing elements of combobox");
596 if (pListBoxTarget && pStore)
597 mungeModel(*pListBoxTarget, *pStore, elem.m_nActiveId);
598 else if (pComboBoxTarget && pStore)
599 mungeModel(*pComboBoxTarget, *pStore, elem.m_nActiveId);
600 else if (pTreeBoxTarget && pStore)
601 mungeModel(*pTreeBoxTarget, *pStore, elem.m_nActiveId);
605 for (
auto const& elem : m_pParserState->m_aTextBufferMaps)
608 const TextBuffer *pBuffer = get_buffer_by_name(elem.m_sValue.toUtf8());
609 SAL_WARN_IF(!pTarget || !pBuffer,
"vcl",
"missing elements of textview/textbuffer");
610 if (pTarget && pBuffer)
611 mungeTextBuffer(*pTarget, *pBuffer);
615 for (
auto const& elem : m_pParserState->m_aNumericFormatterAdjustmentMaps)
618 const Adjustment *pAdjustment = get_adjustment_by_name(elem.m_sValue.toUtf8());
619 SAL_WARN_IF(!pTarget,
"vcl",
"missing NumericFormatter element of spinbutton/adjustment");
620 SAL_WARN_IF(!pAdjustment,
"vcl",
"missing Adjustment element of spinbutton/adjustment");
621 if (pTarget && pAdjustment)
622 mungeAdjustment(*pTarget, *pAdjustment);
625 for (
auto const& elem : m_pParserState->m_aFormattedFormatterAdjustmentMaps)
628 const Adjustment *pAdjustment = get_adjustment_by_name(elem.m_sValue.toUtf8());
629 SAL_WARN_IF(!pTarget,
"vcl",
"missing FormattedField element of spinbutton/adjustment");
630 SAL_WARN_IF(!pAdjustment,
"vcl",
"missing Adjustment element of spinbutton/adjustment");
631 if (pTarget && pAdjustment)
632 mungeAdjustment(*pTarget, *pAdjustment);
636 for (
auto const& elem : m_pParserState->m_aScrollAdjustmentMaps)
638 ScrollBar *pTarget = get<ScrollBar>(elem.m_sID);
639 const Adjustment *pAdjustment = get_adjustment_by_name(elem.m_sValue.toUtf8());
640 SAL_WARN_IF(!pTarget || !pAdjustment,
"vcl",
"missing elements of scrollbar/adjustment");
641 if (pTarget && pAdjustment)
642 mungeAdjustment(*pTarget, *pAdjustment);
646 for (
auto const& elem : m_pParserState->m_aSliderAdjustmentMaps)
648 Slider* pTarget =
dynamic_cast<Slider*
>(
get(elem.m_sID));
649 const Adjustment* pAdjustment = get_adjustment_by_name(elem.m_sValue.toUtf8());
650 SAL_WARN_IF(!pTarget || !pAdjustment,
"vcl",
"missing elements of scale(slider)/adjustment");
651 if (pTarget && pAdjustment)
653 mungeAdjustment(*pTarget, *pAdjustment);
658 for (
auto const& sizeGroup : m_pParserState->m_aSizeGroups)
660 std::shared_ptr<VclSizeGroup> xGroup(std::make_shared<VclSizeGroup>());
662 for (
auto const& elem : sizeGroup.m_aProperties)
664 const OString &rKey = elem.first;
665 const OUString &
rValue = elem.second;
666 xGroup->set_property(rKey, rValue);
669 for (
auto const& elem : sizeGroup.m_aWidgets)
677 std::set<OUString> aImagesToBeRemoved;
678 for (
auto const& elem : m_pParserState->m_aButtonImageWidgetMaps)
682 Button *pTarget =
nullptr;
686 pTargetButton = get<PushButton>(elem.m_sID);
687 pTarget = pTargetButton;
691 pTargetRadio = get<RadioButton>(elem.m_sID);
692 pTarget = pTargetRadio;
695 FixedImage *pImage = get<FixedImage>(elem.m_sValue.toUtf8());
697 "vcl",
"missing elements of button/image/stock");
698 if (!pTarget || !pImage)
700 aImagesToBeRemoved.insert(elem.m_sValue);
733 auto aFind = m_pParserState->m_aImageSizeMap.find(elem.m_sValue.toUtf8());
734 if (aFind != m_pParserState->m_aImageSizeMap.end())
736 switch (aFind->second)
754 SAL_WARN(
"vcl.builder",
"unsupported image size " << aFind->second);
757 m_pParserState->m_aImageSizeMap.erase(aFind);
763 for (
auto const& elem : aImagesToBeRemoved)
765 delete_by_name(elem.toUtf8());
769 for (
auto const& elem : m_pParserState->m_aButtonMenuMaps)
771 MenuButton *pTarget = get<MenuButton>(elem.m_sID);
772 PopupMenu *pMenu = get_menu(elem.m_sValue.toUtf8());
774 "vcl",
"missing elements of button/menu");
775 if (!pTarget || !pMenu)
782 for (
auto const& elem : m_pParserState->m_aRedundantParentWidgets)
784 delete_by_window(elem.first);
788 for (
auto const& elem : m_pParserState->m_aExpanderWidgets)
792 if (pLabel && pLabel != pChild && pLabel->
GetType() == WindowType::FIXEDTEXT)
795 elem->set_label(pLabelWidget->
GetText());
798 delete_by_window(pLabel);
803 for (
auto const& elem : m_pParserState->m_aMessageDialogs)
804 elem->create_message_area();
807 m_pParserState.reset();
809 SAL_WARN_IF(!m_sID.isEmpty() && (!m_bToplevelParentFound && !get_by_name(m_sID)),
"vcl.builder",
810 "Requested top level widget \"" << m_sID <<
"\" not found in " << sUIFile);
812 #if defined SAL_LOG_WARN
813 if (m_bToplevelParentFound && m_pParent->IsDialog())
816 bool bHasDefButton =
false;
817 for (
auto const& child : m_aChildren)
819 if (isButtonType(child.m_pWindow->GetType()))
824 bHasDefButton =
true;
829 SAL_WARN_IF(nButtons && !bHasDefButton,
"vcl.builder",
"No default button defined in " << sUIFile);
834 officecfg::Office::Common::Help::HelpRootURL::get().isEmpty();
849 for (std::vector<WinAndId>::reverse_iterator aI = m_aChildren.rbegin(),
850 aEnd = m_aChildren.rend(); aI != aEnd; ++aI)
852 aI->m_pWindow.disposeAndClear();
856 for (std::vector<MenuAndId>::reverse_iterator aI =
m_aMenus.rbegin(),
857 aEnd =
m_aMenus.rend(); aI != aEnd; ++aI)
859 aI->m_pMenu.disposeAndClear();
869 bool bHasFrame =
true;
870 VclBuilder::stringmap::iterator aFind = rMap.find(
"has-frame");
871 if (aFind != rMap.end())
873 bHasFrame =
toBool(aFind->second);
881 bool bDrawValue =
true;
882 VclBuilder::stringmap::iterator aFind = rMap.find(
"draw-value");
883 if (aFind != rMap.end())
885 bDrawValue =
toBool(aFind->second);
894 VclBuilder::stringmap::iterator aFind = rMap.find(
"popup");
895 if (aFind != rMap.end())
897 sRet = aFind->second;
906 VclBuilder::stringmap::iterator aFind = rMap.find(
"name");
907 if (aFind != rMap.end())
909 sRet = aFind->second;
917 OUString sRet(
"top");
918 VclBuilder::stringmap::iterator aFind = rMap.find(
"value-pos");
919 if (aFind != rMap.end())
921 sRet = aFind->second;
929 OUString sRet(
"normal");
930 VclBuilder::stringmap::iterator aFind = rMap.find(
"type-hint");
931 if (aFind != rMap.end())
933 sRet = aFind->second;
941 bool bResizable =
true;
942 VclBuilder::stringmap::iterator aFind = rMap.find(
"resizable");
943 if (aFind != rMap.end())
945 bResizable =
toBool(aFind->second);
951 #if HAVE_FEATURE_DESKTOP
955 VclBuilder::stringmap::iterator aFind = rMap.find(
"modal");
956 if (aFind != rMap.end())
958 bModal =
toBool(aFind->second);
967 bool bDecorated =
true;
968 VclBuilder::stringmap::iterator aFind = rMap.find(
"decorated");
969 if (aFind != rMap.end())
971 bDecorated =
toBool(aFind->second);
979 bool bCloseable =
true;
980 VclBuilder::stringmap::iterator aFind = rMap.find(
"deletable");
981 if (aFind != rMap.end())
983 bCloseable =
toBool(aFind->second);
991 bool bHasEntry =
false;
992 VclBuilder::stringmap::iterator aFind = rMap.find(
"has-entry");
993 if (aFind != rMap.end())
995 bHasEntry =
toBool(aFind->second);
1003 bool bVertical =
false;
1004 VclBuilder::stringmap::iterator aFind = rMap.find(
"orientation");
1005 if (aFind != rMap.end())
1007 bVertical = aFind->second.equalsIgnoreAsciiCase(
"vertical");
1015 bool bVertical =
false;
1016 VclBuilder::stringmap::iterator aFind = rMap.find(
"tab-pos");
1017 if (aFind != rMap.end())
1019 bVertical = aFind->second.equalsIgnoreAsciiCase(
"left") ||
1020 aFind->second.equalsIgnoreAsciiCase(
"right");
1028 bool bInconsistent =
false;
1029 VclBuilder::stringmap::iterator aFind = rMap.find(
"inconsistent");
1030 if (aFind != rMap.end())
1032 bInconsistent =
toBool(aFind->second);
1035 return bInconsistent;
1043 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"pixbuf"));
1044 if (aFind != rMap.end())
1046 sIconName = aFind->second;
1051 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"icon-name"));
1052 if (aFind != rMap.end())
1054 sIconName = aFind->second;
1058 if (sIconName ==
"missing-image")
1060 OUString sReplace = mapStockToImageResource(sIconName);
1061 return !sReplace.isEmpty() ? sReplace : sIconName;
1067 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"relief"));
1068 if (aFind != rMap.end())
1070 if (aFind->second ==
"half")
1072 else if (aFind->second ==
"none")
1082 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"label"));
1083 if (aFind != rMap.end())
1085 sType = aFind->second;
1093 OUString sActionName;
1094 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"action-name"));
1095 if (aFind != rMap.end())
1097 sActionName = aFind->second;
1106 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"visible"));
1107 if (aFind != rMap.end())
1109 bRet =
toBool(aFind->second);
1117 OUString sWidthRequest(
"0");
1118 OUString sHeightRequest(
"0");
1119 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"width-request"));
1120 if (aFind != rMap.end())
1122 sWidthRequest = aFind->second;
1125 aFind = rMap.find(
"height-request");
1126 if (aFind != rMap.end())
1128 sHeightRequest = aFind->second;
1131 return Size(sWidthRequest.toInt32(), sHeightRequest.toInt32());
1136 OUString sTooltipText;
1137 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"tooltip-text"));
1138 if (aFind == rMap.end())
1139 aFind = rMap.find(OString(
"tooltip-markup"));
1140 if (aFind != rMap.end())
1142 sTooltipText = aFind->second;
1145 return sTooltipText;
1151 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"alignment"));
1152 if (aFind != rMap.end())
1154 f = aFind->second.toFloat();
1163 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"title"));
1164 if (aFind != rMap.end())
1166 sTitle = aFind->second;
1174 bool bHeadersVisible =
true;
1175 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"headers-visible"));
1176 if (aFind != rMap.end())
1178 bHeadersVisible =
toBool(aFind->second);
1181 return bHeadersVisible;
1186 bool bSortIndicator =
false;
1187 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"sort-indicator"));
1188 if (aFind != rMap.end())
1190 bSortIndicator =
toBool(aFind->second);
1193 return bSortIndicator;
1198 bool bClickable =
false;
1199 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"clickable"));
1200 if (aFind != rMap.end())
1202 bClickable =
toBool(aFind->second);
1213 OUString
aCommand(extractActionName(rMap));
1224 if (!aTooltip.isEmpty())
1239 nBits |= extractRelief(rMap);
1249 nBits |= extractRelief(rMap);
1259 nBits |= extractRelief(rMap);
1268 if (extractResizable(rMap))
1270 if (extractCloseable(rMap))
1272 if (!extractDecorated(rMap))
1274 OUString sType(extractTypeHint(rMap));
1275 if (sType ==
"utility")
1277 else if (sType ==
"popup-menu")
1279 else if (sType ==
"dock")
1289 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"group"));
1290 if (aFind != rMap.end())
1292 OUString sID = aFind->second;
1293 sal_Int32 nDelim = sID.indexOf(
':');
1295 sID = sID.copy(0, nDelim);
1303 if (!rAdjustment.isEmpty())
1304 m_pParserState->m_aNumericFormatterAdjustmentMaps.emplace_back(
id, rAdjustment);
1309 if (!rAdjustment.isEmpty())
1310 m_pParserState->m_aFormattedFormatterAdjustmentMaps.emplace_back(
id, rAdjustment);
1315 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"adjustment"));
1316 if (aFind != rMap.end())
1318 rAdjustmentMap.emplace_back(
id, aFind->second);
1329 sal_Int32 nActiveId = 0;
1330 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"active"));
1331 if (aFind != rMap.end())
1333 nActiveId = aFind->second.toInt32();
1341 bool bSelectable =
false;
1342 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"selectable"));
1343 if (aFind != rMap.end())
1345 bSelectable =
toBool(aFind->second);
1353 OUString sAdjustment;
1354 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"adjustment"));
1355 if (aFind != rMap.end())
1357 sAdjustment= aFind->second;
1366 bool bDrawIndicator =
false;
1367 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"draw-indicator"));
1368 if (aFind != rMap.end())
1370 bDrawIndicator =
toBool(aFind->second);
1373 return bDrawIndicator;
1379 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"model"));
1380 if (aFind != rMap.end())
1383 extractActive(rMap));
1390 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"buffer"));
1391 if (aFind != rMap.end())
1393 m_pParserState->m_aTextBufferMaps.emplace_back(
id, aFind->second);
1401 auto aFind = rMap.find(OString(
"icon-size"));
1402 if (aFind != rMap.end())
1403 nSize = aFind->second.toInt32();
1409 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"image"));
1410 if (aFind != rMap.end())
1412 m_pParserState->m_aButtonImageWidgetMaps.emplace_back(
id, aFind->second, bRadio);
1419 VclBuilder::stringmap::iterator aFind = rMap.find(OString(
"mnemonic-widget"));
1420 if (aFind != rMap.end())
1422 OUString sID = aFind->second;
1423 sal_Int32 nDelim = sID.indexOf(
':');
1425 sID = sID.copy(0, nDelim);
1426 m_pParserState->m_aMnemonicWidgetMaps.emplace_back(rLabelID, sID);
1436 if (pParent && pParent->
GetType() == WindowType::SCROLLWINDOW)
1440 rWinStyle |= nScrollBits;
1441 if (static_cast<VclScrolledWindow*>(pParent)->HasVisibleBorder())
1453 rMap[OString(
"width-request")] = OUString::number(nWidthReq);
1455 rMap[OString(
"height-request")] = OUString::number(nHeightReq);
1457 m_pParserState->m_aRedundantParentWidgets[pScrollParent] = pWindow;
1460 #ifndef DISABLE_DYNLOADING
1467 class NoAutoUnloadModule :
public osl::Module
1470 ~NoAutoUnloadModule() { release(); }
1475 typedef std::map<OUString, std::shared_ptr<NoAutoUnloadModule>>
ModuleMap;
1478 #if ENABLE_MERGELIBS
1479 static std::shared_ptr<NoAutoUnloadModule> g_pMergedLib = std::make_shared<NoAutoUnloadModule>();
1482 #ifndef SAL_DLLPREFIX
1483 # define SAL_DLLPREFIX ""
1492 #ifndef DISABLE_DYNLOADING
1494 #if ENABLE_MERGELIBS
1499 static const char *aWidgetLibs[] = {
1502 for (
const auto & lib : aWidgetLibs)
1504 std::unique_ptr<NoAutoUnloadModule> pModule(
new NoAutoUnloadModule);
1506 if (pModule->loadRelative(&
thisModule, sModule))
1507 g_aModuleMap.insert(std::make_pair(sModule, std::move(pModule)));
1509 #endif // ENABLE_MERGELIBS
1510 #endif // DISABLE_DYNLOADING
1515 #if defined DISABLE_DYNLOADING && !HAVE_FEATURE_DESKTOP
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)
1535 ModuleMap::iterator aI = g_aModuleMap.find(sModule);
1536 if (aI == g_aModuleMap.end())
1538 std::shared_ptr<NoAutoUnloadModule> pModule;
1539 #if ENABLE_MERGELIBS
1540 if (!g_pMergedLib->is())
1542 if ((pFunction = reinterpret_cast<VclBuilder::customMakeWidget>(
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));
1571 g_aModuleMap.insert(std::make_pair(sModule, pModule));
1575 aI->second->getFunctionSymbol(sFunction));
1576 #elif !HAVE_FEATURE_DESKTOP
1577 pFunction = lo_get_custom_widget_func(sFunction.toUtf8().getStr());
1578 SAL_WARN_IF(!pFunction,
"vcl.builder",
"Could not find " << sFunction);
1582 osl_getFunctionSymbol((oslModule)RTLD_DEFAULT, sFunction.pData));
1592 bool bIsPlaceHolder = name.isEmpty();
1593 bool bVertical =
false;
1595 if (pParent && (pParent->
GetType() == WindowType::TABCONTROL ||
1596 pParent->
GetType() == WindowType::VERTICALTABCONTROL))
1598 bool bTopLevel(name ==
"GtkDialog" || name ==
"GtkMessageDialog" ||
1599 name ==
"GtkWindow" || name ==
"GtkPopover" || name ==
"GtkAssistant");
1602 if (pParent->
GetType() == WindowType::TABCONTROL)
1607 sal_uInt16 nNewPageCount = pTabControl->
GetPageCount()+1;
1608 sal_uInt16 nNewPageId = nNewPageCount;
1609 pTabControl->
InsertPage(nNewPageId, OUString());
1611 SAL_WARN_IF(bIsPlaceHolder,
"vcl.builder",
"we should have no placeholders for tabpages");
1612 if (!bIsPlaceHolder)
1620 OString::number(nNewPageCount);
1621 m_aChildren.emplace_back(sTabPageId, pPage,
false);
1632 SAL_WARN_IF(bIsPlaceHolder,
"vcl.builder",
"we should have no placeholders for tabpages");
1633 if (!bIsPlaceHolder)
1639 if (bIsPlaceHolder || name ==
"GtkTreeSelection")
1642 ToolBox *pToolBox = (pParent && pParent->
GetType() == WindowType::TOOLBOX) ? static_cast<ToolBox*>(pParent) :
nullptr;
1647 if (name ==
"GtkDialog" || name ==
"GtkAssistant")
1653 if (extractResizable(rMap))
1655 if (extractCloseable(rMap))
1658 if (name ==
"GtkAssistant")
1662 #if HAVE_FEATURE_DESKTOP
1663 if (!extractModal(rMap))
1664 xWindow->
SetType(WindowType::MODELESSDIALOG);
1667 else if (name ==
"GtkMessageDialog")
1670 if (extractResizable(rMap))
1681 else if (name ==
"GtkBox" || name ==
"GtkStatusbar")
1683 bVertical = extractOrientation(rMap);
1689 else if (name ==
"GtkPaned")
1691 bVertical = extractOrientation(rMap);
1697 else if (name ==
"GtkHBox")
1699 else if (name ==
"GtkVBox")
1701 else if (name ==
"GtkButtonBox")
1703 bVertical = extractOrientation(rMap);
1709 else if (name ==
"GtkHButtonBox")
1711 else if (name ==
"GtkVButtonBox")
1713 else if (name ==
"GtkGrid")
1715 else if (name ==
"GtkFrame")
1717 else if (name ==
"GtkExpander")
1721 xWindow = pExpander;
1723 else if (name ==
"GtkButton" || (!
m_bLegacy && name ==
"GtkToggleButton"))
1727 if (sMenu.isEmpty())
1728 xButton = extractStockAndBuildPushButton(pParent, rMap, name ==
"GtkToggleButton");
1732 xButton = extractStockAndBuildMenuButton(pParent, rMap);
1736 setupFromActionName(xButton, rMap,
m_xFrame);
1739 else if (name ==
"GtkMenuButton")
1743 OUString sMenu = extractPopupMenu(rMap);
1744 if (!sMenu.isEmpty())
1747 OUString sType = extractWidgetName(rMap);
1748 if (sType.isEmpty())
1750 xButton = extractStockAndBuildMenuButton(pParent, rMap);
1755 xButton = extractStockAndBuildMenuToggleButton(pParent, rMap);
1760 if (!extractDrawIndicator(rMap))
1763 setupFromActionName(xButton, rMap,
m_xFrame);
1766 else if (name ==
"GtkToggleButton" &&
m_bLegacy)
1770 assert(sMenu.getLength() &&
"not implemented yet");
1771 xButton = extractStockAndBuildMenuToggleButton(pParent, rMap);
1773 xButton->SetImageAlign(ImageAlign::Left);
1774 setupFromActionName(xButton, rMap,
m_xFrame);
1777 else if (name ==
"GtkRadioButton")
1785 else if (name ==
"GtkCheckButton")
1788 bool bIsTriState = extractInconsistent(rMap);
1797 xWindow = xCheckBox;
1799 else if (name ==
"GtkSpinButton")
1801 OUString sAdjustment = extractAdjustment(rMap);
1804 if (extractHasFrame(rMap))
1812 else if (name ==
"GtkLinkButton")
1814 else if (name ==
"GtkComboBox" || name ==
"GtkComboBoxText")
1825 if (extractEntry(rMap))
1829 xWindow = xComboBox;
1838 else if (name ==
"VclOptionalBox" || name ==
"sfxlo-OptionalBox")
1843 else if (name ==
"svtlo-ManagedMenuButton")
1849 if (!sMenu.isEmpty())
1851 setupFromActionName(static_cast<Button*>(xWindow.
get()), rMap,
m_xFrame);
1853 else if (name ==
"sfxlo-PriorityMergedHBox")
1858 else if (name ==
"sfxlo-PriorityHBox")
1863 else if (name ==
"sfxlo-DropdownBox")
1868 else if (name ==
"sfxlo-ContextVBox")
1873 else if (name ==
"GtkIconView")
1875 assert(rMap.find(OString(
"model")) != rMap.end() &&
"GtkIconView must have a model");
1885 xWindowForPackingProps = xBox;
1891 if (pRealParent != pParent)
1894 else if (name ==
"GtkTreeView")
1898 assert(rMap.find(OString(
"model")) != rMap.end() &&
"GtkTreeView must have a model");
1913 if (!sBorder.isEmpty())
1925 xWindowForPackingProps = xWindow;
1930 bool bHeadersVisible = extractHeadersVisible(rMap);
1931 if (bHeadersVisible)
1934 OString containerid(
id +
"-container");
1936 m_aChildren.emplace_back(containerid, xContainer,
true);
1940 OString headerid(
id +
"-header");
1942 m_aChildren.emplace_back(headerid, xHeader,
true);
1950 xWindowForPackingProps = xContainer;
1955 xWindowForPackingProps = xBox;
1964 if (pRealParent != pParent)
1967 else if (name ==
"GtkTreeViewColumn")
1975 if (extractClickable(rMap))
1977 if (extractSortIndicator(rMap))
1979 float fAlign = extractAlignment(rMap);
1982 else if (fAlign == 1.0)
1984 else if (fAlign == 0.5)
1986 auto nItemId = pHeaderBar->GetItemCount() + 1;
1987 OUString sTitle(extractTitle(rMap));
1988 pHeaderBar->InsertItem(nItemId, sTitle, 100, nBits);
1992 else if (name ==
"GtkLabel")
1996 if (extractSelectable(rMap))
2001 else if (name ==
"GtkImage")
2004 OUString sIconName = extractIconName(rMap);
2005 if (!sIconName.isEmpty())
2008 xWindow = xFixedImage;
2014 rMap[
"visible"] =
"false";
2017 else if (name ==
"GtkSeparator")
2019 bVertical = extractOrientation(rMap);
2022 else if (name ==
"GtkScrollbar")
2025 bVertical = extractOrientation(rMap);
2028 else if (name ==
"GtkProgressBar")
2031 bVertical = extractOrientation(rMap);
2034 else if (name ==
"GtkScrolledWindow")
2038 else if (name ==
"GtkViewport")
2042 else if (name ==
"GtkEventBox")
2046 else if (name ==
"GtkEntry")
2049 if (extractHasFrame(rMap))
2054 else if (name ==
"GtkNotebook")
2056 if (!extractVerticalTabPos(rMap))
2061 else if (name ==
"GtkDrawingArea")
2065 else if (name ==
"GtkTextView")
2073 if (pRealParent != pParent)
2076 else if (name ==
"GtkSpinner")
2080 else if (name ==
"GtkScale")
2083 bool bDrawValue = extractDrawValue(rMap);
2086 OUString sValuePos = extractValuePos(rMap);
2089 bVertical = extractOrientation(rMap);
2095 else if (name ==
"GtkToolbar")
2099 else if(name ==
"NotebookBarAddonsToolMergePoint")
2101 customMakeWidget pFunction = GetCustomMakeWidget(
"sfxlo-NotebookbarToolBox");
2102 if(pFunction !=
nullptr)
2106 else if (name ==
"GtkToolButton" || name ==
"GtkMenuToolButton" ||
2107 name ==
"GtkToggleToolButton" || name ==
"GtkRadioToolButton" || name ==
"GtkToolItem")
2111 OUString
aCommand(extractActionName(rMap));
2113 sal_uInt16 nItemId = 0;
2115 if (name ==
"GtkMenuToolButton")
2117 else if (name ==
"GtkToggleToolButton")
2119 else if (name ==
"GtkRadioToolButton")
2122 if (!aCommand.isEmpty() &&
m_xFrame.is())
2125 nItemId = pToolBox->
GetItemId(aCommand);
2131 pToolBox->
InsertItem(nItemId, extractLabel(rMap), nBits);
2133 aCommand = OUString::fromUtf8(
id);
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);
2185 if (xWindow->
GetType() == WindowType::PUSHBUTTON)
2186 setupFromActionName(static_cast<Button*>(xWindow.
get()), rMap,
m_xFrame);
2187 else if (xWindow->
GetType() == WindowType::MENUBUTTON)
2190 if (!sMenu.isEmpty())
2192 setupFromActionName(static_cast<Button*>(xWindow.
get()), rMap,
m_xFrame);
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 " <<
2211 m_aChildren.emplace_back(
id, xWindow, bVertical);
2230 bool isConsideredGtkPseudo(
vcl::Window const *pWindow)
2232 return pWindow->
GetType() == WindowType::TABPAGE;
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] =
"25";
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::UNKNOWN },
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;
2484 if (m_pParent && !isConsideredGtkPseudo(m_pParent) && !m_sID.isEmpty() && rID == m_sID)
2486 pCurrentChild = m_pParent;
2495 m_bToplevelHasDeferredInit =
false;
2501 m_bToplevelHasDeferredInit =
false;
2504 if (pCurrentChild->
GetHelpId().isEmpty())
2506 pCurrentChild->
SetHelpId(m_sHelpRoot + m_sID);
2507 SAL_INFO(
"vcl.builder",
"for toplevel dialog " <<
this <<
" " <<
2508 rID <<
", set helpid " << pCurrentChild->
GetHelpId());
2510 m_bToplevelParentFound =
true;
2517 if (pParent == m_pParent.get() && m_bToplevelHasDeferredInit)
2519 pCurrentChild = makeObject(pParent, rClass, rID, rProps);
2524 pCurrentChild->
set_id(OStringToOUString(rID, RTL_TEXTENCODING_UTF8));
2525 if (pCurrentChild == m_pParent.
get() && m_bToplevelHasDeferredProperties)
2526 m_aDeferredProperties = rProps;
2530 for (
auto const& elem : rPango)
2532 const OString &rKey = elem.first;
2533 const OUString &rValue = elem.second;
2537 m_pParserState->m_aAtkInfo[pCurrentChild] = rAtk;
2546 bool bToolbarParent = (pParent && pParent->
GetType() == WindowType::TOOLBOX);
2547 pCurrentChild = (m_aChildren.empty() || bToolbarParent) ? pParent : m_aChildren.back().m_pWindow.get();
2549 return pCurrentChild;
2554 TabControl *pTabControl = pParent && pParent->
GetType() == WindowType::TABCONTROL ?
2557 std::vector<OString> sIDs;
2562 std::vector<vcl::EnumContext::Context> context;
2575 if (name ==
"object")
2583 sal_Int32 nDelim = sID.indexOf(
':');
2586 OString sPattern = sID.copy(nDelim+1);
2587 aProperties[OString(
"customproperty")] = OUString::fromUtf8(sPattern);
2588 sID = sID.copy(0, nDelim);
2590 sIDs.push_back(sID);
2594 else if (name ==
"style")
2597 context = handleStyle(reader, nPriority);
2600 else if (name ==
"property")
2601 collectProperty(reader, aProperties);
2602 else if (pTabControl && name ==
"child")
2605 handleChild(
nullptr, &aAtkProperties, reader);
2625 assert(pTabControl || pVerticalTabControl);
2626 VclBuilder::stringmap::iterator aFind = aProperties.find(OString(
"label"));
2627 if (aFind != aProperties.end())
2629 OUString sTooltip(extractTooltipText(aProperties));
2636 if (!context.empty())
2642 for (
auto const& prop : aAtkProperties)
2644 const OString &rKey = prop.first;
2645 const OUString &rValue = prop.second;
2647 if (rKey ==
"AtkObject::accessible-name")
2649 else if (rKey ==
"AtkObject::accessible-description")
2652 SAL_INFO(
"vcl.builder",
"unhandled atk property: " << rKey);
2659 OUString sIconName(extractIconName(aProperties));
2684 if (nLeftA < nLeftB)
2686 if (nLeftA > nLeftB)
2691 if (ePackA < ePackB)
2693 if (ePackA > ePackB)
2695 bool bVerticalContainer = m_pBuilder->get_window_packing_data(pA->
GetParent()).m_bVerticalOrient;
2698 if (!bVerticalContainer)
2701 if (bPackA > bPackB)
2703 if (bPackA < bPackB)
2709 if (bPackA < bPackB)
2711 if (bPackA > bPackB)
2717 sal_Int32 nPackA = m_pBuilder->get_window_packing_data(pA).m_nPosition;
2718 sal_Int32 nPackB = m_pBuilder->get_window_packing_data(pB).m_nPosition;
2719 if (nPackA < nPackB)
2721 if (nPackA > nPackB)
2730 int nFramePosA = (pA == pLabel) ? 0 : 1;
2731 int nFramePosB = (pB == pLabel) ? 0 : 1;
2732 return nFramePosA < nFramePosB;
2744 OString sType, sInternalChild;
2753 else if (name ==
"internal-child")
2756 sInternalChild = OString(name.
begin, name.
length);
2762 handleTabChild(pParent, reader);
2774 if (name ==
"object" || name ==
"placeholder")
2776 pCurrentChild = handleObject(pParent, pAtkProps, reader).get();
2778 bool bObjectInserted = pCurrentChild && pParent != pCurrentChild;
2780 if (bObjectInserted)
2784 if (!sInternalChild.isEmpty())
2785 pCurrentChild->
Show();
2788 if (pCurrentChild->
GetType() == WindowType::TABCONTROL)
2800 if (sType ==
"label")
2802 if (
VclFrame *pFrameParent = dynamic_cast<VclFrame*>(pParent))
2803 pFrameParent->designate_label(pCurrentChild);
2805 if (sInternalChild.startsWith(
"vbox") || sInternalChild.startsWith(
"messagedialog-vbox"))
2807 if (
Dialog *pBoxParent = dynamic_cast<Dialog*>(pParent))
2808 pBoxParent->set_content_area(static_cast<VclBox*>(pCurrentChild));
2810 else if (sInternalChild.startsWith(
"action_area") || sInternalChild.startsWith(
"messagedialog-action_area"))
2813 if (
Dialog *pBoxParent = dynamic_cast<Dialog*>(pContentArea ? pContentArea->
GetParent() :
nullptr))
2815 pBoxParent->set_action_area(static_cast<VclButtonBox*>(pCurrentChild));
2819 bool bIsButtonBox =
dynamic_cast<VclButtonBox*
>(pCurrentChild) !=
nullptr;
2823 std::vector<vcl::Window*> aChilds;
2829 if (
PushButton* pPushButton = dynamic_cast<PushButton*>(pChild))
2830 pPushButton->setAction(
true);
2833 aChilds.push_back(pChild);
2843 else if (name ==
"packing")
2845 handlePacking(pCurrentChild, pParent, reader);
2847 else if (name ==
"interface")
2851 if (name ==
"domain")
2890 else if (span ==
"value")
2897 if (!sProperty.isEmpty())
2898 rMap[sProperty] = OUString::fromUtf8(sValue);
2916 else if (span ==
"target")
2920 sal_Int32 nDelim = sValue.indexOf(
':');
2922 sValue = sValue.copy(0, nDelim);
2926 if (!sProperty.isEmpty())
2927 rMap[sProperty] = OUString::fromUtf8(sValue);
2946 if (!sProperty.isEmpty())
2947 rMap[
"role"] = OUString::fromUtf8(sProperty);
2972 bool bTranslated =
false;
2981 nId = OString(name.
begin, name.
length).toUInt32();
2983 else if (nId == 0 && name ==
"translatable" && reader.
getAttributeValue(
false) ==
"yes")
2987 else if (name ==
"context")
2998 OUString sFinalValue;
3001 if (!sContext.isEmpty())
3002 sValue = sContext +
"\004" + sValue;
3003 sFinalValue =
Translate::get(sValue.getStr(), m_pParserState->m_aResLocale);
3006 sFinalValue = OUString::fromUtf8(sValue);
3009 if (aRow.size() < nId+1)
3011 aRow[nId] = sFinalValue;
3024 m_pParserState->m_aModels[rID].m_aEntries.push_back(aRow);
3046 bool bNotTreeStore = rClass !=
"GtkTreeStore";
3048 handleRow(reader, rID);
3049 assert(bNotTreeStore &&
"gtk, as the time of writing, doesn't support data in GtkTreeStore serialization");
3085 if (name ==
"property")
3086 collectProperty(reader, aProperties);
3104 for (
auto const& prop : rProperties)
3106 const OString &rKey = prop.first;
3107 const OUString &rValue = prop.second;
3109 if (pWindow && rKey.match(
"AtkObject::"))
3110 pWindow->
set_property(rKey.copy(RTL_CONSTASCII_LENGTH(
"AtkObject::")), rValue);
3112 SAL_WARN(
"vcl.builder",
"unhandled atk prop: " << rKey);
3120 std::vector<ComboBoxTextItem> aItems;
3138 bool bTranslated =
false;
3139 OString sContext,
sId;
3147 else if (name ==
"context")
3152 else if (name ==
"id")
3163 OUString sFinalValue;
3166 if (!sContext.isEmpty())
3167 sValue = sContext +
"\004" + sValue;
3168 sFinalValue =
Translate::get(sValue.getStr(), m_pParserState->m_aResLocale);
3171 sFinalValue = OUString::fromUtf8(sValue);
3173 if (m_pStringReplace)
3174 sFinalValue = (*m_pStringReplace)(sFinalValue);
3176 aItems.emplace_back(sFinalValue, sId);
3200 pCurrentMenu->
set_id(OStringToOUString(rID, RTL_TEXTENCODING_UTF8));
3219 if (name ==
"child")
3221 handleMenuChild(pCurrentMenu, reader);
3226 if (name ==
"property")
3227 collectProperty(reader, aProperties);
3240 m_aMenus.emplace_back(rID, pCurrentMenu);
3242 return pCurrentMenu;
3258 if (name ==
"object" || name ==
"placeholder")
3260 handleMenuObject(pParent, reader);
3281 OUString sCustomProperty;
3289 if (name ==
"class")
3294 else if (name ==
"id")
3300 sal_Int32 nDelim = sID.indexOf(
':');
3303 sCustomProperty = OUString::fromUtf8(sID.subView(nDelim+1));
3304 sID = sID.copy(0, nDelim);
3316 if (!sCustomProperty.isEmpty())
3317 aProperties[OString(
"customproperty")] = sCustomProperty;
3329 if (name ==
"child")
3331 size_t nChildMenuIdx = m_aMenus.size();
3332 handleChild(
nullptr, &aAtkProperties, reader);
3333 bool bSubMenuInserted = m_aMenus.size() > nChildMenuIdx;
3334 if (bSubMenuInserted)
3335 pSubMenu =
dynamic_cast<PopupMenu*
>(m_aMenus[nChildMenuIdx].m_pMenu.get());
3340 if (name ==
"property")
3341 collectProperty(reader, aProperties);
3342 else if (name ==
"accelerator")
3343 collectAccelerator(reader, aAccelerators);
3356 insertMenuObject(pParent, pSubMenu, sClass, sID, aProperties, aAtkProperties, aAccelerators);
3361 m_pParserState->m_aSizeGroups.emplace_back();
3362 SizeGroup &rSizeGroup = m_pParserState->m_aSizeGroups.back();
3380 if (name ==
"widget")
3388 sal_Int32 nDelim = sWidget.indexOf(
':');
3390 sWidget = sWidget.copy(0, nDelim);
3397 if (name ==
"property")
3414 vcl::KeyCode makeKeyCode(
const std::pair<OString,OString> &rKey)
3416 bool bShift = rKey.second.indexOf(
"GDK_SHIFT_MASK") != -1;
3417 bool bMod1 = rKey.second.indexOf(
"GDK_CONTROL_MASK") != -1;
3418 bool bMod2 = rKey.second.indexOf(
"GDK_MOD1_MASK") != -1;
3419 bool bMod3 = rKey.second.indexOf(
"GDK_MOD2_MASK") != -1;
3421 if (rKey.first ==
"Insert")
3423 else if (rKey.first ==
"Delete")
3425 else if (rKey.first ==
"Return")
3427 else if (rKey.first ==
"Up")
3429 else if (rKey.first ==
"Down")
3431 else if (rKey.first ==
"Left")
3433 else if (rKey.first ==
"Right")
3435 else if (rKey.first ==
"asterisk")
3437 else if (rKey.first.getLength() > 1 && rKey.first[0] ==
'F')
3439 sal_uInt32
nIndex = rKey.first.copy(1).toUInt32();
3440 assert(nIndex >= 1 && nIndex <= 26);
3444 assert (rKey.first.getLength() == 1);
3445 char cChar = rKey.first.toChar();
3447 if (cChar >=
'a' && cChar <=
'z')
3449 else if (cChar >=
'A' && cChar <=
'Z')
3451 else if (cChar >=
'0' && cChar <=
'9')
3454 return vcl::KeyCode(cChar, bShift, bMod1, bMod2, bMod3);
3462 sal_uInt16 nNewId = ++m_pParserState->m_nLastMenuItemId;
3464 if(rClass ==
"NotebookBarAddonsMenuMergePoint")
3467 m_pParserState->m_nLastMenuItemId = pParent->
GetItemCount();
3469 else if (rClass ==
"GtkMenuItem")
3472 OUString
aCommand(extractActionName(rProps));
3478 else if (rClass ==
"GtkCheckMenuItem")
3481 OUString
aCommand(extractActionName(rProps));
3485 else if (rClass ==
"GtkRadioMenuItem")
3488 OUString
aCommand(extractActionName(rProps));
3492 else if (rClass ==
"GtkSeparatorMenuItem")
3501 pParent->
SetHelpId(nNewId, m_sHelpRoot + rID);
3502 if (!extractVisible(rProps))
3505 for (
auto const& prop : rProps)
3507 const OString &rKey = prop.first;
3508 const OUString &rValue = prop.second;
3510 if (rKey ==
"tooltip-markup")
3512 else if (rKey ==
"tooltip-text")
3515 SAL_INFO(
"vcl.builder",
"unhandled property: " << rKey);
3518 for (
auto const& prop : rAtkProps)
3520 const OString &rKey = prop.first;
3521 const OUString &rValue = prop.second;
3523 if (rKey ==
"AtkObject::accessible-name")
3525 else if (rKey ==
"AtkObject::accessible-description")
3528 SAL_INFO(
"vcl.builder",
"unhandled atk property: " << rKey);
3531 for (
auto const& accel : rAccels)
3533 const OString &rSignal = accel.first;
3534 const auto &rValue = accel.second;
3536 if (rSignal ==
"activate")
3537 pParent->
SetAccelKey(nNewId, makeKeyCode(rValue));
3539 SAL_INFO(
"vcl.builder",
"unhandled accelerator for: " << rSignal);
3549 std::vector<std::unique_ptr<OUString>>& rUserData,
3550 const std::vector<ComboBoxTextItem> &rItems)
3552 T *pContainer =
dynamic_cast<T*
>(pWindow);
3556 sal_uInt16 nActiveId = extractActive(rMap);
3557 for (
auto const& item : rItems)
3559 sal_Int32
nPos = pContainer->InsertEntry(item.m_sItem);
3560 if (!item.m_sId.isEmpty())
3562 rUserData.emplace_back(std::make_unique<OUString>(OUString::fromUtf8(item.m_sId)));
3563 pContainer->SetEntryData(nPos, rUserData.back().get());
3566 if (nActiveId < rItems.size())
3567 pContainer->SelectEntryPos(nActiveId);
3576 OUString sCustomProperty;
3583 if (name ==
"class")
3588 else if (name ==
"id")
3594 sal_Int32 nDelim = sID.indexOf(
':');
3597 sCustomProperty = OUString::fromUtf8(sID.subView(nDelim+1));
3598 sID = sID.copy(0, nDelim);
3604 if (sClass ==
"GtkListStore" || sClass ==
"GtkTreeStore")
3606 handleListStore(reader, sID, sClass);
3609 else if (sClass ==
"GtkMenu")
3611 handleMenu(reader, sID,
false);
3614 else if (sClass ==
"GtkMenuBar")
3618 pTopLevel->SetMenuBar(dynamic_cast<MenuBar*>(xMenu.
get()));
3621 else if (sClass ==
"GtkSizeGroup")
3623 handleSizeGroup(reader);
3626 else if (sClass ==
"AtkObject")
3628 assert((pParent || pAtkProps) &&
"must have one set");
3629 assert(!(pParent && pAtkProps) &&
"must not have both");
3630 auto aAtkProperties = handleAtkObject(reader);
3632 applyAtkProperties(pParent, aAtkProperties);
3634 *pAtkProps = aAtkProperties;
3642 std::vector<ComboBoxTextItem> aItems;
3644 if (!sCustomProperty.isEmpty())
3645 aProperties[OString(
"customproperty")] = sCustomProperty;
3658 if (name ==
"child")
3662 pCurrentChild = insertObject(pParent, sClass, sID,
3663 aProperties, aPangoAttributes, aAtkAttributes);
3665 handleChild(pCurrentChild,
nullptr, reader);
3667 else if (name ==
"items")
3668 aItems = handleItems(reader);
3669 else if (name ==
"style")
3672 std::vector<vcl::EnumContext::Context> aContext = handleStyle(reader, nPriority);
3676 SAL_WARN_IF(!pPrioritable,
"vcl",
"priority set for not supported item");
3680 if (!aContext.empty())
3683 SAL_WARN_IF(!pContextControl,
"vcl",
"context set for not supported item");
3684 if (pContextControl)
3691 if (name ==
"property")
3692 collectProperty(reader, aProperties);
3693 else if (name ==
"attribute")
3694 collectPangoAttribute(reader, aPangoAttributes);
3695 else if (name ==
"relation")
3696 collectAtkRelationAttribute(reader, aAtkAttributes);
3697 else if (name ==
"role")
3698 collectAtkRoleAttribute(reader, aAtkAttributes);
3699 else if (name ==
"action-widget")
3700 handleActionWidget(reader);
3713 if (sClass ==
"GtkAdjustment")
3715 m_pParserState->m_aAdjustments[sID] = aProperties;
3718 else if (sClass ==
"GtkTextBuffer")
3720 m_pParserState->m_aTextBuffers[sID] = aProperties;
3726 pCurrentChild = insertObject(pParent, sClass, sID, aProperties,
3727 aPangoAttributes, aAtkAttributes);
3730 if (!aItems.empty())
3733 if (!insertItems<ComboBox>(pCurrentChild, aProperties, m_aUserData, aItems))
3734 insertItems<ListBox>(pCurrentChild, aProperties, m_aUserData, aItems);
3737 return pCurrentChild;
3758 if (name ==
"property")
3759 applyPackingProperty(pCurrent, pParent, reader);
3781 ToolBox *pToolBoxParent =
nullptr;
3782 if (pCurrent == pParent)
3783 pToolBoxParent =
dynamic_cast<ToolBox*
>(pParent);
3788 if (pCurrent->
GetType() == WindowType::SCROLLWINDOW)
3790 auto aFind = m_pParserState->m_aRedundantParentWidgets.find(
VclPtr<vcl::Window>(pCurrent));
3791 if (aFind != m_pParserState->m_aRedundantParentWidgets.end())
3793 pCurrent = aFind->second;
3804 sKey = sKey.replace(
'_',
'-');
3809 if (sKey ==
"expand" || sKey ==
"resize")
3811 bool bTrue = (!sValue.isEmpty() && (sValue[0] ==
't' || sValue[0] ==
'T' || sValue[0] ==
'1'));
3813 pToolBoxParent->
SetItemExpand(m_pParserState->m_nLastToolbarId, bTrue);
3824 bool bTrue = (!sValue.isEmpty() && (sValue[0] ==
't' || sValue[0] ==
'T' || sValue[0] ==
'1'));
3827 else if (sKey ==
"pack-type")
3832 else if (sKey ==
"left-attach")
3836 else if (sKey ==
"top-attach")
3840 else if (sKey ==
"width")
3844 else if (sKey ==
"height")
3848 else if (sKey ==
"padding")
3852 else if (sKey ==
"position")
3854 set_window_packing_position(pCurrent, sValue.toInt32());
3856 else if (sKey ==
"secondary")
3860 else if (sKey ==
"non-homogeneous")
3864 else if (sKey ==
"homogeneous")
3870 SAL_WARN(
"vcl.builder",
"unknown packing: " << sKey);
3878 std::vector<vcl::EnumContext::Context> aContext;
3896 if (name ==
"class")
3898 OString classStyle = getStyleClass(reader);
3900 if (classStyle.startsWith(
"context-"))
3902 OString sContext = classStyle.copy(classStyle.indexOf(
'-') + 1);
3903 OUString sContext2(sContext.getStr(), sContext.getLength(), RTL_TEXTENCODING_UTF8);
3906 else if (classStyle.startsWith(
"priority-"))
3908 OString aPriority = classStyle.copy(classStyle.indexOf(
'-') + 1);
3909 OUString aPriority2(aPriority.getStr(), aPriority.getLength(), RTL_TEXTENCODING_UTF8);
3910 nPriority = aPriority2.toInt32();
3912 else if (classStyle !=
"small-button")
3914 SAL_WARN(
"vcl.builder",
"unknown class: " << classStyle);
3954 OString sProperty, sContext;
3956 bool bTranslated =
false;
3965 else if (name ==
"context")
3978 OUString sFinalValue;
3981 if (!sContext.isEmpty())
3982 sValue = sContext +
"\004" + sValue;
3983 sFinalValue =
Translate::get(sValue.getStr(), m_pParserState->m_aResLocale);
3986 sFinalValue = OUString::fromUtf8(sValue);
3988 if (!sProperty.isEmpty())
3990 sProperty = sProperty.replace(
'_',
'-');
3991 if (m_pStringReplace)
3992 sFinalValue = (*m_pStringReplace)(sFinalValue);
3993 rMap[sProperty] = sFinalValue;
4006 if (name ==
"response")
4015 sal_Int32 nDelim = sID.indexOf(
':');
4017 sID = sID.copy(0, nDelim);
4018 set_response(sID, sResponse.toInt32());
4037 else if (name ==
"signal")
4042 else if (name ==
"modifiers")
4049 if (!sProperty.isEmpty() && !sValue.isEmpty())
4051 rMap[sProperty] = std::make_pair(sValue, sModifiers);
4057 return m_aChildren.empty() ?
nullptr : m_aChildren[0].m_pWindow.get();
4062 for (
auto const& child : m_aChildren)
4064 if (child.m_sID == sID)
4065 return child.m_pWindow;
4073 for (
auto const& menu : m_aMenus)
4075 if (menu.m_sID == sID)
4076 return dynamic_cast<PopupMenu*
>(menu.m_pMenu.get());
4105 assert(nResponse >= 100 &&
"keep non-canned responses in range 100+ to avoid collision with vcl RET_*");
4109 for (
const auto & child : m_aChildren)
4111 if (child.m_sID == sID)
4117 pDialog->
add_button(pPushButton, nResponse,
false);
4127 auto aI = std::find_if(m_aChildren.begin(), m_aChildren.end(),
4128 [&sID](
WinAndId& rItem) {
return rItem.m_sID == sID; });
4129 if (aI != m_aChildren.end())
4131 aI->m_pWindow.disposeAndClear();
4132 m_aChildren.erase(aI);
4138 drop_ownership(pWindow);
4144 auto aI = std::find_if(m_aChildren.begin(), m_aChildren.end(),
4145 [&pWindow](
WinAndId& rItem) {
return rItem.m_pWindow == pWindow; });
4146 if (aI != m_aChildren.end())
4147 m_aChildren.erase(aI);
4152 for (
auto const& child : m_aChildren)
4154 if (child.m_pWindow == pWindow)
4169 for (
auto const& child : m_aChildren)
4171 if (child.m_pWindow == pPropHolder)
4172 return child.m_aPackingData;
4180 for (
auto & child : m_aChildren)
4182 if (child.m_pWindow == pWindow)
4183 child.m_aPackingData.m_nPosition = nPosition;
4189 std::map<OString, ListStore>::const_iterator aI = m_pParserState->m_aModels.find(sID);
4190 if (aI != m_pParserState->m_aModels.end())
4191 return &(aI->second);
4197 std::map<OString, TextBuffer>::const_iterator aI = m_pParserState->m_aTextBuffers.find(sID);
4198 if (aI != m_pParserState->m_aTextBuffers.end())
4199 return &(aI->second);
4205 std::map<OString, Adjustment>::const_iterator aI = m_pParserState->m_aAdjustments.find(sID);
4206 if (aI != m_pParserState->m_aAdjustments.end())
4207 return &(aI->second);
4217 if (rRow.size() > 1)
4221 sal_Int32
nValue = rRow[1].toInt32();
4222 rTarget.
SetEntryData(nEntry, reinterpret_cast<void*>(nValue));
4226 if (!rRow[1].isEmpty())
4228 m_aUserData.emplace_back(std::make_unique<OUString>(rRow[1]));
4229 rTarget.
SetEntryData(nEntry, m_aUserData.back().get());
4244 if (rRow.size() > 1)
4248 sal_Int32
nValue = rRow[1].toInt32();
4249 rTarget.
SetEntryData(nEntry, reinterpret_cast<void*>(nValue));
4253 if (!rRow[1].isEmpty())
4255 m_aUserData.emplace_back(std::make_unique<OUString>(rRow[1]));
4256 rTarget.
SetEntryData(nEntry, m_aUserData.back().get());
4271 if (rRow.size() > 1)
4275 sal_Int32
nValue = rRow[1].toInt32();
4276 pEntry->SetUserData(reinterpret_cast<void*>(nValue));
4280 if (!rRow[1].isEmpty())
4282 m_aUserData.emplace_back(std::make_unique<OUString>(rRow[1]));
4283 pEntry->SetUserData(m_aUserData.back().get());
4299 for (
auto const& elem : rAdjustment)
4301 const OString &rKey = elem.first;
4302 const OUString &rValue = elem.second;
4304 if (rKey ==
"upper")
4306 sal_Int64 nUpper = rValue.toDouble() * nMul;
4310 else if (rKey ==
"lower")
4312 sal_Int64 nLower = rValue.toDouble() * nMul;
4316 else if (rKey ==
"value")
4318 sal_Int64
nValue = rValue.toDouble() * nMul;
4321 else if (rKey ==
"step-increment")
4323 sal_Int64 nSpinSize = rValue.toDouble() * nMul;
4328 SAL_INFO(
"vcl.builder",
"unhandled property :" << rKey);
4335 double nMaxValue = 0, nMinValue = 0,
nValue = 0, nSpinSize = 0;
4337 for (
auto const& elem : rAdjustment)
4339 const OString &rKey = elem.first;
4340 const OUString &rValue = elem.second;
4342 if (rKey ==
"upper")
4343 nMaxValue = rValue.toDouble();
4344 else if (rKey ==
"lower")
4345 nMinValue = rValue.toDouble();
4346 else if (rKey ==
"value")
4347 nValue = rValue.toDouble();
4348 else if (rKey ==
"step-increment")
4349 nSpinSize = rValue.toDouble();
4351 SAL_INFO(
"vcl.builder",
"unhandled property :" << rKey);
4363 for (
auto const& elem : rAdjustment)
4365 const OString &rKey = elem.first;
4366 const OUString &rValue = elem.second;
4368 if (rKey ==
"upper")
4370 else if (rKey ==
"lower")
4372 else if (rKey ==
"value")
4374 else if (rKey ==
"step-increment")
4376 else if (rKey ==
"page-increment")
4380 SAL_INFO(
"vcl.builder",
"unhandled property :" << rKey);
4387 for (
auto const& elem : rAdjustment)
4389 const OString &rKey = elem.first;
4390 const OUString &rValue = elem.second;
4392 if (rKey ==
"upper")
4394 else if (rKey ==
"lower")
4396 else if (rKey ==
"value")
4398 else if (rKey ==
"step-increment")
4400 else if (rKey ==
"page-increment")
4404 SAL_INFO(
"vcl.builder",
"unhandled property :" << rKey);
4411 for (
auto const& elem : rTextBuffer)
4413 const OString &rKey = elem.first;
4414 const OUString &rValue = elem.second;
4420 SAL_INFO(
"vcl.builder",
"unhandled property :" << rKey);
4426 : m_nLastToolbarId(0)
4427 , m_nLastMenuItemId(0)
static bool toBool(std::string_view rValue)
#define LINK(Instance, Class, Member)
Size GetSizePixel() const
void delete_by_window(vcl::Window *pWindow)
void set_mnemonic_widget(vcl::Window *pWindow)
virtual SvTreeListEntry * InsertEntry(const OUString &rText, SvTreeListEntry *pParent=nullptr, bool bChildrenOnDemand=false, sal_uLong nPos=TREELIST_APPEND, void *pUserData=nullptr) override
WinBits const WB_DOCKABLE
vcl::Window * ImplGetWindow() const
if this is a proxy return the client, otherwise itself
void handleMenuObject(Menu *pParent, xmlreader::XmlReader &reader)
MenuAndId(const OString &rId, Menu *pMenu)
const LocaleDataWrapper & GetLocaleDataWrapper() const
void SetRangeMax(tools::Long nNewRange)
void set_height_request_by_rows(int nRows)
static Image loadThemeImage(const OUString &rFileName)
void extractBuffer(const OString &id, stringmap &rVec)
WinBits const WB_SYSTEMWINDOW
SystemWindow * GetSystemWindow() const
void set_border_width(sal_Int32 nBorderWidth)
PackingData get_window_packing_data(const vcl::Window *pWindow) const
void SetNoAutoCurEntry(bool b)
virtual bool iter_parent(TreeIter &rIter) const =0
VclBuilder(vcl::Window *pParent, const OUString &sUIRootDir, const OUString &sUIFile, const OString &sID=OString(), const css::uno::Reference< css::frame::XFrame > &rFrame=css::uno::Reference< css::frame::XFrame >(), bool bLegacy=true, const NotebookBarAddonsItem *pNotebookBarAddonsItem=nullptr)
sal_Int32 get_grid_top_attach() const
void set_grid_width(sal_Int32 nCols)
static JSInstanceBuilder * CreateAutofilterWindowBuilder(vcl::Window *pParent, const OUString &rUIRoot, const OUString &rUIFile)
size_t GetAbsPos(const weld::TreeView &rTreeView, const weld::TreeIter &rIter)
void set_grid_left_attach(sal_Int32 nAttach)
A widget used to choose from a list of items and which has no entry.
void handleSizeGroup(xmlreader::XmlReader &reader)
WinBits const WB_HASBUTTONSATROOT
static void applyAtkProperties(vcl::Window *pWindow, const stringmap &rProperties)
static Context GetContextEnum(const OUString &rsContextName)
void delete_by_name(const OString &sID)
#define SAL_INFO_IF(condition, area, stream)
void set_non_homogeneous(bool bNonHomogeneous)
const Image & GetImage() const
static const AllSettings & GetSettings()
Gets the application's settings.
constexpr sal_uInt16 KEY_A
constexpr sal_uInt16 KEY_0
void handleRow(xmlreader::XmlReader &reader, const OString &rID)
OUString GetLabelForCommand(const css::uno::Sequence< css::beans::PropertyValue > &rProperties)
Return a label for the given command.
void connectFormattedFormatterAdjustment(const OString &id, const OUString &rAdjustment)
css::uno::Reference< css::lang::XComponent > m_xFrame
VclPtr< vcl::Window > handleObject(vcl::Window *pParent, stringmap *pAtkProps, xmlreader::XmlReader &reader)
virtual Size GetSizePixel() const
virtual void SetSizePixel(const Size &rNewSize)
void SetAccessibleRelationLabelFor(vcl::Window *pLabelFor)
void extractButtonImage(const OString &id, stringmap &rMap, bool bRadio)
std::vector< OUString > row
std::vector< OString > m_aWidgets
SAL_DLLPRIVATE WindowImpl * ImplGetWindowImpl() const
static weld::Builder * CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false)
static void collectPangoAttribute(xmlreader::XmlReader &reader, stringmap &rMap)
TabPage * GetTabPage(sal_uInt16 nPageId) const
WinBits const WB_AUTOVSCROLL
void handleListStore(xmlreader::XmlReader &reader, const OString &rID, std::string_view rClass)
void set_height_request(sal_Int32 nHeightRequest)
virtual weld::Builder * CreateInterimBuilder(vcl::Window *pParent, const OUString &rUIRoot, const OUString &rUIFile, bool bAllowCycleFocusOut, sal_uInt64 nLOKWindowId=0)
std::map< OString, std::pair< OString, OString > > accelmap
void VclBuilderPreload()
Pre-loads all modules containing UI information.
void SetHelpId(const OString &)
stringmap m_aDeferredProperties
void set_pack_type(VclPackType ePackType)
bool IsControlFont() const
void SetState(TriState eState)
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage)
void SetType(WindowType nType)
ResHookProc GetReadStringHook()
void SetQuickHelpText(const OUString &rHelpText)
std::vector< row > m_aEntries
Dialog * GetParentDialog() const
static void mungeAdjustment(NumericFormatter &rTarget, const Adjustment &rAdjustment)
constexpr sal_uInt16 KEY_UP
virtual std::unique_ptr< TreeIter > make_iterator(const TreeIter *pOrig=nullptr) const =0
void set_properties(vcl::Window *pWindow, const VclBuilder::stringmap &rProps)
constexpr sal_uInt16 KEY_F1
void SetEntryData(sal_Int32 nPos, void *pNewData)
void set_window_packing_position(const vcl::Window *pWindow, sal_Int32 nPosition)
static OString getStyleClass(xmlreader::XmlReader &reader)
static int getImageSize(const stringmap &rMap)
css::uno::Any const & rValue
void SetAccessibleName(sal_uInt16 nItemId, const OUString &rStr)
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.
void MergeNotebookBarMenuAddons(Menu *pPopupMenu, sal_Int16 nItemId, const OString &sItemIdName, NotebookBarAddonsItem &aNotebookBarAddonsItem)
WinBits const WB_OWNERDRAWDECORATION
void insertMenuObject(Menu *pParent, PopupMenu *pSubMenu, const OString &rClass, const OString &rID, stringmap &rProps, stringmap &rAtkProps, accelmap &rAccels)
virtual weld::Window * GetFrameWeld(const css::uno::Reference< css::awt::XWindow > &rWindow)
std::locale Create(const char *pPrefixName, const LanguageTag &rLocale)
void EnableAutoSize(bool bAuto)
PropertiesInfo aProperties
WinBits const WB_DEFBUTTON
static void mungeTextBuffer(VclMultiLineEdit &rTarget, const TextBuffer &rTextBuffer)
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
static weld::Builder * CreateInterimBuilder(vcl::Window *pParent, const OUString &rUIFile, bool bAllowCycleFocusOut, sal_uInt64 nLOKWindowId=0)
IMPL_LINK(CustomWeld, DoResize, const Size &, rSize, void)
void reorderWithinParent(vcl::Window &rWindow, sal_uInt16 nNewPosition)
void SetThumbPos(tools::Long nThumbPos)
VclPtr< vcl::Window > makeObject(vcl::Window *pParent, const OString &rClass, const OString &rID, stringmap &rVec)
void mungeModel(ListBox &rTarget, const ListStore &rStore, sal_uInt16 nActiveId)
void SetAccessibleRelationMemberOf(vcl::Window *pMemberOf)
void set_width_request(sal_Int32 nWidthRequest)
virtual OUString GetText() const
void SetCurPageId(sal_uInt16 nPageId)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
std::unique_ptr< TreeView > m_xTreeView
void MergeNotebookBarAddons(vcl::Window *pParent, const VclBuilder::customMakeWidget &pFunction, const css::uno::Reference< css::frame::XFrame > &m_xFrame, const NotebookBarAddonsItem &aNotebookBarAddonsItem, VclBuilder::stringmap &rMap)
WinBits const WB_BEVELBUTTON
bool get_secondary() const
sal_uInt16 GetPageCount() const
static ModuleMap g_aModuleMap
void drop_ownership(const vcl::Window *pWindow)
void extractGroup(const OString &id, stringmap &rVec)
bool IsDockingWindow() const
void set_fill(bool bFill)
OUString GetStock() const
constexpr sal_uInt16 KEY_DOWN
void SetHighlightRange(sal_uInt16 nFirstTab=0, sal_uInt16 nLastTab=0xffff)
OUString extractCustomProperty(VclBuilder::stringmap &rMap)
static OUString GetUIRootDir()
Image GetImageForCommand(const OUString &rsCommandName, const Reference< frame::XFrame > &rxFrame, vcl::ImageType eImageType)
WinBits const WB_DIALOGCONTROL
ImplSVData * ImplGetSVData()
Use given parent or get a default one using GetDefaultParent(...)
std::map< OUString, std::shared_ptr< NoAutoUnloadModule > > ModuleMap
#define DBG_UNHANDLED_EXCEPTION(...)
const OString & GetHelpId() const
void collectProperty(xmlreader::XmlReader &reader, stringmap &rVec) const
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.
void SetAccessibleDescription(sal_uInt16 nItemId, const OUString &rStr)
virtual void doDeferredInit(WinBits nBits)
static vcl::Window * prepareWidgetOwnScrolling(vcl::Window *pParent, WinBits &rWinStyle)
OUString GetModuleIdentifier(const Reference< frame::XFrame > &rxFrame)
OString get_by_window(const vcl::Window *pWindow) const
bool IsSystemWindow() const
void SetPageText(sal_uInt16 nPageId, const OUString &rText)
void set_secondary(bool bSecondary)
void SetAccessibleRelationLabeledBy(vcl::Window *pLabeledBy)
void SelectEntryPos(sal_Int32 nPos, bool bSelect=true)
WinBits const WB_SIMPLEMODE
virtual void SetText(const OUString &rStr) override
void handleMenuChild(Menu *pParent, xmlreader::XmlReader &reader)
bool m_bToplevelHasDeferredProperties
PopupMenu * get_menu(std::string_view sID)
static weld::Window * GetFrameWeld(const css::uno::Reference< css::awt::XWindow > &rWindow)
void EnableTriState(bool bTriState=true)
tools::Long Width() const
static void collectAtkRelationAttribute(xmlreader::XmlReader &reader, stringmap &rMap)
virtual bool iter_next(TreeIter &rIter) const =0
std::map< OString, OUString > stringmap
vcl::Window * get_widget_root()
void add_button(PushButton *pButton, int nResponse, bool bTransferOwnership)
WinBits const WB_SMALLSTYLE
Size get_preferred_size() const
sal_Int32 InsertEntry(const OUString &rStr, sal_Int32 nPos=LISTBOX_APPEND)
VclPtr< vcl::Window > m_pParent
WinBits const WB_DROPDOWN
void SetImage(const Image &rImage)
virtual bool set_property(const OString &rKey, const OUString &rValue)
void reorderWithinParent(sal_uInt16 nNewPosition)
VclPackType get_pack_type() const
void cleanupWidgetOwnScrolling(vcl::Window *pScrollParent, vcl::Window *pWindow, stringmap &rMap)
vcl::Window * GetParent() const
VclPtr< vcl::Window > mpBorderWindow
void InsertPage(const OString &rPageId, const OUString &rLabel, const Image &rImage, const OUString &rTooltip, VclPtr< vcl::Window > xPage, int nPos=-1)
void SetStyle(WinBits nStyle)
constexpr sal_uInt16 KEY_RETURN
bool TextToValue(const OUString &rStr, double &rValue, sal_Int64 nBaseValue, sal_uInt16 nDecDigits, const LocaleDataWrapper &rLocaleDataWrapper, FieldUnit eUnit)
OUString convertMnemonicMarkup(const OUString &rIn)
vcl::Window * GetWindow(GetWindowType nType) const
constexpr sal_uInt16 KEY_RIGHT
void handleChild(vcl::Window *pParent, stringmap *pAtkProps, xmlreader::XmlReader &reader)
void SetSpaceBetweenEntries(short nSpace)
void applyPackingProperty(vcl::Window *pCurrent, vcl::Window *pParent, xmlreader::XmlReader &reader)
void set_grid_top_attach(sal_Int32 nAttach)
void set_grid_height(sal_Int32 nRows)
WinBits const WB_SIZEABLE
void setDeferredProperties()
Sequence< beans::PropertyValue > GetCommandProperties(const OUString &rsCommandName, const OUString &rsModuleName)
Return a label for the given command.
virtual Size GetOptimalSize() const override
void set_id(const OUString &rID)
Sets an ID.
void extractModel(const OString &id, stringmap &rVec)
A construction helper for a temporary VclPtr.
void extractMnemonicWidget(const OString &id, stringmap &rMap)
const Adjustment * get_adjustment_by_name(const OString &sID) const
void SetPageName(sal_uInt16 nPageId, const OString &rName) const
static void collectAtkRoleAttribute(xmlreader::XmlReader &reader, stringmap &rMap)
std::unique_ptr< ParserState > m_pParserState
static OUString formatPercent(double dNumber, const LanguageTag &rLangTag)
sal_Int32 get_height_request() const
const LanguageTag & getLanguageTag() const
void disposeBuilder()
releases references and disposes all children.
IMPL_LINK_NOARG(HexColorControl, OnAsyncModifyHdl, void *, void)
void connectNumericFormatterAdjustment(const OString &id, const OUString &rAdjustment)
void handleActionWidget(xmlreader::XmlReader &reader)
sal_Int32 get_grid_left_attach() const
void handlePacking(vcl::Window *pCurrent, vcl::Window *pParent, xmlreader::XmlReader &reader)
#define SAL_WARN_IF(condition, area, stream)
Span getAttributeValue(bool fullyNormalize)
void SetRangeMin(tools::Long nNewRange)
stringmap handleAtkObject(xmlreader::XmlReader &reader)
static std::vector< vcl::EnumContext::Context > handleStyle(xmlreader::XmlReader &reader, int &nPriority)
css::uno::Reference< css::frame::XFrame > m_xFrame
XFrame to be able to extract labels and other properties of the UNO commands (like of ...
vcl::Window * get_label_widget()
void handleTabChild(vcl::Window *pParent, xmlreader::XmlReader &reader)
#define SAL_INFO(area, stream)
sal_Int32 get_width_request() const
std::unique_ptr< weld::TreeView > m_xTreeView
VCL_DLLPRIVATE void SetEntryHeight(SvTreeListEntry const *pEntry)
virtual void doDeferredInit(WinBits nBits)
SvTreeListEntry * GetEntry(SvTreeListEntry *pParent, sal_uLong nPos) const
sal_uInt16 GetPageId(sal_uInt16 nPos) const
tools::Long AdjustWidth(tools::Long n)
vcl::Window * get_by_name(std::string_view sID)
static VclPtr< reference_type > Create(Arg &&...arg)
A construction helper for VclPtr.
VclPtr< vcl::Window > mpParent
std::unique_ptr< NotebookBarAddonsItem > m_pNotebookBarAddonsItem
virtual bool get_iter_first(TreeIter &rIter) const =0
std::vector< MenuAndId > m_aMenus
tools::Long Height() const
const TextBuffer * get_buffer_by_name(const OString &sID) const
std::vector< std::pair< OUString, FieldUnit > > FieldUnitStringList
void RemovePage(sal_uInt16 nPageId)
VclPtr< vcl::Window > insertObject(vcl::Window *pParent, const OString &rClass, const OString &rID, stringmap &rProps, stringmap &rPangoAttributes, stringmap &rAtkProps)
const ListStore * get_model_by_name(const OString &sID) const
WinBits const WB_AUTOHSCROLL
bool extractDropdown(VclBuilder::stringmap &rMap)
void SetContext(const std::vector< vcl::EnumContext::Context > &aContext)
bool set_font_attribute(const OString &rKey, const OUString &rValue)
static JSInstanceBuilder * CreateDialogBuilder(weld::Widget *pParent, const OUString &rUIRoot, const OUString &rUIFile)
sal_Int16 getRoleFromName(const OString &roleName)
void setHeight(tools::Long nHeight)
sal_Int64 ConvertValue(sal_Int64 nValue, sal_Int64 mnBaseValue, sal_uInt16 nDecDigits, FieldUnit eInUnit, FieldUnit eOutUnit)
A widget used to choose from a list of items and which has an entry.
WindowType GetType() const
WinBits const WB_HASBUTTONS
constexpr sal_uInt16 KEY_MULTIPLY
void SetTabPage(sal_uInt16 nPageId, TabPage *pPage)
VclPtr< Menu > handleMenu(xmlreader::XmlReader &reader, const OString &rID, bool bMenuBar)
void add_to_size_group(const std::shared_ptr< VclSizeGroup > &xGroup)
reference_type * get() const
Get the body.
bool nextAttribute(int *nsId, Span *localName)
static bool extractAdjustmentToMap(const OString &id, stringmap &rVec, std::vector< WidgetAdjustmentMap > &rAdjustmentMap)
#define SAL_WARN(area, stream)
VclPtr< vcl::Window > mpRealParent
void SetPriority(int nPriority)
void ensureDefaultWidthChars(VclBuilder::stringmap &rMap)
std::vector< ComboBoxTextItem > handleItems(xmlreader::XmlReader &reader) const
void(* f)(TrueTypeTable *)
virtual bool get_row_expanded(const TreeIter &rIter) const =0
OUString getNum(sal_Int64 nNumber, sal_uInt16 nDecimals, bool bUseThousandSep=true, bool bTrailingZeros=true) const
constexpr sal_uInt16 KEY_DELETE
OUString get(const char *pContextAndId, const std::locale &loc)
constexpr sal_uInt16 KEY_LEFT
bool Select(SvTreeListEntry *pEntry, bool bSelect=true)
Result nextItem(Text reportText, Span *data, int *nsId)
virtual weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage)
void SelectEntryPos(sal_Int32 nPos, bool bSelect=true)
WinBits const WB_CLOSEABLE
sal_Int32 InsertEntry(const OUString &rStr, sal_Int32 nPos=COMBOBOX_APPEND)
const FieldUnitStringList & ImplGetFieldUnits()
virtual weld::Builder * CreateBuilder(weld::Widget *pParent, const OUString &rUIRoot, const OUString &rUIFile)
WinBits const WB_MOVEABLE
static void collectAccelerator(xmlreader::XmlReader &reader, accelmap &rMap)
void SetPageSize(tools::Long nNewSize)
void SetEntryData(sal_Int32 nPos, void *pNewData)
void SetAccessibleRole(sal_uInt16 nRole)
WinBits const WB_FLATBUTTON
constexpr sal_uInt16 KEY_INSERT
vcl::Font GetControlFont() const
void InsertPage(sal_uInt16 nPageId, const OUString &rText, sal_uInt16 nPos=TAB_APPEND)
WinBits const WB_STDTABCONTROL
EntryTreeView(std::unique_ptr< Entry > xEntry, std::unique_ptr< TreeView > xTreeView)
static JSInstanceBuilder * CreateNotebookbarBuilder(vcl::Window *pParent, const OUString &rUIRoot, const OUString &rUIFile, const css::uno::Reference< css::frame::XFrame > &rFrame, sal_uInt64 nWindowId=0)
static SymbolType mapStockToSymbol(std::u16string_view icon_name)
bool operator()(const vcl::Window *pA, const vcl::Window *pB) const
OUString GetTooltipForCommand(const OUString &rsCommandName, const css::uno::Sequence< css::beans::PropertyValue > &rProperties, const Reference< frame::XFrame > &rxFrame)
WinBits const WB_CLIPCHILDREN
void SetLineSize(tools::Long nNewSize)
void EnableAutoSize(bool bAuto)
std::unique_ptr< Entry > m_xEntry
bool IsEntryVisible(const weld::TreeView &rTreeView, const weld::TreeIter &rIter)
void SetHelpText(sal_uInt16 nPageId, const OUString &rText)
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, bool bMobile=false)
virtual void SetText(const OUString &rStr) override
void SetQuickSearch(bool bEnable)
void set_padding(sal_Int32 nPadding)
vcl::Window * GetPageParent()
WinBits const WB_ALLOWMENUBAR
void set_response(std::string_view sID, short nResponse)
static void addKeyValue(SAL_UNUSED_PARAMETER const OUString &, SAL_UNUSED_PARAMETER const OUString &, SAL_UNUSED_PARAMETER tAddKeyHandling)
sal_uInt16 GetCurPageId() const
void set_expand(bool bExpand)
virtual int iter_compare(const TreeIter &a, const TreeIter &b) const =0
virtual int get_iter_depth(const TreeIter &rIter) const =0
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)