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 :
20 : #ifndef INCLUDED_SVTOOLS_SOURCE_HATCHWINDOW_IPWIN_HXX
21 : #define INCLUDED_SVTOOLS_SOURCE_HATCHWINDOW_IPWIN_HXX
22 :
23 : #include <tools/gen.hxx>
24 : #include <vcl/window.hxx>
25 :
26 : /********************** SvResizeHelper ***********************************
27 : *************************************************************************/
28 : class SvResizeHelper
29 : {
30 : Size aBorder;
31 : Rectangle aOuter;
32 : short nGrab; // -1 no Grab, 0 - 7, 8 = Move, see FillHandle...
33 : Point aSelPos;
34 : sal_Bool bResizeable;
35 : public:
36 : SvResizeHelper();
37 :
38 : void SetResizeable( sal_Bool b ) { bResizeable = b; }
39 0 : short GetGrab() const { return nGrab; }
40 0 : void SetBorderPixel( const Size & rBorderP )
41 0 : { aBorder = rBorderP; }
42 : const Size & GetBorderPixel() const { return aBorder; }
43 : const Rectangle & GetOuterRectPixel() const
44 : { return aOuter; }
45 0 : void SetOuterRectPixel( const Rectangle & rRect )
46 0 : { aOuter = rRect; }
47 : Rectangle GetInnerRectPixel() const
48 : {
49 : Rectangle aRect( aOuter );
50 : aRect.Top() += aBorder.Height();
51 : aRect.Left() += aBorder.Width();
52 : aRect.Bottom() -= aBorder.Height();
53 : aRect.Right() -= aBorder.Width();
54 : return aRect;
55 : }
56 : // Clockwise, start at upper left
57 :
58 : void FillHandleRectsPixel( Rectangle aRects[ 8 ] ) const;
59 : void FillMoveRectsPixel( Rectangle aRects[ 4 ] ) const;
60 : void Draw( OutputDevice * );
61 : void InvalidateBorder( Window * );
62 : sal_Bool SelectBegin( Window *, const Point & rPos );
63 : short SelectMove( Window * pWin, const Point & rPos );
64 : Point GetTrackPosPixel( const Rectangle & rRect ) const;
65 : Rectangle GetTrackRectPixel( const Point & rTrackPos ) const;
66 : void ValidateRect( Rectangle & rValidate ) const;
67 : sal_Bool SelectRelease( Window *, const Point & rPos, Rectangle & rOutPosSize );
68 : void Release( Window * pWin );
69 : };
70 :
71 : /********************** SvResizeWindow ***********************************
72 : *************************************************************************/
73 : class VCLXHatchWindow;
74 0 : class SvResizeWindow : public Window
75 : {
76 : Pointer m_aOldPointer;
77 : short m_nMoveGrab; // last pointer type
78 : SvResizeHelper m_aResizer;
79 : sal_Bool m_bActive;
80 :
81 : VCLXHatchWindow* m_pWrapper;
82 : public:
83 : SvResizeWindow( Window* pParent, VCLXHatchWindow* pWrapper );
84 :
85 : void SetHatchBorderPixel( const Size & rSize );
86 :
87 : void SelectMouse( const Point & rPos );
88 : virtual void MouseButtonUp( const MouseEvent & rEvt ) SAL_OVERRIDE;
89 : virtual void MouseMove( const MouseEvent & rEvt ) SAL_OVERRIDE;
90 : virtual void MouseButtonDown( const MouseEvent & rEvt ) SAL_OVERRIDE;
91 : virtual void KeyInput( const KeyEvent & rEvt ) SAL_OVERRIDE;
92 : virtual void Resize() SAL_OVERRIDE;
93 : virtual void Paint( const Rectangle & ) SAL_OVERRIDE;
94 : virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
95 : virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
96 :
97 : void QueryObjAreaPixel( Rectangle & );
98 : void RequestObjAreaPixel( const Rectangle & );
99 : };
100 :
101 : #endif // INCLUDED_SVTOOLS_SOURCE_HATCHWINDOW_IPWIN_HXX
102 :
103 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|