Kaydet (Commit) 0af04819 authored tarafından Caolán McNamara's avatar Caolán McNamara

weld SvxHFPage

Change-Id: I9e39e276c64da4fca01ff79ebbb42d6f342f0379
Reviewed-on: https://gerrit.libreoffice.org/55863
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 5d680efb
......@@ -21,6 +21,7 @@
#include <sfx2/tabdlg.hxx>
#include <vcl/customweld.hxx>
#include <vcl/fixed.hxx>
#include <vcl/field.hxx>
#include <vcl/group.hxx>
......@@ -47,7 +48,6 @@ public:
virtual void Reset( const SfxItemSet* rSet ) override;
virtual ~SvxHFPage() override;
virtual void dispose() override;
void DisableDeleteQueryBox() { mbDisableQueryBox = true; }
......@@ -61,37 +61,36 @@ protected:
virtual void ActivatePage( const SfxItemSet& rSet ) override;
virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
SvxHFPage( vcl::Window* pParent, const SfxItemSet& rSet, sal_uInt16 nSetId );
VclPtr<FixedText> m_pPageLbl;
VclPtr<CheckBox> m_pTurnOnBox;
VclPtr<CheckBox> m_pCntSharedBox;
VclPtr<CheckBox> m_pCntSharedFirstBox;
VclPtr<FixedText> m_pLMLbl;
VclPtr<MetricField> m_pLMEdit;
VclPtr<FixedText> m_pRMLbl;
VclPtr<MetricField> m_pRMEdit;
VclPtr<FixedText> m_pDistFT;
VclPtr<MetricField> m_pDistEdit;
VclPtr<CheckBox> m_pDynSpacingCB;
VclPtr<FixedText> m_pHeightFT;
VclPtr<MetricField> m_pHeightEdit;
VclPtr<CheckBox> m_pHeightDynBtn;
VclPtr<SvxPageWindow> m_pBspWin;
VclPtr<PushButton> m_pBackgroundBtn;
SvxHFPage(TabPageParent pParent, const SfxItemSet& rSet, sal_uInt16 nSetId);
sal_uInt16 nId;
std::unique_ptr<SfxItemSet> pBBSet;
bool mbDisableQueryBox : 1;
bool mbEnableDrawingLayerFillStyles : 1;
PageWindow m_aBspWin;
std::unique_ptr<weld::Label> m_xPageLbl;
std::unique_ptr<weld::CheckButton> m_xTurnOnBox;
std::unique_ptr<weld::CheckButton> m_xCntSharedBox;
std::unique_ptr<weld::CheckButton> m_xCntSharedFirstBox;
std::unique_ptr<weld::Label> m_xLMLbl;
std::unique_ptr<weld::MetricSpinButton>m_xLMEdit;
std::unique_ptr<weld::Label> m_xRMLbl;
std::unique_ptr<weld::MetricSpinButton> m_xRMEdit;
std::unique_ptr<weld::Label> m_xDistFT;
std::unique_ptr<weld::MetricSpinButton> m_xDistEdit;
std::unique_ptr<weld::CheckButton> m_xDynSpacingCB;
std::unique_ptr<weld::Label> m_xHeightFT;
std::unique_ptr<weld::MetricSpinButton> m_xHeightEdit;
std::unique_ptr<weld::CheckButton> m_xHeightDynBtn;
std::unique_ptr<weld::Button> m_xBackgroundBtn;
std::unique_ptr<weld::CustomWeld> m_xBspWin;
void InitHandler();
DECL_LINK(TurnOnHdl, Button*, void);
DECL_LINK(DistModify, Edit&, void);
DECL_LINK(HeightModify, Edit&, void);
DECL_LINK(BorderModify, Edit&, void);
DECL_LINK(BackgroundHdl, Button*, void);
DECL_LINK(RangeFocusHdl, Control&, void);
void TurnOn(weld::ToggleButton* pButton);
DECL_LINK(TurnOnHdl, weld::ToggleButton&, void);
DECL_LINK(BackgroundHdl, weld::Button&, void);
DECL_LINK(ValueChangeHdl, weld::MetricSpinButton&, void);
void RangeHdl();
void UpdateExample();
......
......@@ -19,6 +19,7 @@
#ifndef INCLUDED_SVX_PAGECTRL_HXX
#define INCLUDED_SVX_PAGECTRL_HXX
#include <vcl/customweld.hxx>
#include <vcl/window.hxx>
#include <svx/svxdllapi.h>
#include <svx/sdr/attribute/sdrallfillattributeshelper.hxx>
......@@ -152,6 +153,128 @@ public:
virtual Size GetOptimalSize() const override;
};
class SVX_DLLPUBLIC PageWindow : public weld::CustomWidgetController
{
private:
Size aWinSize;
Size aSize;
long nTop;
long nBottom;
long nLeft;
long nRight;
bool bResetBackground;
bool bFrameDirection;
SvxFrameDirection nFrameDirection;
long nHdLeft;
long nHdRight;
long nHdDist;
long nHdHeight;
long nFtLeft;
long nFtRight;
long nFtDist;
long nFtHeight;
drawinglayer::attribute::SdrAllFillAttributesHelperPtr maHeaderFillAttributes;
drawinglayer::attribute::SdrAllFillAttributesHelperPtr maFooterFillAttributes;
drawinglayer::attribute::SdrAllFillAttributesHelperPtr maPageFillAttributes;
bool bFooter : 1;
bool bHeader : 1;
bool bTable : 1;
bool bHorz : 1;
bool bVert : 1;
SvxPageUsage eUsage;
protected:
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
virtual void DrawPage(vcl::RenderContext& rRenderContext, const Point& rPoint,
const bool bSecond, const bool bEnabled);
void drawFillAttributes(vcl::RenderContext& rRenderContext,
const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes,
const tools::Rectangle& rPaintRange, const tools::Rectangle& rDefineRange);
public:
PageWindow();
virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
virtual ~PageWindow() override;
void setHeaderFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes)
{
maHeaderFillAttributes = rFillAttributes;
}
void setFooterFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes)
{
maFooterFillAttributes = rFillAttributes;
}
void setPageFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes)
{
maPageFillAttributes = rFillAttributes;
}
const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& getPageFillAttributes() const
{
return maPageFillAttributes;
}
void SetSize(const Size& rSize)
{
aSize = rSize;
}
const Size& GetSize() const
{
return aSize;
}
void SetTop(long nNew) { nTop = nNew; }
void SetBottom(long nNew) { nBottom = nNew; }
void SetLeft(long nNew) { nLeft = nNew; }
void SetRight(long nNew) { nRight = nNew; }
long GetTop() const { return nTop; }
long GetBottom() const { return nBottom; }
long GetLeft() const { return nLeft; }
long GetRight() const { return nRight; }
void SetHdLeft(long nNew) { nHdLeft = nNew; }
void SetHdRight(long nNew) { nHdRight = nNew; }
void SetHdDist(long nNew) { nHdDist = nNew; }
void SetHdHeight(long nNew) { nHdHeight = nNew; }
long GetHdLeft() const { return nHdLeft; }
long GetHdRight() const { return nHdRight; }
long GetHdDist() const { return nHdDist; }
long GetHdHeight() const { return nHdHeight; }
void SetFtLeft(long nNew) { nFtLeft = nNew; }
void SetFtRight(long nNew) { nFtRight = nNew; }
void SetFtDist(long nNew) { nFtDist = nNew; }
void SetFtHeight(long nNew) { nFtHeight = nNew; }
long GetFtLeft() const { return nFtLeft; }
long GetFtRight() const { return nFtRight; }
long GetFtDist() const { return nFtDist; }
long GetFtHeight() const { return nFtHeight; }
void SetUsage(SvxPageUsage eU) { eUsage = eU; }
SvxPageUsage GetUsage() const { return eUsage; }
void SetHeader( bool bNew ) { bHeader = bNew; }
void SetFooter( bool bNew ) { bFooter = bNew; }
void SetTable( bool bNew ) { bTable = bNew; }
void SetHorz( bool bNew ) { bHorz = bNew; }
void SetVert( bool bNew ) { bVert = bNew; }
void EnableFrameDirection(bool bEnable);
void SetFrameDirection(SvxFrameDirection nDirection);
void ResetBackground();
};
#endif // INCLUDED_SVX_PAGECTRL_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -37,9 +37,7 @@ public:
void SetStyleDlg ( ScStyleDlg* pDlg ) { pStyleDlg = pDlg; }
protected:
ScHFPage( vcl::Window* pParent,
const SfxItemSet& rSet,
sal_uInt16 nSetId );
ScHFPage(TabPageParent pParent, const SfxItemSet& rSet, sal_uInt16 nSetId);
virtual void ActivatePage() override;
virtual void DeactivatePage() override;
......@@ -47,15 +45,15 @@ protected:
virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
private:
VclPtr<PushButton> m_pBtnEdit;
SfxItemSet aDataSet;
OUString aStrPageStyle;
SvxPageUsage nPageUsage;
VclPtr<ScStyleDlg> pStyleDlg;
std::unique_ptr<weld::Button> m_xBtnEdit;
DECL_LINK( BtnHdl, Button*, void );
DECL_LINK(BtnHdl, weld::Button&, void);
DECL_LINK( HFEditHdl, void*, void );
DECL_LINK( TurnOnHdl, Button*, void );
DECL_LINK(TurnOnHdl, weld::ToggleButton&, void);
};
class ScHeaderPage : public ScHFPage
......
......@@ -41,24 +41,18 @@
// class ScHFPage
ScHFPage::ScHFPage( vcl::Window* pParent, const SfxItemSet& rSet, sal_uInt16 nSetId )
: SvxHFPage ( pParent, rSet, nSetId ),
aDataSet(
*rSet.GetPool(),
svl::Items<
ATTR_PAGE, ATTR_PAGE,
ATTR_PAGE_HEADERLEFT, ATTR_PAGE_FOOTERRIGHT>{}),
nPageUsage ( SvxPageUsage::All ),
pStyleDlg ( nullptr )
ScHFPage::ScHFPage(TabPageParent pParent, const SfxItemSet& rSet, sal_uInt16 nSetId)
: SvxHFPage(pParent, rSet, nSetId)
, aDataSet(*rSet.GetPool(), svl::Items<ATTR_PAGE, ATTR_PAGE, ATTR_PAGE_HEADERLEFT, ATTR_PAGE_FOOTERRIGHT>{})
, nPageUsage(SvxPageUsage::All)
, pStyleDlg(nullptr)
, m_xBtnEdit(m_xBuilder->weld_button("buttonEdit"))
{
get(m_pBtnEdit, "buttonEdit");
SetExchangeSupport();
SfxViewShell* pSh = SfxViewShell::Current();
ScTabViewShell* pViewSh = dynamic_cast< ScTabViewShell *>( pSh );
m_pBtnEdit->Show();
m_xBtnEdit->show();
aDataSet.Put( rSet );
......@@ -70,13 +64,13 @@ ScHFPage::ScHFPage( vcl::Window* pParent, const SfxItemSet& rSet, sal_uInt16 nSe
aStrPageStyle = pDoc->GetPageStyle( rViewData.GetTabNo() );
}
m_pBtnEdit->SetClickHdl ( LINK( this, ScHFPage, BtnHdl ) );
m_pTurnOnBox->SetClickHdl ( LINK( this, ScHFPage, TurnOnHdl ) );
m_xBtnEdit->connect_clicked(LINK(this, ScHFPage, BtnHdl));
m_xTurnOnBox->connect_toggled(LINK(this, ScHFPage, TurnOnHdl));
if ( nId == SID_ATTR_PAGE_HEADERSET )
m_pBtnEdit->SetHelpId( HID_SC_HEADER_EDIT );
m_xBtnEdit->set_help_id(HID_SC_HEADER_EDIT);
else
m_pBtnEdit->SetHelpId( HID_SC_FOOTER_EDIT );
m_xBtnEdit->set_help_id(HID_SC_FOOTER_EDIT);
}
ScHFPage::~ScHFPage()
......@@ -86,7 +80,6 @@ ScHFPage::~ScHFPage()
void ScHFPage::dispose()
{
m_pBtnEdit.clear();
pStyleDlg.clear();
SvxHFPage::dispose();
}
......@@ -94,7 +87,7 @@ void ScHFPage::dispose()
void ScHFPage::Reset( const SfxItemSet* rSet )
{
SvxHFPage::Reset( rSet );
TurnOnHdl( nullptr );
TurnOnHdl(*m_xTurnOnBox);
}
bool ScHFPage::FillItemSet( SfxItemSet* rOutSet )
......@@ -150,17 +143,17 @@ void ScHFPage::DeactivatePage()
// Handler:
IMPL_LINK_NOARG(ScHFPage, TurnOnHdl, Button*, void)
IMPL_LINK_NOARG(ScHFPage, TurnOnHdl, weld::ToggleButton&, void)
{
SvxHFPage::TurnOnHdl( m_pTurnOnBox );
SvxHFPage::TurnOnHdl(*m_xTurnOnBox);
if ( m_pTurnOnBox->IsChecked() )
m_pBtnEdit->Enable();
if (m_xTurnOnBox->get_active())
m_xBtnEdit->set_sensitive(true);
else
m_pBtnEdit->Disable();
m_xBtnEdit->set_sensitive(false);
}
IMPL_LINK_NOARG(ScHFPage, BtnHdl, Button*, void)
IMPL_LINK_NOARG(ScHFPage, BtnHdl, weld::Button&, void)
{
// When the Edit-Dialog is directly called from the Button's Click-Handler,
// the GrabFocus from the Edit-Dialog under OS/2 doesn't work.(Bug #41805#).
......@@ -179,8 +172,7 @@ IMPL_LINK_NOARG(ScHFPage, HFEditHdl, void*, void)
return;
}
if ( m_pCntSharedBox->IsEnabled()
&& !m_pCntSharedBox->IsChecked() )
if (m_xCntSharedBox->get_sensitive() && !m_xCntSharedBox->get_active())
{
sal_uInt16 nResId = ( nId == SID_ATTR_PAGE_HEADERSET )
? RID_SCDLG_HFED_HEADER
......@@ -200,8 +192,7 @@ IMPL_LINK_NOARG(ScHFPage, HFEditHdl, void*, void)
{
OUString aText;
VclPtrInstance< SfxSingleTabDialog > pDlg(this, aDataSet);
bool bRightPage = m_pCntSharedBox->IsChecked()
|| ( SvxPageUsage::Left != nPageUsage );
bool bRightPage = m_xCntSharedBox->get_active() || (SvxPageUsage::Left != nPageUsage);
if ( nId == SID_ATTR_PAGE_HEADERSET )
{
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment