diff options
-rw-r--r-- | vcl/unx/gtk3/gtkinst.cxx | 102 |
1 files changed, 75 insertions, 27 deletions
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index afadbd7d80e5..09b4807a0126 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -7491,6 +7491,7 @@ public: } } }; +#endif void update_attr_list(PangoAttrList* pAttrList, const vcl::Font& rFont) { @@ -7573,6 +7574,7 @@ void set_font(GtkLabel* pLabel, const vcl::Font& rFont) pango_attr_list_unref(pAttrList); } +#if !GTK_CHECK_VERSION(4, 0, 0) class GtkInstanceButton : public GtkInstanceContainer, public virtual weld::Button { private: @@ -9987,7 +9989,12 @@ namespace break; } } +} +#endif + +namespace +{ gboolean filter_pango_attrs(PangoAttribute *attr, gpointer data) { PangoAttrType* pFilterAttrs = static_cast<PangoAttrType*>(data); @@ -9999,6 +10006,12 @@ namespace } return false; } +} + +#if !GTK_CHECK_VERSION(4, 0, 0) + +namespace +{ class GtkInstanceEntry : public GtkInstanceWidget, public virtual weld::Entry { @@ -14013,6 +14026,11 @@ public: } }; +} +#endif + +namespace { + class GtkInstanceLabel : public GtkInstanceWidget, public virtual weld::Label { private: @@ -14113,7 +14131,6 @@ public: }; } -#endif std::unique_ptr<weld::Label> GtkInstanceFrame::weld_label_widget() const { @@ -17537,7 +17554,10 @@ void ConvertTree(const Reference<css::xml::dom::XNode>& xNode) css::uno::Reference<css::xml::dom::XNode> xName = xMap->getNamedItem("name"); OUString sName(xName->getNodeValue().replace('_', '-')); if (sName == "type-hint" || sName == "skip-taskbar-hint" || - sName == "can-default" || sName == "has-default") + sName == "can-default" || sName == "has-default" || + sName == "border-width" || sName == "layout-style" || + sName == "has-focus" || sName == "no-show-all" || + sName == "ignore-hidden") { xRemoveList.push_back(xChild); } @@ -17551,6 +17571,8 @@ void ConvertTree(const Reference<css::xml::dom::XNode>& xNode) OUString sName(xName->getNodeValue()); if (sName == "vbox") xName->setNodeValue("content_area"); + else if (sName == "accessible") + xRemoveList.push_back(xChild); // Yikes!, what's the replacement for this going to be } } else if (xChild->getNodeName() == "object") @@ -17562,32 +17584,59 @@ void ConvertTree(const Reference<css::xml::dom::XNode>& xNode) xClass->setNodeValue("GtkBox"); } else if (xChild->getNodeName() == "packing") - xRemoveList.push_back(xChild); - -#if 0 - css::xml::dom::NodeType eChildType = xChild->getNodeType(); - switch ( eChildType ) { - case css::xml::dom::NodeType_ATTRIBUTE_NODE: - case css::xml::dom::NodeType_ELEMENT_NODE: - case css::xml::dom::NodeType_TEXT_NODE: - } -#endif + // remove "packing" and if its grid packing insert a replacement "layout" into + // the associated "object" + auto xDoc = xChild->getOwnerDocument(); + css::uno::Reference<css::xml::dom::XElement> xNew = xDoc->createElement("layout"); -#if 0 - if ( xChild->hasAttributes() ) - { - Reference< css::xml::dom::XNamedNodeMap > xMap = xChild->getAttributes(); - if ( xMap.is() ) + bool bGridPacking = false; + + // iterate over all children and append them to the new element + for (css::uno::Reference<css::xml::dom::XNode> xCurrent = xChild->getFirstChild(); + xCurrent.is(); + xCurrent = xChild->getFirstChild()) + { + css::uno::Reference<css::xml::dom::XNamedNodeMap> xMap = xCurrent->getAttributes(); + if (xMap.is()) + { + css::uno::Reference<css::xml::dom::XNode> xName = xMap->getNamedItem("name"); + OUString sName(xName->getNodeValue().replace('_', '-')); + if (sName == "left-attach") + { + xName->setNodeValue("column"); + bGridPacking = true; + } + if (sName == "top-attach") + { + xName->setNodeValue("row"); + bGridPacking = true; + } + } + xNew->appendChild(xChild->removeChild(xCurrent)); + } + + if (bGridPacking) { - sal_Int32 j, nMapLen = xMap->getLength(); - for ( j = 0; j < nMapLen; ++j ) + // go back to parent and find the object child and insert this "layout" as a + // new child of the object + auto xParent = xChild->getParentNode(); + auto xInsertIn = xParent->getFirstChild(); + for (css::uno::Reference<css::xml::dom::XNode> xObjectCandidate = xParent->getFirstChild(); + xObjectCandidate.is(); + xObjectCandidate = xObjectCandidate->getNextSibling()) { - Reference< css::xml::dom::XNode > xAttr = xMap->item(j); + if (xObjectCandidate->getNodeName() == "object") + { + xObjectCandidate->appendChild(xNew); + break; + } } } + + xRemoveList.push_back(xChild); } -#endif + if (!xChild->hasChildNodes()) continue; ConvertTree(xChild); @@ -18477,16 +18526,11 @@ public: virtual std::unique_ptr<weld::Label> weld_label(const OString &id) override { -#if !GTK_CHECK_VERSION(4, 0, 0) GtkLabel* pLabel = GTK_LABEL(gtk_builder_get_object(m_pBuilder, id.getStr())); if (!pLabel) return nullptr; auto_add_parentless_widgets_to_container(GTK_WIDGET(pLabel)); return std::make_unique<GtkInstanceLabel>(pLabel, this, false); -#else - (void)id; - return nullptr; -#endif } virtual std::unique_ptr<weld::TextView> weld_text_view(const OString &id) override @@ -18654,8 +18698,12 @@ void GtkInstanceWidget::help_hierarchy_foreach(const std::function<bool(const OS weld::Builder* GtkInstance::CreateBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile) { #if GTK_CHECK_VERSION(4, 0, 0) - if (rUIFile != "svt/ui/javadisableddialog.ui") + if (rUIFile != "svt/ui/javadisableddialog.ui" && + rUIFile != "modules/swriter/ui/wordcount.ui") + { + SAL_WARN( "vcl.gtk", rUIFile); return SalInstance::CreateBuilder(pParent, rUIRoot, rUIFile); + } #endif GtkInstanceWidget* pParentWidget = dynamic_cast<GtkInstanceWidget*>(pParent); if (pParent && !pParentWidget) //remove when complete |