[Libreoffice-commits] core.git: include/vcl sfx2/source vcl/inc vcl/source vcl/unx

2023-07-23 Thread Rafael Lima (via logerrit)
 include/vcl/weld.hxx |1 +
 sfx2/source/control/templatedlglocalview.cxx |   10 ++
 sfx2/source/inc/helpids.h|8 
 vcl/inc/salvtables.hxx   |1 +
 vcl/source/app/salvtables.cxx|7 +++
 vcl/unx/gtk3/gtkinst.cxx |5 +
 6 files changed, 32 insertions(+)

New commits:
commit 65c91bd5aa6f9b68390739a0e027d23c8a32da08
Author: Rafael Lima 
AuthorDate: Fri Jul 21 14:47:47 2023 +0200
Commit: Caolán McNamara 
CommitDate: Sun Jul 23 15:07:11 2023 +0200

tdf#147911 Implement set_item_help_id for context menu items

This patch adds the method set_item_help_id for weld::Menu (similarly to 
what we already have for weld::Toolbar). This way, it is possible to define 
help IDs for each entry in context menus that are created during runtime.

This is necessary to fix various bug tickets that request F1 to redirect to 
the corresponding help page when a context menu item has focus. This currently 
works for context menus created from XML files, but fails for context menus 
created during runtime.

Besides implementing the new method, this patch fixes bug 147911 (see 
changes in file templatedlglocalview.cxx) to showcase how set_item_help_id can 
be used.

NOTE: Pressing F1 in context menus only work with "gen" and "win"... 
unfortunately it does not work in kf5 and gtk3 due to a separate bug (see bug 
156376).

Change-Id: Ic9bb1bca3e646cb4d0b879d8672c5dcc9c19c4c9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154699
Tested-by: Jenkins
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 4c198b3ecc99..c03f78d6c0e1 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -2419,6 +2419,7 @@ public:
 TriState eCheckRadioFalse)
 = 0;
 
+virtual void set_item_help_id(const OUString& rIdent, const OUString& 
rHelpId) = 0;
 virtual void remove(const OUString& rId) = 0;
 
 virtual void clear() = 0;
diff --git a/sfx2/source/control/templatedlglocalview.cxx 
b/sfx2/source/control/templatedlglocalview.cxx
index b469ea716dc8..52a12b4ef965 100644
--- a/sfx2/source/control/templatedlglocalview.cxx
+++ b/sfx2/source/control/templatedlglocalview.cxx
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 
TemplateDlgLocalView::TemplateDlgLocalView(std::unique_ptr
 xWindow,
@@ -113,6 +114,15 @@ void TemplateDlgLocalView::createContextMenu(const bool 
bIsDefault, const bool b
 mxContextMenu->append("move", SfxResId(STR_MOVE), BMP_MENU_MOVE);
 mxContextMenu->append("export", SfxResId(STR_EXPORT), BMP_MENU_EXPORT);
 
+// Set the help IDs of all context menu entries
+mxContextMenu->set_item_help_id("open", HID_TEMPLATEDLG_OPEN);
+mxContextMenu->set_item_help_id("edit", HID_TEMPLATEDLG_EDIT);
+mxContextMenu->set_item_help_id("default", HID_TEMPLATEDLG_DEFAULT);
+mxContextMenu->set_item_help_id("rename", HID_TEMPLATEDLG_RENAME);
+mxContextMenu->set_item_help_id("delete", HID_TEMPLATEDLG_DELETE);
+mxContextMenu->set_item_help_id("move", HID_TEMPLATEDLG_MOVE);
+mxContextMenu->set_item_help_id("export", HID_TEMPLATEDLG_EXPORT);
+
 if (!bIsSingleSel)
 {
 mxContextMenu->set_sensitive("open", false);
diff --git a/sfx2/source/inc/helpids.h b/sfx2/source/inc/helpids.h
index 7dbce5235779..051cc5ada8a5 100644
--- a/sfx2/source/inc/helpids.h
+++ b/sfx2/source/inc/helpids.h
@@ -40,6 +40,14 @@ inline constexpr OUStringLiteral HID_HELP_TOOLBOXITEM_PRINT 
= u"SFX2_HID_HELP_TO
 inline constexpr OUStringLiteral HID_HELP_TOOLBOXITEM_BOOKMARKS = 
u"SFX2_HID_HELP_TOOLBOXITEM_BOOKMARKS";
 inline constexpr OUStringLiteral HID_HELP_TOOLBOXITEM_SEARCHDIALOG = 
u"SFX2_HID_HELP_TOOLBOXITEM_SEARCHDIALOG";
 
+inline constexpr OUStringLiteral HID_TEMPLATEDLG_OPEN = 
u"SFX2_HID_TEMPLATEDLG_OPEN";
+inline constexpr OUStringLiteral HID_TEMPLATEDLG_EDIT = 
u"SFX2_HID_TEMPLATEDLG_EDIT";
+inline constexpr OUStringLiteral HID_TEMPLATEDLG_DEFAULT = 
u"SFX2_HID_TEMPLATEDLG_DEFAULT";
+inline constexpr OUStringLiteral HID_TEMPLATEDLG_RENAME = 
u"SFX2_HID_TEMPLATEDLG_RENAME";
+inline constexpr OUStringLiteral HID_TEMPLATEDLG_DELETE = 
u"SFX2_HID_TEMPLATEDLG_DELETE";
+inline constexpr OUStringLiteral HID_TEMPLATEDLG_MOVE = 
u"SFX2_HID_TEMPLATEDLG_MOVE";
+inline constexpr OUStringLiteral HID_TEMPLATEDLG_EXPORT = 
u"SFX2_HID_TEMPLATEDLG_EXPORT";
+
 inline constexpr OUStringLiteral HID_QUERY_LOAD_TEMPLATE = 
u"SFX2_HID_QUERY_LOAD_TEMPLATE";
 
 inline constexpr OUStringLiteral HID_SIDEBAR_WINDOW = 
u"SFX2_HID_SIDEBAR_WINDOW";
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index 04a42c3a8929..4264de0cea6d 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -169,6 +169,7 @@ public:
 const css::uno::Reference& 
rImage,
   

[Libreoffice-commits] core.git: include/vcl sfx2/source vcl/inc vcl/source vcl/unx

2021-02-12 Thread Caolán McNamara (via logerrit)
 include/vcl/weld.hxx  |   11 ++-
 sfx2/source/sidebar/SidebarController.cxx |9 ++---
 vcl/inc/salvtables.hxx|1 +
 vcl/source/app/salvtables.cxx |   13 ++---
 vcl/unx/gtk3/gtk3gtkinst.cxx  |9 +
 5 files changed, 32 insertions(+), 11 deletions(-)

New commits:
commit 1a490b71feb2340ac4f58ff1bef983ef1115e2f3
Author: Caolán McNamara 
AuthorDate: Thu Feb 11 20:57:25 2021 +
Commit: Caolán McNamara 
CommitDate: Fri Feb 12 10:10:23 2021 +0100

allow using css::graphic::XGraphic to set menu image

Change-Id: Ice5062f26ea300aec73d5fd849484c8bc4fc43bd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110793
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 7921948027a3..c33bd97a098a 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -2220,6 +2220,7 @@ public:
 
 virtual void insert(int pos, const OUString& rId, const OUString& rStr,
 const OUString* pIconName, VirtualDevice* 
pImageSurface,
+const css::uno::Reference* 
pImage,
 TriState eCheckRadioFalse)
 = 0;
 
@@ -2232,23 +2233,23 @@ public:
 
 void append(const OUString& rId, const OUString& rStr)
 {
-insert(-1, rId, rStr, nullptr, nullptr, TRISTATE_INDET);
+insert(-1, rId, rStr, nullptr, nullptr, nullptr, TRISTATE_INDET);
 }
 void append_check(const OUString& rId, const OUString& rStr)
 {
-insert(-1, rId, rStr, nullptr, nullptr, TRISTATE_TRUE);
+insert(-1, rId, rStr, nullptr, nullptr, nullptr, TRISTATE_TRUE);
 }
 void append_radio(const OUString& rId, const OUString& rStr)
 {
-insert(-1, rId, rStr, nullptr, nullptr, TRISTATE_FALSE);
+insert(-1, rId, rStr, nullptr, nullptr, nullptr, TRISTATE_FALSE);
 }
 void append(const OUString& rId, const OUString& rStr, const OUString& 
rImage)
 {
-insert(-1, rId, rStr, , nullptr, TRISTATE_INDET);
+insert(-1, rId, rStr, , nullptr, nullptr, TRISTATE_INDET);
 }
 void append(const OUString& rId, const OUString& rStr, VirtualDevice& 
rImage)
 {
-insert(-1, rId, rStr, nullptr, , TRISTATE_INDET);
+insert(-1, rId, rStr, nullptr, , nullptr, TRISTATE_INDET);
 }
 
 // return the number of toplevel nodes
diff --git a/sfx2/source/sidebar/SidebarController.cxx 
b/sfx2/source/sidebar/SidebarController.cxx
index 2af18b6d7558..ae12e361a6ba 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -1069,7 +1069,8 @@ void SidebarController::PopulatePopupMenus(weld::Menu& 
rMenu, weld::Menu& rCusto
 for (const auto& rItem : rMenuData)
 {
 OString sIdent("select" + OString::number(nIndex));
-rMenu.insert(nIndex, OUString::fromUtf8(sIdent), rItem.msDisplayName, 
nullptr, nullptr, TRISTATE_FALSE);
+rMenu.insert(nIndex, OUString::fromUtf8(sIdent), rItem.msDisplayName,
+ nullptr, nullptr, nullptr, TRISTATE_FALSE);
 rMenu.set_active(sIdent, rItem.mbIsCurrentDeck);
 rMenu.set_sensitive(sIdent, rItem.mbIsEnabled && rItem.mbIsActive);
 
@@ -1079,13 +1080,15 @@ void SidebarController::PopulatePopupMenus(weld::Menu& 
rMenu, weld::Menu& rCusto
 {
 // Don't allow the currently visible deck to be disabled.
 OString sSubIdent("nocustomize" + OString::number(nIndex));
-rCustomizationMenu.insert(nIndex, 
OUString::fromUtf8(sSubIdent), rItem.msDisplayName, nullptr, nullptr, 
TRISTATE_FALSE);
+rCustomizationMenu.insert(nIndex, 
OUString::fromUtf8(sSubIdent), rItem.msDisplayName,
+  nullptr, nullptr, nullptr, 
TRISTATE_FALSE);
 rCustomizationMenu.set_active(sSubIdent, true);
 }
 else
 {
 OString sSubIdent("customize" + OString::number(nIndex));
-rCustomizationMenu.insert(nIndex, 
OUString::fromUtf8(sSubIdent), rItem.msDisplayName, nullptr, nullptr, 
TRISTATE_TRUE);
+rCustomizationMenu.insert(nIndex, 
OUString::fromUtf8(sSubIdent), rItem.msDisplayName,
+  nullptr, nullptr, nullptr, 
TRISTATE_TRUE);
 rCustomizationMenu.set_active(sSubIdent, rItem.mbIsEnabled && 
rItem.mbIsActive);
 }
 }
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index a3941ff51e67..2416aa6ab696 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -153,6 +153,7 @@ public:
 virtual void clear() override;
 virtual void insert(int pos, const OUString& rId, const OUString& rStr,
 const OUString* pIconName, VirtualDevice* 
pImageSurface,
+const css::uno::Reference* 
pImage,
 

[Libreoffice-commits] core.git: include/vcl sfx2/source vcl/inc vcl/source

2020-10-28 Thread Caolán McNamara (via logerrit)
 include/vcl/outdev.hxx  |3 ---
 include/vcl/svapp.hxx   |   11 ---
 sfx2/source/doc/objstor.cxx |4 
 vcl/inc/svdata.hxx  |3 ---
 vcl/source/app/svapp.cxx|5 -
 vcl/source/outdev/font.cxx  |   32 +---
 6 files changed, 1 insertion(+), 57 deletions(-)

New commits:
commit f34c304638258eb1d30a7fab942313199c65cc3f
Author: Caolán McNamara 
AuthorDate: Wed Oct 28 15:16:17 2020 +
Commit: Caolán McNamara 
CommitDate: Wed Oct 28 20:40:45 2020 +0100

tdf#137643 Revert "lock refreshing font data when loading a document"

from tdf#69060, to replace with an alternative solution

This reverts commit 98d71c4e0847797a4ba9229a8e6d832a8a3d5e0f.
and
This reverts commit 64d8e5f8db70f4f913abb902b41f4cff8dd1cdad.

Change-Id: I384e994b54aa1bfc735c6ab591b9b1410058451f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104716
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 60664ce3de02..ea8292909a39 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1292,9 +1292,6 @@ public:
 //If bNewFontLists is true then drop and refetch lists of system fonts
 SAL_DLLPRIVATE static void  ImplUpdateAllFontData( bool bNewFontLists );
 
-// Lock font updates for all output devices
-static void LockFontUpdates(bool bLock);
-
 protected:
 SAL_DLLPRIVATE const LogicalFontInstance* GetFontInstance() const;
 SAL_DLLPRIVATE tools::Long GetEmphasisAscent() const { return 
mnEmphasisAscent; }
diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx
index e5ecc5cb499d..b1d7759765c3 100644
--- a/include/vcl/svapp.hxx
+++ b/include/vcl/svapp.hxx
@@ -1307,17 +1307,6 @@ public:
 
 ///@}
 
-/** Lock font updates for all output devices
-
- @remark When performing operations that might involve multiple 
registration of fonts, such as
-opening/closing documents with multiple embedded fonts, then each font 
addition/removal
-might cause an event that initiates a rebuild of each OutputDevice's 
font lists.
-
-Locking font updates disables processing such events, and unlocking 
causes a single such
-processing for all OutputDevices.
-*/
-static void LockFontUpdates(bool bLock);
-
 // For vclbootstrapprotector:
 static void setDeInitHook(Link const & hook);
 
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 2f8a2c5f7779..d5803e1b0029 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -567,10 +567,6 @@ bool SfxObjectShell::ImportFromGeneratedStream_Impl(
 bool SfxObjectShell::DoLoad( SfxMedium *pMed )
 {
 ModifyBlocker_Impl aBlock( this );
-struct FontLockGuard {
-FontLockGuard() { Application::LockFontUpdates(true); }
-~FontLockGuard() { Application::LockFontUpdates(false); }
-} aFontLockGuard;
 
 pMedium = pMed;
 pMedium->CanDisposeStorage_Impl( true );
diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx
index b8a7a54f35b7..e7a423234043 100644
--- a/vcl/inc/svdata.hxx
+++ b/vcl/inc/svdata.hxx
@@ -383,9 +383,6 @@ struct ImplSVData
 VclPtr  mpDefaultWin;   // Default-Window
 boolmbDeInit = false;   // Is VCL 
deinitializing
 std::unique_ptr mpSalSystem; // SalSystem 
interface
-int mnFontUpdatesLockCount = 0; // avoid repeated 
font updates
-boolmbFontUpdatesPending = false;   // need to update 
font data after unlock
-boolmbFontUpdatesNewLists = false;  // generate new 
font lists
 boolmbResLocaleSet = false; // 
SV-Resource-Manager
 std::locale maResLocale;// Resource locale
 ImplSchedulerContextmaSchedCtx; // Data for class 
Scheduler
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 150caea518ee..3ee9413edf7f 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1038,11 +1038,6 @@ void Application::RemoveUserEvent( ImplSVEvent * 
nUserEvent )
 }
 }
 
-void Application::LockFontUpdates(bool bLock)
-{
-OutputDevice::LockFontUpdates(bLock);
-}
-
 vcl::Window* Application::GetFocusWindow()
 {
 return ImplGetSVData()->mpWinData->mpFocusWin;
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index a5301e3a594a..faaff5682df5 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -543,16 +543,7 @@ void OutputDevice::ImplClearAllFontData(bool bNewFontLists)
 
 void OutputDevice::ImplRefreshAllFontData(bool bNewFontLists)
 {
-auto svdata = ImplGetSVData();
-DBG_TESTSOLARMUTEX();
-if (!svdata->mnFontUpdatesLockCount)
-ImplUpdateFontDataForAllFrames(::ImplRefreshFontData, 
bNewFontLists);
-else
-{
-

[Libreoffice-commits] core.git: include/vcl sfx2/source vcl/inc vcl/source

2019-06-14 Thread Caolán McNamara (via logerrit)
 include/vcl/event.hxx|4 +---
 include/vcl/window.hxx   |1 +
 sfx2/source/view/frame2.cxx  |   34 --
 vcl/inc/salframe.hxx |4 
 vcl/source/window/dialog.cxx |8 
 vcl/source/window/window.cxx |5 +
 6 files changed, 35 insertions(+), 21 deletions(-)

New commits:
commit 252239ae30313142195b3da81aea45a89b2d6674
Author: Caolán McNamara 
AuthorDate: Fri Jun 14 09:18:44 2019 +0100
Commit: Caolán McNamara 
CommitDate: Fri Jun 14 13:06:54 2019 +0200

disable 'quit' menu entry when modal dialog waiting response

Traditionally when a modal dialog is active, the quit menu entry of all
LibreOffice toplevel frames, not just those which are themselves modal, is 
get
disabled.

This has come unstuck because its implemented by dialogs emitting
MouseNotifyEvent::[END]EXECUTEDIALOG on its parent, and SfxFrameWindow_Impl
listening for that event. But if the dialog parent is the toplevel parent of
SfxFrameWindow_Impl then it doesn't get seen by the SfxFrameWindow_Impl 
child.

Change-Id: I0c4a5472d16d9169e68f6b0c230d039f1119489a
Reviewed-on: https://gerrit.libreoffice.org/73975
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/include/vcl/event.hxx b/include/vcl/event.hxx
index d1e4b61b876d..bd0b5589f375 100644
--- a/include/vcl/event.hxx
+++ b/include/vcl/event.hxx
@@ -276,9 +276,7 @@ enum class MouseNotifyEvent
 GETFOCUS = 6,
 LOSEFOCUS= 7,
 COMMAND  = 8,
-INPUTENABLE  = 10,
-EXECUTEDIALOG= 100,
-ENDEXECUTEDIALOG = 101
+INPUTENABLE  = 10
 };
 
 class VCL_DLLPUBLIC NotifyEvent
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index e2223af65950..3b28f9a503a0 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -1578,6 +1578,7 @@ public:
 
 void SetHelpHdl(const Link& rLink);
 void SetMnemonicActivateHdl(const Link& rLink);
+void SetModalHierarchyHdl(const Link& rLink);
 };
 
 }
diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx
index 804440a4f24f..dd894c87dc37 100644
--- a/sfx2/source/view/frame2.cxx
+++ b/sfx2/source/view/frame2.cxx
@@ -61,9 +61,9 @@ using namespace ::com::sun::star::container;
 using namespace ::com::sun::star::beans;
 using ::com::sun::star::frame::XComponentLoader;
 
-
 class SfxFrameWindow_Impl : public vcl::Window
 {
+DECL_LINK(ModalHierarchyHdl, bool, void);
 public:
 SfxFrame*   pFrame;
 
@@ -75,13 +75,21 @@ public:
 virtual boolEventNotify( NotifyEvent& rEvt ) override;
 virtual voidResize() override;
 virtual voidGetFocus() override;
+virtual voiddispose() override;
 voidDoResize();
 };
 
-SfxFrameWindow_Impl::SfxFrameWindow_Impl( SfxFrame* pF, vcl::Window& 
i_rContainerWindow )
-: Window( _rContainerWindow, WB_BORDER | WB_CLIPCHILDREN | 
WB_NODIALOGCONTROL | WB_3DLOOK )
-, pFrame( pF )
+SfxFrameWindow_Impl::SfxFrameWindow_Impl(SfxFrame* pF, vcl::Window& 
i_rContainerWindow)
+: Window(_rContainerWindow, WB_BORDER | WB_CLIPCHILDREN | 
WB_NODIALOGCONTROL | WB_3DLOOK)
+, pFrame(pF)
+{
+i_rContainerWindow.SetModalHierarchyHdl(LINK(this, SfxFrameWindow_Impl, 
ModalHierarchyHdl));
+}
+
+void SfxFrameWindow_Impl::dispose()
 {
+GetParent()->SetModalHierarchyHdl(Link());
+vcl::Window::dispose();
 }
 
 void SfxFrameWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt )
@@ -119,20 +127,18 @@ bool SfxFrameWindow_Impl::EventNotify( NotifyEvent& rNEvt 
)
 if ( pView->GetViewShell()->KeyInput( *rNEvt.GetKeyEvent() ) )
 return true;
 }
-else if ( rNEvt.GetType() == MouseNotifyEvent::EXECUTEDIALOG )
-{
-pView->SetModalMode( true );
-return true;
-}
-else if ( rNEvt.GetType() == MouseNotifyEvent::ENDEXECUTEDIALOG /*|| 
rNEvt.GetType() == MouseNotifyEvent::INPUTENABLE*/ )
-{
-pView->SetModalMode( false );
-return true;
-}
 
 return Window::EventNotify( rNEvt );
 }
 
+IMPL_LINK(SfxFrameWindow_Impl, ModalHierarchyHdl, bool, bSetModal, void)
+{
+SfxViewFrame* pView = pFrame->GetCurrentViewFrame();
+if (!pView || !pView->GetObjectShell())
+return;
+pView->SetModalMode(bSetModal);
+}
+
 bool SfxFrameWindow_Impl::PreNotify( NotifyEvent& rNEvt )
 {
 MouseNotifyEvent nType = rNEvt.GetType();
diff --git a/vcl/inc/salframe.hxx b/vcl/inc/salframe.hxx
index b77ceafa8079..86ad6da98b6e 100644
--- a/vcl/inc/salframe.hxx
+++ b/vcl/inc/salframe.hxx
@@ -117,6 +117,7 @@ private:
 // the VCL window corresponding to this frame
 VclPtr m_pWindow;
 SALFRAMEPROCm_pProc;
+Linkm_aModalHierarchyHdl;
 protected:
 mutable std::unique_ptr m_xFrameWeld;
 public:
@@ -287,6 +288,9 @@ public:
 // returns the instance set
 vcl::Window*

[Libreoffice-commits] core.git: include/vcl sfx2/source vcl/inc vcl/source

2019-01-10 Thread Libreoffice Gerrit user
 include/vcl/outdev.hxx  |3 +++
 include/vcl/svapp.hxx   |   11 +++
 sfx2/source/doc/objstor.cxx |4 
 vcl/inc/svdata.hxx  |3 +++
 vcl/source/app/svapp.cxx|5 +
 vcl/source/outdev/font.cxx  |   40 +++-
 6 files changed, 65 insertions(+), 1 deletion(-)

New commits:
commit 98d71c4e0847797a4ba9229a8e6d832a8a3d5e0f
Author: Mike Kaganski 
AuthorDate: Fri Jan 11 00:06:49 2019 +0300
Commit: Mike Kaganski 
CommitDate: Fri Jan 11 05:38:52 2019 +0100

tdf#69060: lock refreshing font data when loading a document

This accumulates all calls to OutputDevice::ImplRefreshAllFontData
while loading document's model, to avoid multiple updates for each
imported font. After loading, OutputDevice::ImplRefreshAllFontData
is executed once.

Change-Id: I5b23a2b8a3765dee9061b6479665d04c2ba11cbf
Reviewed-on: https://gerrit.libreoffice.org/47112
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 1d4a936e22a6..3fa9d2167d27 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1263,6 +1263,9 @@ public:
 //If bNewFontLists is true then drop and refetch lists of system fonts
 SAL_DLLPRIVATE static void  ImplUpdateAllFontData( bool bNewFontLists );
 
+// Lock font updates for all output devices
+static void LockFontUpdates(bool bLock);
+
 protected:
 SAL_DLLPRIVATE const LogicalFontInstance* GetFontInstance() const;
 SAL_DLLPRIVATE long GetEmphasisAscent() const { return mnEmphasisAscent; }
diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx
index ac1c0ddfb848..712f75a0f09d 100644
--- a/include/vcl/svapp.hxx
+++ b/include/vcl/svapp.hxx
@@ -1365,6 +1365,17 @@ public:
 
 ///@}
 
+/** Lock font updates for all output devices
+
+ @remark When performing operations that might involve multiple 
registration of fonts, such as
+opening/closing documents with multiple embedded fonts, then each font 
addition/removal
+might cause an event that initiates a rebuild of each OutputDevice's 
font lists.
+
+Locking font updates disables processing such events, and unlocking 
causes a single such
+processing for all OutputDevices.
+*/
+static void LockFontUpdates(bool bLock);
+
 // For vclbootstrapprotector:
 static void setDeInitHook(Link const & hook);
 
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index f1ae5b009231..e83ff19c3186 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -581,6 +581,10 @@ bool SfxObjectShell::ImportFromGeneratedStream_Impl(
 bool SfxObjectShell::DoLoad( SfxMedium *pMed )
 {
 ModifyBlocker_Impl aBlock( this );
+struct FontLockGuard {
+FontLockGuard() { Application::LockFontUpdates(true); }
+~FontLockGuard() { Application::LockFontUpdates(false); }
+} aFontLockGuard;
 
 pMedium = pMed;
 pMedium->CanDisposeStorage_Impl( true );
diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx
index beb877f728ff..ea48d774ccca 100644
--- a/vcl/inc/svdata.hxx
+++ b/vcl/inc/svdata.hxx
@@ -351,6 +351,9 @@ struct ImplSVData
 boolmbDeInit = false;   // Is VCL 
deinitializing
 std::unique_ptr mpImeStatus;  // interface to 
ime status window, only used by the X11 backend
 std::unique_ptr mpSalSystem; // SalSystem 
interface
+int mnFontUpdatesLockCount = 0; // avoid repeated 
font updates
+boolmbFontUpdatesPending = false;   // need to update 
font data after unlock
+boolmbFontUpdatesNewLists = false;  // generate new 
font lists
 boolmbResLocaleSet = false; // 
SV-Resource-Manager
 std::locale maResLocale;// Resource locale
 ImplSchedulerContextmaSchedCtx; // indepen data 
for class Scheduler
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index c73769ebcc8a..c3f3b07827f0 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -987,6 +987,11 @@ void Application::RemoveUserEvent( ImplSVEvent * 
nUserEvent )
 }
 }
 
+void Application::LockFontUpdates(bool bLock)
+{
+OutputDevice::LockFontUpdates(bLock);
+}
+
 WorkWindow* Application::GetAppWindow()
 {
 return ImplGetSVData()->maWinData.mpAppWin;
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index 1e0cb553c04b..4d982e9d1f3a 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -595,9 +595,26 @@ void OutputDevice::ImplClearAllFontData(bool bNewFontLists)
 }
 }
 
+namespace {
+osl::Mutex& GetFontUpdatesLockMutex()
+{
+static osl::Mutex aFontUpdatesMutex;
+return aFontUpdatesMutex;
+}
+}
+
 void OutputDevice::ImplRefreshAllFontData(bool bNewFontLists)
 {
-

[Libreoffice-commits] core.git: include/vcl sfx2/source vcl/inc vcl/source

2015-06-15 Thread Stephan Bergmann
 include/vcl/idle.hxx |1 
 include/vcl/scheduler.hxx|   39 ++-
 include/vcl/timer.hxx|2 
 sfx2/source/appl/appinit.cxx |2 
 vcl/inc/svdata.hxx   |2 
 vcl/source/app/idle.cxx  |1 
 vcl/source/app/scheduler.cxx |  217 ---
 vcl/source/app/svdata.cxx|3 
 vcl/source/app/svmain.cxx|3 
 vcl/source/app/timer.cxx |   11 +-
 10 files changed, 127 insertions(+), 154 deletions(-)

New commits:
commit 09c5a9d41e03b3137ce47b9f9419290525458337
Author: Stephan Bergmann sberg...@redhat.com
Date:   Mon Jun 15 14:22:08 2015 +0200

Revert std::list for Scheduler

This reverts commit 1289d3c42af66990a2c8e5a7a38e51b6cd51c7eb, plus 
follow-ups
762e90ffa0cd5f85dadd9bad93391d105e60e418 vcl: loplugin:pointertobool and
863e5685dda88efd0bee3177a08eedffd4730e33 Fix funny line-ends, as it causes
memory corruption, see valgrind make CppunitTest_sw_ooxmlexport4 output:

 Invalid write of size 1
  Scheduler::ImplInvoke(unsigned long) (/vcl/source/app/scheduler.cxx:40)
  Scheduler::ProcessTaskScheduling(bool) 
(/vcl/source/app/scheduler.cxx:128)
  Scheduler::CallbackTaskScheduling(bool) 
(/vcl/source/app/scheduler.cxx:112)
  SalTimer::CallCallback(bool) (/vcl/inc/saltimer.hxx:53)
  SvpSalInstance::CheckTimeout(bool) (/vcl/headless/svpinst.cxx:191)
  SvpSalInstance::Yield(bool, bool) (/vcl/headless/svpinst.cxx:307)
  ImplYield(bool, bool) (/vcl/source/app/svapp.cxx:353)
  Application::Reschedule(bool) (/vcl/source/app/svapp.cxx:377)
  framework::StatusIndicatorFactory::impl_reschedule(bool) 
(/framework/source/helper/statusindicatorfactory.cxx:528)
  
framework::StatusIndicatorFactory::end(com::sun::star::uno::Referencecom::sun::star::task::XStatusIndicator
 const) (/framework/source/helper/statusindicatorfactory.cxx:229)
  framework::StatusIndicator::end() 
(/framework/source/helper/statusindicator.cxx:70)
  non-virtual thunk to framework::StatusIndicator::end() 
(/framework/source/helper/statusindicator.cxx:57)
  writerfilter::ooxml::OOXMLDocumentImpl::resolve(writerfilter::Stream) 
(/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx:531)
  
WriterFilter::filter(com::sun::star::uno::Sequencecom::sun::star::beans::PropertyValue
 const) (/writerfilter/source/filter/WriterFilter.cxx:191)
  non-virtual thunk to 
WriterFilter::filter(com::sun::star::uno::Sequencecom::sun::star::beans::PropertyValue
 const) (/writerfilter/source/filter/WriterFilter.cxx:126)
  SfxObjectShell::ImportFrom(SfxMedium, 
com::sun::star::uno::Referencecom::sun::star::text::XTextRange const) 
(/sfx2/source/doc/objstor.cxx:2271)
  SfxObjectShell::DoLoad(SfxMedium*) (/sfx2/source/doc/objstor.cxx:767)
  
SfxBaseModel::load(com::sun::star::uno::Sequencecom::sun::star::beans::PropertyValue
 const) (/sfx2/source/doc/sfxbasemodel.cxx:1859)
  non-virtual thunk to 
SfxBaseModel::load(com::sun::star::uno::Sequencecom::sun::star::beans::PropertyValue
 const) (/sfx2/source/doc/sfxbasemodel.cxx:1810)
  (anonymous 
namespace)::SfxFrameLoader_Impl::load(com::sun::star::uno::Sequencecom::sun::star::beans::PropertyValue
 const, com::sun::star::uno::Referencecom::sun::star::frame::XFrame const) 
(/sfx2/source/view/frmload.cxx:703)
  non-virtual thunk to (anonymous 
namespace)::SfxFrameLoader_Impl::load(com::sun::star::uno::Sequencecom::sun::star::beans::PropertyValue
 const, com::sun::star::uno::Referencecom::sun::star::frame::XFrame const) 
(/sfx2/source/view/frmload.cxx:615)
  framework::LoadEnv::impl_loadContent() 
(/framework/source/loadenv/loadenv.cxx:1122)
  framework::LoadEnv::startLoading() 
(/framework/source/loadenv/loadenv.cxx:383)
  
framework::LoadEnv::loadComponentFromURL(com::sun::star::uno::Referencecom::sun::star::frame::XComponentLoader
 const, com::sun::star::uno::Referencecom::sun::star::uno::XComponentContext 
const, rtl::OUString const, rtl::OUString const, int, 
com::sun::star::uno::Sequencecom::sun::star::beans::PropertyValue const) 
(/framework/source/loadenv/loadenv.cxx:164)
  framework::Desktop::loadComponentFromURL(rtl::OUString const, 
rtl::OUString const, int, 
com::sun::star::uno::Sequencecom::sun::star::beans::PropertyValue const) 
(/framework/source/services/desktop.cxx:566)
  non-virtual thunk to 
framework::Desktop::loadComponentFromURL(rtl::OUString const, rtl::OUString 
const, int, 
com::sun::star::uno::Sequencecom::sun::star::beans::PropertyValue const) 
(/framework/source/services/desktop.cxx:552)
  unotest::MacrosTest::loadFromDesktop(rtl::OUString const, rtl::OUString 
const, com::sun::star::uno::Sequencecom::sun::star::beans::PropertyValue 
const) (/unotest/source/cpp/macros_test.cxx:50)
  SwModelTestBase::load(char const*, char const*) 
(/sw/qa/extras/inc/swmodeltestbase.hxx:580)
  SwModelTestBase::executeImportExportImportTest(char const*) 
(/sw/qa/extras/inc/swmodeltestbase.hxx:219)