Files
odfstudio/cui/source/inc/cuitabarea.hxx
T
Armin Le Grand (collabora) 760394bbad Remove XFillAttrSetItem and XLineAttrSetItem
Both are derived from SfxSetItem which means they contain
a SfxItemSet themselves. That leads to problems since at
their construction time a SfxItemPool has to be known and
it *should* not be different to the one of the ItemSet
that Item gets added later - that leads to the 2nd class
of problems.

In the long therm we should get rid of all SfxSetItems.
This change simplifies already some stuff, including that
the standard Items for DrawObjects reduces by two (and
more due to containing a whole ItemSet) and e.g. the
problem that these Items had to be converted to hard
attributes in the done fixes for copy/pasting Slides.

Signed-off-by: Armin Le Grand (collabora) <Armin.LeGrand@collabora.com>
Change-Id: I8b1c6cabdaa43ed6062811b5508ab3dece47a755
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/6795
Reviewed-by: Armin Le Grand <armin.legrand@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit e67458a9b769fe7a3a7ee0739ed6d5c46dbc0692)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211734
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-10-08 08:56:42 +02:00

759 lines
29 KiB
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#pragma once
#include "SvxPresetListBox.hxx"
#include <svx/ColorIconView.hxx>
#include <svx/dlgctrl.hxx>
#include <svx/tabarea.hxx>
#include <svx/PaletteManager.hxx>
#include <svx/svdview.hxx>
#include <vcl/hexcolorcontrol.hxx>
#include <vcl/weld/Button.hxx>
#include <vcl/weld/CheckButton.hxx>
#include <vcl/weld/ComboBox.hxx>
#include <vcl/weld/DrawingArea.hxx>
#include <vcl/weld/Entry.hxx>
#include <vcl/weld/IconView.hxx>
#include <vcl/weld/Label.hxx>
#include <vcl/weld/MetricSpinButton.hxx>
#include <vcl/weld/RadioButton.hxx>
#include <vcl/weld/Scale.hxx>
#include <vcl/weld/SpinButton.hxx>
#include <vcl/weld/ToggleButton.hxx>
class ColorListBox;
class SdrModel;
class SvxBitmapCtl;
enum class FillType
{
TRANSPARENT,
SOLID,
GRADIENT,
HATCH,
BITMAP,
PATTERN,
USE_BACKGROUND_FILL,
// fallback value if no fill type has been set
INVALID,
};
class ButtonBox
{
private:
weld::Toggleable* mpCurrentButton;
std::map<weld::Toggleable*, FillType > maButtonToFillType;
public:
ButtonBox()
: mpCurrentButton(nullptr) {};
void AddButton(weld::ToggleButton* pButton, FillType eFillType)
{
maButtonToFillType.insert( std::make_pair(pButton, eFillType) );
}
FillType GetCurrentFillType() const
{
if (mpCurrentButton)
return GetFillType(*mpCurrentButton);
return FillType::INVALID;
}
FillType GetFillType(weld::Toggleable& rButton) const
{
auto aIt = maButtonToFillType.find(&rButton);
assert(aIt != maButtonToFillType.end() && "Unknown button");
return aIt->second;
}
void SelectButton(weld::Toggleable& rButton)
{
weld::Toggleable* pPreviousButton = mpCurrentButton;
mpCurrentButton = &rButton;
rButton.set_active(true);
if (pPreviousButton)
pPreviousButton->set_active(false);
}
};
enum class PageType
{
Area,
Gradient,
Hatch,
Bitmap,
Shadow,
Transparence,
};
class AreaTabHelper
{
public:
static OUString GetPalettePath();
};
class SvxAreaTabDialog final : public SfxTabDialogController
{
SdrModel* mpDrawModel;
XColorListRef mpColorList;
XColorListRef mpNewColorList;
XGradientListRef mpGradientList;
XGradientListRef mpNewGradientList;
XHatchListRef mpHatchingList;
XHatchListRef mpNewHatchingList;
XBitmapListRef mpBitmapList;
XBitmapListRef mpNewBitmapList;
XPatternListRef mpPatternList;
XPatternListRef mpNewPatternList;
ChangeType mnColorListState;
virtual void PageCreated(const OUString& rId, SfxTabPage &rPage) override;
virtual short Ok() override;
DECL_LINK(CancelHdlImpl, weld::Button&, void);
void SavePalettes();
public:
SvxAreaTabDialog(weld::Window* pParent, const SfxItemSet* pAttr, SdrModel* pModel, bool bShadow,
bool bSlideBackground);
void SetNewColorList( XColorListRef const & pColorList )
{ mpNewColorList = pColorList; }
const XColorListRef& GetNewColorList() const { return mpNewColorList; }
};
/************************************************************************/
class SvxTransparenceTabPage : public SfxTabPage
{
static const WhichRangesContainer pTransparenceRanges;
const SfxItemSet& rOutAttrs;
PageType nPageType;
sal_uInt16 nDlgType;
bool bBitmap;
SfxItemSet m_aFillAttributeSet;
SvxXRectPreview m_aCtlBitmapPreview;
SvxXRectPreview m_aCtlXRectPreview;
// main selection
std::unique_ptr<weld::RadioButton> m_xRbtTransOff;
std::unique_ptr<weld::RadioButton> m_xRbtTransLinear;
std::unique_ptr<weld::RadioButton> m_xRbtTransGradient;
/// linear transparency
std::unique_ptr<weld::MetricSpinButton> m_xMtrTransparent;
// gradient transparency
std::unique_ptr<weld::Widget> m_xGridGradient;
std::unique_ptr<weld::ComboBox> m_xLbTrgrGradientType;
std::unique_ptr<weld::Label> m_xFtTrgrCenterX;
std::unique_ptr<weld::MetricSpinButton> m_xMtrTrgrCenterX;
std::unique_ptr<weld::Label> m_xFtTrgrCenterY;
std::unique_ptr<weld::MetricSpinButton> m_xMtrTrgrCenterY;
std::unique_ptr<weld::Label> m_xFtTrgrAngle;
std::unique_ptr<weld::MetricSpinButton> m_xMtrTrgrAngle;
std::unique_ptr<weld::MetricSpinButton> m_xMtrTrgrBorder;
std::unique_ptr<weld::MetricSpinButton> m_xMtrTrgrStartValue;
std::unique_ptr<weld::MetricSpinButton> m_xMtrTrgrEndValue;
std::unique_ptr<weld::Widget> m_xCtlBitmapBorder;
std::unique_ptr<weld::Widget> m_xCtlXRectBorder;
// preview
std::unique_ptr<weld::CustomWeld> m_xCtlBitmapPreview;
std::unique_ptr<weld::CustomWeld> m_xCtlXRectPreview;
// MCGR: Preserve ColorStops until we have a UI to edit these
basegfx::BColorStops maColorStops;
DECL_LINK(ClickTransOffHdl_Impl, weld::Toggleable&, void);
DECL_LINK(ClickTransLinearHdl_Impl, weld::Toggleable&, void);
DECL_LINK(ClickTransGradientHdl_Impl, weld::Toggleable&, void );
DECL_LINK(ModifyTransparentHdl_Impl, weld::MetricSpinButton&, void);
DECL_LINK(ModifiedTrgrEditHdl_Impl, weld::MetricSpinButton&, void);
DECL_LINK(ModifiedTrgrListBoxHdl_Impl, weld::ComboBox&, void);
void ModifiedTrgrHdl_Impl(const weld::ComboBox*);
void ActivateLinear(bool bActivate);
void ActivateGradient(bool bActivate);
void SetControlState_Impl(css::awt::GradientStyle eXGS);
bool InitPreview ( const SfxItemSet& rSet );
void InvalidatePreview (bool bEnable = true );
// MCGR: Preserve ColorStops until we have a UI to edit these
basegfx::BColorStops createColorStops();
public:
SvxTransparenceTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
virtual ~SvxTransparenceTabPage() override;
static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet*);
static const WhichRangesContainer & GetRanges() { return pTransparenceRanges; }
virtual bool FillItemSet(SfxItemSet*) override;
virtual void Reset(const SfxItemSet*) override;
virtual void ChangesApplied() override;
virtual void ActivatePage(const SfxItemSet& rSet) override;
virtual DeactivateRC DeactivatePage(SfxItemSet* pSet) override;
void SetPageType(PageType nInType) { nPageType = nInType; }
void SetDlgType(sal_uInt16 nInType) { nDlgType = nInType; }
virtual void PageCreated(const SfxAllItemSet& aSet) override;
};
/************************************************************************/
class SvxAreaTabPage : public SfxTabPage
{
static const WhichRangesContainer pAreaRanges;
private:
std::unique_ptr<SfxTabPage> m_xFillTabPage;
ButtonBox maBox;
XColorListRef m_pColorList;
XGradientListRef m_pGradientList;
XHatchListRef m_pHatchingList;
XBitmapListRef m_pBitmapList;
XPatternListRef m_pPatternList;
// Placeholders for pointer-based entries; these will be inited
// to point to these so that the page is usable without that
// SvxAreaTabDialog has to call the setter methods (e.g. SetColorChgd).
// Without that the pages used in SvxAreaTabDialog are not usable
ChangeType maFixed_ChangeType;
ChangeType* m_pnColorListState;
SfxItemSet m_aFillAttributeSet;
bool m_bBtnClicked = false;
protected:
std::unique_ptr<weld::Container> m_xFillTab;
std::unique_ptr<weld::ToggleButton> m_xBtnNone;
std::unique_ptr<weld::ToggleButton> m_xBtnColor;
std::unique_ptr<weld::ToggleButton> m_xBtnGradient;
std::unique_ptr<weld::ToggleButton> m_xBtnHatch;
std::unique_ptr<weld::ToggleButton> m_xBtnBitmap;
std::unique_ptr<weld::ToggleButton> m_xBtnPattern;
std::unique_ptr<weld::ToggleButton> m_xBtnUseBackground;
void SetOptimalSize(weld::DialogController* pController);
void SelectFillType( weld::Toggleable& rButton, const SfxItemSet* _pSet = nullptr );
bool IsBtnClicked() const { return m_bBtnClicked; }
private:
DECL_LINK(SelectFillTypeHdl_Impl, weld::Toggleable&, void);
template< typename TabPage >
bool FillItemSet_Impl( SfxItemSet* );
template< typename TabPage >
void Reset_Impl( const SfxItemSet* );
template< typename TabPage >
DeactivateRC DeactivatePage_Impl( SfxItemSet* pSet );
std::unique_ptr<SfxTabPage> CreatePage(FillType eFillType);
public:
SvxAreaTabPage(weld::Container* pPage, weld::DialogController* pController,
const SfxItemSet& rInAttrs, bool bSlideBackground = false);
virtual ~SvxAreaTabPage() override;
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
static std::unique_ptr<SfxTabPage>
CreateWithSlideBackground(weld::Container* pPage, weld::DialogController* pController,
const SfxItemSet*);
static const WhichRangesContainer & GetRanges() { return pAreaRanges; }
virtual OUString GetAllStrings() override;
virtual bool FillItemSet( SfxItemSet* ) override;
virtual void Reset( const SfxItemSet * ) override;
virtual void ActivatePage( const SfxItemSet& rSet ) override;
virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
void SetColorList( XColorListRef const & pColorList ) { m_pColorList = pColorList; }
void SetGradientList( XGradientListRef const & pGrdLst)
{ m_pGradientList = pGrdLst; }
void SetHatchingList( XHatchListRef const & pHtchLst)
{ m_pHatchingList = pHtchLst; }
void SetBitmapList( XBitmapListRef const & pBmpLst) { m_pBitmapList = pBmpLst; }
void SetPatternList( XPatternListRef const &pPtrnLst ) { m_pPatternList = pPtrnLst; }
virtual void PageCreated(const SfxAllItemSet& aSet) override;
void SetColorChgd( ChangeType* pIn ) { m_pnColorListState = pIn; }
};
class SvxShadowTabPage : public SvxTabPage
{
static const WhichRangesContainer pShadowRanges;
private:
const SfxItemSet& m_rOutAttrs;
XColorListRef m_pColorList;
ChangeType* m_pnColorListState;
PageType m_nPageType;
sal_uInt16 m_nDlgType;
SfxItemSet m_aFillAttributeSet;
MapUnit m_ePoolUnit;
SvxRectCtl m_aCtlPosition;
SvxXShadowPreview m_aCtlXRectPreview;
std::unique_ptr<weld::CheckButton> m_xTsbShowShadow;
std::unique_ptr<weld::Widget> m_xGridShadow;
std::unique_ptr<weld::MetricSpinButton> m_xMtrDistance;
std::unique_ptr<ColorListBox> m_xLbShadowColor;
std::unique_ptr<weld::MetricSpinButton> m_xMtrTransparent;
std::unique_ptr<weld::MetricSpinButton> m_xLbShadowBlurMetric;
std::unique_ptr<weld::CustomWeld> m_xCtlPosition;
std::unique_ptr<weld::CustomWeld> m_xCtlXRectPreview;
DECL_LINK(ClickShadowHdl_Impl, weld::Toggleable&, void);
DECL_LINK(ModifyShadowHdl_Impl, weld::MetricSpinButton&, void);
DECL_LINK(SelectShadowHdl_Impl, ColorListBox&, void);
public:
SvxShadowTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
virtual ~SvxShadowTabPage() override;
static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* );
static const WhichRangesContainer & GetRanges() { return pShadowRanges; }
virtual bool FillItemSet( SfxItemSet* ) override;
virtual void Reset( const SfxItemSet * ) override;
virtual void ActivatePage( const SfxItemSet& rSet ) override;
virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
virtual void PointChanged( weld::DrawingArea* pWindow, RectPoint eRP ) override;
void SetColorList( XColorListRef const & pColorList ) { m_pColorList = pColorList; }
void SetPageType( PageType nInType ) { m_nPageType = nInType; }
void SetDlgType( sal_uInt16 nInType ) { m_nDlgType = nInType; }
void SetColorChgd( ChangeType* pIn ) { m_pnColorListState = pIn; }
virtual void PageCreated(const SfxAllItemSet& aSet) override;
};
/************************************************************************/
class SvxGradientTabPage : public SfxTabPage
{
private:
const SfxItemSet& m_rOutAttrs;
XColorListRef m_pColorList;
XGradientListRef m_pGradientList;
ChangeType m_nGradientListState;
ChangeType* m_pnColorListState;
SfxItemSet m_aFillAttributeSet;
// MCGR: Preserve ColorStops until we have a UI to edit these
basegfx::BColorStops m_aColorStops;
SvxXRectPreview m_aCtlPreview;
std::unique_ptr<weld::ComboBox> m_xLbGradientType;
std::unique_ptr<weld::Label> m_xFtCenter;
std::unique_ptr<weld::MetricSpinButton> m_xMtrCenterX;
std::unique_ptr<weld::MetricSpinButton> m_xMtrCenterY;
std::unique_ptr<weld::Label> m_xFtAngle;
std::unique_ptr<weld::MetricSpinButton> m_xMtrAngle;
std::unique_ptr<weld::Scale> m_xSliderAngle;
std::unique_ptr<weld::MetricSpinButton> m_xMtrBorder;
std::unique_ptr<weld::Scale> m_xSliderBorder;
std::unique_ptr<ColorListBox> m_xLbColorFrom;
std::unique_ptr<weld::MetricSpinButton> m_xMtrColorFrom;
std::unique_ptr<ColorListBox> m_xLbColorTo;
std::unique_ptr<weld::MetricSpinButton> m_xMtrColorTo;
std::unique_ptr<weld::IconView> m_xGradientPresets;
std::unique_ptr<SvxPresetListBox> m_xGradientLB;
std::unique_ptr<weld::SpinButton> m_xMtrIncrement;
std::unique_ptr<weld::CheckButton> m_xCbIncrement;
std::unique_ptr<weld::Button> m_xBtnAdd;
std::unique_ptr<weld::Button> m_xBtnModify;
std::unique_ptr<weld::CustomWeld> m_xCtlPreview;
DECL_LINK( ClickAddHdl_Impl, weld::Button&, void );
DECL_LINK( ClickModifyHdl_Impl, weld::Button&, void );
DECL_LINK(ChangeGradientHdl, const weld::TreeIter&, bool);
void ChangeGradientHdl_Impl();
DECL_LINK(ClickRenameHdl_Impl, int, void);
DECL_LINK(ClickDeleteHdl_Impl, int, void);
DECL_LINK( ModifiedEditHdl_Impl, weld::SpinButton&, void );
DECL_LINK( ModifiedMetricHdl_Impl, weld::MetricSpinButton&, void );
DECL_LINK( ModifiedColorListBoxHdl_Impl, ColorListBox&, void );
DECL_LINK( ModifiedListBoxHdl_Impl, weld::ComboBox&, void );
DECL_LINK( ChangeAutoStepHdl_Impl, weld::Toggleable&, void );
DECL_LINK( ModifiedSliderHdl_Impl, weld::Scale&, void );
void ModifiedHdl_Impl(void const *);
void SetControlState_Impl( css::awt::GradientStyle eXGS );
sal_Int32 SearchGradientList(std::u16string_view rGradientName);
// MCGR: Preserve ColorStops until we have a UI to edit these
basegfx::BColorStops createColorStops();
public:
SvxGradientTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
virtual ~SvxGradientTabPage() override;
void Construct();
static std::unique_ptr<SvxGradientTabPage>
Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet&);
virtual bool FillItemSet( SfxItemSet* ) override;
virtual void Reset( const SfxItemSet * ) override;
virtual void ActivatePage( const SfxItemSet& rSet ) override;
virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
void SetColorList( XColorListRef const & pColorList ) { m_pColorList = pColorList; }
void SetGradientList( XGradientListRef const & pGrdLst)
{ m_pGradientList = pGrdLst; }
void SetColorChgd( ChangeType* pIn ) { m_pnColorListState = pIn; }
};
/************************************************************************/
class SvxHatchTabPage : public SfxTabPage
{
private:
const SfxItemSet& m_rOutAttrs;
XColorListRef m_pColorList;
XHatchListRef m_pHatchingList;
ChangeType m_nHatchingListState;
ChangeType* m_pnColorListState;
SfxItemSet m_aFillAttributeSet;
MapUnit m_ePoolUnit;
SvxXRectPreview m_aCtlPreview;
std::unique_ptr<weld::MetricSpinButton> m_xMtrDistance;
std::unique_ptr<weld::MetricSpinButton> m_xMtrAngle;
std::unique_ptr<weld::Scale> m_xSliderAngle;
std::unique_ptr<weld::ComboBox> m_xLbLineType;
std::unique_ptr<ColorListBox> m_xLbLineColor;
std::unique_ptr<weld::CheckButton> m_xCbBackgroundColor;
std::unique_ptr<ColorListBox> m_xLbBackgroundColor;
std::unique_ptr<weld::IconView> m_xHatchPresets;
std::unique_ptr<SvxPresetListBox> m_xHatchLB;
std::unique_ptr<weld::Button> m_xBtnAdd;
std::unique_ptr<weld::Button> m_xBtnModify;
std::unique_ptr<weld::CustomWeld> m_xCtlPreview;
DECL_LINK(ChangeHatchHdl, const weld::TreeIter&, bool);
void ChangeHatchHdl_Impl();
DECL_LINK( ModifiedEditHdl_Impl, weld::MetricSpinButton&, void );
DECL_LINK( ModifiedListBoxHdl_Impl, weld::ComboBox&, void );
DECL_LINK( ModifiedColorListBoxHdl_Impl, ColorListBox&, void );
DECL_LINK( ToggleHatchBackgroundColor_Impl, weld::Toggleable&, void );
DECL_LINK( ModifiedBackgroundHdl_Impl, ColorListBox&, void );
DECL_LINK( ModifiedSliderHdl_Impl, weld::Scale&, void );
void ModifiedHdl_Impl(void const *);
DECL_LINK( ClickAddHdl_Impl, weld::Button&, void );
DECL_LINK( ClickModifyHdl_Impl, weld::Button&, void );
DECL_LINK(ClickRenameHdl_Impl, int, void);
DECL_LINK(ClickDeleteHdl_Impl, int, void);
sal_Int32 SearchHatchList(std::u16string_view rHatchName);
void AddHatch(const OUString& aName, tools::Long nCount);
public:
SvxHatchTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
virtual ~SvxHatchTabPage() override;
void Construct();
static std::unique_ptr<SvxHatchTabPage>
Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet&);
virtual bool FillItemSet( SfxItemSet* ) override;
virtual void Reset( const SfxItemSet * ) override;
virtual void ActivatePage( const SfxItemSet& rSet ) override;
virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
void SetColorList( XColorListRef const & pColorList ) { m_pColorList = pColorList; }
void SetHatchingList( XHatchListRef const & pHtchLst)
{ m_pHatchingList = pHtchLst; }
void SetColorChgd( ChangeType* pIn ) { m_pnColorListState = pIn; }
};
/************************************************************************/
class SvxBitmapTabPage : public SfxTabPage
{
const SfxItemSet& m_rOutAttrs;
XBitmapListRef m_pBitmapList;
ChangeType m_nBitmapListState;
double m_fObjectWidth;
double m_fObjectHeight;
bool m_bLogicalSize;
SfxItemSet m_aFillAttributeSet;
const SdrView* mpView;
MapUnit mePoolUnit;
FieldUnit meFieldUnit;
Size m_aBitmapSize;
Size m_aFilledSize;
Size m_aZoomedSize;
SvxXRectPreview m_aCtlBitmapPreview;
std::unique_ptr<weld::IconView> m_xBitmapsPresets;
std::unique_ptr<SvxPresetListBox> m_xBitmapLB;
std::unique_ptr<weld::ComboBox> m_xBitmapStyleLB;
std::unique_ptr<weld::Container> m_xSizeBox;
std::unique_ptr<weld::CheckButton> m_xTsbScale;
std::unique_ptr<weld::MetricSpinButton> m_xBitmapWidth;
std::unique_ptr<weld::MetricSpinButton> m_xBitmapHeight;
std::unique_ptr<weld::Container> m_xPositionBox;
std::unique_ptr<weld::ComboBox> m_xPositionLB;
std::unique_ptr<weld::Container> m_xPositionOffBox;
std::unique_ptr<weld::MetricSpinButton> m_xPositionOffX;
std::unique_ptr<weld::MetricSpinButton> m_xPositionOffY;
std::unique_ptr<weld::Container> m_xTileOffBox;
std::unique_ptr<weld::ComboBox> m_xTileOffLB;
std::unique_ptr<weld::MetricSpinButton> m_xTileOffset;
std::unique_ptr<weld::Button> m_xBtnImport;
std::unique_ptr<weld::CustomWeld> m_xCtlBitmapPreview;
DECL_LINK(ModifyBitmapHdl, const weld::TreeIter&, bool);
DECL_LINK( ClickScaleHdl, weld::Toggleable&, void );
DECL_LINK( ModifyBitmapStyleHdl, weld::ComboBox&, void );
DECL_LINK( ModifyBitmapSizeHdl, weld::MetricSpinButton&, void );
DECL_LINK( ModifyBitmapPositionHdl, weld::ComboBox&, void );
DECL_LINK( ModifyPositionOffsetHdl, weld::MetricSpinButton&, void );
DECL_LINK( ModifyTileOffsetHdl, weld::MetricSpinButton&, void );
DECL_LINK(ClickRenameHdl, int, void);
DECL_LINK(ClickDeleteHdl, int, void);
DECL_LINK( ClickImportHdl, weld::Button&, void );
void CalculateBitmapPresetSize();
sal_Int32 SearchBitmapList(std::u16string_view rBitmapName);
sal_Int32 SearchBitmapList(const GraphicObject& rGraphicObject);
void UpdateBitmap();
tools::Long AddBitmap(const GraphicObject& rGraphicObject, const OUString& rName,
bool bOnlyForThisDocument = false);
public:
SvxBitmapTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
virtual ~SvxBitmapTabPage() override;
void Construct();
static std::unique_ptr<SvxBitmapTabPage>
Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet&);
virtual bool FillItemSet( SfxItemSet* ) override;
virtual void Reset( const SfxItemSet * ) override;
virtual void ActivatePage( const SfxItemSet& rSet ) override;
virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
void SetBitmapList( const XBitmapListRef& pBmpLst) { m_pBitmapList = pBmpLst; }
};
/************************************************************************/
class SvxPatternTabPage : public SvxTabPage
{
private:
const SfxItemSet& m_rOutAttrs;
XColorListRef m_pColorList;
XPatternListRef m_pPatternList;
ChangeType m_nPatternListState;
ChangeType* m_pnColorListState;
SfxItemSet m_aFillAttributeSet;
SvxXRectPreview m_aCtlPreview;
std::unique_ptr<SvxPixelCtl> m_xCtlPixel;
std::unique_ptr<ColorListBox> m_xLbColor;
std::unique_ptr<ColorListBox> m_xLbBackgroundColor;
std::unique_ptr<weld::IconView> m_xPatternPresets;
std::unique_ptr<SvxPresetListBox> m_xPatternLB;
std::unique_ptr<weld::Button> m_xBtnAdd;
std::unique_ptr<weld::Button> m_xBtnModify;
std::unique_ptr<weld::CustomWeld> m_xCtlPixelWin;
std::unique_ptr<weld::CustomWeld> m_xCtlPreview;
std::unique_ptr<SvxBitmapCtl> m_xBitmapCtl;
DECL_LINK( ClickAddHdl_Impl, weld::Button&, void );
DECL_LINK( ClickModifyHdl_Impl, weld::Button&, void );
DECL_LINK(ChangePatternHdl_Impl, const weld::TreeIter&, bool);
DECL_LINK( ChangeColorHdl_Impl, ColorListBox&, void );
DECL_LINK(ClickRenameHdl_Impl, int, void);
DECL_LINK(ClickDeleteHdl_Impl, int, void);
void UpdatePattern();
sal_Int32 SearchPatternList(std::u16string_view rPatternName);
public:
SvxPatternTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
virtual ~SvxPatternTabPage() override;
void Construct();
static std::unique_ptr<SvxPatternTabPage>
Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet&);
virtual bool FillItemSet( SfxItemSet* ) override;
virtual void Reset( const SfxItemSet * ) override;
virtual void ActivatePage( const SfxItemSet& rSet ) override;
virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
virtual void PointChanged( weld::DrawingArea*, RectPoint eRP ) override;
void SetColorList( XColorListRef const & pColorList ) { m_pColorList = pColorList; }
void SetPatternList( XPatternListRef const & pPatternList) { m_pPatternList = pPatternList; }
void SetColorChgd( ChangeType* pIn ) { m_pnColorListState = pIn; }
void ChangeColor_Impl();
};
/************************************************************************/
enum class ColorModel
{
RGB,
CMYK
};
class SvxColorTabPage : public SfxTabPage
{
private:
const SfxItemSet& m_rOutAttrs;
XColorListRef m_pColorList;
ChangeType* m_pnColorListState;
SfxItemSet m_aFillAttributeSet;
ColorModel m_eCM;
Color m_aPreviousColor;
NamedColor m_aCurrentColor;
PaletteManager maPaletteManager;
SvxXRectPreview m_aCtlPreviewOld;
SvxXRectPreview m_aCtlPreviewNew;
ColorIconView m_aColorIconView;
ColorIconView m_aRecentIconView;
std::unique_ptr<weld::ComboBox> m_xSelectPalette;
std::unique_ptr<weld::RadioButton> m_xRbRGB;
std::unique_ptr<weld::RadioButton> m_xRbCMYK;
std::unique_ptr<weld::Widget> m_xRGBcustom;
std::unique_ptr<weld::Widget> m_xRGBpreset;
std::unique_ptr<weld::Entry> m_xRpreset;
std::unique_ptr<weld::Entry> m_xGpreset;
std::unique_ptr<weld::Entry> m_xBpreset;
std::unique_ptr<weld::SpinButton> m_xRcustom;
std::unique_ptr<weld::SpinButton> m_xGcustom;
std::unique_ptr<weld::SpinButton> m_xBcustom;
std::unique_ptr<weld::HexColorControl> m_xHexpreset;
std::unique_ptr<weld::HexColorControl> m_xHexcustom;
std::unique_ptr<weld::Widget> m_xCMYKcustom;
std::unique_ptr<weld::Widget> m_xCMYKpreset;
std::unique_ptr<weld::Entry> m_xCpreset;
std::unique_ptr<weld::Entry> m_xYpreset;
std::unique_ptr<weld::Entry> m_xMpreset;
std::unique_ptr<weld::Entry> m_xKpreset;
std::unique_ptr<weld::MetricSpinButton> m_xCcustom;
std::unique_ptr<weld::MetricSpinButton> m_xYcustom;
std::unique_ptr<weld::MetricSpinButton> m_xMcustom;
std::unique_ptr<weld::MetricSpinButton> m_xKcustom;
std::unique_ptr<weld::Button> m_xBtnAdd;
std::unique_ptr<weld::Button> m_xBtnDelete;
std::unique_ptr<weld::Button> m_xBtnWorkOn;
std::unique_ptr<weld::Button> m_xMoreColors;
std::unique_ptr<weld::CustomWeld> m_xCtlPreviewOld;
std::unique_ptr<weld::CustomWeld> m_xCtlPreviewNew;
static void ConvertColorValues (Color& rColor, ColorModel eModel);
static void RgbToCmyk_Impl( Color& rColor, sal_uInt16& rK );
static void CmykToRgb_Impl( Color& rColor, const sal_uInt16 nKey );
sal_uInt16 ColorToPercent_Impl( sal_uInt16 nColor );
sal_uInt16 PercentToColor_Impl( sal_uInt16 nPercent );
void FillPaletteLB();
DECL_LINK(ClickAddHdl_Impl, weld::Button&, void);
DECL_LINK(ClickWorkOnHdl_Impl, weld::Button&, void);
DECL_LINK(ClickDeleteHdl_Impl, weld::Button&, void);
DECL_LINK(OnMoreColorsClick, weld::Button&, void);
DECL_LINK(SelectPaletteLBHdl, weld::ComboBox&, void);
DECL_LINK(ActivatePaletteColorHdl, int, void);
DECL_LINK(ActivateRecentColorHdl, int, void);
DECL_LINK( SelectColorModeHdl_Impl, weld::Toggleable&, void );
void UpdateToSelectedColor(const NamedColor& rNamedColor);
void ChangeColor(const NamedColor &rNewColor, bool bUpdatePreset = true);
void SetColorModel(ColorModel eModel);
void ChangeColorModel();
void UpdateColorValues( bool bUpdatePreset = true );
DECL_LINK(SpinValueHdl_Impl, weld::SpinButton&, void);
DECL_LINK(MetricSpinValueHdl_Impl, weld::MetricSpinButton&, void);
DECL_LINK(ModifiedHdl_Impl, weld::Entry&, void);
static sal_Int32 FindInCustomColors( std::u16string_view aColorName );
sal_Int32 FindInPalette( const Color& rColor );
public:
SvxColorTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
virtual ~SvxColorTabPage() override;
void Construct();
static std::unique_ptr<SvxColorTabPage>
Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet&);
virtual bool FillItemSet( SfxItemSet* ) override;
virtual void Reset( const SfxItemSet * ) override;
virtual void ActivatePage( const SfxItemSet& rSet ) override;
virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
void SetColorList( const XColorListRef& pColList );
void SetColorChgd(ChangeType* pIn) { m_pnColorListState = pIn; }
virtual void FillUserData() override;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */