summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-02-16 13:56:04 +0000
committerCaolán McNamara <caolanm@redhat.com>2021-02-16 17:13:01 +0100
commit2c8ffa41ec8e1ab2af95d5e033a445c17d29cf5a (patch)
tree27939b26b4745b85f50fe004d77304d39789dd4a /sfx2
parent0b86394983e05f7ffecb9e20792aba090680eff6 (diff)
weld sidebar "too-narrow" CloseIndicator
Change-Id: Ifda6f56ba51d46bd35065c2230f39e837b037096 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110991 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/inc/bitmaps.hlst1
-rw-r--r--sfx2/source/sidebar/SidebarController.cxx47
-rw-r--r--sfx2/source/sidebar/Theme.cxx39
3 files changed, 40 insertions, 47 deletions
diff --git a/sfx2/inc/bitmaps.hlst b/sfx2/inc/bitmaps.hlst
index 7e97d1219996..de8d6555d19d 100644
--- a/sfx2/inc/bitmaps.hlst
+++ b/sfx2/inc/bitmaps.hlst
@@ -88,6 +88,7 @@
#define SFX_BMP_CLOSE_DOC "sfx2/res/closedoc.png"
+#define SIDEBAR_CLOSE_INDICATOR "cmd/lc_decrementlevel.png"
#endif
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index b46de16deb08..fdd52a44f783 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -36,7 +36,6 @@
#include <framework/ContextChangeEventMultiplexerTunnel.hxx>
#include <vcl/floatwin.hxx>
-#include <vcl/fixed.hxx>
#include <vcl/uitest/logger.hxx>
#include <vcl/uitest/eventdescription.hxx>
#include <vcl/svapp.hxx>
@@ -61,6 +60,7 @@
#include <com/sun/star/util/URL.hpp>
#include <com/sun/star/rendering/XSpriteCanvas.hpp>
+#include <bitmaps.hlst>
using namespace css;
using namespace css::uno;
@@ -240,6 +240,40 @@ void SidebarController::disposeDecks()
mpResourceManager->disposeDecks();
}
+namespace
+{
+ class CloseIndicator final : public InterimItemWindow
+ {
+ public:
+ CloseIndicator(vcl::Window* pParent)
+ : InterimItemWindow(pParent, "svt/ui/fixedimagecontrol.ui", "FixedImageControl")
+ , m_xWidget(m_xBuilder->weld_image("image"))
+ {
+ InitControlBase(m_xWidget.get());
+
+ m_xWidget->set_from_icon_name(SIDEBAR_CLOSE_INDICATOR);
+
+ SetSizePixel(get_preferred_size());
+
+ SetBackground(Theme::GetColor(Theme::Color_DeckBackground));
+ }
+
+ virtual ~CloseIndicator() override
+ {
+ disposeOnce();
+ }
+
+ virtual void dispose() override
+ {
+ m_xWidget.reset();
+ InterimItemWindow::dispose();
+ }
+
+ private:
+ std::unique_ptr<weld::Image> m_xWidget;
+ };
+}
+
void SAL_CALL SidebarController::disposing()
{
SolarMutexGuard aSolarMutexGuard;
@@ -1438,15 +1472,8 @@ void SidebarController::UpdateCloseIndicator (const bool bCloseAfterDrag)
if (bCloseAfterDrag)
{
// Make sure that the indicator exists.
- if ( ! mpCloseIndicator)
- {
- mpCloseIndicator.reset(VclPtr<FixedImage>::Create(mpParentWindow));
- FixedImage* pFixedImage = static_cast<FixedImage*>(mpCloseIndicator.get());
- const Image aImage (Theme::GetImage(Theme::Image_CloseIndicator));
- pFixedImage->SetImage(aImage);
- pFixedImage->SetSizePixel(aImage.GetSizePixel());
- pFixedImage->SetBackground(Theme::GetColor(Theme::Color_DeckBackground));
- }
+ if (!mpCloseIndicator)
+ mpCloseIndicator.reset(VclPtr<CloseIndicator>::Create(mpParentWindow));
// Place and show the indicator.
const Size aWindowSize (mpParentWindow->GetSizePixel());
diff --git a/sfx2/source/sidebar/Theme.cxx b/sfx2/source/sidebar/Theme.cxx
index 6ad2b891657c..dd187aa26edc 100644
--- a/sfx2/source/sidebar/Theme.cxx
+++ b/sfx2/source/sidebar/Theme.cxx
@@ -37,7 +37,6 @@ Theme& Theme::GetCurrentTheme()
Theme::Theme()
: ThemeInterfaceBase(m_aMutex),
- maImages(),
maColors(),
maIntegers(),
maBooleans(),
@@ -57,15 +56,6 @@ Theme::~Theme()
{
}
-Image Theme::GetImage (const ThemeItem eItem)
-{
- const PropertyType eType (GetPropertyType(eItem));
- OSL_ASSERT(eType==PT_Image);
- const sal_Int32 nIndex (GetIndex(eItem, eType));
- const Theme& rTheme (GetCurrentTheme());
- return rTheme.maImages[nIndex];
-}
-
Color Theme::GetColor (const ThemeItem eItem)
{
const PropertyType eType (GetPropertyType(eItem));
@@ -196,9 +186,6 @@ void Theme::UpdateTheme()
setPropertyValue(
maPropertyIdToNameMap[Color_VerticalBorder],
Any(sal_Int32(aBorderColor.GetRGBColor())));
- setPropertyValue(
- maPropertyIdToNameMap[Image_CloseIndicator],
- Any(OUString("private:graphicrepository/cmd/lc_decrementlevel.png")));
}
catch(beans::UnknownPropertyException const &)
{
@@ -485,15 +472,10 @@ sal_Bool SAL_CALL Theme::hasPropertyByName (const OUString& rsPropertyName)
void Theme::SetupPropertyMaps()
{
maPropertyIdToNameMap.resize(Post_Bool_);
- maImages.resize(Image_Color_ - Pre_Image_ - 1);
- maColors.resize(Color_Int_ - Image_Color_ - 1);
+ maColors.resize(Color_Int_ - Pre_Color_ - 1);
maIntegers.resize(Int_Bool_ - Color_Int_ - 1);
maBooleans.resize(Post_Bool_ - Int_Bool_ - 1);
- maPropertyNameToIdMap["Image_CloseIndicator"]=Image_CloseIndicator;
- maPropertyIdToNameMap[Image_CloseIndicator]="Image_CloseIndicator";
-
-
maPropertyNameToIdMap["Color_DeckTitleFont"]=Color_DeckTitleFont;
maPropertyIdToNameMap[Color_DeckTitleFont]="Color_DeckTitleFont";
@@ -570,9 +552,6 @@ Theme::PropertyType Theme::GetPropertyType (const ThemeItem eItem)
{
switch(eItem)
{
- case Image_CloseIndicator:
- return PT_Image;
-
case Color_DeckTitleFont:
case Color_PanelTitleFont:
case Color_Highlight:
@@ -610,9 +589,6 @@ css::uno::Type const & Theme::GetCppuType (const PropertyType eType)
{
switch(eType)
{
- case PT_Image:
- return cppu::UnoType<OUString>::get();
-
case PT_Color:
return cppu::UnoType<sal_uInt32>::get();
@@ -632,10 +608,8 @@ sal_Int32 Theme::GetIndex (const ThemeItem eItem, const PropertyType eType)
{
switch(eType)
{
- case PT_Image:
- return eItem - Pre_Image_-1;
case PT_Color:
- return eItem - Image_Color_-1;
+ return eItem - Pre_Color_-1;
case PT_Integer:
return eItem - Color_Int_-1;
case PT_Boolean:
@@ -733,15 +707,6 @@ void Theme::ProcessNewValue (
const sal_Int32 nIndex (GetIndex (eItem, eType));
switch (eType)
{
- case PT_Image:
- {
- OUString sURL;
- if (rValue >>= sURL)
- {
- maImages[nIndex] = Image(Tools::GetImage(sURL, nullptr));
- }
- break;
- }
case PT_Color:
{
Color nColorValue;