diff options
author | Jim Raykowski <raykowj@gmail.com> | 2023-04-15 19:53:05 -0800 |
---|---|---|
committer | Jim Raykowski <raykowj@gmail.com> | 2023-04-25 19:43:33 +0200 |
commit | 4bc86f6477c3ed5f0e97b0a530acf7e102b613b3 (patch) | |
tree | 7fa32d1191383d0f73456daecf6dbfe275f26b8e /sfx2 | |
parent | fb76d7f454522c4e8982b8fe1e75d0eb6f37c12d (diff) |
tdf#38194 tdf#106556 Enhancement to highlight direct formatting,
paragraph style, and character style use in Writer documents
Initial commit to realize direct formatting, paragraph style, and
character style highlighting enhancement requests.
Highlighting of character direct formatting is turned on/off using
.uno:HighlightCharDF. Highlighting of paragraph styles and character
styles is turned on/off using a check box in the Sidebar Styles panel.
Closing the Sidebar also turns paragraph and character style
highlighting off. Paragraph direct formatting is indicated by a hatch
pattern over the paragraph style highlight bar and also by "+ Paragraph
Direct Formatting" appended to the tooltip that appears showing the
name of the paragraph style when the mouse pointer is over the style
highlight bar.
Colors used for styles highlighting are determined by a hash of the
style name. Lightgray is used for character direct formatting.
Known issue:
Tooltip doesn't show for paragraph style highlighting in tables and in
frames where the highlighting bar is drawn outside of the frame.
Change-Id: I6e00ee38c1c169bc7c6542a1782c03b2593e1891
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150451
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/dialog/StyleList.cxx | 204 | ||||
-rw-r--r-- | sfx2/source/dialog/templdlg.cxx | 62 | ||||
-rw-r--r-- | sfx2/source/inc/StyleList.hxx | 15 | ||||
-rw-r--r-- | sfx2/source/inc/templdgi.hxx | 4 | ||||
-rw-r--r-- | sfx2/uiconfig/ui/templatepanel.ui | 196 |
5 files changed, 378 insertions, 103 deletions
diff --git a/sfx2/source/dialog/StyleList.cxx b/sfx2/source/dialog/StyleList.cxx index dd8475052578..ce2d2f9bb7d0 100644 --- a/sfx2/source/dialog/StyleList.cxx +++ b/sfx2/source/dialog/StyleList.cxx @@ -62,6 +62,8 @@ #include <StyleList.hxx> +#include <vcl/virdev.hxx> + using namespace css; using namespace css::beans; using namespace css::frame; @@ -90,6 +92,50 @@ public: } }; +namespace +{ +Color ColorHash(const OUString& rString) +{ + // method 1 + //Color aColor(rString.hashCode() & 0xFFFFFF); + + // method 2 borrowed from https://github.com/RolandR/ColorHash/blob/master/colorhash.js + //sal_Int32 nSum = 0; + + //for (int i = 0; i < rString.getLength(); i++) + //{ + // nSum += rString[i]; + //} + + //sal_uInt8 nRed = OUString("0." + OUString(OUString::number(std::sin(nSum + 1))).copy(6)).toDouble() * 256; + //sal_uInt8 nGreen = OUString("0." + OUString(OUString::number(std::sin(nSum + 2))).copy(6)).toDouble() * 256; + //sal_uInt8 nBlue = OUString("0." + OUString(OUString::number(std::sin(nSum + 3))).copy(6)).toDouble() * 256; + + //Color aColor(nRed, nGreen, nBlue); + + // method 3 std::hash + //const std::hash<OUString> hasher; + //Color aColor(hasher(rString) & 0xFFFFFF); + + // method 4 + sal_uInt32 nLen = rString.getLength(); + sal_uInt32 nHashCode = nLen; + while (nLen > 0) + { + nHashCode = (nHashCode * 107) + rString[nLen - 1]; + nLen--; + } + sal_uInt32 nColor = nHashCode & 0xFFFFFF; + Color aColor(ColorTransparency, nColor); + aColor.ApplyTintOrShade(5000); + + return aColor; +} + +// used to disallow the default character style in the styles highlighter character styles color map +std::optional<OUString> sDefaultCharStyleUIName; +} + // Constructor StyleList::StyleList(weld::Builder* pBuilder, SfxBindings* pBindings, @@ -121,6 +167,11 @@ StyleList::StyleList(weld::Builder* pBuilder, SfxBindings* pBindings, , m_pContainer(pC) { m_xFmtLb->set_help_id(HID_TEMPLATE_FMT); + + uno::Reference<frame::XFrame> xFrame + = m_pBindings->GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface(); + m_bModuleHasStylesHighlighterFeature + = vcl::CommandInfoProvider::GetModuleIdentifier(xFrame) == "com.sun.star.text.TextDocument"; } // Destructor @@ -199,6 +250,8 @@ IMPL_LINK_NOARG(StyleList, ReadResource, void*, size_t) { m_nActFilter = m_pCurObjShell->GetAutoStyleFilterIndex(); } + if (m_bModuleHasStylesHighlighterFeature) + sDefaultCharStyleUIName = getDefaultStyleName(SfxStyleFamily::Char); } size_t nCount = m_xStyleFamilies->size(); m_pBindings->ENTERREGISTRATIONS(); @@ -357,8 +410,8 @@ void StyleList::Initialize() m_xTreeBox->connect_custom_get_size(LINK(this, StyleList, CustomGetSizeHdl)); m_xTreeBox->connect_custom_render(LINK(this, StyleList, CustomRenderHdl)); bool bCustomPreview = officecfg::Office::Common::StylesAndFormatting::Preview::get(); - m_xFmtLb->set_column_custom_renderer(0, bCustomPreview); - m_xTreeBox->set_column_custom_renderer(0, bCustomPreview); + m_xFmtLb->set_column_custom_renderer(1, bCustomPreview); + m_xTreeBox->set_column_custom_renderer(1, bCustomPreview); m_xFmtLb->set_visible(!m_bHierarchical); m_xTreeBox->set_visible(m_bHierarchical); @@ -659,16 +712,63 @@ 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, + const weld::TreeIter* pParent, weld::TreeIter* pRet, SfxViewShell* pViewSh) +{ + Color aColor(ColorHash(rName)); + + int nColor; + if (eFam == SfxStyleFamily::Para) + { + StylesHighlighterColorMap& rParaStylesColorMap + = pViewSh->GetStylesHighlighterParaColorMap(); + nColor = rParaStylesColorMap.size(); + rParaStylesColorMap[rName] = std::pair(aColor, nColor); + } + else + { + 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"*/) + { + rTreeView.insert(pParent, -1, &rName, &rName, nullptr, nullptr, false, pRet); + return; + } + } + + // draw the color rectangle and number image + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + Size aImageSize = rStyleSettings.GetListBoxPreviewDefaultPixelSize(); + ScopedVclPtrInstance<VirtualDevice> xDevice; + xDevice->SetOutputSize(aImageSize); + 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); + + rTreeView.insert(pParent, -1, &rName, &rName, nullptr, xDevice.get(), false, pRet); +} + static void FillBox_Impl(weld::TreeView& rBox, StyleTree_Impl* pEntry, const std::vector<OUString>& rEntries, SfxStyleFamily eStyleFamily, - const weld::TreeIter* pParent) + const weld::TreeIter* pParent, bool blcl_insert, SfxViewShell* pViewShell) { std::unique_ptr<weld::TreeIter> xResult = rBox.make_iterator(); const OUString& rName = pEntry->getName(); - rBox.insert(pParent, -1, &rName, &rName, nullptr, nullptr, false, xResult.get()); + + if (blcl_insert) + lcl_Insert(rBox, rName, eStyleFamily, pParent, xResult.get(), pViewShell); + else + 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()); + FillBox_Impl(rBox, pEntry->getChildren()[i].get(), rEntries, eStyleFamily, xResult.get(), + blcl_insert, pViewShell); } namespace SfxTemplate @@ -788,8 +888,16 @@ IMPL_LINK(StyleList, SetWaterCanState, const SfxBoolItem*, pItem, void) m_pBindings->LeaveRegistrations(); } -void StyleList::FamilySelect(sal_uInt16 nEntry) +void StyleList::FamilySelect(sal_uInt16 nEntry, bool bRefresh) { + if (bRefresh) + { + bool bCustomPreview = officecfg::Office::Common::StylesAndFormatting::Preview::get(); + m_xFmtLb->clear(); + m_xFmtLb->set_column_custom_renderer(1, bCustomPreview); + m_xTreeBox->clear(); + m_xTreeBox->set_column_custom_renderer(1, bCustomPreview); + } m_nActFamily = nEntry; SfxDispatcher* pDispat = m_pBindings->GetDispatcher_Impl(); SfxUInt16Item const aItem(SID_STYLE_FAMILY, @@ -944,18 +1052,40 @@ void StyleList::FillTreeBox(SfxStyleFamily eFam) m_xTreeBox->clear(); const sal_uInt16 nCount = aArr.size(); + SfxViewShell* pViewShell = m_pCurObjShell->GetViewShell(); + if (pViewShell && m_bModuleHasStylesHighlighterFeature) + { + if (eFam == SfxStyleFamily::Para) + pViewShell->GetStylesHighlighterParaColorMap().clear(); + else if (eFam == SfxStyleFamily::Char) + pViewShell->GetStylesHighlighterCharColorMap().clear(); + } + + bool blcl_insert = pViewShell && m_bModuleHasStylesHighlighterFeature + && ((eFam == SfxStyleFamily::Para && m_bHighlightParaStyles) + || (eFam == SfxStyleFamily::Char && m_bHighlightCharStyles)); + for (sal_uInt16 i = 0; i < nCount; ++i) { - FillBox_Impl(*m_xTreeBox, aArr[i].get(), aEntries, eFam, nullptr); + FillBox_Impl(*m_xTreeBox, aArr[i].get(), aEntries, eFam, nullptr, blcl_insert, pViewShell); aArr[i].reset(); } + m_xTreeBox->columns_autosize(); + m_pParentDialog->EnableItem("watercan", false); SfxTemplateItem* pState = m_pFamilyState[m_nActFamily - 1].get(); m_xTreeBox->thaw(); + // hack for x11 to make view update + if (pViewShell && m_bModuleHasStylesHighlighterFeature) + { + SfxViewFrame* pViewFrame = m_pBindings->GetDispatcher_Impl()->GetFrame(); + pViewFrame->Resize(true); + } + std::unique_ptr<weld::TreeIter> xEntry = m_xTreeBox->make_iterator(); bool bEntry = m_xTreeBox->get_iter_first(*xEntry); if (bEntry && nCount) @@ -1084,7 +1214,6 @@ void StyleList::UpdateStyles(StyleFlags nFlags) SfxStyleSheetBase* pStyle = m_pStyleSheetPool->First(eFam, nFilter); std::unique_ptr<weld::TreeIter> xEntry = m_xFmtLb->make_iterator(); - bool bEntry = m_xFmtLb->get_iter_first(*xEntry); std::vector<OUString> aStrings; comphelper::string::NaturalStringSorter aSorter( @@ -1112,25 +1241,46 @@ void StyleList::UpdateStyles(StyleFlags nFlags) return aSorter.compare(rLHS, rRHS) < 0; }); + // Fill the display box + m_xFmtLb->freeze(); + m_xFmtLb->clear(); + + SfxViewShell* pViewShell = m_pCurObjShell->GetViewShell(); + if (pViewShell && m_bModuleHasStylesHighlighterFeature) + { + if (eFam == SfxStyleFamily::Para) + pViewShell->GetStylesHighlighterParaColorMap().clear(); + else if (eFam == SfxStyleFamily::Char) + pViewShell->GetStylesHighlighterCharColorMap().clear(); + } + size_t nCount = aStrings.size(); size_t nPos = 0; - while (nPos < nCount && bEntry && aStrings[nPos] == m_xFmtLb->get_text(*xEntry)) + + if (pViewShell && m_bModuleHasStylesHighlighterFeature + && ((eFam == SfxStyleFamily::Para && m_bHighlightParaStyles) + || (eFam == SfxStyleFamily::Char && m_bHighlightCharStyles))) { - ++nPos; - bEntry = m_xFmtLb->iter_next(*xEntry); + for (nPos = 0; nPos < nCount; ++nPos) + lcl_Insert(*m_xFmtLb, aStrings[nPos], eFam, nullptr, nullptr, pViewShell); } - - if (nPos < nCount || bEntry) + else { - // Fills the display box - m_xFmtLb->freeze(); - m_xFmtLb->clear(); - for (nPos = 0; nPos < nCount; ++nPos) m_xFmtLb->append(aStrings[nPos], aStrings[nPos]); + } + + m_xFmtLb->columns_autosize(); + + m_xFmtLb->thaw(); - m_xFmtLb->thaw(); + // hack for x11 to make view update + if (pViewShell && m_bModuleHasStylesHighlighterFeature) + { + SfxViewFrame* pViewFrame = m_pBindings->GetDispatcher_Impl()->GetFrame(); + pViewFrame->Resize(true); } + // Selects the current style if any SfxTemplateItem* pState = m_pFamilyState[m_nActFamily - 1].get(); OUString aStyle; @@ -1327,6 +1477,15 @@ IMPL_LINK_NOARG(StyleList, EnableDelete, void*, void) IMPL_LINK_NOARG(StyleList, Clear, void*, void) { + if (m_pCurObjShell && m_bModuleHasStylesHighlighterFeature) + { + SfxViewShell* pViewShell = m_pCurObjShell->GetViewShell(); + if (pViewShell) + { + pViewShell->GetStylesHighlighterParaColorMap().clear(); + pViewShell->GetStylesHighlighterCharColorMap().clear(); + } + } m_xStyleFamilies.reset(); for (auto& i : m_pFamilyState) i.reset(); @@ -1508,7 +1667,6 @@ IMPL_LINK(StyleList, QueryTooltipHdl, const weld::TreeIter&, rEntry, OUString) if (!pItem) return sQuickHelpText; SfxStyleSheetBase* pStyle = m_pStyleSheetPool->Find(aTemplName, pItem->GetFamily()); - if (pStyle && pStyle->IsUsed()) // pStyle is in use in the document? { OUString sUsedBy; @@ -1730,14 +1888,6 @@ void StyleList::Update() m_pParentDialog->EnableNew(m_bCanNew, this); } -void StyleList::EnablePreview(bool bCustomPreview) -{ - m_xFmtLb->clear(); - m_xFmtLb->set_column_custom_renderer(0, bCustomPreview); - m_xTreeBox->clear(); - m_xTreeBox->set_column_custom_renderer(0, bCustomPreview); -} - const SfxStyleFamilyItem& StyleList::GetFamilyItemByIndex(size_t i) const { return m_xStyleFamilies->at(i); diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index 9001ee0740e1..6b2c258a6aba 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -134,6 +134,27 @@ namespace SfxTemplate default: return 0xffff; } } + // converts from 1-6 to SFX_STYLE_FAMILY Ids + static SfxStyleFamily NIdToSfxFamilyId(sal_uInt16 nId) + { + switch (nId) + { + case 1: + return SfxStyleFamily::Char; + case 2: + return SfxStyleFamily::Para; + case 3: + return SfxStyleFamily::Frame; + case 4: + return SfxStyleFamily::Page; + case 5: + return SfxStyleFamily::Pseudo; + case 6: + return SfxStyleFamily::Table; + default: + return SfxStyleFamily::All; + } + } } void SfxCommonTemplateDialog_Impl::connect_stylelist_execute_drop( @@ -176,6 +197,7 @@ SfxCommonTemplateDialog_Impl::SfxCommonTemplateDialog_Impl(SfxBindings* pB, weld , m_pDeletionWatcher(nullptr) , m_aStyleList(pBuilder, pB, this, pC, "treeview", "flatview") , mxPreviewCheckbox(pBuilder->weld_check_button("showpreview")) + , mxHighlightCheckbox(pBuilder->weld_check_button("highlightstyles")) , mxFilterLb(pBuilder->weld_combo_box("filter")) , nActFamily(0xffff) , nActFilter(0) @@ -262,7 +284,13 @@ void SfxCommonTemplateDialog_Impl::Initialize() mxFilterLb->connect_changed(LINK(this, SfxCommonTemplateDialog_Impl, FilterSelectHdl)); mxPreviewCheckbox->connect_toggled(LINK(this, SfxCommonTemplateDialog_Impl, PreviewHdl)); + mxHighlightCheckbox->connect_toggled(LINK(this, SfxCommonTemplateDialog_Impl, HighlightHdl)); + m_aStyleList.Initialize(); + + SfxStyleFamily eFam = SfxTemplate::NIdToSfxFamilyId(nActFamily); + mxHighlightCheckbox->set_visible(m_aStyleList.HasStylesHighlighterFeature() + && (eFam == SfxStyleFamily::Para || eFam == SfxStyleFamily::Char)); } IMPL_LINK(SfxCommonTemplateDialog_Impl, UpdateStyles_Hdl, StyleFlags, nFlags, void) @@ -460,6 +488,7 @@ bool SfxCommonTemplateDialog_Impl::Execute_Impl( // Handler Listbox of Filter void SfxCommonTemplateDialog_Impl::EnableHierarchical(bool const bEnable, StyleList& rStyleList) { + OUString aSelectedEntry = rStyleList.GetSelectedEntry(); if (bEnable) { if (!rStyleList.IsHierarchical()) @@ -476,8 +505,9 @@ void SfxCommonTemplateDialog_Impl::EnableHierarchical(bool const bEnable, StyleL // If bHierarchical, then the family can have changed // minus one since hierarchical is inserted at the start m_bWantHierarchical = false; // before FilterSelect - FilterSelect(mxFilterLb->get_active() - 1, rStyleList.IsHierarchical() ); + FilterSelect(mxFilterLb->get_active() - 1, true); } + SelectStyle(aSelectedEntry, false, rStyleList); } // Other filters; can be switched by the users or as a result of new or @@ -517,14 +547,27 @@ IMPL_LINK(SfxCommonTemplateDialog_Impl, FilterSelectHdl, weld::ComboBox&, rBox, } // Select-Handler for the Toolbox -void SfxCommonTemplateDialog_Impl::FamilySelect(sal_uInt16 nEntry, StyleList&, bool bPreviewRefresh) +void SfxCommonTemplateDialog_Impl::FamilySelect(sal_uInt16 nEntry, StyleList&, bool bRefresh) { assert((0 < nEntry && nEntry <= MAX_FAMILIES) || 0xffff == nEntry); - if( nEntry != nActFamily || bPreviewRefresh ) + if( nEntry != nActFamily || bRefresh ) { CheckItem(OUString::number(nActFamily), false); nActFamily = nEntry; - m_aStyleList.FamilySelect(nEntry); + m_aStyleList.FamilySelect(nEntry, bRefresh); + + SfxStyleFamily eFam = SfxTemplate::NIdToSfxFamilyId(nActFamily); + mxHighlightCheckbox->set_visible(m_aStyleList.HasStylesHighlighterFeature() + && (eFam == SfxStyleFamily::Para || eFam == SfxStyleFamily::Char)); + if (mxHighlightCheckbox->is_visible()) + { + bool bActive = false; + if (eFam == SfxStyleFamily::Para) + bActive = m_aStyleList.IsHighlightParaStyles(); + else if (eFam == SfxStyleFamily::Char) + bActive = m_aStyleList.IsHighlightCharStyles(); + mxHighlightCheckbox->set_active(bActive); + } } } @@ -632,8 +675,17 @@ IMPL_LINK_NOARG(SfxCommonTemplateDialog_Impl, PreviewHdl, weld::Toggleable&, voi officecfg::Office::Common::StylesAndFormatting::Preview::set(bCustomPreview, batch ); batch->commit(); - m_aStyleList.EnablePreview(bCustomPreview); + FamilySelect(nActFamily, m_aStyleList, true); +} +IMPL_LINK_NOARG(SfxCommonTemplateDialog_Impl, HighlightHdl, weld::Toggleable&, void) +{ + bool bActive = mxHighlightCheckbox->get_active(); + SfxStyleFamily eFam = SfxTemplate::NIdToSfxFamilyId(nActFamily); + if (eFam == SfxStyleFamily::Para) + m_aStyleList.SetHighlightParaStyles(bActive); + else if (eFam == SfxStyleFamily::Char) + m_aStyleList.SetHighlightCharStyles(bActive); FamilySelect(nActFamily, m_aStyleList, true); } diff --git a/sfx2/source/inc/StyleList.hxx b/sfx2/source/inc/StyleList.hxx index 5eba936c6cb5..fe4ff6269bd5 100644 --- a/sfx2/source/inc/StyleList.hxx +++ b/sfx2/source/inc/StyleList.hxx @@ -113,8 +113,7 @@ public: void Enableshow(bool canshow) { m_bCanShow = canshow; } void Enablenew(bool cannew) { m_bCanNew = cannew; } void Enableedit(bool canedit) { m_bCanEdit = canedit; } - // Handles the enabling/Disabling of Preview - void EnablePreview(bool bCustomPreview); + // Used in Dialog's Execute_Impl // It is a necessary condition to execute a style bool EnableExecute(); @@ -126,11 +125,17 @@ public: void connect_SaveSelection(const Link<StyleList&, SfxObjectShell*> rLink); void connect_UpdateFamily(const Link<StyleList&, void> rLink) { m_aUpdateFamily = rLink; } - void FamilySelect(sal_uInt16 nEntry); + void FamilySelect(sal_uInt16 nEntry, bool bRefresh = false); void FilterSelect(sal_uInt16 nActFilter, bool bsetFilter); DECL_LINK(NewMenuExecuteAction, void*, void); + bool HasStylesHighlighterFeature() { return m_bModuleHasStylesHighlighterFeature; } + void SetHighlightParaStyles(bool bSet) { m_bHighlightParaStyles = bSet; } + bool IsHighlightParaStyles() { return m_bHighlightParaStyles; } + void SetHighlightCharStyles(bool bSet) { m_bHighlightCharStyles = bSet; } + bool IsHighlightCharStyles() { return m_bHighlightCharStyles; } + private: void FillTreeBox(SfxStyleFamily eFam); @@ -236,4 +241,8 @@ private: SfxModule* m_Module; sal_uInt16 m_nModifier; weld::Container* m_pContainer; + + bool m_bModuleHasStylesHighlighterFeature = false; + bool m_bHighlightParaStyles = false; + bool m_bHighlightCharStyles = false; }; diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx index 322747b5636e..a352b1e9b8e4 100644 --- a/sfx2/source/inc/templdgi.hxx +++ b/sfx2/source/inc/templdgi.hxx @@ -69,6 +69,7 @@ protected: StyleList m_aStyleList; std::unique_ptr<weld::CheckButton> mxPreviewCheckbox; + std::unique_ptr<weld::CheckButton> mxHighlightCheckbox; std::unique_ptr<weld::ComboBox> mxFilterLb; sal_uInt16 nActFamily; // Id in the ToolBox = Position - 1 @@ -97,6 +98,7 @@ protected: DECL_LINK(FilterSelectHdl, weld::ComboBox&, void ); DECL_LINK(PreviewHdl, weld::Toggleable&, void); + DECL_LINK(HighlightHdl, weld::Toggleable&, void); virtual void InsertFamilyItem(sal_uInt16 nId, const SfxStyleFamilyItem& rItem) = 0; virtual void EnableFamilyItem(sal_uInt16 nId, bool bEnabled) = 0; @@ -138,7 +140,7 @@ public: // Used in StyleList::UpdateStyles, StyleList::Update // Whenever a new family(Eg. Character, List etc.) is selected it comes into action - void FamilySelect(sal_uInt16 nId, StyleList& rStyleList, bool bPreviewRefresh = false); + void FamilySelect(sal_uInt16 nId, StyleList& rStyleList, bool bRefresh = false); // Constructor SfxCommonTemplateDialog_Impl(SfxBindings* pB, weld::Container*, weld::Builder* pBuilder); diff --git a/sfx2/uiconfig/ui/templatepanel.ui b/sfx2/uiconfig/ui/templatepanel.ui index f4e8d98b2b43..633e9d0ded37 100644 --- a/sfx2/uiconfig/ui/templatepanel.ui +++ b/sfx2/uiconfig/ui/templatepanel.ui @@ -1,9 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.36.0 --> +<!-- Generated with glade 3.40.0 --> <interface domain="sfx"> <requires lib="gtk+" version="3.20"/> <object class="GtkTreeStore" id="liststore1"> <columns> + <!-- column-name image --> + <column type="CairoSurface"/> <!-- column-name text --> <column type="gchararray"/> <!-- column-name id --> @@ -12,6 +14,8 @@ </object> <object class="GtkTreeStore" id="liststore2"> <columns> + <!-- column-name image --> + <column type="CairoSurface"/> <!-- column-name text --> <column type="gchararray"/> <!-- column-name id --> @@ -21,32 +25,33 @@ <!-- n-columns=1 n-rows=1 --> <object class="GtkGrid" id="TemplatePanel"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="hexpand">True</property> <property name="vexpand">True</property> <child> <object class="GtkBox" id="box1"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="hexpand">True</property> <property name="vexpand">True</property> - <property name="border_width">6</property> + <property name="border-width">6</property> <property name="orientation">vertical</property> <property name="spacing">3</property> <child> <object class="GtkBox"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <child> <object class="GtkToolbar" id="left"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="toolbar_style">text</property> - <property name="show_arrow">False</property> + <property name="can-focus">True</property> + <property name="toolbar-style">text</property> + <property name="show-arrow">False</property> <property name="icon_size">2</property> <child> <object class="GtkToggleToolButton" id="2"> - <property name="use_underline">True</property> + <property name="can-focus">False</property> + <property name="use-underline">True</property> </object> <packing> <property name="expand">False</property> @@ -55,7 +60,8 @@ </child> <child> <object class="GtkToggleToolButton" id="1"> - <property name="use_underline">True</property> + <property name="can-focus">False</property> + <property name="use-underline">True</property> </object> <packing> <property name="expand">False</property> @@ -64,7 +70,8 @@ </child> <child> <object class="GtkToggleToolButton" id="3"> - <property name="use_underline">True</property> + <property name="can-focus">False</property> + <property name="use-underline">True</property> </object> <packing> <property name="expand">False</property> @@ -73,7 +80,8 @@ </child> <child> <object class="GtkToggleToolButton" id="4"> - <property name="use_underline">True</property> + <property name="can-focus">False</property> + <property name="use-underline">True</property> </object> <packing> <property name="expand">False</property> @@ -82,7 +90,8 @@ </child> <child> <object class="GtkToggleToolButton" id="5"> - <property name="use_underline">True</property> + <property name="can-focus">False</property> + <property name="use-underline">True</property> </object> <packing> <property name="expand">False</property> @@ -91,7 +100,8 @@ </child> <child> <object class="GtkToggleToolButton" id="6"> - <property name="use_underline">True</property> + <property name="can-focus">False</property> + <property name="use-underline">True</property> </object> <packing> <property name="expand">False</property> @@ -100,7 +110,8 @@ </child> <child> <object class="GtkToggleToolButton" id="65535"> - <property name="use_underline">True</property> + <property name="can-focus">False</property> + <property name="use-underline">True</property> </object> <packing> <property name="expand">False</property> @@ -110,23 +121,24 @@ </object> <packing> <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> + <property name="fill">False</property> + <property name="position">1</property> </packing> </child> <child> <object class="GtkToolbar" id="right"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="toolbar_style">icons</property> - <property name="show_arrow">False</property> + <property name="can-focus">True</property> + <property name="toolbar-style">icons</property> + <property name="show-arrow">False</property> <property name="icon_size">2</property> <child> <object class="GtkToggleToolButton" id="watercan"> <property name="visible">True</property> - <property name="tooltip_text" translatable="yes" context="templatepanel|STR_STYLE_FILL_FORMAT_MODE">Fill Format Mode</property> - <property name="use_underline">True</property> - <property name="icon_name">res/sc05554.png</property> + <property name="can-focus">False</property> + <property name="tooltip-text" translatable="yes" context="templatepanel|STR_STYLE_FILL_FORMAT_MODE">Fill Format Mode</property> + <property name="use-underline">True</property> + <property name="icon-name">res/sc05554.png</property> </object> <packing> <property name="expand">False</property> @@ -136,9 +148,10 @@ <child> <object class="GtkToolButton" id="new"> <property name="visible">True</property> - <property name="tooltip_text" translatable="yes" context="templatepanel|STR_STYLE_NEW_STYLE_FROM_SELECTION">New Style from Selection</property> - <property name="use_underline">True</property> - <property name="icon_name">res/sc05555.png</property> + <property name="can-focus">False</property> + <property name="tooltip-text" translatable="yes" context="templatepanel|STR_STYLE_NEW_STYLE_FROM_SELECTION">New Style from Selection</property> + <property name="use-underline">True</property> + <property name="icon-name">res/sc05555.png</property> </object> <packing> <property name="expand">False</property> @@ -147,10 +160,11 @@ </child> <child> <object class="GtkMenuToolButton" id="newmenu"> - <property name="no_show_all">True</property> - <property name="tooltip_text" translatable="yes" context="templatepanel|STR_STYLE_NEW_STYLE_ACTION">Styles actions</property> - <property name="use_underline">True</property> - <property name="icon_name">res/sc05555.png</property> + <property name="can-focus">False</property> + <property name="no-show-all">True</property> + <property name="tooltip-text" translatable="yes" context="templatepanel|STR_STYLE_NEW_STYLE_ACTION">Styles actions</property> + <property name="use-underline">True</property> + <property name="icon-name">res/sc05555.png</property> </object> <packing> <property name="expand">False</property> @@ -160,9 +174,10 @@ <child> <object class="GtkToolButton" id="update"> <property name="visible">True</property> - <property name="tooltip_text" translatable="yes" context="templatepanel|STR_STYLE_UPDATE_STYLE">Update Style</property> - <property name="use_underline">True</property> - <property name="icon_name">res/sc05556.png</property> + <property name="can-focus">False</property> + <property name="tooltip-text" translatable="yes" context="templatepanel|STR_STYLE_UPDATE_STYLE">Update Style</property> + <property name="use-underline">True</property> + <property name="icon-name">res/sc05556.png</property> </object> <packing> <property name="expand">False</property> @@ -173,8 +188,8 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="pack_type">end</property> - <property name="position">1</property> + <property name="pack-type">end</property> + <property name="position">2</property> </packing> </child> </object> @@ -186,31 +201,42 @@ </child> <child> <object class="GtkScrolledWindow"> - <property name="can_focus">True</property> + <property name="can-focus">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> - <property name="shadow_type">in</property> + <property name="shadow-type">in</property> <child> <object class="GtkTreeView" id="flatview"> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="no_show_all">True</property> - <property name="has_tooltip">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> + <property name="no-show-all">True</property> + <property name="has-tooltip">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> <property name="model">liststore1</property> - <property name="headers_visible">False</property> - <property name="search_column">0</property> - <property name="show_expanders">False</property> + <property name="headers-visible">False</property> + <property name="search-column">0</property> + <property name="show-expanders">False</property> <child internal-child="selection"> <object class="GtkTreeSelection" id="Macro Library List-selection2"/> </child> <child> + <object class="GtkTreeViewColumn" id="treeviewcolumn0"> + <child> + <object class="GtkCellRendererPixbuf" id="cellrendererpixbuf1"/> + <attributes> + <attribute name="surface">0</attribute> + </attributes> + </child> + </object> + </child> + <child> <object class="GtkTreeViewColumn" id="treeviewcolumn1"> + <property name="resizable">True</property> <child> <object class="GtkCellRendererText" id="cellrenderertext1"/> <attributes> - <attribute name="text">0</attribute> + <attribute name="text">1</attribute> </attributes> </child> </object> @@ -231,32 +257,43 @@ </child> <child> <object class="GtkScrolledWindow"> - <property name="can_focus">True</property> + <property name="can-focus">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> - <property name="shadow_type">in</property> + <property name="shadow-type">in</property> <child> <object class="GtkTreeView" id="treeview"> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="no_show_all">True</property> - <property name="has_tooltip">True</property> + <property name="can-focus">True</property> + <property name="receives-default">True</property> + <property name="no-show-all">True</property> + <property name="has-tooltip">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> <property name="model">liststore2</property> - <property name="headers_visible">False</property> + <property name="headers-visible">False</property> <property name="reorderable">True</property> - <property name="search_column">0</property> - <property name="enable_tree_lines">True</property> + <property name="search-column">1</property> + <property name="enable-tree-lines">True</property> <child internal-child="selection"> <object class="GtkTreeSelection" id="Macro Library List-selection1"/> </child> <child> + <object class="GtkTreeViewColumn" id="treeviewcolumn3"> + <child> + <object class="GtkCellRendererPixbuf" id="cellrendererpixbuf2"/> + <attributes> + <attribute name="surface">0</attribute> + </attributes> + </child> + </object> + </child> + <child> <object class="GtkTreeViewColumn" id="treeviewcolumn2"> + <property name="resizable">True</property> <child> <object class="GtkCellRendererText" id="cellrenderertext2"/> <attributes> - <attribute name="text">0</attribute> + <attribute name="text">1</attribute> </attributes> </child> </object> @@ -276,40 +313,65 @@ </packing> </child> <child> - <object class="GtkCheckButton" id="showpreview"> - <property name="label" translatable="yes" context="commontemplate|STR_PREVIEW_CHECKBOX">Show previews</property> + <object class="GtkBox"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> + <property name="can-focus">False</property> + <child> + <object class="GtkCheckButton" id="showpreview"> + <property name="label" translatable="yes" context="commontemplate|STR_PREVIEW_CHECKBOX">Show previews</property> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="use-underline">True</property> + <property name="draw-indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="highlightstyles"> + <property name="label" translatable="yes" context="commontemplate|STR_HIGHLIGHT_CHECKBOX">Spotlight</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="use-underline">True</property> + <property name="draw-indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">3</property> + <property name="position">4</property> </packing> </child> <child> <object class="GtkComboBoxText" id="filter"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">4</property> + <property name="position">5</property> </packing> </child> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> + <property name="left-attach">0</property> + <property name="top-attach">0</property> </packing> </child> </object> <object class="GtkMenu" id="toolmenu"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> </object> </interface> |