1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef _SVX_CHARMAP_HXX
20 #define _SVX_CHARMAP_HXX
22 #include <vcl/ctrl.hxx>
23 #include <vcl/metric.hxx>
24 #include <vcl/scrbar.hxx>
25 #include <boost/shared_ptr.hpp>
27 #include <tools/shl.hxx>
28 #include "svx/svxdllapi.h"
30 // define ----------------------------------------------------------------
32 #define COLUMN_COUNT 16
37 struct SvxShowCharSetItem
;
38 class SvxShowCharSetVirtualAcc
;
41 // class SvxShowCharSet --------------------------------------------------
43 class SVX_DLLPUBLIC SvxShowCharSet
: public Control
46 SvxShowCharSet( Window
* pParent
, const ResId
& rResId
);
47 SvxShowCharSet( Window
* pParent
);
50 void SetFont( const Font
& rFont
);
52 void SelectCharacter( sal_uInt32 cNew
, sal_Bool bFocus
= sal_False
);
53 sal_UCS4
GetSelectCharacter() const;
55 Link
GetDoubleClickHdl() const { return aDoubleClkHdl
; }
56 void SetDoubleClickHdl( const Link
& rLink
) { aDoubleClkHdl
= rLink
; }
57 Link
GetSelectHdl() const { return aSelectHdl
; }
58 void SetSelectHdl( const Link
& rHdl
) { aSelectHdl
= rHdl
; }
59 Link
GetHighlightHdl() const { return aHighHdl
; }
60 void SetHighlightHdl( const Link
& rHdl
) { aHighHdl
= rHdl
; }
61 Link
GetPreSelectHdl() const { return aHighHdl
; }
62 void SetPreSelectHdl( const Link
& rHdl
) { aPreSelectHdl
= rHdl
; }
63 static sal_uInt32
& getSelectedChar();
65 ::svx::SvxShowCharSetItem
* ImplGetItem( int _nPos
);
66 int FirstInView( void) const;
67 int LastInView( void) const;
68 int PixelToMapIndex( const Point
&) const;
69 void SelectIndex( int index
, sal_Bool bFocus
= sal_False
);
71 inline sal_Bool
IsSelected(sal_uInt16 _nPos
) const { return _nPos
== nSelectedIndex
; }
72 inline sal_uInt16
GetSelectIndexId() const { return sal::static_int_cast
<sal_uInt16
>(nSelectedIndex
); }
73 sal_uInt16
GetRowPos(sal_uInt16 _nPos
) const;
74 sal_uInt16
GetColumnPos(sal_uInt16 _nPos
) const;
76 ScrollBar
* getScrollBar();
77 void ReleaseAccessible();
78 sal_Int32
getMaxCharCount() const;
80 virtual void Resize();
83 virtual void Paint( const Rectangle
& );
84 virtual void MouseButtonDown( const MouseEvent
& rMEvt
);
85 virtual void MouseButtonUp( const MouseEvent
& rMEvt
);
86 virtual void MouseMove( const MouseEvent
& rMEvt
);
87 virtual void Command( const CommandEvent
& rCEvt
);
88 virtual void KeyInput( const KeyEvent
& rKEvt
);
89 virtual void GetFocus();
90 virtual void LoseFocus();
91 virtual void StateChanged( StateChangedType nStateChange
);
92 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
95 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> CreateAccessible();
100 typedef ::std::map
<sal_Int32
, boost::shared_ptr
<svx::SvxShowCharSetItem
> > ItemsMap
;
106 ::svx::SvxShowCharSetVirtualAcc
* m_pAccessible
;
107 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> m_xAccessible
;
114 sal_Int32 nSelectedIndex
;
116 FontCharMap maFontCharMap
;
117 ScrollBar aVscrollSB
;
120 void DrawChars_Impl( int n1
, int n2
);
121 void InitSettings( sal_Bool bForeground
, sal_Bool bBackground
);
122 // abstraction layers are: Unicode<->MapIndex<->Pixel
123 Point
MapIndexToPixel( int) const;
124 DECL_LINK(VscrollHdl
, void *);
127 Rectangle
getGridRectangle(const Point
&rPointUL
, const Size
&rOutputSize
);
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */