Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef INCLUDED_SW_SOURCE_CORE_CRSR_BLOCKCURSOR_HXX
20 : #define INCLUDED_SW_SOURCE_CORE_CRSR_BLOCKCURSOR_HXX
21 :
22 : #include <crsrsh.hxx>
23 :
24 : class SwCrsrShell;
25 : struct SwPosition;
26 : class Point;
27 :
28 : /** Access to the block cursor
29 :
30 : A block cursor contains a SwShellCrsr and additional information about
31 : the rectangle which has been created by pressing the mouse button and
32 : moving the mouse.
33 :
34 : It's simply an aggregation of a SwShellCrsr and a rectangle defined by
35 : a start and an end point.
36 : */
37 : class SwBlockCursor
38 : {
39 : SwShellCrsr aCursor;
40 : Point *pStartPt;
41 : Point *pEndPt;
42 :
43 : public:
44 0 : SwBlockCursor( const SwCrsrShell& rCrsrSh, const SwPosition &rPos ) :
45 0 : aCursor( rCrsrSh, rPos ), pStartPt(0), pEndPt(0) {}
46 : /** Access to the shell cursor
47 :
48 : @return SwShellCrsr& which represents the start and end position of the
49 : current block selection
50 : */
51 : SwShellCrsr& getShellCrsr();
52 : /** Defines the starting vertex of the block selection
53 :
54 : @param rPt
55 : rPt should contain the document coordinates of the mouse cursor when
56 : the block selection starts (MouseButtonDown)
57 : */
58 : void setStartPoint( const Point &rPt );
59 : /** Defines the ending vertex of the block selection
60 :
61 : @param rPt
62 : rPt should contain the document coordinates of the mouse cursor when
63 : the block selection has started and the mouse has been moved (MouseMove)
64 : */
65 : void setEndPoint( const Point &rPt );
66 : /** The document coordinates where the block selection has been started
67 :
68 : @return 0, if no start point has been set
69 : */
70 : const Point* getStartPoint() const;
71 : /** The document coordinates where the block selection ends (at the moment)
72 :
73 : @return 0, if no end point has been set
74 : */
75 : const Point* getEndPoint() const;
76 : /** Deletion of the mouse created rectangle
77 :
78 : When start and end points exist, the block cursor depends on this. If the
79 : cursor is moved by cursor keys (e.g. up/down, home/end) the mouse rectangle
80 : is obsolete and has to be deleted.
81 : */
82 : void clearPoints();
83 : ~SwBlockCursor();
84 : };
85 :
86 :
87 : #endif
88 :
89 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|