merge the formfield patch from ooo-build
[ooovba.git] / binfilter / inc / bf_svx / ruler.hxx
blob63789ef2d7ccf19269f516cee930995396cadd26
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ruler.hxx,v $
10 * $Revision: 1.8 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _SVX_RULER_HXX
31 #define _SVX_RULER_HXX
34 #ifndef _RULER_HXX //autogen
35 #include <bf_svtools/ruler.hxx>
36 #endif
38 #ifndef _SFXLSTNER_HXX //autogen
39 #include <bf_svtools/lstner.hxx>
40 #endif
41 class SfxRectangleItem;
42 class SfxBoolItem;
43 namespace binfilter {
45 class SvxProtectItem;
46 class SvxRulerItem;
47 class SfxBindings;
48 class SvxLongLRSpaceItem;
49 class SvxLongULSpaceItem;
50 class SvxTabStopItem;
51 class SvxLRSpaceItem;
52 class SvxPagePosSizeItem;
53 class SvxColumnItem;
54 class SvxObjectItem;
55 struct SvxRuler_Impl;
57 class SvxRuler: public Ruler, public SfxListener
59 friend class SvxRulerItem;
60 SvxRulerItem **pCtrlItem;
61 SvxLongLRSpaceItem *pLRSpaceItem; //Linker und Rechter Rand
62 SfxRectangleItem *pMinMaxItem; //Maxima fuers Draggen
63 SvxLongULSpaceItem *pULSpaceItem; //Oberer und Unterer Rand
64 SvxTabStopItem *pTabStopItem; //Tabstops
65 SvxLRSpaceItem *pParaItem; //Absaetze
66 SvxLRSpaceItem *pParaBorderItem; //Border distance
67 SvxPagePosSizeItem *pPagePosItem; //Seitenabstaende zum Lineal
68 SvxColumnItem *pColumnItem; //Spalten
69 SvxObjectItem *pObjectItem; //Objekt
70 Window *pEditWin;
71 SvxRuler_Impl *pRuler_Imp;
72 BOOL bAppSetNullOffset :1;
73 BOOL bHorz :1;
74 long lLogicNullOffset; // in logischen Koordinaten
75 long lAppNullOffset; // in logischen Koordinaten
76 long lMinFrame; // minimale Framebreite in Pixel
77 long lInitialDragPos;
78 USHORT nFlags;
79 enum {
80 NONE = 0x0000,
81 DRAG_OBJECT = 0x0001,
82 // letzte Spalte verkleinern, Shift
83 DRAG_OBJECT_SIZE_LINEAR = 0x0002,
84 DRAG_OBJECT_SIZE_PROPORTIONAL = 0x0004, // proportional, Ctrl
85 // nur aktuelle Zeile (Tabelle; Shift-Ctrl)
86 DRAG_OBJECT_ACTLINE_ONLY = 0x0008,
87 // aktuell gleiche Tastenbelegung
88 DRAG_OBJECT_LEFT_INDENT_ONLY = DRAG_OBJECT_SIZE_PROPORTIONAL
90 nDragType;
91 USHORT nDefTabType;
92 USHORT nTabCount;
93 USHORT nTabBufSize;
94 long lDefTabDist;
95 long lTabPos;
96 RulerTab *pTabs; // Tabpositionen in Pixel
97 RulerIndent *pIndents; // Absatzraender in Pixel
98 RulerBorder *pBorders;
99 USHORT nBorderCount;
100 RulerBorder *pObjectBorders;
101 SfxBindings *pBindings;
102 long nDragOffset;
103 long nMaxLeft;
104 long nMaxRight;
105 BOOL bValid;
106 BOOL bListening;
107 BOOL bActive;
108 #if _SOLAR__PRIVATE
109 void StartListening_Impl();
111 // Seitenr"ander oder umgebender Rahmen
112 void UpdateFrame(const SvxLongLRSpaceItem *);
113 void UpdateFrame(const SvxLongULSpaceItem *);
114 void UpdateFrameMinMax(const SfxRectangleItem *);
115 // Absatzeinzuege
116 void UpdatePara(const SvxLRSpaceItem *);
117 // Border distance
118 void UpdateParaBorder(const SvxLRSpaceItem *);
119 // Tabs
120 void Update(const SvxTabStopItem *);
121 // Seitenposition und -breite
122 void Update(const SvxPagePosSizeItem *);
123 // Spalten
124 void Update(const SvxColumnItem *);
125 // Object Selektion
126 // Protect
127 void Update( const SvxProtectItem* );
128 // left-to-right text
129 void UpdateTextRTL( const SfxBoolItem* );
130 // Absatzeinzuege
131 void UpdatePara();
132 void UpdateTabs();
133 void UpdatePage();
134 void UpdateFrame();
135 void UpdateColumns();
138 long ConvertHPosPixel(long lPos) const;
139 long ConvertVPosPixel(long lPos) const;
140 long ConvertHSizePixel(long lSize) const;
141 long ConvertVSizePixel(long lSize) const;
143 long ConvertPosPixel(long lPos) const;
144 long ConvertSizePixel(long lSize) const;
148 // long GetLogicFirstLineIndent() const;
149 // long GetLogicLeftIndent() const;
151 inline long GetLeftFrameMargin() const;
152 long GetRightFrameMargin() const;
160 #endif
162 void Update();
164 enum UpdateType {
165 MOVE_ALL,
166 MOVE_LEFT,
167 MOVE_RIGHT
169 protected:
170 virtual void MouseMove( const MouseEvent& rMEvt );
172 virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
173 const SfxHint& rHint, const TypeId& rHintType );
175 // Berechnung der Grenzwerte fuer Objectgrenzen
176 // Werte sind bezogen auf die Seite
177 BOOL IsActLastColumn(
178 BOOL bForceDontConsiderHidden = FALSE, USHORT nAct=USHRT_MAX) const ;
180 public:
181 #define SVXRULER_SUPPORT_TABS 0x0001
182 #define SVXRULER_SUPPORT_PARAGRAPH_MARGINS 0x0002
183 #define SVXRULER_SUPPORT_BORDERS 0x0004
184 #define SVXRULER_SUPPORT_OBJECT 0x0008
185 #define SVXRULER_SUPPORT_SET_NULLOFFSET 0x0010
186 #define SVXRULER_SUPPORT_NEGATIVE_MARGINS 0x0020
187 #define SVXRULER_SUPPORT_PARAGRAPH_MARGINS_VERTICAL 0x0040
189 SvxRuler(Window* pParent,
190 Window *pEditWin,
191 USHORT nRulerFlags,
192 SfxBindings &rBindings,
193 WinBits nWinStyle = WB_STDRULER);
194 ~SvxRuler();
198 // Setzen / Erfragen NullOffset in logischen Einheiten
200 void SetActive(BOOL bOn = TRUE);
202 void ForceUpdate() { Update(); }
205 }//end of namespace binfilter
206 #endif