Rebased ref, commits from common ancestor: commit 9e2528e19beeed25e41bf069edf6083d36429b22 Author: Katarina Behrens <katarina.behr...@cib.de> Date: Thu May 31 12:14:55 2018 +0200
Make clang-format happy, remove vcl/unx/kde5 from blacklist just between us girls, I hate you clang-format Change-Id: I4cd041eff7a9fa01eb9192cf357e3f07a26fa6ad diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist index 7dcd63136243..79c639c82cb9 100644 --- a/solenv/clang-format/blacklist +++ b/solenv/clang-format/blacklist @@ -18501,24 +18501,6 @@ vcl/unx/kde4/VCLKDEApplication.hxx vcl/unx/kde4/main.cxx vcl/unx/kde4/tst_exclude_posted_events.hxx vcl/unx/kde4/tst_exclude_socket_notifiers.hxx -vcl/unx/kde5/FPServiceInfo.hxx -vcl/unx/kde5/KDE5Data.cxx -vcl/unx/kde5/KDE5Data.hxx -vcl/unx/kde5/KDE5SalDisplay.cxx -vcl/unx/kde5/KDE5SalDisplay.hxx -vcl/unx/kde5/KDE5SalFrame.cxx -vcl/unx/kde5/KDE5SalFrame.hxx -vcl/unx/kde5/KDE5SalGraphics.cxx -vcl/unx/kde5/KDE5SalGraphics.hxx -vcl/unx/kde5/KDE5SalInstance.cxx -vcl/unx/kde5/KDE5SalInstance.hxx -vcl/unx/kde5/KDE5XLib.cxx -vcl/unx/kde5/KDE5XLib.hxx -vcl/unx/kde5/VCLKDE5Application.cxx -vcl/unx/kde5/VCLKDE5Application.hxx -vcl/unx/kde5/main.cxx -vcl/unx/kde5/tst_exclude_posted_events.hxx -vcl/unx/kde5/tst_exclude_socket_notifiers.hxx vcl/unx/x11/x11sys.cxx vcl/unx/x11/xlimits.cxx vcl/win/app/saldata.cxx diff --git a/vcl/inc/qt5/Qt5FilePicker.hxx b/vcl/inc/qt5/Qt5FilePicker.hxx index 1aa19b3459f4..9133c4353295 100644 --- a/vcl/inc/qt5/Qt5FilePicker.hxx +++ b/vcl/inc/qt5/Qt5FilePicker.hxx @@ -43,190 +43,218 @@ class QGridLayout; class QLabel; class QWidget; -typedef ::cppu::WeakComponentImplHelper - < css::ui::dialogs::XFilePicker3 - , css::ui::dialogs::XFilePickerControlAccess - , css::ui::dialogs::XFolderPicker2 - , css::lang::XInitialization - , css::lang::XServiceInfo - > Qt5FilePicker_Base; - -class Qt5FilePicker - : public QObject - , public Qt5FilePicker_Base +typedef ::cppu::WeakComponentImplHelper< + css::ui::dialogs::XFilePicker3, css::ui::dialogs::XFilePickerControlAccess, + css::ui::dialogs::XFolderPicker2, css::lang::XInitialization, css::lang::XServiceInfo> + Qt5FilePicker_Base; + +class Qt5FilePicker : public QObject, public Qt5FilePicker_Base { Q_OBJECT protected: - css::uno::Reference< css::ui::dialogs::XFilePickerListener > m_xListener; + css::uno::Reference<css::ui::dialogs::XFilePickerListener> m_xListener; - QFileDialog* m_pFileDialog; ///< the non-extendable file picker dialog + QFileDialog* m_pFileDialog; ///< the non-extendable file picker dialog - osl::Mutex m_aHelperMutex; ///< mutex used by the WeakComponentImplHelper + osl::Mutex m_aHelperMutex; ///< mutex used by the WeakComponentImplHelper - QStringList m_aNamedFilterList; ///< named filter list for the QFileDialog - QStringList m_aFilterTitleList; ///< the original filter titles - QString m_aCurrentFilterTitle; ///< the current filter title + QStringList m_aNamedFilterList; ///< named filter list for the QFileDialog + QStringList m_aFilterTitleList; ///< the original filter titles + QString m_aCurrentFilterTitle; ///< the current filter title - QDialog *m_pOptionsDialog; ///< an extra options dialog window - QLabel *m_pFilenameLabel; ///< label to display the filename - QLabel *m_pFilterLabel; ///< label to display the filter - QHash<sal_Int16, QWidget*> m_aCustomWidgetsMap; ///< map of SAL control ID's to widget + QDialog* m_pOptionsDialog; ///< an extra options dialog window + QLabel* m_pFilenameLabel; ///< label to display the filename + QLabel* m_pFilterLabel; ///< label to display the filter + QHash<sal_Int16, QWidget*> m_aCustomWidgetsMap; ///< map of SAL control ID's to widget public: - explicit Qt5FilePicker( QFileDialog::FileMode ); + explicit Qt5FilePicker(QFileDialog::FileMode); virtual ~Qt5FilePicker() override; // XFilePickerNotifier - virtual void SAL_CALL addFilePickerListener( const css::uno::Reference< css::ui::dialogs::XFilePickerListener >& xListener ) override; - virtual void SAL_CALL removeFilePickerListener( const css::uno::Reference< css::ui::dialogs::XFilePickerListener >& xListener ) override; + virtual void SAL_CALL addFilePickerListener( + const css::uno::Reference<css::ui::dialogs::XFilePickerListener>& xListener) override; + virtual void SAL_CALL removeFilePickerListener( + const css::uno::Reference<css::ui::dialogs::XFilePickerListener>& xListener) override; // XFilterManager functions - virtual void SAL_CALL appendFilter( const OUString &rTitle, const OUString &rFilter ) override; - virtual void SAL_CALL setCurrentFilter( const OUString &rTitle ) override; + virtual void SAL_CALL appendFilter(const OUString& rTitle, const OUString& rFilter) override; + virtual void SAL_CALL setCurrentFilter(const OUString& rTitle) override; virtual OUString SAL_CALL getCurrentFilter() override; // XFilterGroupManager functions - virtual void SAL_CALL appendFilterGroup( const OUString &rGroupTitle, const css::uno::Sequence< css::beans::StringPair > &rFilters ) override; + virtual void SAL_CALL + appendFilterGroup(const OUString& rGroupTitle, + const css::uno::Sequence<css::beans::StringPair>& rFilters) override; // XCancellable - virtual void SAL_CALL cancel( ) override; + virtual void SAL_CALL cancel() override; // XExecutableDialog functions - virtual void SAL_CALL setTitle( const OUString &rTitle ) override; + virtual void SAL_CALL setTitle(const OUString& rTitle) override; virtual sal_Int16 SAL_CALL execute() override; // XFilePicker functions - virtual void SAL_CALL setMultiSelectionMode( sal_Bool bMode ) override; - virtual void SAL_CALL setDefaultName( const OUString &rName ) override; - virtual void SAL_CALL setDisplayDirectory( const OUString &rDirectory ) override; + virtual void SAL_CALL setMultiSelectionMode(sal_Bool bMode) override; + virtual void SAL_CALL setDefaultName(const OUString& rName) override; + virtual void SAL_CALL setDisplayDirectory(const OUString& rDirectory) override; virtual OUString SAL_CALL getDisplayDirectory() override; - virtual css::uno::Sequence< OUString > SAL_CALL getFiles() override; + virtual css::uno::Sequence<OUString> SAL_CALL getFiles() override; // XFilePickerControlAccess functions - virtual void SAL_CALL setValue( sal_Int16 nControlId, sal_Int16 nControlAction, const css::uno::Any &rValue ) override; - virtual css::uno::Any SAL_CALL getValue( sal_Int16 nControlId, sal_Int16 nControlAction ) override; - virtual void SAL_CALL enableControl( sal_Int16 nControlId, sal_Bool bEnable ) override; - virtual void SAL_CALL setLabel( sal_Int16 nControlId, const OUString &rLabel ) override; - virtual OUString SAL_CALL getLabel( sal_Int16 nControlId ) override; + virtual void SAL_CALL setValue(sal_Int16 nControlId, sal_Int16 nControlAction, + const css::uno::Any& rValue) override; + virtual css::uno::Any SAL_CALL getValue(sal_Int16 nControlId, + sal_Int16 nControlAction) override; + virtual void SAL_CALL enableControl(sal_Int16 nControlId, sal_Bool bEnable) override; + virtual void SAL_CALL setLabel(sal_Int16 nControlId, const OUString& rLabel) override; + virtual OUString SAL_CALL getLabel(sal_Int16 nControlId) override; // XFilePicker2 functions - virtual css::uno::Sequence< OUString > SAL_CALL getSelectedFiles() override; + virtual css::uno::Sequence<OUString> SAL_CALL getSelectedFiles() override; // XInitialization - virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any > &rArguments ) override; + virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& rArguments) override; // XEventListener /// @throws css::uno::RuntimeException - virtual void SAL_CALL disposing( const css::lang::EventObject &rEvent ); + virtual void SAL_CALL disposing(const css::lang::EventObject& rEvent); using cppu::WeakComponentImplHelperBase::disposing; // XServiceInfo virtual OUString SAL_CALL getImplementationName() override; - virtual sal_Bool SAL_CALL supportsService( const OUString &rServiceName ) override; - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override; + virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; // XFolderPicker functions virtual OUString SAL_CALL getDirectory() override; - virtual void SAL_CALL setDescription( const OUString& rDescription ) override; + virtual void SAL_CALL setDescription(const OUString& rDescription) override; private Q_SLOTS: // XExecutableDialog functions /// @throws css::uno::RuntimeException - void setTitleSlot( const OUString &rTitle ) { return setTitle( rTitle ); } + void setTitleSlot(const OUString& rTitle) { return setTitle(rTitle); } /// @throws css::uno::RuntimeException sal_Int16 executeSlot() { return execute(); } // XFilePicker functions /// @throws css::uno::RuntimeException - void setMultiSelectionModeSlot( bool bMode ) { return setMultiSelectionMode( bMode ); } + void setMultiSelectionModeSlot(bool bMode) { return setMultiSelectionMode(bMode); } /// @throws css::uno::RuntimeException - void setDefaultNameSlot( const OUString &rName ) { return setDefaultName( rName ); } + void setDefaultNameSlot(const OUString& rName) { return setDefaultName(rName); } /// @throws css::uno::RuntimeException - void setDisplayDirectorySlot( const OUString &rDirectory ) { return setDisplayDirectory( rDirectory ); } + void setDisplayDirectorySlot(const OUString& rDirectory) + { + return setDisplayDirectory(rDirectory); + } /// @throws css::uno::RuntimeException OUString getDisplayDirectorySlot() { return getDisplayDirectory(); } /// @throws css::uno::RuntimeException - css::uno::Sequence< OUString > getFilesSlot() { return getFiles(); } + css::uno::Sequence<OUString> getFilesSlot() { return getFiles(); } // XFilterManager functions /// @throws css::lang::IllegalArgumentException /// @throws css::uno::RuntimeException - void appendFilterSlot( const OUString &rTitle, const OUString &rFilter ) { return appendFilter( rTitle, rFilter ); } + void appendFilterSlot(const OUString& rTitle, const OUString& rFilter) + { + return appendFilter(rTitle, rFilter); + } /// @throws css::lang::IllegalArgumentException /// @throws css::uno::RuntimeException - void setCurrentFilterSlot( const OUString &rTitle ) { return setCurrentFilter( rTitle ); } + void setCurrentFilterSlot(const OUString& rTitle) { return setCurrentFilter(rTitle); } /// @throws css::uno::RuntimeException OUString getCurrentFilterSlot() { return getCurrentFilter(); } // XFilterGroupManager functions /// @throws css::lang::IllegalArgumentException /// @throws css::uno::RuntimeException - void appendFilterGroupSlot( const OUString &rGroupTitle, const css::uno::Sequence< css::beans::StringPair > &rFilters ) { return appendFilterGroup( rGroupTitle, rFilters ); } + void appendFilterGroupSlot(const OUString& rGroupTitle, + const css::uno::Sequence<css::beans::StringPair>& rFilters) + { + return appendFilterGroup(rGroupTitle, rFilters); + } // XFilePickerControlAccess functions /// @throws css::uno::RuntimeException - void setValueSlot( sal_Int16 nControlId, sal_Int16 nControlAction, const css::uno::Any &rValue ) { return setValue( nControlId, nControlAction, rValue ); } + void setValueSlot(sal_Int16 nControlId, sal_Int16 nControlAction, const css::uno::Any& rValue) + { + return setValue(nControlId, nControlAction, rValue); + } /// @throws css::uno::RuntimeException - css::uno::Any getValueSlot( sal_Int16 nControlId, sal_Int16 nControlAction ) { return getValue( nControlId, nControlAction ); } + css::uno::Any getValueSlot(sal_Int16 nControlId, sal_Int16 nControlAction) + { + return getValue(nControlId, nControlAction); + } /// @throws css::uno::RuntimeException - void enableControlSlot( sal_Int16 nControlId, bool bEnable ) { return enableControl( nControlId, bEnable ); } + void enableControlSlot(sal_Int16 nControlId, bool bEnable) + { + return enableControl(nControlId, bEnable); + } /// @throws css::uno::RuntimeException - void setLabelSlot( sal_Int16 nControlId, const OUString &rLabel ) { return setLabel( nControlId, rLabel ); } + void setLabelSlot(sal_Int16 nControlId, const OUString& rLabel) + { + return setLabel(nControlId, rLabel); + } /// @throws css::uno::RuntimeException - OUString getLabelSlot( sal_Int16 nControlId ) { return getLabel( nControlId ); } + OUString getLabelSlot(sal_Int16 nControlId) { return getLabel(nControlId); } // XFilePicker2 functions /// @throws css::uno::RuntimeException - css::uno::Sequence< OUString > getSelectedFilesSlot() { return getSelectedFiles(); } + css::uno::Sequence<OUString> getSelectedFilesSlot() { return getSelectedFiles(); } // XInitialization /// @throws css::uno::Exception /// @throws css::uno::RuntimeException - void initializeSlot( const css::uno::Sequence< css::uno::Any > &rArguments ) { return initialize( rArguments ); } + void initializeSlot(const css::uno::Sequence<css::uno::Any>& rArguments) + { + return initialize(rArguments); + } Q_SIGNALS: // XExecutableDialog functions - void setTitleSignal( const OUString &rTitle ); + void setTitleSignal(const OUString& rTitle); sal_Int16 executeSignal(); // XFilePicker functions - void setMultiSelectionModeSignal( bool bMode ); - void setDefaultNameSignal( const OUString &rName ); - void setDisplayDirectorySignal( const OUString &rDirectory ); + void setMultiSelectionModeSignal(bool bMode); + void setDefaultNameSignal(const OUString& rName); + void setDisplayDirectorySignal(const OUString& rDirectory); OUString getDisplayDirectorySignal(); - css::uno::Sequence< OUString > getFilesSignal(); + css::uno::Sequence<OUString> getFilesSignal(); // XFilterManager functions - void appendFilterSignal( const OUString &rTitle, const OUString &rFilter ); - void setCurrentFilterSignal( const OUString &rTitle ); + void appendFilterSignal(const OUString& rTitle, const OUString& rFilter); + void setCurrentFilterSignal(const OUString& rTitle); OUString getCurrentFilterSignal(); // XFilterGroupManager functions - void appendFilterGroupSignal( const OUString &rGroupTitle, const css::uno::Sequence< css::beans::StringPair > &rFilters ); + void appendFilterGroupSignal(const OUString& rGroupTitle, + const css::uno::Sequence<css::beans::StringPair>& rFilters); // XFilePickerControlAccess functions - void setValueSignal( sal_Int16 nControlId, sal_Int16 nControlAction, const css::uno::Any &rValue ); - css::uno::Any getValueSignal( sal_Int16 nControlId, sal_Int16 nControlAction ); - void enableControlSignal( sal_Int16 nControlId, bool bEnable ); - void setLabelSignal( sal_Int16 nControlId, const OUString &rLabel ); - OUString getLabelSignal( sal_Int16 nControlId ); + void setValueSignal(sal_Int16 nControlId, sal_Int16 nControlAction, + const css::uno::Any& rValue); + css::uno::Any getValueSignal(sal_Int16 nControlId, sal_Int16 nControlAction); + void enableControlSignal(sal_Int16 nControlId, bool bEnable); + void setLabelSignal(sal_Int16 nControlId, const OUString& rLabel); + OUString getLabelSignal(sal_Int16 nControlId); // XFilePicker2 functions - css::uno::Sequence< OUString > getSelectedFilesSignal() ; + css::uno::Sequence<OUString> getSelectedFilesSignal(); // XInitialization - void initializeSignal( const css::uno::Sequence< css::uno::Any > &rArguments ); + void initializeSignal(const css::uno::Sequence<css::uno::Any>& rArguments); // Destructor proxy void cleanupProxySignal(); private: - Qt5FilePicker( const Qt5FilePicker& ) = delete; - Qt5FilePicker& operator=( const Qt5FilePicker& ) = delete; + Qt5FilePicker(const Qt5FilePicker&) = delete; + Qt5FilePicker& operator=(const Qt5FilePicker&) = delete; // add a custom control widget to the options dialog - void addCustomControl(QGridLayout *pLayout, sal_Int16 controlId); + void addCustomControl(QGridLayout* pLayout, sal_Int16 controlId); static QString getResString(const char* pRedId); @@ -234,9 +262,9 @@ private Q_SLOTS: void cleanupProxy(); // emit XFilePickerListener controlStateChanged event - void filterSelected(const QString &); + void filterSelected(const QString&); // emit XFilePickerListener fileSelectionChanged event -// void urlSelected(const QUrl &); + // void urlSelected(const QUrl &); void selectionChanged(); }; diff --git a/vcl/inc/qt5/Qt5Frame.hxx b/vcl/inc/qt5/Qt5Frame.hxx index 1f881d706881..268441ea688a 100644 --- a/vcl/inc/qt5/Qt5Frame.hxx +++ b/vcl/inc/qt5/Qt5Frame.hxx @@ -87,7 +87,7 @@ public: void Damage(sal_Int32 nExtentsX, sal_Int32 nExtentsY, sal_Int32 nExtentsWidth, sal_Int32 nExtentsHeight) const; - virtual void InitSvpSalGraphics( SvpSalGraphics* pSvpSalGraphics ); + virtual void InitSvpSalGraphics(SvpSalGraphics* pSvpSalGraphics); virtual SalGraphics* AcquireGraphics() override; virtual void ReleaseGraphics(SalGraphics* pGraphics) override; diff --git a/vcl/inc/qt5/Qt5Instance.hxx b/vcl/inc/qt5/Qt5Instance.hxx index 24085b2af92d..cd0e91124412 100644 --- a/vcl/inc/qt5/Qt5Instance.hxx +++ b/vcl/inc/qt5/Qt5Instance.hxx @@ -31,7 +31,9 @@ class QApplication; class SalYieldMutex; class SalFrame; -class VCLPLUG_QT5_PUBLIC Qt5Instance : public QObject, public SalGenericInstance, public SalUserEventList +class VCLPLUG_QT5_PUBLIC Qt5Instance : public QObject, + public SalGenericInstance, + public SalUserEventList { Q_OBJECT @@ -79,10 +81,10 @@ 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 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; @@ -107,11 +109,11 @@ public: virtual void TriggerUserEventProcessing() override; virtual void ProcessEvent(SalUserEvent aEvent) override; - virtual css::uno::Reference< css::ui::dialogs::XFilePicker2 > createFilePicker( - const css::uno::Reference< css::uno::XComponentContext >& ) override; + virtual css::uno::Reference<css::ui::dialogs::XFilePicker2> + createFilePicker(const css::uno::Reference<css::uno::XComponentContext>&) override; - virtual css::uno::Reference< css::ui::dialogs::XFolderPicker2 > createFolderPicker( - const css::uno::Reference< css::uno::XComponentContext >& ) override; + virtual css::uno::Reference<css::ui::dialogs::XFolderPicker2> + createFolderPicker(const css::uno::Reference<css::uno::XComponentContext>&) override; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/Qt5Menu.hxx b/vcl/inc/qt5/Qt5Menu.hxx index 37887045506f..21f33eaece84 100644 --- a/vcl/inc/qt5/Qt5Menu.hxx +++ b/vcl/inc/qt5/Qt5Menu.hxx @@ -21,57 +21,60 @@ class Qt5Menu : public QObject, public SalMenu { Q_OBJECT private: - std::vector< Qt5MenuItem* > maItems; - VclPtr<Menu> mpVCLMenu; - Qt5Menu* mpParentSalMenu; - Qt5Frame* mpFrame; - bool mbMenuBar; - QMenuBar* mpQMenuBar; + std::vector<Qt5MenuItem*> maItems; + VclPtr<Menu> mpVCLMenu; + Qt5Menu* mpParentSalMenu; + Qt5Frame* mpFrame; + bool mbMenuBar; + QMenuBar* mpQMenuBar; - void DoFullMenuUpdate( Menu* pMenuBar, QMenu* pParentMenu = nullptr ); - void NativeItemText( OUString &rItemText ); + void DoFullMenuUpdate(Menu* pMenuBar, QMenu* pParentMenu = nullptr); + void NativeItemText(OUString& rItemText); public: - Qt5Menu( bool bMenuBar ); + Qt5Menu(bool bMenuBar); virtual ~Qt5Menu() override; - virtual bool VisibleMenuBar() override; // must return TRUE to actually DISPLAY native menu bars + 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; - Qt5Menu* GetTopLevel(); - 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; + 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; + Qt5Menu* GetTopLevel(); + 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 ]; } + void SetMenu(Menu* pMenu) { mpVCLMenu = pMenu; } + Menu* GetMenu() { return mpVCLMenu; } + unsigned GetItemCount() { return maItems.size(); } + Qt5MenuItem* GetItemAtPos(unsigned nPos) { return maItems[nPos]; } private slots: - void DispatchCommand( Qt5MenuItem* pQItem ); + void DispatchCommand(Qt5MenuItem* pQItem); }; class Qt5MenuItem : public SalMenuItem { public: - Qt5MenuItem( const SalItemParams* ); + 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) + 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/inc/qt5/Qt5Tools.hxx b/vcl/inc/qt5/Qt5Tools.hxx index 06c02572473c..a714f19e8a87 100644 --- a/vcl/inc/qt5/Qt5Tools.hxx +++ b/vcl/inc/qt5/Qt5Tools.hxx @@ -58,7 +58,7 @@ inline Size toSize(const QSize& rSize) { return Size(rSize.width(), rSize.height inline QColor toQColor(const Color& rColor) { - return QColor( rColor.GetRed(), rColor.GetGreen(), rColor.GetBlue(), rColor.GetTransparency() ); + return QColor(rColor.GetRed(), rColor.GetGreen(), rColor.GetBlue(), rColor.GetTransparency()); } static constexpr QImage::Format Qt5_DefaultFormat32 = QImage::Format_ARGB32; diff --git a/vcl/inc/qt5/Qt5Widget.hxx b/vcl/inc/qt5/Qt5Widget.hxx index c95bc94c1f0c..32daa2bfef38 100644 --- a/vcl/inc/qt5/Qt5Widget.hxx +++ b/vcl/inc/qt5/Qt5Widget.hxx @@ -21,8 +21,8 @@ #include <QtWidgets/QWidget> -#include "Qt5Frame.hxx" +#include "Qt5Frame.hxx" -QWidget* createQt5Widget(Qt5Frame &rFrame, QWidget* parent, Qt::WindowFlags f); +QWidget* createQt5Widget(Qt5Frame& rFrame, QWidget* parent, Qt::WindowFlags f); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qt5/Qt5FilePicker.cxx b/vcl/qt5/Qt5FilePicker.cxx index 7dee36de35d3..7bc561a7d594 100644 --- a/vcl/qt5/Qt5FilePicker.cxx +++ b/vcl/qt5/Qt5FilePicker.cxx @@ -54,7 +54,6 @@ #include <unx/geninst.h> #include <strings.hrc> - using namespace ::com::sun::star; using namespace ::com::sun::star::ui::dialogs; using namespace ::com::sun::star::ui::dialogs::TemplateDescription; @@ -66,266 +65,281 @@ using namespace ::com::sun::star::uno; namespace { - uno::Sequence<OUString> SAL_CALL FilePicker_getSupportedServiceNames() - { - uno::Sequence<OUString> aRet(3); - aRet[0] = "com.sun.star.ui.dialogs.FilePicker"; - aRet[1] = "com.sun.star.ui.dialogs.SystemFilePicker"; - aRet[2] = "com.sun.star.ui.dialogs.Qt5FilePicker"; - return aRet; - } +uno::Sequence<OUString> SAL_CALL FilePicker_getSupportedServiceNames() +{ + uno::Sequence<OUString> aRet(3); + aRet[0] = "com.sun.star.ui.dialogs.FilePicker"; + aRet[1] = "com.sun.star.ui.dialogs.SystemFilePicker"; + aRet[2] = "com.sun.star.ui.dialogs.Qt5FilePicker"; + return aRet; +} } -Qt5FilePicker::Qt5FilePicker( QFileDialog::FileMode eMode ) - : Qt5FilePicker_Base( m_aHelperMutex ) +Qt5FilePicker::Qt5FilePicker(QFileDialog::FileMode eMode) + : Qt5FilePicker_Base(m_aHelperMutex) { -SAL_DEBUG( "Qt5FilePicker::Qt5FilePicker" ); m_pFileDialog = new QFileDialog(); m_pOptionsDialog = new QDialog(); - m_pFileDialog->setFileMode( eMode ); -// m_pFileDialog->setWindowModality( Qt::WindowModal ); - m_pFileDialog->setWindowModality( Qt::ApplicationModal ); - m_pOptionsDialog->setWindowModality( Qt::WindowModal ); + m_pFileDialog->setFileMode(eMode); + // m_pFileDialog->setWindowModality( Qt::WindowModal ); + m_pFileDialog->setWindowModality(Qt::ApplicationModal); + m_pOptionsDialog->setWindowModality(Qt::WindowModal); - setMultiSelectionMode( false ); + setMultiSelectionMode(false); // XExecutableDialog functions - connect( this, SIGNAL( setTitleSignal( const OUString & ) ), - this, SLOT( setTitleSlot( const OUString & ) ), Qt::BlockingQueuedConnection ); - connect( this, SIGNAL( executeSignal() ), - this, SLOT( executeSlot() ), Qt::BlockingQueuedConnection ); + connect(this, SIGNAL(setTitleSignal(const OUString&)), this, + SLOT(setTitleSlot(const OUString&)), Qt::BlockingQueuedConnection); + connect(this, SIGNAL(executeSignal()), this, SLOT(executeSlot()), Qt::BlockingQueuedConnection); // XFilePicker functions - connect( this, SIGNAL( setMultiSelectionModeSignal( bool ) ), - this, SLOT( setMultiSelectionModeSlot( bool ) ), Qt::BlockingQueuedConnection ); - connect( this, SIGNAL( setDefaultNameSignal( const OUString & ) ), - this, SLOT( setDefaultNameSlot( const OUString & ) ), Qt::BlockingQueuedConnection ); - connect( this, SIGNAL( setDisplayDirectorySignal( const OUString & ) ), - this, SLOT( setDisplayDirectorySlot( const OUString & ) ), Qt::BlockingQueuedConnection ); - connect( this, SIGNAL( getDisplayDirectorySignal() ), - this, SLOT( getDisplayDirectorySlot() ), Qt::BlockingQueuedConnection ); - connect( this, SIGNAL( getFilesSignal() ), - this, SLOT( getFilesSlot() ), Qt::BlockingQueuedConnection ); + connect(this, SIGNAL(setMultiSelectionModeSignal(bool)), this, + SLOT(setMultiSelectionModeSlot(bool)), Qt::BlockingQueuedConnection); + connect(this, SIGNAL(setDefaultNameSignal(const OUString&)), this, + SLOT(setDefaultNameSlot(const OUString&)), Qt::BlockingQueuedConnection); + connect(this, SIGNAL(setDisplayDirectorySignal(const OUString&)), this, + SLOT(setDisplayDirectorySlot(const OUString&)), Qt::BlockingQueuedConnection); + connect(this, SIGNAL(getDisplayDirectorySignal()), this, SLOT(getDisplayDirectorySlot()), + Qt::BlockingQueuedConnection); + connect(this, SIGNAL(getFilesSignal()), this, SLOT(getFilesSlot()), + Qt::BlockingQueuedConnection); // XFilterManager functions - connect( this, SIGNAL( appendFilterSignal( const OUString &, const OUString & ) ), - this, SLOT( appendFilterSlot( const OUString &, const OUString & ) ), Qt::BlockingQueuedConnection ); - connect( this, SIGNAL( setCurrentFilterSignal( const OUString & ) ), - this, SLOT( setCurrentFilterSlot( const OUString & ) ), Qt::BlockingQueuedConnection ); - connect( this, SIGNAL( getCurrentFilterSignal() ), - this, SLOT( getCurrentFilterSlot() ), Qt::BlockingQueuedConnection ); + connect(this, SIGNAL(appendFilterSignal(const OUString&, const OUString&)), this, + SLOT(appendFilterSlot(const OUString&, const OUString&)), Qt::BlockingQueuedConnection); + connect(this, SIGNAL(setCurrentFilterSignal(const OUString&)), this, + SLOT(setCurrentFilterSlot(const OUString&)), Qt::BlockingQueuedConnection); + connect(this, SIGNAL(getCurrentFilterSignal()), this, SLOT(getCurrentFilterSlot()), + Qt::BlockingQueuedConnection); // XFilterGroupManager functions - connect( this, SIGNAL( appendFilterGroupSignal( const OUString &, const css::uno::Sequence< css::beans::StringPair > & ) ), - this, SLOT( appendFilterGroupSlot( const OUString &, const css::uno::Sequence< css::beans::StringPair > & ) ), Qt::BlockingQueuedConnection ); + connect(this, + SIGNAL(appendFilterGroupSignal(const OUString&, + const css::uno::Sequence<css::beans::StringPair>&)), + this, + SLOT(appendFilterGroupSlot(const OUString&, + const css::uno::Sequence<css::beans::StringPair>&)), + Qt::BlockingQueuedConnection); // XFilePickerControlAccess functions - connect( this, SIGNAL( setValueSignal( sal_Int16, sal_Int16, const css::uno::Any & ) ), - this, SLOT( setValueSlot( sal_Int16, sal_Int16, const css::uno::Any & ) ), Qt::BlockingQueuedConnection ); - connect( this, SIGNAL( getValueSignal( sal_Int16, sal_Int16 ) ), - this, SLOT( getValueSlot( sal_Int16, sal_Int16 ) ), Qt::BlockingQueuedConnection ); - connect( this, SIGNAL( enableControlSignal( sal_Int16, bool ) ), - this, SLOT( enableControlSlot( sal_Int16, bool ) ), Qt::BlockingQueuedConnection ); - connect( this, SIGNAL( setLabelSignal( sal_Int16, const OUString & ) ), - this, SLOT( setLabelSlot( sal_Int16, const OUString & ) ), Qt::BlockingQueuedConnection ); - connect( this, SIGNAL( getLabelSignal( sal_Int16 ) ), - this, SLOT( getLabelSlot( sal_Int16 ) ), Qt::BlockingQueuedConnection ); + connect(this, SIGNAL(setValueSignal(sal_Int16, sal_Int16, const css::uno::Any&)), this, + SLOT(setValueSlot(sal_Int16, sal_Int16, const css::uno::Any&)), + Qt::BlockingQueuedConnection); + connect(this, SIGNAL(getValueSignal(sal_Int16, sal_Int16)), this, + SLOT(getValueSlot(sal_Int16, sal_Int16)), Qt::BlockingQueuedConnection); + connect(this, SIGNAL(enableControlSignal(sal_Int16, bool)), this, + SLOT(enableControlSlot(sal_Int16, bool)), Qt::BlockingQueuedConnection); + connect(this, SIGNAL(setLabelSignal(sal_Int16, const OUString&)), this, + SLOT(setLabelSlot(sal_Int16, const OUString&)), Qt::BlockingQueuedConnection); + connect(this, SIGNAL(getLabelSignal(sal_Int16)), this, SLOT(getLabelSlot(sal_Int16)), + Qt::BlockingQueuedConnection); // XFilePicker2 functions - connect( this, SIGNAL( getSelectedFilesSignal() ), - this, SLOT( getSelectedFilesSlot() ), Qt::BlockingQueuedConnection ); + connect(this, SIGNAL(getSelectedFilesSignal()), this, SLOT(getSelectedFilesSlot()), + Qt::BlockingQueuedConnection); // XInitialization - connect( this, SIGNAL( initializeSignal( const css::uno::Sequence< css::uno::Any > & ) ), - this, SLOT( initializeSlot( const css::uno::Sequence< css::uno::Any > & ) ), Qt::BlockingQueuedConnection ); + connect(this, SIGNAL(initializeSignal(const css::uno::Sequence<css::uno::Any>&)), this, + SLOT(initializeSlot(const css::uno::Sequence<css::uno::Any>&)), + Qt::BlockingQueuedConnection); // Destructor proxy - connect( this, SIGNAL( cleanupProxySignal() ), this, SLOT( cleanupProxy() ), Qt::BlockingQueuedConnection ); + connect(this, SIGNAL(cleanupProxySignal()), this, SLOT(cleanupProxy()), + Qt::BlockingQueuedConnection); // XFilePickerListener notifications - connect( m_pFileDialog, SIGNAL( filterSelected(const QString&) ), this, SLOT( filterSelected(const QString&) )); - connect( m_pFileDialog, SIGNAL( selectionChanged() ), this, SLOT( selectionChanged() )); + connect(m_pFileDialog, SIGNAL(filterSelected(const QString&)), this, + SLOT(filterSelected(const QString&))); + connect(m_pFileDialog, SIGNAL(selectionChanged()), this, SLOT(selectionChanged())); } -Qt5FilePicker::~Qt5FilePicker() -{ - cleanupProxy(); -} +Qt5FilePicker::~Qt5FilePicker() { cleanupProxy(); } void Qt5FilePicker::cleanupProxy() { - if( qApp->thread() != QThread::currentThread() ) { + if (qApp->thread() != QThread::currentThread()) + { SolarMutexReleaser aReleaser; return Q_EMIT cleanupProxySignal(); } delete m_pOptionsDialog; } -void SAL_CALL Qt5FilePicker::addFilePickerListener( const uno::Reference<XFilePickerListener>& xListener ) +void SAL_CALL +Qt5FilePicker::addFilePickerListener(const uno::Reference<XFilePickerListener>& xListener) { SolarMutexGuard aGuard; m_xListener = xListener; } -void SAL_CALL Qt5FilePicker::removeFilePickerListener( const uno::Reference<XFilePickerListener>& ) +void SAL_CALL Qt5FilePicker::removeFilePickerListener(const uno::Reference<XFilePickerListener>&) { SolarMutexGuard aGuard; m_xListener.clear(); } -void SAL_CALL Qt5FilePicker::setTitle( const OUString &title ) +void SAL_CALL Qt5FilePicker::setTitle(const OUString& title) { - if( qApp->thread() != QThread::currentThread() ) { + if (qApp->thread() != QThread::currentThread()) + { SolarMutexReleaser aReleaser; - return Q_EMIT setTitleSignal( title ); + return Q_EMIT setTitleSignal(title); } - m_pOptionsDialog->setWindowTitle( toQString(title) ); + m_pOptionsDialog->setWindowTitle(toQString(title)); } sal_Int16 SAL_CALL Qt5FilePicker::execute() { - if( qApp->thread() != QThread::currentThread() ) { + if (qApp->thread() != QThread::currentThread()) + { SolarMutexReleaser aReleaser; return Q_EMIT executeSignal(); } - vcl::Window *pWindow = ::Application::GetActiveTopWindow(); - assert( pWindow ); - QWidget *pTransientParent = nullptr; - QWindow *pTransientWindow = nullptr; - if( pWindow ) + vcl::Window* pWindow = ::Application::GetActiveTopWindow(); + assert(pWindow); + QWidget* pTransientParent = nullptr; + QWindow* pTransientWindow = nullptr; + if (pWindow) { - Qt5Frame *pFrame = dynamic_cast<Qt5Frame *>( pWindow->ImplGetFrame() ); - assert( pFrame ); - if( pFrame ) + Qt5Frame* pFrame = dynamic_cast<Qt5Frame*>(pWindow->ImplGetFrame()); + assert(pFrame); + if (pFrame) { pTransientParent = pFrame->GetQWidget(); pTransientWindow = pTransientParent->window()->windowHandle(); } } - m_pFileDialog->setNameFilters( m_aNamedFilterList ); - if( !m_aCurrentFilterTitle.isNull() ) + m_pFileDialog->setNameFilters(m_aNamedFilterList); + if (!m_aCurrentFilterTitle.isNull()) { int i = 0; - for( ; i < m_aFilterTitleList.size(); ++i ) - if( m_aCurrentFilterTitle == m_aFilterTitleList[ i ] ) + for (; i < m_aFilterTitleList.size(); ++i) + if (m_aCurrentFilterTitle == m_aFilterTitleList[i]) { - m_pFileDialog->selectNameFilter( m_aNamedFilterList[ i ] ); + m_pFileDialog->selectNameFilter(m_aNamedFilterList[i]); break; } - assert( i < m_aFilterTitleList.size() ); + assert(i < m_aFilterTitleList.size()); } - if( pTransientParent ) + if (pTransientParent) { m_pFileDialog->show(); - m_pFileDialog->window()->windowHandle()->setTransientParent( pTransientWindow ); - m_pFileDialog->setFocusProxy( pTransientParent ); -// pTransientParent->setMouseTracking( false ); + m_pFileDialog->window()->windowHandle()->setTransientParent(pTransientWindow); + m_pFileDialog->setFocusProxy(pTransientParent); + // pTransientParent->setMouseTracking( false ); } int result = m_pFileDialog->exec(); - if( pTransientParent ) -// pTransientParent->setMouseTracking( true ); - if( QFileDialog::Rejected == result ) - return ExecutableDialogResults::CANCEL; + if (pTransientParent) + // pTransientParent->setMouseTracking( true ); + if (QFileDialog::Rejected == result) + return ExecutableDialogResults::CANCEL; - if ( !m_aCustomWidgetsMap.empty() ) + if (!m_aCustomWidgetsMap.empty()) { - m_pFilenameLabel->setText( m_pFileDialog->selectedUrls()[ 0 ].url() ); + m_pFilenameLabel->setText(m_pFileDialog->selectedUrls()[0].url()); QString filter = m_pFileDialog->selectedNameFilter(); int pos = filter.indexOf(" ("); - if( pos >= 0 ) - filter.truncate( pos ); - m_pFilterLabel->setText( filter ); + if (pos >= 0) + filter.truncate(pos); + m_pFilterLabel->setText(filter); - if( pTransientParent ) + if (pTransientParent) { m_pOptionsDialog->show(); - m_pOptionsDialog->window()->windowHandle()->setTransientParent( pTransientWindow ); - m_pOptionsDialog->setFocusProxy( pTransientParent ); + m_pOptionsDialog->window()->windowHandle()->setTransientParent(pTransientWindow); + m_pOptionsDialog->setFocusProxy(pTransientParent); } result = m_pOptionsDialog->exec(); - if( QFileDialog::Rejected == result ) + if (QFileDialog::Rejected == result) return ExecutableDialogResults::CANCEL; } return ExecutableDialogResults::OK; } -void SAL_CALL Qt5FilePicker::setMultiSelectionMode( sal_Bool multiSelect ) +void SAL_CALL Qt5FilePicker::setMultiSelectionMode(sal_Bool multiSelect) { - if( qApp->thread() != QThread::currentThread() ) { + if (qApp->thread() != QThread::currentThread()) + { SolarMutexReleaser aReleaser; - return Q_EMIT setMultiSelectionModeSignal( multiSelect ); + return Q_EMIT setMultiSelectionModeSignal(multiSelect); } - if( multiSelect ) - m_pFileDialog->setFileMode( QFileDialog::ExistingFiles ); + if (multiSelect) + m_pFileDialog->setFileMode(QFileDialog::ExistingFiles); else - m_pFileDialog->setFileMode( QFileDialog::ExistingFile ); + m_pFileDialog->setFileMode(QFileDialog::ExistingFile); } -void SAL_CALL Qt5FilePicker::setDefaultName( const OUString &name ) +void SAL_CALL Qt5FilePicker::setDefaultName(const OUString& name) { - if( qApp->thread() != QThread::currentThread() ) { + if (qApp->thread() != QThread::currentThread()) + { SolarMutexReleaser aReleaser; - return Q_EMIT setDefaultNameSignal( name ); + return Q_EMIT setDefaultNameSignal(name); } - m_pFileDialog->selectFile( toQString( name ) ); + m_pFileDialog->selectFile(toQString(name)); } -void SAL_CALL Qt5FilePicker::setDisplayDirectory( const OUString &dir ) +void SAL_CALL Qt5FilePicker::setDisplayDirectory(const OUString& dir) { - if( qApp->thread() != QThread::currentThread() ) { + if (qApp->thread() != QThread::currentThread()) + { SolarMutexReleaser aReleaser; - return Q_EMIT setDisplayDirectorySignal( dir ); + return Q_EMIT setDisplayDirectorySignal(dir); } - m_pFileDialog->setDirectory( toQString( dir ) ); + m_pFileDialog->setDirectory(toQString(dir)); } OUString SAL_CALL Qt5FilePicker::getDisplayDirectory() { - if( qApp->thread() != QThread::currentThread() ) { + if (qApp->thread() != QThread::currentThread()) + { SolarMutexReleaser aReleaser; return Q_EMIT getDisplayDirectorySignal(); } - return toOUString( m_pFileDialog->directoryUrl().toString() ); + return toOUString(m_pFileDialog->directoryUrl().toString()); } -uno::Sequence< OUString > SAL_CALL Qt5FilePicker::getFiles() +uno::Sequence<OUString> SAL_CALL Qt5FilePicker::getFiles() { - if( qApp->thread() != QThread::currentThread() ) { + if (qApp->thread() != QThread::currentThread()) + { SolarMutexReleaser aReleaser; return Q_EMIT getFilesSignal(); } - uno::Sequence< OUString > seq = getSelectedFiles(); + uno::Sequence<OUString> seq = getSelectedFiles(); if (seq.getLength() > 1) seq.realloc(1); return seq; } -uno::Sequence< OUString > SAL_CALL Qt5FilePicker::getSelectedFiles() +uno::Sequence<OUString> SAL_CALL Qt5FilePicker::getSelectedFiles() { - if( qApp->thread() != QThread::currentThread() ) { + if (qApp->thread() != QThread::currentThread()) + { SolarMutexReleaser aReleaser; return Q_EMIT getSelectedFilesSignal(); } QList<QUrl> urls = m_pFileDialog->selectedUrls(); - uno::Sequence< OUString > seq( urls.size() ); + uno::Sequence<OUString> seq(urls.size()); int i = 0; - foreach( const QUrl& url, urls ) - seq[ i++ ]= toOUString( url.toString() ); + foreach (const QUrl& url, urls) + seq[i++] = toOUString(url.toString()); return seq; } -void SAL_CALL Qt5FilePicker::appendFilter( const OUString &title, const OUString &filter ) +void SAL_CALL Qt5FilePicker::appendFilter(const OUString& title, const OUString& filter) { - if( qApp->thread() != QThread::currentThread() ) { + if (qApp->thread() != QThread::currentThread()) + { SolarMutexReleaser aReleaser; - return Q_EMIT appendFilterSignal( title, filter ); + return Q_EMIT appendFilterSignal(title, filter); } QString t = toQString(title); @@ -336,8 +350,8 @@ void SAL_CALL Qt5FilePicker::appendFilter( const OUString &title, const OUString t.replace("/", "\\/"); int pos = t.indexOf(" ("); - if( pos >= 0 ) - t.truncate( pos ); + if (pos >= 0) + t.truncate(pos); // openoffice gives us filters separated by ';' qt dialogs just want space separated f.replace(";", " "); @@ -345,68 +359,75 @@ void SAL_CALL Qt5FilePicker::appendFilter( const OUString &title, const OUString // make sure "*.*" is not used as "all files" f.replace("*.*", "*"); - m_aFilterTitleList.append( toQString( title ) ); - m_aNamedFilterList.append( QString("%1 (%2)").arg(t).arg(f) ); + m_aFilterTitleList.append(toQString(title)); + m_aNamedFilterList.append(QString("%1 (%2)").arg(t).arg(f)); } -void SAL_CALL Qt5FilePicker::setCurrentFilter( const OUString &title ) +void SAL_CALL Qt5FilePicker::setCurrentFilter(const OUString& title) { - if( qApp->thread() != QThread::currentThread() ) { + if (qApp->thread() != QThread::currentThread()) + { SolarMutexReleaser aReleaser; - return Q_EMIT setCurrentFilterSignal( title ); + return Q_EMIT setCurrentFilterSignal(title); } - m_aCurrentFilterTitle = toQString( title ); + m_aCurrentFilterTitle = toQString(title); } OUString SAL_CALL Qt5FilePicker::getCurrentFilter() { - if( qApp->thread() != QThread::currentThread() ) { + if (qApp->thread() != QThread::currentThread()) + { SolarMutexReleaser aReleaser; return Q_EMIT getCurrentFilterSignal(); } QString filter = m_pFileDialog->selectedNameFilter(); - for( int i = 0; i < m_aNamedFilterList.size(); ++i ) - if( filter == m_aNamedFilterList[ i ] ) - return toOUString( m_aFilterTitleList[ i ] ); - SAL_DEBUG( "vcl.qt5 " << m_aNamedFilterList.size() << " Unknown filter: " << toOUString( filter ) ); - assert( !"Selected filter not in filter list?! " ); - return OUString( "" ); + for (int i = 0; i < m_aNamedFilterList.size(); ++i) + if (filter == m_aNamedFilterList[i]) + return toOUString(m_aFilterTitleList[i]); + SAL_WARN("vcl.qt5", m_aNamedFilterList.size() << " Unknown filter: " << toOUString(filter)); + assert(!"Selected filter not in filter list?! "); + return OUString(""); } -void SAL_CALL Qt5FilePicker::appendFilterGroup( const OUString& rGroupTitle, const uno::Sequence<beans::StringPair>& filters) +void SAL_CALL Qt5FilePicker::appendFilterGroup(const OUString& rGroupTitle, + const uno::Sequence<beans::StringPair>& filters) { - if( qApp->thread() != QThread::currentThread() ) { + if (qApp->thread() != QThread::currentThread()) + { SolarMutexReleaser aReleaser; - return Q_EMIT appendFilterGroupSignal( rGroupTitle, filters ); + return Q_EMIT appendFilterGroupSignal(rGroupTitle, filters); } const sal_uInt16 length = filters.getLength(); for (sal_uInt16 i = 0; i < length; ++i) { beans::StringPair aPair = filters[i]; - appendFilter( aPair.First, aPair.Second ); + appendFilter(aPair.First, aPair.Second); } } -void SAL_CALL Qt5FilePicker::setValue( sal_Int16 controlId, sal_Int16 nControlAction, const uno::Any &value ) +void SAL_CALL Qt5FilePicker::setValue(sal_Int16 controlId, sal_Int16 nControlAction, + const uno::Any& value) { - if( qApp->thread() != QThread::currentThread() ) { + if (qApp->thread() != QThread::currentThread()) + { SolarMutexReleaser aReleaser; - return Q_EMIT setValueSignal( controlId, nControlAction, value ); + return Q_EMIT setValueSignal(controlId, nControlAction, value); } - if (m_aCustomWidgetsMap.contains( controlId )) { - QCheckBox* cb = dynamic_cast<QCheckBox*>( m_aCustomWidgetsMap.value( controlId )); + if (m_aCustomWidgetsMap.contains(controlId)) + { + QCheckBox* cb = dynamic_cast<QCheckBox*>(m_aCustomWidgetsMap.value(controlId)); if (cb) cb->setChecked(value.get<bool>()); } else - SAL_WARN( "vcl", "set label on unknown control " << controlId ); + SAL_WARN("vcl", "set label on unknown control " << controlId); } -uno::Any SAL_CALL Qt5FilePicker::getValue( sal_Int16 controlId, sal_Int16 nControlAction ) +uno::Any SAL_CALL Qt5FilePicker::getValue(sal_Int16 controlId, sal_Int16 nControlAction) { if (CHECKBOX_AUTOEXTENSION == controlId) // We ignore this one and rely on QFileDialog to provide the function. @@ -414,74 +435,81 @@ uno::Any SAL_CALL Qt5FilePicker::getValue( sal_Int16 controlId, sal_Int16 nContr // LO core would try to be smart and cut the extension in some places, // interfering with QFileDialog's handling of it. QFileDialog also // saves the value of the setting, so LO core is not needed for that either. - return uno::Any( false ); + return uno::Any(false); - if( qApp->thread() != QThread::currentThread() ) { + if (qApp->thread() != QThread::currentThread()) + { SolarMutexReleaser aReleaser; - return Q_EMIT getValueSignal( controlId, nControlAction ); + return Q_EMIT getValueSignal(controlId, nControlAction); } uno::Any res(false); - if (m_aCustomWidgetsMap.contains( controlId )) { - QCheckBox* cb = dynamic_cast<QCheckBox*>( m_aCustomWidgetsMap.value( controlId )); + if (m_aCustomWidgetsMap.contains(controlId)) + { + QCheckBox* cb = dynamic_cast<QCheckBox*>(m_aCustomWidgetsMap.value(controlId)); if (cb) res <<= cb->isChecked(); } else - SAL_WARN( "vcl", "get value on unknown control " << controlId ); + SAL_WARN("vcl", "get value on unknown control " << controlId); return res; } -void SAL_CALL Qt5FilePicker::enableControl( sal_Int16 controlId, sal_Bool enable ) +void SAL_CALL Qt5FilePicker::enableControl(sal_Int16 controlId, sal_Bool enable) { - if( qApp->thread() != QThread::currentThread() ) { + if (qApp->thread() != QThread::currentThread()) + { SolarMutexReleaser aReleaser; - return Q_EMIT enableControlSignal( controlId, enable ); + return Q_EMIT enableControlSignal(controlId, enable); } - if (m_aCustomWidgetsMap.contains( controlId )) - m_aCustomWidgetsMap.value( controlId )->setEnabled( enable ); + if (m_aCustomWidgetsMap.contains(controlId)) + m_aCustomWidgetsMap.value(controlId)->setEnabled(enable); else - SAL_WARN( "vcl", "enable unknown control " << controlId ); + SAL_WARN("vcl", "enable unknown control " << controlId); } -void SAL_CALL Qt5FilePicker::setLabel( sal_Int16 controlId, const OUString &label ) +void SAL_CALL Qt5FilePicker::setLabel(sal_Int16 controlId, const OUString& label) { - if( qApp->thread() != QThread::currentThread() ) { + if (qApp->thread() != QThread::currentThread()) + { SolarMutexReleaser aReleaser; - return Q_EMIT setLabelSignal( controlId, label ); + return Q_EMIT setLabelSignal(controlId, label); } - if (m_aCustomWidgetsMap.contains( controlId )) { - QCheckBox* cb = dynamic_cast<QCheckBox*>( m_aCustomWidgetsMap.value( controlId )); + if (m_aCustomWidgetsMap.contains(controlId)) + { + QCheckBox* cb = dynamic_cast<QCheckBox*>(m_aCustomWidgetsMap.value(controlId)); if (cb) - cb->setText( toQString(label) ); + cb->setText(toQString(label)); } else - SAL_WARN( "vcl", "set label on unknown control " << controlId ); + SAL_WARN("vcl", "set label on unknown control " << controlId); } OUString SAL_CALL Qt5FilePicker::getLabel(sal_Int16 controlId) { - if( qApp->thread() != QThread::currentThread() ) { + if (qApp->thread() != QThread::currentThread()) + { SolarMutexReleaser aReleaser; - return Q_EMIT getLabelSignal( controlId ); + return Q_EMIT getLabelSignal(controlId); } QString label; - if (m_aCustomWidgetsMap.contains( controlId )) { - QCheckBox* cb = dynamic_cast<QCheckBox*>( m_aCustomWidgetsMap.value( controlId )); + if (m_aCustomWidgetsMap.contains(controlId)) + { + QCheckBox* cb = dynamic_cast<QCheckBox*>(m_aCustomWidgetsMap.value(controlId)); if (cb) label = cb->text(); } else - SAL_WARN( "vcl", "get label on unknown control " << controlId ); + SAL_WARN("vcl", "get label on unknown control " << controlId); return toOUString(label); } -QString Qt5FilePicker::getResString(const char *pResId) +QString Qt5FilePicker::getResString(const char* pResId) { QString aResString; @@ -493,7 +521,7 @@ QString Qt5FilePicker::getResString(const char *pResId) return aResString.replace('~', '&'); } -void Qt5FilePicker::addCustomControl(QGridLayout *pLayout, sal_Int16 controlId) +void Qt5FilePicker::addCustomControl(QGridLayout* pLayout, sal_Int16 controlId) { QWidget* widget = nullptr; QWidget* label = nullptr; @@ -558,8 +586,8 @@ void Qt5FilePicker::addCustomControl(QGridLayout *pLayout, sal_Int16 controlId) case LISTBOX_TEMPLATE: case LISTBOX_IMAGE_TEMPLATE: case LISTBOX_FILTER_SELECTOR: - label = new QLabel( getResString(resId), m_pOptionsDialog ); - widget = new QComboBox( m_pOptionsDialog ); + label = new QLabel(getResString(resId), m_pOptionsDialog); + widget = new QComboBox(m_pOptionsDialog); break; case LISTBOX_VERSION_LABEL: case LISTBOX_TEMPLATE_LABEL: @@ -567,21 +595,22 @@ void Qt5FilePicker::addCustomControl(QGridLayout *pLayout, sal_Int16 controlId) break; } - if( widget ) + if (widget) { const int row = pLayout->rowCount(); - if( label ) - pLayout->addWidget( label, row, 0 ); - pLayout->addWidget( widget, row, 1 ); - m_aCustomWidgetsMap.insert( controlId, widget ); + if (label) + pLayout->addWidget(label, row, 0); + pLayout->addWidget(widget, row, 1); + m_aCustomWidgetsMap.insert(controlId, widget); } } -void SAL_CALL Qt5FilePicker::initialize( const uno::Sequence<uno::Any> &args ) +void SAL_CALL Qt5FilePicker::initialize(const uno::Sequence<uno::Any>& args) { - if( qApp->thread() != QThread::currentThread() ) { + if (qApp->thread() != QThread::currentThread()) + { SolarMutexReleaser aReleaser; - return Q_EMIT initializeSignal( args ); + return Q_EMIT initializeSignal(args); } m_aNamedFilterList.clear(); @@ -592,35 +621,32 @@ void SAL_CALL Qt5FilePicker::initialize( const uno::Sequence<uno::Any> &args ) uno::Any arg; if (args.getLength() == 0) { - throw lang::IllegalArgumentException( - "no arguments", - static_cast< XFilePicker2* >( this ), 1 ); + throw lang::IllegalArgumentException("no arguments", static_cast<XFilePicker2*>(this), 1); } arg = args[0]; - if (( arg.getValueType() != cppu::UnoType<sal_Int16>::get()) && - ( arg.getValueType() != cppu::UnoType<sal_Int8>::get())) + if ((arg.getValueType() != cppu::UnoType<sal_Int16>::get()) + && (arg.getValueType() != cppu::UnoType<sal_Int8>::get())) { - throw lang::IllegalArgumentException( - "invalid argument type", - static_cast< XFilePicker2* >( this ), 1 ); + throw lang::IllegalArgumentException("invalid argument type", + static_cast<XFilePicker2*>(this), 1); } - QGridLayout *pLayout = new QGridLayout(); - m_pOptionsDialog->setLayout( pLayout ); - pLayout->addWidget( new QLabel( "Filename:" ), 0, 0 ); + QGridLayout* pLayout = new QGridLayout(); + m_pOptionsDialog->setLayout(pLayout); + pLayout->addWidget(new QLabel("Filename:"), 0, 0); m_pFilenameLabel = new QLabel(); - pLayout->addWidget( m_pFilenameLabel, 0, 1 ); - pLayout->addWidget( new QLabel( "Type:" ), 1, 0 ); + pLayout->addWidget(m_pFilenameLabel, 0, 1); + pLayout->addWidget(new QLabel("Type:"), 1, 0); m_pFilterLabel = new QLabel(); - pLayout->addWidget( m_pFilterLabel, 1, 1 ); + pLayout->addWidget(m_pFilterLabel, 1, 1); sal_Int16 templateId = -1; arg >>= templateId; QFileDialog::AcceptMode acceptMode = QFileDialog::AcceptOpen; - switch ( templateId ) + switch (templateId) { case FILEOPEN_SIMPLE: break; @@ -631,157 +657,149 @@ void SAL_CALL Qt5FilePicker::initialize( const uno::Sequence<uno::Any> &args ) case FILESAVE_AUTOEXTENSION: acceptMode = QFileDialog::AcceptSave; - addCustomControl( pLayout, CHECKBOX_AUTOEXTENSION ); + addCustomControl(pLayout, CHECKBOX_AUTOEXTENSION); break; case FILESAVE_AUTOEXTENSION_PASSWORD: acceptMode = QFileDialog::AcceptSave; - addCustomControl( pLayout, CHECKBOX_AUTOEXTENSION ); - addCustomControl( pLayout, CHECKBOX_PASSWORD ); + addCustomControl(pLayout, CHECKBOX_AUTOEXTENSION); + addCustomControl(pLayout, CHECKBOX_PASSWORD); break; case FILESAVE_AUTOEXTENSION_PASSWORD_FILTEROPTIONS: acceptMode = QFileDialog::AcceptSave; - addCustomControl( pLayout, CHECKBOX_AUTOEXTENSION ); - addCustomControl( pLayout, CHECKBOX_PASSWORD ); - addCustomControl( pLayout, CHECKBOX_FILTEROPTIONS ); + addCustomControl(pLayout, CHECKBOX_AUTOEXTENSION); + addCustomControl(pLayout, CHECKBOX_PASSWORD); + addCustomControl(pLayout, CHECKBOX_FILTEROPTIONS); break; case FILESAVE_AUTOEXTENSION_SELECTION: acceptMode = QFileDialog::AcceptSave; - addCustomControl( pLayout, CHECKBOX_AUTOEXTENSION ); - addCustomControl( pLayout, CHECKBOX_SELECTION ); + addCustomControl(pLayout, CHECKBOX_AUTOEXTENSION); + addCustomControl(pLayout, CHECKBOX_SELECTION); break; case FILESAVE_AUTOEXTENSION_TEMPLATE: acceptMode = QFileDialog::AcceptSave; - addCustomControl( pLayout, CHECKBOX_AUTOEXTENSION ); - addCustomControl( pLayout, LISTBOX_TEMPLATE ); + addCustomControl(pLayout, CHECKBOX_AUTOEXTENSION); + addCustomControl(pLayout, LISTBOX_TEMPLATE); break; case FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE: - addCustomControl( pLayout, CHECKBOX_LINK ); - addCustomControl( pLayout, CHECKBOX_PREVIEW ); - addCustomControl( pLayout, LISTBOX_IMAGE_TEMPLATE ); + addCustomControl(pLayout, CHECKBOX_LINK); + addCustomControl(pLayout, CHECKBOX_PREVIEW); + addCustomControl(pLayout, LISTBOX_IMAGE_TEMPLATE); break; case FILEOPEN_PLAY: - addCustomControl( pLayout, PUSHBUTTON_PLAY ); + addCustomControl(pLayout, PUSHBUTTON_PLAY); break; case FILEOPEN_LINK_PLAY: - addCustomControl( pLayout, CHECKBOX_LINK ); - addCustomControl( pLayout, PUSHBUTTON_PLAY ); + addCustomControl(pLayout, CHECKBOX_LINK); + addCustomControl(pLayout, PUSHBUTTON_PLAY); break; case FILEOPEN_READONLY_VERSION: - addCustomControl( pLayout, CHECKBOX_READONLY ); - addCustomControl( pLayout, LISTBOX_VERSION ); + addCustomControl(pLayout, CHECKBOX_READONLY); + addCustomControl(pLayout, LISTBOX_VERSION); break; case FILEOPEN_LINK_PREVIEW: - addCustomControl( pLayout, CHECKBOX_LINK ); - addCustomControl( pLayout, CHECKBOX_PREVIEW ); + addCustomControl(pLayout, CHECKBOX_LINK); + addCustomControl(pLayout, CHECKBOX_PREVIEW); break; case FILEOPEN_PREVIEW: - addCustomControl( pLayout, CHECKBOX_PREVIEW ); + addCustomControl(pLayout, CHECKBOX_PREVIEW); break; default: - throw lang::IllegalArgumentException( - "Unknown template", - static_cast< XFilePicker2* >( this ), - 1 ); + throw lang::IllegalArgumentException("Unknown template", + static_cast<XFilePicker2*>(this), 1); } - if( !m_aCustomWidgetsMap.empty() ) + if (!m_aCustomWidgetsMap.empty()) { - QHBoxLayout *pHBoxLayout = new QHBoxLayout(); - pLayout->addLayout( pHBoxLayout, pLayout->rowCount(), 0, 1, 2 ); + QHBoxLayout* pHBoxLayout = new QHBoxLayout(); + pLayout->addLayout(pHBoxLayout, pLayout->rowCount(), 0, 1, 2); pHBoxLayout->addStretch(); - QPushButton *pButton = new QPushButton( "Ok" ); - connect( pButton, SIGNAL(clicked()), m_pOptionsDialog, SLOT(accept()) ); - pHBoxLayout->addWidget( pButton ); - pButton = new QPushButton( "Cancel" ); - connect( pButton, SIGNAL(clicked()), m_pOptionsDialog, SLOT(reject()) ); - pHBoxLayout->addWidget( pButton ); + QPushButton* pButton = new QPushButton("Ok"); + connect(pButton, SIGNAL(clicked()), m_pOptionsDialog, SLOT(accept())); + pHBoxLayout->addWidget(pButton); + pButton = new QPushButton("Cancel"); + connect(pButton, SIGNAL(clicked()), m_pOptionsDialog, SLOT(reject())); + pHBoxLayout->addWidget(pButton); } - const char *resId = nullptr; - switch ( acceptMode ) + const char* resId = nullptr; + switch (acceptMode) { - case QFileDialog::AcceptOpen: - resId = STR_FPICKER_OPEN; - break; - case QFileDialog::AcceptSave: - resId = STR_FPICKER_SAVE; - m_pFileDialog->setFileMode( QFileDialog::AnyFile ); - break; + case QFileDialog::AcceptOpen: + resId = STR_FPICKER_OPEN; + break; + case QFileDialog::AcceptSave: + resId = STR_FPICKER_SAVE; + m_pFileDialog->setFileMode(QFileDialog::AnyFile); + break; } - m_pFileDialog->setAcceptMode( acceptMode ); - m_pFileDialog->setWindowTitle( getResString(resId) ); + m_pFileDialog->setAcceptMode(acceptMode); + m_pFileDialog->setWindowTitle(getResString(resId)); } -void SAL_CALL Qt5FilePicker::cancel() -{ - -} +void SAL_CALL Qt5FilePicker::cancel() {} -void SAL_CALL Qt5FilePicker::disposing( const lang::EventObject &rEvent ) +void SAL_CALL Qt5FilePicker::disposing(const lang::EventObject& rEvent) { - uno::Reference<XFilePickerListener> xFilePickerListener( rEvent.Source, uno::UNO_QUERY ); + uno::Reference<XFilePickerListener> xFilePickerListener(rEvent.Source, uno::UNO_QUERY); - if ( xFilePickerListener.is() ) + if (xFilePickerListener.is()) { - removeFilePickerListener( xFilePickerListener ); + removeFilePickerListener(xFilePickerListener); } } OUString SAL_CALL Qt5FilePicker::getImplementationName() { - return OUString( "com.sun.star.ui.dialogs.Qt5FilePicker" ); + return OUString("com.sun.star.ui.dialogs.Qt5FilePicker"); } -sal_Bool SAL_CALL Qt5FilePicker::supportsService( const OUString& ServiceName ) +sal_Bool SAL_CALL Qt5FilePicker::supportsService(const OUString& ServiceName) { return cppu::supportsService(this, ServiceName); } -uno::Sequence< OUString > SAL_CALL Qt5FilePicker::getSupportedServiceNames() +uno::Sequence<OUString> SAL_CALL Qt5FilePicker::getSupportedServiceNames() { return FilePicker_getSupportedServiceNames(); } -void Qt5FilePicker::filterSelected(const QString &) +void Qt5FilePicker::filterSelected(const QString&) { FilePickerEvent aEvent; aEvent.ElementId = LISTBOX_FILTER; - SAL_INFO( "vcl", "filter changed" ); + SAL_INFO("vcl", "filter changed"); if (m_xListener.is()) - m_xListener->controlStateChanged( aEvent ); + m_xListener->controlStateChanged(aEvent); } void Qt5FilePicker::selectionChanged() { FilePickerEvent aEvent; - SAL_INFO( "vcl", "file selection changed" ); + SAL_INFO("vcl", "file selection changed"); if (m_xListener.is()) - m_xListener->fileSelectionChanged( aEvent ); + m_xListener->fileSelectionChanged(aEvent); } OUString Qt5FilePicker::getDirectory() { - uno::Sequence< OUString > seq = getSelectedFiles(); + uno::Sequence<OUString> seq = getSelectedFiles(); if (seq.getLength() > 1) seq.realloc(1); - return seq[ 0 ]; + return seq[0]; } -void Qt5FilePicker::setDescription( const OUString& ) -{ - -} +void Qt5FilePicker::setDescription(const OUString&) {} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qt5/Qt5Font.cxx b/vcl/qt5/Qt5Font.cxx index 46e7b9ec01c3..0164c3b13cd4 100644 --- a/vcl/qt5/Qt5Font.cxx +++ b/vcl/qt5/Qt5Font.cxx @@ -41,8 +41,7 @@ static hb_blob_t* getFontTable(hb_face_t*, hb_tag_t nTableTag, void* pUserData) hb_blob_t* pBlob = nullptr; if (nLength > 0) - pBlob = hb_blob_create(aTable.data(), nLength, - HB_MEMORY_MODE_DUPLICATE, nullptr, nullptr); + pBlob = hb_blob_create(aTable.data(), nLength, HB_MEMORY_MODE_DUPLICATE, nullptr, nullptr); return pBlob; } diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx index 4a36bee27776..e86e10d15f43 100644 --- a/vcl/qt5/Qt5Frame.cxx +++ b/vcl/qt5/Qt5Frame.cxx @@ -141,15 +141,15 @@ void Qt5Frame::TriggerPaintEvent(QRect aRect) CallCallback(SalEvent::Paint, &aPaintEvt); } -void Qt5Frame::InitSvpSalGraphics( SvpSalGraphics* pSvpSalGraphics ) +void Qt5Frame::InitSvpSalGraphics(SvpSalGraphics* pSvpSalGraphics) { int width = m_pQWidget->size().width(); int height = m_pQWidget->size().height(); m_pSvpGraphics = pSvpSalGraphics; m_pSurface.reset(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height)); m_pSvpGraphics->setSurface(m_pSurface.get(), basegfx::B2IVector(width, height)); - cairo_surface_set_user_data(m_pSurface.get(), SvpSalGraphics::getDamageKey(), - &m_aDamageHandler, nullptr); + cairo_surface_set_user_data(m_pSurface.get(), SvpSalGraphics::getDamageKey(), &m_aDamageHandler, + nullptr); TriggerPaintEvent(); } @@ -164,8 +164,8 @@ SalGraphics* Qt5Frame::AcquireGraphics() { if (!m_pOurSvpGraphics.get()) { - m_pOurSvpGraphics.reset( new SvpSalGraphics() ); - InitSvpSalGraphics( m_pOurSvpGraphics.get() ); + m_pOurSvpGraphics.reset(new SvpSalGraphics()); + InitSvpSalGraphics(m_pOurSvpGraphics.get()); } return m_pOurSvpGraphics.get(); } @@ -234,10 +234,7 @@ void Qt5Frame::SetIcon(sal_uInt16 nIcon) m_pQWidget->window()->setWindowIcon(aIcon); } -void Qt5Frame::SetMenu(SalMenu* pMenu) -{ - m_pSalMenu = static_cast<Qt5Menu*>( pMenu ); -} +void Qt5Frame::SetMenu(SalMenu* pMenu) { m_pSalMenu = static_cast<Qt5Menu*>(pMenu); } void Qt5Frame::DrawMenuBar() {} diff --git a/vcl/qt5/Qt5Graphics_Text.cxx b/vcl/qt5/Qt5Graphics_Text.cxx index d95795953ff9..e5fc79e0445b 100644 --- a/vcl/qt5/Qt5Graphics_Text.cxx +++ b/vcl/qt5/Qt5Graphics_Text.cxx @@ -134,14 +134,14 @@ void Qt5Graphics::GetGlyphWidths(const PhysicalFontFace* /*pPFF*/, bool /*bVerti bool Qt5Graphics::GetGlyphBoundRect(const GlyphItem& rGlyph, tools::Rectangle& rRect) { const int nLevel = rGlyph.mnFallbackLevel; - if( nLevel >= MAX_FALLBACK ) + if (nLevel >= MAX_FALLBACK) return false; - Qt5Font* pFont = m_pTextStyle[ nLevel ]; - if( !pFont ) + Qt5Font* pFont = m_pTextStyle[nLevel]; + if (!pFont) return false; - QRawFont aRawFont(QRawFont::fromFont( *pFont )); + QRawFont aRawFont(QRawFont::fromFont(*pFont)); rRect = toRectangle(aRawFont.boundingRect(rGlyph.maGlyphId).toAlignedRect()); return true; } @@ -155,11 +155,11 @@ std::unique_ptr<SalLayout> Qt5Graphics::GetTextLayout(ImplLayoutArgs&, int nFall return std::unique_ptr<SalLayout>(); } -void Qt5Graphics::DrawTextLayout(const GenericSalLayout &rLayout ) +void Qt5Graphics::DrawTextLayout(const GenericSalLayout& rLayout) { const Qt5Font* pFont = static_cast<const Qt5Font*>(&rLayout.GetFont()); - assert( pFont ); - QRawFont aRawFont(QRawFont::fromFont( *pFont )); + assert(pFont); + QRawFont aRawFont(QRawFont::fromFont(*pFont)); QVector<quint32> glyphIndexes; QVector<QPointF> positions; @@ -174,14 +174,14 @@ void Qt5Graphics::DrawTextLayout(const GenericSalLayout &rLayout ) } QGlyphRun aGlyphRun; - aGlyphRun.setPositions( positions ); - aGlyphRun.setGlyphIndexes( glyphIndexes ); - aGlyphRun.setRawFont( aRawFont ); + aGlyphRun.setPositions(positions); + aGlyphRun.setGlyphIndexes(glyphIndexes); + aGlyphRun.setRawFont(aRawFont); Qt5Painter aPainter(*this); QColor aColor = toQColor(m_aTextColor); aPainter.setPen(aColor); - aPainter.drawGlyphRun( QPointF(), aGlyphRun ); + aPainter.drawGlyphRun(QPointF(), aGlyphRun); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qt5/Qt5Instance.cxx b/vcl/qt5/Qt5Instance.cxx index 9bfcd00e630b..6cc083f8f865 100644 --- a/vcl/qt5/Qt5Instance.cxx +++ b/vcl/qt5/Qt5Instance.cxx @@ -111,27 +111,21 @@ Qt5Instance::CreateVirtualDevice(SalGraphics* pGraphics, long& nDX, long& nDY, D } } -SalMenu* Qt5Instance::CreateMenu( bool bMenuBar, Menu* pVCLMenu ) +SalMenu* Qt5Instance::CreateMenu(bool bMenuBar, Menu* pVCLMenu) { - Qt5Menu* pSalMenu = new Qt5Menu( bMenuBar ); - pSalMenu->SetMenu( pVCLMenu ); + Qt5Menu* pSalMenu = new Qt5Menu(bMenuBar); + pSalMenu->SetMenu(pVCLMenu); return pSalMenu; } -void Qt5Instance::DestroyMenu( SalMenu* pMenu ) -{ - delete pMenu; -} +void Qt5Instance::DestroyMenu(SalMenu* pMenu) { delete pMenu; } -SalMenuItem* Qt5Instance::CreateMenuItem( const SalItemParams* pItemData ) +SalMenuItem* Qt5Instance::CreateMenuItem(const SalItemParams* pItemData) { - return new Qt5MenuItem( pItemData ); + return new Qt5MenuItem(pItemData); } -void Qt5Instance::DestroyMenuItem( SalMenuItem* pItem ) -{ - delete pItem; -} +void Qt5Instance::DestroyMenuItem(SalMenuItem* pItem) { delete pItem; } SalTimer* Qt5Instance::CreateSalTimer() { return new Qt5Timer(); } @@ -211,18 +205,18 @@ void Qt5Instance::ProcessEvent(SalUserEvent aEvent) aEvent.m_pFrame->CallCallback(aEvent.m_nEvent, aEvent.m_pData); } -css::uno::Reference< css::ui::dialogs::XFilePicker2 > -Qt5Instance::createFilePicker( const css::uno::Reference< css::uno::XComponentContext > & ) +css::uno::Reference<css::ui::dialogs::XFilePicker2> +Qt5Instance::createFilePicker(const css::uno::Reference<css::uno::XComponentContext>&) { - return css::uno::Reference< css::ui::dialogs::XFilePicker2 >( - new Qt5FilePicker( QFileDialog::ExistingFile ) ); + return css::uno::Reference<css::ui::dialogs::XFilePicker2>( + new Qt5FilePicker(QFileDialog::ExistingFile)); } -css::uno::Reference< css::ui::dialogs::XFolderPicker2 > -Qt5Instance::createFolderPicker( const css::uno::Reference< css::uno::XComponentContext > & ) +css::uno::Reference<css::ui::dialogs::XFolderPicker2> +Qt5Instance::createFolderPicker(const css::uno::Reference<css::uno::XComponentContext>&) { - return css::uno::Reference< css::ui::dialogs::XFolderPicker2 >( - new Qt5FilePicker( QFileDialog::Directory ) ); + return css::uno::Reference<css::ui::dialogs::XFolderPicker2>( + new Qt5FilePicker(QFileDialog::Directory)); } extern "C" { diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx index e61595af4850..ce95da1a94d7 100644 --- a/vcl/qt5/Qt5Menu.cxx +++ b/vcl/qt5/Qt5Menu.cxx @@ -15,174 +15,157 @@ #include <vcl/svapp.hxx> -Qt5Menu::Qt5Menu( bool bMenuBar ) : - mpVCLMenu( nullptr ), - mpParentSalMenu( nullptr ), - mpFrame( nullptr ), - mbMenuBar( bMenuBar ) +Qt5Menu::Qt5Menu(bool bMenuBar) + : mpVCLMenu(nullptr) + , mpParentSalMenu(nullptr) + , mpFrame(nullptr) + , mbMenuBar(bMenuBar) { } -Qt5Menu::~Qt5Menu() -{ - maItems.clear(); -} +Qt5Menu::~Qt5Menu() { maItems.clear(); } -bool Qt5Menu::VisibleMenuBar() -{ - return false; -} +bool Qt5Menu::VisibleMenuBar() { return false; } -void Qt5Menu::InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos ) +void Qt5Menu::InsertItem(SalMenuItem* pSalMenuItem, unsigned nPos) { SolarMutexGuard aGuard; - Qt5MenuItem *pItem = static_cast<Qt5MenuItem*>( pSalMenuItem ); + Qt5MenuItem* pItem = static_cast<Qt5MenuItem*>(pSalMenuItem); - if ( nPos == MENU_APPEND ) - maItems.push_back( pItem ); + if (nPos == MENU_APPEND) + maItems.push_back(pItem); else - maItems.insert( maItems.begin() + nPos, pItem ); + maItems.insert(maItems.begin() + nPos, pItem); pItem->mpParentMenu = this; } -void Qt5Menu::RemoveItem( unsigned nPos ) +void Qt5Menu::RemoveItem(unsigned nPos) { SolarMutexGuard aGuard; - maItems.erase( maItems.begin() + nPos ); + maItems.erase(maItems.begin() + nPos); } -void Qt5Menu::SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos ) +void Qt5Menu::SetSubMenu(SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos) { SolarMutexGuard aGuard; - Qt5MenuItem *pItem = static_cast< Qt5MenuItem* >( pSalMenuItem ); - Qt5Menu *pQSubMenu = static_cast< Qt5Menu* >( pSubMenu ); + Qt5MenuItem* pItem = static_cast<Qt5MenuItem*>(pSalMenuItem); + Qt5Menu* pQSubMenu = static_cast<Qt5Menu*>(pSubMenu); - if ( pQSubMenu == nullptr ) + if (pQSubMenu == nullptr) return; pQSubMenu->mpParentSalMenu = this; pItem->mpSubMenu = pQSubMenu; } -void Qt5Menu::SetFrame( const SalFrame* pFrame ) +void Qt5Menu::SetFrame(const SalFrame* pFrame) { SolarMutexGuard aGuard; assert(mbMenuBar); - mpFrame = const_cast<Qt5Frame*>( static_cast<const Qt5Frame*>( pFrame ) ); + mpFrame = const_cast<Qt5Frame*>(static_cast<const Qt5Frame*>(pFrame)); - mpFrame->SetMenu( this ); + mpFrame->SetMenu(this); QWidget* pWidget = mpFrame->GetQWidget(); QMainWindow* pMainWindow = dynamic_cast<QMainWindow*>(pWidget); - if( pMainWindow ) + if (pMainWindow) mpQMenuBar = pMainWindow->menuBar(); - DoFullMenuUpdate( mpVCLMenu ); + DoFullMenuUpdate(mpVCLMenu); } -void Qt5Menu::DoFullMenuUpdate( Menu* pMenuBar, QMenu* pParentMenu ) +void Qt5Menu::DoFullMenuUpdate(Menu* pMenuBar, QMenu* pParentMenu) { Menu* pVCLMenu = mpVCLMenu; - if ( mbMenuBar && mpQMenuBar ) + if (mbMenuBar && mpQMenuBar) mpQMenuBar->clear(); QActionGroup* pQAG = nullptr; - for ( sal_Int32 nItem = 0; nItem < static_cast<sal_Int32>(GetItemCount()); nItem++ ) + for (sal_Int32 nItem = 0; nItem < static_cast<sal_Int32>(GetItemCount()); nItem++) { - Qt5MenuItem *pSalMenuItem = GetItemAtPos( nItem ); + Qt5MenuItem* pSalMenuItem = GetItemAtPos(nItem); sal_uInt16 nId = pSalMenuItem->mnId; - OUString aText = pVCLMenu->GetItemText( nId ); + OUString aText = pVCLMenu->GetItemText(nId); QMenu* pQMenu = pParentMenu; - NativeItemText( aText ); - vcl::KeyCode nAccelKey = pVCLMenu->GetAccelKey( nId ); - bool bChecked = pVCLMenu->IsItemChecked( nId ); - MenuItemBits itemBits = pVCLMenu->GetItemBits( nId ); + NativeItemText(aText); + vcl::KeyCode nAccelKey = pVCLMenu->GetAccelKey(nId); + bool bChecked = pVCLMenu->IsItemChecked(nId); + MenuItemBits itemBits = pVCLMenu->GetItemBits(nId); if (mbMenuBar && mpQMenuBar) // top-level menu - pQMenu = mpQMenuBar->addMenu( toQString(aText) ); + pQMenu = mpQMenuBar->addMenu(toQString(aText)); else { - if( pSalMenuItem->mpSubMenu ) + if (pSalMenuItem->mpSubMenu) { // submenu - pQMenu = pQMenu->addMenu( toQString(aText) ); - pQAG = new QActionGroup( pQMenu ); + pQMenu = pQMenu->addMenu(toQString(aText)); + pQAG = new QActionGroup(pQMenu); } else { - if ( pSalMenuItem->mnType == MenuItemType::SEPARATOR ) + if (pSalMenuItem->mnType == MenuItemType::SEPARATOR) pQMenu->addSeparator(); else { // leaf menu - QAction *pAction = pQMenu->addAction( toQString(aText) ); - pAction->setShortcut( toQString( nAccelKey.GetName(GetFrame()->GetWindow()) ) ); + QAction* pAction = pQMenu->addAction(toQString(aText)); + pAction->setShortcut(toQString(nAccelKey.GetName(GetFrame()->GetWindow()))); if (itemBits & MenuItemBits::CHECKABLE) { - pAction->setCheckable( true ); - pAction->setChecked( bChecked ); + pAction->setCheckable(true); + pAction->setChecked(bChecked); } else if (itemBits & MenuItemBits::RADIOCHECK) { pAction->setCheckable(true); - if ( !pQAG ) + if (!pQAG) { - pQAG = new QActionGroup( pQMenu ); + pQAG = new QActionGroup(pQMenu); pQAG->setExclusive(true); } - pQAG->addAction( pAction ); + pQAG->addAction(pAction); } - connect( pAction, &QAction::triggered, this, - [this, pSalMenuItem]{ DispatchCommand(pSalMenuItem); } ); + connect(pAction, &QAction::triggered, this, + [this, pSalMenuItem] { DispatchCommand(pSalMenuItem); }); } } } - if ( pSalMenuItem->mpSubMenu != nullptr ) + if (pSalMenuItem->mpSubMenu != nullptr) { pMenuBar->HandleMenuActivateEvent(pSalMenuItem->mpSubMenu->GetMenu()); - pSalMenuItem->mpSubMenu->DoFullMenuUpdate( pMenuBar, pQMenu ); + pSalMenuItem->mpSubMenu->DoFullMenuUpdate(pMenuBar, pQMenu); pMenuBar->HandleMenuDeActivateEvent(pSalMenuItem->mpSubMenu->GetMenu()); } } } -void Qt5Menu::ShowItem( unsigned nPos, bool bCheck ) -{ -} +void Qt5Menu::ShowItem(unsigned nPos, bool bCheck) {} -void Qt5Menu::CheckItem( unsigned nPos, bool bCheck ) -{ -} +void Qt5Menu::CheckItem(unsigned nPos, bool bCheck) {} -void Qt5Menu::EnableItem( unsigned nPos, bool bEnable ) -{ -} +void Qt5Menu::EnableItem(unsigned nPos, bool bEnable) {} -void Qt5Menu::SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const rtl::OUString& rText ) -{ -} +void Qt5Menu::SetItemText(unsigned nPos, SalMenuItem* pSalMenuItem, const rtl::OUString& rText) {} -void Qt5Menu::SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage) -{ -} +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::SetAccelerator(unsigned nPos, SalMenuItem* pSalMenuItem, const vcl::KeyCode& rKeyCode, + const OUString& rKeyName) { } -void Qt5Menu::GetSystemMenuData( SystemMenuData* pData ) -{ -} +void Qt5Menu::GetSystemMenuData(SystemMenuData* pData) {} Qt5Menu* Qt5Menu::GetTopLevel() { - Qt5Menu *pMenu = this; + Qt5Menu* pMenu = this; while (pMenu->mpParentSalMenu) pMenu = pMenu->mpParentSalMenu; return pMenu; @@ -192,38 +175,33 @@ const Qt5Frame* Qt5Menu::GetFrame() const { SolarMutexGuard aGuard; const Qt5Menu* pMenu = this; - while( pMenu && ! pMenu->mpFrame ) + while (pMenu && !pMenu->mpFrame) pMenu = pMenu->mpParentSalMenu; return pMenu ? pMenu->mpFrame : nullptr; } -void Qt5Menu::DispatchCommand( Qt5MenuItem *pQItem ) +void Qt5Menu::DispatchCommand(Qt5MenuItem* pQItem) { - if ( pQItem ) + if (pQItem) { Qt5Menu* pSalMenu = pQItem->mpParentMenu; Qt5Menu* pTopLevel = pSalMenu->GetTopLevel(); pTopLevel->GetMenu()->HandleMenuCommandEvent(pSalMenu->GetMenu(), pQItem->mnId); - SAL_WARN("vcl.qt5", "menu triggered " << pQItem->mnId ); + SAL_WARN("vcl.qt5", "menu triggered " << pQItem->mnId); } } -void Qt5Menu::NativeItemText( OUString& rItemText ) -{ - rItemText = rItemText.replace( '~', '&' ); -} +void Qt5Menu::NativeItemText(OUString& rItemText) { rItemText = rItemText.replace('~', '&'); } -Qt5MenuItem::Qt5MenuItem( const SalItemParams* pItemData ) : - mnId( pItemData->nId ), - mnType( pItemData->eType ), - mpVCLMenu( pItemData->pMenu ), - mpParentMenu( nullptr ), - mpSubMenu( nullptr ) +Qt5MenuItem::Qt5MenuItem(const SalItemParams* pItemData) + : mnId(pItemData->nId) + , mnType(pItemData->eType) + , mpVCLMenu(pItemData->pMenu) + , mpParentMenu(nullptr) + , mpSubMenu(nullptr) { } -Qt5MenuItem::~Qt5MenuItem() -{ -} +Qt5MenuItem::~Qt5MenuItem() {} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx index 5331d32000a8..7dc2e17d6e79 100644 --- a/vcl/qt5/Qt5Widget.cxx +++ b/vcl/qt5/Qt5Widget.cxx @@ -41,7 +41,7 @@ class VclQtMixinBase { public: - VclQtMixinBase( Qt5Frame *pFrame) { m_pFrame = pFrame; } + VclQtMixinBase(Qt5Frame* pFrame) { m_pFrame = pFrame; } void mixinFocusInEvent(QFocusEvent*); void mixinFocusOutEvent(QFocusEvent*); @@ -61,10 +61,9 @@ private: bool mixinHandleKeyEvent(QKeyEvent*, bool); void mixinHandleMouseButtonEvent(QMouseEvent*, bool); - Qt5Frame *m_pFrame; + Qt5Frame* m_pFrame; }; - void VclQtMixinBase::mixinPaintEvent(QPaintEvent* pEvent, QWidget* widget) { QPainter p(widget); @@ -74,7 +73,7 @@ void VclQtMixinBase::mixinPaintEvent(QPaintEvent* pEvent, QWidget* widget) cairo_surface_flush(pSurface); QImage aImage(cairo_image_surface_get_data(pSurface), widget->size().width(), - widget->size().height(),Qt5_DefaultFormat32); + widget->size().height(), Qt5_DefaultFormat32); p.drawImage(pEvent->rect().topLeft(), aImage, pEvent->rect()); } else @@ -195,7 +194,7 @@ void VclQtMixinBase::mixinMoveEvent(QMoveEvent*) void VclQtMixinBase::mixinShowEvent(QShowEvent*) { - QSize aSize( m_pFrame->GetQWidget()->size() ); + QSize aSize(m_pFrame->GetQWidget()->size()); SalPaintEvent aPaintEvt(0, 0, aSize.width(), aSize.height(), true); m_pFrame->CallCallback(SalEvent::Paint, &aPaintEvt); } @@ -380,8 +379,7 @@ void VclQtMixinBase::mixinFocusOutEvent(QFocusEvent*) m_pFrame->CallCallback(SalEvent::LoseFocus, nullptr); } -template<class ParentClassT> -class Qt5Widget : public ParentClassT +template <class ParentClassT> class Qt5Widget : public ParentClassT { //Q_OBJECT @@ -422,10 +420,7 @@ class Qt5Widget : public ParentClassT return maMixin.mixinMouseReleaseEvent(event); } - virtual void moveEvent(QMoveEvent* event) override - { - return maMixin.mixinMoveEvent(event); - } + virtual void moveEvent(QMoveEvent* event) override { return maMixin.mixinMoveEvent(event); } virtual void paintEvent(QPaintEvent* event) override { @@ -437,31 +432,23 @@ class Qt5Widget : public ParentClassT return maMixin.mixinResizeEvent(event, ParentClassT::size()); } - virtual void showEvent(QShowEvent* event) override - { - return maMixin.mixinShowEvent(event); - } + virtual void showEvent(QShowEvent* event) override { return maMixin.mixinShowEvent(event); } - virtual void wheelEvent(QWheelEvent* event) override - { - return maMixin.mixinWheelEvent(event); - } - - virtual void closeEvent(QCloseEvent* event) override - { - return maMixin.mixinCloseEvent(event); - } + virtual void wheelEvent(QWheelEvent* event) override { return maMixin.mixinWheelEvent(event); } + virtual void closeEvent(QCloseEvent* event) override { return maMixin.mixinCloseEvent(event); } private: - Qt5Widget( Qt5Frame& rFrame, QWidget* parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags() ) - : QWidget(parent, f), maMixin(&rFrame) + Qt5Widget(Qt5Frame& rFrame, QWidget* parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags()) + : QWidget(parent, f) + , maMixin(&rFrame) { Init(); } - Qt5Widget( Qt5Frame& rFrame, Qt::WindowFlags f ) - : QMainWindow(Q_NULLPTR, f), maMixin(&rFrame) + Qt5Widget(Qt5Frame& rFrame, Qt::WindowFlags f) + : QMainWindow(Q_NULLPTR, f) + , maMixin(&rFrame) { Init(); } @@ -472,18 +459,19 @@ private: ParentClassT::setMouseTracking(true); ParentClassT::setFocusPolicy(Qt::StrongFocus); } + public: - virtual ~Qt5Widget() override {}; + virtual ~Qt5Widget() override{}; - friend QWidget* createQt5Widget(Qt5Frame &rFrame, QWidget* parent, Qt::WindowFlags f); + friend QWidget* createQt5Widget(Qt5Frame& rFrame, QWidget* parent, Qt::WindowFlags f); }; -QWidget* createQt5Widget( Qt5Frame& rFrame, QWidget* parent, Qt::WindowFlags f) +QWidget* createQt5Widget(Qt5Frame& rFrame, QWidget* parent, Qt::WindowFlags f) { - if(parent) - return new Qt5Widget<QWidget>(rFrame, parent, f); + if (parent) + return new Qt5Widget<QWidget>(rFrame, parent, f); else - return new Qt5Widget<QMainWindow>(rFrame, f); + return new Qt5Widget<QMainWindow>(rFrame, f); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde5/FPServiceInfo.hxx b/vcl/unx/kde5/FPServiceInfo.hxx index fdb285144343..ec58684d4919 100644 --- a/vcl/unx/kde5/FPServiceInfo.hxx +++ b/vcl/unx/kde5/FPServiceInfo.hxx @@ -23,6 +23,6 @@ #define FILE_PICKER_SERVICE_NAME "com.sun.star.ui.dialogs.KDE4FilePicker" // the implementation names -#define FILE_PICKER_IMPL_NAME "com.sun.star.ui.dialogs.KDE4FilePicker" +#define FILE_PICKER_IMPL_NAME "com.sun.star.ui.dialogs.KDE4FilePicker" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde5/KDE5SalData.cxx b/vcl/unx/kde5/KDE5SalData.cxx index 1b0e2071770b..587bf021410b 100644 --- a/vcl/unx/kde5/KDE5SalData.cxx +++ b/vcl/unx/kde5/KDE5SalData.cxx @@ -24,18 +24,16 @@ #include "KDE5SalData.hxx" -KDE5SalData::KDE5SalData( SalInstance *pInstance ) - : Qt5Data( pInstance ) +KDE5SalData::KDE5SalData(SalInstance* pInstance) + : Qt5Data(pInstance) { } -KDE5SalData::~KDE5SalData() -{ -} +KDE5SalData::~KDE5SalData() {} void KDE5SalData::initNWF() { - ImplSVData *pSVData = ImplGetSVData(); + ImplSVData* pSVData = ImplGetSVData(); // draw toolbars on separate lines pSVData->maNWFData.mbDockingAreaSeparateTB = true; @@ -48,13 +46,11 @@ void KDE5SalData::initNWF() pSVData->maNWFData.mbNoFocusRectsForFlatButtons = true; // Styled menus need additional space - QStyle *style = QApplication::style(); - pSVData->maNWFData.mnMenuFormatBorderX = - style->pixelMetric( QStyle::PM_MenuPanelWidth ) + - style->pixelMetric( QStyle::PM_MenuHMargin ); - pSVData->maNWFData.mnMenuFormatBorderY = - style->pixelMetric( QStyle::PM_MenuPanelWidth ) + - style->pixelMetric( QStyle::PM_MenuVMargin ); + QStyle* style = QApplication::style(); + pSVData->maNWFData.mnMenuFormatBorderX = style->pixelMetric(QStyle::PM_MenuPanelWidth) + + style->pixelMetric(QStyle::PM_MenuHMargin); + pSVData->maNWFData.mnMenuFormatBorderY = style->pixelMetric(QStyle::PM_MenuPanelWidth) + + style->pixelMetric(QStyle::PM_MenuVMargin); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde5/KDE5SalData.hxx b/vcl/unx/kde5/KDE5SalData.hxx index a72180694d7b..32b24da1f4ea 100644 --- a/vcl/unx/kde5/KDE5SalData.hxx +++ b/vcl/unx/kde5/KDE5SalData.hxx @@ -23,11 +23,11 @@ class KDE5SalData : public Qt5Data { - public: - KDE5SalData( SalInstance *pInstance ); - virtual ~KDE5SalData(); +public: + KDE5SalData(SalInstance* pInstance); + virtual ~KDE5SalData(); - static void initNWF() ; + static void initNWF(); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde5/KDE5SalDisplay.cxx b/vcl/unx/kde5/KDE5SalDisplay.cxx index 4b844c288533..e6cec3677ba3 100644 --- a/vcl/unx/kde5/KDE5SalDisplay.cxx +++ b/vcl/unx/kde5/KDE5SalDisplay.cxx @@ -28,12 +28,12 @@ SalKDE5Display* SalKDE5Display::selfptr = nullptr; -SalKDE5Display::SalKDE5Display( Display* pDisp ) - : SalX11Display( pDisp ) +SalKDE5Display::SalKDE5Display(Display* pDisp) + : SalX11Display(pDisp) { - assert( selfptr == nullptr ); + assert(selfptr == nullptr); selfptr = this; - xim_protocol = XInternAtom( pDisp_, "_XIM_PROTOCOL", False ); + xim_protocol = XInternAtom(pDisp_, "_XIM_PROTOCOL", False); } SalKDE5Display::~SalKDE5Display() @@ -48,16 +48,16 @@ SalKDE5Display::~SalKDE5Display() void SalKDE5Display::Yield() { - if( DispatchInternalEvent() ) + if (DispatchInternalEvent()) return; // Prevent blocking from Drag'n'Drop events, which may have already have processed the event - if (XEventsQueued( pDisp_, QueuedAfterReading ) == 0) + if (XEventsQueued(pDisp_, QueuedAfterReading) == 0) return; - DBG_ASSERT( GetSalData()->m_pInstance->GetYieldMutex()->IsCurrentThread() == - osl::Thread::getCurrentIdentifier(), - "will crash soon since solar mutex not locked in SalKDE5Display::Yield" ); + DBG_ASSERT(GetSalData()->m_pInstance->GetYieldMutex()->IsCurrentThread() + == osl::Thread::getCurrentIdentifier(), + "will crash soon since solar mutex not locked in SalKDE5Display::Yield"); /*XEvent event; XNextEvent( pDisp_, &event ); @@ -74,22 +74,21 @@ void SalKDE5Display::Yield() // completely. Skipped events are KeyPress, KeyRelease and also _XIM_PROTOCOL client message // (seems to be necessary too, hopefully there are not other internal XIM messages that // would need this handling). -bool SalKDE5Display::checkDirectInputEvent( xcb_generic_event_t* ev ) +bool SalKDE5Display::checkDirectInputEvent(xcb_generic_event_t* ev) { switch (ev->response_type & ~0x80) { case XCB_CLIENT_MESSAGE: case XCB_KEY_PRESS: case XCB_KEY_RELEASE: - if( QApplication::activeWindow() == nullptr ) + if (QApplication::activeWindow() == nullptr) { -// Dispatch(ev); + // Dispatch(ev); return true; } break; } return false; - } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde5/KDE5SalDisplay.hxx b/vcl/unx/kde5/KDE5SalDisplay.hxx index 8cd18d4ed813..640efdbc1e03 100644 --- a/vcl/unx/kde5/KDE5SalDisplay.hxx +++ b/vcl/unx/kde5/KDE5SalDisplay.hxx @@ -28,20 +28,18 @@ class SalKDE5Display : public SalX11Display { - public: - explicit SalKDE5Display( Display* pDisp ); - virtual ~SalKDE5Display() override; - static SalKDE5Display* self(); - virtual void Yield() override; - bool checkDirectInputEvent( xcb_generic_event_t* ev ); - private: - Atom xim_protocol; - static SalKDE5Display* selfptr; +public: + explicit SalKDE5Display(Display* pDisp); + virtual ~SalKDE5Display() override; + static SalKDE5Display* self(); + virtual void Yield() override; + bool checkDirectInputEvent(xcb_generic_event_t* ev); + +private: + Atom xim_protocol; + static SalKDE5Display* selfptr; }; -inline SalKDE5Display* SalKDE5Display::self() -{ - return selfptr; -} +inline SalKDE5Display* SalKDE5Display::self() { return selfptr; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kde5/KDE5SalFrame.cxx b/vcl/unx/kde5/KDE5SalFrame.cxx index 849f0f322a11..8caa9b9f30ec 100644 --- a/vcl/unx/kde5/KDE5SalFrame.cxx +++ b/vcl/unx/kde5/KDE5SalFrame.cxx @@ -45,109 +45,108 @@ #include <boost/optional.hpp> - -KDE5SalFrame::KDE5SalFrame( KDE5SalFrame* pParent, SalFrameStyleFlags nState, bool bUseCairo ) - :Qt5Frame( pParent, nState, bUseCairo ) - ,m_bGraphicsInUse(false) +KDE5SalFrame::KDE5SalFrame(KDE5SalFrame* pParent, SalFrameStyleFlags nState, bool bUseCairo) + : Qt5Frame(pParent, nState, bUseCairo) + , m_bGraphicsInUse(false) { } /** Helper function to convert colors. */ -static Color toColor( const QColor &rColor ) +static Color toColor(const QColor& rColor) { - return Color( rColor.red(), rColor.green(), rColor.blue() ); + return Color(rColor.red(), rColor.green(), rColor.blue()); } - /** Helper function to add information to Font from QFont. Mostly grabbed from the Gtk+ vclplug (salnativewidgets-gtk.cxx). */ -static vcl::Font toFont( const QFont &rQFont, const css::lang::Locale& rLocale ) +static vcl::Font toFont(const QFont& rQFont, const css::lang::Locale& rLocale) { psp::FastPrintFontInfo aInfo; - QFontInfo qFontInfo( rQFont ); + QFontInfo qFontInfo(rQFont); // set family name - aInfo.m_aFamilyName = OUString( static_cast<const char *>(rQFont.family().toUtf8()), strlen( static_cast<const char *>(rQFont.family().toUtf8()) ), RTL_TEXTENCODING_UTF8 ); + aInfo.m_aFamilyName = OUString(static_cast<const char*>(rQFont.family().toUtf8()), + strlen(static_cast<const char*>(rQFont.family().toUtf8())), + RTL_TEXTENCODING_UTF8); // set italic - aInfo.m_eItalic = ( qFontInfo.italic()? ITALIC_NORMAL: ITALIC_NONE ); + aInfo.m_eItalic = (qFontInfo.italic() ? ITALIC_NORMAL : ITALIC_NONE); // set weight int nWeight = qFontInfo.weight(); - if ( nWeight <= QFont::Light ) + if (nWeight <= QFont::Light) aInfo.m_eWeight = WEIGHT_LIGHT; - else if ( nWeight <= QFont::Normal ) + else if (nWeight <= QFont::Normal) aInfo.m_eWeight = WEIGHT_NORMAL; - else if ( nWeight <= QFont::DemiBold ) + else if (nWeight <= QFont::DemiBold) aInfo.m_eWeight = WEIGHT_SEMIBOLD; - else if ( nWeight <= QFont::Bold ) + else if (nWeight <= QFont::Bold) aInfo.m_eWeight = WEIGHT_BOLD; else aInfo.m_eWeight = WEIGHT_ULTRABOLD; // set width int nStretch = rQFont.stretch(); - if ( nStretch <= QFont::UltraCondensed ) + if (nStretch <= QFont::UltraCondensed) aInfo.m_eWidth = WIDTH_ULTRA_CONDENSED; - else if ( nStretch <= QFont::ExtraCondensed ) + else if (nStretch <= QFont::ExtraCondensed) aInfo.m_eWidth = WIDTH_EXTRA_CONDENSED; - else if ( nStretch <= QFont::Condensed ) + else if (nStretch <= QFont::Condensed) aInfo.m_eWidth = WIDTH_CONDENSED; - else if ( nStretch <= QFont::SemiCondensed ) + else if (nStretch <= QFont::SemiCondensed) aInfo.m_eWidth = WIDTH_SEMI_CONDENSED; - else if ( nStretch <= QFont::Unstretched ) + else if (nStretch <= QFont::Unstretched) aInfo.m_eWidth = WIDTH_NORMAL; - else if ( nStretch <= QFont::SemiExpanded ) + else if (nStretch <= QFont::SemiExpanded) aInfo.m_eWidth = WIDTH_SEMI_EXPANDED; - else if ( nStretch <= QFont::Expanded ) + else if (nStretch <= QFont::Expanded) aInfo.m_eWidth = WIDTH_EXPANDED; - else if ( nStretch <= QFont::ExtraExpanded ) + else if (nStretch <= QFont::ExtraExpanded) aInfo.m_eWidth = WIDTH_EXTRA_EXPANDED; else aInfo.m_eWidth = WIDTH_ULTRA_EXPANDED; - SAL_INFO( "vcl.kde5", "font name BEFORE system match: \"" << aInfo.m_aFamilyName << "\"" ); + SAL_INFO("vcl.kde5", "font name BEFORE system match: \"" << aInfo.m_aFamilyName << "\""); // match font to e.g. resolve "Sans" - psp::PrintFontManager::get().matchFont( aInfo, rLocale ); + psp::PrintFontManager::get().matchFont(aInfo, rLocale); - SAL_INFO( "vcl.kde5", "font match " << - (aInfo.m_nID != 0 ? "succeeded" : "failed") << - ", name AFTER: \"" << aInfo.m_aFamilyName << "\"" ); + SAL_INFO("vcl.kde5", "font match " << (aInfo.m_nID != 0 ? "succeeded" : "failed") + << ", name AFTER: \"" << aInfo.m_aFamilyName << "\""); // font height int nPointHeight = qFontInfo.pointSize(); - if ( nPointHeight <= 0 ) + if (nPointHeight <= 0) nPointHeight = rQFont.pointSize(); // Create the font - vcl::Font aFont( aInfo.m_aFamilyName, Size( 0, nPointHeight ) ); - if( aInfo.m_eWeight != WEIGHT_DONTKNOW ) - aFont.SetWeight( aInfo.m_eWeight ); - if( aInfo.m_eWidth != WIDTH_DONTKNOW ) - aFont.SetWidthType( aInfo.m_eWidth ); - if( aInfo.m_eItalic != ITALIC_DONTKNOW ) - aFont.SetItalic( aInfo.m_eItalic ); - if( aInfo.m_ePitch != PITCH_DONTKNOW ) - aFont.SetPitch( aInfo.m_ePitch ); + vcl::Font aFont(aInfo.m_aFamilyName, Size(0, nPointHeight)); + if (aInfo.m_eWeight != WEIGHT_DONTKNOW) + aFont.SetWeight(aInfo.m_eWeight); + if (aInfo.m_eWidth != WIDTH_DONTKNOW) + aFont.SetWidthType(aInfo.m_eWidth); + if (aInfo.m_eItalic != ITALIC_DONTKNOW) + aFont.SetItalic(aInfo.m_eItalic); + if (aInfo.m_ePitch != PITCH_DONTKNOW) + aFont.SetPitch(aInfo.m_ePitch); return aFont; } /** Implementation of KDE integration's main method. */ -void KDE5SalFrame::UpdateSettings( AllSettings& rSettings ) +void KDE5SalFrame::UpdateSettings(AllSettings& rSettings) { - StyleSettings style( rSettings.GetStyleSettings() ); + StyleSettings style(rSettings.GetStyleSettings()); bool bSetTitleFont = false; // General settings QPalette pal = QApplication::palette(); - style.SetToolbarIconSize( ToolbarIconSize::Large ); + style.SetToolbarIconSize(ToolbarIconSize::Large); style.SetActiveColor(toColor(pal.color(QPalette::Active, QPalette::Window))); style.SetDeactiveColor(toColor(pal.color(QPalette::Inactive, QPalette::Window))); ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits