include/sfx2/sidebar/Deck.hxx | 2 include/sfx2/sidebar/Panel.hxx | 5 include/svx/sidebar/LinePropertyPanelBase.hxx | 1 sfx2/source/sidebar/Deck.cxx | 70 ++++++++-- sfx2/source/sidebar/DeckLayouter.cxx | 147 +++++++++++++--------- sfx2/source/sidebar/Panel.cxx | 18 ++ sfx2/source/sidebar/SidebarController.cxx | 8 + svx/source/sidebar/line/LinePropertyPanel.cxx | 4 svx/source/sidebar/line/LinePropertyPanelBase.cxx | 6 vcl/source/window/paint.cxx | 10 + vcl/source/window/window2.cxx | 5 11 files changed, 195 insertions(+), 81 deletions(-)
New commits: commit dbdf32b8ae97e9f75e34dc8969b7b8c02b21516c Author: Michael Meeks <michael.me...@collabora.com> AuthorDate: Fri Jan 10 18:03:49 2020 +0000 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Sat May 9 15:36:53 2020 +0100 lok: jsdialog creation for sidebar panels cleanup. Use UNO panel names as ids on new Panel nodes. This avoids problems with over-writing child details, items like sd::PanelLayout don't have an empty parent to overwrite, but have an immediate valueset node. Change-Id: I00bab7f0d6a4fb247e0509bce7548b2da164bd23 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86573 Tested-by: Jenkins Reviewed-by: Michael Meeks <michael.me...@collabora.com> diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx index 512f47a30393..08cd76d991cc 100644 --- a/sfx2/source/sidebar/Deck.cxx +++ b/sfx2/source/sidebar/Deck.cxx @@ -234,7 +234,7 @@ boost::property_tree::ptree Deck::DumpAsPropertyTree() aTree.put("text", GetText()); aTree.put("enabled", IsEnabled()); - boost::property_tree::ptree aChildren; + boost::property_tree::ptree aPanelNodes; for (auto &it : maPanels) { if (it->IsLurking()) @@ -248,13 +248,20 @@ boost::property_tree::ptree Deck::DumpAsPropertyTree() if (!pWindow) continue; - boost::property_tree::ptree aChild = pWindow->DumpAsPropertyTree(); - aChild.put("text", it->GetText()); - aChild.put("type", "panel"); - aChildren.push_back(std::make_pair("", aChild)); + boost::property_tree::ptree aPanel; + aPanel.put("id", it->GetId()); + aPanel.put("type", "panel"); + aPanel.put("text", it->GetText()); + aPanel.put("enabled", it->IsEnabled()); + + boost::property_tree::ptree aChildren; + aChildren.push_back(std::make_pair("", pWindow->DumpAsPropertyTree())); + aPanel.add_child("children", aChildren); + + aPanelNodes.push_back(std::make_pair("", aPanel)); } + aTree.add_child("children", aPanelNodes); - aTree.add_child("children", aChildren); return aTree; } commit 62541d01a8afc4ad0ef22ddbbd163f4d1a091015 Author: Samuel Mehrbrodt <samuel.mehrbr...@cib.de> AuthorDate: Wed Mar 25 14:08:14 2020 +0100 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Sat May 9 15:35:50 2020 +0100 tdf#131280 Fix endless invalidation loop on documents with form controls Restores a condition which was removed in 8de98e61fbc96bf523b3dec7e1e52eb7e2d7693e Change-Id: I68a9f8a362d2ded9975e7c73e2a0533aa5ad9e94 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91053 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@cib.de> diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index e71a26e5eec1..4b0c7e8f571d 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -1335,8 +1335,8 @@ void Window::queue_resize(StateChangedType eReason) if (VclPtr<vcl::Window> pParent = GetParentWithLOKNotifier()) { Size aSize = GetSizePixel(); - if (aSize.getWidth() > 0 && aSize.getHeight() > 0 && - !pParent->IsInInitShow()) + if (aSize.getWidth() > 0 && aSize.getHeight() > 0 && GetParentDialog() + && !pParent->IsInInitShow()) LogicInvalidate(nullptr); } } commit 450bc27970692e88cc6a1a460ccd540134baf369 Author: Michael Meeks <michael.me...@collabora.com> AuthorDate: Fri Jan 10 12:29:48 2020 +0000 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Sat May 9 15:35:26 2020 +0100 lok: avoid emission storms of un-necessary invalidations. Common when constructing widgets with VclBuilder - which avoids the 'Show' detection Pranav introduced in 8de98e61fbc. This saves ~80% of the ~100k mostly bogus calls I get to: desktop::CallbackFlushHandler::processWindowEvent when opening and closing a few windows. Change-Id: Ie508d6e19274472b85543275aee33f078ddcbbb2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86534 Tested-by: Jenkins Reviewed-by: Michael Meeks <michael.me...@collabora.com> diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx index 99c6ed983a09..9f110e600a31 100644 --- a/vcl/source/window/paint.cxx +++ b/vcl/source/window/paint.cxx @@ -1220,6 +1220,10 @@ void Window::PixelInvalidate(const tools::Rectangle* pRectangle) if (comphelper::LibreOfficeKit::isDialogPainting() || !comphelper::LibreOfficeKit::isActive()) return; + Size aSize = GetSizePixel(); + if (aSize.getWidth() <= 0 || aSize.getHeight() <= 0) + return; + if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier()) { // In case we are routing the window, notify the client @@ -1228,7 +1232,7 @@ void Window::PixelInvalidate(const tools::Rectangle* pRectangle) aPayload.emplace_back("rectangle", pRectangle->toString()); else { - const tools::Rectangle aRect(Point(0, 0), GetSizePixel()); + const tools::Rectangle aRect(Point(0, 0), aSize); aPayload.emplace_back("rectangle", aRect.toString()); } diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index 9183ded20184..e71a26e5eec1 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -1332,10 +1332,11 @@ void Window::queue_resize(StateChangedType eReason) if (pBorderWindow) pBorderWindow->Resize(); } - if (VclPtr<vcl::Window> pParent = GetParentWithLOKNotifier()) { - if (GetParentDialog() && !pParent->IsInInitShow()) + Size aSize = GetSizePixel(); + if (aSize.getWidth() > 0 && aSize.getHeight() > 0 && + !pParent->IsInInitShow()) LogicInvalidate(nullptr); } } commit c687228fdd173728fb517eba7d5dedbbffc2550b Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> AuthorDate: Thu Oct 31 07:26:34 2019 -0400 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Sat May 9 15:29:08 2020 +0100 sidebar: check for valid current deck before closing Also, cleanup unused/unnecessary LOKNotifier logic from Deck.cxx and use emplace_back where possible. Change-Id: I300c5158b12593e8130f5b6273c1ea3bcbefea7f Reviewed-on: https://gerrit.libreoffice.org/82402 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx index dbbe8dd2c9d7..512f47a30393 100644 --- a/sfx2/source/sidebar/Deck.cxx +++ b/sfx2/source/sidebar/Deck.cxx @@ -118,9 +118,6 @@ Deck::~Deck() void Deck::dispose() { - if (comphelper::LibreOfficeKit::isActive()) - ReleaseLOKNotifier(); - SharedPanelContainer aPanels; aPanels.swap(maPanels); @@ -397,15 +394,6 @@ void Deck::ShowPanel(const Panel& rPanel) Point( mpScrollContainer->GetPosPixel().X(), -nNewThumbPos)); - - if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier()) - { - std::vector<vcl::LOKPayloadItem> aItems; - aItems.emplace_back("type", "deck"); - aItems.emplace_back(std::make_pair("position", Point(GetOutOffXPixel(), GetOutOffYPixel()).toString())); - aItems.emplace_back(std::make_pair("size", GetSizePixel().toString())); - pNotifier->notifyWindow(GetLOKWindowId(), "created", aItems); - } } static OUString GetWindowClassification(const vcl::Window* pWindow) diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index ec4659f28e4c..a7ea09953d84 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -1222,6 +1222,13 @@ IMPL_LINK(SidebarController, OnMenuItemSelected, Menu*, pMenu, bool) void SidebarController::RequestCloseDeck() { + if (comphelper::LibreOfficeKit::isActive() && mpCurrentDeck.get()) + { + const vcl::ILibreOfficeKitNotifier* pNotifier = mpCurrentDeck->GetLOKNotifier(); + if (pNotifier) + pNotifier->notifyWindow(mpCurrentDeck->GetLOKWindowId(), "close"); + } + mbIsDeckRequestedOpen = false; UpdateDeckOpenState(); diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx index a99ae752de45..99c6ed983a09 100644 --- a/vcl/source/window/paint.cxx +++ b/vcl/source/window/paint.cxx @@ -1225,11 +1225,11 @@ void Window::PixelInvalidate(const tools::Rectangle* pRectangle) // In case we are routing the window, notify the client std::vector<vcl::LOKPayloadItem> aPayload; if (pRectangle) - aPayload.push_back(std::make_pair(OString("rectangle"), pRectangle->toString())); + aPayload.emplace_back("rectangle", pRectangle->toString()); else { const tools::Rectangle aRect(Point(0, 0), GetSizePixel()); - aPayload.push_back(std::make_pair(OString("rectangle"), aRect.toString())); + aPayload.emplace_back("rectangle", aRect.toString()); } pNotifier->notifyWindow(GetLOKWindowId(), "invalidate", aPayload); commit 3afe0a988fcf94515fb0f0ebd3e8bcab7889573e Author: Michael Meeks <michael.me...@collabora.com> AuthorDate: Thu Jan 9 16:43:11 2020 +0000 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Sat May 9 15:24:32 2020 +0100 lok: simplify jsdialog creation for sidebar panels. Remove some layers of nested and/or un-necessary content, also simplifies client-side JS. Change-Id: I67347035ceb9dbee9c62c99624b5084883d4e61a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86499 Tested-by: Jenkins Reviewed-by: Michael Meeks <michael.me...@collabora.com> diff --git a/include/sfx2/sidebar/Deck.hxx b/include/sfx2/sidebar/Deck.hxx index 278bb4f49a01..dba93a7fd34b 100644 --- a/include/sfx2/sidebar/Deck.hxx +++ b/include/sfx2/sidebar/Deck.hxx @@ -67,6 +67,8 @@ public: virtual bool EventNotify(NotifyEvent& rEvent) override; virtual void Resize() override; + virtual boost::property_tree::ptree DumpAsPropertyTree() override; + static void PrintWindowSubTree (vcl::Window* pRoot, int nIndentation); sal_Int32 GetMinimalWidth() const { return mnMinimalWidth; } diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx index 1ce636f714f3..dbbe8dd2c9d7 100644 --- a/sfx2/source/sidebar/Deck.cxx +++ b/sfx2/source/sidebar/Deck.cxx @@ -36,7 +36,9 @@ #include <vcl/scrbar.hxx> #include <vcl/commandevent.hxx> #include <vcl/IDialogRenderable.hxx> +#include <toolkit/helper/vclunohelper.hxx> #include <tools/svborder.hxx> +#include <boost/property_tree/ptree.hpp> #include <sal/log.hxx> #include <boost/property_tree/json_parser.hpp> #include <LibreOfficeKit/LibreOfficeKitEnums.h> @@ -223,6 +225,42 @@ void Deck::Resize() } } +/* + * Get the ordering as is shown in the layout, and our type as 'deck' + * also elide nested panel windows. + */ +boost::property_tree::ptree Deck::DumpAsPropertyTree() +{ + boost::property_tree::ptree aTree; + aTree.put("id", get_id()); // TODO could be missing - sort out + aTree.put("type", "deck"); + aTree.put("text", GetText()); + aTree.put("enabled", IsEnabled()); + + boost::property_tree::ptree aChildren; + for (auto &it : maPanels) + { + if (it->IsLurking()) + continue; + + // collapse the panel itself out + auto xContent = it->GetElementWindow(); + if (!xContent.is()) + continue; + VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xContent); + if (!pWindow) + continue; + + boost::property_tree::ptree aChild = pWindow->DumpAsPropertyTree(); + aChild.put("text", it->GetText()); + aChild.put("type", "panel"); + aChildren.push_back(std::make_pair("", aChild)); + } + + aTree.add_child("children", aChildren); + return aTree; +} + bool Deck::ProcessWheelEvent(CommandEvent const * pCommandEvent) { if ( ! mpVerticalScrollBar) commit 2e7df9bad8beefb7d901e74132892b2f59a4b4fc Author: Michael Meeks <michael.me...@collabora.com> AuthorDate: Sat Jan 4 22:37:31 2020 +0000 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Sat May 9 15:24:06 2020 +0100 sidebar: improve invalidation tracking for Panels. Only emit an invalidation on panels that change position. Ensure we invalidate the ScrollContainerWindow for updated separators. Emit a single vcl::Region for an invalidation rather than per panel. Change-Id: I5452791ac9a7d1a9b8604c7704d24641160c275b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86234 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Michael Meeks <michael.me...@collabora.com> diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx index d61862085dd2..1ce636f714f3 100644 --- a/sfx2/source/sidebar/Deck.cxx +++ b/sfx2/source/sidebar/Deck.cxx @@ -436,6 +436,7 @@ void Deck::ScrollContainerWindow::Paint(vcl::RenderContext& rRenderContext, cons void Deck::ScrollContainerWindow::SetSeparators (const ::std::vector<sal_Int32>& rSeparators) { maSeparators = rSeparators; + Invalidate(); } } } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/DeckLayouter.cxx b/sfx2/source/sidebar/DeckLayouter.cxx index 3f8627a17f79..652268567753 100644 --- a/sfx2/source/sidebar/DeckLayouter.cxx +++ b/sfx2/source/sidebar/DeckLayouter.cxx @@ -85,6 +85,8 @@ namespace { const sal_Int32 nHeightToDistribute, const sal_Int32 nContainerHeight, const bool bMinimumHeightIsBase); + bool MoveResizePixel(const VclPtr<vcl::Window> &pWindow, + const Point &rNewPos, const Size &rNewSize); sal_Int32 PlacePanels ( ::std::vector<LayoutItem>& rLayoutItems, const sal_Int32 nWidth, @@ -253,6 +255,17 @@ tools::Rectangle LayoutPanels ( return aBox; } +bool MoveResizePixel(const VclPtr<vcl::Window> &pWindow, + const Point &rNewPos, const Size &rNewSize) +{ + Point aCurPos = pWindow->GetPosPixel(); + Size aCurSize = pWindow->GetSizePixel(); + if (rNewPos == aCurPos && aCurSize == rNewSize) + return false; + pWindow->setPosSizePixel(rNewPos.X(), rNewPos.Y(), rNewSize.Width(), rNewSize.Height()); + return true; +} + sal_Int32 PlacePanels ( ::std::vector<LayoutItem>& rLayoutItems, const sal_Int32 nWidth, @@ -263,6 +276,8 @@ sal_Int32 PlacePanels ( const sal_Int32 nDeckSeparatorHeight (Theme::GetInteger(Theme::Int_DeckSeparatorHeight)); sal_Int32 nY (0); + vcl::Region aInvalidRegions; + // Assign heights and places. for(::std::vector<LayoutItem>::const_iterator iItem(rLayoutItems.begin()), iEnd(rLayoutItems.end()); @@ -275,8 +290,11 @@ sal_Int32 PlacePanels ( Panel& rPanel (*iItem->mpPanel); // Separator above the panel title bar. - aSeparators.push_back(nY); - nY += nDeckSeparatorHeight; + if (!rPanel.IsLurking()) + { + aSeparators.push_back(nY); + nY += nDeckSeparatorHeight; + } // Place the title bar. VclPtr<PanelTitleBar> pTitleBar = rPanel.GetTitleBar(); @@ -320,8 +338,15 @@ sal_Int32 PlacePanels ( } // Place the panel. - rPanel.setPosSizePixel(0, nY, nWidth, nPanelHeight); - rPanel.Invalidate(); + Point aNewPos(0, nY); + Size aNewSize(nWidth, nPanelHeight); + + // Only invalidate if we moved + if (MoveResizePixel(&rPanel, aNewPos, aNewSize)) + { + tools::Rectangle aRect(aNewPos, aNewSize); + aInvalidRegions.Union(rPanel.PixelToLogic(aRect)); + } nY += nPanelHeight; } @@ -345,6 +370,8 @@ sal_Int32 PlacePanels ( if (pScrollContainerWindow != nullptr) pScrollContainerWindow->SetSeparators(aSeparators); + rScrollContainer.Invalidate(aInvalidRegions); + return nY; } commit 0ab36729f72870e721862ae9880da5798ace43df Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Jan 7 10:07:27 2020 +0000 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Sat May 9 15:23:51 2020 +0100 arrow in sidebar not getting reenabled on changing context possibly since... commit 5b77d17c4f1ca734babf962b45c1aa07bdca14e9 Date: Sat Jan 4 18:09:20 2020 +0000 sidebar: allow panels to lurk around instead of being disposed. Change-Id: I4d3085a1bd0ceb5f04dba3e49c801df05b795061 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86332 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/include/svx/sidebar/LinePropertyPanelBase.hxx b/include/svx/sidebar/LinePropertyPanelBase.hxx index d12ddbdc7b53..e94513781fb6 100644 --- a/include/svx/sidebar/LinePropertyPanelBase.hxx +++ b/include/svx/sidebar/LinePropertyPanelBase.hxx @@ -105,6 +105,7 @@ protected: void setMapUnit(MapUnit eMapUnit); + void enableArrowHead(); void disableArrowHead(); protected: diff --git a/svx/source/sidebar/line/LinePropertyPanel.cxx b/svx/source/sidebar/line/LinePropertyPanel.cxx index d8dd5fb17498..344d8a02961b 100644 --- a/svx/source/sidebar/line/LinePropertyPanel.cxx +++ b/svx/source/sidebar/line/LinePropertyPanel.cxx @@ -193,8 +193,10 @@ void LinePropertyPanel::HandleContextChange( break; } - if(!bShowArrows) + if (!bShowArrows) disableArrowHead(); + else + enableArrowHead(); } void LinePropertyPanel::setLineStyle(const XLineStyleItem& rItem) diff --git a/svx/source/sidebar/line/LinePropertyPanelBase.cxx b/svx/source/sidebar/line/LinePropertyPanelBase.cxx index 890203b82802..ae583af16f4b 100644 --- a/svx/source/sidebar/line/LinePropertyPanelBase.cxx +++ b/svx/source/sidebar/line/LinePropertyPanelBase.cxx @@ -909,6 +909,12 @@ void LinePropertyPanelBase::disableArrowHead() ActivateControls(); } +void LinePropertyPanelBase::enableArrowHead() +{ + mbArrowSupported = true; + ActivateControls(); +} + }} // end of namespace svx::sidebar /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit eacf91a095774af73526385de3ddcb94a396d480 Author: Michael Meeks <michael.me...@collabora.com> AuthorDate: Sat Jan 4 18:09:20 2020 +0000 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Sat May 9 15:23:37 2020 +0100 sidebar: allow panels to lurk around instead of being disposed. Creating and destroying sidebar panels is done remarkably often - on changes of context eg. The process is remarkably expensive - loading UI XML files, processing them etc. and is un-necessary. Instead let panels lurk around for future use - particularly in the Properties deck which gets the most thrash. This gives a big speedup particularly noticable on mobile where it could take several seconds to load switch between panels for eg. shape vs. slide properties when tapping to edit text. Change-Id: I497e77432c11bbd1e35a8a8716519cabc3730e61 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86233 Tested-by: Michael Meeks <michael.me...@collabora.com> Reviewed-by: Michael Meeks <michael.me...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86287 Tested-by: Jenkins diff --git a/include/sfx2/sidebar/Panel.hxx b/include/sfx2/sidebar/Panel.hxx index 823ed6e90a3a..2c0e9bd764c2 100644 --- a/include/sfx2/sidebar/Panel.hxx +++ b/include/sfx2/sidebar/Panel.hxx @@ -58,6 +58,10 @@ public: const OUString& GetId() const { return msPanelId;} void TriggerDeckLayouting() { maDeckLayoutTrigger(); } + /// Set whether a panel should be present but invisible / inactive + void SetLurkMode(bool bLurk); + bool IsLurking() const { return mbLurking; } + virtual void Resize() override; virtual void DataChanged (const DataChangedEvent& rEvent) override; virtual void ApplySettings(vcl::RenderContext& rRenderContext) override; @@ -70,6 +74,7 @@ private: css::uno::Reference<css::ui::XUIElement> mxElement; css::uno::Reference<css::ui::XSidebarPanel> mxPanelComponent; bool mbIsExpanded; + bool mbLurking; const std::function<void()> maDeckLayoutTrigger; const std::function<Context()> maContextAccess; diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx index a2e9024433f6..d61862085dd2 100644 --- a/sfx2/source/sidebar/Deck.cxx +++ b/sfx2/source/sidebar/Deck.cxx @@ -252,17 +252,25 @@ bool Deck::ProcessWheelEvent(CommandEvent const * pCommandEvent) */ void Deck::ResetPanels(const SharedPanelContainer& rPanelContainer) { - // First dispose old panels we no longer need. + SharedPanelContainer aHiddens; + + // First hide old panels we don't need just now. for (VclPtr<Panel> & rpPanel : maPanels) { bool bFound = false; for (const auto & i : rPanelContainer) bFound = bFound || (rpPanel.get() == i.get()); if (!bFound) // this one didn't survive. - rpPanel.disposeAndClear(); + { + rpPanel->SetLurkMode(true); + aHiddens.push_back(rpPanel); + } } maPanels = rPanelContainer; + // Hidden ones always at the end + maPanels.insert(std::end(maPanels), std::begin(aHiddens), std::end(aHiddens)); + RequestLayoutInternal(); } diff --git a/sfx2/source/sidebar/DeckLayouter.cxx b/sfx2/source/sidebar/DeckLayouter.cxx index b969dc91a8bb..3f8627a17f79 100644 --- a/sfx2/source/sidebar/DeckLayouter.cxx +++ b/sfx2/source/sidebar/DeckLayouter.cxx @@ -296,7 +296,7 @@ sal_Int32 PlacePanels ( } } - if (rPanel.IsExpanded()) + if (rPanel.IsExpanded() && !rPanel.IsLurking()) { rPanel.Show(); @@ -360,69 +360,73 @@ void GetRequestedSizes ( for (auto& rItem : rLayoutItems) { - ui::LayoutSize aLayoutSize (ui::LayoutSize(0,0,0)); - if (rItem.mpPanel != nullptr) + rItem.maLayoutSize = ui::LayoutSize(0,0,0); + + if (rItem.mpPanel == nullptr) + continue; + + if (rItem.mpPanel->IsLurking()) + { + rItem.mbShowTitleBar = false; + continue; + } + + if (rLayoutItems.size() == 1 + && rItem.mpPanel->IsTitleBarOptional()) + { + // There is only one panel and its title bar is + // optional => hide it. + rAvailableHeight -= nDeckSeparatorHeight; + rItem.mbShowTitleBar = false; + } + else { - if (rLayoutItems.size() == 1 - && rItem.mpPanel->IsTitleBarOptional()) + // Show the title bar and a separator above and below + // the title bar. + const sal_Int32 nPanelTitleBarHeight (Theme::GetInteger(Theme::Int_PanelTitleBarHeight) * rItem.mpPanel->GetDPIScaleFactor()); + + rAvailableHeight -= nPanelTitleBarHeight; + rAvailableHeight -= nDeckSeparatorHeight; + } + + if (rItem.mpPanel->IsExpanded() && rItem.mpPanel->GetPanelComponent().is()) + { + Reference<ui::XSidebarPanel> xPanel (rItem.mpPanel->GetPanelComponent()); + + rItem.maLayoutSize = xPanel->getHeightForWidth(rContentBox.GetWidth()); + if (!(0 <= rItem.maLayoutSize.Minimum && rItem.maLayoutSize.Minimum <= rItem.maLayoutSize.Preferred + && rItem.maLayoutSize.Preferred <= rItem.maLayoutSize.Maximum)) { - // There is only one panel and its title bar is - // optional => hide it. - rAvailableHeight -= nDeckSeparatorHeight; - rItem.mbShowTitleBar = false; + SAL_WARN("sfx.sidebar", "Please follow LayoutSize constraints: 0 ≤ " + "Minimum ≤ Preferred ≤ Maximum." + " Currently: Minimum: " + << rItem.maLayoutSize.Minimum + << " Preferred: " << rItem.maLayoutSize.Preferred + << " Maximum: " << rItem.maLayoutSize.Maximum); } - else - { - // Show the title bar and a separator above and below - // the title bar. - const sal_Int32 nPanelTitleBarHeight (Theme::GetInteger(Theme::Int_PanelTitleBarHeight) * rItem.mpPanel->GetDPIScaleFactor()); - rAvailableHeight -= nPanelTitleBarHeight; - rAvailableHeight -= nDeckSeparatorHeight; - } + sal_Int32 nWidth = xPanel->getMinimalWidth(); - if (rItem.mpPanel->IsExpanded()) + uno::Reference<frame::XDesktop2> xDesktop + = frame::Desktop::create(comphelper::getProcessComponentContext()); + uno::Reference<frame::XFrame> xFrame = xDesktop->getActiveFrame(); + if (xFrame.is()) { - Reference<ui::XSidebarPanel> xPanel (rItem.mpPanel->GetPanelComponent()); - if (xPanel.is()) + SidebarController* pController + = SidebarController::GetSidebarControllerForFrame(xFrame); + if (pController && pController->getMaximumWidth() < nWidth) { - aLayoutSize = xPanel->getHeightForWidth(rContentBox.GetWidth()); - if (!(0 <= aLayoutSize.Minimum && aLayoutSize.Minimum <= aLayoutSize.Preferred - && aLayoutSize.Preferred <= aLayoutSize.Maximum)) - { - SAL_WARN("sfx.sidebar", "Please follow LayoutSize constraints: 0 ≤ " - "Minimum ≤ Preferred ≤ Maximum." - " Currently: Minimum: " - << aLayoutSize.Minimum - << " Preferred: " << aLayoutSize.Preferred - << " Maximum: " << aLayoutSize.Maximum); - } - - sal_Int32 nWidth = xPanel->getMinimalWidth(); - - uno::Reference<frame::XDesktop2> xDesktop - = frame::Desktop::create(comphelper::getProcessComponentContext()); - uno::Reference<frame::XFrame> xFrame = xDesktop->getActiveFrame(); - if (xFrame.is()) - { - SidebarController* pController - = SidebarController::GetSidebarControllerForFrame(xFrame); - if (pController && pController->getMaximumWidth() < nWidth) - { - // Add 100 extra pixels to still have the sidebar resizable - // (See also documentation of XSidebarPanel::getMinimalWidth) - pController->setMaximumWidth(nWidth + 100); - } - } - - if (nWidth > rMinimalWidth) - rMinimalWidth = nWidth; + // Add 100 extra pixels to still have the sidebar resizable + // (See also documentation of XSidebarPanel::getMinimalWidth) + pController->setMaximumWidth(nWidth + 100); } - else - aLayoutSize = ui::LayoutSize(MinimalPanelHeight, -1, 0); } + + if (nWidth > rMinimalWidth) + rMinimalWidth = nWidth; } - rItem.maLayoutSize = aLayoutSize; + else + rItem.maLayoutSize = ui::LayoutSize(MinimalPanelHeight, -1, 0); } } diff --git a/sfx2/source/sidebar/Panel.cxx b/sfx2/source/sidebar/Panel.cxx index e4b9ef6668ec..12caa0807c1d 100644 --- a/sfx2/source/sidebar/Panel.cxx +++ b/sfx2/source/sidebar/Panel.cxx @@ -61,6 +61,7 @@ Panel::Panel(const PanelDescriptor& rPanelDescriptor, , mxElement() , mxPanelComponent() , mbIsExpanded(bIsInitiallyExpanded) + , mbLurking(false) , maDeckLayoutTrigger(rDeckLayoutTrigger) , maContextAccess(rContextAccess) , mxFrame(rxFrame) @@ -74,6 +75,12 @@ Panel::~Panel() assert(!mpTitleBar); } +void Panel::SetLurkMode(bool bLurk) +{ + // cf. DeckLayouter + mbLurking = bLurk; +} + void Panel::ApplySettings(vcl::RenderContext& rRenderContext) { rRenderContext.SetBackground(Theme::GetPaint(Theme::Paint_PanelBackground).GetWallpaper()); @@ -81,9 +88,14 @@ void Panel::ApplySettings(vcl::RenderContext& rRenderContext) boost::property_tree::ptree Panel::DumpAsPropertyTree() { - boost::property_tree::ptree aTree(vcl::Window::DumpAsPropertyTree()); - aTree.put("type", "panel"); - return aTree; + if (!IsLurking()) + { + boost::property_tree::ptree aTree(vcl::Window::DumpAsPropertyTree()); + aTree.put("type", "panel"); + return aTree; + } + else + return boost::property_tree::ptree(); } void Panel::dispose() diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index 5cd73cc422cf..ec4659f28e4c 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -719,6 +719,7 @@ void SidebarController::CreatePanels(const OUString& rDeckId, const Context& rCo Panel *const pPanel(pDeck->GetPanel(rPanelContexDescriptor.msId)); if (pPanel != nullptr) { + pPanel->SetLurkMode(false); aNewPanels[nWriteIndex] = pPanel; pPanel->SetExpanded( rPanelContexDescriptor.mbIsInitiallyVisible ); ++nWriteIndex; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits