summaryrefslogtreecommitdiff
path: root/include/svx/ruler.hxx
diff options
context:
space:
mode:
authorTomaž Vajngerl <quikee@gmail.com>2013-08-27 21:53:00 +0200
committerTomaž Vajngerl <quikee@gmail.com>2013-08-29 18:40:00 +0200
commit6a55ef189d35334425f0d27725f22eeea9878375 (patch)
tree0c7c3a230f2537d877ffdb32e2754e0ad526e70c /include/svx/ruler.hxx
parent8c8b165f54399aa5a4f1c26f29101d4482eb9339 (diff)
Use scoped_ptr for items in svxruler and clean-up code.
Change-Id: Ia461bdf633364fdc379a8180998452ef08a58316
Diffstat (limited to 'include/svx/ruler.hxx')
-rw-r--r--include/svx/ruler.hxx175
1 files changed, 98 insertions, 77 deletions
diff --git a/include/svx/ruler.hxx b/include/svx/ruler.hxx
index f017dafeb0f4..15b799bd9505 100644
--- a/include/svx/ruler.hxx
+++ b/include/svx/ruler.hxx
@@ -24,6 +24,8 @@
#include <svl/lstner.hxx>
#include <svx/svxdllapi.h>
+#include <boost/scoped_ptr.hpp>
+
class SvxProtectItem;
class SvxRulerItem;
class SfxBindings;
@@ -43,79 +45,83 @@ class SVX_DLLPUBLIC SvxRuler: public Ruler, public SfxListener
friend class SvxRulerItem;
using Window::Notify;
- SvxRulerItem **pCtrlItem;
- SvxLongLRSpaceItem *pLRSpaceItem; // left and right edge
- SfxRectangleItem *pMinMaxItem; // maxima for dragging
- SvxLongULSpaceItem *pULSpaceItem; // upper and lower edge
- SvxTabStopItem *pTabStopItem; // tab stops
- SvxLRSpaceItem *pParaItem; // paragraphs
- SvxLRSpaceItem *pParaBorderItem; // border distance
- SvxPagePosSizeItem *pPagePosItem; // page distance to the rule
- SvxColumnItem *pColumnItem; // columns
- SvxObjectItem *pObjectItem; // object
- Window *pEditWin;
- SvxRuler_Impl *pRuler_Imp;
- sal_Bool bAppSetNullOffset :1;
- sal_Bool bHorz :1;
- long lLogicNullOffset; // in logic coordinates
- long lAppNullOffset; // in logic coordinates
- long lMinFrame; // minimal frame width in pixels
- long lInitialDragPos;
- sal_uInt16 nFlags;
- enum {
- NONE = 0x0000,
- DRAG_OBJECT = 0x0001,
+ SvxRulerItem** pCtrlItem;
+ boost::scoped_ptr<SvxLongLRSpaceItem> mpLRSpaceItem; // left and right edge
+ boost::scoped_ptr<SfxRectangleItem> mpMinMaxItem; // maxima for dragging
+ boost::scoped_ptr<SvxLongULSpaceItem> mpULSpaceItem; // upper and lower edge
+ boost::scoped_ptr<SvxTabStopItem> mpTabStopItem; // tab stops
+ boost::scoped_ptr<SvxLRSpaceItem> mpParaItem; // paragraphs
+ boost::scoped_ptr<SvxLRSpaceItem> mpParaBorderItem; // border distance
+ boost::scoped_ptr<SvxPagePosSizeItem> mpPagePosItem; // page distance to the rule
+ boost::scoped_ptr<SvxColumnItem> mpColumnItem; // columns
+ boost::scoped_ptr<SvxObjectItem> mpObjectItem; // object
+
+ Window* pEditWin;
+ SvxRuler_Impl* pRuler_Imp;
+ sal_Bool bAppSetNullOffset :1;
+ sal_Bool bHorz :1;
+ long lLogicNullOffset; // in logic coordinates
+ long lAppNullOffset; // in logic coordinates
+ long lMinFrame; // minimal frame width in pixels
+ long lInitialDragPos;
+ sal_uInt16 nFlags;
+
+ enum
+ {
+ NONE = 0x0000,
+ DRAG_OBJECT = 0x0001,
// reduce size of the last column, shift
- DRAG_OBJECT_SIZE_LINEAR = 0x0002,
- DRAG_OBJECT_SIZE_PROPORTIONAL = 0x0004, // proportional, Ctrl
+ DRAG_OBJECT_SIZE_LINEAR = 0x0002,
+ DRAG_OBJECT_SIZE_PROPORTIONAL = 0x0004, // proportional, Ctrl
// only current line (table; Shift-Ctrl)
- DRAG_OBJECT_ACTLINE_ONLY = 0x0008,
+ DRAG_OBJECT_ACTLINE_ONLY = 0x0008,
// currently same key assignment
- DRAG_OBJECT_LEFT_INDENT_ONLY = DRAG_OBJECT_SIZE_PROPORTIONAL
- }
- nDragType;
- sal_uInt16 nDefTabType;
- sal_uInt16 nTabCount;
- sal_uInt16 nTabBufSize;
- long lDefTabDist;
- long lTabPos;
- RulerTab *pTabs; // tab positions in pixel
- RulerIndent *pIndents; // paragraph margins in pixel
- RulerBorder *pBorders;
- sal_uInt16 nBorderCount;
- RulerBorder *pObjectBorders;
- SfxBindings *pBindings;
- long nDragOffset;
- long nMaxLeft;
- long nMaxRight;
- sal_Bool bValid;
- sal_Bool bListening;
- sal_Bool bActive;
+ DRAG_OBJECT_LEFT_INDENT_ONLY = DRAG_OBJECT_SIZE_PROPORTIONAL
+ } nDragType;
+
+ sal_uInt16 nDefTabType;
+ sal_uInt16 nTabCount;
+ sal_uInt16 nTabBufSize;
+ long lDefTabDist;
+ long lTabPos;
+ RulerTab* pTabs; // tab positions in pixel
+ RulerIndent* pIndents; // paragraph margins in pixel
+ RulerBorder* pBorders;
+ sal_uInt16 nBorderCount;
+ RulerBorder* pObjectBorders;
+ SfxBindings* pBindings;
+ long nDragOffset;
+ long nMaxLeft;
+ long nMaxRight;
+ sal_Bool bValid;
+ sal_Bool bListening;
+ sal_Bool bActive;
+
void StartListening_Impl();
- long GetCorrectedDragPos( sal_Bool bLeft = sal_True, sal_Bool bRight = sal_True );
- void DrawLine_Impl(long &lTabPos, int, sal_Bool Hori=sal_True);
+ long GetCorrectedDragPos(sal_Bool bLeft = sal_True, sal_Bool bRight = sal_True );
+ void DrawLine_Impl(long &lTabPos, int, sal_Bool Horizontal=sal_True);
sal_uInt16 GetObjectBordersOff(sal_uInt16 nIdx) const;
// page borders or surrounding frame
- void UpdateFrame(const SvxLongLRSpaceItem *);
- void UpdateFrame(const SvxLongULSpaceItem *);
- void UpdateFrameMinMax(const SfxRectangleItem *);
+ void UpdateFrame(const SvxLongLRSpaceItem* pItem);
+ void UpdateFrame(const SvxLongULSpaceItem* pItem);
+ void UpdateFrameMinMax(const SfxRectangleItem* pItem);
// paragraph indentations
- void UpdatePara(const SvxLRSpaceItem *);
+ void UpdatePara(const SvxLRSpaceItem* pItem);
// Border distance
- void UpdateParaBorder(const SvxLRSpaceItem *);
+ void UpdateParaBorder(const SvxLRSpaceItem* pItem);
// Tabs
- void Update(const SvxTabStopItem *);
+ void Update(const SvxTabStopItem* pItem);
// page position and width
- void Update(const SvxPagePosSizeItem *);
+ void Update(const SvxPagePosSizeItem* pItem);
// columns
- void Update(const SvxColumnItem *, sal_uInt16 nSID);
+ void Update(const SvxColumnItem* pItem, sal_uInt16 nSID);
// object selection
- void Update(const SvxObjectItem *);
+ void Update(const SvxObjectItem* pItem);
// protect
- void Update( const SvxProtectItem* );
+ void Update(const SvxProtectItem* pItem );
// left-to-right text
- void UpdateTextRTL( const SfxBoolItem* );
+ void UpdateTextRTL(const SfxBoolItem* pItem);
// paragraph indentations
void UpdatePara();
void UpdateTabs();
@@ -186,10 +192,11 @@ class SVX_DLLPUBLIC SvxRuler: public Ruler, public SfxListener
sal_uInt16 GetNextVisible(sal_uInt16 nColumn);
sal_uInt16 GetPrevVisible(sal_uInt16 nColumn);
-enum UpdateType {
- MOVE_ALL,
- MOVE_LEFT,
- MOVE_RIGHT
+ enum UpdateType
+ {
+ MOVE_ALL,
+ MOVE_LEFT,
+ MOVE_RIGHT
};
void UpdateParaContents_Impl(long lDiff, UpdateType = MOVE_ALL);
@@ -210,17 +217,22 @@ protected:
// values refer to the page
virtual sal_Bool CalcLimits(long &nMax1, long &nMax2, sal_Bool bFirst) const;
sal_Bool IsActLastColumn(
- sal_Bool bForceDontConsiderHidden = sal_False, sal_uInt16 nAct=USHRT_MAX) const ;
+ sal_Bool bForceDontConsiderHidden = sal_False,
+ sal_uInt16 nAct=USHRT_MAX) const;
sal_Bool IsActFirstColumn(
- sal_Bool bForceDontConsiderHidden = sal_False, sal_uInt16 nAct=USHRT_MAX) const;
+ sal_Bool bForceDontConsiderHidden = sal_False,
+ sal_uInt16 nAct=USHRT_MAX) const;
sal_uInt16 GetActLeftColumn(
- sal_Bool bForceDontConsiderHidden = sal_False, sal_uInt16 nAct=USHRT_MAX ) const;
+ sal_Bool bForceDontConsiderHidden = sal_False,
+ sal_uInt16 nAct=USHRT_MAX ) const;
sal_uInt16 GetActRightColumn (
- sal_Bool bForceDontConsiderHidden = sal_False, sal_uInt16 nAct=USHRT_MAX ) const;
- long CalcPropMaxRight(sal_uInt16 nCol=USHRT_MAX) const;
+ sal_Bool bForceDontConsiderHidden = sal_False,
+ sal_uInt16 nAct=USHRT_MAX ) const;
+ long CalcPropMaxRight(sal_uInt16 nCol = USHRT_MAX) const;
long GetPageWidth() const;
public:
+
#define SVXRULER_SUPPORT_TABS 0x0001
#define SVXRULER_SUPPORT_PARAGRAPH_MARGINS 0x0002
#define SVXRULER_SUPPORT_BORDERS 0x0004
@@ -230,28 +242,37 @@ public:
#define SVXRULER_SUPPORT_PARAGRAPH_MARGINS_VERTICAL 0x0040
#define SVXRULER_SUPPORT_REDUCED_METRIC 0x0080 //shorten the context menu to select metric
- SvxRuler(Window* pParent,
- Window *pEditWin,
- sal_uInt16 nRulerFlags,
- SfxBindings &rBindings,
- WinBits nWinStyle = WB_STDRULER);
+ SvxRuler(Window* pParent, Window *pEditWin, sal_uInt16 nRulerFlags,
+ SfxBindings &rBindings, WinBits nWinStyle = WB_STDRULER);
~SvxRuler();
void SetMinFrameSize(long lSize);
long GetMinFrameSize() const ;
- sal_uInt16 GetRulerFlags() const { return nFlags; }
+ sal_uInt16 GetRulerFlags() const
+ {
+ return nFlags;
+ }
void SetDefTabDist(long);
// set/get NullOffset in logic units
void SetNullOffsetLogic(long lOff = 0);
- long GetNullOffsetLogic() const { return lAppNullOffset; }
+ long GetNullOffsetLogic() const
+ {
+ return lAppNullOffset;
+ }
void SetActive(sal_Bool bOn = sal_True);
- sal_Bool IsActive() const { return bActive; }
-
- void ForceUpdate() { Update(); }
+ sal_Bool IsActive() const
+ {
+ return bActive;
+ }
+
+ void ForceUpdate()
+ {
+ Update();
+ }
//#i24363# tab stops relative to indent
void SetTabsRelativeToIndent( sal_Bool bRel = sal_True );