31#include <koffice_export.h>
33#include <KoTabChooser.h>
39enum KoTabulators { T_LEFT = 0, T_CENTER = 1, T_RIGHT = 2, T_DEC_PNT = 3, T_INVALID = -1 };
40enum KoTabulatorFilling { TF_BLANK = 0, TF_DOTS = 1, TF_LINE = 2, TF_DASH = 3, TF_DASH_DOT = 4, TF_DASH_DOT_DOT = 5};
73 return !operator==(t);
76 bool operator < ( const KoTabulator & t ) const {
79 bool operator <= ( const KoTabulator & t ) const {
82 bool operator > ( const KoTabulator & t ) const {
87typedef TQValueList<KoTabulator> KoTabulatorList;
101class KOFFICEUI_EXPORT KoRuler : public TQFrame
105 friend class KoRulerPrivate;
107 static const int F_TABS;
108 static const int F_INDENTS;
109 static const int F_HELPLINES;
110 static const int F_NORESIZE;
116 KoRuler( TQWidget *_parent, TQWidget *_canvas, TQt::Orientation _orientation,
118 KoTabChooser *_tabChooser = 0L );
126 void setUnit( const TQString& unit ) TDE_DEPRECATED ;
139 const double& zoom() const { return m_zoom; }
153 void showMousePos( bool _showMPos );
159 void setMousePos( int mx, int my );
166 void setOffset( int _diffx, int _diffy );
172 { i_left = makeIntern( _left ); update(); }
179 { i_first = makeIntern( _first ); update(); }
184 void setRightIndent( double _right );
191 void setDirection( bool rtl );
196 void setTabList( const KoTabulatorList & tabList );
206 void setFrameStartEnd( int _frameStart, int _frameEnd );
212 void setReadWrite( bool _readWrite );
217 void changeFlags( int _flags);
239 bool doubleClickedIndent() const;
244 void setPageLayoutMenuItemEnabled( bool b);
249 virtual TQSize minimumSizeHint() const;
254 virtual TQSize sizeHint() const;
258 void newLeftIndent( double );
259 void newFirstIndent( double );
260 void newRightIndent( double );
268 void tabListChanged( const KoTabulatorList & );
271 void addGuide( const TQPoint &, bool, int );
272 void moveGuide( const TQPoint &, bool, int );
273 void addHelpline( const TQPoint &, bool );
274 void moveHelpLines( const TQPoint &, bool );
277 enum Action {A_NONE, A_BR_LEFT, A_BR_RIGHT, A_BR_TOP, A_BR_BOTTOM,
278 A_LEFT_INDENT, A_FIRST_INDENT, A_TAB, A_RIGHT_INDENT,
281 void drawContents( TQPainter *_painter )
282 { orientation == TQt::Horizontal ? drawHorizontal( _painter ) : drawVertical( _painter ); }
284 void drawHorizontal( TQPainter *_painter );
285 void drawVertical( TQPainter *_painter );
286 void drawTabs( TQPainter &_painter );
288 void mousePressEvent( TQMouseEvent *e );
289 void mouseReleaseEvent( TQMouseEvent *e );
290 void mouseMoveEvent( TQMouseEvent *e );
291 void mouseDoubleClickEvent( TQMouseEvent* );
292 void resizeEvent( TQResizeEvent *e );
293 void handleDoubleClick();
295 double makeIntern( double _v );
296 double zoomIt( const double &value) const;
297 int zoomIt( const int &value) const;
298 unsigned int zoomIt( const unsigned int &value) const;
299 double unZoomIt( const double &value) const;
300 int unZoomIt( const int &value) const;
301 unsigned int unZoomIt( const unsigned int &value) const;
304 void searchTab( int mx);
305 void drawLine( int oldX, int newX);
308 double applyRtlAndZoom( double value ) const;
309 double unZoomItRtl( int pixValue ) const;
310 double lineDistance() const;
311 bool willRemoveTab( int y ) const;
315 TQt::Orientation orientation;
317 double i_left, i_first;
319 double m_zoom, m_1_zoom;
323 bool m_bFrameStartSet;
331 void slotMenuActivated( int i );
332 void pageLayoutDia() { emit doubleClicked(); }
337inline double KoRuler::zoomIt( const double &value) const {
343inline int KoRuler::zoomIt( const int &value) const {
346 return tqRound(m_zoom*value);
349inline unsigned int KoRuler::zoomIt( const unsigned int &value) const {
352 return static_cast<unsigned int>(tqRound(m_zoom*value));
355inline double KoRuler::unZoomIt( const double &value) const {
358 return value*m_1_zoom;
361inline int KoRuler::unZoomIt( const int &value) const {
364 return tqRound(value*m_1_zoom);
367inline unsigned int KoRuler::unZoomIt( const unsigned int &value) const {
370 return static_cast<unsigned int>(tqRound(value*m_1_zoom));
void doubleClicked() This signal is emitted when double-clicking the ruler (or an indent).
void setLeftIndent(double _left) Set the [paragraph] left indent to the specified position (in the current unit).
void setGridSize(double newGridSize) Set the size of the grid used for tabs positioning, size in pt.
void setFirstIndent(double _first) Set the [paragraph] first-line left indent to the specified position (in the current unit) This inden...
void doubleClicked(double ptPos) This signal is emitted when double-clicking a tab.
void setUnit(const TQString &unit) TDE_DEPRECATED Set the unit to be used.
KoRuler(TQWidget *_parent, TQWidget *_canvas, TQt::Orientation _orientation, const KoPageLayout &_layout, int _flags, KoUnit::Unit _unit, KoTabChooser *_tabChooser=0L) Create a ruler TODO document params.
void setZoom(const double &zoom=1.0) Set the zoom of the ruler (default value of 1.0 is 100%).
void openPageLayoutDia() Old signal, kept for compatibility.
const double & zoom() const
Unit Length units supported by KOffice.
This structure defines the page layout, including its size in pt, its format (e.g.
Struct: KoTabulator Defines the position of a tabulation (in pt), and its type.
KoTabulators type Type of tab (left/center/right/decimalpoint).
KoTabulatorFilling filling Type of tab filling.
double ptPos Position of the tab in pt.
TQChar alignChar Alignment character.
double ptWidth Width of the tab filling line.
|