[Libreoffice-commits] core.git: Branch 'feature/macOS-weld' - include/vcl vcl/inc vcl/Library_vclplug_osx.mk vcl/osx vcl/source
Tor Lillqvist (via logerrit)
logerrit at kemper.freedesktop.org
Fri Mar 6 10:08:10 UTC 2020
Rebased ref, commits from common ancestor:
commit 2a3b817a82ac0277d31d6c5de64fc22ad47d71f5
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Wed Mar 4 19:34:41 2020 +0200
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Fri Mar 6 12:07:31 2020 +0200
WIP: macOS welding
Not to be merged to master as such, contains lots of SAL_DEBUG and
other crack.
Change-Id: I5865118c6e4c34f0513ecbd2d759642bc15ad31a
diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx
index 3e22639569b8..109c3ba33613 100644
--- a/include/vcl/builder.hxx
+++ b/include/vcl/builder.hxx
@@ -504,7 +504,7 @@ protected:
/*
* @return true if rValue is "True", "true", "1", etc.
*/
-bool toBool(const OUString &rValue);
+bool VCL_DLLPUBLIC toBool(const OUString &rValue);
#endif
diff --git a/vcl/Library_vclplug_osx.mk b/vcl/Library_vclplug_osx.mk
index 6b94c6c25df1..01f34aec2b00 100644
--- a/vcl/Library_vclplug_osx.mk
+++ b/vcl/Library_vclplug_osx.mk
@@ -51,7 +51,9 @@ $(eval $(call gb_Library_use_libraries,vclplug_osx,\
sal \
salhelper \
tl \
+ utl \
vcl \
+ xmlreader \
))
$(eval $(call gb_Library_use_externals,vclplug_osx,\
diff --git a/vcl/inc/osx/salframe.h b/vcl/inc/osx/salframe.h
index 2fcdef3609e9..3e150a5fafdf 100644
--- a/vcl/inc/osx/salframe.h
+++ b/vcl/inc/osx/salframe.h
@@ -159,6 +159,8 @@ public:
// done setting up the clipregion
virtual void EndSetClipRegion() override;
+ virtual weld::Window* GetFrameWeld() const override;
+
void UpdateFrameGeometry();
// trigger painting of the window
diff --git a/vcl/inc/osx/salinst.h b/vcl/inc/osx/salinst.h
index edece53b6bea..f0701748145f 100644
--- a/vcl/inc/osx/salinst.h
+++ b/vcl/inc/osx/salinst.h
@@ -32,6 +32,8 @@
#include <osl/thread.hxx>
#ifdef MACOSX
+#include <com/sun/star/awt/XWindow.hpp>
+#include <cppuhelper/compbase.hxx>
#include <osx/osxvcltypes.h>
#endif
#include <salinst.hxx>
@@ -142,6 +144,9 @@ public:
// Is this the NSAppThread?
virtual bool IsMainThread() const override;
+ virtual weld::Builder* CreateBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile) override; virtual weld::MessageDialog* CreateMessageDialog(weld::Widget* pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage) override;
+ virtual weld::Window* GetFrameWeld(const css::uno::Reference<css::awt::XWindow>& rWindow) override;
+
void startedPrintJob() { mnActivePrintJobs++; }
void endedPrintJob() { mnActivePrintJobs--; }
@@ -157,6 +162,130 @@ public:
CGImageRef CreateCGImage( const Image& );
NSImage* CreateNSImage( const Image& );
+#ifdef MACOSX
+
+typedef cppu::WeakComponentImplHelper<css::awt::XWindow> SalAppKitXWindow_Base;
+
+class SalAppKitXWindow : public SalAppKitXWindow_Base
+{
+private:
+ osl::Mutex m_aHelperMtx;
+ weld::Window* m_pWeldWidget;
+ NSView* m_pView;
+
+public:
+
+ SalAppKitXWindow(weld::Window* pWeldWidget, NSView* pView)
+ : SalAppKitXWindow_Base(m_aHelperMtx)
+ , m_pWeldWidget(pWeldWidget)
+ , m_pView(pView)
+ {
+ }
+
+ void clear()
+ {
+ m_pWeldWidget = nullptr;
+ m_pView = nullptr;
+ }
+
+ NSView* getView() const
+ {
+ return m_pView;
+ }
+
+ weld::Window* getFrameWeld() const
+ {
+ return m_pWeldWidget;
+ }
+
+ // css::awt::XWindow
+ void SAL_CALL setPosSize(sal_Int32, sal_Int32, sal_Int32, sal_Int32, sal_Int16) override
+ {
+ throw css::uno::RuntimeException("not implemented");
+ }
+
+ css::awt::Rectangle SAL_CALL getPosSize() override
+ {
+ throw css::uno::RuntimeException("not implemented");
+ }
+
+ void SAL_CALL setVisible(sal_Bool) override
+ {
+ throw css::uno::RuntimeException("not implemented");
+ }
+
+ void SAL_CALL setEnable(sal_Bool) override
+ {
+ throw css::uno::RuntimeException("not implemented");
+ }
+
+ void SAL_CALL setFocus() override
+ {
+ throw css::uno::RuntimeException("not implemented");
+ }
+
+ void SAL_CALL addWindowListener(const css::uno::Reference< css::awt::XWindowListener >& ) override
+ {
+ throw css::uno::RuntimeException("not implemented");
+ }
+ void SAL_CALL removeWindowListener(const css::uno::Reference< css::awt::XWindowListener >& ) override
+ {
+ throw css::uno::RuntimeException("not implemented");
+ }
+
+ void SAL_CALL addFocusListener(const css::uno::Reference< css::awt::XFocusListener >& ) override
+ {
+ throw css::uno::RuntimeException("not implemented");
+ }
+
+ void SAL_CALL removeFocusListener(const css::uno::Reference< css::awt::XFocusListener >& ) override
+ {
+ throw css::uno::RuntimeException("not implemented");
+ }
+
+ void SAL_CALL addKeyListener(const css::uno::Reference< css::awt::XKeyListener >& ) override
+ {
+ throw css::uno::RuntimeException("not implemented");
+ }
+
+ void SAL_CALL removeKeyListener(const css::uno::Reference< css::awt::XKeyListener >& ) override
+ {
+ throw css::uno::RuntimeException("not implemented");
+ }
+
+ void SAL_CALL addMouseListener(const css::uno::Reference< css::awt::XMouseListener >& ) override
+ {
+ throw css::uno::RuntimeException("not implemented");
+ }
+
+ void SAL_CALL removeMouseListener(const css::uno::Reference< css::awt::XMouseListener >& ) override
+ {
+ throw css::uno::RuntimeException("not implemented");
+ }
+
+ void SAL_CALL addMouseMotionListener(const css::uno::Reference< css::awt::XMouseMotionListener >& ) override
+ {
+ throw css::uno::RuntimeException("not implemented");
+ }
+
+ void SAL_CALL removeMouseMotionListener(const css::uno::Reference< css::awt::XMouseMotionListener >& ) override
+ {
+ throw css::uno::RuntimeException("not implemented");
+ }
+
+ void SAL_CALL addPaintListener(const css::uno::Reference< css::awt::XPaintListener >& ) override
+ {
+ throw css::uno::RuntimeException("not implemented");
+ }
+
+ void SAL_CALL removePaintListener(const css::uno::Reference< css::awt::XPaintListener >& ) override
+ {
+ throw css::uno::RuntimeException("not implemented");
+ }
+};
+
+#endif
+
#endif // INCLUDED_VCL_INC_OSX_SALINST_H
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index 519e2ddf7ef9..65871808403b 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -10,9 +10,9 @@
#include <vcl/edit.hxx>
#include <vcl/spinfld.hxx>
-class SalInstanceBuilder : public weld::Builder
+class VCL_DLLPUBLIC SalInstanceBuilder : public weld::Builder
{
-private:
+protected:
std::unique_ptr<VclBuilder> m_xBuilder;
VclPtr<vcl::Window> m_aOwnedToplevel;
@@ -144,7 +144,7 @@ public:
virtual ~SalInstanceBuilder() override;
};
-class SalInstanceWidget : public virtual weld::Widget
+class VCL_DLLPUBLIC SalInstanceWidget : public virtual weld::Widget
{
protected:
VclPtr<vcl::Window> m_xWidget;
@@ -450,7 +450,7 @@ public:
virtual ~SalInstanceWindow() override;
};
-class SalInstanceDialog : public SalInstanceWindow, public virtual weld::Dialog
+class VCL_DLLPUBLIC SalInstanceDialog : public SalInstanceWindow, public virtual weld::Dialog
{
private:
VclPtr<::Dialog> m_xDialog;
@@ -615,4 +615,4 @@ public:
virtual ~SalInstanceSpinButton() override;
};
-#endif
\ No newline at end of file
+#endif
diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx
index dc012aa1d07b..f58d929ee12b 100644
--- a/vcl/osx/salframe.cxx
+++ b/vcl/osx/salframe.cxx
@@ -33,6 +33,7 @@
#include <vcl/window.hxx>
#include <vcl/syswin.hxx>
#include <vcl/settings.hxx>
+#include <vcl/weld.hxx>
#include <osx/saldata.hxx>
#include <quartz/salgdi.h>
diff --git a/vcl/osx/salinst.cxx b/vcl/osx/salinst.cxx
index c1b11ebfaa58..88d23411ba2f 100644
--- a/vcl/osx/salinst.cxx
+++ b/vcl/osx/salinst.cxx
@@ -21,6 +21,7 @@
#include <sal/log.hxx>
#include <osl/diagnose.h>
+#include <algorithm>
#include <condition_variable>
#include <mutex>
#include <utility>
@@ -30,12 +31,11 @@
#include <stdio.h>
#include <comphelper/solarmutex.hxx>
-
#include <comphelper/lok.hxx>
#include <osl/process.h>
-#include <rtl/ustrbuf.hxx>
+#include <unotools/resmgr.hxx>
#include <vclpluginapi.h>
#include <vcl/svapp.hxx>
#include <vcl/window.hxx>
@@ -44,7 +44,16 @@
#include <vcl/opengl/OpenGLContext.hxx>
#include <vcl/commandevent.hxx>
#include <vcl/event.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/quickselectionengine.hxx>
+#include <vcl/builder.hxx>
+#include <vcl/weld.hxx>
+#include <xmlreader/xmlreader.hxx>
+
+#define VCL_INTERNALS
+#include <vcl/toolkit/dialog.hxx>
+#include <salvtables.hxx>
#include <osx/saldata.hxx>
#include <osx/salinst.h>
#include <osx/salframe.h>
@@ -66,6 +75,7 @@
#include <com/sun/star/uno/XComponentContext.hpp>
#include <premac.h>
+#include <objc/runtime.h>
#include <Foundation/Foundation.h>
#include <ApplicationServices/ApplicationServices.h>
#import "apple_remote/RemoteMainController.h"
@@ -795,7 +805,7 @@ void AquaSalInstance::DestroyInfoPrinter( SalInfoPrinter* pPrinter )
OUString AquaSalInstance::GetConnectionIdentifier()
{
- return OUString();
+ return "";
}
// We need to re-encode file urls because osl_getFileURLFromSystemPath converts
@@ -984,4 +994,4183 @@ bool AquaSalInstance::SVMainHook(int* pnInit)
return true;
}
+// Correspondance between the GTK welding and macOS welding:
+//
+// GtkWidget \
+// GtkContainer > NSView
+// GtkBin /
+// GtkDialog - NSPanel
+// GtkMessageDialog - NSAlert
+// GtkGrid - NSGridView
+// GtkNotebook - NSTabView
+// GtkFrame - NSBox
+// GtkBox - NSStackView
+// GtkButton - NSButton
+
+
+ at interface NSObject (Cast)
++ (instancetype)castFrom:(id)from;
+ at end
+
+ at implementation NSObject (Cast)
++ (instancetype)castFrom:(id)from {
+ if ([from isKindOfClass:self]) {
+ return from;
+ }
+ return nil;
+}
+ at end
+
+class AppKitInstanceBuilder;
+
+namespace
+{
+ const void* helpIdKey = "helpid";
+ const void* leftAttachKey = "leftattach";
+ const void* topAttachKey = "topattach";
+
+ void set_help_id(NSView* pView, const OString& rHelpId)
+ {
+ NSString* helpid = [NSString stringWithUTF8String:rHelpId.getStr()];
+ objc_setAssociatedObject(pView, helpIdKey, helpid, OBJC_ASSOCIATION_COPY);
+ }
+
+ OString get_help_id(const NSView *pView)
+ {
+ id pData = objc_getAssociatedObject(pView, helpIdKey);
+ if (pData == nil || strcmp(object_getClassName(pData), object_getClassName(@"")) != 0)
+ return "";
+ NSString* pString = pData;
+ return OString([pString UTF8String]);
+ }
+
+ void set_left_attach(NSView* pView, int nLeftAttach)
+ {
+ NSNumber* leftAttach = [NSNumber numberWithInteger:nLeftAttach];
+ objc_setAssociatedObject(pView, leftAttachKey, leftAttach, OBJC_ASSOCIATION_COPY);
+ }
+
+ int get_left_attach(const NSView *pView)
+ {
+ id pData = objc_getAssociatedObject(pView, leftAttachKey);
+ if (pData == nil || strcmp(object_getClassName(pData), object_getClassName(@0)) != 0)
+ return -1;
+ NSNumber* pNumber = pData;
+ return [pNumber integerValue];
+ }
+
+ void set_top_attach(NSView* pView, int nTopAttach)
+ {
+ NSNumber* topAttach = [NSNumber numberWithInteger:nTopAttach];
+ objc_setAssociatedObject(pView, topAttachKey, topAttach, OBJC_ASSOCIATION_COPY);
+ }
+
+ int get_top_attach(const NSView *pView)
+ {
+ id pData = objc_getAssociatedObject(pView, topAttachKey);
+ if (pData == nil || strcmp(object_getClassName(pData), object_getClassName(@0)) != 0)
+ return -1;
+ NSNumber* pNumber = pData;
+ return [pNumber integerValue];
+ }
+
+ bool extractOrientation(std::map<OString, OUString> &rMap)
+ {
+ bool bVertical = false;
+ auto aFind = rMap.find("orientation");
+ if (aFind != rMap.end())
+ {
+ bVertical = aFind->second.equalsIgnoreAsciiCase("vertical");
+ rMap.erase(aFind);
+ }
+ return bVertical;
+ }
+}
+
+class AppKitInstanceWidget : public virtual weld::Widget
+{
+protected:
+ NSView* m_pView;
+ AppKitInstanceBuilder* m_pBuilder;
+
+private:
+ bool m_bTakeOwnership;
+
+public:
+ AppKitInstanceWidget(NSView* pView, AppKitInstanceBuilder* pBuilder, bool bTakeOwnership)
+ : m_pView(pView)
+ , m_pBuilder(pBuilder)
+ , m_bTakeOwnership(bTakeOwnership)
+ {
+ // SAL_DEBUG("AppKitInstanceWidget CTOR this=" << this);
+ if (!bTakeOwnership)
+ [m_pView retain];
+ }
+
+ virtual ~AppKitInstanceWidget() override
+ {
+ // SAL_DEBUG("AppKitInstanceWidget DTOR this=" << this);
+ if (m_bTakeOwnership)
+ [m_pView removeFromSuperview]; // ???
+ else
+ [m_pView release];
+ }
+
+ virtual void set_sensitive(bool sensitive) override
+ {
+ NSControl* control = [NSControl castFrom:m_pView];
+ if (control != nil)
+ [control setEnabled:(sensitive ? YES : NO)];
+ }
+
+ virtual bool get_sensitive() const override
+ {
+ NSControl* control = [NSControl castFrom:m_pView];
+ if (control != nil)
+ return [control isEnabled];
+ return true;
+ }
+
+ virtual void show() override
+ {
+ [m_pView setHidden:NO];
+ }
+
+ virtual void hide() override
+ {
+ [m_pView setHidden:YES];
+ }
+
+ virtual bool get_visible() const override
+ {
+ return ![m_pView isHidden];
+ }
+
+ virtual bool is_visible() const override
+ {
+ return ![m_pView isHiddenOrHasHiddenAncestor];
+ }
+
+ virtual void set_can_focus(bool bCanFocus) override
+ {
+ (void) bCanFocus;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void grab_focus() override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual bool has_focus() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return false;
+ }
+
+ virtual bool is_active() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return true;
+ }
+
+ virtual void set_has_default(bool has_default) override
+ {
+ (void) has_default;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual bool get_has_default() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return false;
+ }
+
+ virtual void set_size_request(int nWidth, int nHeight) override
+ {
+ [m_pView setBoundsSize:NSMakeSize(nWidth, nHeight)];
+ }
+
+ virtual Size get_size_request() const override
+ {
+ // ???
+ NSRect bounds = [m_pView bounds];
+ return Size(bounds.size.width, bounds.size.height);
+ }
+
+ virtual Size get_preferred_size() const override
+ {
+ // ???
+ NSRect bounds = [m_pView bounds];
+ return Size(bounds.size.width, bounds.size.height);
+ }
+
+ virtual float get_approximate_digit_width() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return 10;
+ }
+
+ virtual int get_text_height() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return 10;
+ }
+
+ virtual Size get_pixel_size(const OUString& rText) const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ (void) rText;
+ return Size(10, 10);
+ }
+
+ virtual OString get_buildable_name() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return "";
+ }
+
+ virtual void set_help_id(const OString& rHelpId) override
+ {
+ ::set_help_id(m_pView, rHelpId);
+ }
+
+ virtual OString get_help_id() const override
+ {
+ OString sRet = ::get_help_id(m_pView);
+ if (sRet.isEmpty())
+ sRet = OString("null");
+ return sRet;
+ }
+
+ virtual void set_grid_left_attach(int nAttach) override
+ {
+ (void) nAttach;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual int get_grid_left_attach() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return 0;
+ }
+
+ virtual void set_grid_width(int nCols) override
+ {
+ (void) nCols;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_grid_top_attach(int nAttach) override
+ {
+ (void) nAttach;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual int get_grid_top_attach() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return 0;
+ }
+
+ virtual void set_hexpand(bool bExpand) override
+ {
+ (void) bExpand;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual bool get_hexpand() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return false;
+ }
+
+ virtual void set_vexpand(bool bExpand) override
+ {
+ (void) bExpand;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual bool get_vexpand() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return false;
+ }
+
+ virtual void set_secondary(bool bSecondary) override
+ {
+ (void) bSecondary;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_margin_top(int nMargin) override
+ {
+ (void) nMargin;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_margin_bottom(int nMargin) override
+ {
+ (void) nMargin;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_margin_left(int nMargin) override
+ {
+ (void) nMargin;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_margin_right(int nMargin) override
+ {
+ (void) nMargin;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual int get_margin_top() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return 0;
+ }
+
+ virtual int get_margin_bottom() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return 0;
+ }
+
+ virtual int get_margin_left() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return 0;
+ }
+
+ virtual int get_margin_right() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return 0;
+ }
+
+ virtual bool get_extents_relative_to(weld::Widget& rRelative, int& x, int &y, int& width, int &height) override
+ {
+ (void) rRelative;
+ (void) x;
+ (void) y;
+ (void) width;
+ (void) height;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return false;
+ }
+
+ virtual void set_accessible_name(const OUString& rName) override
+ {
+ (void) rName;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual OUString get_accessible_name() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return "";
+ }
+
+ virtual OUString get_accessible_description() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return "";
+ }
+
+ virtual void set_accessible_relation_labeled_by(weld::Widget* pLabel) override
+ {
+ (void) pLabel;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_accessible_relation_label_for(weld::Widget* pLabeled) override
+ {
+ (void) pLabeled;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void add_extra_accessible_relation(const css::accessibility::AccessibleRelation &rRelation) override
+ {
+ (void) rRelation;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void clear_extra_accessible_relations() override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_tooltip_text(const OUString& rTip) override
+ {
+ [m_pView setToolTip:CreateNSString(rTip)];
+ }
+
+ virtual OUString get_tooltip_text() const override
+ {
+ return GetOUString([m_pView toolTip]);
+ }
+
+ virtual void grab_add() override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual bool has_grab() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return false;
+ }
+
+ virtual void grab_remove() override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual vcl::Font get_font() override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return vcl::Font();
+ }
+
+ virtual bool get_direction() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return false;
+ }
+
+ virtual void set_direction(bool bRTL) override
+ {
+ (void) bRTL;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void freeze() override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void thaw() override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual std::unique_ptr<weld::Container> weld_parent() const override;
+
+ virtual void help_hierarchy_foreach(const std::function<bool(const OString&)>& func) override
+ {
+ (void) func;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual OUString strip_mnemonic(const OUString &rLabel) const override
+ {
+ return rLabel.replaceFirst("_", "");
+ }
+
+ virtual VclPtr<VirtualDevice> create_virtual_device() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual void set_stack_background() override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_highlight_background() override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_toolbar_background() override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget> get_drop_target() override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual void connect_get_property_tree(const Link<boost::property_tree::ptree&, void>&) override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ NSView* getView()
+ {
+ return m_pView;
+ }
+
+ NSWindow* getWindow()
+ {
+ return [m_pView window];
+ }
+
+ int runModal()
+ {
+ int ret = RET_CANCEL;
+ while (true)
+ {
+ NSModalResponse response = [NSApp runModalForWindow:getWindow()];
+ if (response == NSModalResponseOK)
+ ret = RET_OK;
+ else if (response == NSModalResponseCancel)
+ ret = RET_CANCEL;
+ break;
+ }
+ hide();
+ return ret;
+ }
+};
+
+class AppKitInstanceContainer : public AppKitInstanceWidget, public virtual weld::Container
+{
+public:
+ AppKitInstanceContainer(NSView* pView, AppKitInstanceBuilder* pBuilder, bool bTakeOwnership)
+ : AppKitInstanceWidget(pView, pBuilder, bTakeOwnership)
+ {
+ // SAL_DEBUG("AppKitInstanceContainer CTOR this=" << this);
+ }
+
+ virtual ~AppKitInstanceContainer()
+ {
+ // SAL_DEBUG("AppKitInstanceContainer DTOR this=" << this);
+ }
+
+ virtual void move(weld::Widget* pWidget, weld::Container* pNewParent) override
+ {
+ AppKitInstanceWidget* pAppKitWidget = dynamic_cast<AppKitInstanceWidget*>(pWidget);
+ assert(pAppKitWidget);
+ AppKitInstanceContainer* pNewAppKitParent = dynamic_cast<AppKitInstanceContainer*>(pNewParent);
+ assert(!pNewParent || pNewAppKitParent);
+ [pNewAppKitParent->m_pView addSubview:pAppKitWidget->getView()];
+ }
+
+ virtual void recursively_unset_default_buttons() override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual css::uno::Reference<css::awt::XWindow> CreateChildFrame() override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+};
+
+std::unique_ptr<weld::Container> AppKitInstanceWidget::weld_parent() const
+{
+ NSView* parent = [m_pView superview];
+ if (parent == nil)
+ return nullptr;
+ return std::make_unique<AppKitInstanceContainer>(parent, m_pBuilder, false);
+}
+
+class AppKitInstanceBox : public AppKitInstanceContainer, public virtual weld::Box
+{
+private:
+ NSStackView* const m_pStackView;
+
+public:
+ AppKitInstanceBox(NSStackView* pStackView, AppKitInstanceBuilder* pBuilder, bool bTakeOwnership)
+ : AppKitInstanceContainer(pStackView, pBuilder, bTakeOwnership)
+ , m_pStackView(pStackView)
+ {
+ }
+
+ virtual void reorder_child(weld::Widget* pWidget, int nNewPosition) override
+ {
+ AppKitInstanceWidget* pAppKitWidget = dynamic_cast<AppKitInstanceWidget*>(pWidget);
+ assert(pAppKitWidget);
+ NSView* pChild = pAppKitWidget->getView();
+ [pChild removeFromSuperview];
+ [m_pStackView insertView:pChild atIndex:nNewPosition inGravity:NSStackViewGravityCenter];
+ }
+};
+
+class AppKitInstanceWindow : public AppKitInstanceContainer, public virtual weld::Window
+{
+private:
+ NSWindow* m_pWindow;
+
+protected:
+ void help();
+
+public:
+ AppKitInstanceWindow(NSWindow* pWindow, AppKitInstanceBuilder* pBuilder, bool bTakeOwnership)
+ : AppKitInstanceContainer([pWindow contentView], pBuilder, bTakeOwnership)
+ , m_pWindow(pWindow)
+ {
+ // SAL_DEBUG("AppKitInstanceWindow CTOR this=" << this);
+ }
+
+ virtual ~AppKitInstanceWindow()
+ {
+ // SAL_DEBUG("AppKitInstanceWindow DTOR this=" << this);
+ }
+
+ virtual void set_title(const OUString& rTitle) override
+ {
+ [m_pWindow setTitle:CreateNSString(rTitle)];
+ }
+
+ virtual OUString get_title() const override
+ {
+ return GetOUString([m_pWindow title]);
+ }
+
+ virtual void set_busy_cursor(bool bBusy) override
+ {
+ (void) bBusy;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void window_move(int x, int y) override
+ {
+ (void) x;
+ (void) y;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_modal(bool bModal) override
+ {
+ (void) bModal;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual bool get_modal() const override
+ {
+ return [NSApp modalWindow] == m_pWindow;
+ }
+
+ virtual bool get_resizable() const override
+ {
+ return [m_pWindow isResizable];
+ }
+
+ virtual Size get_size() const override
+ {
+ return Size(m_pWindow.frame.size.width, m_pWindow.frame.size.height);
+ }
+
+ virtual Point get_position() const override
+ {
+ return Point(m_pWindow.frame.origin.x, m_pWindow.frame.origin.y);
+ }
+
+ virtual tools::Rectangle get_monitor_workarea() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return tools::Rectangle();
+ }
+
+ virtual void set_centered_on_parent(bool bTrackGeometryRequests) override
+ {
+ (void) bTrackGeometryRequests;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual bool has_toplevel_focus() const override
+ {
+ return [m_pWindow isKeyWindow];
+ }
+
+ virtual void present() override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_window_state(const OString& rStr) override
+ {
+ (void) rStr;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual OString get_window_state(WindowStateMask nMask) const override
+ {
+ if (nMask == WindowStateMask::NONE)
+ return "";
+
+ OStringBuffer sBuf(64);
+
+ if (nMask & WindowStateMask::X)
+ sBuf.append(OString::number(m_pWindow.frame.origin.x));
+ sBuf.append(",");
+ if (nMask & WindowStateMask::Y)
+ sBuf.append(OString::number(m_pWindow.frame.origin.y));
+ sBuf.append(",");
+ if (nMask & WindowStateMask::Width)
+ sBuf.append(OString::number(m_pWindow.frame.size.width));
+ sBuf.append(",");
+ if (nMask & WindowStateMask::Height)
+ sBuf.append(OString::number(m_pWindow.frame.size.height));
+ sBuf.append(";");
+ if (nMask & WindowStateMask::State)
+ {
+ WindowStateState nState = WindowStateState::Normal;
+ if ([m_pWindow isMiniaturized])
+ nState = WindowStateState::Minimized;
+ else if ([m_pWindow isZoomed])
+ nState = WindowStateState::Maximized;
+ sBuf.append(OString::number((int)nState));
+ }
+ sBuf.append(";");
+ if (nMask & WindowStateMask::MaximizedX)
+ sBuf.append("0"); // ???
+ sBuf.append(",");
+ if (nMask & WindowStateMask::MaximizedY)
+ sBuf.append("0"); // ???
+ sBuf.append(",");
+ if (nMask & WindowStateMask::MaximizedWidth)
+ sBuf.append(m_pWindow.maxSize.width); // ???
+ sBuf.append(",");
+ if (nMask & WindowStateMask::MaximizedHeight)
+ sBuf.append(m_pWindow.maxSize.height); // ???
+ sBuf.append(";");
+
+ return sBuf.makeStringAndClear();
+ }
+
+ virtual css::uno::Reference<css::awt::XWindow> GetXWindow() override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual SystemEnvData get_system_data() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return SystemEnvData();
+ }
+
+ virtual void resize_to_request() override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void draw(VirtualDevice& rOutput) override
+ {
+ (void) rOutput;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual weld::ScreenShotCollection collect_screenshot_data() override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return weld::ScreenShotCollection();
+ }
+};
+
+namespace
+{
+ class AppKitInstanceDialogCommon : public virtual weld::Dialog
+ {
+ private:
+ virtual bool runAsync(std::shared_ptr<weld::DialogController> rController,
+ const std::function<void(sal_Int32)>& func) override
+ {
+ (void) rController;
+ (void) func;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return false;
+ }
+
+ public:
+ virtual bool runAsync(std::shared_ptr<weld::Dialog> const& rxSelf,
+ const std::function<void(sal_Int32)>& func) override
+ {
+ (void) rxSelf;
+ (void) func;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return false;
+ }
+
+ virtual void response(int nResponse) override
+ {
+ NSModalResponse response;
+ if (nResponse == RET_OK)
+ response = NSModalResponseOK;
+ else if (nResponse == RET_CANCEL)
+ response = NSModalResponseCancel;
+ else
+ return;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void add_button(const OUString& rText, int response, const OString& rHelpId = OString()) override
+ {
+ (void) rText;
+ (void) response;
+ (void) rHelpId;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_default_response(int response) override
+ {
+ (void) response;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual weld::Button* weld_widget_for_response(int response) override
+ {
+ (void) response;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual weld::Container* weld_content_area() override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual void collapse(weld::Widget* pEdit, weld::Widget* pButton) override
+ {
+ (void) pEdit;
+ (void) pButton;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void undo_collapse() override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void SetInstallLOKNotifierHdl(const Link<void*, vcl::ILibreOfficeKitNotifier*>& rLink) override
+ {
+ (void) rLink;
+ }
+ };
+}
+
+class AppKitInstanceDialog : public AppKitInstanceWindow, public virtual AppKitInstanceDialogCommon, public virtual weld::Dialog
+{
+protected:
+ NSPanel* m_pPanel;
+
+public:
+ AppKitInstanceDialog(NSPanel* pPanel, AppKitInstanceBuilder* pBuilder, bool bTakeOwnership)
+ : AppKitInstanceWindow(pPanel, pBuilder, bTakeOwnership)
+ , m_pPanel(pPanel)
+ {
+ // SAL_DEBUG("AppKitInstanceDialog CTOR this=" << this);
+ }
+
+ virtual ~AppKitInstanceDialog()
+ {
+ // SAL_DEBUG("AppKitInstanceDialog DTOR this=" << this);
+ }
+
+ virtual int run() override
+ {
+ return runModal();
+ }
+};
+
+class AppKitInstanceMessageDialog final : public AppKitInstanceWindow, public virtual AppKitInstanceDialogCommon, public virtual weld::MessageDialog
+{
+private:
+ NSAlert* m_pAlert;
+
+public:
+ AppKitInstanceMessageDialog(NSAlert* pAlert, AppKitInstanceBuilder* pBuilder, bool bTakeOwnership)
+ : AppKitInstanceWindow(pAlert.window, pBuilder, bTakeOwnership)
+ , m_pAlert(pAlert)
+ {
+ }
+
+ virtual void set_primary_text(const OUString& rText) override
+ {
+ [m_pAlert setMessageText:CreateNSString(rText)];
+ }
+
+ virtual OUString get_primary_text() const override
+ {
+ return GetOUString([m_pAlert messageText]);
+ }
+
+ virtual void set_secondary_text(const OUString& rText) override
+ {
+ [m_pAlert setInformativeText:CreateNSString(rText)];
+ }
+
+ virtual OUString get_secondary_text() const override
+ {
+ return GetOUString([m_pAlert informativeText]);
+ }
+
+ virtual Container* weld_message_area() override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual int run() override
+ {
+ return runModal();
+ }
+};
+
+class AppKitInstanceFrame final : public AppKitInstanceContainer, public virtual weld::Frame
+{
+private:
+ NSBox* m_pBox;
+
+public:
+ AppKitInstanceFrame(NSBox* pBox, AppKitInstanceBuilder* pBuilder, bool bTakeOwnership)
+ : AppKitInstanceContainer(pBox, pBuilder, bTakeOwnership)
+ , m_pBox(pBox)
+ {
+ // SAL_DEBUG("AppKitInstanceFrame CTOR this=" << this);
+ }
+
+ virtual ~AppKitInstanceFrame()
+ {
+ // SAL_DEBUG("AppKitInstanceFrame DTOR this=" << this);
+ }
+
+ virtual void set_label(const OUString& rText) override
+ {
+ [m_pBox setTitle:CreateNSString(rText)];
+ }
+
+ virtual OUString get_label() const override
+ {
+ return GetOUString([m_pBox title]);
+ }
+
+ virtual std::unique_ptr<weld::Label> weld_label_widget() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+};
+
+class AppKitInstanceNotebook final : public AppKitInstanceContainer, public virtual weld::Notebook
+{
+private:
+ NSTabView* m_pTabView;
+ mutable std::vector<std::unique_ptr<AppKitInstanceContainer>> m_aPages;
+
+ int get_page_number(const OString& rIdent) const
+ {
+ NSString* string = [NSString stringWithUTF8String:rIdent.getStr()];
+ NSInteger index = [m_pTabView indexOfTabViewItemWithIdentifier:string];
+ if (index == NSNotFound)
+ return -1;
+ return index;
+ }
+
+public:
+ AppKitInstanceNotebook(NSTabView* pTabView, AppKitInstanceBuilder* pBuilder, bool bTakeOwnership)
+ : AppKitInstanceContainer(pTabView, pBuilder, bTakeOwnership)
+ , m_pTabView(pTabView)
+ {
+ }
+
+ virtual int get_current_page() const override
+ {
+ return [m_pTabView indexOfTabViewItem:[m_pTabView selectedTabViewItem]];
+ }
+
+ OString get_page_ident(int nPage) const override
+ {
+ if (nPage > [m_pTabView numberOfTabViewItems])
+ return "";
+ NSTabViewItem* item = [m_pTabView tabViewItemAtIndex:nPage];
+ id ident = [item identifier];
+ if (ident == nil)
+ return "";
+ NSString* string = [NSString castFrom:ident];
+ if (string == nil)
+ return "";
+ const char* p = [string UTF8String];
+ return OString(p, strlen(p));
+ }
+
+ virtual OString get_current_page_ident() const override
+ {
+ return get_page_ident(get_current_page());
+ }
+
+ virtual void set_current_page(int nPage) override
+ {
+ [m_pTabView selectTabViewItemAtIndex:nPage];
+ }
+
+ virtual void set_current_page(const OString& rIdent) override
+ {
+ [m_pTabView selectTabViewItemWithIdentifier:[NSString stringWithUTF8String:rIdent.getStr()]];
+ }
+
+ virtual void remove_page(const OString& rIdent) override
+ {
+ [m_pTabView removeTabViewItem:[m_pTabView tabViewItemAtIndex:[m_pTabView indexOfTabViewItemWithIdentifier:[NSString stringWithUTF8String:rIdent.getStr()]]]];
+ }
+
+ virtual void insert_page(const OString& rIdent, const OUString& rLabel, int nPos) override
+ {
+ NSTabViewItem* item = [[NSTabViewItem alloc] initWithIdentifier:[NSString stringWithUTF8String:rIdent.getStr()]];
+ [item setLabel:CreateNSString(rLabel)];
+ [m_pTabView insertTabViewItem:item atIndex:nPos];
+ }
+
+ virtual void set_tab_label_text(const OString& rIdent, const OUString& rLabel) override
+ {
+ [[m_pTabView tabViewItemAtIndex:[m_pTabView indexOfTabViewItemWithIdentifier:[NSString stringWithUTF8String:rIdent.getStr()]]] setLabel:CreateNSString(rLabel)];
+ }
+
+ virtual OUString get_tab_label_text(const OString& rIdent) const override
+ {
+ return GetOUString([[m_pTabView tabViewItemAtIndex:[m_pTabView indexOfTabViewItemWithIdentifier:[NSString stringWithUTF8String:rIdent.getStr()]]] label]);
+ }
+
+ virtual int get_n_pages() const override
+ {
+ return [m_pTabView numberOfTabViewItems];
+ }
+
+ virtual weld::Container* get_page(const OString& rIdent) const override
+ {
+ int nPage = get_page_number(rIdent);
+ if (nPage < 0)
+ return nullptr;
+ NSTabViewItem* pChild = [m_pTabView tabViewItemAtIndex:nPage];
+ unsigned int nPageIndex = static_cast<unsigned int>(nPage);
+ if (m_aPages.size() < nPageIndex + 1)
+ m_aPages.resize(nPageIndex + 1);
+ if (!m_aPages[nPageIndex])
+ m_aPages[nPageIndex].reset(new AppKitInstanceContainer([pChild view], m_pBuilder, false));
+ return m_aPages[nPageIndex].get();
+ }
+
+ virtual ~AppKitInstanceNotebook() override
+ {
+ }
+};
+
+class AppKitInstanceButton : public AppKitInstanceContainer, public virtual weld::Button
+{
+protected:
+ NSButton* m_pButton;
+
+public:
+ AppKitInstanceButton(NSButton* pButton, AppKitInstanceBuilder* pBuilder, bool bTakeOwnership)
+ : AppKitInstanceContainer(pButton, pBuilder, bTakeOwnership)
+ , m_pButton(pButton)
+ {
+ }
+
+ virtual void set_label(const OUString& rText) override
+ {
+ [m_pButton setTitle:CreateNSString(rText)];
+ }
+
+ virtual void set_image(VirtualDevice* pDevice) override
+ {
+ (void) pDevice;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_image(const css::uno::Reference<css::graphic::XGraphic>& rImage) override
+ {
+ (void) rImage;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_from_icon_name(const OUString& rIconName) override
+ {
+ (void) rIconName;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual OUString get_label() const override
+ {
+ return GetOUString([m_pButton title]);
+ }
+
+ virtual void set_label_line_wrap(bool wrap) override
+ {
+ (void) wrap;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual ~AppKitInstanceButton() override
+ {
+ }
+};
+
+class AppKitInstanceToggleButton : public AppKitInstanceButton, public virtual weld::ToggleButton
+{
+public:
+ AppKitInstanceToggleButton(NSButton* pButton, AppKitInstanceBuilder* pBuilder, bool bTakeOwnership)
+ : AppKitInstanceButton(pButton, pBuilder, bTakeOwnership)
+ {
+ [m_pButton setButtonType:NSButtonTypeToggle];
+ }
+
+ virtual void set_active(bool active) override
+ {
+ [m_pButton setState:(active ? NSOnState : NSOffState)];
+ }
+
+ virtual bool get_active() const override
+ {
+ return [m_pButton state] == NSOnState;
+ }
+
+ virtual void set_inconsistent(bool inconsistent) override
+ {
+ [m_pButton setAllowsMixedState:inconsistent];
+ if (inconsistent)
+ [m_pButton setState:NSMixedState];
+ }
+
+ virtual bool get_inconsistent() const override
+ {
+ return [m_pButton state] == NSMixedState;
+ }
+
+ virtual ~AppKitInstanceToggleButton() override
+ {
+ }
+};
+
+class AppKitInstanceRadioButton final : public AppKitInstanceToggleButton, public virtual weld::RadioButton
+{
+public:
+ AppKitInstanceRadioButton(NSButton* pButton, AppKitInstanceBuilder* pBuilder, bool bTakeOwnership)
+ : AppKitInstanceToggleButton(pButton, pBuilder, bTakeOwnership)
+ {
+ [m_pButton setButtonType:NSButtonTypeRadio];
+ }
+};
+
+class AppKitInstanceCheckButton final : public AppKitInstanceToggleButton, public virtual weld::CheckButton
+{
+public:
+ AppKitInstanceCheckButton(NSButton* pButton, AppKitInstanceBuilder* pBuilder, bool bTakeOwnership)
+ : AppKitInstanceToggleButton(pButton, pBuilder, bTakeOwnership)
+ {
+ [m_pButton setButtonType:NSButtonTypeSwitch];
+ }
+};
+
+class AppKitInstanceEntry : public AppKitInstanceWidget, public virtual weld::Entry
+{
+private:
+ NSTextField* m_pTextField;
+
+public:
+ AppKitInstanceEntry(NSTextField* pTextField, AppKitInstanceBuilder* pBuilder, bool bTakeOwnership)
+ : AppKitInstanceWidget(pTextField, pBuilder, bTakeOwnership)
+ , m_pTextField(pTextField)
+ {
+ }
+
+ virtual void set_text(const OUString& rText) override
+ {
+ [m_pTextField setStringValue:CreateNSString(rText)];
+ }
+
+ virtual OUString get_text() const override
+ {
+ return GetOUString([m_pTextField stringValue]);
+ }
+
+ virtual void set_width_chars(int nChars) override
+ {
+ (void) nChars;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual int get_width_chars() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return 10;
+ }
+
+ virtual void set_max_length(int nChars) override
+ {
+ (void) nChars;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void select_region(int nStartPos, int nEndPos) override
+ {
+ (void) nStartPos;
+ (void) nEndPos;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual bool get_selection_bounds(int& rStartPos, int& rEndPos) override
+ {
+ (void) rStartPos;
+ (void) rEndPos;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return true;
+ }
+
+ virtual void replace_selection(const OUString& rText) override
+ {
+ (void) rText;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_position(int nCursorPos) override
+ {
+ (void) nCursorPos;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual int get_position() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return 0;
+ }
+
+ virtual void set_editable(bool bEditable) override
+ {
+ (void) bEditable;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual bool get_editable() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return true;
+ }
+
+ virtual void set_message_type(weld::EntryMessageType eType) override
+ {
+ (void) eType;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_placeholder_text(const OUString& rText) override
+ {
+ (void) rText;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_font(const vcl::Font& rFont) override
+ {
+ (void) rFont;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void cut_clipboard() override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void copy_clipboard() override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void paste_clipboard() override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual ~AppKitInstanceEntry() override
+ {
+ }
+};
+
+// Just a first rough idea, probably totally wrong
+
+struct AppKitInstanceTreeIter final : public weld::TreeIter
+{
+ virtual bool equal(const TreeIter& rOther) const override
+ {
+ const AppKitInstanceTreeIter& b = static_cast<const AppKitInstanceTreeIter&>(rOther);
+ return row == b.row && col == b.col;
+ }
+ NSInteger row, col;
+};
+
+class AppKitInstanceTreeView final : public AppKitInstanceContainer, public virtual weld::TreeView
+{
+private:
+ NSOutlineView* m_pOutlineView;
+
+public:
+ AppKitInstanceTreeView(NSOutlineView* pOutlineView, AppKitInstanceBuilder* pBuilder, bool bTakeOwnership)
+ : AppKitInstanceContainer(pOutlineView, pBuilder, bTakeOwnership)
+ , m_pOutlineView(pOutlineView)
+ {
+ }
+
+ virtual void insert(const weld::TreeIter* pParent, int pos, const OUString* pStr, const OUString* pId,
+ const OUString* pIconName, VirtualDevice* pImageSurface,
+ const OUString* pExpanderName, bool bChildrenOnDemand, weld::TreeIter* pRet) override
+ {
+ (void) pParent;
+ (void) pos;
+ (void) pStr;
+ (void) pId;
+ (void) pIconName;
+ (void) pImageSurface;
+ (void) pExpanderName;
+ (void) bChildrenOnDemand;
+ (void) pRet;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual OUString get_selected_text() const override
+ {
+ // ???
+ return GetOUString([m_pOutlineView stringValue]);
+ }
+
+ virtual OUString get_selected_id() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return "";
+ }
+
+ virtual int get_selected_index() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return 0;
+ }
+
+ virtual void select(int pos) override
+ {
+ (void) pos;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void unselect(int pos) override
+ {
+ (void) pos;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void remove(int pos) override
+ {
+ (void) pos;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual OUString get_text(int row, int col = -1) const override
+ {
+ (void) row;
+ (void) col;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return "";
+ }
+
+ virtual void set_text(int row, const OUString& rText, int col = -1) override
+ {
+ (void) row;
+ (void) rText;
+ (void) col;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ using AppKitInstanceWidget::set_sensitive;
+
+ virtual void set_sensitive(int row, bool bSensitive, int col = -1) override
+ {
+ (void) row;
+ (void) bSensitive;
+ (void) col;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_id(int row, const OUString& rId) override
+ {
+ (void) row;
+ (void) rId;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_toggle(int row, TriState eState, int col) override
+ {
+ (void) row;
+ (void) eState;
+ (void) col;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual TriState get_toggle(int row, int col) const override
+ {
+ (void) row;
+ (void) col;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return TRISTATE_FALSE;
+ }
+
+ virtual void set_image(int row, const OUString& rImage, int col = -1) override
+ {
+ (void) row;
+ (void) rImage;
+ (void) col;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_image(int row, VirtualDevice& rImage, int col = -1) override
+ {
+ (void) row;
+ (void) rImage;
+ (void) col;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_image(int row, const css::uno::Reference<css::graphic::XGraphic>& rImage,
+ int col = -1) override
+ {
+ (void) row;
+ (void) rImage;
+ (void) col;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_text_emphasis(int row, bool bOn, int col) override
+ {
+ (void) row;
+ (void) bOn;
+ (void) col;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual bool get_text_emphasis(int row, int col) const override
+ {
+ (void) row;
+ (void) col;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return false;
+ }
+
+ virtual void swap(int pos1, int pos2) override
+ {
+ (void) pos1;
+ (void) pos2;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual std::vector<int> get_selected_rows() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return std::vector<int>();
+ }
+
+ virtual void set_font_color(int pos, const Color& rColor) override
+ {
+ (void) pos;
+ (void) rColor;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void scroll_to_row(int pos) override
+ {
+ (void) pos;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual bool is_selected(int pos) const override
+ {
+ (void) pos;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return false;
+ }
+
+ virtual int get_cursor_index() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return 0;
+ }
+
+ virtual void set_cursor(int pos) override
+ {
+ (void) pos;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual int find_text(const OUString& rText) const override
+ {
+ (void) rText;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return 0;
+ }
+
+ virtual OUString get_id(int pos) const override
+ {
+ (void) pos;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return "";
+ }
+
+ virtual int find_id(const OUString& rId) const override
+ {
+ (void) rId;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return 0;
+ }
+
+ virtual std::unique_ptr<weld::TreeIter> make_iterator(const weld::TreeIter* pOrig = nullptr) const override
+ {
+ (void) pOrig;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual void copy_iterator(const weld::TreeIter& rSource, weld::TreeIter& rDest) const override
+ {
+ (void) rSource;
+ (void) rDest;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual bool get_selected(weld::TreeIter* pIter) const override
+ {
+ (void) pIter;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return false;
+ }
+
+ virtual bool get_cursor(weld::TreeIter* pIter) const override
+ {
+ (void) pIter;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return false;
+ }
+
+ virtual void set_cursor(const weld::TreeIter& rIter) override
+ {
+ (void) rIter;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual bool get_iter_first(weld::TreeIter& rIter) const override
+ {
+ (void) rIter;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return false;
+ }
+
+ virtual bool iter_next_sibling(weld::TreeIter& rIter) const override
+ {
+ (void) rIter;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return false;
+ }
+
+ virtual bool iter_next(weld::TreeIter& rIter) const override
+ {
+ (void) rIter;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return false;
+ }
+
+ virtual bool iter_children(weld::TreeIter& rIter) const override
+ {
+ (void) rIter;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return false;
+ }
+
+ virtual bool iter_parent(weld::TreeIter& rIter) const override
+ {
+ (void) rIter;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return false;
+ }
+
+ virtual int get_iter_depth(const weld::TreeIter& rIter) const override
+ {
+ (void) rIter;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return 0;
+ }
+
+ virtual int get_iter_index_in_parent(const weld::TreeIter& rIter) const override
+ {
+ (void) rIter;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return 0;
+ }
+
+ virtual int iter_compare(const weld::TreeIter& a, const weld::TreeIter& b) const override
+ {
+ (void) a;
+ (void) b;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return 0;
+ }
+
+ virtual bool iter_has_child(const weld::TreeIter& rIter) const override
+ {
+ (void) rIter;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return false;
+ }
+
+ virtual int iter_n_children(const weld::TreeIter& rIter) const override
+ {
+ (void) rIter;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return 0;
+ }
+
+ virtual void remove(const weld::TreeIter& rIter) override
+ {
+ (void) rIter;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void select(const weld::TreeIter& rIter) override
+ {
+ (void) rIter;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void unselect(const weld::TreeIter& rIter) override
+ {
+ (void) rIter;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual bool get_row_expanded(const weld::TreeIter& rIter) const override
+ {
+ (void) rIter;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return false;
+ }
+
+ virtual bool get_children_on_demand(const weld::TreeIter& rIter) const override
+ {
+ (void) rIter;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return false;
+ }
+
+ virtual void set_children_on_demand(const weld::TreeIter& rIter, bool bChildrenOnDemand) override
+ {
+ (void) rIter;
+ (void) bChildrenOnDemand;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void expand_row(const weld::TreeIter& rIter) override
+ {
+ (void) rIter;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void collapse_row(const weld::TreeIter& rIter) override
+ {
+ (void) rIter;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_text(const weld::TreeIter& rIter, const OUString& rStr, int col) override
+ {
+ (void) rIter;
+ (void) rStr;
+ (void) col;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_sensitive(const weld::TreeIter& rIter, bool bSensitive, int col) override
+ {
+ (void) rIter;
+ (void) bSensitive;
+ (void) col;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_image(const weld::TreeIter& rIter, const OUString& rImage, int col) override
+ {
+ (void) rIter;
+ (void) rImage;
+ (void) col;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_text_emphasis(const weld::TreeIter& rIter, bool bOn, int col) override
+ {
+ (void) rIter;
+ (void) bOn;
+ (void) col;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual bool get_text_emphasis(const weld::TreeIter& rIter, int col) const override
+ {
+ (void) rIter;
+ (void) col;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return false;
+ }
+
+ virtual void set_toggle(const weld::TreeIter& rIter, TriState bOn, int col) override
+ {
+ (void) rIter;
+ (void) bOn;
+ (void) col;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual TriState get_toggle(const weld::TreeIter& rIter, int col) const override
+ {
+ (void) rIter;
+ (void) col;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return TRISTATE_FALSE;
+ }
+
+ virtual OUString get_text(const weld::TreeIter& rIter, int col = -1) const override
+ {
+ (void) rIter;
+ (void) col;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return "";
+ }
+
+ virtual void set_id(const weld::TreeIter& rIter, const OUString& rId) override
+ {
+ (void) rIter;
+ (void) rId;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual OUString get_id(const weld::TreeIter& rIter) const override
+ {
+ (void) rIter;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return "";
+ }
+
+ virtual void set_image(const weld::TreeIter& rIter, VirtualDevice& rImage, int col) override
+ {
+ (void) rIter;
+ (void) rImage;
+ (void) col;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_image(const weld::TreeIter& rIter,
+ const css::uno::Reference<css::graphic::XGraphic>& rImage, int col) override
+ {
+ (void) rIter;
+ (void) rImage;
+ (void) col;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_font_color(const weld::TreeIter& rIter, const Color& rColor) override
+ {
+ (void) rIter;
+ (void) rColor;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void scroll_to_row(const weld::TreeIter& rIter) override
+ {
+ (void) rIter;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual bool is_selected(const weld::TreeIter& rIter) const override
+ {
+ (void) rIter;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return false;
+ }
+
+ virtual void move_subtree(weld::TreeIter& rNode, const weld::TreeIter* pNewParent, int nIndexInNewParent) override
+ {
+ (void) rNode;
+ (void) pNewParent;
+ (void) nIndexInNewParent;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void all_foreach(const std::function<bool(weld::TreeIter&)>& func) override
+ {
+ (void) func;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void selected_foreach(const std::function<bool(weld::TreeIter&)>& func) override
+ {
+ (void) func;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void visible_foreach(const std::function<bool(weld::TreeIter&)>& func) override
+ {
+ (void) func;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void bulk_insert_for_each(int nSourceCount,
+ const std::function<void(weld::TreeIter&, int nSourceIndex)>& func,
+ const std::vector<int>* pFixedWidths = nullptr) override
+ {
+ (void) nSourceCount;
+ (void) func;
+ (void) pFixedWidths;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void start_editing(const weld::TreeIter& rEntry) override
+ {
+ (void) rEntry;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void end_editing() override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void enable_drag_source(rtl::Reference<TransferDataContainer>& rTransferrable,
+ sal_uInt8 eDNDConstants) override
+ {
+ (void) rTransferrable;
+ (void) eDNDConstants;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual int n_children() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return 0;
+ }
+
+ virtual void make_sorted() override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void make_unsorted() override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual bool get_sort_order() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return false;
+ }
+
+ virtual void set_sort_order(bool bAscending) override
+ {
+ (void) bAscending;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_sort_indicator(TriState eState, int nColumn = -1) override
+ {
+ (void) eState;
+ (void) nColumn;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual TriState get_sort_indicator(int nColumn = -1) const override
+ {
+ (void) nColumn;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return TRISTATE_FALSE;
+ }
+
+ virtual int get_sort_column() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return 0;
+ }
+
+ virtual void set_sort_column(int nColumn) override
+ {
+ (void) nColumn;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void clear() override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual int get_height_rows(int nRows) const override
+ {
+ (void) nRows;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return 0;
+ }
+
+ virtual void columns_autosize() override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_column_fixed_widths(const std::vector<int>& rWidths) override
+ {
+ (void) rWidths;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_column_editables(const std::vector<bool>& rEditables) override
+ {
+ (void) rEditables;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual int get_column_width(int nCol) const override
+ {
+ (void) nCol;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return 0;
+ }
+
+ virtual void set_centered_column(int nCol) override
+ {
+ (void) nCol;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual OUString get_column_title(int nColumn) const override
+ {
+ (void) nColumn;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return "";
+ }
+
+ virtual void set_column_title(int nColumn, const OUString& rTitle) override
+ {
+ (void) nColumn;
+ (void) rTitle;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_selection_mode(SelectionMode eMode) override
+ {
+ (void) eMode;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual int count_selected_rows() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return 0;
+ }
+
+ virtual void remove_selection() override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void vadjustment_set_value(int value) override
+ {
+ (void) value;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual int vadjustment_get_value() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return 0;
+ }
+
+ virtual bool get_dest_row_at_pos(const Point& rPos, weld::TreeIter* pResult) override
+ {
+ (void) rPos;
+ (void) pResult;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return false;
+ }
+
+ virtual tools::Rectangle get_row_area(const weld::TreeIter& rIter) const override
+ {
+ (void) rIter;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return tools::Rectangle();
+ }
+
+ virtual weld::TreeView* get_drag_source() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual ~AppKitInstanceTreeView() override
+ {
+ }
+};
+
+class AppKitInstanceSpinButton final : public AppKitInstanceEntry, public virtual weld::SpinButton
+{
+private:
+ NSStepper* m_pStepper;
+
+public:
+ AppKitInstanceSpinButton(NSTextField* pTextField, NSStepper* pStepper, AppKitInstanceBuilder* pBuilder, bool bTakeOwnership)
+ : AppKitInstanceEntry(pTextField, pBuilder, bTakeOwnership)
+ , m_pStepper(pStepper)
+ {
+ }
+
+ virtual void set_value(int value) override
+ {
+ [m_pStepper setIntValue:value];
+ }
+
+ virtual int get_value() const override
+ {
+ return [m_pStepper intValue];
+ }
+
+ virtual void set_range(int min, int max) override
+ {
+ [m_pStepper setMinValue:min];
+ [m_pStepper setMaxValue:max];
+ }
+
+ virtual void get_range(int& min, int& max) const override
+ {
+ min = [m_pStepper minValue];
+ max = [m_pStepper maxValue];
+ }
+
+ virtual void set_increments(int step, int page) override
+ {
+ (void) page;
+ [m_pStepper setIncrement:step];
+ }
+
+ virtual void get_increments(int& step, int& page) const override
+ {
+ step = [m_pStepper increment];
+ page = step;
+ }
+
+ virtual void set_digits(unsigned int digits) override
+ {
+ (void) digits;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual unsigned int get_digits() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return 1;
+ }
+
+ virtual ~AppKitInstanceSpinButton() override
+ {
+ }
+};
+
+class AppKitInstanceLabel final : public AppKitInstanceWidget, public virtual weld::Label
+{
+private:
+ NSTextField* m_pTextField;
+
+public:
+ AppKitInstanceLabel(NSTextField* pTextField, AppKitInstanceBuilder* pBuilder, bool bTakeOwnership)
+ : AppKitInstanceWidget(pTextField, pBuilder, bTakeOwnership)
+ , m_pTextField(pTextField)
+ {
+ // SAL_DEBUG("AppKitInstanceLabel CTOR this=" << this);
+ }
+
+ virtual ~AppKitInstanceLabel()
+ {
+ // SAL_DEBUG("AppKitInstanceLabel DTOR this=" << this);
+ }
+
+ virtual void set_label(const OUString& rText) override
+ {
+ [m_pTextField setStringValue:CreateNSString(rText)];
+ }
+
+ virtual OUString get_label() const override
+ {
+ return GetOUString([m_pTextField stringValue]);
+ }
+
+ virtual void set_mnemonic_widget(Widget* pTarget) override
+ {
+ (void) pTarget;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_message_type(weld::EntryMessageType eType) override
+ {
+ (void) eType;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_font(const vcl::Font& rFont) override
+ {
+ (void) rFont;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+};
+
+class AppKitInstanceComboBox final : public AppKitInstanceContainer, public vcl::ISearchableStringList, public virtual weld::ComboBox
+{
+private:
+ NSComboBox* m_pComboBox;
+
+public:
+ AppKitInstanceComboBox(NSComboBox* pComboBox, AppKitInstanceBuilder* pBuilder, bool bTakeOwnership)
+ : AppKitInstanceContainer(pComboBox, pBuilder, bTakeOwnership)
+ {
+ }
+
+ virtual void insert(int pos, const OUString& rStr, const OUString* pId,
+ const OUString* pIconName, VirtualDevice* pImageSurface) override
+ {
+ (void) pos;
+ (void) rStr;
+ (void) pId;
+ (void) pIconName;
+ (void) pImageSurface;
+ (void) m_pComboBox;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void insert_vector(const std::vector<weld::ComboBoxEntry>& rItems, bool bKeepExisting) override
+ {
+ (void) rItems;
+ (void) bKeepExisting;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void insert_separator(int pos, const OUString& rId) override
+ {
+ (void) pos;
+ (void) rId;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual int get_count() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return 0;
+ }
+
+ virtual void make_sorted() override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void clear() override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual int get_active() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return 0;
+ }
+
+ virtual void set_active(int pos) override
+ {
+ (void) pos;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void remove(int pos) override
+ {
+ (void) pos;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual OUString get_active_text() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return "";
+ }
+
+ virtual OUString get_text(int pos) const override
+ {
+ (void) pos;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return "";
+ }
+
+ virtual int find_text(const OUString& rStr) const override
+ {
+ (void) rStr;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return 0;
+ }
+
+ virtual OUString get_active_id() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return "";
+ }
+
+ virtual void set_active_id(const OUString& rStr) override
+ {
+ (void) rStr;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual OUString get_id(int pos) const override
+ {
+ (void) pos;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return "";
+ }
+
+ virtual void set_id(int row, const OUString& rId) override
+ {
+ (void) row;
+ (void) rId;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual int find_id(const OUString& rId) const override
+ {
+ (void) rId;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return 0;
+ }
+
+ virtual bool changed_by_direct_pick() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return false;
+ }
+
+ virtual bool has_entry() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return false;
+ }
+
+ virtual void set_entry_message_type(weld::EntryMessageType eType) override
+ {
+ (void) eType;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_entry_text(const OUString& rStr) override
+ {
+ (void) rStr;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_entry_width_chars(int nChars) override
+ {
+ (void) nChars;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_entry_max_length(int nChars) override
+ {
+ (void) nChars;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void select_entry_region(int nStartPos, int nEndPos) override
+ {
+ (void) nStartPos;
+ (void) nEndPos;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual bool get_entry_selection_bounds(int& rStartPos, int& rEndPos) override
+ {
+ (void) rStartPos;
+ (void) rEndPos;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return false;
+ }
+
+ virtual void set_entry_completion(bool bEnable, bool bCaseSensitive = false) override
+ {
+ (void) bEnable;
+ (void) bCaseSensitive;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual void set_entry_placeholder_text(const OUString& rText) override
+ {
+ (void) rText;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+
+ virtual bool get_popup_shown() const override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return false;
+ }
+
+ virtual vcl::StringEntryIdentifier CurrentEntry(OUString& _out_entryText) const override
+ {
+ (void) _out_entryText;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual vcl::StringEntryIdentifier NextEntry(vcl::StringEntryIdentifier _currentEntry, OUString& _out_entryText) const override
+ {
+ (void) _currentEntry;
+ (void) _out_entryText;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual void SelectEntry(vcl::StringEntryIdentifier _entry) override
+ {
+ (void) _entry;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ }
+};
+
+class AppKitInstanceBuilder : public weld::Builder
+{
+private:
+ NSView* m_pParent;
+
+ ResHookProc const m_pStringReplace;
+
+ std::map<OString, OUString> m_aDeferredProperties;
+
+ AppKitInstanceBuilder(const AppKitInstanceBuilder&) = delete;
+ AppKitInstanceBuilder& operator=(const AppKitInstanceBuilder&) = delete;
+
+ struct PackingData
+ {
+ bool m_bVerticalOrient;
+ sal_Int32 m_nPosition;
+ PackingData(bool bVerticalOrient = false)
+ : m_bVerticalOrient(bVerticalOrient)
+ , m_nPosition(-1)
+ {
+ }
+ };
+
+ struct IdAndView
+ {
+ OString m_sId;
+ NSView* m_pView;
+ PackingData m_aPackingData;
+ IdAndView(const OString &rId, NSView* pView, bool bVertical)
+ : m_sId(rId)
+ , m_pView(pView)
+ , m_aPackingData(bVertical)
+ {
+ }
+ };
+ std::vector<IdAndView> m_aChildren;
+
+ struct StringPair
+ {
+ OString const m_sID;
+ OString const m_sValue;
+ StringPair(const OString &rId, const OString &rValue)
+ : m_sID(rId)
+ , m_sValue(rValue)
+ {
+ }
+ };
+
+ struct UStringPair
+ {
+ OString m_sID;
+ OUString m_sValue;
+ UStringPair(const OString &rId, const OUString &rValue)
+ : m_sID(rId)
+ , m_sValue(rValue)
+ {
+ }
+ };
+
+ typedef StringPair RadioButtonGroupMap;
+ typedef UStringPair MnemonicWidgetMap;
+
+ std::locale m_aResLocale;
+
+ std::vector<RadioButtonGroupMap> m_aGroupMaps;
+
+ std::map<OString, std::map<OString, OUString>> m_aAdjustments;
+
+ std::vector<MnemonicWidgetMap> m_aMnemonicWidgetMaps;
+
+public:
+ AppKitInstanceBuilder(NSView* pParent, const OUString& rUIRoot, const OUString& rUIFile)
+ : weld::Builder(rUIFile)
+ , m_pParent(pParent)
+ , m_pStringReplace(Translate::GetReadStringHook())
+ {
+ (void) m_pParent;
+
+ OUString sUri(rUIRoot + rUIFile);
+ SAL_DEBUG("AppKitInstanceBuilder: " << sUri);
+ xmlreader::XmlReader reader(sUri);
+
+ handleChild(pParent, reader);
+ }
+
+ virtual std::unique_ptr<weld::MessageDialog> weld_message_dialog(const OString &id, bool bTakeOwnership) override
+ {
+ (void) id;
+ (void) bTakeOwnership;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::AboutDialog> weld_about_dialog(const OString &id, bool bTakeOwnership) override
+ {
+ (void) id;
+ (void) bTakeOwnership;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::Assistant> weld_assistant(const OString &id, bool bTakeOwnership) override
+ {
+ (void) id;
+ (void) bTakeOwnership;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::Dialog> weld_dialog(const OString &rId, bool bTakeOwnership) override
+ {
+ // This is apparently where we need to parse the .ui file? No,
+ // wait, we do that in the AppKitInstanceBuilder ctor.
+
+ for (const auto &i : m_aChildren)
+ {
+ if (i.m_sId == rId)
+ return std::make_unique<AppKitInstanceDialog>(i.m_pView.window, this, bTakeOwnership);
+ }
+
+ SAL_WARN("vcl.osx.weld", "returning nullptr: " << OSL_THIS_FUNC);
+
+ return nullptr;
+
+#if 0
+ Dialog* pDialog = m_xBuilder->get<Dialog>(id);
+ std::unique_ptr<weld::Dialog> pRet(pDialog ? new SalInstanceDialog(pDialog, this, false) : nullptr);
+ if (bTakeOwnership && pDialog)
+ {
+ assert(!m_aOwnedToplevel && "only one toplevel per .ui allowed");
+ m_aOwnedToplevel.set(pDialog);
+ m_xBuilder->drop_ownership(pDialog);
+ }
+
+ return pRet;
+#endif
+ }
+
+ virtual std::unique_ptr<weld::Window> create_screenshot_window() override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::Window> weld_window(const OString &id, bool bTakeOwnership) override
+ {
+ (void) id;
+ (void) bTakeOwnership;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::Widget> weld_widget(const OString &id, bool bTakeOwnership) override
+ {
+ (void) id;
+ (void) bTakeOwnership;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::Container> weld_container(const OString &id, bool bTakeOwnership) override
+ {
+ (void) id;
+ (void) bTakeOwnership;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::Box> weld_box(const OString &id, bool bTakeOwnership) override
+ {
+ (void) id;
+ (void) bTakeOwnership;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::Frame> weld_frame(const OString &id, bool bTakeOwnership) override
+ {
+ (void) id;
+ (void) bTakeOwnership;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::ScrolledWindow> weld_scrolled_window(const OString &id, bool bTakeOwnership) override
+ {
+ (void) id;
+ (void) bTakeOwnership;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::Notebook> weld_notebook(const OString &id, bool bTakeOwnership) override
+ {
+ (void) id;
+ (void) bTakeOwnership;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::Button> weld_button(const OString &id, bool bTakeOwnership) override
+ {
+ (void) id;
+ (void) bTakeOwnership;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::MenuButton> weld_menu_button(const OString &id, bool bTakeOwnership) override
+ {
+ (void) id;
+ (void) bTakeOwnership;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::LinkButton> weld_link_button(const OString &id, bool bTakeOwnership) override
+ {
+ (void) id;
+ (void) bTakeOwnership;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::ToggleButton> weld_toggle_button(const OString &id, bool bTakeOwnership) override
+ {
+ (void) id;
+ (void) bTakeOwnership;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::RadioButton> weld_radio_button(const OString &id, bool bTakeOwnership) override
+ {
+ (void) id;
+ (void) bTakeOwnership;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::CheckButton> weld_check_button(const OString &id, bool bTakeOwnership) override
+ {
+ (void) id;
+ (void) bTakeOwnership;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::Scale> weld_scale(const OString &id, bool bTakeOwnership) override
+ {
+ (void) id;
+ (void) bTakeOwnership;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::ProgressBar> weld_progress_bar(const OString &id, bool bTakeOwnership) override
+ {
+ (void) id;
+ (void) bTakeOwnership;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::Spinner> weld_spinner(const OString &id, bool bTakeOwnership) override
+ {
+ (void) id;
+ (void) bTakeOwnership;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::Image> weld_image(const OString &id, bool bTakeOwnership) override
+ {
+ (void) id;
+ (void) bTakeOwnership;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::Calendar> weld_calendar(const OString &id, bool bTakeOwnership) override
+ {
+ (void) id;
+ (void) bTakeOwnership;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::Entry> weld_entry(const OString &id, bool bTakeOwnership) override
+ {
+ (void) id;
+ (void) bTakeOwnership;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::SpinButton> weld_spin_button(const OString &id, bool bTakeOwnership) override
+ {
+ (void) id;
+ (void) bTakeOwnership;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::MetricSpinButton> weld_metric_spin_button(const OString& id, FieldUnit eUnit,
+ bool bTakeOwnership) override
+ {
+ return std::make_unique<weld::MetricSpinButton>(weld_spin_button(id, bTakeOwnership), eUnit);
+ }
+
+ virtual std::unique_ptr<weld::FormattedSpinButton> weld_formatted_spin_button(const OString &id, bool bTakeOwnership) override
+ {
+ (void) id;
+ (void) bTakeOwnership;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::TimeSpinButton> weld_time_spin_button(const OString& id, TimeFieldFormat eFormat,
+ bool bTakeOwnership) override
+ {
+ return std::make_unique<weld::TimeSpinButton>(weld_spin_button(id, bTakeOwnership), eFormat);
+ }
+
+ virtual std::unique_ptr<weld::ComboBox> weld_combo_box(const OString &id, bool bTakeOwnership) override
+ {
+ (void) id;
+ (void) bTakeOwnership;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::TreeView> weld_tree_view(const OString &id, bool bTakeOwnership) override
+ {
+ (void) id;
+ (void) bTakeOwnership;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::IconView> weld_icon_view(const OString &id, bool bTakeOwnership) override
+ {
+ (void) id;
+ (void) bTakeOwnership;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::EntryTreeView> weld_entry_tree_view(const OString& containerid, const OString& entryid, const OString& treeviewid, bool bTakeOwnership) override
+ {
+ (void) containerid;
+ (void) entryid;
+ (void) treeviewid;
+ (void) bTakeOwnership;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::Label> weld_label(const OString &rId, bool bTakeOwnership) override
+ {
+ (void) bTakeOwnership;
+ for (const auto& i : m_aChildren)
+ {
+ if (i.m_sId == rId)
+ return std::make_unique<AppKitInstanceLabel>((NSTextField*) i.m_pView, this, bTakeOwnership);
+ }
+
+ SAL_WARN("vcl.osx.weld", "AppKitInstanceBuilder::weld_label(" << rId << "): not found");
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::TextView> weld_text_view(const OString &id, bool bTakeOwnership) override
+ {
+ (void) id;
+ (void) bTakeOwnership;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::Expander> weld_expander(const OString &id, bool bTakeOwnership) override
+ {
+ (void) id;
+ (void) bTakeOwnership;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::DrawingArea> weld_drawing_area(const OString &id, const a11yref& rA11y,
+ FactoryFunction /*pUITestFactoryFunction*/, void* /*pUserData*/, bool bTakeOwnership) override
+ {
+ (void) id;
+ (void) rA11y;
+ (void) bTakeOwnership;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::Menu> weld_menu(const OString &id, bool bTakeOwnership) override
+ {
+ (void) id;
+ (void) bTakeOwnership;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::Toolbar> weld_toolbar(const OString &id, bool bTakeOwnership) override
+ {
+ (void) id;
+ (void) bTakeOwnership;
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual std::unique_ptr<weld::SizeGroup> create_size_group() override
+ {
+ SAL_WARN("vcl.osx.weld", "Not yet implemented: " << OSL_THIS_FUNC);
+ return nullptr;
+ }
+
+ virtual ~AppKitInstanceBuilder() override
+ {
+ }
+
+private:
+ void applyPackingProperty(NSView* pCurrent, NSView* pParent, xmlreader::XmlReader &reader)
+ {
+ (void) pParent;
+
+ if (!pCurrent)
+ return;
+
+#if 0
+ //ToolBoxItems are not true widgets just elements
+ //of the ToolBox itself
+ ToolBox *pToolBoxParent = nullptr;
+ if (pCurrent == pParent)
+ pToolBoxParent = dynamic_cast<ToolBox*>(pParent);
+#endif
+
+ xmlreader::Span name;
+ int nsId;
+
+#if 0
+ if (pCurrent->GetType() == WindowType::SCROLLWINDOW)
+ {
+ auto aFind = m_pParserState->m_aRedundantParentWidgets.find(VclPtr<vcl::Window>(pCurrent));
+ if (aFind != m_pParserState->m_aRedundantParentWidgets.end())
+ {
+ pCurrent = aFind->second;
+ assert(pCurrent);
+ }
+ }
+#endif
+ NSGridView* gridView = [NSGridView castFrom:pParent];
+ if (gridView == nil)
+ return;
+
+ while (reader.nextAttribute(&nsId, &name))
+ {
+ if (name == "name")
+ {
+ name = reader.getAttributeValue(false);
+ OString sKey(name.begin, name.length);
+ sKey = sKey.replace('_', '-');
+ (void)reader.nextItem(xmlreader::XmlReader::Text::Raw, &name, &nsId);
+ OString sValue(name.begin, name.length);
+
+ SAL_DEBUG("apply packing: " << sKey << " " << sValue);
+
+ if (sKey == "expand" || sKey == "resize")
+ {
+ bool bTrue = (!sValue.isEmpty() && (sValue[0] == 't' || sValue[0] == 'T' || sValue[0] == '1'));
+ (void) bTrue;
+#if 0
+ if (pToolBoxParent)
+ pToolBoxParent->SetItemExpand(m_pParserState->m_nLastToolbarId, bTrue);
+ else
+ pCurrent->set_expand(bTrue);
+#endif
+ continue;
+ }
+
+#if 0
+ if (pToolBoxParent)
+ continue;
+#endif
+ if (sKey == "fill")
+ {
+ // bool bTrue = (!sValue.isEmpty() && (sValue[0] == 't' || sValue[0] == 'T' || sValue[0] == '1'));
+ // pCurrent->set_fill(bTrue);
+ }
+ else if (sKey == "pack-type")
+ {
+ // VclPackType ePackType = (!sValue.isEmpty() && (sValue[0] == 'e' || sValue[0] == 'E')) ? VclPackType::End : VclPackType::Start;
+ // pCurrent->set_pack_type(ePackType);
+ }
+ else if (sKey == "left-attach")
+ {
+ set_left_attach(pCurrent, sValue.toInt32());
+ }
+ else if (sKey == "top-attach")
+ {
+ set_top_attach(pCurrent, sValue.toInt32());
+ }
+ else if (sKey == "width")
+ {
+ // pCurrent->set_grid_width(sValue.toInt32());
+ }
+ else if (sKey == "height")
+ {
+ // pCurrent->set_grid_height(sValue.toInt32());
+ }
+ else if (sKey == "padding")
+ {
+ // pCurrent->set_padding(sValue.toInt32());
+ }
+ else if (sKey == "position")
+ {
+ // set_window_packing_position(pCurrent, sValue.toInt32());
+ }
+ else if (sKey == "secondary")
+ {
+ // pCurrent->set_secondary(toBool(sValue));
+ }
+ else if (sKey == "non-homogeneous")
+ {
+ // pCurrent->set_non_homogeneous(toBool(sValue));
+ }
+ else if (sKey == "homogeneous")
+ {
+ // pCurrent->set_non_homogeneous(!toBool(sValue));
+ }
+ else
+ {
+ SAL_WARN("vcl.osx.weld", "unknown packing: " << sKey);
+ }
+ }
+ }
+
+ long leftAttach = get_left_attach(pCurrent);
+ long topAttach = get_top_attach(pCurrent)-1;
+ if (leftAttach >= 0 && topAttach >= 0)
+ {
+ if (leftAttach >= gridView.numberOfColumns)
+ {
+ for (int i = gridView.numberOfColumns; i <= leftAttach; i++)
+ [gridView addColumnWithViews:@[]];
+ }
+ NSGridColumn* oldColumn = [gridView columnAtIndex:leftAttach];
+ NSMutableArray<NSView*>* newColumn = [NSMutableArray arrayWithCapacity:std::max(topAttach+1, oldColumn.numberOfCells)];
+ for (int j = 0; j < topAttach; j++)
+ newColumn[j] = [[oldColumn cellAtIndex:j] contentView];
+ newColumn[topAttach] = pCurrent;
+ for (int j = topAttach+1; j < oldColumn.numberOfCells; j++)
+ {
+ id oldCellContent = [[oldColumn cellAtIndex:j] contentView];
+ if (oldCellContent != nil)
+ newColumn[j] = oldCellContent;
+ else
+ newColumn[j] = [NSGridCell emptyContentView];
+ }
+ [gridView removeColumnAtIndex:leftAttach];
+ [gridView insertColumnAtIndex:leftAttach withViews:newColumn];
+ }
+ }
+
+ void handlePacking(NSView* pCurrent, NSView* pParent, xmlreader::XmlReader &reader)
+ {
+ xmlreader::Span name;
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list