[Libreoffice-commits] core.git: Branch 'feature/qt5+kde5' - 2 commits - vcl/inc vcl/Library_vclplug_qt5.mk vcl/qt5
Katarina Behrens
Katarina.Behrens at cib.de
Wed May 9 08:40:49 UTC 2018
vcl/Library_vclplug_qt5.mk | 1
vcl/inc/qt5/Qt5Instance.hxx | 5 ++
vcl/inc/qt5/Qt5Menu.hxx | 66 ++++++++++++++++++++++++++++++++
vcl/qt5/Qt5Instance.cxx | 23 +++++++++++
vcl/qt5/Qt5Menu.cxx | 89 ++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 184 insertions(+)
New commits:
commit 3e386ed3652133a9835bb0243dd94e02ecc83005
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Tue May 8 18:35:44 2018 +0200
Prep Qt5Instance for native menus
Change-Id: I7ec34b13823b943ef5e99b92d919c2df795d6ace
diff --git a/vcl/inc/qt5/Qt5Instance.hxx b/vcl/inc/qt5/Qt5Instance.hxx
index 19d3bfc2d9f8..da27b187789e 100644
--- a/vcl/inc/qt5/Qt5Instance.hxx
+++ b/vcl/inc/qt5/Qt5Instance.hxx
@@ -79,6 +79,11 @@ public:
virtual OUString GetDefaultPrinter() override;
virtual void PostPrintersChanged() override;
+ virtual SalMenu* CreateMenu( bool, Menu* ) override;
+ virtual void DestroyMenu( SalMenu* pMenu ) override;
+ virtual SalMenuItem* CreateMenuItem( const SalItemParams* ) override;
+ virtual void DestroyMenuItem( SalMenuItem* pItem ) override;
+
virtual SalTimer* CreateSalTimer() override;
virtual SalSystem* CreateSalSystem() override;
virtual SalBitmap* CreateSalBitmap() override;
diff --git a/vcl/qt5/Qt5Instance.cxx b/vcl/qt5/Qt5Instance.cxx
index beab3ed902b8..e8c6c5786888 100644
--- a/vcl/qt5/Qt5Instance.cxx
+++ b/vcl/qt5/Qt5Instance.cxx
@@ -24,6 +24,7 @@
#include "Qt5Data.hxx"
#include "Qt5FilePicker.hxx"
#include "Qt5Frame.hxx"
+#include "Qt5Menu.hxx"
#include "Qt5Object.hxx"
#include "Qt5Timer.hxx"
#include "Qt5VirtualDevice.hxx"
@@ -107,6 +108,28 @@ SalVirtualDevice* Qt5Instance::CreateVirtualDevice(SalGraphics* /* pGraphics */,
}
}
+SalMenu* Qt5Instance::CreateMenu( bool bMenuBar, Menu* pVCLMenu )
+{
+ Qt5Menu* pSalMenu = new Qt5Menu( bMenuBar );
+ pSalMenu->SetMenu( pVCLMenu );
+ return pSalMenu;
+}
+
+void Qt5Instance::DestroyMenu( SalMenu* pMenu )
+{
+ delete pMenu;
+}
+
+SalMenuItem* Qt5Instance::CreateMenuItem( const SalItemParams* pItemData )
+{
+ return new Qt5MenuItem( pItemData );
+}
+
+void Qt5Instance::DestroyMenuItem( SalMenuItem* pItem )
+{
+ delete pItem;
+}
+
SalTimer* Qt5Instance::CreateSalTimer() { return new Qt5Timer(); }
SalSystem* Qt5Instance::CreateSalSystem() { return new SvpSalSystem(); }
commit 748da4ae6657b2205c8006dbfa5c0c309ed7ccb3
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Tue May 8 16:05:59 2018 +0200
Basic skeleton of native menus
in the closet
Change-Id: Ic54b3853b53987b3e5a85444da0b9167a785bd81
diff --git a/vcl/Library_vclplug_qt5.mk b/vcl/Library_vclplug_qt5.mk
index 8ebee18f71e4..075eb0bb0be8 100644
--- a/vcl/Library_vclplug_qt5.mk
+++ b/vcl/Library_vclplug_qt5.mk
@@ -91,6 +91,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\
vcl/qt5/Qt5Graphics_Text \
vcl/qt5/Qt5Instance \
vcl/qt5/Qt5Instance_Print \
+ vcl/qt5/Qt5Menu \
vcl/qt5/Qt5Object \
vcl/qt5/Qt5Painter \
vcl/qt5/Qt5Printer \
diff --git a/vcl/inc/qt5/Qt5Menu.hxx b/vcl/inc/qt5/Qt5Menu.hxx
new file mode 100644
index 000000000000..cf7a715f5911
--- /dev/null
+++ b/vcl/inc/qt5/Qt5Menu.hxx
@@ -0,0 +1,66 @@
+/* -*- 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/.
+ */
+
+#pragma once
+
+#include <salmenu.hxx>
+
+class MenuItemList;
+class Qt5MenuItem;
+class Qt5Frame;
+
+class Qt5Menu : public SalMenu
+{
+private:
+ std::vector< Qt5MenuItem* > maItems;
+ VclPtr<Menu> mpVCLMenu;
+ Qt5Menu* mpParentSalMenu;
+ Qt5Frame* mpFrame;
+ bool mbMenuBar;
+
+public:
+ Qt5Menu( bool bMenuBar );
+ virtual ~Qt5Menu() override;
+
+ virtual bool VisibleMenuBar() override; // must return TRUE to actually DISPLAY native menu bars
+
+ virtual void InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos ) override;
+ virtual void RemoveItem( unsigned nPos ) override;
+ virtual void SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos ) override;
+ virtual void SetFrame( const SalFrame* pFrame ) override;
+ const Qt5Frame* GetFrame() const;
+ virtual void CheckItem( unsigned nPos, bool bCheck ) override;
+ virtual void EnableItem( unsigned nPos, bool bEnable ) override;
+ virtual void ShowItem( unsigned nPos, bool bShow ) override;
+ virtual void SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const OUString& rText ) override;
+ virtual void SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage) override;
+ virtual void SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const vcl::KeyCode& rKeyCode, const OUString& rKeyName ) override;
+ virtual void GetSystemMenuData( SystemMenuData* pData ) override;
+
+ void SetMenu( Menu* pMenu ) { mpVCLMenu = pMenu; }
+ Menu* GetMenu() { return mpVCLMenu; }
+ unsigned GetItemCount() { return maItems.size(); }
+ Qt5MenuItem* GetItemAtPos( unsigned nPos ) { return maItems[ nPos ]; }
+};
+
+class Qt5MenuItem : public SalMenuItem
+{
+public:
+ Qt5MenuItem( const SalItemParams* );
+ virtual ~Qt5MenuItem() override;
+
+ sal_uInt16 mnId; // Item ID
+ MenuItemType mnType; // Item type
+ bool mbVisible; // Item visibility.
+ Menu* mpVCLMenu;
+ Qt5Menu* mpParentMenu; // The menu into which this menu item is inserted
+ Qt5Menu* mpSubMenu; // Submenu of this item (if defined)
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx
new file mode 100644
index 000000000000..2471f779c463
--- /dev/null
+++ b/vcl/qt5/Qt5Menu.cxx
@@ -0,0 +1,89 @@
+/* -*- 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 "Qt5Frame.hxx"
+#include "Qt5Menu.hxx"
+
+Qt5Menu::Qt5Menu( bool bMenuBar ) :
+ mpVCLMenu( nullptr ),
+ mpParentSalMenu( nullptr ),
+ mpFrame( nullptr ),
+ mbMenuBar( bMenuBar )
+{
+}
+
+Qt5Menu::~Qt5Menu()
+{
+}
+
+bool Qt5Menu::VisibleMenuBar()
+{
+ return false;
+}
+
+void Qt5Menu::InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos )
+{
+}
+
+void Qt5Menu::RemoveItem( unsigned nPos )
+{
+}
+
+void Qt5Menu::SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos )
+{
+}
+
+void Qt5Menu::SetFrame( const SalFrame* pFrame )
+{
+
+ mpFrame = const_cast<Qt5Frame*>( static_cast<const Qt5Frame*>( pFrame ) );
+}
+
+void Qt5Menu::ShowItem( unsigned nPos, bool bCheck )
+{
+}
+
+void Qt5Menu::CheckItem( unsigned nPos, bool bCheck )
+{
+}
+
+void Qt5Menu::EnableItem( unsigned nPos, bool bEnable )
+{
+}
+
+void Qt5Menu::SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const rtl::OUString& rText )
+{
+}
+
+void Qt5Menu::SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage)
+{
+}
+
+void Qt5Menu::SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const vcl::KeyCode& rKeyCode, const OUString& rKeyName )
+{
+}
+
+void Qt5Menu::GetSystemMenuData( SystemMenuData* pData )
+{
+}
+
+
+Qt5MenuItem::Qt5MenuItem( const SalItemParams* pItemData ) :
+ mnId( pItemData->nId ),
+ mpVCLMenu( pItemData->pMenu ),
+ mpParentMenu( nullptr ),
+ mpSubMenu( nullptr )
+{
+}
+
+Qt5MenuItem::~Qt5MenuItem()
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list