[Libreoffice-commits] core.git: cui/source include/svx sc/source svx/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Sat Apr 25 19:55:44 UTC 2020
cui/source/tabpages/tpcolor.cxx | 4 -
include/svx/Palette.hxx | 1
include/svx/PaletteManager.hxx | 1
include/svx/SvxColorValueSet.hxx | 15 ----
sc/source/ui/miscdlgs/tabbgcolordlg.cxx | 6 -
svx/source/tbxctrls/SvxColorValueSet.cxx | 101 +++----------------------------
svx/source/tbxctrls/colrctrl.cxx | 8 +-
svx/source/tbxctrls/tbcontrl.cxx | 2
8 files changed, 25 insertions(+), 113 deletions(-)
New commits:
commit fadcfa51e7ef5d654607e39073405fbe6c0c9568
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Apr 24 20:40:31 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat Apr 25 21:55:07 2020 +0200
remove newly unused SvxColorValueSet
Change-Id: Iaf7243430e50df4db84f7032eaf52728cc779c7c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92896
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx
index 456897ee28d6..4bae96abc837 100644
--- a/cui/source/tabpages/tpcolor.cxx
+++ b/cui/source/tabpages/tpcolor.cxx
@@ -154,8 +154,8 @@ void SvxColorTabPage::ImpColorCountChanged()
{
if (!pColorList.is())
return;
- m_xValSetColorList->SetColCount(SvxColorValueSet::getColumnCount());
- m_xValSetRecentList->SetColCount(SvxColorValueSet::getColumnCount());
+ m_xValSetColorList->SetColCount(ColorValueSet::getColumnCount());
+ m_xValSetRecentList->SetColCount(ColorValueSet::getColumnCount());
}
void SvxColorTabPage::FillPaletteLB()
diff --git a/include/svx/Palette.hxx b/include/svx/Palette.hxx
index 8bee59534e4e..be8198f288e4 100644
--- a/include/svx/Palette.hxx
+++ b/include/svx/Palette.hxx
@@ -24,7 +24,6 @@
class Color;
class ColorValueSet;
-class SvxColorValueSet;
typedef std::pair<Color, OUString> NamedColor;
diff --git a/include/svx/PaletteManager.hxx b/include/svx/PaletteManager.hxx
index 514211960961..42fbb0437c04 100644
--- a/include/svx/PaletteManager.hxx
+++ b/include/svx/PaletteManager.hxx
@@ -27,7 +27,6 @@
#include <vector>
#include <memory>
-class SvxColorValueSet;
namespace com::sun::star::uno { class XComponentContext; }
namespace svx { class ToolboxButtonColorUpdaterBase; }
namespace weld { class Window; }
diff --git a/include/svx/SvxColorValueSet.hxx b/include/svx/SvxColorValueSet.hxx
index 26924f298f2f..ffdaf642292d 100644
--- a/include/svx/SvxColorValueSet.hxx
+++ b/include/svx/SvxColorValueSet.hxx
@@ -25,10 +25,10 @@
class XColorList;
-class SVXCORE_DLLPUBLIC SvxColorValueSet : public ValueSet
+class SVXCORE_DLLPUBLIC ColorValueSet : public SvtValueSet
{
public:
- SvxColorValueSet(vcl::Window* pParent);
+ ColorValueSet(std::unique_ptr<weld::ScrolledWindow> pWindow);
virtual void Resize() override;
@@ -36,17 +36,6 @@ public:
static sal_uInt32 getEntryEdgeLength();
static sal_uInt32 getColumnCount();
- void addEntriesForXColorList(const XColorList& rXColorList, sal_uInt32 nStartIndex = 1);
- Size layoutToGivenHeight(sal_uInt32 nHeight, sal_uInt32 nEntryCount);
-};
-
-class SVXCORE_DLLPUBLIC ColorValueSet : public SvtValueSet
-{
-public:
- ColorValueSet(std::unique_ptr<weld::ScrolledWindow> pWindow);
-
- virtual void Resize() override;
-
void addEntriesForXColorList(const XColorList& rXColorList, sal_uInt32 nStartIndex = 1);
void addEntriesForColorSet(const std::set<Color>& rColorSet, const OUString& rNamePrefix);
Size layoutAllVisible(sal_uInt32 nEntryCount);
diff --git a/sc/source/ui/miscdlgs/tabbgcolordlg.cxx b/sc/source/ui/miscdlgs/tabbgcolordlg.cxx
index bc9301c21c31..a0317ca01c2d 100644
--- a/sc/source/ui/miscdlgs/tabbgcolordlg.cxx
+++ b/sc/source/ui/miscdlgs/tabbgcolordlg.cxx
@@ -38,7 +38,7 @@ ScTabBgColorDlg::ScTabBgColorDlg(weld::Window* pParent, const OUString& rTitle,
, m_xBtnOk(m_xBuilder->weld_button("ok"))
{
m_xTabBgColorSet->SetDialog(this);
- m_xTabBgColorSet->SetColCount(SvxColorValueSet::getColumnCount());
+ m_xTabBgColorSet->SetColCount(ColorValueSet::getColumnCount());
m_xDialog->set_title(rTitle);
@@ -46,9 +46,9 @@ ScTabBgColorDlg::ScTabBgColorDlg(weld::Window* pParent, const OUString& rTitle,
m_xTabBgColorSet->SetStyle(nBits);
m_xTabBgColorSet->SetText(rTabBgColorNoColorText);
- const sal_uInt32 nColCount = SvxColorValueSet::getColumnCount();
+ const sal_uInt32 nColCount = ColorValueSet::getColumnCount();
const sal_uInt32 nRowCount(10);
- const sal_uInt32 nLength = SvxColorValueSet::getEntryEdgeLength();
+ const sal_uInt32 nLength = ColorValueSet::getEntryEdgeLength();
Size aSize(m_xTabBgColorSet->CalcWindowSizePixel(Size(nLength, nLength), nColCount, nRowCount));
m_xTabBgColorSetWin->set_size_request(aSize.Width() + 8, aSize.Height() + 8);
diff --git a/svx/source/tbxctrls/SvxColorValueSet.cxx b/svx/source/tbxctrls/SvxColorValueSet.cxx
index fa67ac94428d..bed00e5f9d63 100644
--- a/svx/source/tbxctrls/SvxColorValueSet.cxx
+++ b/svx/source/tbxctrls/SvxColorValueSet.cxx
@@ -23,56 +23,31 @@
#include <vcl/settings.hxx>
#include <osl/diagnose.h>
-SvxColorValueSet::SvxColorValueSet(vcl::Window* _pParent)
-: ValueSet(_pParent, WB_ITEMBORDER)
-{
- SetEdgeBlending(true);
-}
-
ColorValueSet::ColorValueSet(std::unique_ptr<weld::ScrolledWindow> pWindow)
: SvtValueSet(std::move(pWindow))
{
SetEdgeBlending(true);
}
-sal_uInt32 SvxColorValueSet::getMaxRowCount()
+sal_uInt32 ColorValueSet::getMaxRowCount()
{
return StyleSettings::GetColorValueSetMaximumRowCount();
}
-sal_uInt32 SvxColorValueSet::getEntryEdgeLength()
+sal_uInt32 ColorValueSet::getEntryEdgeLength()
{
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
return rStyleSettings.GetListBoxPreviewDefaultPixelSize().Height() + 1;
}
-sal_uInt32 SvxColorValueSet::getColumnCount()
+sal_uInt32 ColorValueSet::getColumnCount()
{
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
return rStyleSettings.GetColorValueSetColumnCount();
}
-void SvxColorValueSet::addEntriesForXColorList(const XColorList& rXColorList, sal_uInt32 nStartIndex)
-{
- const sal_uInt32 nColorCount(rXColorList.Count());
-
- for(sal_uInt32 nIndex(0); nIndex < nColorCount; nIndex++, nStartIndex++)
- {
- const XColorEntry* pEntry = rXColorList.GetColor(nIndex);
-
- if(pEntry)
- {
- InsertItem(nStartIndex, pEntry->GetColor(), pEntry->GetName());
- }
- else
- {
- OSL_ENSURE(false, "OOps, XColorList with empty entries (!)");
- }
- }
-}
-
void ColorValueSet::addEntriesForXColorList(const XColorList& rXColorList, sal_uInt32 nStartIndex)
{
const sal_uInt32 nColorCount(rXColorList.Count());
@@ -120,11 +95,11 @@ Size ColorValueSet::layoutAllVisible(sal_uInt32 nEntryCount)
nEntryCount++;
}
- const sal_uInt32 nRowCount(ceil(double(nEntryCount)/SvxColorValueSet::getColumnCount()));
- const Size aItemSize(SvxColorValueSet::getEntryEdgeLength() - 2, SvxColorValueSet::getEntryEdgeLength() - 2);
+ const sal_uInt32 nRowCount(ceil(double(nEntryCount)/ColorValueSet::getColumnCount()));
+ const Size aItemSize(ColorValueSet::getEntryEdgeLength() - 2, ColorValueSet::getEntryEdgeLength() - 2);
const WinBits aWinBits(GetStyle() & ~WB_VSCROLL);
- if (nRowCount > SvxColorValueSet::getMaxRowCount())
+ if (nRowCount > ColorValueSet::getMaxRowCount())
{
SetStyle(aWinBits|WB_VSCROLL);
}
@@ -133,70 +108,20 @@ Size ColorValueSet::layoutAllVisible(sal_uInt32 nEntryCount)
SetStyle(aWinBits);
}
- SetColCount(SvxColorValueSet::getColumnCount());
- SetLineCount(std::min(nRowCount, SvxColorValueSet::getMaxRowCount()));
+ SetColCount(ColorValueSet::getColumnCount());
+ SetLineCount(std::min(nRowCount, ColorValueSet::getMaxRowCount()));
SetItemWidth(aItemSize.Width());
SetItemHeight(aItemSize.Height());
return CalcWindowSizePixel(aItemSize);
}
-void SvxColorValueSet::Resize()
-{
- layoutToGivenHeight(GetSizePixel().Height(), GetItemCount());
- ValueSet::Resize();
-}
-
void ColorValueSet::Resize()
{
layoutToGivenHeight(GetOutputSizePixel().Height(), GetItemCount());
SvtValueSet::Resize();
}
-Size SvxColorValueSet::layoutToGivenHeight(sal_uInt32 nHeight, sal_uInt32 nEntryCount)
-{
- if(!nEntryCount)
- {
- nEntryCount++;
- }
-
- const Size aItemSize(getEntryEdgeLength() - 2, getEntryEdgeLength() - 2);
- const WinBits aWinBits(GetStyle() & ~WB_VSCROLL);
-
- // get size with all fields disabled
- const WinBits aWinBitsNoScrollNoFields(GetStyle() & ~(WB_VSCROLL|WB_NAMEFIELD|WB_NONEFIELD));
- SetStyle(aWinBitsNoScrollNoFields);
- const Size aSizeNoScrollNoFields(CalcWindowSizePixel(aItemSize, getColumnCount()));
-
- // get size with all needed fields
- SetStyle(aWinBits);
- Size aNewSize(CalcWindowSizePixel(aItemSize, getColumnCount()));
-
- const Size aItemSizePixel(CalcItemSizePixel(aItemSize));
- // calculate field height and available height for requested height
- const sal_uInt32 nFieldHeight(aNewSize.Height() - aSizeNoScrollNoFields.Height());
- const sal_uInt32 nAvailableHeight(nHeight >= nFieldHeight ? nHeight - nFieldHeight + aItemSizePixel.Height() - 1 : 0);
-
- // calculate how many lines can be shown there
- const sal_uInt32 nLineCount(nAvailableHeight / aItemSizePixel.Height());
- const sal_uInt32 nLineMax(ceil(double(nEntryCount)/getColumnCount()));
-
- if(nLineMax > nLineCount)
- {
- SetStyle(aWinBits|WB_VSCROLL);
- }
-
- // set height to wanted height
- aNewSize.setHeight( nHeight );
-
- SetItemWidth(aItemSize.Width());
- SetItemHeight(aItemSize.Height());
- SetColCount(getColumnCount());
- SetLineCount(nLineCount);
-
- return aNewSize;
-}
-
Size ColorValueSet::layoutToGivenHeight(sal_uInt32 nHeight, sal_uInt32 nEntryCount)
{
if(!nEntryCount)
@@ -204,17 +129,17 @@ Size ColorValueSet::layoutToGivenHeight(sal_uInt32 nHeight, sal_uInt32 nEntryCou
nEntryCount++;
}
- const Size aItemSize(SvxColorValueSet::getEntryEdgeLength() - 2, SvxColorValueSet::getEntryEdgeLength() - 2);
+ const Size aItemSize(ColorValueSet::getEntryEdgeLength() - 2, ColorValueSet::getEntryEdgeLength() - 2);
const WinBits aWinBits(GetStyle() & ~WB_VSCROLL);
// get size with all fields disabled
const WinBits aWinBitsNoScrollNoFields(GetStyle() & ~(WB_VSCROLL|WB_NAMEFIELD|WB_NONEFIELD));
SetStyle(aWinBitsNoScrollNoFields);
- const Size aSizeNoScrollNoFields(CalcWindowSizePixel(aItemSize, SvxColorValueSet::getColumnCount()));
+ const Size aSizeNoScrollNoFields(CalcWindowSizePixel(aItemSize, ColorValueSet::getColumnCount()));
// get size with all needed fields
SetStyle(aWinBits);
- Size aNewSize(CalcWindowSizePixel(aItemSize, SvxColorValueSet::getColumnCount()));
+ Size aNewSize(CalcWindowSizePixel(aItemSize, ColorValueSet::getColumnCount()));
const Size aItemSizePixel(CalcItemSizePixel(aItemSize));
// calculate field height and available height for requested height
@@ -223,7 +148,7 @@ Size ColorValueSet::layoutToGivenHeight(sal_uInt32 nHeight, sal_uInt32 nEntryCou
// calculate how many lines can be shown there
const sal_uInt32 nLineCount(nAvailableHeight / aItemSizePixel.Height());
- const sal_uInt32 nLineMax(ceil(double(nEntryCount)/SvxColorValueSet::getColumnCount()));
+ const sal_uInt32 nLineMax(ceil(double(nEntryCount)/ColorValueSet::getColumnCount()));
if(nLineMax > nLineCount)
{
@@ -235,7 +160,7 @@ Size ColorValueSet::layoutToGivenHeight(sal_uInt32 nHeight, sal_uInt32 nEntryCou
SetItemWidth(aItemSize.Width());
SetItemHeight(aItemSize.Height());
- SetColCount(SvxColorValueSet::getColumnCount());
+ SetColCount(ColorValueSet::getColumnCount());
SetLineCount(nLineCount);
return aNewSize;
diff --git a/svx/source/tbxctrls/colrctrl.cxx b/svx/source/tbxctrls/colrctrl.cxx
index 72120453eb70..71b637ea5937 100644
--- a/svx/source/tbxctrls/colrctrl.cxx
+++ b/svx/source/tbxctrls/colrctrl.cxx
@@ -208,10 +208,10 @@ SvxColorDockingWindow::SvxColorDockingWindow(SfxBindings* _pBindings, SfxChildWi
}
}
- aItemSize = xColorSet->CalcItemSizePixel(Size(SvxColorValueSet::getEntryEdgeLength(), SvxColorValueSet::getEntryEdgeLength()));
- aItemSize.setWidth( aItemSize.Width() + SvxColorValueSet::getEntryEdgeLength() );
+ aItemSize = xColorSet->CalcItemSizePixel(Size(ColorValueSet::getEntryEdgeLength(), ColorValueSet::getEntryEdgeLength()));
+ aItemSize.setWidth( aItemSize.Width() + ColorValueSet::getEntryEdgeLength() );
aItemSize.setWidth( aItemSize.Width() / 2 );
- aItemSize.setHeight( aItemSize.Height() + SvxColorValueSet::getEntryEdgeLength() );
+ aItemSize.setHeight( aItemSize.Height() + ColorValueSet::getEntryEdgeLength() );
aItemSize.setHeight( aItemSize.Height() / 2 );
fprintf(stderr, "size is %ld %ld\n", aItemSize.Width(), aItemSize.Height());
@@ -256,7 +256,7 @@ void SvxColorDockingWindow::FillValueSet()
xColorSet->addEntriesForXColorList(*pColorList, 2);
// create the last entry for 'invisible/none'
- const Size aColorSize(SvxColorValueSet::getEntryEdgeLength(), SvxColorValueSet::getEntryEdgeLength());
+ const Size aColorSize(ColorValueSet::getEntryEdgeLength(), ColorValueSet::getEntryEdgeLength());
long nPtX = aColorSize.Width() - 1;
long nPtY = aColorSize.Height() - 1;
ScopedVclPtrInstance< VirtualDevice > pVD;
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index a56ab368f12a..1b4961caae17 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1826,7 +1826,7 @@ ColorWindow::ColorWindow(const OUString& rCommand,
mxColorSet->SetHelpId(HID_POPUP_COLOR_CTRL);
mxPaletteManager->ReloadColorSet(*mxColorSet);
- const sal_uInt32 nMaxItems(SvxColorValueSet::getMaxRowCount() * SvxColorValueSet::getColumnCount());
+ const sal_uInt32 nMaxItems(ColorValueSet::getMaxRowCount() * ColorValueSet::getColumnCount());
Size aSize = mxColorSet->layoutAllVisible(nMaxItems);
mxColorSet->set_size_request(aSize.Width(), aSize.Height());
More information about the Libreoffice-commits
mailing list