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

weld SvxSwPosSizeTabPage

Change-Id: I51c83ec801884a07f7920309535a58b55171b0be
Reviewed-on: https://gerrit.libreoffice.org/54934Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 66cd438e
...@@ -20,12 +20,9 @@ ...@@ -20,12 +20,9 @@
#define INCLUDED_CUI_SOURCE_INC_SWPOSSIZETABPAGE_HXX #define INCLUDED_CUI_SOURCE_INC_SWPOSSIZETABPAGE_HXX
#include <sfx2/tabdlg.hxx> #include <sfx2/tabdlg.hxx>
#include <vcl/fixed.hxx>
#include <vcl/field.hxx>
#include <vcl/layout.hxx>
#include <vcl/lstbox.hxx>
#include <svx/swframeposstrings.hxx> #include <svx/swframeposstrings.hxx>
#include <svx/swframeexample.hxx> #include <svx/swframeexample.hxx>
#include <vcl/weld.hxx>
// SvxSwPosSizeTabPage - position and size page for Writer drawing objects // SvxSwPosSizeTabPage - position and size page for Writer drawing objects
struct FrmMap; struct FrmMap;
...@@ -37,40 +34,6 @@ class SvxSwPosSizeTabPage : public SfxTabPage ...@@ -37,40 +34,6 @@ class SvxSwPosSizeTabPage : public SfxTabPage
{ {
using TabPage::DeactivatePage; using TabPage::DeactivatePage;
VclPtr<MetricField> m_pWidthMF;
VclPtr<MetricField> m_pHeightMF;
VclPtr<CheckBox> m_pKeepRatioCB;
VclPtr<RadioButton> m_pToPageRB;
VclPtr<RadioButton> m_pToParaRB;
VclPtr<RadioButton> m_pToCharRB;
VclPtr<RadioButton> m_pAsCharRB;
VclPtr<RadioButton> m_pToFrameRB;
VclPtr<TriStateBox> m_pPositionCB;
VclPtr<TriStateBox> m_pSizeCB;
VclPtr<VclContainer> m_pPosFrame;
VclPtr<FixedText> m_pHoriFT;
VclPtr<ListBox> m_pHoriLB;
VclPtr<FixedText> m_pHoriByFT;
VclPtr<MetricField> m_pHoriByMF;
VclPtr<FixedText> m_pHoriToFT;
VclPtr<ListBox> m_pHoriToLB;
VclPtr<CheckBox> m_pHoriMirrorCB;
VclPtr<FixedText> m_pVertFT;
VclPtr<ListBox> m_pVertLB;
VclPtr<FixedText> m_pVertByFT;
VclPtr<MetricField> m_pVertByMF;
VclPtr<FixedText> m_pVertToFT;
VclPtr<ListBox> m_pVertToLB;
VclPtr<CheckBox> m_pFollowCB;
VclPtr<SvxSwFrameExample> m_pExampleWN;
Link<SvxSwFrameValidation&,void> m_aValidateLink; Link<SvxSwFrameValidation&,void> m_aValidateLink;
::tools::Rectangle m_aRect; //size of all selected objects ::tools::Rectangle m_aRect; //size of all selected objects
...@@ -95,24 +58,53 @@ class SvxSwPosSizeTabPage : public SfxTabPage ...@@ -95,24 +58,53 @@ class SvxSwPosSizeTabPage : public SfxTabPage
bool m_bIsInRightToLeft; bool m_bIsInRightToLeft;
TriState m_nProtectSizeState; TriState m_nProtectSizeState;
DECL_LINK(RangeModifyHdl, Control&, void); SwFrameExample m_aExampleWN;
DECL_LINK(RangeModifyClickHdl, Button*, void);
DECL_LINK(AnchorTypeHdl, Button*, void); std::unique_ptr<weld::MetricSpinButton> m_xWidthMF;
DECL_LINK( PosHdl, ListBox&, void ); std::unique_ptr<weld::MetricSpinButton> m_xHeightMF;
DECL_LINK( RelHdl, ListBox&, void ); std::unique_ptr<weld::CheckButton> m_xKeepRatioCB;
DECL_LINK(MirrorHdl, Button*, void); std::unique_ptr<weld::RadioButton> m_xToPageRB;
DECL_LINK( ModifyHdl, Edit&, void ); std::unique_ptr<weld::RadioButton> m_xToParaRB;
DECL_LINK(ProtectHdl, Button*, void); std::unique_ptr<weld::RadioButton> m_xToCharRB;
std::unique_ptr<weld::RadioButton> m_xAsCharRB;
std::unique_ptr<weld::RadioButton> m_xToFrameRB;
std::unique_ptr<weld::CheckButton> m_xPositionCB;
std::unique_ptr<weld::CheckButton> m_xSizeCB;
std::unique_ptr<weld::Widget> m_xPosFrame;
std::unique_ptr<weld::Label> m_xHoriFT;
std::unique_ptr<weld::ComboBoxText> m_xHoriLB;
std::unique_ptr<weld::Label> m_xHoriByFT;
std::unique_ptr<weld::MetricSpinButton> m_xHoriByMF;
std::unique_ptr<weld::Label> m_xHoriToFT;
std::unique_ptr<weld::ComboBoxText> m_xHoriToLB;
std::unique_ptr<weld::CheckButton> m_xHoriMirrorCB;
std::unique_ptr<weld::Label> m_xVertFT;
std::unique_ptr<weld::ComboBoxText> m_xVertLB;
std::unique_ptr<weld::Label> m_xVertByFT;
std::unique_ptr<weld::MetricSpinButton> m_xVertByMF;
std::unique_ptr<weld::Label> m_xVertToFT;
std::unique_ptr<weld::ComboBoxText> m_xVertToLB;
std::unique_ptr<weld::CheckButton> m_xFollowCB;
std::unique_ptr<weld::CustomWeld> m_xExampleWN;
DECL_LINK(RangeModifyHdl, weld::Widget&, void);
DECL_LINK(RangeModifyClickHdl, weld::ToggleButton&, void);
DECL_LINK(AnchorTypeHdl, weld::ToggleButton&, void);
DECL_LINK(PosHdl, weld::ComboBoxText&, void);
DECL_LINK(RelHdl, weld::ComboBoxText&, void);
DECL_LINK(MirrorHdl, weld::ToggleButton&, void);
DECL_LINK(ModifyHdl, weld::MetricSpinButton&, void);
DECL_LINK(ProtectHdl, weld::ToggleButton&, void);
void InitPos(RndStdIds nAnchorType, sal_uInt16 nH, sal_uInt16 nHRel, void InitPos(RndStdIds nAnchorType, sal_uInt16 nH, sal_uInt16 nHRel,
sal_uInt16 nV, sal_uInt16 nVRel, sal_uInt16 nV, sal_uInt16 nVRel,
long nX, long nY); long nX, long nY);
static sal_uInt16 GetMapPos(FrmMap const *pMap, ListBox const &rAlignLB); static sal_uInt16 GetMapPos(FrmMap const *pMap, const weld::ComboBoxText& rAlignLB);
static short GetAlignment(FrmMap const *pMap, sal_uInt16 nMapPos, ListBox const &rRelationLB); static short GetAlignment(FrmMap const *pMap, sal_uInt16 nMapPos, const weld::ComboBoxText& rRelationLB);
static short GetRelation(ListBox const &rRelationLB); static short GetRelation(const weld::ComboBoxText& rRelationLB);
RndStdIds GetAnchorType(bool* pbHasChanged = nullptr); RndStdIds GetAnchorType(bool* pbHasChanged = nullptr);
void FillRelLB(FrmMap const *pMap, sal_uInt16 nLBSelPos, sal_uInt16 nAlign, sal_uInt16 nRel, ListBox &rLB, FixedText &rFT); void FillRelLB(FrmMap const *pMap, sal_uInt16 nLBSelPos, sal_uInt16 nAlign, sal_uInt16 nRel, weld::ComboBoxText& rLB, weld::Label& rFT);
sal_uInt16 FillPosLB(FrmMap const *pMap, sal_uInt16 nAlign, const sal_uInt16 _nRel, ListBox &rLB); sal_uInt16 FillPosLB(FrmMap const *pMap, sal_uInt16 nAlign, const sal_uInt16 _nRel, weld::ComboBoxText& rLB);
void UpdateExample(); void UpdateExample();
...@@ -120,9 +112,8 @@ class SvxSwPosSizeTabPage : public SfxTabPage ...@@ -120,9 +112,8 @@ class SvxSwPosSizeTabPage : public SfxTabPage
void setOptimalRelWidth(); void setOptimalRelWidth();
public: public:
SvxSwPosSizeTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs ); SvxSwPosSizeTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs);
virtual ~SvxSwPosSizeTabPage() override; virtual ~SvxSwPosSizeTabPage() override;
virtual void dispose() override;
static VclPtr<SfxTabPage> Create( TabPageParent, const SfxItemSet* ); static VclPtr<SfxTabPage> Create( TabPageParent, const SfxItemSet* );
static const sal_uInt16* GetRanges(); static const sal_uInt16* GetRanges();
......
...@@ -19,11 +19,12 @@ ...@@ -19,11 +19,12 @@
#ifndef INCLUDED_SVX_SWFRAMEEXAMPLE_HXX #ifndef INCLUDED_SVX_SWFRAMEEXAMPLE_HXX
#define INCLUDED_SVX_SWFRAMEEXAMPLE_HXX #define INCLUDED_SVX_SWFRAMEEXAMPLE_HXX
#include <vcl/window.hxx>
#include <tools/color.hxx> #include <tools/color.hxx>
#include <tools/gen.hxx> #include <tools/gen.hxx>
#include <svx/svxdllapi.h> #include <svx/svxdllapi.h>
#include <svx/swframetypes.hxx> #include <svx/swframetypes.hxx>
#include <vcl/customweld.hxx>
#include <vcl/window.hxx>
#include <com/sun/star/text/WrapTextMode.hpp> #include <com/sun/star/text/WrapTextMode.hpp>
class SVX_DLLPUBLIC SvxSwFrameExample : public vcl::Window class SVX_DLLPUBLIC SvxSwFrameExample : public vcl::Window
...@@ -87,6 +88,68 @@ public: ...@@ -87,6 +88,68 @@ public:
void SetRelPos(const Point& rP); void SetRelPos(const Point& rP);
}; };
class SVX_DLLPUBLIC SwFrameExample : public weld::CustomWidgetController
{
Color m_aTransColor; ///< transparency
Color m_aBgCol; ///< background
Color m_aFrameColor; ///< graphic frame
Color m_aAlignColor; ///< align anchor
Color m_aBorderCol; ///< frame of doc
Color m_aPrintAreaCol; ///< frame of printable area of doc
Color m_aTxtCol; ///< symbolised text
Color m_aBlankCol; ///< area of symbol for blank
Color m_aBlankFrameCol; ///< frame of symbol for blank
tools::Rectangle aPage;
tools::Rectangle aPagePrtArea;
tools::Rectangle aTextLine;
tools::Rectangle aPara;
tools::Rectangle aParaPrtArea;
tools::Rectangle aFrameAtFrame;
tools::Rectangle aDrawObj;
tools::Rectangle aAutoCharFrame;
Size aFrmSize;
short nHAlign;
short nHRel;
short nVAlign;
short nVRel;
css::text::WrapTextMode nWrap;
RndStdIds nAnchor;
bool bTrans;
Point aRelPos;
void InitColors_Impl();
void InitAllRects_Impl(vcl::RenderContext& rRenderContext);
void CalcBoundRect_Impl(vcl::RenderContext& rRenderContext, tools::Rectangle &rRect);
tools::Rectangle DrawInnerFrame_Impl(vcl::RenderContext& rRenderContext, const tools::Rectangle &rRect, const Color &rFillColor, const Color &rBorderColor);
virtual void StyleUpdated() override;
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override;
public:
SwFrameExample();
virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
void SetWrap(css::text::WrapTextMode nW) { nWrap = nW; }
void SetHAlign(short nH) { nHAlign = nH; }
void SetHoriRel(short nR) { nHRel = nR; }
void SetVAlign(short nV) { nVAlign = nV; }
void SetVertRel(short nR) { nVRel = nR; }
void SetTransparent(bool bT) { bTrans = bT; }
void SetAnchor(RndStdIds nA) { nAnchor = nA; }
void SetRelPos(const Point& rP);
};
#endif // INCLUDED_SVX_SWFRAMEEXAMPLE_HXX #endif // INCLUDED_SVX_SWFRAMEEXAMPLE_HXX
......
...@@ -684,7 +684,7 @@ public: ...@@ -684,7 +684,7 @@ public:
} }
void set_help_id(const OString& rName) { m_xSpinButton->set_help_id(rName); } void set_help_id(const OString& rName) { m_xSpinButton->set_help_id(rName); }
void set_position(int nCursorPos) { m_xSpinButton->set_position(nCursorPos); } void set_position(int nCursorPos) { m_xSpinButton->set_position(nCursorPos); }
const weld::SpinButton* get_widget() const { return m_xSpinButton.get(); } weld::SpinButton& get_widget() { return *m_xSpinButton; }
}; };
class VCL_DLLPUBLIC TimeSpinButton class VCL_DLLPUBLIC TimeSpinButton
...@@ -741,7 +741,7 @@ public: ...@@ -741,7 +741,7 @@ public:
return m_xSpinButton->get_value_changed_from_saved(); return m_xSpinButton->get_value_changed_from_saved();
} }
void set_position(int nCursorPos) { m_xSpinButton->set_position(nCursorPos); } void set_position(int nCursorPos) { m_xSpinButton->set_position(nCursorPos); }
weld::SpinButton* get_widget() { return m_xSpinButton.get(); } weld::SpinButton& get_widget() { return *m_xSpinButton; }
}; };
class VCL_DLLPUBLIC Label : virtual public Widget class VCL_DLLPUBLIC Label : virtual public Widget
......
...@@ -635,13 +635,13 @@ IMPL_LINK( SmDistanceDialog, GetFocusHdl, weld::Widget&, rControl, void ) ...@@ -635,13 +635,13 @@ IMPL_LINK( SmDistanceDialog, GetFocusHdl, weld::Widget&, rControl, void )
{ {
sal_uInt16 i; sal_uInt16 i;
if (&rControl == m_xMetricField1->get_widget()) if (&rControl == &m_xMetricField1->get_widget())
i = 0; i = 0;
else if (&rControl == m_xMetricField2->get_widget()) else if (&rControl == &m_xMetricField2->get_widget())
i = 1; i = 1;
else if (&rControl == m_xMetricField3->get_widget()) else if (&rControl == &m_xMetricField3->get_widget())
i = 2; i = 2;
else if (&rControl == m_xMetricField4->get_widget()) else if (&rControl == &m_xMetricField4->get_widget())
i = 3; i = 3;
else else
return; return;
......
...@@ -2304,9 +2304,8 @@ public: ...@@ -2304,9 +2304,8 @@ public:
bool bTakeOwnership) override bool bTakeOwnership) override
{ {
weld::TimeSpinButton* pRet = new weld::TimeSpinButton(weld_spin_button(id, bTakeOwnership), eFormat); weld::TimeSpinButton* pRet = new weld::TimeSpinButton(weld_spin_button(id, bTakeOwnership), eFormat);
SalInstanceSpinButton* pButton = dynamic_cast<SalInstanceSpinButton*>(pRet->get_widget()); SalInstanceSpinButton& rButton = dynamic_cast<SalInstanceSpinButton&>(pRet->get_widget());
assert(pButton); rButton.DisableRemainderFactor(); //so with hh::mm::ss, incrementing mm will not reset ss
pButton->DisableRemainderFactor(); //so with hh::mm::ss, incrementing mm will not reset ss
return pRet; return pRet;
} }
......
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