diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-12-12 21:09:15 +0000 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-12-16 12:24:24 +0100 |
commit | e5eec842b0c61c9c91a8f836661d6885c9c236a8 (patch) | |
tree | 1ddd061daff5d084b2aad8f85d0f677de3d291ad | |
parent | 0d16b0e351e455a87292fd7d7e0dc0f626d74b82 (diff) |
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.mcnamara@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
-rw-r--r-- | include/sfx2/StylePreviewRenderer.hxx | 2 | ||||
-rw-r--r-- | include/svl/style.hxx | 3 | ||||
-rw-r--r-- | sfx2/source/dialog/StyleList.cxx | 82 | ||||
-rw-r--r-- | svl/source/items/style.cxx | 5 | ||||
-rw-r--r-- | sw/inc/docstyle.hxx | 2 | ||||
-rw-r--r-- | sw/inc/view.hxx | 4 | ||||
-rw-r--r-- | sw/source/core/layout/paintfrm.cxx | 40 | ||||
-rw-r--r-- | sw/source/core/text/inftxt.cxx | 37 | ||||
-rw-r--r-- | sw/source/uibase/app/docstyle.cxx | 19 | ||||
-rw-r--r-- | sw/source/uibase/docvw/edtwin2.cxx | 8 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view0.cxx | 29 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 9 |
12 files changed, 179 insertions, 61 deletions
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 eeab434dc45b..173acc604f3b 100644 --- a/include/svl/style.hxx +++ b/include/svl/style.hxx @@ -172,6 +172,9 @@ public: virtual sal_uLong GetHelpId( OUString& rFile ); virtual void SetHelpId( const OUString& r, sal_uLong 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 d241adb5127f..b53a4ce188b8 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> @@ -94,8 +95,6 @@ public: } }; -namespace -{ Color ColorHash(std::u16string_view rString) { static std::vector aSaturationArray{ 0.90, 0.75, 0.60 }; @@ -113,6 +112,8 @@ Color ColorHash(std::u16string_view rString) return Color(basegfx::utils::hsl2rgb(aHSLColor)); } +namespace +{ // used to disallow the default character style in the styles highlighter character styles color map std::optional<OUString> sDefaultCharStyleUIName; } @@ -614,20 +615,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; } }; } @@ -691,25 +695,30 @@ static bool IsExpanded_Impl(const std::vector<OUString>& rEntries, std::u16strin return false; } -static void lcl_Insert(weld::TreeView& rTreeView, const OUString& rName, SfxStyleFamily eFam, +static void lcl_Insert(weld::TreeView& rTreeView, const StyleTree_Impl& rEntry, SfxStyleFamily eFam, const weld::TreeIter* pParent, weld::TreeIter* pRet, 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"*/) { @@ -726,9 +735,13 @@ static void lcl_Insert(weld::TreeView& rTreeView, const OUString& rName, SfxStyl 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.insert(pParent, -1, &rName, &rName, nullptr, xDevice.get(), false, pRet); } @@ -738,12 +751,14 @@ static void FillBox_Impl(weld::TreeView& rBox, StyleTree_Impl* pEntry, const weld::TreeIter* pParent, bool blcl_insert, SfxViewShell* pViewShell) { std::unique_ptr<weld::TreeIter> xResult = rBox.make_iterator(); - const OUString& rName = pEntry->getName(); if (blcl_insert) - lcl_Insert(rBox, rName, eStyleFamily, pParent, xResult.get(), pViewShell); + lcl_Insert(rBox, *pEntry, eStyleFamily, pParent, xResult.get(), pViewShell); else + { + const OUString& rName = pEntry->getName(); rBox.insert(pParent, -1, &rName, &rName, nullptr, nullptr, false, xResult.get()); + } for (size_t i = 0; i < pEntry->getChildren().size(); ++i) FillBox_Impl(rBox, pEntry->getChildren()[i].get(), rEntries, eStyleFamily, xResult.get(), @@ -1067,7 +1082,8 @@ void StyleList::FillTreeBox(SfxStyleFamily eFam) while (pStyle) { - 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(); } @@ -1233,7 +1249,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(), @@ -1241,7 +1257,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); @@ -1250,9 +1266,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) @@ -1269,7 +1290,7 @@ void StyleList::UpdateStyles(StyleFlags nFlags) auto xUpdateGuard = std::make_unique<StyleHighlightUpdateGuard>( pViewShell, m_bModuleHasStylesHighlighterFeature, *m_pStyleSheetPool, eFam); - size_t nCount = aStrings.size(); + size_t nCount = aStyles.size(); size_t nPos = 0; if (pViewShell && m_bModuleHasStylesHighlighterFeature @@ -1277,12 +1298,15 @@ void StyleList::UpdateStyles(StyleFlags nFlags) || (eFam == SfxStyleFamily::Char && m_bHighlightCharStyles))) { for (nPos = 0; nPos < nCount; ++nPos) - lcl_Insert(*m_xFmtLb, aStrings[nPos], eFam, nullptr, nullptr, pViewShell); + lcl_Insert(*m_xFmtLb, aStyles[nPos], eFam, nullptr, nullptr, pViewShell); } else { for (nPos = 0; nPos < nCount; ++nPos) - m_xFmtLb->append(aStrings[nPos], aStrings[nPos]); + { + const OUString& rName = aStyles[nPos].getName(); + m_xFmtLb->append(rName, rName); + } } m_xFmtLb->columns_autosize(); diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx index 916b1621b4f0..20b78d110683 100644 --- a/svl/source/items/style.cxx +++ b/svl/source/items/style.cxx @@ -282,6 +282,11 @@ void SfxStyleSheetBase::SetHelpId( const OUString& rFile, sal_uLong 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 b411bfe4b1ce..889a4a474f81 100644 --- a/sw/inc/docstyle.hxx +++ b/sw/inc/docstyle.hxx @@ -114,6 +114,8 @@ public: virtual sal_uLong GetHelpId( OUString& rFile ) override; virtual void SetHelpId( const OUString& r, sal_uLong 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 8c825d2f78da..9779cedd9d94 100644 --- a/sw/inc/view.hxx +++ b/sw/inc/view.hxx @@ -722,7 +722,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 4261ddf3a032..626cd81426fd 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> @@ -4574,19 +4575,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; + + 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.find(sStyleName) != rParaStylesColorMap.end(); + if (bSpotlightStyle) + { + nStyleNumber = rParaStylesColorMap[sStyleName].second; + nStyleColor = rParaStylesColorMap[sStyleName].first; + } + } // draw styles highlighter - OUString sStyleName = GetTextNodeFirst()->GetTextColl()->GetName(); - if (rParaStylesColorMap.find(sStyleName) != rParaStylesColorMap.end()) + if (bSpotlightStyle) { SwRect aFrameAreaRect(getFrameArea()); @@ -4614,9 +4639,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 dbe8eabaf801..9a74eca9589e 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -25,6 +25,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> @@ -1280,9 +1281,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; @@ -1309,17 +1308,31 @@ 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(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(sCurrentCharStyle, - SwGetPoolIdFromName::ChrFmt); - if (!sCharStyleDisplayName.isEmpty() - && rCharStylesColorMap.find(sCharStyleDisplayName) - != rCharStylesColorMap.end()) + StylesHighlighterColorMap& rCharStylesColorMap = pView->GetStylesHighlighterCharColorMap(); + if (!rCharStylesColorMap.empty()) { - aFillColor = rCharStylesColorMap[sCharStyleDisplayName].first; - sCSNumberOrDF = OUString::number(rCharStylesColorMap[sCharStyleDisplayName].second); + if (!sCharStyleDisplayName.isEmpty() + && rCharStylesColorMap.find(sCharStyleDisplayName) + != rCharStylesColorMap.end()) + { + sCSNumberOrDF = OUString::number(rCharStylesColorMap[sCharStyleDisplayName].second); + aFillColor = rCharStylesColorMap[sCharStyleDisplayName].first; + } } } } diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index a715bef70da1..dfcc60857070 100644 --- a/sw/source/uibase/app/docstyle.cxx +++ b/sw/source/uibase/app/docstyle.cxx @@ -2599,6 +2599,25 @@ void SwDocStyleSheet::SetHelpId( const OUString& r, sal_uLong 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 07bf72ff4b99..e8a2c29b4979 100644 --- a/sw/source/uibase/docvw/edtwin2.cxx +++ b/sw/source/uibase/docvw/edtwin2.cxx @@ -102,8 +102,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( @@ -138,7 +138,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; @@ -196,7 +196,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 66d8c66597ae..274ef12c73d2 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> @@ -564,10 +567,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, "StyleListDeck"); - GetDispatcher().ExecuteList(SID_SIDEBAR_DECK, SfxCallMode::SYNCHRON, { &sDeckName }); + if (!pArgs || !pArgs->HasItem(FN_PARAM_1)) + { + const SfxStringItem sDeckName(SID_SIDEBAR_DECK, "StyleListDeck"); + GetDispatcher().ExecuteList(SID_SIDEBAR_DECK, SfxCallMode::SYNCHRON, { &sDeckName }); + } } if (STATE_TOGGLE == eState) bFlag = !m_bIsSpotlightParaStyles; @@ -575,10 +581,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, "StyleListDeck"); - GetDispatcher().ExecuteList(SID_SIDEBAR_DECK, SfxCallMode::SYNCHRON, { &sDeckName }); + if (!pArgs || !pArgs->HasItem(FN_PARAM_1)) + { + const SfxStringItem sDeckName(SID_SIDEBAR_DECK, "StyleListDeck"); + GetDispatcher().ExecuteList(SID_SIDEBAR_DECK, SfxCallMode::SYNCHRON, { &sDeckName }); + } } if (STATE_TOGGLE == eState) bFlag = !m_bIsSpotlightCharStyles; @@ -734,6 +743,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 19045dfd5605..dd817602bd2b 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3463,6 +3463,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); |