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 .
20 #ifndef INCLUDED_STARMATH_INC_ELEMENTSDOCKINGWINDOW_HXX
21 #define INCLUDED_STARMATH_INC_ELEMENTSDOCKINGWINDOW_HXX
23 #include <boost/signals2/signal.hpp>
24 #include <sfx2/dockwin.hxx>
25 #include <svx/dlgctrl.hxx>
26 #include <vcl/scrbar.hxx>
28 #include <document.hxx>
41 SmElement(SmNodePointer pNode
, const OUString
& aText
, const OUString
& aHelpText
);
44 SmNodePointer
getNode();
50 OUString
getHelpText()
55 virtual bool isSeparator()
61 class SmElementSeparator
: public SmElement
66 virtual bool isSeparator() SAL_OVERRIDE
72 class SmElementsControl
: public Control
74 static const sal_uInt16 aUnaryBinaryOperatorsList
[][2];
75 static const sal_uInt16 aRelationsList
[][2];
76 static const sal_uInt16 aSetOperations
[][2];
77 static const sal_uInt16 aFunctions
[][2];
78 static const sal_uInt16 aOperators
[][2];
79 static const sal_uInt16 aAttributes
[][2];
80 static const sal_uInt16 aBrackets
[][2];
81 static const sal_uInt16 aFormats
[][2];
82 static const sal_uInt16 aOthers
[][2];
84 virtual void Paint(vcl::RenderContext
& rRenderContext
, const Rectangle
&) SAL_OVERRIDE
;
85 virtual void MouseButtonDown(const MouseEvent
& rMEvt
) SAL_OVERRIDE
;
86 virtual void MouseMove( const MouseEvent
& rMEvt
) SAL_OVERRIDE
;
88 typedef std::shared_ptr
<SmElement
> SmElementPointer
;
89 typedef std::vector
< SmElementPointer
> SmElementList
;
91 SmDocShell
* mpDocShell
;
93 sal_uInt16 maCurrentSetId
;
94 SmElement
* mpCurrentElement
;
96 SmElementList maElementList
;
97 Size maMaxElementDimensions
;
99 VclPtr
< ScrollBar
> mxScroll
;
101 void addElement(const OUString
& aElementVisual
, const OUString
& aElementSource
, const OUString
& aHelpText
);
103 void addElements(const sal_uInt16 aElementsArray
[][2], sal_uInt16 size
);
109 //if pContext is not NULL, then draw, otherwise
111 void LayoutOrPaintContents(vcl::RenderContext
*pContext
= NULL
);
114 SmElementsControl(vcl::Window
*pParent
);
115 virtual ~SmElementsControl();
116 virtual void dispose() SAL_OVERRIDE
;
118 void setElementSetId(sal_uInt16 aSetId
);
120 void setVerticalMode(bool bVertical
);
122 Size
GetOptimalSize() const SAL_OVERRIDE
;
124 DECL_LINK( ScrollHdl
, void* );
125 void DoScroll(long nDelta
);
127 boost::signals2::signal
< void ( SmElement
* ) > selectedSignal
;
130 class SmElementsDockingWindow
: public SfxDockingWindow
132 static const sal_uInt16 aCategories
[];
134 VclPtr
<SmElementsControl
> mpElementsControl
;
135 VclPtr
<ListBox
> mpElementListBox
;
137 virtual void Resize() SAL_OVERRIDE
;
138 SmViewShell
* GetView();
140 void SelectClickHandler(SmElement
* pElement
);
141 DECL_LINK(ElementSelectedHandle
, ListBox
*);
145 SmElementsDockingWindow( SfxBindings
* pBindings
,
146 SfxChildWindow
* pChildWindow
,
147 vcl::Window
* pParent
);
148 virtual ~SmElementsDockingWindow();
149 virtual void dispose() SAL_OVERRIDE
;
151 virtual void EndDocking( const Rectangle
& rReactangle
, bool bFloatMode
) SAL_OVERRIDE
;
152 virtual void ToggleFloatingMode() SAL_OVERRIDE
;
155 class SmElementsDockingWindowWrapper
: public SfxChildWindow
157 SFX_DECL_CHILDWINDOW_WITHID(SmElementsDockingWindowWrapper
);
160 SmElementsDockingWindowWrapper( vcl::Window
* pParentWindow
,
162 SfxBindings
* pBindings
,
163 SfxChildWinInfo
* pInfo
);
164 virtual ~SmElementsDockingWindowWrapper();
167 #endif // INCLUDED_STARMATH_INC_ELEMENTSDOCKINGWINDOW_HXX
169 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */