officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu | 11 vcl/source/treelist/iconview.cxx | 153 ++++------ 2 files changed, 73 insertions(+), 91 deletions(-)
New commits: commit d90f701221207977e4a0417caedc841b6adca2e3 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Wed Apr 27 11:10:59 2022 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Sun Jun 5 07:51:17 2022 +0200 Drop unused .uno:EditChart This reverts commit fb5e0581f922dba93f3689786201ee067cb01a73 Author Muhammet Kara <muhammet.k...@collabora.com> Date Fri Nov 22 13:16:25 2019 +0300 Add command .uno:EditChart Obviously this command has never been used. It was named "EditChart", but in fact it executes the default verb for any selected object, so could be named like "edit object". Since it's unused, let's just drop it instead of renaming. Change-Id: I20aa8a17c54a0bf0030c3187340690846bfbc729 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133473 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135405 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu index 15924fc1f06e..0b1212292b13 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu @@ -7265,17 +7265,6 @@ bit 3 (0x8): #define UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON 8 <value>1</value> </prop> </node> - <node oor:name=".uno:EditChart" oor:op="replace"> - <prop oor:name="Label" oor:type="xs:string"> - <value xml:lang="en-US">~Edit Chart</value> - </prop> - <prop oor:name="TargetURL" oor:type="xs:string"> - <value>.uno:ObjectMenue?VerbID:short=-1</value> - </prop> - <prop oor:name="Properties" oor:type="xs:int"> - <value>1</value> - </prop> - </node> <node oor:name=".uno:DistributeSelection" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="en-US">~Distribution</value> commit 20c7f3d0047f5de5c0951a0091c0d03ed522d67f Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Mon May 2 09:46:52 2022 +0100 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Sun Jun 5 07:50:57 2022 +0200 Reimplement IconView::PaintEntry Use spacing between top, bottom, icon and text (the case of sum of items heights greater than element height is not yet handled). Draw the background even when there's no text: that allows to center the icon in the item, and still have proper highlight of selected item. Change-Id: I5d5dd14060efd15beb0e69df859ecf1efe8a0287 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133612 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135404 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/vcl/source/treelist/iconview.cxx b/vcl/source/treelist/iconview.cxx index c46862434120..c1ed4b028726 100644 --- a/vcl/source/treelist/iconview.cxx +++ b/vcl/source/treelist/iconview.cxx @@ -82,59 +82,45 @@ tools::Rectangle IconView::GetFocusRect(const SvTreeListEntry*, tools::Long nEnt void IconView::PaintEntry(SvTreeListEntry& rEntry, tools::Long nX, tools::Long nY, vcl::RenderContext& rRenderContext) { - tools::Rectangle aRect; // multi purpose + const int nSpacing = 5; // 5 pixels from top, from bottom, between icon and label pImpl->UpdateContextBmpWidthMax(&rEntry); short nTempEntryHeight = GetEntryHeight(); short nTempEntryWidth = GetEntryWidth(); - Point aEntryPos; + Point aEntryPos(nX, nY); - Color aBackupTextColor(rRenderContext.GetTextColor()); - vcl::Font aBackupFont(rRenderContext.GetFont()); - Color aBackupColor = rRenderContext.GetFillColor(); + const Color aBackupTextColor(rRenderContext.GetTextColor()); + const vcl::Font aBackupFont(rRenderContext.GetFont()); + const Color aBackupColor = rRenderContext.GetFillColor(); - bool bCurFontIsSel = false; - const WinBits nWindowStyle = GetStyle(); - const bool bHideSelection = (nWindowStyle & WB_HIDESELECTION) != 0 && !HasFocus(); const StyleSettings& rSettings = rRenderContext.GetSettings().GetStyleSettings(); - vcl::Font aHighlightFont(rRenderContext.GetFont()); - const Color aHighlightTextColor(rSettings.GetHighlightTextColor()); - aHighlightFont.SetColor(aHighlightTextColor); - - Size aOutputSize = GetOutputSizePixel(); + const Size aOutputSize = GetOutputSizePixel(); if (aOutputSize.getHeight() < nTempEntryHeight) nTempEntryHeight = aOutputSize.getHeight(); - Size aRectSize(nTempEntryWidth, nTempEntryHeight); - - SvViewDataEntry* pViewDataEntry = GetViewDataEntry(&rEntry); + const SvViewDataEntry* pViewDataEntry = GetViewDataEntry(&rEntry); - sal_uInt16 nItemCount = rEntry.ItemCount(); - sal_uInt16 nCurItem = 0; - sal_uInt16 nIconItem = nItemCount; - - while (nCurItem < nItemCount) + bool bCurFontIsSel = false; + if (pViewDataEntry->IsHighlighted()) { - SvLBoxItem* pItem = nCurItem < nItemCount ? &rEntry.GetItem(nCurItem) : nullptr; - SvLBoxItemType nItemType = pItem->GetType(); - - if (nItemType == SvLBoxItemType::ContextBmp) - { - nIconItem = nCurItem; - nCurItem++; - continue; - } - - auto nItemHeight = SvLBoxItem::GetHeight(pViewDataEntry, nCurItem); - - aEntryPos.setX(nX); - aEntryPos.setY(nY); + vcl::Font aHighlightFont(rRenderContext.GetFont()); + const Color aHighlightTextColor(rSettings.GetHighlightTextColor()); + aHighlightFont.SetColor(aHighlightTextColor); + + // set font color to highlight + rRenderContext.SetTextColor(aHighlightTextColor); + rRenderContext.SetFont(aHighlightFont); + bCurFontIsSel = true; + } + bool bFillColorSet = false; + // draw background + if (!(nTreeFlags & SvTreeFlags::USESEL)) + { // set background pattern/color - Wallpaper aWallpaper = rRenderContext.GetBackground(); if (pViewDataEntry->IsHighlighted()) @@ -142,80 +128,87 @@ void IconView::PaintEntry(SvTreeListEntry& rEntry, tools::Long nX, tools::Long n Color aNewWallColor = rSettings.GetHighlightColor(); // if the face color is bright then the deactivate color is also bright // -> so you can't see any deactivate selection + const WinBits nWindowStyle = GetStyle(); + const bool bHideSelection = (nWindowStyle & WB_HIDESELECTION) != 0 && !HasFocus(); if (bHideSelection && !rSettings.GetFaceColor().IsBright() && aWallpaper.GetColor().IsBright() != rSettings.GetDeactiveColor().IsBright()) { aNewWallColor = rSettings.GetDeactiveColor(); } - // set font color to highlight - if (!bCurFontIsSel) - { - rRenderContext.SetTextColor(aHighlightTextColor); - rRenderContext.SetFont(aHighlightFont); - bCurFontIsSel = true; - } aWallpaper.SetColor(aNewWallColor); } else // no selection { - if (bCurFontIsSel) - { - bCurFontIsSel = false; - rRenderContext.SetTextColor(aBackupTextColor); - rRenderContext.SetFont(aBackupFont); - } - else - { - aWallpaper.SetColor(rEntry.GetBackColor()); - } + aWallpaper.SetColor(rEntry.GetBackColor()); } - // draw background - if (!(nTreeFlags & SvTreeFlags::USESEL)) + Color aBackgroundColor = aWallpaper.GetColor(); + if (aBackgroundColor != COL_TRANSPARENT) { - aRect.SetPos(aEntryPos); - aRect.SetSize(aRectSize); - - Color aBackgroundColor = aWallpaper.GetColor(); - if (aBackgroundColor != COL_TRANSPARENT) - { - rRenderContext.SetFillColor(aBackgroundColor); - // this case may occur for smaller horizontal resizes - if (aRect.Left() < aRect.Right()) - rRenderContext.DrawRect(aRect); - } + rRenderContext.SetFillColor(aBackgroundColor); + bFillColorSet = true; + // this case may occur for smaller horizontal resizes + if (nTempEntryWidth > 1) + rRenderContext.DrawRect({ aEntryPos, Size(nTempEntryWidth, nTempEntryHeight) }); } + } - // center vertically - aEntryPos.AdjustY((nTempEntryHeight - nItemHeight) / 2); + const size_t nItemCount = rEntry.ItemCount(); + size_t nIconItem = nItemCount; - aEntryPos.AdjustY(15); + int nLabelHeight = 0; + std::vector<size_t> aTextItems; - pItem->Paint(aEntryPos, *this, rRenderContext, pViewDataEntry, rEntry); + for (size_t nCurItem = 0; nCurItem < nItemCount; ++nCurItem) + { + SvLBoxItem& rItem = rEntry.GetItem(nCurItem); + SvLBoxItemType nItemType = rItem.GetType(); - rRenderContext.SetFillColor(aBackupColor); + if (nItemType == SvLBoxItemType::ContextBmp) + { + nIconItem = nCurItem; + continue; + } - nCurItem++; + aTextItems.push_back(nCurItem); + auto nItemHeight = SvLBoxItem::GetHeight(pViewDataEntry, nCurItem); + nLabelHeight += nItemHeight; + } + + int nLabelYPos = nY + nTempEntryHeight - nLabelHeight - nSpacing; // padding from bottom + for (auto nCurItem : aTextItems) + { + aEntryPos.setY(nLabelYPos); + + auto nItemHeight = SvLBoxItem::GetHeight(pViewDataEntry, nCurItem); + nLabelYPos += nItemHeight; + + rEntry.GetItem(nCurItem).Paint(aEntryPos, *this, rRenderContext, pViewDataEntry, rEntry); } + if (bFillColorSet) + rRenderContext.SetFillColor(aBackupColor); + // draw icon - if (nIconItem != nItemCount && nIconItem < nItemCount) + if (nIconItem < nItemCount) { - SvLBoxItem* pItem = &rEntry.GetItem(nIconItem); - auto nItemWidth = pItem->GetWidth(this, pViewDataEntry, nIconItem); + SvLBoxItem& rItem = rEntry.GetItem(nIconItem); + auto nItemWidth = rItem.GetWidth(this, pViewDataEntry, nIconItem); auto nItemHeight = SvLBoxItem::GetHeight(pViewDataEntry, nIconItem); - aEntryPos.setX(nX); aEntryPos.setY(nY); // center horizontally aEntryPos.AdjustX((nTempEntryWidth - nItemWidth) / 2); // center vertically - aEntryPos.AdjustY((nTempEntryHeight - nItemHeight) / 2); - - aEntryPos.AdjustY(-10); + int nImageAreaHeight = nTempEntryHeight - nSpacing * 2; // spacings from top, from bottom + if (nLabelHeight > 0) + { + nImageAreaHeight -= nLabelHeight + nSpacing; // spacing between icon and label + } + aEntryPos.AdjustY((nImageAreaHeight - nItemHeight) / 2 + nSpacing); - pItem->Paint(aEntryPos, *this, rRenderContext, pViewDataEntry, rEntry); + rItem.Paint(aEntryPos, *this, rRenderContext, pViewDataEntry, rEntry); } if (bCurFontIsSel)