Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _SVX_CHARMAP_HXX
29 : : #define _SVX_CHARMAP_HXX
30 : :
31 : : #include <vcl/ctrl.hxx>
32 : : #include <vcl/metric.hxx>
33 : : #include <vcl/scrbar.hxx>
34 : : #include <boost/shared_ptr.hpp>
35 : : #include <map>
36 : : #include <tools/shl.hxx>
37 : : #include "svx/svxdllapi.h"
38 : :
39 : : // define ----------------------------------------------------------------
40 : :
41 : : #define COLUMN_COUNT 16
42 : : #define ROW_COUNT 8
43 : :
44 : : namespace svx
45 : : {
46 : : struct SvxShowCharSetItem;
47 : : class SvxShowCharSetVirtualAcc;
48 : : }
49 : :
50 : : // class SvxShowCharSet --------------------------------------------------
51 : :
52 : : class SVX_DLLPUBLIC SvxShowCharSet : public Control
53 : : {
54 : : public:
55 : : SvxShowCharSet( Window* pParent, const ResId& rResId );
56 : : ~SvxShowCharSet();
57 : :
58 : : void SetFont( const Font& rFont );
59 : :
60 : : void SelectCharacter( sal_uInt32 cNew, sal_Bool bFocus = sal_False );
61 : : sal_UCS4 GetSelectCharacter() const;
62 : :
63 : : Link GetDoubleClickHdl() const { return aDoubleClkHdl; }
64 : 0 : void SetDoubleClickHdl( const Link& rLink ) { aDoubleClkHdl = rLink; }
65 : : Link GetSelectHdl() const { return aSelectHdl; }
66 : 0 : void SetSelectHdl( const Link& rHdl ) { aSelectHdl = rHdl; }
67 : : Link GetHighlightHdl() const { return aHighHdl; }
68 : 0 : void SetHighlightHdl( const Link& rHdl ) { aHighHdl = rHdl; }
69 : : Link GetPreSelectHdl() const { return aHighHdl; }
70 : 0 : void SetPreSelectHdl( const Link& rHdl ) { aPreSelectHdl = rHdl; }
71 : : static sal_uInt32& getSelectedChar();
72 : :
73 : : #ifdef _SVX_CHARMAP_CXX_
74 : : ::svx::SvxShowCharSetItem* ImplGetItem( int _nPos );
75 : : int FirstInView( void) const;
76 : : int LastInView( void) const;
77 : : int PixelToMapIndex( const Point&) const;
78 : : void SelectIndex( int index, sal_Bool bFocus = sal_False );
79 : : void DeSelect();
80 : : inline sal_Bool IsSelected(sal_uInt16 _nPos) const { return _nPos == nSelectedIndex; }
81 : : inline sal_uInt16 GetSelectIndexId() const { return sal::static_int_cast<sal_uInt16>(nSelectedIndex); }
82 : : sal_uInt16 GetRowPos(sal_uInt16 _nPos) const;
83 : : sal_uInt16 GetColumnPos(sal_uInt16 _nPos) const;
84 : :
85 : : ScrollBar* getScrollBar();
86 : : void ReleaseAccessible();
87 : : sal_Int32 getMaxCharCount() const;
88 : : #endif // _SVX_CHARMAP_CXX_
89 : :
90 : : protected:
91 : : virtual void Paint( const Rectangle& );
92 : : virtual void MouseButtonDown( const MouseEvent& rMEvt );
93 : : virtual void MouseButtonUp( const MouseEvent& rMEvt );
94 : : virtual void MouseMove( const MouseEvent& rMEvt );
95 : : virtual void Command( const CommandEvent& rCEvt );
96 : : virtual void KeyInput( const KeyEvent& rKEvt );
97 : : virtual void GetFocus();
98 : : virtual void LoseFocus();
99 : : virtual void StateChanged( StateChangedType nStateChange );
100 : : virtual void DataChanged( const DataChangedEvent& rDCEvt );
101 : :
102 : :
103 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
104 : :
105 : :
106 : :
107 : : private:
108 : : typedef ::std::map<sal_Int32, boost::shared_ptr<svx::SvxShowCharSetItem> > ItemsMap;
109 : : ItemsMap m_aItems;
110 : : Link aDoubleClkHdl;
111 : : Link aSelectHdl;
112 : : Link aHighHdl;
113 : : Link aPreSelectHdl;
114 : : ::svx::SvxShowCharSetVirtualAcc* m_pAccessible;
115 : : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xAccessible;
116 : : long nX;
117 : : long nY;
118 : : sal_Bool bDrag;
119 : :
120 : : sal_Int32 nSelectedIndex;
121 : :
122 : : FontCharMap maFontCharMap;
123 : : ScrollBar aVscrollSB;
124 : : Size aOrigSize;
125 : : Point aOrigPos;
126 : :
127 : : private:
128 : : void DrawChars_Impl( int n1, int n2);
129 : : void InitSettings( sal_Bool bForeground, sal_Bool bBackground);
130 : : // abstraction layers are: Unicode<->MapIndex<->Pixel
131 : : Point MapIndexToPixel( int) const;
132 : : DECL_LINK(VscrollHdl, void *);
133 : : };
134 : :
135 : : #endif
136 : :
137 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|