/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <memory> #include <map> #include <string_view> #include <vector> #ifdef check # //some problem with MacOSX and a check define # undef check #endif
class ComboBox; class FormattedField; class ListBox; class MessageDialog; class NumericFormatter; class ScrollBar; class SvTabListBox; class Slider; class VclExpander; class VclMultiLineEdit; struct NotebookBarAddonsItem; namespace com::sun::star::frame { class XFrame; }
/// Creates a hierarchy of vcl::Windows (widgets) from a .ui file for dialogs, sidebar, etc. class VCL_DLLPUBLIC VclBuilder final : public WidgetBuilder<vcl::Window, VclPtr<vcl::Window>, PopupMenu, VclPtr<PopupMenu>>
{ public: /// These functions create a new widget with parent pParent and return it in rRet typedefvoid (*customMakeWidget)(VclPtr<vcl::Window> &rRet, const VclPtr<vcl::Window> &pParent, stringmap &rVec);
//sID may not exist, but must be of type T if it does template <typename T = vcl::Window> T* get(std::u16string_view sID);
vcl::Window* get_widget_root();
//release ownership of pWindow, i.e. don't delete it void drop_ownership(const vcl::Window *pWindow);
//see m_aDeferredProperties, you need this for toplevel dialogs //which build themselves from their ctor. The properties on //the top level are stored in m_aDeferredProperties and need //to be applied post ctor void setDeferredProperties();
// owner for ListBox/ComboBox UserData
std::vector<std::unique_ptr<OUString>> m_aUserData;
//If the toplevel window has any properties which need to be set on it, //but the toplevel is the owner of the builder, then its ctor //has not been completed during the building, so properties for it //are collected here and need to be set afterwards, e.g. during //Show or Execute
stringmap m_aDeferredProperties;
/// XFrame to be able to extract labels and other properties of the UNO commands (like of .uno:Bold).
css::uno::Reference<css::frame::XFrame> m_xFrame;
private: // tweak newly inserted child depending on window type void tweakInsertedChild(vcl::Window *pParent, vcl::Window* pCurrentChild,
std::string_view sType, std::string_view sInternalChild) override;
// if bToolbarItem=true, pParent is the ToolBox that the item belongs to, since there's no widget for the item itself void applyAtkProperties(vcl::Window* pWindow, const stringmap& rProperties, bool bToolbarItem) override;
//add a default value of 25 width-chars to a map if width-chars not set void ensureDefaultWidthChars(VclBuilder::stringmap &rMap);
//Helpers to retrofit all the existing code to the builder void reorderWithinParent(std::vector< vcl::Window*>& rChilds, bool bIsButtonBox); void reorderWithinParent(vcl::Window &rWindow, sal_uInt16 nNewPosition);
//Convert an accessibility role name to accessibility role number
sal_Int16 getRoleFromName(std::u16string_view roleName);
}
//sID may not exist, but must be of type T if it does template <typename T> inline T* VclBuilder::get(std::u16string_view sID)
{
vcl::Window *w = get_by_name(sID);
SAL_WARN_IF(w && !dynamic_cast<T*>(w), "vcl.layout", ".ui widget \"" << OUStringToOString(sID, RTL_TEXTENCODING_UTF8)
<< "\" needs to correspond to vcl type " << typeid(T).name());
assert(!w || dynamic_cast<T*>(w)); returnstatic_cast<T*>(w);
}
/* * @return true if rValue is "True", "true", "1", etc.
*/
VCL_DLLPUBLIC bool toBool(std::u16string_view rValue);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.