[Libreoffice-commits] .: Branch 'feature/cmclayouttrans' - sw/source vcl/inc vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Aug 20 02:51:21 PDT 2012


 sw/source/ui/misc/numberingtypelistbox.cxx |   18 ++++++++++++++++++
 vcl/inc/vcl/builder.hxx                    |    1 +
 vcl/source/window/builder.cxx              |   10 +++++++++-
 3 files changed, 28 insertions(+), 1 deletion(-)

New commits:
commit 35ab221b8eda66d107bcc7122b7daf09d1229bc7
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Aug 20 10:50:32 2012 +0100

    add a mechanism to create custom widgets via VclBuilder
    
    Change-Id: Ia78ba7126de6a1b3dac3877e3eef9a30194f8777

diff --git a/sw/source/ui/misc/numberingtypelistbox.cxx b/sw/source/ui/misc/numberingtypelistbox.cxx
index 4f25c4b..82d81b8 100644
--- a/sw/source/ui/misc/numberingtypelistbox.cxx
+++ b/sw/source/ui/misc/numberingtypelistbox.cxx
@@ -58,6 +58,24 @@ SwNumberingTypeListBox::SwNumberingTypeListBox( Window* pWin, const ResId& rResI
     Reload(nTypeFlags);
 }
 
+SwNumberingTypeListBox::SwNumberingTypeListBox( Window* pWin, WinBits nStyle, sal_uInt16 nTypeFlags ) :
+    ListBox(pWin, nStyle),
+    pImpl(new SwNumberingTypeListBox_Impl)
+{
+    uno::Reference<uno::XComponentContext>          xContext( ::comphelper::getProcessComponentContext() );
+    uno::Reference<text::XDefaultNumberingProvider> xDefNum = text::DefaultNumberingProvider::create(xContext);
+
+    pImpl->xInfo = uno::Reference<text::XNumberingTypeInfo>(xDefNum, uno::UNO_QUERY);
+    Reload(nTypeFlags);
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSwNumberingTypeListBox(Window *pParent)
+{
+    SwNumberingTypeListBox *pListBox = new SwNumberingTypeListBox(pParent, WB_LEFT|WB_DROPDOWN|WB_VCENTER|WB_3DLOOK);
+    pListBox->SetDropDownLineCount(16);
+    return pListBox;
+}
+
 SwNumberingTypeListBox::~SwNumberingTypeListBox()
 {
     delete pImpl;
diff --git a/vcl/inc/vcl/builder.hxx b/vcl/inc/vcl/builder.hxx
index e43ac1b..48e8a47 100644
--- a/vcl/inc/vcl/builder.hxx
+++ b/vcl/inc/vcl/builder.hxx
@@ -42,6 +42,7 @@ class VCL_DLLPUBLIC VclBuilder
 {
 public:
     typedef std::map<rtl::OString, rtl::OString> stringmap;
+    typedef Window* (*customMakeWidget)(Window *pParent);
 private:
     struct WinAndId
     {
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index cd2b30b..b51ab9a 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -26,6 +26,7 @@
  * instead of those above.
  */
 
+#include <osl/module.h>
 #include <vcl/builder.hxx>
 #include <vcl/button.hxx>
 #include <vcl/dialog.hxx>
@@ -451,7 +452,14 @@ Window *VclBuilder::makeObject(Window *pParent, const rtl::OString &name, const
     else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkDrawingArea")))
         pWindow = new Window(pParent);
     else
-        fprintf(stderr, "TO-DO, implement %s\n", name.getStr());
+    {
+        rtl::OString sFunction = rtl::OString("make") + name;
+        customMakeWidget pFunction = (customMakeWidget)osl_getAsciiFunctionSymbol(NULL, sFunction.getStr());
+        if (pFunction)
+            pWindow = (*pFunction)(pParent);
+    }
+    if (!pWindow)
+        fprintf(stderr, "TO-DO, implement %s or add a make%s function\n", name.getStr(), name.getStr());
     if (pWindow)
     {
         pWindow->SetHelpId(m_sHelpRoot + id);


More information about the Libreoffice-commits mailing list