include/sfx2/StylePreviewRenderer.hxx | 2 include/svl/style.hxx | 3 + sfx2/source/dialog/StyleList.cxx | 91 ++++++++++++++++++++-------------- svl/source/items/style.cxx | 5 + sw/inc/docstyle.hxx | 2 sw/inc/view.hxx | 4 + sw/source/core/layout/paintfrm.cxx | 40 +++++++++++--- sw/source/core/text/inftxt.cxx | 26 ++++++--- sw/source/uibase/app/docstyle.cxx | 19 +++++++ sw/source/uibase/docvw/edtwin2.cxx | 8 +- sw/source/uibase/uiview/view0.cxx | 29 ++++++++-- sw/source/uibase/uno/unotxdoc.cxx | 9 +++ 12 files changed, 175 insertions(+), 63 deletions(-)
New commits: commit 68969293c1a15e8d27091e159aeb813c1f94c9a3 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Thu Dec 12 21:09:15 2024 +0000 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Mon Jan 27 11:20:28 2025 +0100 enable spotlight subset in kit mode Use the index of the style within the list of writer's instantiated styles as the indicator number to use, so this is stable regardless of what particular mode the style dialog/panel is using. Unused styles don't get a number indicator, but do have a (stable) color until they are used in the document. For kit, Para/Char style mode renders all styles, not just the subset selected in the style dialog/panel, when Para/Char spotlight is enabled. Change-Id: I513e4a676a7c4f7f542c016afa5a79d158778210 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178481 Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Michael Meeks <michael.me...@collabora.com> (cherry picked from commit e5eec842b0c61c9c91a8f836661d6885c9c236a8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180768 Tested-by: Jenkins diff --git a/include/sfx2/StylePreviewRenderer.hxx b/include/sfx2/StylePreviewRenderer.hxx index 1692182bd113..33ed26c793e7 100644 --- a/include/sfx2/StylePreviewRenderer.hxx +++ b/include/sfx2/StylePreviewRenderer.hxx @@ -52,6 +52,8 @@ public: } // end namespace sfx2 +SFX2_DLLPUBLIC Color ColorHash(std::u16string_view rString); + #endif // INCLUDED_SVX_STYLEPREVIEWRENDERER_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svl/style.hxx b/include/svl/style.hxx index 1a1d589fd684..0073d5b93ee9 100644 --- a/include/svl/style.hxx +++ b/include/svl/style.hxx @@ -172,6 +172,9 @@ public: virtual sal_uInt32 GetHelpId( OUString& rFile ); virtual void SetHelpId( const OUString& r, sal_uInt32 nId ); + // Spotlight Id, @return -1 for style not in use + virtual sal_Int32 GetSpotlightId(); + virtual SfxItemSet& GetItemSet(); /// Due to writer's usual lack of sanity this is a separate function for /// preview only; it shall not create the style in case it does not exist. diff --git a/sfx2/source/dialog/StyleList.cxx b/sfx2/source/dialog/StyleList.cxx index b63059e14ee9..1fd863181d02 100644 --- a/sfx2/source/dialog/StyleList.cxx +++ b/sfx2/source/dialog/StyleList.cxx @@ -34,6 +34,7 @@ #include <svl/intitem.hxx> #include <svl/style.hxx> #include <svl/itemset.hxx> +#include <comphelper/lok.hxx> #include <comphelper/processfactory.hxx> #include <officecfg/Office/Common.hxx> @@ -95,8 +96,6 @@ public: } }; -namespace -{ Color ColorHash(std::u16string_view rString) { static constexpr auto aSaturationArray = std::to_array<sal_uInt16>({ 90, 75, 60 }); @@ -129,6 +128,8 @@ Color ColorHash(std::u16string_view rString) return aColor; } +namespace +{ // used to disallow the default character style in the styles highlighter character styles color map std::optional<OUString> sDefaultCharStyleUIName; } @@ -630,20 +631,23 @@ class StyleTree_Impl private: OUString aName; OUString aParent; + sal_Int32 nSpotlightId; StyleTreeArr_Impl pChildren; public: bool HasParent() const { return !aParent.isEmpty(); } - StyleTree_Impl(OUString _aName, OUString _aParent) + StyleTree_Impl(OUString _aName, OUString _aParent, sal_Int32 _nSpotlightId) : aName(std::move(_aName)) , aParent(std::move(_aParent)) + , nSpotlightId(_nSpotlightId) , pChildren(0) { } const OUString& getName() const { return aName; } const OUString& getParent() const { return aParent; } + sal_Int32 getSpotlightId() const { return nSpotlightId; } StyleTreeArr_Impl& getChildren() { return pChildren; } }; } @@ -707,25 +711,30 @@ static bool IsExpanded_Impl(const std::vector<OUString>& rEntries, std::u16strin return false; } -static void lcl_Update(weld::TreeView& rTreeView, weld::TreeIter& rIter, const OUString& rName, - SfxStyleFamily eFam, SfxViewShell* pViewSh) +static void lcl_Update(weld::TreeView& rTreeView, weld::TreeIter& rIter, + const StyleTree_Impl& rEntry, SfxStyleFamily eFam, SfxViewShell* pViewSh) { + const OUString& rName = rEntry.getName(); + Color aColor = ColorHash(rName); - int nColor; - if (eFam == SfxStyleFamily::Para) + // For kit keep the id used for spotlight/number-image for a style stable + // regardless of the selection mode of the style panel, so multiple views + // on a document all share the same id for a style. + sal_Int32 nSpotlightId; + if (comphelper::LibreOfficeKit::isActive()) + nSpotlightId = rEntry.getSpotlightId(); + else { - StylesHighlighterColorMap& rParaStylesColorMap - = pViewSh->GetStylesHighlighterParaColorMap(); - nColor = rParaStylesColorMap.size(); - rParaStylesColorMap[rName] = std::pair(aColor, nColor); + StylesHighlighterColorMap& rColorMap = (eFam == SfxStyleFamily::Para) + ? pViewSh->GetStylesHighlighterParaColorMap() + : pViewSh->GetStylesHighlighterCharColorMap(); + nSpotlightId = rColorMap.size(); + rColorMap[rName] = std::pair(aColor, nSpotlightId); } - else + + if (eFam == SfxStyleFamily::Char) { - StylesHighlighterColorMap& rCharStylesColorMap - = pViewSh->GetStylesHighlighterCharColorMap(); - nColor = rCharStylesColorMap.size(); - rCharStylesColorMap[rName] = std::pair(aColor, nColor); // don't show a color or number for default character style 'No Character Style' entry if (rName == sDefaultCharStyleUIName.value() /*"No Character Style"*/) { @@ -743,9 +752,13 @@ static void lcl_Update(weld::TreeView& rTreeView, weld::TreeIter& rIter, const O xDevice->SetFillColor(aColor); const tools::Rectangle aRect(Point(0, 0), aImageSize); xDevice->DrawRect(aRect); - xDevice->SetTextColor(COL_BLACK); - xDevice->DrawText(aRect, OUString::number(nColor), - DrawTextFlags::Center | DrawTextFlags::VCenter); + // In kit mode, unused styles are -1, so we can just skip the number image for those + if (nSpotlightId != -1) + { + xDevice->SetTextColor(COL_BLACK); + xDevice->DrawText(aRect, OUString::number(nSpotlightId), + DrawTextFlags::Center | DrawTextFlags::VCenter); + } rTreeView.set_id(rIter, rName); rTreeView.set_text(rIter, rName); @@ -770,7 +783,7 @@ static void FillBox_Impl(weld::TreeView& rBox, StyleTreeArr_Impl& rTreeArray, if (pStyleSheetPool) pStyle = pStyleSheetPool->Find(rChildName, eStyleFamily); if (pStyle && pStyle->IsUsed()) - lcl_Update(rBox, rIter, rChildName, eStyleFamily, + lcl_Update(rBox, rIter, *pChildEntry, eStyleFamily, pViewShell); else { @@ -1075,7 +1088,8 @@ void StyleList::FillTreeBox(SfxStyleFamily eFam) ; else { - StyleTree_Impl* pNew = new StyleTree_Impl(pStyle->GetName(), pStyle->GetParent()); + StyleTree_Impl* pNew = new StyleTree_Impl(pStyle->GetName(), pStyle->GetParent(), + pStyle->GetSpotlightId()); aArr.emplace_back(pNew); } pStyle = m_pStyleSheetPool->Next(); @@ -1255,7 +1269,7 @@ void StyleList::UpdateStyles(StyleFlags nFlags) SfxStyleSheetBase* pStyle = m_pStyleSheetPool->First(eFam, nFilter); std::unique_ptr<weld::TreeIter> xEntry = m_xFmtLb->make_iterator(); - std::vector<OUString> aStrings; + std::vector<StyleTree_Impl> aStyles; comphelper::string::NaturalStringSorter aSorter( ::comphelper::getProcessComponentContext(), @@ -1263,7 +1277,7 @@ void StyleList::UpdateStyles(StyleFlags nFlags) while (pStyle) { - aStrings.push_back(pStyle->GetName()); + aStyles.emplace_back(pStyle->GetName(), pStyle->GetParent(), pStyle->GetSpotlightId()); pStyle = m_pStyleSheetPool->Next(); } OUString aUIName = getDefaultStyleName(eFam); @@ -1272,9 +1286,14 @@ void StyleList::UpdateStyles(StyleFlags nFlags) // sorting twice is faster than sorting once. // The first sort has a cheap comparator, and gets the list into mostly-sorted order. // Then the second sort needs to call its (much more expensive) comparator less often. - std::sort(aStrings.begin(), aStrings.end()); - std::sort(aStrings.begin(), aStrings.end(), - [&aSorter, &aUIName](const OUString& rLHS, const OUString& rRHS) { + std::sort(aStyles.begin(), aStyles.end(), + [](const StyleTree_Impl& rLHS, const StyleTree_Impl& rRHS) { + return rLHS.getName() < rRHS.getName(); + }); + std::sort(aStyles.begin(), aStyles.end(), + [&aSorter, &aUIName](const StyleTree_Impl& rLHSS, const StyleTree_Impl& rRHSS) { + const OUString& rLHS = rLHSS.getName(); + const OUString& rRHS = rRHSS.getName(); if (rRHS == aUIName) return false; if (rLHS == aUIName) @@ -1303,7 +1322,7 @@ void StyleList::UpdateStyles(StyleFlags nFlags) pHighlighterColorMap->clear(); } - size_t nCount = aStrings.size(); + size_t nCount = aStyles.size(); if (pViewShell && m_bModuleHasStylesHighlighterFeature && ((eFam == SfxStyleFamily::Para && m_bHighlightParaStyles) @@ -1311,14 +1330,15 @@ void StyleList::UpdateStyles(StyleFlags nFlags) { m_xFmtLb->bulk_insert_for_each( nCount, - [this, &aStrings, eFam, pViewShell](weld::TreeIter& rIter, int nIdx) { - auto pChildStyle = m_pStyleSheetPool->Find(aStrings[nIdx], eFam); + [this, &aStyles, eFam, pViewShell](weld::TreeIter& rIter, int nIdx) { + const OUString& rName = aStyles[nIdx].getName(); + auto pChildStyle = m_pStyleSheetPool->Find(rName, eFam); if (pChildStyle && pChildStyle->IsUsed()) - lcl_Update(*m_xFmtLb, rIter, aStrings[nIdx], eFam, pViewShell); + lcl_Update(*m_xFmtLb, rIter, aStyles[nIdx], eFam, pViewShell); else { - m_xFmtLb->set_id(rIter, aStrings[nIdx]); - m_xFmtLb->set_text(rIter, aStrings[nIdx]); + m_xFmtLb->set_id(rIter, rName); + m_xFmtLb->set_text(rIter, rName); } }, nullptr, nullptr, /*bGoingToSetText*/ true); @@ -1326,9 +1346,10 @@ void StyleList::UpdateStyles(StyleFlags nFlags) else { m_xFmtLb->bulk_insert_for_each(nCount, - [this, &aStrings](weld::TreeIter& rIter, int nIdx) { - m_xFmtLb->set_id(rIter, aStrings[nIdx]); - m_xFmtLb->set_text(rIter, aStrings[nIdx]); + [this, &aStyles](weld::TreeIter& rIter, int nIdx) { + const OUString& rName = aStyles[nIdx].getName(); + m_xFmtLb->set_id(rIter, rName); + m_xFmtLb->set_text(rIter, rName); }, nullptr, nullptr, /*bGoingToSetText*/ true); } diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx index 54b9e227ebce..a5144962632e 100644 --- a/svl/source/items/style.cxx +++ b/svl/source/items/style.cxx @@ -284,6 +284,11 @@ void SfxStyleSheetBase::SetHelpId( const OUString& rFile, sal_uInt32 nId ) nHelpId = nId; } +sal_Int32 SfxStyleSheetBase::GetSpotlightId() +{ + return -1; +} + /** * Next style possible? * Default: Yes diff --git a/sw/inc/docstyle.hxx b/sw/inc/docstyle.hxx index e45c599d2a0b..f5a7a70a350f 100644 --- a/sw/inc/docstyle.hxx +++ b/sw/inc/docstyle.hxx @@ -113,6 +113,8 @@ public: virtual sal_uInt32 GetHelpId( OUString& rFile ) override; virtual void SetHelpId( const OUString& r, sal_uInt32 nId ) override; + virtual sal_Int32 GetSpotlightId() override; + /** Preset the members without physical access. Used by StyleSheetPool. */ void PresetName(const OUString& rName) { aName = rName; } diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx index 220c97af2627..47e6bc6bf8a4 100644 --- a/sw/inc/view.hxx +++ b/sw/inc/view.hxx @@ -729,7 +729,9 @@ public: virtual void flushPendingLOKInvalidateTiles() override; virtual std::optional<OString> getLOKPayload(int nType, int nViewId) const override; - bool IsHighlightCharDF() { return m_bIsHighlightCharDF; } + bool IsHighlightCharDF() const { return m_bIsHighlightCharDF; } + bool IsSpotlightParaStyles() const { return m_bIsSpotlightParaStyles; } + bool IsSpotlightCharStyles() const { return m_bIsSpotlightCharStyles; } private: AutoTimer m_aBringToAttentionBlinkTimer; diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 39d43341148e..a0b91c84300a 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -23,6 +23,7 @@ #include <sfx2/docfile.hxx> #include <sfx2/printer.hxx> #include <sfx2/progress.hxx> +#include <sfx2/StylePreviewRenderer.hxx> #include <editeng/brushitem.hxx> #include <editeng/prntitem.hxx> #include <editeng/boxitem.hxx> @@ -4538,19 +4539,43 @@ void SwTextFrame::PaintParagraphStylesHighlighting() const if (!pWrtSh) return; + if (!pWrtSh->GetView().IsSpotlightParaStyles()) + return; + vcl::RenderContext* pRenderContext = pWrtSh->GetOut(); if (!pRenderContext) return; - StylesHighlighterColorMap& rParaStylesColorMap - = pWrtSh->GetView().GetStylesHighlighterParaColorMap(); + const SwTextFormatColl* pColl = GetTextNodeFirst()->GetTextColl(); + OUString sStyleName = pColl->GetName(); - if (rParaStylesColorMap.empty()) - return; + Color nStyleColor; + int nStyleNumber(-1); + + bool bSpotlightStyle; + if (comphelper::LibreOfficeKit::isActive()) + { + // For simplicity in kit mode, we render in the document "all styles" + bSpotlightStyle = true; + // Do this so these are stable across views regardless of an individual + // user's selection mode in the style panel. + nStyleNumber = pWrtSh->GetDoc()->GetTextFormatColls()->GetPos(pColl); + nStyleColor = ColorHash(sStyleName); + } + else + { + StylesHighlighterColorMap& rParaStylesColorMap + = pWrtSh->GetView().GetStylesHighlighterParaColorMap(); + bSpotlightStyle = rParaStylesColorMap.contains(sStyleName); + if (bSpotlightStyle) + { + nStyleNumber = rParaStylesColorMap[sStyleName].second; + nStyleColor = rParaStylesColorMap[sStyleName].first; + } + } // draw styles highlighter - OUString sStyleName = GetTextNodeFirst()->GetTextColl()->GetName(); - if (rParaStylesColorMap.contains(sStyleName)) + if (bSpotlightStyle) { SwRect aFrameAreaRect(getFrameArea()); @@ -4578,9 +4603,6 @@ void SwTextFrame::PaintParagraphStylesHighlighting() const pRenderContext->Push(vcl::PushFlags::ALL); - Color nStyleColor = rParaStylesColorMap[sStyleName].first; - int nStyleNumber = rParaStylesColorMap[sStyleName].second; - pRenderContext->SetFillColor(nStyleColor); pRenderContext->SetLineColor(nStyleColor); diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index ddb68fd8ef4e..8e6d121e4000 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -27,6 +27,7 @@ #include <svl/ctloptions.hxx> #include <sfx2/infobar.hxx> #include <sfx2/printer.hxx> +#include <sfx2/StylePreviewRenderer.hxx> #include <sal/log.hxx> #include <editeng/hyphenzoneitem.hxx> #include <editeng/hngpnctitem.hxx> @@ -1338,9 +1339,7 @@ void SwTextPaintInfo::DrawCSDFHighlighting(const SwLinePortion &rPor) const if (!pView) return; - StylesHighlighterColorMap& rCharStylesColorMap = pView->GetStylesHighlighterCharColorMap(); - - if (rCharStylesColorMap.empty() && !pView->IsHighlightCharDF()) + if (!pView->IsSpotlightCharStyles() && !pView->IsHighlightCharDF()) return; SwRect aRect; @@ -1367,18 +1366,29 @@ void SwTextPaintInfo::DrawCSDFHighlighting(const SwLinePortion &rPor) const // check for CS formatting, if not CS formatted check for direct character formatting if (!sCurrentCharStyle.isEmpty()) { - if (!rCharStylesColorMap.empty()) + OUString sCharStyleDisplayName = SwStyleNameMapper::GetUIName(ProgName(sCurrentCharStyle), + SwGetPoolIdFromName::ChrFmt); + if (comphelper::LibreOfficeKit::isActive()) + { + // For simplicity in kit mode, we render in the document "all styles" that exist + if (const SwCharFormat* pCharFormat = pFrame->GetDoc().FindCharFormatByName(sCharStyleDisplayName)) + { + // Do this so these are stable across views regardless of an individual + // user's selection mode in the style panel. + sCSNumberOrDF = OUString::number(pFrame->GetDoc().GetCharFormats()->GetPos(pCharFormat)); + aFillColor = ColorHash(sCharStyleDisplayName); + } + } + else { - OUString sCharStyleDisplayName; - sCharStyleDisplayName = SwStyleNameMapper::GetUIName(ProgName(sCurrentCharStyle), - SwGetPoolIdFromName::ChrFmt); if (!sCharStyleDisplayName.isEmpty()) { + StylesHighlighterColorMap& rCharStylesColorMap = pView->GetStylesHighlighterCharColorMap(); auto it = rCharStylesColorMap.find(sCharStyleDisplayName); if (it != rCharStylesColorMap.end()) { - aFillColor = it->second.first; sCSNumberOrDF = OUString::number(it->second.second); + aFillColor = it->second.first; } } } diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index aa10329710d3..59b2d111b0db 100644 --- a/sw/source/uibase/app/docstyle.cxx +++ b/sw/source/uibase/app/docstyle.cxx @@ -2621,6 +2621,25 @@ void SwDocStyleSheet::SetHelpId( const OUString& r, sal_uInt32 nId ) } } +sal_Int32 SwDocStyleSheet::GetSpotlightId() +{ + if (nFamily == SfxStyleFamily::Para) + { + SwTextFormatColl* pColl = m_pColl ? + m_pColl : m_rDoc.FindTextFormatCollByName(aName); + return pColl ? m_rDoc.GetTextFormatColls()->GetPos(pColl) : -1; + } + + if (nFamily == SfxStyleFamily::Char) + { + SwCharFormat* pCharFormat = m_pCharFormat + ? m_pCharFormat : m_rDoc.FindCharFormatByName(aName); + return pCharFormat ? m_rDoc.GetCharFormats()->GetPos(pCharFormat) : -1; + } + + return SfxStyleSheetBase::GetSpotlightId(); +} + // methods for DocStyleSheetPool SwDocStyleSheetPool::SwDocStyleSheetPool( SwDoc& rDocument, bool bOrg ) : SfxStyleSheetBasePool(rDocument.GetAttrPool()) diff --git a/sw/source/uibase/docvw/edtwin2.cxx b/sw/source/uibase/docvw/edtwin2.cxx index 81901328b62f..0ac0fc0344b7 100644 --- a/sw/source/uibase/docvw/edtwin2.cxx +++ b/sw/source/uibase/docvw/edtwin2.cxx @@ -103,8 +103,8 @@ bool PSCSDFPropsQuickHelp(const HelpEvent &rEvt, SwWrtShell& rSh) OUString sText; SwView& rView = rSh.GetView(); - if (rView.IsHighlightCharDF() || rView.GetStylesHighlighterParaColorMap().size() - || rView.GetStylesHighlighterCharColorMap().size()) + if (rView.IsHighlightCharDF() || rView.IsSpotlightParaStyles() + || rView.IsSpotlightCharStyles()) { SwPosition aPos(rSh.GetDoc()->GetNodes()); Point aPt(rSh.GetWin()->PixelToLogic( @@ -139,7 +139,7 @@ bool PSCSDFPropsQuickHelp(const HelpEvent &rEvt, SwWrtShell& rSh) if (bContainsPt) { - if (rView.GetStylesHighlighterCharColorMap().size()) + if (rView.IsSpotlightCharStyles()) { // check if in CS formatting highlighted area OUString sCharStyle; @@ -197,7 +197,7 @@ bool PSCSDFPropsQuickHelp(const HelpEvent &rEvt, SwWrtShell& rSh) } } } - else if (rView.GetStylesHighlighterParaColorMap().size()) + else if (rView.IsSpotlightParaStyles()) { // check if in paragraph style formatting highlighted area pContentFrame = aPos.GetContentNode()->GetTextNode()->getLayoutFrame( diff --git a/sw/source/uibase/uiview/view0.cxx b/sw/source/uibase/uiview/view0.cxx index 95dfe297fdce..dab7f898fe51 100644 --- a/sw/source/uibase/uiview/view0.cxx +++ b/sw/source/uibase/uiview/view0.cxx @@ -29,6 +29,7 @@ #include <viewopt.hxx> #include <globals.h> #include <sfx2/infobar.hxx> +#include <sfx2/lokhelper.hxx> #include <sfx2/request.hxx> #include <svl/whiter.hxx> #include <svx/srchdlg.hxx> @@ -37,9 +38,11 @@ #include <sfx2/dispatch.hxx> #include <sfx2/sidebar/SidebarChildWindow.hxx> #include <uivwimp.hxx> +#include <unotxdoc.hxx> #include <avmedia/mediaplayer.hxx> #include <swmodule.hxx> #include <com/sun/star/linguistic2/XLinguProperties.hpp> +#include <comphelper/servicehelper.hxx> #include <osl/diagnose.h> #include <sfx2/objface.hxx> @@ -570,10 +573,13 @@ void SwView::ExecViewOptions(SfxRequest &rReq) break; case SID_SPOTLIGHT_PARASTYLES: - if (!pArgs || (pArgs && !pArgs->HasItem(FN_PARAM_1))) + if (!comphelper::LibreOfficeKit::isActive()) { - const SfxStringItem sDeckName(SID_SIDEBAR_DECK, u"StyleListDeck"_ustr); - GetDispatcher().ExecuteList(SID_SIDEBAR_DECK, SfxCallMode::SYNCHRON, { &sDeckName }); + if (!pArgs || !pArgs->HasItem(FN_PARAM_1)) + { + const SfxStringItem sDeckName(SID_SIDEBAR_DECK, u"StyleListDeck"_ustr); + GetDispatcher().ExecuteList(SID_SIDEBAR_DECK, SfxCallMode::SYNCHRON, { &sDeckName }); + } } if (STATE_TOGGLE == eState) bFlag = !m_bIsSpotlightParaStyles; @@ -581,10 +587,13 @@ void SwView::ExecViewOptions(SfxRequest &rReq) break; case SID_SPOTLIGHT_CHARSTYLES: - if (!pArgs || (pArgs && !pArgs->HasItem(FN_PARAM_1))) + if (!comphelper::LibreOfficeKit::isActive()) { - const SfxStringItem sDeckName(SID_SIDEBAR_DECK, u"StyleListDeck"_ustr); - GetDispatcher().ExecuteList(SID_SIDEBAR_DECK, SfxCallMode::SYNCHRON, { &sDeckName }); + if (!pArgs || !pArgs->HasItem(FN_PARAM_1)) + { + const SfxStringItem sDeckName(SID_SIDEBAR_DECK, u"StyleListDeck"_ustr); + GetDispatcher().ExecuteList(SID_SIDEBAR_DECK, SfxCallMode::SYNCHRON, { &sDeckName }); + } } if (STATE_TOGGLE == eState) bFlag = !m_bIsSpotlightCharStyles; @@ -755,6 +764,14 @@ void SwView::ExecViewOptions(SfxRequest &rReq) pModule->ApplyUsrPref( *pOpt, this, bWebView ? SvViewOpt::DestWeb : SvViewOpt::DestText ); + if (nSlot == SID_SPOTLIGHT_CHARSTYLES || nSlot == SID_SPOTLIGHT_PARASTYLES) + { + SwXTextDocument* pModel = comphelper::getFromUnoTunnel<SwXTextDocument>(GetCurrentDocument()); + SfxLokHelper::notifyViewRenderState(this, pModel); + if (vcl::Window *pMyWin = rSh.GetWin()) + pMyWin->Invalidate(); + } + // #i6193# let postits know about new spellcheck setting if ( nSlot == SID_AUTOSPELL_CHECK ) GetPostItMgr()->SetSpellChecking(); diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 000564fbbc76..865c789be815 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3647,6 +3647,15 @@ OString SwXTextDocument::getViewRenderState(SfxViewShell* pViewShell) if (pVOpt->GetDocColor() == svtools::ColorConfig::GetDefaultColor(svtools::DOCCOLOR, 1)) aState.append('D'); + if (pView->IsSpotlightParaStyles() || pView->IsSpotlightCharStyles()) + { + aState.append('H'); + if (pView->IsSpotlightParaStyles()) + aState.append('P'); + if (pView->IsSpotlightCharStyles()) + aState.append('C'); + } + aState.append(';'); OString aThemeName = OUStringToOString(pVOpt->GetThemeName(), RTL_TEXTENCODING_UTF8);