diff options
-rw-r--r-- | include/svx/ruler.hxx | 33 | ||||
-rw-r--r-- | sd/source/ui/inc/Ruler.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/drviews1.cxx | 10 | ||||
-rw-r--r-- | sd/source/ui/view/sdruler.cxx | 2 | ||||
-rw-r--r-- | svx/source/dialog/svxruler.cxx | 34 | ||||
-rw-r--r-- | sw/source/uibase/inc/swruler.hxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/misc/swruler.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view.cxx | 14 |
8 files changed, 53 insertions, 46 deletions
diff --git a/include/svx/ruler.hxx b/include/svx/ruler.hxx index e36339558696..01eaa6c06b0e 100644 --- a/include/svx/ruler.hxx +++ b/include/svx/ruler.hxx @@ -59,6 +59,22 @@ namespace o3tl template<> struct typed_flags<SvxRulerDragFlags> : is_typed_flags<SvxRulerDragFlags, 0x0f> {}; } +enum class SvxRulerSupportFlags +{ + TABS = 0x0001, + PARAGRAPH_MARGINS = 0x0002, + BORDERS = 0x0004, + OBJECT = 0x0008, + SET_NULLOFFSET = 0x0010, + NEGATIVE_MARGINS = 0x0020, + PARAGRAPH_MARGINS_VERTICAL = 0x0040, + REDUCED_METRIC = 0x0080, //shorten the context menu to select metric +}; +namespace o3tl +{ + template<> struct typed_flags<SvxRulerSupportFlags> : is_typed_flags<SvxRulerSupportFlags, 0x00ff> {}; +} + class SVX_DLLPUBLIC SvxRuler: public Ruler, public SfxListener { friend class SvxRulerItem; @@ -85,8 +101,8 @@ class SVX_DLLPUBLIC SvxRuler: public Ruler, public SfxListener long lAppNullOffset; // in logic coordinates long lMinFrame; // minimal frame width in pixels long lInitialDragPos; - sal_uInt16 nFlags; - SvxRulerDragFlags nDragType; + SvxRulerSupportFlags nFlags; + SvxRulerDragFlags nDragType; sal_uInt16 nDefTabType; sal_uInt16 nTabCount; sal_uInt16 nTabBufSize; @@ -247,16 +263,7 @@ protected: public: -#define SVXRULER_SUPPORT_TABS 0x0001 -#define SVXRULER_SUPPORT_PARAGRAPH_MARGINS 0x0002 -#define SVXRULER_SUPPORT_BORDERS 0x0004 -#define SVXRULER_SUPPORT_OBJECT 0x0008 -#define SVXRULER_SUPPORT_SET_NULLOFFSET 0x0010 -#define SVXRULER_SUPPORT_NEGATIVE_MARGINS 0x0020 -#define SVXRULER_SUPPORT_PARAGRAPH_MARGINS_VERTICAL 0x0040 -#define SVXRULER_SUPPORT_REDUCED_METRIC 0x0080 //shorten the context menu to select metric - - SvxRuler(vcl::Window* pParent, vcl::Window *pEditWin, sal_uInt16 nRulerFlags, + SvxRuler(vcl::Window* pParent, vcl::Window *pEditWin, SvxRulerSupportFlags nRulerFlags, SfxBindings &rBindings, WinBits nWinStyle = WB_STDRULER); virtual ~SvxRuler(); virtual void dispose() SAL_OVERRIDE; @@ -264,7 +271,7 @@ public: void SetMinFrameSize(long lSize); long GetMinFrameSize() const ; - sal_uInt16 GetRulerFlags() const + SvxRulerSupportFlags GetRulerFlags() const { return nFlags; } diff --git a/sd/source/ui/inc/Ruler.hxx b/sd/source/ui/inc/Ruler.hxx index 8ad5147b28ef..03f4da28376d 100644 --- a/sd/source/ui/inc/Ruler.hxx +++ b/sd/source/ui/inc/Ruler.hxx @@ -37,7 +37,7 @@ public: DrawViewShell& rViewSh, ::vcl::Window* pParent, ::sd::Window* pWin, - sal_uInt16 nRulerFlags, + SvxRulerSupportFlags nRulerFlags, SfxBindings& rBindings, WinBits nWinStyle); virtual ~Ruler(); diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx index 62b0b46b5c1a..b5674ce6cfdf 100644 --- a/sd/source/ui/view/drviews1.cxx +++ b/sd/source/ui/view/drviews1.cxx @@ -482,14 +482,14 @@ SvxRuler* DrawViewShell::CreateHRuler (::sd::Window* pWin, bool bIsFirst) { Ruler* pRuler; WinBits aWBits; - sal_uInt16 nFlags = SVXRULER_SUPPORT_OBJECT; + SvxRulerSupportFlags nFlags = SvxRulerSupportFlags::OBJECT; if ( bIsFirst ) { aWBits = WB_HSCROLL | WB_3DLOOK | WB_BORDER | WB_EXTRAFIELD; - nFlags |= ( SVXRULER_SUPPORT_SET_NULLOFFSET | - SVXRULER_SUPPORT_TABS | - SVXRULER_SUPPORT_PARAGRAPH_MARGINS ); // Neu + nFlags |= ( SvxRulerSupportFlags::SET_NULLOFFSET | + SvxRulerSupportFlags::TABS | + SvxRulerSupportFlags::PARAGRAPH_MARGINS ); // Neu } else aWBits = WB_HSCROLL | WB_3DLOOK | WB_BORDER; @@ -524,7 +524,7 @@ SvxRuler* DrawViewShell::CreateVRuler(::sd::Window* pWin) { Ruler* pRuler; WinBits aWBits = WB_VSCROLL | WB_3DLOOK | WB_BORDER; - sal_uInt16 nFlags = SVXRULER_SUPPORT_OBJECT; + SvxRulerSupportFlags nFlags = SvxRulerSupportFlags::OBJECT; pRuler = VclPtr<Ruler>::Create(*this, GetParentWindow(), pWin, nFlags, GetViewFrame()->GetBindings(), aWBits); diff --git a/sd/source/ui/view/sdruler.cxx b/sd/source/ui/view/sdruler.cxx index 12e3a6089834..95d4c6ca52a6 100644 --- a/sd/source/ui/view/sdruler.cxx +++ b/sd/source/ui/view/sdruler.cxx @@ -68,7 +68,7 @@ void RulerCtrlItem::StateChanged( sal_uInt16 nSId, SfxItemState, const SfxPoolIt } } -Ruler::Ruler( DrawViewShell& rViewSh, vcl::Window* pParent, ::sd::Window* pWin, sal_uInt16 nRulerFlags, SfxBindings& rBindings, WinBits nWinStyle) +Ruler::Ruler( DrawViewShell& rViewSh, vcl::Window* pParent, ::sd::Window* pWin, SvxRulerSupportFlags nRulerFlags, SfxBindings& rBindings, WinBits nWinStyle) : SvxRuler(pParent, pWin, nRulerFlags, rBindings, nWinStyle) , pSdView(NULL) , pSdWin(pWin) diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx index da50e4b9be2d..3c12829bff3e 100644 --- a/svx/source/dialog/svxruler.cxx +++ b/svx/source/dialog/svxruler.cxx @@ -218,10 +218,10 @@ void SvxRuler_Impl::SetPercSize(sal_uInt16 nSize) SvxRuler::SvxRuler( vcl::Window* pParent, // StarView Parent vcl::Window* pWin, // Output window: is used for conversion - // logical units <-> pixels - sal_uInt16 flags, // Display flags, see ruler.hxx - SfxBindings &rBindings, // associated Bindings - WinBits nWinStyle) : // StarView WinBits + // logical units <-> pixels + SvxRulerSupportFlags flags, // Display flags, see ruler.hxx + SfxBindings &rBindings, // associated Bindings + WinBits nWinStyle) : // StarView WinBits Ruler(pParent, nWinStyle), pCtrlItem(new SvxRulerItem* [CTRL_ITEM_COUNT]), pEditWin(pWin), @@ -275,14 +275,14 @@ SvxRuler::SvxRuler( // Page Position pCtrlItem[i++] = new SvxRulerItem(SID_RULER_PAGE_POS, *this, rBindings); - if((nFlags & SVXRULER_SUPPORT_TABS) == SVXRULER_SUPPORT_TABS) + if(nFlags & SvxRulerSupportFlags::TABS) { sal_uInt16 nTabStopId = bHorz ? SID_ATTR_TABSTOP : SID_ATTR_TABSTOP_VERTICAL; pCtrlItem[i++] = new SvxRulerItem(nTabStopId, *this, rBindings); SetExtraType(RULER_EXTRA_TAB, nDefTabType); } - if(0 != (nFlags & (SVXRULER_SUPPORT_PARAGRAPH_MARGINS |SVXRULER_SUPPORT_PARAGRAPH_MARGINS_VERTICAL))) + if(nFlags & (SvxRulerSupportFlags::PARAGRAPH_MARGINS |SvxRulerSupportFlags::PARAGRAPH_MARGINS_VERTICAL)) { if(bHorz) pCtrlItem[i++] = new SvxRulerItem(SID_ATTR_PARA_LRSPACE, *this, rBindings); @@ -304,7 +304,7 @@ SvxRuler::SvxRuler( mpIndents[INDENT_RIGHT_MARGIN].nStyle = RULER_INDENT_BOTTOM; } - if( (nFlags & SVXRULER_SUPPORT_BORDERS) == SVXRULER_SUPPORT_BORDERS ) + if( (nFlags & SvxRulerSupportFlags::BORDERS) == SvxRulerSupportFlags::BORDERS ) { pCtrlItem[i++] = new SvxRulerItem(bHorz ? SID_RULER_BORDERS : SID_RULER_BORDERS_VERTICAL, *this, rBindings); pCtrlItem[i++] = new SvxRulerItem(bHorz ? SID_RULER_ROWS : SID_RULER_ROWS_VERTICAL, *this, rBindings); @@ -312,7 +312,7 @@ SvxRuler::SvxRuler( pCtrlItem[i++] = new SvxRulerItem(SID_RULER_TEXT_RIGHT_TO_LEFT, *this, rBindings); - if( (nFlags & SVXRULER_SUPPORT_OBJECT) == SVXRULER_SUPPORT_OBJECT ) + if( (nFlags & SvxRulerSupportFlags::OBJECT) == SvxRulerSupportFlags::OBJECT ) { pCtrlItem[i++] = new SvxRulerItem(SID_RULER_OBJECT, *this, rBindings ); mpObjectBorders.resize(OBJECT_BORDER_COUNT); @@ -328,7 +328,7 @@ SvxRuler::SvxRuler( pCtrlItem[i++] = new SvxRulerItem(SID_RULER_BORDER_DISTANCE, *this, rBindings); mxRulerImpl->nControlerItems=i; - if( (nFlags & SVXRULER_SUPPORT_SET_NULLOFFSET) == SVXRULER_SUPPORT_SET_NULLOFFSET ) + if( (nFlags & SvxRulerSupportFlags::SET_NULLOFFSET) == SvxRulerSupportFlags::SET_NULLOFFSET ) SetExtraType(RULER_EXTRA_NULLOFFSET, 0); rBindings.LeaveRegistrations(); @@ -1264,15 +1264,15 @@ void SvxRuler::Update() UpdatePage(); UpdateFrame(); - if((nFlags & SVXRULER_SUPPORT_OBJECT) == SVXRULER_SUPPORT_OBJECT) + if(nFlags & SvxRulerSupportFlags::OBJECT) UpdateObject(); else UpdateColumns(); - if(0 != (nFlags & (SVXRULER_SUPPORT_PARAGRAPH_MARGINS | SVXRULER_SUPPORT_PARAGRAPH_MARGINS_VERTICAL))) + if(nFlags & (SvxRulerSupportFlags::PARAGRAPH_MARGINS | SvxRulerSupportFlags::PARAGRAPH_MARGINS_VERTICAL)) UpdatePara(); - if(0 != (nFlags & SVXRULER_SUPPORT_TABS)) + if(nFlags & SvxRulerSupportFlags::TABS) UpdateTabs(); } @@ -1406,8 +1406,8 @@ long SvxRuler::GetRightFrameMargin() const return lResult; } -#define NEG_FLAG ( (nFlags & SVXRULER_SUPPORT_NEGATIVE_MARGINS) == \ - SVXRULER_SUPPORT_NEGATIVE_MARGINS ) +#define NEG_FLAG ( (nFlags & SvxRulerSupportFlags::NEGATIVE_MARGINS) == \ + SvxRulerSupportFlags::NEGATIVE_MARGINS ) #define TAB_FLAG ( mxColumnItem.get() && mxColumnItem->IsTable() ) long SvxRuler::GetCorrectedDragPos( bool bLeft, bool bRight ) @@ -2606,7 +2606,7 @@ void SvxRuler::Click() } bool bRTL = mxRulerImpl->pTextRTLItem && mxRulerImpl->pTextRTLItem->GetValue(); if(mxTabStopItem.get() && - (nFlags & SVXRULER_SUPPORT_TABS) == SVXRULER_SUPPORT_TABS) + (nFlags & SvxRulerSupportFlags::TABS) == SvxRulerSupportFlags::TABS) { bool bContentProtected = mxRulerImpl->aProtectItem.IsCntntProtected(); if( bContentProtected ) return; @@ -3395,7 +3395,7 @@ void SvxRuler::ExtraDown() // Switch Tab Type if(mxTabStopItem.get() && - (nFlags & SVXRULER_SUPPORT_TABS) == SVXRULER_SUPPORT_TABS) + (nFlags & SvxRulerSupportFlags::TABS) == SvxRulerSupportFlags::TABS) { ++nDefTabType; if(RULER_TAB_DEFAULT == nDefTabType) @@ -3492,7 +3492,7 @@ void SvxRuler::Command( const CommandEvent& rCommandEvent ) FieldUnit eUnit = GetUnit(); const sal_uInt16 nCount = aMenu.GetItemCount(); - bool bReduceMetric = 0 != (nFlags & SVXRULER_SUPPORT_REDUCED_METRIC); + bool bReduceMetric = bool(nFlags & SvxRulerSupportFlags::REDUCED_METRIC); for ( sal_uInt16 i = nCount; i; --i ) { const sal_uInt16 nId = aMenu.GetItemId(i - 1); diff --git a/sw/source/uibase/inc/swruler.hxx b/sw/source/uibase/inc/swruler.hxx index 35938f1cebf3..94c23771b8da 100644 --- a/sw/source/uibase/inc/swruler.hxx +++ b/sw/source/uibase/inc/swruler.hxx @@ -30,7 +30,7 @@ public: SwViewShell* pViewSh, vcl::Window* pParent, SwEditWin* pWin, - sal_uInt16 nRulerFlags, + SvxRulerSupportFlags nRulerFlags, SfxBindings& rBindings, WinBits nWinStyle); virtual ~SwCommentRuler (); diff --git a/sw/source/uibase/misc/swruler.cxx b/sw/source/uibase/misc/swruler.cxx index 6e635be84eae..748aa9ceccb6 100644 --- a/sw/source/uibase/misc/swruler.cxx +++ b/sw/source/uibase/misc/swruler.cxx @@ -35,7 +35,7 @@ #define CONTROL_TRIANGLE_PAD 3 // Constructor -SwCommentRuler::SwCommentRuler( SwViewShell* pViewSh, vcl::Window* pParent, SwEditWin* pWin, sal_uInt16 nRulerFlags, SfxBindings& rBindings, WinBits nWinStyle) +SwCommentRuler::SwCommentRuler( SwViewShell* pViewSh, vcl::Window* pParent, SwEditWin* pWin, SvxRulerSupportFlags nRulerFlags, SfxBindings& rBindings, WinBits nWinStyle) : SvxRuler(pParent, pWin, nRulerFlags, rBindings, nWinStyle | WB_HSCROLL) , mpViewShell(pViewSh) , mpSwWin(pWin) diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx index a3da88c0fcc7..ab632ebf3d1d 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -700,8 +700,8 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) m_pVScrollbar(0), m_pScrollFill(VclPtr<ScrollBarBox>::Create( &_pFrame->GetWindow(), _pFrame->GetFrame().GetParentFrame() ? 0 : WB_SIZEABLE )), m_pVRuler(VclPtr<SvxRuler>::Create(&GetViewFrame()->GetWindow(), m_pEditWin, - SVXRULER_SUPPORT_TABS | SVXRULER_SUPPORT_PARAGRAPH_MARGINS_VERTICAL| - SVXRULER_SUPPORT_BORDERS | SVXRULER_SUPPORT_REDUCED_METRIC, + SvxRulerSupportFlags::TABS | SvxRulerSupportFlags::PARAGRAPH_MARGINS_VERTICAL| + SvxRulerSupportFlags::BORDERS | SvxRulerSupportFlags::REDUCED_METRIC, GetViewFrame()->GetBindings(), WB_VSCROLL | WB_EXTRAFIELD | WB_BORDER )), m_pTogglePageBtn(0), @@ -847,11 +847,11 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) } SAL_INFO( "sw.ui", "after create WrtShell" ); m_pHRuler = VclPtr<SwCommentRuler>::Create(m_pWrtShell, &GetViewFrame()->GetWindow(), m_pEditWin, - SVXRULER_SUPPORT_TABS | - SVXRULER_SUPPORT_PARAGRAPH_MARGINS | - SVXRULER_SUPPORT_BORDERS | - SVXRULER_SUPPORT_NEGATIVE_MARGINS| - SVXRULER_SUPPORT_REDUCED_METRIC, + SvxRulerSupportFlags::TABS | + SvxRulerSupportFlags::PARAGRAPH_MARGINS | + SvxRulerSupportFlags::BORDERS | + SvxRulerSupportFlags::NEGATIVE_MARGINS| + SvxRulerSupportFlags::REDUCED_METRIC, GetViewFrame()->GetBindings(), WB_STDRULER | WB_EXTRAFIELD | WB_BORDER); |