diff options
-rw-r--r-- | svx/source/dialog/frmsel.cxx | 54 | ||||
-rw-r--r-- | svx/source/inc/frmselimpl.hxx | 109 |
2 files changed, 83 insertions, 80 deletions
diff --git a/svx/source/dialog/frmsel.cxx b/svx/source/dialog/frmsel.cxx index 2ea626589ffc..7d606d2fe640 100644 --- a/svx/source/dialog/frmsel.cxx +++ b/svx/source/dialog/frmsel.cxx @@ -22,8 +22,8 @@ #include <algorithm> #include <math.h> -#include "frmselimpl.hxx" -#include "AccessibleFrameSelector.hxx" +#include <frmselimpl.hxx> +#include <AccessibleFrameSelector.hxx> #include <svx/dialmgr.hxx> #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> @@ -60,9 +60,8 @@ size_t GetIndexFromFrameBorderType( FrameBorderType eBorder ) return static_cast< size_t >( eBorder ) - 1; } - - -namespace { +namespace +{ /** Space between outer control border and any graphical element of the control. */ const long FRAMESEL_GEOM_OUTER = 2; @@ -80,7 +79,6 @@ const long FRAMESEL_GEOM_ADD_CLICK_OUTER = 5; const long FRAMESEL_GEOM_ADD_CLICK_INNER = 2; - /** Returns the corresponding flag for a frame border. */ FrameSelFlags lclGetFlagFromType( FrameBorderType eBorder ) { @@ -301,12 +299,12 @@ void FrameSelectorImpl::Initialize( FrameSelFlags nFlags ) void FrameSelectorImpl::InitColors() { - const StyleSettings& rSett = mrFrameSel.GetSettings().GetStyleSettings(); - maBackCol = rSett.GetFieldColor(); - mbHCMode = rSett.GetHighContrastMode(); - maArrowCol = rSett.GetFieldTextColor(); - maMarkCol.operator=( maBackCol ).Merge( maArrowCol, mbHCMode ? 0x80 : 0xC0 ); - maHCLineCol = rSett.GetLabelTextColor(); + const StyleSettings& rSettings = mrFrameSel.GetSettings().GetStyleSettings(); + maBackCol = rSettings.GetFieldColor(); + mbHCMode = rSettings.GetHighContrastMode(); + maArrowCol = rSettings.GetFieldTextColor(); + maMarkCol.operator=(maBackCol).Merge(maArrowCol, mbHCMode ? 0x80 : 0xC0); + maHCLineCol = rSettings.GetLabelTextColor(); } void FrameSelectorImpl::InitArrowImageList() @@ -595,8 +593,8 @@ void FrameSelectorImpl::DrawArrows( const FrameBorder& rBorder ) void FrameSelectorImpl::DrawAllArrows() { - for( FrameBorderCIter aIt( maEnabBorders ); aIt.Is(); ++aIt ) - DrawArrows( **aIt ); + for(FrameBorderCIter aIt(maEnabBorders); aIt.Is(); ++aIt) + DrawArrows(**aIt); } Color FrameSelectorImpl::GetDrawLineColor( const Color& rColor ) const @@ -669,29 +667,29 @@ void FrameSelectorImpl::DrawVirtualDevice() mbFullRepaint = false; } -void FrameSelectorImpl::CopyVirDevToControl() +void FrameSelectorImpl::CopyVirDevToControl(vcl::RenderContext& rRenderContext) { - if( mbFullRepaint ) + if (mbFullRepaint) DrawVirtualDevice(); - mrFrameSel.DrawBitmap( maVirDevPos, mpVirDev->GetBitmap( Point( 0, 0 ), mpVirDev->GetOutputSizePixel() ) ); + rRenderContext.DrawBitmap(maVirDevPos, mpVirDev->GetBitmap(Point(0, 0), mpVirDev->GetOutputSizePixel())); } void FrameSelectorImpl::DrawAllTrackingRects() { tools::PolyPolygon aPPoly; - if( mrFrameSel.IsAnyBorderSelected() ) + if (mrFrameSel.IsAnyBorderSelected()) { - for( SelFrameBorderCIter aIt( maEnabBorders ); aIt.Is(); ++aIt ) - (*aIt)->MergeFocusToPolyPolygon( aPPoly ); - aPPoly.Move( maVirDevPos.X(), maVirDevPos.Y() ); + for(SelFrameBorderCIter aIt( maEnabBorders ); aIt.Is(); ++aIt) + (*aIt)->MergeFocusToPolyPolygon(aPPoly); + aPPoly.Move(maVirDevPos.X(), maVirDevPos.Y()); } else // no frame border selected -> draw tracking rectangle around entire control - aPPoly.Insert( Polygon( Rectangle( maVirDevPos, mpVirDev->GetOutputSizePixel() ) ) ); + aPPoly.Insert(Polygon(Rectangle(maVirDevPos, mpVirDev->GetOutputSizePixel()))); - aPPoly.Optimize( PolyOptimizeFlags::CLOSE ); - for( sal_uInt16 nIdx = 0, nCount = aPPoly.Count(); nIdx < nCount; ++nIdx ) - mrFrameSel.InvertTracking( aPPoly.GetObject( nIdx ), SHOWTRACK_SMALL | SHOWTRACK_WINDOW ); + aPPoly.Optimize(PolyOptimizeFlags::CLOSE); + for(sal_uInt16 nIdx = 0, nCount = aPPoly.Count(); nIdx < nCount; ++nIdx) + mrFrameSel.InvertTracking(aPPoly.GetObject(nIdx), SHOWTRACK_SMALL | SHOWTRACK_WINDOW); } Point FrameSelectorImpl::GetDevPosFromMousePos( const Point& rMousePos ) const @@ -1044,10 +1042,10 @@ Rectangle FrameSelector::GetClickBoundRect( FrameBorderType eBorder ) const } // virtual functions from base class -void FrameSelector::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& ) +void FrameSelector::Paint(vcl::RenderContext& rRenderContext, const Rectangle&) { - mxImpl->CopyVirDevToControl(); - if( HasFocus() ) + mxImpl->CopyVirDevToControl(rRenderContext); + if (HasFocus()) mxImpl->DrawAllTrackingRects(); } diff --git a/svx/source/inc/frmselimpl.hxx b/svx/source/inc/frmselimpl.hxx index 926fbe71d0f8..762c3cc54459 100644 --- a/svx/source/inc/frmselimpl.hxx +++ b/svx/source/inc/frmselimpl.hxx @@ -28,73 +28,80 @@ namespace svx { -namespace a11y { class AccFrameSelector; } - - +namespace a11y { + class AccFrameSelector; +} class FrameBorder { public: - explicit FrameBorder( FrameBorderType eType ); + explicit FrameBorder(FrameBorderType eType); - inline FrameBorderType GetType() const { return meType; } + inline FrameBorderType GetType() const + { + return meType; + } - inline bool IsEnabled() const { return mbEnabled; } - void Enable( FrameSelFlags nFlags ); + inline bool IsEnabled() const + { + return mbEnabled; + } + void Enable(FrameSelFlags nFlags); - inline FrameBorderState GetState() const { return meState; } - void SetState( FrameBorderState eState ); + inline FrameBorderState GetState() const + { + return meState; + } + void SetState(FrameBorderState eState); - inline bool IsSelected() const { return mbSelected; } - inline void Select( bool bSelect ) { mbSelected = bSelect; } + inline bool IsSelected() const { return mbSelected; } + inline void Select( bool bSelect ) { mbSelected = bSelect; } const editeng::SvxBorderLine& GetCoreStyle() const { return maCoreStyle; } - void SetCoreStyle( const editeng::SvxBorderLine* pStyle ); + void SetCoreStyle( const editeng::SvxBorderLine* pStyle ); - inline void SetUIColorPrim( const Color& rColor ) {maUIStyle.SetColorPrim( rColor ); } - inline void SetUIColorSecn( const Color& rColor ) {maUIStyle.SetColorSecn( rColor ); } - inline void SetUIColorGap( bool bUseIt, const Color& rColor ) {maUIStyle.SetColorGap(bUseIt, rColor);} + inline void SetUIColorPrim( const Color& rColor ) {maUIStyle.SetColorPrim( rColor ); } + inline void SetUIColorSecn( const Color& rColor ) {maUIStyle.SetColorSecn( rColor ); } + inline void SetUIColorGap( bool bUseIt, const Color& rColor ) {maUIStyle.SetColorGap(bUseIt, rColor);} inline const frame::Style& GetUIStyle() const { return maUIStyle; } - inline void ClearFocusArea() { maFocusArea.Clear(); } - void AddFocusPolygon( const Polygon& rFocus ); - void MergeFocusToPolyPolygon( tools::PolyPolygon& rPPoly ) const; + inline void ClearFocusArea() { maFocusArea.Clear(); } + void AddFocusPolygon( const Polygon& rFocus ); + void MergeFocusToPolyPolygon( tools::PolyPolygon& rPPoly ) const; - inline void ClearClickArea() { maClickArea.Clear(); } - void AddClickRect( const Rectangle& rRect ); - bool ContainsClickPoint( const Point& rPos ) const; - Rectangle GetClickBoundRect() const; + inline void ClearClickArea() { maClickArea.Clear(); } + void AddClickRect( const Rectangle& rRect ); + bool ContainsClickPoint( const Point& rPos ) const; + Rectangle GetClickBoundRect() const; - void SetKeyboardNeighbors( - FrameBorderType eLeft, FrameBorderType eRight, - FrameBorderType eTop, FrameBorderType eBottom ); - FrameBorderType GetKeyboardNeighbor( sal_uInt16 nKeyCode ) const; + void SetKeyboardNeighbors(FrameBorderType eLeft, FrameBorderType eRight, + FrameBorderType eTop, FrameBorderType eBottom); + FrameBorderType GetKeyboardNeighbor( sal_uInt16 nKeyCode ) const; private: - const FrameBorderType meType; /// Frame border type (position in control). - FrameBorderState meState; /// Frame border state (on/off/don't care). - editeng::SvxBorderLine maCoreStyle; /// Core style from application. - frame::Style maUIStyle; /// Internal style to draw lines. - FrameBorderType meKeyLeft; /// Left neighbor for keyboard control. - FrameBorderType meKeyRight; /// Right neighbor for keyboard control. - FrameBorderType meKeyTop; /// Upper neighbor for keyboard control. - FrameBorderType meKeyBottom; /// Lower neighbor for keyboard control. - tools::PolyPolygon maFocusArea; /// Focus drawing areas. - tools::PolyPolygon maClickArea; /// Mouse click areas. - bool mbEnabled; /// true = Border enabled in control. - bool mbSelected; /// true = Border selected in control. + const FrameBorderType meType; /// Frame border type (position in control). + FrameBorderState meState; /// Frame border state (on/off/don't care). + editeng::SvxBorderLine maCoreStyle; /// Core style from application. + frame::Style maUIStyle; /// Internal style to draw lines. + FrameBorderType meKeyLeft; /// Left neighbor for keyboard control. + FrameBorderType meKeyRight; /// Right neighbor for keyboard control. + FrameBorderType meKeyTop; /// Upper neighbor for keyboard control. + FrameBorderType meKeyBottom; /// Lower neighbor for keyboard control. + tools::PolyPolygon maFocusArea; /// Focus drawing areas. + tools::PolyPolygon maClickArea; /// Mouse click areas. + bool mbEnabled : 1; /// true = Border enabled in control. + bool mbSelected : 1; /// true = Border selected in control. }; -typedef std::vector< FrameBorder* > FrameBorderPtrVec; +typedef std::vector< FrameBorder* > FrameBorderPtrVec; struct FrameSelectorImpl : public Resource { - typedef ::com::sun::star::uno::Reference< - ::com::sun::star::accessibility::XAccessible > XAccessibleRef; - typedef std::vector< a11y::AccFrameSelector* > AccessibleImplVec; - typedef std::vector< XAccessibleRef > XAccessibleRefVec; + typedef css::uno::Reference<css::accessibility::XAccessible> XAccessibleRef; + typedef std::vector<a11y::AccFrameSelector*> AccessibleImplVec; + typedef std::vector<XAccessibleRef> XAccessibleRefVec; FrameSelector& mrFrameSel; /// The control itself. ScopedVclPtr<VirtualDevice> mpVirDev; /// For all buffered drawing operations. @@ -114,7 +121,7 @@ struct FrameSelectorImpl : public Resource FrameBorder maVer; /// All data of inner vertical frame border. FrameBorder maTLBR; /// All data of top-left to bottom-right frame border. FrameBorder maBLTR; /// All data of bottom-left to top-right frame border. - editeng::SvxBorderLine maCurrStyle; /// Current style and color for new borders. + editeng::SvxBorderLine maCurrStyle; /// Current style and color for new borders. frame::Array maArray; /// Frame link array to draw an array of frame borders. FrameSelFlags mnFlags; /// Flags for enabled frame borders. @@ -188,7 +195,7 @@ struct FrameSelectorImpl : public Resource /** Draws all contents of the control. */ void DrawVirtualDevice(); /** Copies contents of the virtual device to the control. */ - void CopyVirDevToControl(); + void CopyVirDevToControl(vcl::RenderContext& rRenderContext); /** Draws tracking rectangles for all selected frame borders. */ void DrawAllTrackingRects(); @@ -244,11 +251,11 @@ template< typename Cont, typename Iter, typename Pred > class FrameBorderIterBase { public: - typedef Cont container_type; - typedef Iter iterator_type; - typedef Pred predicate_type; - typedef typename Cont::value_type value_type; - typedef FrameBorderIterBase< Cont, Iter, Pred > this_type; + typedef Cont container_type; + typedef Iter iterator_type; + typedef Pred predicate_type; + typedef typename Cont::value_type value_type; + typedef FrameBorderIterBase<Cont, Iter, Pred> this_type; explicit FrameBorderIterBase( container_type& rCont ); inline bool Is() const { return maIt != maEnd; } @@ -285,8 +292,6 @@ typedef FrameBorderIterBase< const FrameBorderPtrVec, FrameBorderPtrVec::const_i typedef FrameBorderIterBase< FrameBorderPtrVec, FrameBorderPtrVec::iterator, FrameBorderSelected_Pred > SelFrameBorderIter; - - } // namespace svx #endif |