[Libreoffice-commits] core.git: desktop/source include/sfx2 sfx2/source starmath/inc starmath/source
desktop/source/lib/init.cxx|5 + include/sfx2/lokcomponenthelpers.hxx |2 sfx2/source/view/lokstarmathhelper.cxx | 23 ++-- starmath/inc/cursor.hxx|2 starmath/inc/view.hxx |9 +-- starmath/inc/visitors.hxx | 60 + starmath/source/cursor.cxx | 14 - starmath/source/view.cxx | 56 +++- starmath/source/visitors.cxx | 91 - 9 files changed, 205 insertions(+), 57 deletions(-) New commits: commit 14ed342dd3f4cae607f7785905787f73c7b1fde2 Author: Mike Kaganski AuthorDate: Wed Nov 2 11:03:08 2022 +0300 Commit: Mike Kaganski CommitDate: Sat Nov 5 09:19:07 2022 +0100 lok: show Math cursor Change-Id: I17a449f0a0662f0433de9cad1522a090434c1e30 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142178 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 46dbe3e5d9c6..6414a3fe1ca9 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -2138,6 +2138,11 @@ void CallbackFlushHandler::enqueueUpdatedTypes() void CallbackFlushHandler::enqueueUpdatedType( int type, const SfxViewShell* viewShell, int viewId ) { +if (type == LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR) +{ +if (const SfxViewShell* viewShell2 = LokStarMathHelper(viewShell).GetSmViewShell()) +viewShell = viewShell2; +} std::optional payload = viewShell->getLOKPayload( type, viewId ); if(!payload) return; // No actual payload to send. diff --git a/include/sfx2/lokcomponenthelpers.hxx b/include/sfx2/lokcomponenthelpers.hxx index b26cd0a13fb8..23bdcd44369e 100644 --- a/include/sfx2/lokcomponenthelpers.hxx +++ b/include/sfx2/lokcomponenthelpers.hxx @@ -72,6 +72,8 @@ public: vcl::Window* GetGraphicWindow(); vcl::Window* GetWidgetWindow(); +const SfxViewShell* GetSmViewShell(); +tools::Rectangle GetBoundingBox() const; void Dispatch(const OUString& cmd, const css::uno::Sequence& rArguments) const; diff --git a/sfx2/source/view/lokstarmathhelper.cxx b/sfx2/source/view/lokstarmathhelper.cxx index fb30d9cee449..8ec65c45a274 100644 --- a/sfx2/source/view/lokstarmathhelper.cxx +++ b/sfx2/source/view/lokstarmathhelper.cxx @@ -122,14 +122,29 @@ vcl::Window* LokStarMathHelper::GetWidgetWindow() return mpWidgetWindow.get(); } +const SfxViewShell* LokStarMathHelper::GetSmViewShell() +{ +if (vcl::Window* pGraphWindow = GetGraphicWindow()) +{ +return SfxViewShell::GetFirst(false, [pGraphWindow](const SfxViewShell* shell) { +return shell->GetWindow() && shell->GetWindow()->IsChild(pGraphWindow); +}); +} +return nullptr; +} + +tools::Rectangle LokStarMathHelper::GetBoundingBox() const +{ +return mpIPClient ? mpIPClient->GetObjArea() : tools::Rectangle{}; +} + bool LokStarMathHelper::postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier, double /*fScaleX*/, double /*fScaleY*/) { -if (vcl::Window* pWindow = GetWidgetWindow()) +const tools::Rectangle rBBox = GetBoundingBox(); +if (Point aMousePos(nX, nY); rBBox.Contains(aMousePos)) { -Point aMousePos(nX, nY); -tools::Rectangle rBBox = mpIPClient->GetObjArea(); -if (rBBox.Contains(aMousePos)) +if (vcl::Window* pWindow = GetWidgetWindow()) { aMousePos -= rBBox.TopLeft(); LokMouseEventData aMouseEventData( diff --git a/starmath/inc/cursor.hxx b/starmath/inc/cursor.hxx index 5886ffaf2eac..a1491c5decfe 100644 --- a/starmath/inc/cursor.hxx +++ b/starmath/inc/cursor.hxx @@ -186,6 +186,8 @@ public: /** Draw the caret */ void Draw(OutputDevice& pDev, Point Offset, bool isCaretVisible); +tools::Rectangle GetCaretRectangle(OutputDevice& rOutDev) const; + bool IsAtTailOfBracket(SmBracketType eBracketType) const; private: diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx index 309c89513489..1905edb02741 100644 --- a/starmath/inc/view.hxx +++ b/starmath/inc/view.hxx @@ -136,10 +136,7 @@ public: } private: -void SetIsCursorVisible(bool bVis) -{ -bIsCursorVisible = bVis; -} +void SetIsCursorVisible(bool bVis); void SetCursor(const SmNode *pNode); void SetCursor(const tools::Rectangle ); @@ -295,7 +292,7 @@ public: SmViewShell(SfxViewFrame *pFrame, SfxViewShell *pOldSh); virtual ~SmViewShell() override; -SmDocShell * GetDoc() +SmDocShell * GetDoc() const { return static_cast( GetViewFrame()->GetObjectShell() ); } @@ -325,6 +322,8 @@ public: SFX_DECL_INTERFACE(SFX_INTERFACE_SMA_START+SfxInterfaceId(2)) SFX_DECL_VIEWFACTORY(SmViewShell); +void SendCaretToLOK() const; + private: /// SfxInterface
[Libreoffice-commits] core.git: desktop/source include/sfx2 sfx2/source starmath/inc starmath/source sw/inc sw/source test/source
desktop/source/lib/init.cxx |7 +++ include/sfx2/viewsh.hxx |3 ++- sfx2/source/view/viewsh.cxx |2 +- starmath/inc/view.hxx |2 +- starmath/source/view.cxx |6 ++ sw/inc/view.hxx |2 +- sw/inc/viscrs.hxx |6 -- sw/source/core/crsr/viscrs.cxx| 15 +-- sw/source/uibase/inc/wrtsh.hxx|2 +- sw/source/uibase/uiview/view.cxx |4 ++-- sw/source/uibase/wrtsh/wrtsh4.cxx |6 +++--- test/source/lokcallback.cxx | 14 ++ 12 files changed, 31 insertions(+), 38 deletions(-) New commits: commit 0b85a66cc3d8e54747506089f92e154dc7665bfe Author: Mike Kaganski AuthorDate: Wed Aug 17 08:40:31 2022 +0300 Commit: Mike Kaganski CommitDate: Wed Aug 17 09:28:59 2022 +0200 Return std::optional instead of using bool* argument Change-Id: I47f03411a6677f22291bea4dc06920ab9052349a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138399 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 7f27f96d9efa..f9e871fb99f1 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -2119,11 +2119,10 @@ void CallbackFlushHandler::enqueueUpdatedTypes() void CallbackFlushHandler::enqueueUpdatedType( int type, const SfxViewShell* viewShell, int viewId ) { -bool ignore = false; -OString payload = viewShell->getLOKPayload( type, viewId, ); -if(ignore) +std::optional payload = viewShell->getLOKPayload( type, viewId ); +if(!payload) return; // No actual payload to send. -CallbackData callbackData(payload.getStr(), viewId); +CallbackData callbackData(payload->getStr(), viewId); m_queue1.emplace_back(type); m_queue2.emplace_back(callbackData); SAL_INFO("lok", "Queued updated [" << type << "]: [" << callbackData.getPayload() diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx index ea431a687b49..9762c6cd6e03 100644 --- a/include/sfx2/viewsh.hxx +++ b/include/sfx2/viewsh.hxx @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -356,7 +357,7 @@ public: // Returns current payload for nType, after libreOfficeKitViewUpdatedCallback() or // libreOfficeKitViewUpdatedCallbackPerViewId() were called. If no payload should // be generated, the ignore flag should be set. -virtual OString getLOKPayload(int nType, int nViewId, bool* ignore) const; +virtual std::optional getLOKPayload(int nType, int nViewId) const; /// Set if we are doing tiled searching. void setTiledSearching(bool bTiledSearching); diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index bd04697fab89..11812cca2fbf 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -1555,7 +1555,7 @@ void SfxViewShell::flushPendingLOKInvalidateTiles() // SfxViewShell itself does not delay any tile invalidations. } -OString SfxViewShell::getLOKPayload(int nType, int /*nViewId*/, bool* /*ignore*/) const +std::optional SfxViewShell::getLOKPayload(int nType, int /*nViewId*/) const { // SfxViewShell itself currently doesn't handle any updated-payload types. SAL_WARN("sfx.view", "SfxViewShell::getLOKPayload unhandled type " << lokCallbackTypeToString(nType)); diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx index 0a18e0084435..3bc3b7cdf461 100644 --- a/starmath/inc/view.hxx +++ b/starmath/inc/view.hxx @@ -289,7 +289,7 @@ class SmViewShell final : public SfxViewShell virtual void OuterResizePixel(const Point , const Size ) override; virtual void QueryObjAreaPixel( tools::Rectangle& rRect ) const override; virtual void SetZoomFactor( const Fraction , const Fraction ) override; -virtual OString getLOKPayload(int nType, int nViewId, bool* ignore) const override; +virtual std::optional getLOKPayload(int nType, int nViewId) const override; public: diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx index add20227a808..56fc72bdd96d 100644 --- a/starmath/source/view.cxx +++ b/starmath/source/view.cxx @@ -2275,7 +2275,7 @@ void SmViewShell::ZoomByItemSet(const SfxItemSet *pSet) } } -OString SmViewShell::getLOKPayload(int nType, int nViewId, bool* ignore) const +std::optional SmViewShell::getLOKPayload(int nType, int nViewId) const { switch (nType) { @@ -2285,11 +2285,9 @@ OString SmViewShell::getLOKPayload(int nType, int nViewId, bool* ignore) const case LOK_CALLBACK_TEXT_SELECTION_START: case LOK_CALLBACK_TEXT_SELECTION_END: case LOK_CALLBACK_TEXT_VIEW_SELECTION: -if (ignore) -*ignore = true; return {}; } -return SfxViewShell::getLOKPayload(nType, nViewId, ignore); // aborts +return SfxViewShell::getLOKPayload(nType, nViewId); // aborts } /* vim:set shiftwidth=4
[Libreoffice-commits] core.git: desktop/source include/sfx2 sfx2/source sw/inc sw/source test/source
desktop/source/lib/init.cxx |5 +++-- include/sfx2/viewsh.hxx |5 +++-- sfx2/source/view/viewsh.cxx |2 +- sw/inc/view.hxx |2 +- sw/inc/viscrs.hxx |4 ++-- sw/source/core/crsr/viscrs.cxx|6 -- sw/source/uibase/inc/wrtsh.hxx|2 +- sw/source/uibase/uiview/view.cxx |4 ++-- sw/source/uibase/wrtsh/wrtsh4.cxx |6 +++--- test/source/lokcallback.cxx | 10 ++ 10 files changed, 26 insertions(+), 20 deletions(-) New commits: commit 309bffba603ae65e76148dff3add1a541a2b5d81 Author: Luboš Luňák AuthorDate: Fri Nov 12 10:56:54 2021 +0100 Commit: Luboš Luňák CommitDate: Fri Nov 12 13:02:08 2021 +0100 make it explicit whether to ignore the result of getLOKPayload() Returning an empty string to signify 'ignore' was a poor design, as some messages types actually may have valid empty messages. Change-Id: Ia82d3d97d150bc5ef412a1bd4b1091d9b2d84385 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124979 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 6a1e0871fceb..2191a87f5b87 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -2191,8 +2191,9 @@ void CallbackFlushHandler::enqueueUpdatedTypes() void CallbackFlushHandler::enqueueUpdatedType( int type, const SfxViewShell* viewShell, int viewId ) { -OString payload = viewShell->getLOKPayload( type, viewId ); -if(payload.isEmpty()) +bool ignore = false; +OString payload = viewShell->getLOKPayload( type, viewId, ); +if(ignore) return; // No actual payload to send. CallbackData callbackData(payload.getStr(), viewId); m_queue1.emplace_back(type); diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx index e35c6848c9e1..fc06eb9ddbe8 100644 --- a/include/sfx2/viewsh.hxx +++ b/include/sfx2/viewsh.hxx @@ -346,8 +346,9 @@ public: virtual void libreOfficeKitViewUpdatedCallback(int nType) const override; virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId, int nSourceViewId) const override; // Returns current payload for nType, after libreOfficeKitViewUpdatedCallback() or -// libreOfficeKitViewUpdatedCallbackPerViewId() were called. -virtual OString getLOKPayload(int nType, int nViewId) const; +// libreOfficeKitViewUpdatedCallbackPerViewId() were called. If no payload should +// be generated, the ignore flag should be set. +virtual OString getLOKPayload(int nType, int nViewId, bool* ignore) const; /// Set if we are doing tiled searching. void setTiledSearching(bool bTiledSearching); diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index e49899bc36eb..75826a28d128 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -1544,7 +1544,7 @@ void SfxViewShell::flushPendingLOKInvalidateTiles() // SfxViewShell itself does not delay any tile invalidations. } -OString SfxViewShell::getLOKPayload(int nType, int /*nViewId*/) const +OString SfxViewShell::getLOKPayload(int nType, int /*nViewId*/, bool* /*ignore*/) const { // SfxViewShell itself currently doesn't handle any updated-payload types. SAL_WARN("sfx.view", "SfxViewShell::getLOKPayload unhandled type " << lokCallbackTypeToString(nType)); diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx index edcf028d9f5d..d074f0d552a7 100644 --- a/sw/inc/view.hxx +++ b/sw/inc/view.hxx @@ -693,7 +693,7 @@ public: virtual tools::Rectangle getLOKVisibleArea() const override; virtual void flushPendingLOKInvalidateTiles() override; -virtual OString getLOKPayload(int nType, int nViewId) const override; +virtual OString getLOKPayload(int nType, int nViewId, bool* ignore) const override; }; inline tools::Long SwView::GetXScroll() const diff --git a/sw/inc/viscrs.hxx b/sw/inc/viscrs.hxx index 3c355e01800c..6755b548e8a0 100644 --- a/sw/inc/viscrs.hxx +++ b/sw/inc/viscrs.hxx @@ -60,7 +60,7 @@ public: void SetPosAndShow(SfxViewShell const * pViewShell); const vcl::Cursor& GetTextCursor() const; -OString getLOKPayload(int nType, int nViewId) const; +OString getLOKPayload(int nType, int nViewId, bool* ignore) const; }; // From here classes/methods for selections. @@ -114,7 +114,7 @@ public: static void Get1PixelInLogic( const SwViewShell& rSh, tools::Long* pX = nullptr, tools::Long* pY = nullptr ); -OString getLOKPayload(int nType, int nViewId) const; +OString getLOKPayload(int nType, int nViewId, bool* ignore) const; }; class SW_DLLPUBLIC SwShellCursor : public virtual SwCursor, public SwSelPaintRects diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index d28dab2c7d98..26e43813575d 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -266,7 +266,7
[Libreoffice-commits] core.git: desktop/source include/sfx2 sfx2/source sw/source
desktop/source/lib/init.cxx|4 +- include/sfx2/lokhelper.hxx | 17 +++--- sfx2/source/view/lokhelper.cxx | 69 - sw/source/core/crsr/crsrsh.cxx |2 - 4 files changed, 56 insertions(+), 36 deletions(-) New commits: commit 44f6329330e8c8f000cb310b04ac13777e8bfff3 Author: Ashod Nakashian AuthorDate: Fri Jul 24 11:33:46 2020 -0400 Commit: Tor Lillqvist CommitDate: Fri Nov 20 14:34:00 2020 +0100 sfx2: lok: refactor notifications and const correctness This reduces the stringification and reuses the notificaiton helpers to reduce code duplication. Change-Id: Icf9f9c50f361a0ded741d39fed37cfcc8da1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99972 Tested-by: Jenkins CollaboraOffice Reviewed-by: Ashod Nakashian Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106221 Tested-by: Jenkins Reviewed-by: Tor Lillqvist diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 8f82d577f3cc..6fe7347e9b70 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -2195,7 +2195,7 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis, LibLibreOffice_Impl* pLib = static_cast(pThis); pLib->maLastExceptionMsg.clear(); -OUString aURL(getAbsoluteURL(pURL)); +const OUString aURL(getAbsoluteURL(pURL)); if (aURL.isEmpty()) { pLib->maLastExceptionMsg = "Filename to load was not provided."; @@ -2291,7 +2291,7 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis, LibLODocument_Impl* pDocument = new LibLODocument_Impl(xComponent, nDocumentIdCounter++); -// Do we know that after loading the document, its initial view is the "current" view? +// After loading the document, its initial view is the "current" view. SfxLokHelper::setDocumentIdOfView(pDocument->mnDocumentId); if (pLib->mpCallback) { diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx index 79052a0d6e04..2aad968681b8 100644 --- a/include/sfx2/lokhelper.hxx +++ b/include/sfx2/lokhelper.hxx @@ -51,7 +51,7 @@ public: /// Set a view shell as current one. static void setView(int nId); /// Get the currently active view. -static int getView(SfxViewShell* pViewShell = nullptr); +static int getView(const SfxViewShell* pViewShell = nullptr); /// Get the number of views of the current object shell. static std::size_t getViewsCount(); /// Get viewIds of views of the current object shell. @@ -72,17 +72,24 @@ public: static LOKDeviceFormFactor getDeviceFormFactor(); /// Set the device form factor that should be used for a new view. static void setDeviceFormFactor(const OUString& rDeviceFormFactor); + /// Iterate over any view shell, except pThisViewShell, passing it to the f function. template static void forEachOtherView(ViewShellType* pThisViewShell, FunctionType f); + /// Invoke the LOK callback of all other views showing the same document as pThisView, with a payload of rKey-rPayload. -static void notifyOtherViews(SfxViewShell* pThisView, int nType, const OString& rKey, const OString& rPayload); +static void notifyOtherViews(const SfxViewShell* pThisView, int nType, const OString& rKey, + const OString& rPayload); /// Invoke the LOK callback of all views except pThisView, with a JSON payload created from the given property tree. -static void notifyOtherViews(SfxViewShell* pThisView, int nType, const boost::property_tree::ptree& rTree); +static void notifyOtherViews(const SfxViewShell* pThisView, int nType, + const boost::property_tree::ptree& rTree); /// Same as notifyOtherViews(), but works on a selected "other" view, not on all of them. -static void notifyOtherView(SfxViewShell* pThisView, SfxViewShell const* pOtherView, int nType, const OString& rKey, const OString& rPayload); +static void notifyOtherView(const SfxViewShell* pThisView, SfxViewShell const* pOtherView, +int nType, const OString& rKey, const OString& rPayload); /// Same as notifyOtherViews(), the property-tree version, but works on a selected "other" view, not on all of them. -static void notifyOtherView(SfxViewShell* pThisView, SfxViewShell const* pOtherView, int nType, const boost::property_tree::ptree& rTree); +static void notifyOtherView(const SfxViewShell* pThisView, SfxViewShell const* pOtherView, +int nType, const boost::property_tree::ptree& rTree); + /// Emits a LOK_CALLBACK_STATE_CHANGED static void sendUnoStatus(const SfxViewShell* pShell, const SfxPoolItem* pItem); /// Emits a LOK_CALLBACK_WINDOW diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index
[Libreoffice-commits] core.git: desktop/source include/sfx2 sfx2/source
desktop/source/lib/init.cxx | 19 --- include/sfx2/sidebar/SidebarDockingWindow.hxx |2 +- sfx2/source/sidebar/ResourceManager.cxx |9 + 3 files changed, 26 insertions(+), 4 deletions(-) New commits: commit 87c58f6a9351f2a2ec40fd99c4e5a63bfe29d0b8 Author: Mert Tumer AuthorDate: Wed Apr 29 16:29:57 2020 +0300 Commit: Mert Tumer CommitDate: Tue Aug 4 12:43:29 2020 +0200 added ability to switch sidebar deck on init.cxx for mobilewizard Change-Id: I532398bc41e1c984c24b1d39e4844315a0a69847 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93162 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97062 Reviewed-by: Jan Holesovsky Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98247 Tested-by: Jenkins Reviewed-by: Mert Tumer diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index dc1b6b1664fc..346c5174accd 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -111,6 +111,7 @@ #include #include #include +#include #include #include #include @@ -883,10 +884,10 @@ void ExecuteOrientationChange() mxUndoManager->leaveUndoContext(); } -void setupSidebar(bool bShow) +void setupSidebar(bool bShow, const OUString& sidebarDeckId = "") { SfxViewShell* pViewShell = SfxViewShell::Current(); -SfxViewFrame* pViewFrame = pViewShell? pViewShell->GetViewFrame(): nullptr; +SfxViewFrame* pViewFrame = pViewShell ? pViewShell->GetViewFrame() : nullptr; if (pViewFrame) { if (bShow && !pViewFrame->GetChildWindow(SID_SIDEBAR)) @@ -905,6 +906,11 @@ void setupSidebar(bool bShow) auto pDockingWin = dynamic_cast(pChild->GetWindow()); if (!pDockingWin) return; + +if (!sidebarDeckId.isEmpty()) +{ +pDockingWin->GetSidebarController()->SwitchToDeck(sidebarDeckId); +} pDockingWin->SyncUpdate(); } else @@ -3744,6 +3750,7 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pComma SfxObjectShell* pDocSh = SfxObjectShell::Current(); OUString aCommand(pCommand, strlen(pCommand), RTL_TEXTENCODING_UTF8); LibLODocument_Impl* pDocument = static_cast(pThis); +OUString sidebarDeckId = "PropertyDeck"; std::vector aPropertyValuesVector(jsonToPropertyValuesVector(pArguments)); @@ -3897,9 +3904,15 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pComma return; } } +else if (gImpl && aCommand == ".uno:LOKSidebarWriterPage") +{ +sidebarDeckId = "WriterPageDeck"; +setupSidebar(true, sidebarDeckId); +return; +} else if (gImpl && aCommand == ".uno:SidebarShow") { -setupSidebar(true); +setupSidebar(true, sidebarDeckId); return; } else if (gImpl && aCommand == ".uno:SidebarHide") diff --git a/include/sfx2/sidebar/SidebarDockingWindow.hxx b/include/sfx2/sidebar/SidebarDockingWindow.hxx index 6d726ddd1260..f156ab0cb0fb 100644 --- a/include/sfx2/sidebar/SidebarDockingWindow.hxx +++ b/include/sfx2/sidebar/SidebarDockingWindow.hxx @@ -49,7 +49,7 @@ public: void SyncUpdate(); void NotifyResize(); - +auto& GetSidebarController() const { return mpSidebarController; } using SfxDockingWindow::Close; private: diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx index f3440e6dcb46..c61781643f49 100644 --- a/sfx2/source/sidebar/ResourceManager.cxx +++ b/sfx2/source/sidebar/ResourceManager.cxx @@ -429,6 +429,15 @@ void ResourceManager::ReadPanelList() if (!aPanelNode.isValid()) continue; +if (comphelper::LibreOfficeKit::isActive()) +{ +// Hide these panels in LOK as they aren't fully functional. +OUString aPanelId = getString(aPanelNode, "Id"); +if (aPanelId == "PageStylesPanel" || aPanelId == "PageHeaderPanel" +|| aPanelId == "PageFooterPanel") +continue; +} + maPanels.push_back(std::make_shared()); PanelDescriptor& rPanelDescriptor(*maPanels.back()); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: desktop/source include/sfx2 sfx2/source svx/source
desktop/source/lib/init.cxx | 70 ++- include/sfx2/sidebar/AsynchronousCall.hxx|1 include/sfx2/sidebar/SidebarController.hxx |2 include/sfx2/sidebar/SidebarDockingWindow.hxx|5 + sfx2/source/sidebar/AsynchronousCall.cxx |8 ++ sfx2/source/sidebar/SidebarController.cxx|7 + sfx2/source/sidebar/SidebarDockingWindow.cxx |6 + svx/source/sidebar/ContextChangeEventMultiplexer.cxx | 14 +-- 8 files changed, 104 insertions(+), 9 deletions(-) New commits: commit 0778991057fd4592aacc193a5a30a0ee09a8be18 Author: Michael Meeks AuthorDate: Thu Dec 19 11:16:15 2019 + Commit: Michael Meeks CommitDate: Thu Jan 2 12:04:01 2020 +0100 sidebar: bring new sidebar commands in-house & be more assertive with sfx2 Force the sidebar to do it's asynchronous things synchronously to help keep things sane. Also emit our (in-process on Android / iOS) context change notification after everyone else got it & updated their panels. Change-Id: If94de6c83f1b783d7deee515fc2ee9a8d3754765 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86088 Tested-by: Jenkins Reviewed-by: Michael Meeks diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index b80980994c5a..dcbc466ce4b4 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -108,6 +108,8 @@ #include #include #include +#include +#include #include #include #include @@ -142,6 +144,7 @@ #include #include #include +#include #include #include #include @@ -859,6 +862,57 @@ void ExecuteOrientationChange() mxUndoManager->leaveUndoContext(); } +void setupSidebar(bool bShow) +{ +SfxViewShell* pViewShell = SfxViewShell::Current(); +SfxViewFrame* pViewFrame = pViewShell? pViewShell->GetViewFrame(): nullptr; +if (pViewFrame) +{ +if (bShow && !pViewFrame->GetChildWindow(SID_SIDEBAR)) +pViewFrame->SetChildWindow(SID_SIDEBAR, false /* create it */, true /* focus */); + +pViewFrame->ShowChildWindow(SID_SIDEBAR, bShow); + +if (!bShow) +return; + +// Force synchronous population of panels +SfxChildWindow *pChild = pViewFrame->GetChildWindow(SID_SIDEBAR); +if (!pChild) +return; + +auto pDockingWin = dynamic_cast(pChild->GetWindow()); +if (!pDockingWin) +return; +pDockingWin->SyncUpdate(); +} +else +SetLastExceptionMsg("No view shell or sidebar"); +} + +VclPtr getSidebarWindow() +{ +VclPtr xRet; + +setupSidebar(true); +SfxViewShell* pViewShell = SfxViewShell::Current(); +SfxViewFrame* pViewFrame = pViewShell? pViewShell->GetViewFrame(): nullptr; +if (!pViewFrame) +return xRet; + +// really a SidebarChildWindow +SfxChildWindow *pChild = pViewFrame->GetChildWindow(SID_SIDEBAR); +if (!pChild) +return xRet; + +// really a SidebarDockingWindow +vcl::Window *pWin = pChild->GetWindow(); +if (!pWin) +return xRet; +xRet = pWin; +return xRet; +} + } // end anonymous namespace // Could be anonymous in principle, but for the unit testing purposes, we @@ -3454,7 +3508,7 @@ public: virtual void SAL_CALL disposing(const css::lang::EventObject&) override {} }; -} +} // anonymous namespace static void doc_sendDialogEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nWindowId, const char* pArguments) { @@ -3462,6 +3516,10 @@ static void doc_sendDialogEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nWin StringMap aMap(jsonToStringMap(pArguments)); VclPtr pWindow = vcl::Window::FindLOKWindow(nWindowId); + +if (!pWindow && nWindowId >= 10 /* why unsigned? */) +pWindow = getSidebarWindow(); + if (!pWindow) { SetLastExceptionMsg("Document doesn't support dialog rendering, or window not found."); @@ -3672,6 +3730,16 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pComma return; } } +else if (gImpl && aCommand == ".uno:SidebarShow") +{ +setupSidebar(true); +return; +} +else if (gImpl && aCommand == ".uno:SidebarHide") +{ +setupSidebar(false); +return; +} bool bResult = false; LokChartHelper aChartHelper(SfxViewShell::Current()); diff --git a/include/sfx2/sidebar/AsynchronousCall.hxx b/include/sfx2/sidebar/AsynchronousCall.hxx index b05c90dc86db..b2c868b653ec 100644 --- a/include/sfx2/sidebar/AsynchronousCall.hxx +++ b/include/sfx2/sidebar/AsynchronousCall.hxx @@ -40,6 +40,7 @@ public: void RequestCall(); void CancelRequest(); +void Sync(); private: Action const maAction; diff --git a/include/sfx2/sidebar/SidebarController.hxx b/include/sfx2/sidebar/SidebarController.hxx index e65bceb78b6f..abc122faa709 100644 ---
[Libreoffice-commits] core.git: desktop/source include/sfx2 sfx2/source
desktop/source/lib/init.cxx| 14 +- include/sfx2/lokhelper.hxx |4 sfx2/source/view/lokhelper.cxx | 26 ++ 3 files changed, 31 insertions(+), 13 deletions(-) New commits: commit f779609a9be63d70b895ba6f0d769e91b5321a2e Author: Michael Meeks AuthorDate: Tue Jul 16 16:14:16 2019 +0100 Commit: Michael Meeks CommitDate: Wed Oct 2 16:53:43 2019 +0200 Ensure that 'input' events are processed asynchronously too. Change-Id: I715eadd444e428148cfff8a61436987517004fae Reviewed-on: https://gerrit.libreoffice.org/79882 Tested-by: Jenkins Reviewed-by: Michael Meeks diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 3b8e7eb128c7..6a43d56c0296 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3044,19 +3044,7 @@ static void doc_postWindowExtTextInputEvent(LibreOfficeKitDocument* pThis, unsig return; } -switch (nType) -{ -case LOK_EXT_TEXTINPUT: -pWindow->PostExtTextInputEvent(VclEventId::ExtTextInput, - OUString::fromUtf8(OString(pText, strlen(pText; -break; -case LOK_EXT_TEXTINPUT_END: -pWindow->PostExtTextInputEvent(VclEventId::EndExtTextInput, - OUString::fromUtf8(OString(pText, strlen(pText; -break; -default: -assert(false && "Unhandled External Text input event!"); -} +SfxLokHelper::postExtTextEventAsync(pWindow, nType, OUString::fromUtf8(OString(pText, strlen(pText; } static void doc_removeTextContext(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, int nCharBefore, int nCharAfter) diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx index 1e6a0caad205..760b2ed5dfc6 100644 --- a/include/sfx2/lokhelper.hxx +++ b/include/sfx2/lokhelper.hxx @@ -65,6 +65,10 @@ public: static void postKeyEventAsync(const VclPtr , int nType, int nCharCode, int nKeyCode, int nRepeat = 0); +/// Helper for posting input event +static void postExtTextEventAsync(const VclPtr , + int nType, const OUString ); + /// Helper for posting async mouse event static void postMouseEventAsync(const VclPtr , int nType, const Point , diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index f9c559093861..b7a4b238f18b 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -301,6 +301,7 @@ namespace VclEventId mnEvent; MouseEvent maMouseEvent; KeyEvent maKeyEvent; +OUString maText; }; void LOKPostAsyncEvent(void* pEv, void*) @@ -356,6 +357,10 @@ namespace case VclEventId::WindowMouseMove: pLOKEv->mpWindow->LogicMouseMove(pLOKEv->maMouseEvent); break; +case VclEventId::ExtTextInput: +case VclEventId::EndExtTextInput: +pLOKEv->mpWindow->PostExtTextInputEvent(pLOKEv->mnEvent, pLOKEv->maText); +break; default: assert(false); break; @@ -405,6 +410,27 @@ void SfxLokHelper::postKeyEventAsync(const VclPtr , postEventAsync(pLOKEv); } +void SfxLokHelper::postExtTextEventAsync(const VclPtr , + int nType, const OUString ) +{ +LOKAsyncEventData* pLOKEv = new LOKAsyncEventData; +switch (nType) +{ +case LOK_EXT_TEXTINPUT: +pLOKEv->mnEvent = VclEventId::ExtTextInput; +pLOKEv->maText = rText; +break; +case LOK_EXT_TEXTINPUT_END: +pLOKEv->mnEvent = VclEventId::EndExtTextInput; +pLOKEv->maText = ""; +break; +default: +assert(false); +} +pLOKEv->mpWindow = xWindow; +postEventAsync(pLOKEv); +} + void SfxLokHelper::postMouseEventAsync(const VclPtr , int nType, const Point , int nCount, MouseEventModifiers aModifiers, ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: desktop/source include/sfx2 sfx2/source svx/source
desktop/source/app/app.cxx |5 - include/sfx2/safemode.hxx| 24 +++- sfx2/source/safemode/safemode.cxx| 35 ++- svx/source/dialog/SafeModeDialog.cxx |1 + 4 files changed, 58 insertions(+), 7 deletions(-) New commits: commit 0fda52cc4a5c78c55f96850faa734ea66891808c Author: Samuel MehrbrodtDate: Mon Dec 12 17:29:28 2016 +0100 SafeMode: Restart goes into safe mode again Looks like the XRestartManager keeps all command line arguments when restarting, so it also keeps --safe-mode. Solution is to add a flag file when restarting from safe mode, to prevent going into safe mode again. Change-Id: I9820d3ccbddf98b0bf6132f254c989f52ea5e808 Reviewed-on: https://gerrit.libreoffice.org/31913 Reviewed-by: Samuel Mehrbrodt Tested-by: Samuel Mehrbrodt diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index eba8bf6..437ff51 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -560,7 +560,10 @@ void Desktop::Init() // Check whether safe mode is enabled CommandLineArgs& rCmdLine = GetCommandLineArgs(); -if (rCmdLine.IsSafeMode() || sfx2::SafeMode::hasFlag()) +// Check if we are restarting from safe mode - in that case we don't want to enter it again +if (sfx2::SafeMode::hasRestartFlag()) +sfx2::SafeMode::removeRestartFlag(); +else if (rCmdLine.IsSafeMode() || sfx2::SafeMode::hasFlag()) Application::EnableSafeMode(); // When we are in SafeMode we need to do changes before the configuration diff --git a/include/sfx2/safemode.hxx b/include/sfx2/safemode.hxx index 03f8590..47034f6 100644 --- a/include/sfx2/safemode.hxx +++ b/include/sfx2/safemode.hxx @@ -40,9 +40,31 @@ public: */ static bool removeFlag(); +/** + * Write a flag to the user profile indicating that we are currently restarting from safe mode - + * that means we don't want to enter safe mode again. + * + * @return Whether the file could be written successfully + */ +static bool putRestartFlag(); + +/** + * Check the existence of the restart flag file. + * + * @return Whether the restart flag file exists + */ +static bool hasRestartFlag(); + +/** + * Remove the restart flag file. + * + * @return Whether the flag file could be removed successfully + */ +static bool removeRestartFlag(); + private: /** Returns the path of the safe mode flag file.*/ -static OUString getFileName(); +static OUString getFilePath(const OUString& sFilename); }; } diff --git a/sfx2/source/safemode/safemode.cxx b/sfx2/source/safemode/safemode.cxx index 3e84f7e..6d8dcf9 100644 --- a/sfx2/source/safemode/safemode.cxx +++ b/sfx2/source/safemode/safemode.cxx @@ -20,7 +20,7 @@ namespace sfx2 { bool SafeMode::putFlag() { -File safeModeFile(getFileName()); +File safeModeFile(getFilePath("safemode")); if (safeModeFile.open(osl_File_OpenFlag_Create) == FileBase::E_None) { safeModeFile.close(); @@ -30,7 +30,7 @@ bool SafeMode::putFlag() } bool SafeMode::hasFlag() { -File safeModeFile(getFileName()); +File safeModeFile(getFilePath("safemode")); if (safeModeFile.open(osl_File_OpenFlag_Read) == FileBase::E_None) { safeModeFile.close(); @@ -40,17 +40,42 @@ bool SafeMode::hasFlag() } bool SafeMode::removeFlag() { -return File::remove(getFileName()) == FileBase::E_None; +return File::remove(getFilePath("safemode")) == FileBase::E_None; } -OUString SafeMode::getFileName() +bool SafeMode::putRestartFlag() +{ +File restartFile(getFilePath("safemode_restart")); +if (restartFile.open(osl_File_OpenFlag_Create) == FileBase::E_None) +{ +restartFile.close(); +return true; +} +return false; +} +bool SafeMode::hasRestartFlag() +{ +File restartFile(getFilePath("safemode_restart")); +if (restartFile.open(osl_File_OpenFlag_Read) == FileBase::E_None) +{ +restartFile.close(); +return true; +} +return false; +} +bool SafeMode::removeRestartFlag() +{ +return File::remove(getFilePath("safemode_restart")) == FileBase::E_None; +} + +OUString SafeMode::getFilePath(const OUString& sFilename) { OUString url("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}/"); rtl::Bootstrap::expandMacros(url); OUString aProfilePath; FileBase::getSystemPathFromFileURL(url, aProfilePath); -FileBase::getAbsoluteFileURL(url, "safemode", aProfilePath); +FileBase::getAbsoluteFileURL(url, sFilename, aProfilePath); return aProfilePath; } diff --git a/svx/source/dialog/SafeModeDialog.cxx b/svx/source/dialog/SafeModeDialog.cxx index ac9c494..b77b83f 100644 --- a/svx/source/dialog/SafeModeDialog.cxx +++