summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cui/source/inc/backgrnd.hxx1
-rw-r--r--cui/source/inc/cuitabarea.hxx6
-rw-r--r--cui/source/inc/cuitabline.hxx1
-rw-r--r--cui/source/inc/dstribut.hxx1
-rw-r--r--cui/source/inc/measure.hxx1
-rw-r--r--cui/source/inc/textattr.hxx45
-rw-r--r--cui/source/inc/transfrm.hxx3
-rw-r--r--cui/source/tabpages/backgrnd.cxx7
-rw-r--r--cui/source/tabpages/dstribut.cxx4
-rw-r--r--cui/source/tabpages/measure.cxx5
-rw-r--r--cui/source/tabpages/textattr.cxx363
-rw-r--r--cui/source/tabpages/tparea.cxx4
-rw-r--r--cui/source/tabpages/tpbitmap.cxx4
-rw-r--r--cui/source/tabpages/tphatch.cxx4
-rw-r--r--cui/source/tabpages/tpline.cxx4
-rw-r--r--cui/source/tabpages/tppattern.cxx13
-rw-r--r--cui/source/tabpages/tpshadow.cxx6
-rw-r--r--cui/source/tabpages/tptrans.cxx3
-rw-r--r--cui/source/tabpages/transfrm.cxx17
-rw-r--r--cui/uiconfig/ui/textattrtabpage.ui77
-rw-r--r--include/svx/dlgctrl.hxx82
-rw-r--r--include/vcl/layout.hxx14
-rw-r--r--include/vcl/weld.hxx6
-rw-r--r--svx/source/accessibility/charmapacc.cxx26
-rw-r--r--svx/source/accessibility/svxrectctaccessiblecontext.cxx544
-rw-r--r--svx/source/dialog/dlgctrl.cxx521
-rw-r--r--svx/source/inc/charmapacc.hxx1
-rw-r--r--svx/source/inc/svxrectctaccessiblecontext.hxx203
-rw-r--r--vcl/source/app/salvtables.cxx33
-rw-r--r--vcl/unx/gtk/a11y/atkwrapper.cxx13
-rw-r--r--vcl/unx/gtk/a11y/atkwrapper.hxx3
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx30
32 files changed, 1778 insertions, 267 deletions
diff --git a/cui/source/inc/backgrnd.hxx b/cui/source/inc/backgrnd.hxx
index 8f5a9c96ff2a..a67caba32a2a 100644
--- a/cui/source/inc/backgrnd.hxx
+++ b/cui/source/inc/backgrnd.hxx
@@ -57,6 +57,7 @@ public:
virtual void Reset( const SfxItemSet* rSet ) override;
virtual void FillUserData() override;
virtual void PointChanged( vcl::Window* pWindow, RectPoint eRP ) override;
+ virtual void PointChanged( weld::DrawingArea* pWindow, RectPoint eRP ) override;
/// Shift-ListBox activation
void ShowSelector();
diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx
index ce7fea8d96e8..2790b5323888 100644
--- a/cui/source/inc/cuitabarea.hxx
+++ b/cui/source/inc/cuitabarea.hxx
@@ -204,6 +204,7 @@ public:
virtual void ActivatePage(const SfxItemSet& rSet) override;
virtual DeactivateRC DeactivatePage(SfxItemSet* pSet) override;
virtual void PointChanged(vcl::Window* pWindow, RectPoint eRP) override;
+ virtual void PointChanged(weld::DrawingArea* pWindow, RectPoint eRP) override;
void SetPageType(PageType nInType) { nPageType = nInType; }
void SetDlgType(sal_uInt16 nInType) { nDlgType = nInType; }
@@ -271,6 +272,7 @@ public:
virtual void ActivatePage( const SfxItemSet& rSet ) override;
virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
virtual void PointChanged( vcl::Window* pWindow, RectPoint eRP ) override;
+ virtual void PointChanged( weld::DrawingArea* pWindow, RectPoint eRP ) override;
void SetColorList( XColorListRef const & pColorList ) { m_pColorList = pColorList; }
void SetGradientList( XGradientListRef const & pGrdLst)
@@ -332,6 +334,7 @@ public:
virtual void ActivatePage( const SfxItemSet& rSet ) override;
virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
virtual void PointChanged( vcl::Window* pWindow, RectPoint eRP ) 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; }
@@ -481,6 +484,7 @@ public:
virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
virtual void PointChanged( vcl::Window* pWindow, RectPoint eRP ) override;
+ virtual void PointChanged( weld::DrawingArea* pWindow, RectPoint eRP ) override;
void SetColorList( XColorListRef const & pColorList ) { m_pColorList = pColorList; }
void SetHatchingList( XHatchListRef const & pHtchLst)
@@ -564,6 +568,7 @@ public:
virtual void ActivatePage( const SfxItemSet& rSet ) override;
virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
virtual void PointChanged( vcl::Window* pWindow, RectPoint eRP ) override;
+ virtual void PointChanged( weld::DrawingArea*, RectPoint eRP ) override;
void SetBitmapList( const XBitmapListRef& pBmpLst) { m_pBitmapList = pBmpLst; }
void SetBmpChgd( ChangeType* pIn ) { m_pnBitmapListState = pIn; }
@@ -623,6 +628,7 @@ public:
virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
virtual void PointChanged( vcl::Window* pWindow, RectPoint eRP ) 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; }
diff --git a/cui/source/inc/cuitabline.hxx b/cui/source/inc/cuitabline.hxx
index eadb4e038f69..89c5ec790bb8 100644
--- a/cui/source/inc/cuitabline.hxx
+++ b/cui/source/inc/cuitabline.hxx
@@ -212,6 +212,7 @@ public:
virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
virtual void PointChanged( vcl::Window* pWindow, RectPoint eRP ) override;
+ virtual void PointChanged( weld::DrawingArea* pWindow, RectPoint eRP ) override;
virtual void FillUserData() override;
diff --git a/cui/source/inc/dstribut.hxx b/cui/source/inc/dstribut.hxx
index 0923746a2eca..a065fcf6c74f 100644
--- a/cui/source/inc/dstribut.hxx
+++ b/cui/source/inc/dstribut.hxx
@@ -50,6 +50,7 @@ public:
virtual bool FillItemSet(SfxItemSet*) override;
virtual void Reset(const SfxItemSet*) override;
virtual void PointChanged(vcl::Window* pWindow, RectPoint eRP) override;
+ virtual void PointChanged(weld::DrawingArea* pWindow, RectPoint eRP) override;
SvxDistributeHorizontal GetDistributeHor() const { return m_eDistributeHor; }
SvxDistributeVertical GetDistributeVer() const { return m_eDistributeVer; }
diff --git a/cui/source/inc/measure.hxx b/cui/source/inc/measure.hxx
index 721f7d4f8244..2a9fb17d2b65 100644
--- a/cui/source/inc/measure.hxx
+++ b/cui/source/inc/measure.hxx
@@ -79,6 +79,7 @@ public:
virtual void Reset( const SfxItemSet * ) override;
virtual void PointChanged( vcl::Window* pWindow, RectPoint eRP ) override;
+ virtual void PointChanged( weld::DrawingArea* pWindow, RectPoint eRP ) override;
void Construct();
void SetView( const SdrView* pSdrView ) { pView = pSdrView; }
diff --git a/cui/source/inc/textattr.hxx b/cui/source/inc/textattr.hxx
index 5c96c71ab329..88a5f7d7113d 100644
--- a/cui/source/inc/textattr.hxx
+++ b/cui/source/inc/textattr.hxx
@@ -40,26 +40,6 @@ class SvxTextAttrPage : public SvxTabPage
private:
static const sal_uInt16 pRanges[];
- VclPtr<VclContainer> m_pDrawingText;
- VclPtr<VclContainer> m_pCustomShapeText;
-
- VclPtr<TriStateBox> m_pTsbAutoGrowWidth;
- VclPtr<TriStateBox> m_pTsbAutoGrowHeight;
- VclPtr<TriStateBox> m_pTsbFitToSize;
- VclPtr<TriStateBox> m_pTsbContour;
- VclPtr<TriStateBox> m_pTsbWordWrapText;
- VclPtr<TriStateBox> m_pTsbAutoGrowSize;
-
- VclPtr<VclFrame> m_pFlDistance;
- VclPtr<MetricField> m_pMtrFldLeft;
- VclPtr<MetricField> m_pMtrFldRight;
- VclPtr<MetricField> m_pMtrFldTop;
- VclPtr<MetricField> m_pMtrFldBottom;
-
- VclPtr<VclFrame> m_pFlPosition;
- VclPtr<SvxRectCtl> m_pCtlPosition;
- VclPtr<TriStateBox> m_pTsbFullWidth;
-
const SfxItemSet& rOutAttrs;
SdrObjKind m_eObjKind;
@@ -70,8 +50,25 @@ private:
bool bWordWrapTextEnabled;
bool bFitToSizeEnabled;
- DECL_LINK( ClickFullWidthHdl_Impl, Button*, void );
- DECL_LINK( ClickHdl_Impl, Button*, void );
+ std::unique_ptr<weld::Widget> m_xDrawingText;
+ std::unique_ptr<weld::Widget> m_xCustomShapeText;
+ std::unique_ptr<weld::CheckButton> m_xTsbAutoGrowWidth;
+ std::unique_ptr<weld::CheckButton> m_xTsbAutoGrowHeight;
+ std::unique_ptr<weld::CheckButton> m_xTsbFitToSize;
+ std::unique_ptr<weld::CheckButton> m_xTsbContour;
+ std::unique_ptr<weld::CheckButton> m_xTsbWordWrapText;
+ std::unique_ptr<weld::CheckButton> m_xTsbAutoGrowSize;
+ std::unique_ptr<weld::Frame> m_xFlDistance;
+ std::unique_ptr<weld::MetricSpinButton> m_xMtrFldLeft;
+ std::unique_ptr<weld::MetricSpinButton> m_xMtrFldRight;
+ std::unique_ptr<weld::MetricSpinButton> m_xMtrFldTop;
+ std::unique_ptr<weld::MetricSpinButton> m_xMtrFldBottom;
+ std::unique_ptr<weld::Frame> m_xFlPosition;
+ std::unique_ptr<RectCtl> m_xCtlPosition;
+ std::unique_ptr<weld::CheckButton> m_xTsbFullWidth;
+
+ DECL_LINK(ClickFullWidthHdl_Impl, weld::Button&, void);
+ DECL_LINK(ClickHdl_Impl, weld::Button&, void);
/** Return whether the text direction is from left to right (</sal_True>) or
top to bottom (</sal_False>).
@@ -80,9 +77,8 @@ private:
public:
- SvxTextAttrPage( vcl::Window* pWindow, const SfxItemSet& rInAttrs );
+ SvxTextAttrPage(TabPageParent pWindow, const SfxItemSet& rInAttrs);
virtual ~SvxTextAttrPage() override;
- virtual void dispose() override;
static VclPtr<SfxTabPage> Create( TabPageParent, const SfxItemSet* );
static const sal_uInt16* GetRanges() { return pRanges; }
@@ -91,6 +87,7 @@ public:
virtual void Reset( const SfxItemSet * ) override;
virtual void PointChanged( vcl::Window* pWindow, RectPoint eRP ) override;
+ virtual void PointChanged( weld::DrawingArea* pWindow, RectPoint eRP ) override;
void Construct();
void SetObjKind(SdrObjKind eObjKind) { m_eObjKind = eObjKind; }
diff --git a/cui/source/inc/transfrm.hxx b/cui/source/inc/transfrm.hxx
index 8a24987a8842..94fa4836de51 100644
--- a/cui/source/inc/transfrm.hxx
+++ b/cui/source/inc/transfrm.hxx
@@ -150,6 +150,7 @@ public:
virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
virtual void PointChanged( vcl::Window* pWindow, RectPoint eRP ) override;
+ virtual void PointChanged( weld::DrawingArea* pWindow, RectPoint eRP ) override;
void Construct();
void SetView( const SdrView* pSdrView ) { mpView = pSdrView; }
@@ -208,6 +209,7 @@ public:
virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
virtual void PointChanged( vcl::Window* pWindow, RectPoint eRP ) override;
+ virtual void PointChanged( weld::DrawingArea* pWindow, RectPoint eRP ) override;
void Construct();
void SetView( const SdrView* pSdrView ) { pView = pSdrView; }
@@ -261,6 +263,7 @@ public:
virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override;
virtual void PointChanged( vcl::Window* pWindow, RectPoint eRP ) override;
+ virtual void PointChanged( weld::DrawingArea* pWindow, RectPoint eRP ) override;
void Construct();
void SetView( const SdrView* pSdrView ) { pView = pSdrView; }
diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx
index 722b4a84624b..8e7243a98220 100644
--- a/cui/source/tabpages/backgrnd.cxx
+++ b/cui/source/tabpages/backgrnd.cxx
@@ -841,7 +841,12 @@ DeactivateRC SvxBackgroundTabPage::DeactivatePage( SfxItemSet* _pSet )
return DeactivateRC::LeavePage;
}
-void SvxBackgroundTabPage::PointChanged( vcl::Window* , RectPoint )
+void SvxBackgroundTabPage::PointChanged( vcl::Window*, RectPoint )
+{
+ // has to be implemented so that position control can work
+}
+
+void SvxBackgroundTabPage::PointChanged( weld::DrawingArea*, RectPoint )
{
// has to be implemented so that position control can work
}
diff --git a/cui/source/tabpages/dstribut.cxx b/cui/source/tabpages/dstribut.cxx
index bd6039f39974..e132a736d25b 100644
--- a/cui/source/tabpages/dstribut.cxx
+++ b/cui/source/tabpages/dstribut.cxx
@@ -102,6 +102,10 @@ void SvxDistributePage::PointChanged(vcl::Window* /*pWindow*/, RectPoint /*eRP*/
{
}
+void SvxDistributePage::PointChanged(weld::DrawingArea*, RectPoint /*eRP*/)
+{
+}
+
/*************************************************************************
|*
|* read the delivered Item-Set
diff --git a/cui/source/tabpages/measure.cxx b/cui/source/tabpages/measure.cxx
index 657cf6199b32..963544eef73f 100644
--- a/cui/source/tabpages/measure.cxx
+++ b/cui/source/tabpages/measure.cxx
@@ -619,6 +619,11 @@ void SvxMeasurePage::PointChanged( vcl::Window* pWindow, RectPoint /*eRP*/ )
ChangeAttrHdl_Impl( pWindow );
}
+void SvxMeasurePage::PointChanged( weld::DrawingArea*, RectPoint /*eRP*/ )
+{
+ ChangeAttrHdl_Impl( m_pCtlPosition );
+}
+
IMPL_LINK( SvxMeasurePage, ClickAutoPosHdl_Impl, Button*, p, void )
{
if( m_pTsbAutoPosH->GetState() == TRISTATE_TRUE )
diff --git a/cui/source/tabpages/textattr.cxx b/cui/source/tabpages/textattr.cxx
index 1fe363be96ca..092ef3966ffa 100644
--- a/cui/source/tabpages/textattr.cxx
+++ b/cui/source/tabpages/textattr.cxx
@@ -53,8 +53,8 @@ const sal_uInt16 SvxTextAttrPage::pRanges[] =
|* dialog (page) for copying objects
|*
\************************************************************************/
-SvxTextAttrPage::SvxTextAttrPage(vcl::Window* pWindow, const SfxItemSet& rInAttrs)
- : SvxTabPage(pWindow,"TextAttributesPage","cui/ui/textattrtabpage.ui", rInAttrs)
+SvxTextAttrPage::SvxTextAttrPage(TabPageParent pPage, const SfxItemSet& rInAttrs)
+ : SvxTabPage(pPage, "cui/ui/textattrtabpage.ui", "TextAttributesPage", rInAttrs)
, rOutAttrs(rInAttrs)
, m_eObjKind(OBJ_NONE)
, bAutoGrowSizeEnabled(false)
@@ -63,66 +63,43 @@ SvxTextAttrPage::SvxTextAttrPage(vcl::Window* pWindow, const SfxItemSet& rInAttr
, bAutoGrowHeightEnabled(false)
, bWordWrapTextEnabled(false)
, bFitToSizeEnabled(false)
+ , m_xDrawingText(m_xBuilder->weld_widget("drawingtext"))
+ , m_xCustomShapeText(m_xBuilder->weld_widget("customshapetext"))
+ , m_xTsbAutoGrowWidth(m_xBuilder->weld_check_button("TSB_AUTOGROW_WIDTH"))
+ , m_xTsbAutoGrowHeight(m_xBuilder->weld_check_button("TSB_AUTOGROW_HEIGHT"))
+ , m_xTsbFitToSize(m_xBuilder->weld_check_button("TSB_FIT_TO_SIZE"))
+ , m_xTsbContour(m_xBuilder->weld_check_button("TSB_CONTOUR"))
+ , m_xTsbWordWrapText(m_xBuilder->weld_check_button("TSB_WORDWRAP_TEXT"))
+ , m_xTsbAutoGrowSize(m_xBuilder->weld_check_button("TSB_AUTOGROW_SIZE"))
+ , m_xFlDistance(m_xBuilder->weld_frame("FL_DISTANCE"))
+ , m_xMtrFldLeft(m_xBuilder->weld_metric_spin_button("MTR_FLD_LEFT", FUNIT_CM))
+ , m_xMtrFldRight(m_xBuilder->weld_metric_spin_button("MTR_FLD_RIGHT", FUNIT_CM))
+ , m_xMtrFldTop(m_xBuilder->weld_metric_spin_button("MTR_FLD_TOP", FUNIT_CM))
+ , m_xMtrFldBottom(m_xBuilder->weld_metric_spin_button("MTR_FLD_BOTTOM", FUNIT_CM))
+ , m_xFlPosition(m_xBuilder->weld_frame("FL_POSITION"))
+ , m_xCtlPosition(new RectCtl(*m_xBuilder, "CTL_POSITION", this))
+ , m_xTsbFullWidth(m_xBuilder->weld_check_button("TSB_FULL_WIDTH"))
{
- get(m_pDrawingText, "drawingtext");
- get(m_pCustomShapeText, "customshapetext");
- get(m_pTsbAutoGrowWidth,"TSB_AUTOGROW_WIDTH");
- get(m_pTsbAutoGrowHeight,"TSB_AUTOGROW_HEIGHT");
- get(m_pTsbFitToSize,"TSB_FIT_TO_SIZE");
- get(m_pTsbContour,"TSB_CONTOUR");
- get(m_pTsbWordWrapText,"TSB_WORDWRAP_TEXT");
- get(m_pTsbAutoGrowSize,"TSB_AUTOGROW_SIZE");
- get(m_pFlDistance,"FL_DISTANCE");
- get(m_pMtrFldLeft,"MTR_FLD_LEFT");
- get(m_pMtrFldRight,"MTR_FLD_RIGHT");
- get(m_pMtrFldTop,"MTR_FLD_TOP");
- get(m_pMtrFldBottom,"MTR_FLD_BOTTOM");
- get(m_pFlPosition,"FL_POSITION");
- get(m_pCtlPosition,"CTL_POSITION");
- m_pCtlPosition->SetControlSettings(RectPoint::MM, 240, 100);
- get(m_pTsbFullWidth,"TSB_FULL_WIDTH");
-
+ m_xCtlPosition->SetControlSettings(RectPoint::MM, 240, 100);
FieldUnit eFUnit = GetModuleFieldUnit( rInAttrs );
- SetFieldUnit( *m_pMtrFldLeft, eFUnit );
- SetFieldUnit( *m_pMtrFldRight, eFUnit );
- SetFieldUnit( *m_pMtrFldTop, eFUnit );
- SetFieldUnit( *m_pMtrFldBottom, eFUnit );
-
- Link<Button*,void> aLink( LINK( this, SvxTextAttrPage, ClickHdl_Impl ) );
- m_pTsbAutoGrowWidth->SetClickHdl( aLink );
- m_pTsbAutoGrowHeight->SetClickHdl( aLink );
- m_pTsbAutoGrowSize->SetClickHdl( aLink );
- m_pTsbFitToSize->SetClickHdl( aLink );
- m_pTsbContour->SetClickHdl( aLink );
-
- m_pTsbFullWidth->SetClickHdl(LINK( this, SvxTextAttrPage, ClickFullWidthHdl_Impl ) );
+ SetFieldUnit( *m_xMtrFldLeft, eFUnit );
+ SetFieldUnit( *m_xMtrFldRight, eFUnit );
+ SetFieldUnit( *m_xMtrFldTop, eFUnit );
+ SetFieldUnit( *m_xMtrFldBottom, eFUnit );
+
+ Link<weld::Button&,void> aLink( LINK( this, SvxTextAttrPage, ClickHdl_Impl ) );
+ m_xTsbAutoGrowWidth->connect_clicked( aLink );
+ m_xTsbAutoGrowHeight->connect_clicked( aLink );
+ m_xTsbAutoGrowSize->connect_clicked( aLink );
+ m_xTsbFitToSize->connect_clicked( aLink );
+ m_xTsbContour->connect_clicked( aLink );
+
+ m_xTsbFullWidth->connect_clicked(LINK( this, SvxTextAttrPage, ClickFullWidthHdl_Impl ) );
}
SvxTextAttrPage::~SvxTextAttrPage()
{
- disposeOnce();
-}
-
-void SvxTextAttrPage::dispose()
-{
- m_pDrawingText.clear();
- m_pCustomShapeText.clear();
- m_pTsbAutoGrowWidth.clear();
- m_pTsbAutoGrowHeight.clear();
- m_pTsbFitToSize.clear();
- m_pTsbContour.clear();
- m_pTsbWordWrapText.clear();
- m_pTsbAutoGrowSize.clear();
- m_pFlDistance.clear();
- m_pMtrFldLeft.clear();
- m_pMtrFldRight.clear();
- m_pMtrFldTop.clear();
- m_pMtrFldBottom.clear();
- m_pFlPosition.clear();
- m_pCtlPosition.clear();
- m_pTsbFullWidth.clear();
- SvxTabPage::dispose();
}
/*************************************************************************
@@ -144,11 +121,11 @@ void SvxTextAttrPage::Reset( const SfxItemSet* rAttrs )
if( pItem )
{
long nValue = static_cast<const SdrMetricItem*>( pItem )->GetValue();
- SetMetricValue( *m_pMtrFldLeft, nValue, eUnit );
+ SetMetricValue( *m_xMtrFldLeft, nValue, eUnit );
}
else
- m_pMtrFldLeft->SetText( "" );
- m_pMtrFldLeft->SaveValue();
+ m_xMtrFldLeft->set_text("");
+ m_xMtrFldLeft->save_value();
pItem = GetItem( *rAttrs, SDRATTR_TEXT_RIGHTDIST );
if( !pItem )
@@ -156,11 +133,11 @@ void SvxTextAttrPage::Reset( const SfxItemSet* rAttrs )
if( pItem )
{
long nValue = static_cast<const SdrMetricItem*>( pItem )->GetValue();
- SetMetricValue( *m_pMtrFldRight, nValue, eUnit );
+ SetMetricValue( *m_xMtrFldRight, nValue, eUnit );
}
else
- m_pMtrFldRight->SetText( "" );
- m_pMtrFldRight->SaveValue();
+ m_xMtrFldRight->set_text("");
+ m_xMtrFldRight->save_value();
pItem = GetItem( *rAttrs, SDRATTR_TEXT_UPPERDIST );
if( !pItem )
@@ -168,11 +145,11 @@ void SvxTextAttrPage::Reset( const SfxItemSet* rAttrs )
if( pItem )
{
long nValue = static_cast<const SdrMetricItem*>( pItem )->GetValue();
- SetMetricValue( *m_pMtrFldTop, nValue, eUnit );
+ SetMetricValue( *m_xMtrFldTop, nValue, eUnit );
}
else
- m_pMtrFldTop->SetText( "" );
- m_pMtrFldTop->SaveValue();
+ m_xMtrFldTop->set_text("");
+ m_xMtrFldTop->save_value();
pItem = GetItem( *rAttrs, SDRATTR_TEXT_LOWERDIST );
if( !pItem )
@@ -180,52 +157,48 @@ void SvxTextAttrPage::Reset( const SfxItemSet* rAttrs )
if( pItem )
{
long nValue = static_cast<const SdrMetricItem*>(pItem)->GetValue();
- SetMetricValue( *m_pMtrFldBottom, nValue, eUnit );
+ SetMetricValue( *m_xMtrFldBottom, nValue, eUnit );
}
else
- m_pMtrFldBottom->SetText( "" );
- m_pMtrFldBottom->SaveValue();
+ m_xMtrFldBottom->set_text("");
+ m_xMtrFldBottom->save_value();
// adjust to height and autogrowsize
if ( rAttrs->GetItemState( SDRATTR_TEXT_AUTOGROWHEIGHT ) != SfxItemState::DONTCARE )
{
- m_pTsbAutoGrowHeight->SetState( rAttrs->Get( SDRATTR_TEXT_AUTOGROWHEIGHT ).
+ m_xTsbAutoGrowHeight->set_state( rAttrs->Get( SDRATTR_TEXT_AUTOGROWHEIGHT ).
GetValue() ? TRISTATE_TRUE : TRISTATE_FALSE );
- m_pTsbAutoGrowHeight->EnableTriState( false );
- m_pTsbAutoGrowSize->SetState( rAttrs->Get( SDRATTR_TEXT_AUTOGROWHEIGHT ).
+ m_xTsbAutoGrowSize->set_state( rAttrs->Get( SDRATTR_TEXT_AUTOGROWHEIGHT ).
GetValue() ? TRISTATE_TRUE : TRISTATE_FALSE );
- m_pTsbAutoGrowSize->EnableTriState( false );
}
else
{
- m_pTsbAutoGrowHeight->SetState( TRISTATE_INDET );
- m_pTsbAutoGrowSize->SetState( TRISTATE_INDET );
+ m_xTsbAutoGrowHeight->set_state( TRISTATE_INDET );
+ m_xTsbAutoGrowSize->set_state( TRISTATE_INDET );
}
- m_pTsbAutoGrowHeight->SaveValue();
- m_pTsbAutoGrowSize->SaveValue();
+ m_xTsbAutoGrowHeight->save_state();
+ m_xTsbAutoGrowSize->save_state();
// adjust to width
if ( rAttrs->GetItemState( SDRATTR_TEXT_AUTOGROWWIDTH ) != SfxItemState::DONTCARE )
{
- m_pTsbAutoGrowWidth->SetState( rAttrs->Get( SDRATTR_TEXT_AUTOGROWWIDTH ).
+ m_xTsbAutoGrowWidth->set_state( rAttrs->Get( SDRATTR_TEXT_AUTOGROWWIDTH ).
GetValue() ? TRISTATE_TRUE : TRISTATE_FALSE );
- m_pTsbAutoGrowWidth->EnableTriState( false );
}
else
- m_pTsbAutoGrowWidth->SetState( TRISTATE_INDET );
- m_pTsbAutoGrowWidth->SaveValue();
+ m_xTsbAutoGrowWidth->set_state( TRISTATE_INDET );
+ m_xTsbAutoGrowWidth->save_state();
// wordwrap text
if ( rAttrs->GetItemState( SDRATTR_TEXT_WORDWRAP ) != SfxItemState::DONTCARE )
{
- m_pTsbWordWrapText->SetState( rAttrs->Get( SDRATTR_TEXT_WORDWRAP ).
+ m_xTsbWordWrapText->set_state( rAttrs->Get( SDRATTR_TEXT_WORDWRAP ).
GetValue() ? TRISTATE_TRUE : TRISTATE_FALSE );
- m_pTsbWordWrapText->EnableTriState( false );
}
else
- m_pTsbWordWrapText->SetState( TRISTATE_INDET );
- m_pTsbWordWrapText->SaveValue();
+ m_xTsbWordWrapText->set_state( TRISTATE_INDET );
+ m_xTsbWordWrapText->save_state();
// #103516# Do the setup based on states of hor/ver adjust
@@ -240,8 +213,6 @@ void SvxTextAttrPage::Reset( const SfxItemSet* rAttrs )
SdrTextHorzAdjust eTHA = rAttrs->Get(SDRATTR_TEXT_HORZADJUST).GetValue();
RectPoint eRP = RectPoint::LB;
- m_pTsbFullWidth->EnableTriState( false );
-
// Translate item values into local anchor position.
switch (eTVA)
{
@@ -289,51 +260,48 @@ void SvxTextAttrPage::Reset( const SfxItemSet* rAttrs )
if((bLeftToRight && (SDRTEXTHORZADJUST_BLOCK == eTHA)) || (!bLeftToRight && (SDRTEXTVERTADJUST_BLOCK == eTVA)))
{
// Move anchor to valid position.
- ClickFullWidthHdl_Impl(nullptr);
- m_pTsbFullWidth->SetState(TRISTATE_TRUE);
+ ClickFullWidthHdl_Impl(*m_xTsbFullWidth);
+ m_xTsbFullWidth->set_state(TRISTATE_TRUE);
}
- m_pCtlPosition->SetActualRP( eRP );
+ m_xCtlPosition->SetActualRP( eRP );
}
else
{
// VertAdjust or HorAdjust is not unequivocal
- m_pCtlPosition->Reset();
+ m_xCtlPosition->Reset();
- m_pCtlPosition->SetState(CTL_STATE::NOVERT);
- m_pCtlPosition->DoCompletelyDisable(true);
+ m_xCtlPosition->SetState(CTL_STATE::NOVERT);
+ m_xCtlPosition->DoCompletelyDisable(true);
- m_pTsbFullWidth->SetState(TRISTATE_INDET);
- m_pFlPosition->Enable( false );
+ m_xTsbFullWidth->set_state(TRISTATE_INDET);
+ m_xFlPosition->set_sensitive( false );
}
// adjust to border
- if ( rAttrs->GetItemState( SDRATTR_TEXT_FITTOSIZE ) != SfxItemState::DONTCARE )
+ if (rAttrs->GetItemState(SDRATTR_TEXT_FITTOSIZE) != SfxItemState::DONTCARE)
{
drawing::TextFitToSizeType const eFTS =
rAttrs->Get( SDRATTR_TEXT_FITTOSIZE ).GetValue();
if (eFTS == drawing::TextFitToSizeType_AUTOFIT || eFTS == drawing::TextFitToSizeType_NONE)
- m_pTsbFitToSize->SetState( TRISTATE_FALSE );
+ m_xTsbFitToSize->set_state( TRISTATE_FALSE );
else
- m_pTsbFitToSize->SetState( TRISTATE_TRUE );
-
- m_pTsbFitToSize->EnableTriState( false );
+ m_xTsbFitToSize->set_state( TRISTATE_TRUE );
}
else
- m_pTsbFitToSize->SetState( TRISTATE_INDET );
- m_pTsbFitToSize->SaveValue();
+ m_xTsbFitToSize->set_state( TRISTATE_INDET );
+ m_xTsbFitToSize->save_state();
if( rAttrs->GetItemState( SDRATTR_TEXT_CONTOURFRAME ) != SfxItemState::DONTCARE )
{
bool bContour = rAttrs->Get( SDRATTR_TEXT_CONTOURFRAME ).GetValue();
- m_pTsbContour->SetState( bContour ? TRISTATE_TRUE : TRISTATE_FALSE );
- m_pTsbContour->EnableTriState( false );
+ m_xTsbContour->set_state( bContour ? TRISTATE_TRUE : TRISTATE_FALSE );
}
else
- m_pTsbContour->SetState( TRISTATE_INDET );
- m_pTsbContour->SaveValue();
+ m_xTsbContour->set_state( TRISTATE_INDET );
+ m_xTsbContour->save_state();
- ClickHdl_Impl( nullptr );
+ ClickHdl_Impl(*m_xTsbContour);
}
/*************************************************************************
@@ -351,62 +319,62 @@ bool SvxTextAttrPage::FillItemSet( SfxItemSet* rAttrs)
sal_Int32 nValue;
TriState eState;
- if( m_pMtrFldLeft->IsValueChangedFromSaved() )
+ if( m_xMtrFldLeft->get_value_changed_from_saved() )
{
- nValue = GetCoreValue( *m_pMtrFldLeft, eUnit );
+ nValue = GetCoreValue( *m_xMtrFldLeft, eUnit );
rAttrs->Put( makeSdrTextLeftDistItem( nValue ) );
}
- if( m_pMtrFldRight->IsValueChangedFromSaved() )
+ if( m_xMtrFldRight->get_value_changed_from_saved() )
{
- nValue = GetCoreValue( *m_pMtrFldRight, eUnit );
+ nValue = GetCoreValue( *m_xMtrFldRight, eUnit );
rAttrs->Put( makeSdrTextRightDistItem( nValue ) );
}
- if( m_pMtrFldTop->IsValueChangedFromSaved() )
+ if( m_xMtrFldTop->get_value_changed_from_saved() )
{
- nValue = GetCoreValue( *m_pMtrFldTop, eUnit );
+ nValue = GetCoreValue( *m_xMtrFldTop, eUnit );
rAttrs->Put( makeSdrTextUpperDistItem( nValue ) );
}
- if( m_pMtrFldBottom->IsValueChangedFromSaved() )
+ if( m_xMtrFldBottom->get_value_changed_from_saved() )
{
- nValue = GetCoreValue( *m_pMtrFldBottom, eUnit );
+ nValue = GetCoreValue( *m_xMtrFldBottom, eUnit );
rAttrs->Put( makeSdrTextLowerDistItem( nValue ) );
}
- eState = m_pTsbAutoGrowHeight->GetState();
- if( m_pTsbAutoGrowHeight->IsValueChangedFromSaved() )
+ eState = m_xTsbAutoGrowHeight->get_state();
+ if( m_xTsbAutoGrowHeight->get_state_changed_from_saved() )
{
rAttrs->Put( makeSdrTextAutoGrowHeightItem( TRISTATE_TRUE == eState ) );
}
- eState = m_pTsbAutoGrowWidth->GetState();
- if( m_pTsbAutoGrowWidth->IsValueChangedFromSaved() )
+ eState = m_xTsbAutoGrowWidth->get_state();
+ if( m_xTsbAutoGrowWidth->get_state_changed_from_saved() )
{
rAttrs->Put( makeSdrTextAutoGrowWidthItem( TRISTATE_TRUE == eState ) );
}
- eState = m_pTsbAutoGrowSize->GetState();
- if( m_pTsbAutoGrowSize->IsValueChangedFromSaved() )
+ eState = m_xTsbAutoGrowSize->get_state();
+ if( m_xTsbAutoGrowSize->get_state_changed_from_saved() )
{
rAttrs->Put( makeSdrTextAutoGrowHeightItem( TRISTATE_TRUE == eState ) );
}
- eState = m_pTsbWordWrapText->GetState();
- if( m_pTsbWordWrapText->IsValueChangedFromSaved() )
+ eState = m_xTsbWordWrapText->get_state();
+ if( m_xTsbWordWrapText->get_state_changed_from_saved() )
{
rAttrs->Put( makeSdrTextWordWrapItem( TRISTATE_TRUE == eState ) );
}
- eState = m_pTsbContour->GetState();
- if( m_pTsbContour->IsValueChangedFromSaved() )
+ eState = m_xTsbContour->get_state();
+ if( m_xTsbContour->get_state_changed_from_saved() )
{
rAttrs->Put( makeSdrTextContourFrameItem( TRISTATE_TRUE == eState ) );
}
- eState = m_pTsbFitToSize->GetState();
- if( m_pTsbFitToSize->IsValueChangedFromSaved() )
+ eState = m_xTsbFitToSize->get_state();
+ if( m_xTsbFitToSize->get_state_changed_from_saved() )
{
drawing::TextFitToSizeType eFTS;
switch( eState )
@@ -421,7 +389,7 @@ bool SvxTextAttrPage::FillItemSet( SfxItemSet* rAttrs)
}
// centered
- RectPoint eRP = m_pCtlPosition->GetActualRP();
+ RectPoint eRP = m_xCtlPosition->GetActualRP();
SdrTextVertAdjust eTVA, eOldTVA;
SdrTextHorzAdjust eTHA, eOldTHA;
@@ -449,11 +417,11 @@ bool SvxTextAttrPage::FillItemSet( SfxItemSet* rAttrs)
}
// #103516# Do not change values if adjust controls were disabled.
- bool bIsDisabled(m_pCtlPosition->IsCompletelyDisabled());
+ bool bIsDisabled(m_xCtlPosition->IsCompletelyDisabled());
if(!bIsDisabled)
{
- if( m_pTsbFullWidth->GetState() == TRISTATE_TRUE )
+ if( m_xTsbFullWidth->get_state() == TRISTATE_TRUE )
{
if (IsTextDirectionLeftToRight())
eTHA = SDRTEXTHORZADJUST_BLOCK;
@@ -491,8 +459,8 @@ void SvxTextAttrPage::Construct()
// indeterminate, show them all
bFitToSizeEnabled = bContourEnabled = bWordWrapTextEnabled =
bAutoGrowSizeEnabled = bAutoGrowWidthEnabled = bAutoGrowHeightEnabled = true;
- m_pCustomShapeText->Show();
- m_pDrawingText->Show();
+ m_xCustomShapeText->show();
+ m_xDrawingText->show();
break;
case OBJ_TEXT:
case OBJ_TITLETEXT:
@@ -503,42 +471,76 @@ void SvxTextAttrPage::Construct()
// adjusting width and height is ONLY possible for pure text objects
bFitToSizeEnabled = bAutoGrowWidthEnabled = bAutoGrowHeightEnabled = true;
- m_pCustomShapeText->Hide();
- m_pDrawingText->Show();
+ m_xCustomShapeText->hide();
+ m_xDrawingText->show();
break;
case OBJ_CUSTOMSHAPE:
bFitToSizeEnabled = bContourEnabled = bAutoGrowWidthEnabled = bAutoGrowHeightEnabled = false;
bWordWrapTextEnabled = bAutoGrowSizeEnabled = true;
- m_pDrawingText->Hide();
- m_pCustomShapeText->Show();
+ m_xDrawingText->hide();
+ m_xCustomShapeText->show();
break;
default:
bFitToSizeEnabled = bContourEnabled = true;
bWordWrapTextEnabled = bAutoGrowSizeEnabled = bAutoGrowWidthEnabled = bAutoGrowHeightEnabled = false;
- m_pCustomShapeText->Hide();
- m_pDrawingText->Show();
+ m_xCustomShapeText->hide();
+ m_xDrawingText->show();
break;
}
- m_pTsbAutoGrowHeight->Show( bAutoGrowHeightEnabled );
- m_pTsbAutoGrowWidth->Show( bAutoGrowWidthEnabled );
- m_pTsbFitToSize->Show( bFitToSizeEnabled );
- m_pTsbContour->Show( bContourEnabled );
- m_pTsbAutoGrowSize->Show( bAutoGrowSizeEnabled );
- m_pTsbWordWrapText->Show( bWordWrapTextEnabled );
+ m_xTsbAutoGrowHeight->show( bAutoGrowHeightEnabled );
+ m_xTsbAutoGrowWidth->show( bAutoGrowWidthEnabled );
+ m_xTsbFitToSize->show( bFitToSizeEnabled );
+ m_xTsbContour->show( bContourEnabled );
+ m_xTsbAutoGrowSize->show( bAutoGrowSizeEnabled );
+ m_xTsbWordWrapText->show( bWordWrapTextEnabled );
}
-VclPtr<SfxTabPage> SvxTextAttrPage::Create( TabPageParent pWindow,
- const SfxItemSet* rAttrs )
+VclPtr<SfxTabPage> SvxTextAttrPage::Create(TabPageParent pWindow, const SfxItemSet* rAttrs)
{
- return VclPtr<SvxTextAttrPage>::Create( pWindow.pParent, *rAttrs );
+ return VclPtr<SvxTextAttrPage>::Create(pWindow, *rAttrs);
}
/** Check whether we have to uncheck the "Full width" check box.
*/
void SvxTextAttrPage::PointChanged( vcl::Window*, RectPoint eRP )
{
- if (m_pTsbFullWidth->GetState() == TRISTATE_TRUE)
+ if (m_xTsbFullWidth->get_state() == TRISTATE_TRUE)
+ {
+ // Depending on write direction and currently checked anchor we have
+ // to uncheck the "full width" button.
+ if (IsTextDirectionLeftToRight())
+ switch( eRP )
+ {
+ case RectPoint::LT:
+ case RectPoint::LM:
+ case RectPoint::LB:
+ case RectPoint::RT:
+ case RectPoint::RM:
+ case RectPoint::RB:
+ m_xTsbFullWidth->set_state( TRISTATE_FALSE );
+ break;
+ default: ;//prevent warning
+ }
+ else
+ switch (eRP)
+ {
+ case RectPoint::LT:
+ case RectPoint::MT:
+ case RectPoint::RT:
+ case RectPoint::LB:
+ case RectPoint::MB:
+ case RectPoint::RB:
+ m_xTsbFullWidth->set_state( TRISTATE_FALSE );
+ break;
+ default: ;//prevent warning
+ }
+ }
+}
+
+void SvxTextAttrPage::PointChanged(weld::DrawingArea*, RectPoint eRP)
+{
+ if (m_xTsbFullWidth->get_state() == TRISTATE_TRUE)
{
// Depending on write direction and currently checked anchor we have
// to uncheck the "full width" button.
@@ -551,7 +553,7 @@ void SvxTextAttrPage::PointChanged( vcl::Window*, RectPoint eRP )
case RectPoint::RT:
case RectPoint::RM:
case RectPoint::RB:
- m_pTsbFullWidth->SetState( TRISTATE_FALSE );
+ m_xTsbFullWidth->set_state( TRISTATE_FALSE );
break;
default: ;//prevent warning
}
@@ -564,13 +566,14 @@ void SvxTextAttrPage::PointChanged( vcl::Window*, RectPoint eRP )
case RectPoint::LB:
case RectPoint::MB:
case RectPoint::RB:
- m_pTsbFullWidth->SetState( TRISTATE_FALSE );
+ m_xTsbFullWidth->set_state( TRISTATE_FALSE );
break;
default: ;//prevent warning
}
}
}
+
/*************************************************************************
|*
|* possibly changes the position of the position-control
@@ -581,28 +584,28 @@ void SvxTextAttrPage::PointChanged( vcl::Window*, RectPoint eRP )
to be moved to a valid and adjacent position. This position depends on
the current anchor position and the text writing direction.
*/
-IMPL_LINK_NOARG(SvxTextAttrPage, ClickFullWidthHdl_Impl, Button*, void)
+IMPL_LINK_NOARG(SvxTextAttrPage, ClickFullWidthHdl_Impl, weld::Button&, void)
{
- if( m_pTsbFullWidth->GetState() == TRISTATE_TRUE )
+ if( m_xTsbFullWidth->get_state() == TRISTATE_TRUE )
{
if (IsTextDirectionLeftToRight())
{
// Move text anchor to horizontal middle axis.
- switch( m_pCtlPosition->GetActualRP() )
+ switch( m_xCtlPosition->GetActualRP() )
{
case RectPoint::LT:
case RectPoint::RT:
- m_pCtlPosition->SetActualRP( RectPoint::MT );
+ m_xCtlPosition->SetActualRP( RectPoint::MT );
break;
case RectPoint::LM:
case RectPoint::RM:
- m_pCtlPosition->SetActualRP( RectPoint::MM );
+ m_xCtlPosition->SetActualRP( RectPoint::MM );
break;
case RectPoint::LB:
case RectPoint::RB:
- m_pCtlPosition->SetActualRP( RectPoint::MB );
+ m_xCtlPosition->SetActualRP( RectPoint::MB );
break;
default: ;//prevent warning
}
@@ -610,21 +613,21 @@ IMPL_LINK_NOARG(SvxTextAttrPage, ClickFullWidthHdl_Impl, Button*, void)
else
{
// Move text anchor to vertical middle axis.
- switch( m_pCtlPosition->GetActualRP() )
+ switch( m_xCtlPosition->GetActualRP() )
{
case RectPoint::LT:
case RectPoint::LB:
- m_pCtlPosition->SetActualRP( RectPoint::LM );
+ m_xCtlPosition->SetActualRP( RectPoint::LM );
break;
case RectPoint::MT:
case RectPoint::MB:
- m_pCtlPosition->SetActualRP( RectPoint::MM );
+ m_xCtlPosition->SetActualRP( RectPoint::MM );
break;
case RectPoint::RT:
case RectPoint::RB:
- m_pCtlPosition->SetActualRP( RectPoint::RM );
+ m_xCtlPosition->SetActualRP( RectPoint::RM );
break;
default: ;//prevent warning
}
@@ -638,50 +641,50 @@ IMPL_LINK_NOARG(SvxTextAttrPage, ClickFullWidthHdl_Impl, Button*, void)
|*
\************************************************************************/
-IMPL_LINK(SvxTextAttrPage, ClickHdl_Impl, Button*, pButton, void)
+IMPL_LINK(SvxTextAttrPage, ClickHdl_Impl, weld::Button&, rButton, void)
{
- if (pButton == m_pTsbAutoGrowSize)
+ if (&rButton == m_xTsbAutoGrowSize.get())
{
- m_pTsbAutoGrowHeight->SetState(m_pTsbAutoGrowSize->GetState());
- if (m_pTsbAutoGrowSize->GetState() == TRISTATE_TRUE)
+ m_xTsbAutoGrowHeight->set_state(m_xTsbAutoGrowSize->get_state());
+ if (m_xTsbAutoGrowSize->get_state() == TRISTATE_TRUE)
{
- m_pTsbFitToSize->SetState(TRISTATE_FALSE);
- m_pTsbContour->SetState(TRISTATE_FALSE);
+ m_xTsbFitToSize->set_state(TRISTATE_FALSE);
+ m_xTsbContour->set_state(TRISTATE_FALSE);
}
}
- else if (pButton == m_pTsbAutoGrowHeight)
- m_pTsbAutoGrowSize->SetState(m_pTsbAutoGrowHeight->GetState());
+ else if (&rButton == m_xTsbAutoGrowHeight.get())
+ m_xTsbAutoGrowSize->set_state(m_xTsbAutoGrowHeight->get_state());
- bool bAutoGrowWidth = m_pTsbAutoGrowWidth->GetState() == TRISTATE_TRUE;
- bool bAutoGrowHeight = m_pTsbAutoGrowHeight->GetState() == TRISTATE_TRUE;
- bool bFitToSize = m_pTsbFitToSize->GetState() == TRISTATE_TRUE;
- bool bContour = m_pTsbContour->GetState() == TRISTATE_TRUE;
+ bool bAutoGrowWidth = m_xTsbAutoGrowWidth->get_state() == TRISTATE_TRUE;
+ bool bAutoGrowHeight = m_xTsbAutoGrowHeight->get_state() == TRISTATE_TRUE;
+ bool bFitToSize = m_xTsbFitToSize->get_state() == TRISTATE_TRUE;
+ bool bContour = m_xTsbContour->get_state() == TRISTATE_TRUE;
- m_pTsbContour->Enable( !bFitToSize &&
+ m_xTsbContour->set_sensitive( !bFitToSize &&
!( ( bAutoGrowWidth && bAutoGrowWidthEnabled ) || ( bAutoGrowHeight && bAutoGrowHeightEnabled ) ) &&
bContourEnabled );
- m_pTsbAutoGrowWidth->Enable( !bFitToSize &&
+ m_xTsbAutoGrowWidth->set_sensitive( !bFitToSize &&
!( bContour && bContourEnabled ) &&
bAutoGrowWidthEnabled );
- m_pTsbAutoGrowHeight->Enable( !bFitToSize &&
+ m_xTsbAutoGrowHeight->set_sensitive( !bFitToSize &&
!( bContour && bContourEnabled ) &&
bAutoGrowHeightEnabled );
- m_pTsbFitToSize->Enable( !( ( bAutoGrowWidth && bAutoGrowWidthEnabled ) || ( bAutoGrowHeight && bAutoGrowHeightEnabled ) ) &&
+ m_xTsbFitToSize->set_sensitive( !( ( bAutoGrowWidth && bAutoGrowWidthEnabled ) || ( bAutoGrowHeight && bAutoGrowHeightEnabled ) ) &&
!( bContour && bContourEnabled ) &&
bFitToSizeEnabled );
// #101901# enable/disable metric fields and decorations dependent of contour
- m_pFlDistance->Enable(!bContour);
+ m_xFlDistance->set_sensitive(!bContour);
if( bContour && bContourEnabled )
{
- m_pMtrFldLeft->SetValue( 0 );
- m_pMtrFldRight->SetValue( 0 );
- m_pMtrFldTop->SetValue( 0 );
- m_pMtrFldBottom->SetValue( 0 );
+ m_xMtrFldLeft->set_value(0, FUNIT_NONE);
+ m_xMtrFldRight->set_value(0, FUNIT_NONE);
+ m_xMtrFldTop->set_value(0, FUNIT_NONE);
+ m_xMtrFldBottom->set_value(0, FUNIT_NONE);
}
// #103516# Do the setup based on states of hor/ver adjust
@@ -690,7 +693,7 @@ IMPL_LINK(SvxTextAttrPage, ClickHdl_Impl, Button*, pButton, void)
bool bHorAndVer(SfxItemState::DONTCARE == eVState || SfxItemState::DONTCARE == eHState);
// #83698# enable/disable text anchoring dependent of contour
- m_pFlPosition->Enable(!bContour && !bHorAndVer);
+ m_xFlPosition->set_sensitive(!bContour && !bHorAndVer);
}
diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx
index 57492037a1e6..dbceed157716 100644
--- a/cui/source/tabpages/tparea.cxx
+++ b/cui/source/tabpages/tparea.cxx
@@ -397,6 +397,10 @@ void SvxAreaTabPage::PointChanged( vcl::Window* , RectPoint )
{
}
+void SvxAreaTabPage::PointChanged( weld::DrawingArea*, RectPoint )
+{
+}
+
void SvxAreaTabPage::CreatePage( sal_Int32 nId, SfxTabPage* pTab )
{
if(nId == SOLID )
diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx
index b6b2d007294f..75ddd68ce72f 100644
--- a/cui/source/tabpages/tpbitmap.cxx
+++ b/cui/source/tabpages/tpbitmap.cxx
@@ -835,4 +835,8 @@ void SvxBitmapTabPage::PointChanged( vcl::Window* , RectPoint )
{
}
+void SvxBitmapTabPage::PointChanged( weld::DrawingArea*, RectPoint )
+{
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx
index 304a7868ea1b..78c70ba84923 100644
--- a/cui/source/tabpages/tphatch.cxx
+++ b/cui/source/tabpages/tphatch.cxx
@@ -594,6 +594,10 @@ void SvxHatchTabPage::PointChanged( vcl::Window*, RectPoint )
{
}
+void SvxHatchTabPage::PointChanged( weld::DrawingArea*, RectPoint )
+{
+}
+
void SvxHatchTabPage::DataChanged( const DataChangedEvent& rDCEvt )
{
if ( ( rDCEvt.GetType() == DataChangedEventType::SETTINGS ) && ( rDCEvt.GetFlags() & AllSettingsFlags::STYLE ) )
diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx
index b19981a03ee1..e29acf095eac 100644
--- a/cui/source/tabpages/tpline.cxx
+++ b/cui/source/tabpages/tpline.cxx
@@ -1665,11 +1665,13 @@ IMPL_LINK_NOARG(SvxLineTabPage, ChangeTransparentHdl_Impl, Edit&, void)
m_pCtlPreview->Invalidate();
}
-
void SvxLineTabPage::PointChanged( vcl::Window*, RectPoint )
{
}
+void SvxLineTabPage::PointChanged( weld::DrawingArea*, RectPoint )
+{
+}
void SvxLineTabPage::FillUserData()
{
diff --git a/cui/source/tabpages/tppattern.cxx b/cui/source/tabpages/tppattern.cxx
index b312b33c3a1a..b073d844bde0 100644
--- a/cui/source/tabpages/tppattern.cxx
+++ b/cui/source/tabpages/tppattern.cxx
@@ -549,7 +549,6 @@ void SvxPatternTabPage::ChangeColor_Impl()
m_pCtlPreview->Invalidate();
}
-
void SvxPatternTabPage::PointChanged( vcl::Window* pWindow, RectPoint )
{
if( pWindow == m_pCtlPixel )
@@ -565,6 +564,18 @@ void SvxPatternTabPage::PointChanged( vcl::Window* pWindow, RectPoint )
m_pPatternLB->SetNoSelection();
}
+void SvxPatternTabPage::PointChanged( weld::DrawingArea*, RectPoint )
+{
+ m_pBitmapCtl->SetBmpArray( m_pCtlPixel->GetBitmapPixelPtr() );
+
+ // get bitmap and display it
+ m_rXFSet.Put(XFillBitmapItem(OUString(), Graphic(m_pBitmapCtl->GetBitmapEx())));
+ m_pCtlPreview->SetAttributes( m_aXFillAttr.GetItemSet() );
+ m_pCtlPreview->Invalidate();
+
+ m_pPatternLB->SetNoSelection();
+}
+
sal_Int32 SvxPatternTabPage::SearchPatternList(const OUString& rPatternName)
{
long nCount = m_pPatternList->Count();
diff --git a/cui/source/tabpages/tpshadow.cxx b/cui/source/tabpages/tpshadow.cxx
index e603ce9f4c1a..d03a37a7d98f 100644
--- a/cui/source/tabpages/tpshadow.cxx
+++ b/cui/source/tabpages/tpshadow.cxx
@@ -496,6 +496,12 @@ void SvxShadowTabPage::PointChanged( vcl::Window*, RectPoint )
ModifyShadowHdl_Impl( *m_pMtrTransparent );
}
+void SvxShadowTabPage::PointChanged( weld::DrawingArea*, RectPoint )
+{
+ // repaint shadow
+ ModifyShadowHdl_Impl( *m_pMtrTransparent );
+}
+
void SvxShadowTabPage::PageCreated(const SfxAllItemSet& aSet)
{
const SvxColorListItem* pColorListItem = aSet.GetItem<SvxColorListItem>(SID_COLOR_TABLE, false);
diff --git a/cui/source/tabpages/tptrans.cxx b/cui/source/tabpages/tptrans.cxx
index c8d99d39c35c..1f6fc20da7dd 100644
--- a/cui/source/tabpages/tptrans.cxx
+++ b/cui/source/tabpages/tptrans.cxx
@@ -487,6 +487,9 @@ void SvxTransparenceTabPage::PointChanged(vcl::Window* , RectPoint )
{
}
+void SvxTransparenceTabPage::PointChanged(weld::DrawingArea*, RectPoint)
+{
+}
// Preview-Methods
diff --git a/cui/source/tabpages/transfrm.cxx b/cui/source/tabpages/transfrm.cxx
index b455872dd343..570635d1737a 100644
--- a/cui/source/tabpages/transfrm.cxx
+++ b/cui/source/tabpages/transfrm.cxx
@@ -348,7 +348,6 @@ DeactivateRC SvxAngleTabPage::DeactivatePage( SfxItemSet* _pSet )
return DeactivateRC::LeavePage;
}
-
void SvxAngleTabPage::PointChanged(vcl::Window* pWindow, RectPoint eRP)
{
if(pWindow == m_pCtlRect)
@@ -413,6 +412,11 @@ void SvxAngleTabPage::PointChanged(vcl::Window* pWindow, RectPoint eRP)
}
}
+void SvxAngleTabPage::PointChanged(weld::DrawingArea* /*pWindow*/, RectPoint /*eRP*/)
+{
+ assert(false);
+}
+
/*************************************************************************
|*
|* dialog for changing slant and corner radius
@@ -787,7 +791,11 @@ DeactivateRC SvxSlantTabPage::DeactivatePage( SfxItemSet* _pSet )
}
-void SvxSlantTabPage::PointChanged( vcl::Window* , RectPoint )
+void SvxSlantTabPage::PointChanged( vcl::Window*, RectPoint )
+{
+}
+
+void SvxSlantTabPage::PointChanged( weld::DrawingArea*, RectPoint )
{
}
@@ -1539,7 +1547,6 @@ void SvxPositionSizeTabPage::GetTopLeftPosition(double& rfX, double& rfY, const
}
}
-
void SvxPositionSizeTabPage::PointChanged( vcl::Window* pWindow, RectPoint eRP )
{
if( pWindow == m_pCtlPos )
@@ -1610,6 +1617,10 @@ void SvxPositionSizeTabPage::PointChanged( vcl::Window* pWindow, RectPoint eRP )
}
}
+void SvxPositionSizeTabPage::PointChanged(weld::DrawingArea* /*pWindow*/, RectPoint /*eRP*/)
+{
+ assert(false);
+}
void SvxPositionSizeTabPage::DisableResize()
{
diff --git a/cui/uiconfig/ui/textattrtabpage.ui b/cui/uiconfig/ui/textattrtabpage.ui
index 7373946102a9..f5ee8ec34ed1 100644
--- a/cui/uiconfig/ui/textattrtabpage.ui
+++ b/cui/uiconfig/ui/textattrtabpage.ui
@@ -1,14 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
+<!-- Generated with glade 3.20.4 -->
<interface domain="cui">
<requires lib="gtk+" version="3.18"/>
- <requires lib="LibreOffice" version="1.0"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="lower">-100</property>
<property name="upper">100</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
+ <object class="GtkAdjustment" id="adjustment2">
+ <property name="lower">-100</property>
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment3">
+ <property name="lower">-100</property>
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment4">
+ <property name="lower">-100</property>
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
<object class="GtkBox" id="TextAttributesPage">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -173,12 +190,6 @@
<property name="top_attach">1</property>
</packing>
</child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
</object>
</child>
</object>
@@ -236,7 +247,7 @@
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="textattrtabpage|label4">_Left:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">MTR_FLD_LEFT:0.00cm</property>
+ <property name="mnemonic_widget">MTR_FLD_LEFT</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -250,7 +261,7 @@
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="textattrtabpage|label5">_Right:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">MTR_FLD_RIGHT:0.00cm</property>
+ <property name="mnemonic_widget">MTR_FLD_RIGHT</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -264,7 +275,7 @@
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="textattrtabpage|label6">_Top:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">MTR_FLD_TOP:0.00cm</property>
+ <property name="mnemonic_widget">MTR_FLD_TOP</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -278,7 +289,7 @@
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="textattrtabpage|label7">_Bottom:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">MTR_FLD_BOTTOM:0.00cm</property>
+ <property name="mnemonic_widget">MTR_FLD_BOTTOM</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -287,9 +298,10 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="MTR_FLD_LEFT:0.00cm">
+ <object class="GtkSpinButton" id="MTR_FLD_LEFT">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="activates_default">True</property>
<property name="adjustment">adjustment1</property>
<property name="digits">2</property>
</object>
@@ -299,10 +311,11 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="MTR_FLD_RIGHT:0.00cm">
+ <object class="GtkSpinButton" id="MTR_FLD_RIGHT">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="adjustment">adjustment1</property>
+ <property name="activates_default">True</property>
+ <property name="adjustment">adjustment2</property>
<property name="digits">2</property>
</object>
<packing>
@@ -311,10 +324,11 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="MTR_FLD_TOP:0.00cm">
+ <object class="GtkSpinButton" id="MTR_FLD_TOP">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="adjustment">adjustment1</property>
+ <property name="activates_default">True</property>
+ <property name="adjustment">adjustment3</property>
<property name="digits">2</property>
</object>
<packing>
@@ -323,10 +337,11 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="MTR_FLD_BOTTOM:0.00cm">
+ <object class="GtkSpinButton" id="MTR_FLD_BOTTOM">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="adjustment">adjustment1</property>
+ <property name="activates_default">True</property>
+ <property name="adjustment">adjustment4</property>
<property name="digits">2</property>
</object>
<packing>
@@ -359,7 +374,7 @@
<child>
<object class="GtkFrame" id="FL_POSITION">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
@@ -377,11 +392,29 @@
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
- <object class="svxlo-SvxRectCtl" id="CTL_POSITION">
+ <object class="GtkScrolledWindow">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">True</property>
<property name="halign">start</property>
<property name="valign">center</property>
+ <property name="hscrollbar_policy">never</property>
+ <property name="vscrollbar_policy">never</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkViewport">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkDrawingArea" id="CTL_POSITION">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="events">GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
+ <property name="halign">start</property>
+ <property name="valign">center</property>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
<packing>
<property name="expand">True</property>
diff --git a/include/svx/dlgctrl.hxx b/include/svx/dlgctrl.hxx
index 0cf9220cb34f..075a008fe0c0 100644
--- a/include/svx/dlgctrl.hxx
+++ b/include/svx/dlgctrl.hxx
@@ -24,6 +24,7 @@
#include <svx/svxdllapi.h>
#include <svx/rectenum.hxx>
#include <vcl/graph.hxx>
+#include <vcl/weld.hxx>
#include <svx/xtable.hxx>
#include <rtl/ref.hxx>
#include <o3tl/typed_flags_set.hxx>
@@ -49,7 +50,12 @@ public:
: SfxTabPage(pParent, rID, rUIXMLDescription, &rAttrSet)
{
}
- virtual void PointChanged( vcl::Window* pWindow, RectPoint eRP ) = 0;
+ SvxTabPage(TabPageParent pParent, const OUString& rUIXMLDescription, const OString& rID, const SfxItemSet &rAttrSet)
+ : SfxTabPage(pParent, rUIXMLDescription, rID, &rAttrSet)
+ {
+ }
+ virtual void PointChanged(vcl::Window* pWindow, RectPoint eRP) = 0;
+ virtual void PointChanged(weld::DrawingArea* pArea, RectPoint eRP) = 0;
};
/*************************************************************************
@@ -69,6 +75,7 @@ namespace o3tl
}
class SvxRectCtlAccessibleContext;
+class RectCtlAccessibleContext;
class SvxPixelCtlAccessible;
class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxRectCtl : public Control
@@ -141,6 +148,79 @@ public:
void DoCompletelyDisable(bool bNew);
};
+class SAL_WARN_UNUSED SVX_DLLPUBLIC RectCtl
+{
+private:
+ std::unique_ptr<weld::DrawingArea> m_xControl;
+ VclPtr<SvxTabPage> m_pPage;
+
+ SVX_DLLPRIVATE void InitSettings(vcl::RenderContext& rRenderContext);
+ SVX_DLLPRIVATE void InitRectBitmap();
+ SVX_DLLPRIVATE BitmapEx& GetRectBitmap();
+ SVX_DLLPRIVATE void Resize_Impl();
+
+protected:
+ rtl::Reference<RectCtlAccessibleContext> pAccContext;
+ sal_uInt16 nBorderWidth;
+ sal_uInt16 nRadius;
+ Size m_aSize;
+ Point aPtLT, aPtMT, aPtRT;
+ Point aPtLM, aPtMM, aPtRM;
+ Point aPtLB, aPtMB, aPtRB;
+ Point aPtNew;
+ RectPoint eRP, eDefRP;
+ BitmapEx* pBitmap;
+ CTL_STATE m_nState;
+
+ bool mbCompleteDisable : 1;
+
+ void MarkToResetSettings();
+
+ RectPoint GetRPFromPoint( Point, bool bRTL = false ) const;
+ const Point& GetPointFromRP( RectPoint ) const;
+ Point SetActualRPWithoutInvalidate( RectPoint eNewRP ); // returns the last point
+
+ Point GetApproxLogPtFromPixPt( const Point& rRoughPixelPoint ) const;
+public:
+ RectCtl(weld::Builder& rBuilder, const OString& rDrawingId, SvxTabPage* pPage,
+ RectPoint eRpt = RectPoint::MM, sal_uInt16 nBorder = 200, sal_uInt16 nCircle = 80);
+ void SetControlSettings(RectPoint eRpt, sal_uInt16 nBorder, sal_uInt16 nCircl);
+ ~RectCtl();
+
+ DECL_LINK(DoPaint, weld::DrawingArea::draw_args, void);
+ DECL_LINK(DoResize, const Size& rSize, void);
+ DECL_LINK(DoMouseButtonDown, const MouseEvent&, void);
+ DECL_LINK(DoKeyDown, const KeyEvent&, bool);
+ DECL_LINK(DoGetFocus, weld::Widget&, void);
+ DECL_LINK(DoLoseFocus, weld::Widget&, void);
+ DECL_LINK(MarkToResetSettings, weld::Widget&, void);
+
+ void Reset();
+ RectPoint GetActualRP() const { return eRP;}
+ void SetActualRP( RectPoint eNewRP );
+
+ void SetState( CTL_STATE nState );
+
+ static const sal_uInt8 NO_CHILDREN = 9; // returns number of usable radio buttons
+
+ tools::Rectangle CalculateFocusRectangle() const;
+ tools::Rectangle CalculateFocusRectangle( RectPoint eRectPoint ) const;
+
+ css::uno::Reference<css::accessibility::XAccessible> getAccessibleParent() { return m_xControl->get_accessible_parent(); }
+ css::uno::Reference<css::accessibility::XAccessible> CreateAccessible();
+ a11yrelationset get_accessible_relation_set() { return m_xControl->get_accessible_relation_set(); }
+
+ RectPoint GetApproxRPFromPixPt( const css::awt::Point& rPixelPoint ) const;
+
+ bool IsCompletelyDisabled() const { return mbCompleteDisable; }
+ void DoCompletelyDisable(bool bNew);
+
+ bool IsVisible() const { return m_xControl->get_visible(); }
+ bool HasFocus() const { return m_xControl->has_focus(); }
+ void GrabFocus() { m_xControl->grab_focus(); }
+ Size GetSize() const { return m_aSize; }
+};
+
/*************************************************************************
|* Control for editing bitmaps
\************************************************************************/
diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx
index 9aff1794a53c..31ff24e2d2ee 100644
--- a/include/vcl/layout.hxx
+++ b/include/vcl/layout.hxx
@@ -623,6 +623,7 @@ private:
Link<const MouseEvent&, void> m_aMouseReleaseHdl;
Link<const KeyEvent&, bool> m_aKeyPressHdl;
Link<const KeyEvent&, bool> m_aKeyReleaseHdl;
+ Link<VclDrawingArea&, void> m_aStyleUpdatedHdl;
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override
{
@@ -655,21 +656,24 @@ private:
if (!m_aKeyReleaseHdl.Call(rKEvt))
Control::KeyUp(rKEvt);
}
-
virtual void StateChanged(StateChangedType nType) override
{
Control::StateChanged(nType);
if (nType == StateChangedType::ControlForeground || nType == StateChangedType::ControlBackground)
+ {
+ m_aStyleUpdatedHdl.Call(*this);
Invalidate();
+ }
}
-
virtual void DataChanged(const DataChangedEvent& rDCEvt) override
{
Control::DataChanged(rDCEvt);
if ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE))
+ {
+ m_aStyleUpdatedHdl.Call(*this);
Invalidate();
+ }
}
-
virtual FactoryFunction GetUITestFactory() const override
{
if (m_pFactoryFunction)
@@ -721,6 +725,10 @@ public:
{
m_aKeyReleaseHdl = rLink;
}
+ void SetStyleUpdatedHdl(const Link<VclDrawingArea&, void>& rLink)
+ {
+ m_aStyleUpdatedHdl = rLink;
+ }
};
//Get first window of a pTopLevel window as
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 93f8657e6852..309c1447a80d 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -17,7 +17,10 @@
#include <vcl/field.hxx>
#include <vcl/virdev.hxx>
+#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
+
typedef css::uno::Reference<css::accessibility::XAccessible> a11yref;
+typedef css::uno::Reference<css::accessibility::XAccessibleRelationSet> a11yrelationset;
namespace weld
{
@@ -697,6 +700,7 @@ protected:
Link<const MouseEvent&, void> m_aMouseReleaseHdl;
Link<const KeyEvent&, bool> m_aKeyPressHdl;
Link<const KeyEvent&, bool> m_aKeyReleaseHdl;
+ Link<Widget&, void> m_aStyleUpdatedHdl;
public:
void connect_draw(const Link<draw_args, void>& rLink) { m_aDrawHdl = rLink; }
@@ -715,9 +719,11 @@ public:
}
void connect_key_press(const Link<const KeyEvent&, bool>& rLink) { m_aKeyPressHdl = rLink; }
void connect_key_release(const Link<const KeyEvent&, bool>& rLink) { m_aKeyReleaseHdl = rLink; }
+ void connect_style_updated(const Link<Widget&, void>& rLink) { m_aStyleUpdatedHdl = rLink; }
virtual void queue_draw() = 0;
virtual void queue_draw_area(int x, int y, int width, int height) = 0;
virtual a11yref get_accessible_parent() = 0;
+ virtual a11yrelationset get_accessible_relation_set() = 0;
};
class VCL_DLLPUBLIC Menu
diff --git a/svx/source/accessibility/charmapacc.cxx b/svx/source/accessibility/charmapacc.cxx
index 8e6da5d0029e..bb560b9e820d 100644
--- a/svx/source/accessibility/charmapacc.cxx
+++ b/svx/source/accessibility/charmapacc.cxx
@@ -116,15 +116,18 @@ void SvxShowCharSetAcc::implSelect(sal_Int32 nAccessibleChildIndex, bool bSelect
css::awt::Rectangle SvxShowCharSetAcc::implGetBounds()
{
- const Point aOutPos;//( m_pParent->GetPosPixel() );
- Size aOutSize( m_pParent->GetSize());
-
awt::Rectangle aRet;
- aRet.X = aOutPos.X();
- aRet.Y = aOutPos.Y();
- aRet.Width = aOutSize.Width();
- aRet.Height = aOutSize.Height();
+ if (m_pParent)
+ {
+ const Point aOutPos;//( m_pParent->GetPosPixel() );
+ Size aOutSize( m_pParent->GetSize());
+
+ aRet.X = aOutPos.X();
+ aRet.Y = aOutPos.Y();
+ aRet.Width = aOutSize.Width();
+ aRet.Height = aOutSize.Height();
+ }
return aRet;
}
@@ -136,11 +139,6 @@ sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleChildCount()
return m_pParent->getMaxCharCount();
}
-sal_Int32 SAL_CALL SvxShowCharSetAcc::getAccessibleIndexInParent()
-{
- return 0;
-}
-
uno::Reference< css::accessibility::XAccessible > SAL_CALL SvxShowCharSetAcc::getAccessibleChild( sal_Int32 i )
{
OExternalLockGuard aGuard( this );
@@ -162,7 +160,9 @@ uno::Reference< css::accessibility::XAccessible > SAL_CALL SvxShowCharSetAcc::ge
{
OExternalLockGuard aGuard( this );
- return m_pParent->getAccessibleParent();
+ if (m_pParent)
+ return m_pParent->getAccessibleParent();
+ return uno::Reference<css::accessibility::XAccessible>();
}
sal_Int16 SAL_CALL SvxShowCharSetAcc::getAccessibleRole()
diff --git a/svx/source/accessibility/svxrectctaccessiblecontext.cxx b/svx/source/accessibility/svxrectctaccessiblecontext.cxx
index bc0d4501d60d..e6c0959d20d3 100644
--- a/svx/source/accessibility/svxrectctaccessiblecontext.cxx
+++ b/svx/source/accessibility/svxrectctaccessiblecontext.cxx
@@ -97,7 +97,6 @@ static long PointToIndex( RectPoint ePoint )
return nRet;
}
-
SvxRectCtlAccessibleContext::SvxRectCtlAccessibleContext(
const Reference< XAccessible >& rxParent,
SvxRectCtl& rRepr ) :
@@ -625,6 +624,309 @@ void SvxRectCtlAccessibleContext::ThrowExceptionIfNotAlive()
throw lang::DisposedException();
}
+RectCtlAccessibleContext::RectCtlAccessibleContext(RectCtl* pRepr)
+ : mpRepr(pRepr)
+ , mnSelectedChild(NOCHILDSELECTED)
+{
+ {
+ ::SolarMutexGuard aSolarGuard;
+ msName = SvxResId( RID_SVXSTR_RECTCTL_ACC_CORN_NAME );
+ msDescription = SvxResId( RID_SVXSTR_RECTCTL_ACC_CORN_DESCR );
+ }
+
+ mvChildren.resize(MAX_NUM_OF_CHILDREN);
+}
+
+RectCtlAccessibleContext::~RectCtlAccessibleContext()
+{
+ ensureDisposed();
+}
+
+IMPLEMENT_FORWARD_XINTERFACE2( RectCtlAccessibleContext, OAccessibleSelectionHelper, OAccessibleHelper_Base )
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( RectCtlAccessibleContext, OAccessibleSelectionHelper, OAccessibleHelper_Base )
+
+Reference< XAccessible > SAL_CALL RectCtlAccessibleContext::getAccessibleAtPoint( const awt::Point& rPoint )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ Reference< XAccessible > xRet;
+
+ long nChild = mpRepr ? PointToIndex(mpRepr->GetApproxRPFromPixPt(rPoint)) : NOCHILDSELECTED;
+
+ if (nChild != NOCHILDSELECTED)
+ xRet = getAccessibleChild( nChild );
+
+ return xRet;
+}
+
+// XAccessibleContext
+sal_Int32 SAL_CALL RectCtlAccessibleContext::getAccessibleChildCount()
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ return SvxRectCtl::NO_CHILDREN;
+}
+
+Reference< XAccessible > SAL_CALL RectCtlAccessibleContext::getAccessibleChild( sal_Int32 nIndex )
+{
+ checkChildIndex( nIndex );
+
+ Reference< XAccessible > xChild(mvChildren[ nIndex ].get());
+ if( !xChild.is() )
+ {
+ ::SolarMutexGuard aSolarGuard;
+
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ xChild = mvChildren[ nIndex ].get();
+
+ if (!xChild.is() && mpRepr)
+ {
+ const ChildIndexToPointData* p = IndexToPoint( nIndex );
+ OUString aName(SvxResId(p->pResIdName));
+ OUString aDescr(SvxResId(p->pResIdDescr));
+
+ tools::Rectangle aFocusRect( mpRepr->CalculateFocusRectangle( p->ePoint ) );
+
+ RectCtlChildAccessibleContext* pChild = new RectCtlChildAccessibleContext(this, aName,
+ aDescr, aFocusRect, nIndex );
+ mvChildren[ nIndex ] = pChild;
+ xChild = pChild;
+
+ // set actual state
+ if( mnSelectedChild == nIndex )
+ pChild->setStateChecked( true );
+ }
+ }
+
+ return xChild;
+}
+
+Reference< XAccessible > SAL_CALL RectCtlAccessibleContext::getAccessibleParent()
+{
+ if (mpRepr)
+ return mpRepr->getAccessibleParent();
+ return uno::Reference<css::accessibility::XAccessible>();
+}
+
+sal_Int16 SAL_CALL RectCtlAccessibleContext::getAccessibleRole()
+{
+ return AccessibleRole::PANEL;
+}
+
+OUString SAL_CALL RectCtlAccessibleContext::getAccessibleDescription()
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ return msDescription + " Please use arrow key to selection.";
+}
+
+OUString SAL_CALL RectCtlAccessibleContext::getAccessibleName()
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ return msName;
+}
+
+/** Return empty reference to indicate that the relation set is not
+ supported.
+*/
+Reference< XAccessibleRelationSet > SAL_CALL RectCtlAccessibleContext::getAccessibleRelationSet()
+{
+ if (mpRepr)
+ return mpRepr->get_accessible_relation_set();
+ return uno::Reference<css::accessibility::XAccessibleRelationSet>();
+}
+
+Reference< XAccessibleStateSet > SAL_CALL RectCtlAccessibleContext::getAccessibleStateSet()
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
+
+ if (mpRepr)
+ {
+ pStateSetHelper->AddState( AccessibleStateType::ENABLED );
+ pStateSetHelper->AddState( AccessibleStateType::FOCUSABLE );
+ if( mpRepr->HasFocus() )
+ pStateSetHelper->AddState( AccessibleStateType::FOCUSED );
+ pStateSetHelper->AddState( AccessibleStateType::OPAQUE );
+
+ pStateSetHelper->AddState( AccessibleStateType::SHOWING );
+
+ if( mpRepr->IsVisible() )
+ pStateSetHelper->AddState( AccessibleStateType::VISIBLE );
+ }
+ else
+ pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
+
+ return pStateSetHelper;
+}
+
+void SAL_CALL RectCtlAccessibleContext::grabFocus()
+{
+ ::SolarMutexGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if (mpRepr)
+ mpRepr->GrabFocus();
+}
+
+sal_Int32 RectCtlAccessibleContext::getForeground()
+{
+ ::SolarMutexGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ //see SvxRectCtl::Paint
+ const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
+ return sal_Int32(rStyles.GetLabelTextColor());
+}
+
+sal_Int32 RectCtlAccessibleContext::getBackground( )
+{
+ ::SolarMutexGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ //see SvxRectCtl::Paint
+ const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
+ return sal_Int32(rStyles.GetDialogColor());
+}
+
+// XAccessibleSelection
+void RectCtlAccessibleContext::implSelect(sal_Int32 nIndex, bool bSelect)
+{
+ ::SolarMutexGuard aSolarGuard;
+
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ checkChildIndex( nIndex );
+
+ const ChildIndexToPointData* pData = IndexToPoint( nIndex );
+
+ DBG_ASSERT(pData, "RectCtlAccessibleContext::selectAccessibleChild(): this is an impossible state! Or at least should be...");
+
+ if (mpRepr)
+ {
+ if (bSelect)
+ {
+ // this does all what is needed, including the change of the child's state!
+ mpRepr->SetActualRP( pData->ePoint );
+ }
+ else
+ {
+ SAL_WARN( "svx", "RectCtlAccessibleContext::clearAccessibleSelection() is not possible!" );
+ }
+ }
+}
+
+bool RectCtlAccessibleContext::implIsSelected( sal_Int32 nIndex )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ checkChildIndex( nIndex );
+
+ return nIndex == mnSelectedChild;
+}
+
+// internals
+void RectCtlAccessibleContext::checkChildIndex( long nIndex )
+{
+ if( nIndex < 0 || nIndex >= getAccessibleChildCount() )
+ throw lang::IndexOutOfBoundsException();
+}
+
+void RectCtlAccessibleContext::FireChildFocus( RectPoint eButton )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ long nNew = PointToIndex( eButton );
+ long nNumOfChildren = getAccessibleChildCount();
+ if( nNew < nNumOfChildren )
+ {
+ // select new child
+ mnSelectedChild = nNew;
+ if( nNew != NOCHILDSELECTED )
+ {
+ if( mvChildren[ nNew ].is() )
+ mvChildren[ nNew ]->FireFocusEvent();
+ }
+ else
+ {
+ Any aOld;
+ Any aNew;
+ aNew <<= AccessibleStateType::FOCUSED;
+ NotifyAccessibleEvent(AccessibleEventId::STATE_CHANGED, aNew, aOld);
+ }
+ }
+ else
+ mnSelectedChild = NOCHILDSELECTED;
+}
+
+void RectCtlAccessibleContext::selectChild( long nNew )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if( nNew != mnSelectedChild )
+ {
+ long nNumOfChildren = getAccessibleChildCount();
+ if( nNew < nNumOfChildren )
+ { // valid index
+ RectCtlChildAccessibleContext* pChild;
+ if( mnSelectedChild != NOCHILDSELECTED )
+ { // deselect old selected child if one is selected
+ pChild = mvChildren[ mnSelectedChild ].get();
+ if( pChild )
+ pChild->setStateChecked( false );
+ }
+
+ // select new child
+ mnSelectedChild = nNew;
+
+ if( nNew != NOCHILDSELECTED )
+ {
+ if( mvChildren[ nNew ].is() )
+ mvChildren[ nNew ]->setStateChecked( true );
+ }
+ }
+ else
+ mnSelectedChild = NOCHILDSELECTED;
+ }
+}
+
+void RectCtlAccessibleContext::selectChild(RectPoint eButton )
+{
+ // no guard -> is done in next selectChild
+ selectChild(PointToIndex( eButton ));
+}
+
+void SAL_CALL RectCtlAccessibleContext::disposing()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ OAccessibleSelectionHelper::disposing();
+ for (auto & rxChild : mvChildren)
+ {
+ if( rxChild.is() )
+ rxChild->dispose();
+ }
+ mvChildren.clear();
+ mpRepr = nullptr;
+}
+
+awt::Rectangle RectCtlAccessibleContext::implGetBounds()
+{
+ ::SolarMutexGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ awt::Rectangle aRet;
+
+ if (mpRepr)
+ {
+ const Point aOutPos;//( mpRepr->GetPosPixel() );
+ Size aOutSize( mpRepr->GetSize());
+
+ aRet.X = aOutPos.X();
+ aRet.Y = aOutPos.Y();
+ aRet.Width = aOutSize.Width();
+ aRet.Height = aOutSize.Height();
+ }
+
+ return aRet;
+}
SvxRectCtlChildAccessibleContext::SvxRectCtlChildAccessibleContext(
const Reference<XAccessible>& rxParent,
@@ -1022,4 +1324,244 @@ void SvxRectCtlChildAccessibleContext::FireFocusEvent()
CommitChange( AccessibleEventObject( xSource, AccessibleEventId::STATE_CHANGED, aNew, aOld ) );
}
+RectCtlChildAccessibleContext::RectCtlChildAccessibleContext(
+ const Reference<XAccessible>& rxParent,
+ const OUString& rName,
+ const OUString& rDescription,
+ const tools::Rectangle& rBoundingBox,
+ long nIndexInParent )
+ : msDescription( rDescription )
+ , msName( rName )
+ , mxParent(rxParent)
+ , maBoundingBox( rBoundingBox )
+ , mnIndexInParent( nIndexInParent )
+ , mbIsChecked( false )
+{
+}
+
+RectCtlChildAccessibleContext::~RectCtlChildAccessibleContext()
+{
+ ensureDisposed();
+}
+
+Reference< XAccessible > SAL_CALL RectCtlChildAccessibleContext::getAccessibleAtPoint( const awt::Point& /*rPoint*/ )
+{
+ return Reference< XAccessible >();
+}
+
+void SAL_CALL RectCtlChildAccessibleContext::grabFocus()
+{
+}
+
+sal_Int32 RectCtlChildAccessibleContext::getForeground( )
+{
+ ::SolarMutexGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ //see SvxRectCtl::Paint
+ const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
+ return sal_Int32(rStyles.GetLabelTextColor());
+}
+
+sal_Int32 RectCtlChildAccessibleContext::getBackground( )
+{
+ ::SolarMutexGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ //see SvxRectCtl::Paint
+ const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
+ return sal_Int32(rStyles.GetDialogColor());
+}
+
+// XAccessibleContext
+sal_Int32 SAL_CALL RectCtlChildAccessibleContext::getAccessibleChildCount()
+{
+ return 0;
+}
+
+Reference< XAccessible > SAL_CALL RectCtlChildAccessibleContext::getAccessibleChild( sal_Int32 /*nIndex*/ )
+{
+ throw lang::IndexOutOfBoundsException();
+}
+
+Reference< XAccessible > SAL_CALL RectCtlChildAccessibleContext::getAccessibleParent()
+{
+ return mxParent;
+}
+
+sal_Int16 SAL_CALL RectCtlChildAccessibleContext::getAccessibleRole()
+{
+ return AccessibleRole::RADIO_BUTTON;
+}
+
+OUString SAL_CALL RectCtlChildAccessibleContext::getAccessibleDescription()
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ return msDescription;
+}
+
+OUString SAL_CALL RectCtlChildAccessibleContext::getAccessibleName()
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ return msName;
+}
+
+/** Return empty reference to indicate that the relation set is not
+ supported.
+*/
+Reference<XAccessibleRelationSet> SAL_CALL RectCtlChildAccessibleContext::getAccessibleRelationSet()
+{
+ utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
+ uno::Reference< css::accessibility::XAccessibleRelationSet > xSet = pRelationSetHelper;
+ if( mxParent.is() )
+ {
+ uno::Sequence< uno::Reference< uno::XInterface > > aSequence { mxParent };
+ pRelationSetHelper->AddRelation( css::accessibility::AccessibleRelation( css::accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) );
+
+ }
+
+ return xSet;
+}
+
+Reference< XAccessibleStateSet > SAL_CALL RectCtlChildAccessibleContext::getAccessibleStateSet()
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
+
+ if (!rBHelper.bDisposed)
+ {
+ if( mbIsChecked )
+ {
+ pStateSetHelper->AddState( AccessibleStateType::CHECKED );
+ }
+
+ pStateSetHelper->AddState( AccessibleStateType::ENABLED );
+ pStateSetHelper->AddState( AccessibleStateType::SENSITIVE );
+ pStateSetHelper->AddState( AccessibleStateType::OPAQUE );
+ pStateSetHelper->AddState( AccessibleStateType::SELECTABLE );
+ pStateSetHelper->AddState( AccessibleStateType::SHOWING );
+ pStateSetHelper->AddState( AccessibleStateType::VISIBLE );
+ }
+ else
+ pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
+
+ return pStateSetHelper;
+}
+
+// XAccessibleValue
+Any SAL_CALL RectCtlChildAccessibleContext::getCurrentValue()
+{
+ Any aRet;
+ aRet <<= ( mbIsChecked? 1.0 : 0.0 );
+ return aRet;
+}
+
+sal_Bool SAL_CALL RectCtlChildAccessibleContext::setCurrentValue( const Any& /*aNumber*/ )
+{
+ return false;
+}
+
+Any SAL_CALL RectCtlChildAccessibleContext::getMaximumValue()
+{
+ Any aRet;
+ aRet <<= 1.0;
+ return aRet;
+}
+
+Any SAL_CALL RectCtlChildAccessibleContext::getMinimumValue()
+{
+ Any aRet;
+ aRet <<= 0.0;
+ return aRet;
+}
+
+
+// XAccessibleAction
+
+
+sal_Int32 RectCtlChildAccessibleContext::getAccessibleActionCount( )
+{
+ return 1;
+}
+
+
+sal_Bool RectCtlChildAccessibleContext::doAccessibleAction ( sal_Int32 nIndex )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+ throw IndexOutOfBoundsException();
+
+ Reference<XAccessibleSelection> xSelection( mxParent, UNO_QUERY);
+
+ xSelection->selectAccessibleChild(mnIndexInParent);
+
+ return true;
+}
+
+
+OUString RectCtlChildAccessibleContext::getAccessibleActionDescription ( sal_Int32 nIndex )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+ throw IndexOutOfBoundsException();
+
+ return OUString("select");
+}
+
+
+Reference< XAccessibleKeyBinding > RectCtlChildAccessibleContext::getAccessibleActionKeyBinding( sal_Int32 nIndex )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+ throw IndexOutOfBoundsException();
+
+ return Reference< XAccessibleKeyBinding >();
+}
+
+void SAL_CALL RectCtlChildAccessibleContext::disposing()
+{
+ OAccessibleComponentHelper::disposing();
+ mxParent.clear();
+}
+
+awt::Rectangle RectCtlChildAccessibleContext::implGetBounds( )
+{
+ // no guard necessary, because no one changes maBoundingBox after creating it
+ return AWTRectangle(maBoundingBox);
+}
+
+void RectCtlChildAccessibleContext::setStateChecked( bool bChecked )
+{
+ if( mbIsChecked != bChecked )
+ {
+ mbIsChecked = bChecked;
+
+ Any aOld;
+ Any aNew;
+ Any& rMod = bChecked? aNew : aOld;
+
+ //Send the STATE_CHANGED(Focused) event to accessible
+ rMod <<= AccessibleStateType::FOCUSED;
+ NotifyAccessibleEvent(AccessibleEventId::STATE_CHANGED, aNew, aOld);
+
+ rMod <<= AccessibleStateType::CHECKED;
+
+ NotifyAccessibleEvent(AccessibleEventId::STATE_CHANGED, aNew, aOld);
+ }
+}
+
+void RectCtlChildAccessibleContext::FireFocusEvent()
+{
+ Any aOld;
+ Any aNew;
+ aNew <<= AccessibleStateType::FOCUSED;
+ NotifyAccessibleEvent(AccessibleEventId::STATE_CHANGED, aNew, aOld);
+}
+
+IMPLEMENT_FORWARD_XINTERFACE2( RectCtlChildAccessibleContext, OAccessibleComponentHelper, OAccessibleHelper_Base_3 )
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( RectCtlChildAccessibleContext, OAccessibleComponentHelper, OAccessibleHelper_Base_3 )
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx
index 7e2ffb67c0e3..a4d31925d242 100644
--- a/svx/source/dialog/dlgctrl.cxx
+++ b/svx/source/dialog/dlgctrl.cxx
@@ -353,7 +353,6 @@ void SvxRectCtl::DataChanged( const DataChangedEvent& rDCEvt )
}
// the control (rectangle with 9 circles)
-
void SvxRectCtl::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&)
{
InitSettings(rRenderContext);
@@ -660,6 +659,526 @@ void SvxRectCtl::DoCompletelyDisable(bool bNew)
Invalidate();
}
+BitmapEx& RectCtl::GetRectBitmap()
+{
+ if( !pBitmap )
+ InitRectBitmap();
+
+ return *pBitmap;
+}
+
+RectCtl::RectCtl(weld::Builder& rBuilder, const OString& rDrawingId, SvxTabPage* pPage, RectPoint eRpt, sal_uInt16 nBorder, sal_uInt16 nCircle)
+ : m_pPage(pPage)
+ , nBorderWidth(Application::GetDefaultDevice()->LogicToPixel(Size(nBorder, 0), MapMode(MapUnit::Map100thMM)).Width())
+ , nRadius(Application::GetDefaultDevice()->LogicToPixel(Size(nCircle, 0), MapMode(MapUnit::Map100thMM)).Width())
+ , eDefRP(eRpt)
+ , pBitmap(nullptr)
+ , m_nState(CTL_STATE::NONE)
+ , mbCompleteDisable(false)
+{
+ m_xControl.reset(rBuilder.weld_drawing_area(rDrawingId, CreateAccessible()));
+ m_xControl->connect_style_updated(LINK(this, RectCtl, MarkToResetSettings));
+ m_xControl->connect_draw(LINK(this, RectCtl, DoPaint));
+ m_xControl->connect_size_allocate(LINK(this, RectCtl, DoResize));
+ m_xControl->connect_mouse_press(LINK(this, RectCtl, DoMouseButtonDown));
+ m_xControl->connect_key_press(LINK(this, RectCtl, DoKeyDown));
+ m_xControl->connect_focus_in(LINK(this, RectCtl, DoGetFocus));
+ m_xControl->connect_focus_out(LINK(this, RectCtl, DoLoseFocus));
+
+ m_xControl->set_size_request(m_xControl->get_approximate_digit_width() * 25, m_xControl->get_text_height() * 5);
+ Resize_Impl();
+}
+
+void RectCtl::SetControlSettings(RectPoint eRpt, sal_uInt16 nBorder, sal_uInt16 nCircle)
+{
+ nBorderWidth = Application::GetDefaultDevice()->LogicToPixel(Size(nBorder, 0), MapMode(MapUnit::Map100thMM)).Width();
+ nRadius = Application::GetDefaultDevice()->LogicToPixel(Size(nCircle, 0), MapMode(MapUnit::Map100thMM)).Width();
+ eDefRP = eRpt;
+ Resize_Impl();
+}
+
+RectCtl::~RectCtl()
+{
+ delete pBitmap;
+
+ pAccContext.clear();
+}
+
+IMPL_LINK(RectCtl, DoResize, const Size&, rSize, void)
+{
+ m_aSize = rSize;
+ Resize_Impl();
+}
+
+void RectCtl::Resize_Impl()
+{
+ aPtLT = Point( 0 + nBorderWidth, 0 + nBorderWidth );
+ aPtMT = Point( m_aSize.Width() / 2, 0 + nBorderWidth );
+ aPtRT = Point( m_aSize.Width() - nBorderWidth, 0 + nBorderWidth );
+
+ aPtLM = Point( 0 + nBorderWidth, m_aSize.Height() / 2 );
+ aPtMM = Point( m_aSize.Width() / 2, m_aSize.Height() / 2 );
+ aPtRM = Point( m_aSize.Width() - nBorderWidth, m_aSize.Height() / 2 );
+
+ aPtLB = Point( 0 + nBorderWidth, m_aSize.Height() - nBorderWidth );
+ aPtMB = Point( m_aSize.Width() / 2, m_aSize.Height() - nBorderWidth );
+ aPtRB = Point( m_aSize.Width() - nBorderWidth, m_aSize.Height() - nBorderWidth );
+
+ Reset();
+ MarkToResetSettings(*m_xControl);
+ m_xControl->queue_draw();
+}
+
+void RectCtl::InitRectBitmap()
+{
+ delete pBitmap;
+
+ const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
+ svtools::ColorConfig aColorConfig;
+
+ pBitmap = new BitmapEx(RID_SVXCTRL_RECTBTNS);
+
+ // set bitmap-colors
+ Color aColorAry1[7];
+ Color aColorAry2[7];
+ aColorAry1[0] = Color( 0xC0, 0xC0, 0xC0 ); // light-gray
+ aColorAry1[1] = Color( 0xFF, 0xFF, 0x00 ); // yellow
+ aColorAry1[2] = Color( 0xFF, 0xFF, 0xFF ); // white
+ aColorAry1[3] = Color( 0x80, 0x80, 0x80 ); // dark-gray
+ aColorAry1[4] = Color( 0x00, 0x00, 0x00 ); // black
+ aColorAry1[5] = Color( 0x00, 0xFF, 0x00 ); // green
+ aColorAry1[6] = Color( 0x00, 0x00, 0xFF ); // blue
+ aColorAry2[0] = rStyles.GetDialogColor(); // background
+ aColorAry2[1] = rStyles.GetWindowColor();
+ aColorAry2[2] = rStyles.GetLightColor();
+ aColorAry2[3] = rStyles.GetShadowColor();
+ aColorAry2[4] = rStyles.GetDarkShadowColor();
+ aColorAry2[5] = aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor;
+ aColorAry2[6] = rStyles.GetDialogColor();
+
+#ifdef DBG_UTIL
+ static bool bModify = false;
+ bool& rModify = bModify;
+ if( rModify )
+ {
+ static int n = 0;
+ static sal_uInt8 r = 0xFF;
+ static sal_uInt8 g = 0x00;
+ static sal_uInt8 b = 0xFF;
+ int& rn = n;
+ sal_uInt8& rr = r;
+ sal_uInt8& rg = g;
+ sal_uInt8& rb = b;
+ aColorAry2[ rn ] = Color( rr, rg, rb );
+ }
+#endif
+
+ pBitmap->Replace( aColorAry1, aColorAry2, 7 );
+}
+
+IMPL_LINK_NOARG(RectCtl, MarkToResetSettings, weld::Widget&, void)
+{
+ delete pBitmap;
+ pBitmap = nullptr; // forces new creating of bitmap
+}
+
+void RectCtl::InitSettings(vcl::RenderContext& rRenderContext)
+{
+ svtools::ColorConfig aColorConfig;
+ Color aTextColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
+ rRenderContext.SetTextColor(aTextColor);
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+ rRenderContext.SetBackground(rStyleSettings.GetWindowColor());
+}
+
+// The clicked rectangle (3 x 3) is determined and the parent (dialog)
+// is notified that the item was changed
+IMPL_LINK(RectCtl, DoMouseButtonDown, const MouseEvent&, rMEvt, void)
+{
+ // CompletelyDisabled() added to have a disabled state for RectCtl
+ if(!IsCompletelyDisabled())
+ {
+ aPtNew = GetApproxLogPtFromPixPt( rMEvt.GetPosPixel() );
+ eRP = GetRPFromPoint( aPtNew );
+ SetActualRP( eRP );
+
+ if (m_pPage)
+ m_pPage->PointChanged(m_xControl.get(), eRP);
+ }
+}
+
+IMPL_LINK(RectCtl, DoKeyDown, const KeyEvent&, rKeyEvt, bool)
+{
+ // CompletelyDisabled() added to have a disabled state for RectCtl
+ if (IsCompletelyDisabled())
+ return false;
+
+ RectPoint eNewRP = eRP;
+
+ switch( rKeyEvt.GetKeyCode().GetCode() )
+ {
+ case KEY_DOWN:
+ {
+ if( !(m_nState & CTL_STATE::NOVERT) )
+ switch( eNewRP )
+ {
+ case RectPoint::LT: eNewRP = RectPoint::LM; break;
+ case RectPoint::MT: eNewRP = RectPoint::MM; break;
+ case RectPoint::RT: eNewRP = RectPoint::RM; break;
+ case RectPoint::LM: eNewRP = RectPoint::LB; break;
+ case RectPoint::MM: eNewRP = RectPoint::MB; break;
+ case RectPoint::RM: eNewRP = RectPoint::RB; break;
+ default: ; //prevent warning
+ }
+ }
+ break;
+ case KEY_UP:
+ {
+ if( !(m_nState & CTL_STATE::NOVERT) )
+ switch( eNewRP )
+ {
+ case RectPoint::LM: eNewRP = RectPoint::LT; break;
+ case RectPoint::MM: eNewRP = RectPoint::MT; break;
+ case RectPoint::RM: eNewRP = RectPoint::RT; break;
+ case RectPoint::LB: eNewRP = RectPoint::LM; break;
+ case RectPoint::MB: eNewRP = RectPoint::MM; break;
+ case RectPoint::RB: eNewRP = RectPoint::RM; break;
+ default: ; //prevent warning
+ }
+ }
+ break;
+ case KEY_LEFT:
+ {
+ if( !(m_nState & CTL_STATE::NOHORZ) )
+ switch( eNewRP )
+ {
+ case RectPoint::MT: eNewRP = RectPoint::LT; break;
+ case RectPoint::RT: eNewRP = RectPoint::MT; break;
+ case RectPoint::MM: eNewRP = RectPoint::LM; break;
+ case RectPoint::RM: eNewRP = RectPoint::MM; break;
+ case RectPoint::MB: eNewRP = RectPoint::LB; break;
+ case RectPoint::RB: eNewRP = RectPoint::MB; break;
+ default: ; //prevent warning
+ }
+ }
+ break;
+ case KEY_RIGHT:
+ {
+ if( !(m_nState & CTL_STATE::NOHORZ) )
+ switch( eNewRP )
+ {
+ case RectPoint::LT: eNewRP = RectPoint::MT; break;
+ case RectPoint::MT: eNewRP = RectPoint::RT; break;
+ case RectPoint::LM: eNewRP = RectPoint::MM; break;
+ case RectPoint::MM: eNewRP = RectPoint::RM; break;
+ case RectPoint::LB: eNewRP = RectPoint::MB; break;
+ case RectPoint::MB: eNewRP = RectPoint::RB; break;
+ default: ; //prevent warning
+ }
+ }
+ break;
+ default:
+ return false;
+ }
+ if( eNewRP != eRP )
+ {
+ SetActualRP( eNewRP );
+
+ if (m_pPage)
+ m_pPage->PointChanged(m_xControl.get(), eRP);
+ }
+ return true;
+}
+
+// the control (rectangle with 9 circles)
+IMPL_LINK(RectCtl, DoPaint, weld::DrawingArea::draw_args, aPayload, void)
+{
+ vcl::RenderContext& rRenderContext = aPayload.first;
+
+ InitSettings(rRenderContext);
+
+ Point aPtDiff(1, 1);
+
+ const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
+
+ rRenderContext.SetLineColor(rStyles.GetDialogColor());
+ rRenderContext.SetFillColor(rStyles.GetDialogColor());
+ rRenderContext.DrawRect(tools::Rectangle(Point(0,0), rRenderContext.GetOutputSize()));
+
+ if (m_xControl->get_sensitive())
+ rRenderContext.SetLineColor(rStyles.GetLabelTextColor());
+ else
+ rRenderContext.SetLineColor(rStyles.GetShadowColor());
+
+ rRenderContext.SetFillColor();
+
+ if (!m_xControl->get_sensitive())
+ {
+ Color aOldCol = rRenderContext.GetLineColor();
+ rRenderContext.SetLineColor(rStyles.GetLightColor());
+ rRenderContext.DrawRect(tools::Rectangle(aPtLT + aPtDiff, aPtRB + aPtDiff));
+ rRenderContext.SetLineColor(aOldCol);
+ }
+ rRenderContext.DrawRect(tools::Rectangle(aPtLT, aPtRB));
+
+ rRenderContext.SetFillColor(rRenderContext.GetBackground().GetColor());
+
+ Size aBtnSize(11, 11);
+ Size aDstBtnSize(aBtnSize);
+ Point aToCenter(aDstBtnSize.Width() >> 1, aDstBtnSize.Height() >> 1);
+ Point aBtnPnt1(m_xControl->get_sensitive() ? 0 : 22, 0);
+ Point aBtnPnt2(11, 0);
+ Point aBtnPnt3(22, 0);
+
+ bool bNoHorz = bool(m_nState & CTL_STATE::NOHORZ);
+ bool bNoVert = bool(m_nState & CTL_STATE::NOVERT);
+
+ BitmapEx& rBitmap = GetRectBitmap();
+
+ // CompletelyDisabled() added to have a disabled state for SvxRectCtl
+ if (IsCompletelyDisabled())
+ {
+ rRenderContext.DrawBitmap(aPtLT - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap.GetBitmap());
+ rRenderContext.DrawBitmap(aPtMT - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap.GetBitmap());
+ rRenderContext.DrawBitmap(aPtRT - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap.GetBitmap());
+ rRenderContext.DrawBitmap(aPtLM - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap.GetBitmap());
+ rRenderContext.DrawBitmap(aPtMM - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap.GetBitmap());
+ rRenderContext.DrawBitmap(aPtRM - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap.GetBitmap());
+ rRenderContext.DrawBitmap(aPtLB - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap.GetBitmap());
+ rRenderContext.DrawBitmap(aPtMB - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap.GetBitmap());
+ rRenderContext.DrawBitmap(aPtRB - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap.GetBitmap());
+ }
+ else
+ {
+ rRenderContext.DrawBitmap(aPtLT - aToCenter, aDstBtnSize, (bNoHorz || bNoVert)?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap.GetBitmap());
+ rRenderContext.DrawBitmap(aPtMT - aToCenter, aDstBtnSize, bNoVert?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap.GetBitmap());
+ rRenderContext.DrawBitmap(aPtRT - aToCenter, aDstBtnSize, (bNoHorz || bNoVert)?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap.GetBitmap());
+ rRenderContext.DrawBitmap(aPtLM - aToCenter, aDstBtnSize, bNoHorz?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap.GetBitmap());
+
+ // Center for rectangle and line
+ rRenderContext.DrawBitmap(aPtMM - aToCenter, aDstBtnSize, aBtnPnt1, aBtnSize, rBitmap.GetBitmap());
+
+ rRenderContext.DrawBitmap(aPtRM - aToCenter, aDstBtnSize, bNoHorz?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap.GetBitmap());
+ rRenderContext.DrawBitmap(aPtLB - aToCenter, aDstBtnSize, (bNoHorz || bNoVert)?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap.GetBitmap());
+ rRenderContext.DrawBitmap(aPtMB - aToCenter, aDstBtnSize, bNoVert?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap.GetBitmap());
+ rRenderContext.DrawBitmap(aPtRB - aToCenter, aDstBtnSize, (bNoHorz || bNoVert)?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap.GetBitmap());
+ }
+
+ // draw active button, avoid center pos for angle
+ // CompletelyDisabled() added to have a disabled state for SvxRectCtl
+ if (!IsCompletelyDisabled())
+ {
+ if (m_xControl->get_sensitive())
+ {
+ Point aCenterPt(aPtNew);
+ aCenterPt -= aToCenter;
+
+ rRenderContext.DrawBitmap(aCenterPt, aDstBtnSize, aBtnPnt2, aBtnSize, rBitmap.GetBitmap());
+ }
+ }
+
+ if (m_xControl->has_focus())
+ {
+ tools::Rectangle aFocusRect(CalculateFocusRectangle());
+ rRenderContext.Invert(aFocusRect, InvertFlags(0xffff));
+ }
+}
+
+// Convert RectPoint Point
+
+const Point& RectCtl::GetPointFromRP( RectPoint _eRP) const
+{
+ switch( _eRP )
+ {
+ case RectPoint::LT: return aPtLT;
+ case RectPoint::MT: return aPtMT;
+ case RectPoint::RT: return aPtRT;
+ case RectPoint::LM: return aPtLM;
+ case RectPoint::MM: return aPtMM;
+ case RectPoint::RM: return aPtRM;
+ case RectPoint::LB: return aPtLB;
+ case RectPoint::MB: return aPtMB;
+ case RectPoint::RB: return aPtRB;
+ }
+ return aPtMM; // default
+}
+
+Point RectCtl::SetActualRPWithoutInvalidate( RectPoint eNewRP )
+{
+ Point aPtLast = aPtNew;
+ aPtNew = GetPointFromRP( eNewRP );
+
+ if( m_nState & CTL_STATE::NOHORZ )
+ aPtNew.setX( aPtMM.X() );
+
+ if( m_nState & CTL_STATE::NOVERT )
+ aPtNew.setY( aPtMM.Y() );
+
+ // fdo#74751 this fix reverse base point on RTL UI.
+ bool bRTL = AllSettings::GetLayoutRTL();
+ eNewRP = GetRPFromPoint( aPtNew, bRTL );
+
+ eDefRP = eNewRP;
+ eRP = eNewRP;
+
+ return aPtLast;
+}
+
+IMPL_LINK_NOARG(RectCtl, DoGetFocus, weld::Widget&, void)
+{
+ m_xControl->queue_draw();
+
+ // Send accessibility event.
+ if (pAccContext.is())
+ {
+ pAccContext->FireChildFocus(GetActualRP());
+ }
+}
+
+IMPL_LINK_NOARG(RectCtl, DoLoseFocus, weld::Widget&, void)
+{
+ m_xControl->queue_draw();
+}
+
+Point RectCtl::GetApproxLogPtFromPixPt( const Point& rPt ) const
+{
+ Point aPt = rPt;
+ long x;
+ long y;
+
+ if( !( m_nState & CTL_STATE::NOHORZ ) )
+ {
+ if( aPt.X() < m_aSize.Width() / 3 )
+ x = aPtLT.X();
+ else if( aPt.X() < m_aSize.Width() * 2 / 3 )
+ x = aPtMM.X();
+ else
+ x = aPtRB.X();
+ }
+ else
+ x = aPtMM.X();
+
+ if( !( m_nState & CTL_STATE::NOVERT ) )
+ {
+ if( aPt.Y() < m_aSize.Height() / 3 )
+ y = aPtLT.Y();
+ else if( aPt.Y() < m_aSize.Height() * 2 / 3 )
+ y = aPtMM.Y();
+ else
+ y = aPtRB.Y();
+ }
+ else
+ y = aPtMM.Y();
+
+ return Point( x, y );
+}
+
+
+// Converts Point in RectPoint
+
+RectPoint RectCtl::GetRPFromPoint( Point aPt, bool bRTL ) const
+{
+ RectPoint rPoint = RectPoint::MM; // default
+
+ if (aPt == aPtLT) rPoint = bRTL ? RectPoint::RT : RectPoint::LT;
+ else if( aPt == aPtMT) rPoint = RectPoint::MT;
+ else if( aPt == aPtRT) rPoint = bRTL ? RectPoint::LT : RectPoint::RT;
+ else if( aPt == aPtLM) rPoint = bRTL ? RectPoint::RM : RectPoint::LM;
+ else if( aPt == aPtRM) rPoint = bRTL ? RectPoint::LM : RectPoint::RM;
+ else if( aPt == aPtLB) rPoint = bRTL ? RectPoint::RB : RectPoint::LB;
+ else if( aPt == aPtMB) rPoint = RectPoint::MB;
+ else if( aPt == aPtRB) rPoint = bRTL ? RectPoint::LB : RectPoint::RB;
+
+ return rPoint;
+}
+
+// Resets to the original state of the control
+
+void RectCtl::Reset()
+{
+ aPtNew = GetPointFromRP( eDefRP );
+ eRP = eDefRP;
+ m_xControl->queue_draw();
+}
+
+// Returns the currently selected RectPoint
+
+
+void RectCtl::SetActualRP( RectPoint eNewRP )
+{
+ SetActualRPWithoutInvalidate(eNewRP);
+
+ m_xControl->queue_draw();
+
+ // notify accessibility object about change
+ if (pAccContext.is())
+ pAccContext->selectChild( eNewRP /* MT, bFireFocus */ );
+}
+
+void RectCtl::SetState( CTL_STATE nState )
+{
+ m_nState = nState;
+
+ Point aPtLast( GetPointFromRP( eRP ) );
+ Point _aPtNew( aPtLast );
+
+ if( m_nState & CTL_STATE::NOHORZ )
+ _aPtNew.setX( aPtMM.X() );
+
+ if( m_nState & CTL_STATE::NOVERT)
+ _aPtNew.setY( aPtMM.Y() );
+
+ eRP = GetRPFromPoint( _aPtNew );
+ m_xControl->queue_draw();
+
+ if (m_pPage)
+ m_pPage->PointChanged(m_xControl.get(), eRP);
+}
+
+tools::Rectangle RectCtl::CalculateFocusRectangle() const
+{
+ Size aDstBtnSize(15, 15);
+ return tools::Rectangle( aPtNew - Point( aDstBtnSize.Width() >> 1, aDstBtnSize.Height() >> 1 ), aDstBtnSize );
+}
+
+tools::Rectangle RectCtl::CalculateFocusRectangle( RectPoint eRectPoint ) const
+{
+ tools::Rectangle aRet;
+ RectPoint eOldRectPoint = GetActualRP();
+
+ if( eOldRectPoint == eRectPoint )
+ aRet = CalculateFocusRectangle();
+ else
+ {
+ RectCtl* pThis = const_cast<RectCtl*>(this);
+
+ pThis->SetActualRPWithoutInvalidate( eRectPoint ); // no invalidation because it's only temporary!
+ aRet = CalculateFocusRectangle();
+
+ pThis->SetActualRPWithoutInvalidate( eOldRectPoint ); // no invalidation because nothing has changed!
+ }
+
+ return aRet;
+}
+
+Reference< XAccessible > RectCtl::CreateAccessible()
+{
+ pAccContext = new RectCtlAccessibleContext(this);
+ return pAccContext.get();
+}
+
+RectPoint RectCtl::GetApproxRPFromPixPt( const css::awt::Point& r ) const
+{
+ return GetRPFromPoint( GetApproxLogPtFromPixPt( Point( r.X, r.Y ) ) );
+}
+
+// CompletelyDisabled() added to have a disabled state for RectCtl
+void RectCtl::DoCompletelyDisable(bool bNew)
+{
+ mbCompleteDisable = bNew;
+ m_xControl->queue_draw();
+}
+
// Control for editing bitmaps
css::uno::Reference< css::accessibility::XAccessible > SvxPixelCtl::CreateAccessible()
diff --git a/svx/source/inc/charmapacc.hxx b/svx/source/inc/charmapacc.hxx
index 346add7aec3b..d594f390495e 100644
--- a/svx/source/inc/charmapacc.hxx
+++ b/svx/source/inc/charmapacc.hxx
@@ -85,7 +85,6 @@ namespace svx
//OAccessibleContextHelper
// XAccessibleContext - still waiting to be overwritten
- virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() override;
virtual sal_Int32 SAL_CALL getAccessibleChildCount() override;
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override;
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override;
diff --git a/svx/source/inc/svxrectctaccessiblecontext.hxx b/svx/source/inc/svxrectctaccessiblecontext.hxx
index 35e11bef8684..347e7f4c82ad 100644
--- a/svx/source/inc/svxrectctaccessiblecontext.hxx
+++ b/svx/source/inc/svxrectctaccessiblecontext.hxx
@@ -41,7 +41,9 @@
#include <cppuhelper/interfacecontainer.h>
#include <cppuhelper/compbase6.hxx>
#include <cppuhelper/compbase7.hxx>
+#include <cppuhelper/compbase3.hxx>
#include <cppuhelper/basemutex.hxx>
+#include <comphelper/accessibleselectionhelper.hxx>
#include <comphelper/servicehelper.hxx>
#include <svx/rectenum.hxx>
#include <vcl/vclptr.hxx>
@@ -56,11 +58,12 @@ namespace com { namespace sun { namespace star { namespace awt {
} } } }
namespace tools { class Rectangle; }
+class RectCtl;
class SvxRectCtl;
+class RectCtlChildAccessibleContext;
class SvxRectCtlChildAccessibleContext;
namespace vcl { class Window; }
-
typedef ::cppu::WeakAggComponentImplHelper6<
css::accessibility::XAccessible,
css::accessibility::XAccessibleComponent,
@@ -230,7 +233,10 @@ private:
virtual void SAL_CALL disposing() override;
/// @returns true if it's disposed or in disposing
- inline bool IsAlive() const;
+ bool IsAlive() const
+ {
+ return !rBHelper.bDisposed && !rBHelper.bInDispose;
+ }
/// @throws css::lang::DisposedException if it's not alive
void ThrowExceptionIfNotAlive();
@@ -261,10 +267,93 @@ private:
long mnSelectedChild;
};
-inline bool SvxRectCtlAccessibleContext::IsAlive() const
+typedef ::cppu::ImplHelper1<css::accessibility::XAccessible> OAccessibleHelper_Base;
+
+class RectCtlAccessibleContext final : public ::comphelper::OAccessibleSelectionHelper,
+ public OAccessibleHelper_Base
{
- return !rBHelper.bDisposed && !rBHelper.bInDispose;
-}
+public:
+ // internal
+ RectCtlAccessibleContext(RectCtl* pRepresentation);
+
+ DECLARE_XINTERFACE( )
+ DECLARE_XTYPEPROVIDER( )
+
+ // XAccessibleComponent
+ virtual void SAL_CALL grabFocus() override;
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point& rPoint) override;
+
+ // XAccessible
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount() override;
+ virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL getAccessibleChild(sal_Int32 nIndex) override;
+ virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL getAccessibleParent() override;
+ virtual sal_Int16 SAL_CALL getAccessibleRole() override;
+ virtual OUString SAL_CALL getAccessibleDescription() override;
+ virtual OUString SAL_CALL getAccessibleName() override;
+ virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override;
+ virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() override;
+
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext> SAL_CALL getAccessibleContext() override { return this; }
+ virtual sal_Int32 SAL_CALL getForeground() override;
+ virtual sal_Int32 SAL_CALL getBackground() override;
+
+ /** Selects a new child by point.
+
+ <p>If the child was not selected before, the state of the child will
+ be updated. If the point is not invalid, the index will internally set to NOCHILDSELECTED</p>
+
+ @param eButton
+ Button which belongs to the child which should be selected.
+ */
+ void selectChild( RectPoint ePoint );
+ void FireChildFocus( RectPoint eButton );
+
+private:
+ virtual ~RectCtlAccessibleContext() override;
+
+ // OCommonAccessibleSelection
+ // return if the specified child is visible => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
+ virtual bool implIsSelected(sal_Int32 nAccessibleChildIndex) override;
+
+ // select the specified child => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
+ virtual void implSelect(sal_Int32 nAccessibleChildIndex, bool bSelect) override;
+
+ // OCommonAccessibleComponent
+ virtual css::awt::Rectangle implGetBounds() override;
+
+ virtual void SAL_CALL disposing() override;
+
+ void checkChildIndex(long nIndex);
+
+ /** Selects a new child by index.
+
+ <p>If the child was not selected before, the state of the child will
+ be updated. If the index is invalid, the index will internally set to NOCHILDSELECTED</p>
+
+ @param nIndexOfChild
+ Index of the new child which should be selected.
+ */
+ void selectChild( long nIndexOfChild );
+
+ /** Description of this object. This is not a constant because it can
+ be set from the outside.
+ */
+ OUString msDescription;
+
+ /** Name of this object.
+ */
+ OUString msName;
+
+ /// pointer to internal representation
+ RectCtl* mpRepr;
+
+ /// array for all possible children
+ std::vector<rtl::Reference<RectCtlChildAccessibleContext>> mvChildren;
+
+ /// actual selected child
+ long mnSelectedChild;
+};
typedef ::cppu::WeakAggComponentImplHelper7<
css::accessibility::XAccessible,
@@ -408,7 +497,10 @@ protected:
virtual void SAL_CALL disposing() override;
/// @returns true if it's disposed or in disposing
- inline bool IsAlive() const;
+ bool IsAlive() const
+ {
+ return !rBHelper.bDisposed && !rBHelper.bInDispose;
+ }
/// @throws css::lang::DisposedException if it's not alive
void ThrowExceptionIfNotAlive();
@@ -449,10 +541,103 @@ private:
bool mbIsChecked;
};
-inline bool SvxRectCtlChildAccessibleContext::IsAlive() const
+typedef ::cppu::ImplHelper3 < css::accessibility::XAccessible,
+ css::accessibility::XAccessibleValue,
+ css::accessibility::XAccessibleAction
+ > OAccessibleHelper_Base_3;
+
+class RectCtlChildAccessibleContext : public ::comphelper::OAccessibleComponentHelper,
+ public OAccessibleHelper_Base_3
{
- return !rBHelper.bDisposed && !rBHelper.bInDispose;
-}
+public:
+ RectCtlChildAccessibleContext(
+ const css::uno::Reference< css::accessibility::XAccessible>& rxParent,
+ const OUString& rName, const OUString& rDescription,
+ const tools::Rectangle& rBoundingBox,
+ long nIndexInParent );
+protected:
+ virtual ~RectCtlChildAccessibleContext() override;
+
+ // OCommonAccessibleComponent
+ /// implements the calculation of the bounding rectangle - still waiting to be overwritten
+ virtual css::awt::Rectangle implGetBounds( ) override;
+public:
+
+ DECLARE_XINTERFACE( )
+ DECLARE_XTYPEPROVIDER( )
+
+ // XAccessibleComponent
+ virtual void SAL_CALL grabFocus() override;
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& rPoint ) override;
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount() override;
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 nIndex ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override;
+ virtual sal_Int16 SAL_CALL getAccessibleRole() override;
+ virtual OUString SAL_CALL getAccessibleDescription() override;
+ virtual OUString SAL_CALL getAccessibleName() override;
+ virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override;
+ virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() override;
+
+ virtual css::uno::Reference< css::accessibility::XAccessibleContext> SAL_CALL getAccessibleContext() override { return this; }
+
+ virtual sal_Int32 SAL_CALL getForeground() override;
+ virtual sal_Int32 SAL_CALL getBackground() override;
+
+ // XAccessibleValue
+ virtual css::uno::Any SAL_CALL
+ getCurrentValue() override;
+
+ virtual sal_Bool SAL_CALL
+ setCurrentValue( const css::uno::Any& aNumber ) override;
+
+ virtual css::uno::Any SAL_CALL
+ getMaximumValue() override;
+
+ virtual css::uno::Any SAL_CALL
+ getMinimumValue() override;
+
+ // XAccessibleAction
+ virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) override;
+ virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) override;
+ virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) override;
+ virtual css::uno::Reference< css::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) override;
+
+ // internal
+ /// Sets the checked status
+ void setStateChecked(bool bChecked);
+ void FireFocusEvent();
+
+protected:
+ virtual void SAL_CALL disposing() override;
+
+private:
+
+ /** Description of this object. This is not a constant because it can
+ be set from the outside. Furthermore, it changes according to the
+ draw page's display mode.
+ */
+ OUString msDescription;
+
+ /** Name of this object. It changes according the draw page's
+ display mode.
+ */
+ OUString msName;
+
+ /// Reference to the parent object.
+ css::uno::Reference< css::accessibility::XAccessible >
+ mxParent;
+
+ /// Bounding box
+ tools::Rectangle maBoundingBox;
+
+ /// index of child in parent
+ long mnIndexInParent;
+
+ /// Indicates, if object is checked
+ bool mbIsChecked;
+};
#endif
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 3ec78eb95013..8af07394c310 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -18,6 +18,7 @@
*/
#include <comphelper/lok.hxx>
+#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
#include <salframe.hxx>
#include <salinst.hxx>
#include <salvd.hxx>
@@ -30,6 +31,7 @@
#include <salmenu.hxx>
#include <svdata.hxx>
#include <messagedialog.hxx>
+#include <unotools/accessiblerelationsethelper.hxx>
#include <vcl/builder.hxx>
#include <vcl/combobox.hxx>
#include <vcl/lstbox.hxx>
@@ -1604,6 +1606,7 @@ private:
DECL_LINK(MouseReleaseHdl, const MouseEvent&, void);
DECL_LINK(KeyPressHdl, const KeyEvent&, bool);
DECL_LINK(KeyReleaseHdl, const KeyEvent&, bool);
+ DECL_LINK(StyleUpdatedHdl, VclDrawingArea&, void);
public:
SalInstanceDrawingArea(VclDrawingArea* pDrawingArea, const a11yref& rAlly,
@@ -1620,6 +1623,7 @@ public:
m_xDrawingArea->SetMouseReleaseHdl(LINK(this, SalInstanceDrawingArea, MouseReleaseHdl));
m_xDrawingArea->SetKeyPressHdl(LINK(this, SalInstanceDrawingArea, KeyPressHdl));
m_xDrawingArea->SetKeyReleaseHdl(LINK(this, SalInstanceDrawingArea, KeyReleaseHdl));
+ m_xDrawingArea->SetStyleUpdatedHdl(LINK(this, SalInstanceDrawingArea, StyleUpdatedHdl));
}
virtual void queue_draw() override
@@ -1640,8 +1644,32 @@ public:
return css::uno::Reference<css::accessibility::XAccessible>();
}
+ virtual a11yrelationset get_accessible_relation_set() override
+ {
+ utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
+ css::uno::Reference< css::accessibility::XAccessibleRelationSet > xSet = pRelationSetHelper;
+ vcl::Window* pWindow = m_xDrawingArea.get();
+ if (pWindow)
+ {
+ vcl::Window *pLabeledBy = pWindow->GetAccessibleRelationLabeledBy();
+ if (pLabeledBy && pLabeledBy != pWindow)
+ {
+ css::uno::Sequence<css::uno::Reference<css::uno::XInterface>> aSequence { pLabeledBy->GetAccessible() };
+ pRelationSetHelper->AddRelation( css::accessibility::AccessibleRelation( css::accessibility::AccessibleRelationType::LABELED_BY, aSequence ) );
+ }
+ vcl::Window* pMemberOf = pWindow->GetAccessibleRelationMemberOf();
+ if (pMemberOf && pMemberOf != pWindow)
+ {
+ css::uno::Sequence<css::uno::Reference<css::uno::XInterface>> aSequence { pMemberOf->GetAccessible() };
+ pRelationSetHelper->AddRelation( css::accessibility::AccessibleRelation( css::accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) );
+ }
+ }
+ return xSet;
+ }
+
virtual ~SalInstanceDrawingArea() override
{
+ m_xDrawingArea->SetStyleUpdatedHdl(Link<VclDrawingArea&, void>());
m_xDrawingArea->SetMousePressHdl(Link<const MouseEvent&, void>());
m_xDrawingArea->SetMouseMoveHdl(Link<const MouseEvent&, void>());
m_xDrawingArea->SetMouseReleaseHdl(Link<const MouseEvent&, void>());
@@ -1687,6 +1715,11 @@ IMPL_LINK(SalInstanceDrawingArea, KeyReleaseHdl, const KeyEvent&, rEvent, bool)
return m_aKeyReleaseHdl.Call(rEvent);
}
+IMPL_LINK_NOARG(SalInstanceDrawingArea, StyleUpdatedHdl, VclDrawingArea&, void)
+{
+ m_aStyleUpdatedHdl.Call(*this);
+}
+
//ComboBox and ListBox have similar apis, ComboBoxes in LibreOffice have an edit box and ListBoxes
//don't. This distinction isn't there in Gtk. Use a template to sort this problem out.
template <class vcl_type>
diff --git a/vcl/unx/gtk/a11y/atkwrapper.cxx b/vcl/unx/gtk/a11y/atkwrapper.cxx
index 33ec9caabb14..baae426bc6d1 100644
--- a/vcl/unx/gtk/a11y/atkwrapper.cxx
+++ b/vcl/unx/gtk/a11y/atkwrapper.cxx
@@ -468,6 +468,11 @@ static gint
wrapper_get_index_in_parent( AtkObject *atk_obj )
{
AtkObjectWrapper *obj = ATK_OBJECT_WRAPPER (atk_obj);
+
+ //if we're a native GtkDrawingArea with custom a11y, use the default toolkit index in parent
+ if (obj->mpOrig)
+ return atk_object_get_index_in_parent(obj->mpOrig);
+
gint i = -1;
if( obj->mpContext.is() )
@@ -488,6 +493,11 @@ static AtkRelationSet *
wrapper_ref_relation_set( AtkObject *atk_obj )
{
AtkObjectWrapper *obj = ATK_OBJECT_WRAPPER (atk_obj);
+
+ //if we're a native GtkDrawingArea with custom a11y, use the default toolkit relation set impl
+ if (obj->mpOrig)
+ return atk_object_ref_relation_set(obj->mpOrig);
+
AtkRelationSet *pSet = atk_relation_set_new();
if( obj->mpContext.is() )
@@ -797,7 +807,7 @@ atk_object_wrapper_ref( const uno::Reference< accessibility::XAccessible > &rxAc
AtkObject *
atk_object_wrapper_new( const css::uno::Reference< css::accessibility::XAccessible >& rxAccessible,
- AtkObject* parent )
+ AtkObject* parent, AtkObject* orig )
{
g_return_val_if_fail( rxAccessible.get() != nullptr, nullptr );
@@ -818,6 +828,7 @@ atk_object_wrapper_new( const css::uno::Reference< css::accessibility::XAccessib
pWrap->child_about_to_be_removed = nullptr;
pWrap->mpContext = xContext;
+ pWrap->mpOrig = orig;
AtkObject* atk_obj = ATK_OBJECT(pWrap);
atk_obj->role = mapToAtkRole( xContext->getAccessibleRole() );
diff --git a/vcl/unx/gtk/a11y/atkwrapper.hxx b/vcl/unx/gtk/a11y/atkwrapper.hxx
index e8ab83b5c778..0cb3f7b1c907 100644
--- a/vcl/unx/gtk/a11y/atkwrapper.hxx
+++ b/vcl/unx/gtk/a11y/atkwrapper.hxx
@@ -43,6 +43,7 @@ namespace com { namespace sun { namespace star { namespace accessibility {
struct AtkObjectWrapper
{
AtkObject aParent;
+ AtkObject* mpOrig; //if we're a GtkDrawingArea acting as a custom LibreOffice widget, this is the toolkit default impl
css::uno::Reference<css::accessibility::XAccessible> mpAccessible;
css::uno::Reference<css::accessibility::XAccessibleContext> mpContext;
@@ -79,7 +80,7 @@ AtkObject * atk_object_wrapper_ref(
AtkObject * atk_object_wrapper_new(
const css::uno::Reference< css::accessibility::XAccessible >& rxAccessible,
- AtkObject* parent = nullptr );
+ AtkObject* parent = nullptr, AtkObject* orig = nullptr );
void atk_object_wrapper_add_child(AtkObjectWrapper* wrapper, AtkObject *child, gint index);
void atk_object_wrapper_remove_child(AtkObjectWrapper* wrapper, AtkObject *child, gint index);
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 250f5e845a99..b33013916a85 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -3485,6 +3485,7 @@ private:
gulong m_nButtonReleaseSignalId;
gulong m_nKeyPressSignalId;
gulong m_nKeyReleaseSignalId;
+ gulong m_nStyleUpdatedSignalId;
static gboolean signalDraw(GtkWidget*, cairo_t* cr, gpointer widget)
{
@@ -3529,6 +3530,16 @@ private:
#endif
m_aSizeAllocateHdl.Call(Size(nWidth, nHeight));
}
+ static void signalStyleUpdated(GtkWidget*, gpointer widget)
+ {
+ GtkInstanceDrawingArea* pThis = static_cast<GtkInstanceDrawingArea*>(widget);
+ SolarMutexGuard aGuard;
+ return pThis->signal_style_updated();
+ }
+ void signal_style_updated()
+ {
+ m_aStyleUpdatedHdl.Call(*this);
+ }
static gboolean signalButton(GtkWidget*, GdkEventButton* pEvent, gpointer widget)
{
GtkInstanceDrawingArea* pThis = static_cast<GtkInstanceDrawingArea*>(widget);
@@ -3655,16 +3666,17 @@ public:
, m_nButtonReleaseSignalId(g_signal_connect(m_pDrawingArea, "button-release-event", G_CALLBACK(signalButton), this))
, m_nKeyPressSignalId(g_signal_connect(m_pDrawingArea, "key-press-event", G_CALLBACK(signalKey), this))
, m_nKeyReleaseSignalId(g_signal_connect(m_pDrawingArea,"key-release-event", G_CALLBACK(signalKey), this))
+ , m_nStyleUpdatedSignalId(g_signal_connect(m_pDrawingArea,"style-updated", G_CALLBACK(signalStyleUpdated), this))
{
g_object_set_data(G_OBJECT(m_pDrawingArea), "g-lo-GtkInstanceDrawingArea", this);
}
- AtkObject* GetAtkObject()
+ AtkObject* GetAtkObject(AtkObject* pDefaultAccessible)
{
if (!m_pAccessible && m_xAccessible.is())
{
GtkWidget* pParent = gtk_widget_get_parent(m_pWidget);
- m_pAccessible = atk_object_wrapper_new(m_xAccessible, gtk_widget_get_accessible(pParent));
+ m_pAccessible = atk_object_wrapper_new(m_xAccessible, gtk_widget_get_accessible(pParent), pDefaultAccessible);
}
return m_pAccessible;
}
@@ -3689,6 +3701,14 @@ public:
return uno::Reference<css::accessibility::XAccessible>();
}
+ virtual a11yrelationset get_accessible_relation_set() override
+ {
+ //get_accessible_relation_set should only be needed for the vcl implementation,
+ //in the gtk impl the native equivalent should negate the need.
+ assert(false && "get_accessible_parent should only be called on a vcl impl");
+ return uno::Reference<css::accessibility::XAccessibleRelationSet>();
+ }
+
virtual ~GtkInstanceDrawingArea() override
{
g_object_steal_data(G_OBJECT(m_pDrawingArea), "g-lo-GtkInstanceDrawingArea");
@@ -3696,6 +3716,7 @@ public:
g_object_unref(m_pAccessible);
if (m_pSurface)
cairo_surface_destroy(m_pSurface);
+ g_signal_handler_disconnect(m_pDrawingArea, m_nStyleUpdatedSignalId);
g_signal_handler_disconnect(m_pDrawingArea, m_nKeyPressSignalId);
g_signal_handler_disconnect(m_pDrawingArea, m_nKeyReleaseSignalId);
g_signal_handler_disconnect(m_pDrawingArea, m_nButtonPressSignalId);
@@ -4167,12 +4188,13 @@ AtkObject* (*default_drawing_area_get_accessible)(GtkWidget *widget);
AtkObject* drawing_area_get_accessibity(GtkWidget *pWidget)
{
+ AtkObject* pDefaultAccessible = default_drawing_area_get_accessible(pWidget);
void* pData = g_object_get_data(G_OBJECT(pWidget), "g-lo-GtkInstanceDrawingArea");
GtkInstanceDrawingArea* pDrawingArea = static_cast<GtkInstanceDrawingArea*>(pData);
- AtkObject *pAtkObj = pDrawingArea ? pDrawingArea->GetAtkObject() : nullptr;
+ AtkObject *pAtkObj = pDrawingArea ? pDrawingArea->GetAtkObject(pDefaultAccessible) : nullptr;
if (pAtkObj)
return pAtkObj;
- return default_drawing_area_get_accessible(pWidget);
+ return pDefaultAccessible;
}
void ensure_intercept_drawing_area_accessibility()