Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / starmath / inc / ElementsDockingWindow.hxx
blob752954e44a993300f1316f025d3257015608aac5
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 INCLUDED_STARMATH_INC_ELEMENTSDOCKINGWINDOW_HXX
20 #define INCLUDED_STARMATH_INC_ELEMENTSDOCKINGWINDOW_HXX
22 #include <sfx2/dockwin.hxx>
23 #include <svx/dlgctrl.hxx>
25 #include <document.hxx>
26 #include <node.hxx>
28 class SmElement
30 SmNodePointer mpNode;
31 OUString maText;
32 OUString maHelpText;
33 public:
34 Point mBoxLocation;
35 Size mBoxSize;
37 SmElement(SmNodePointer pNode, const OUString& aText, const OUString& aHelpText);
38 virtual ~SmElement();
40 SmNodePointer getNode();
41 OUString getText()
43 return maText;
46 OUString getHelpText()
48 return maHelpText;
51 virtual bool isSeparator()
53 return false;
57 class SmElementSeparator : public SmElement
59 public:
60 SmElementSeparator();
62 virtual bool isSeparator() SAL_OVERRIDE
64 return true;
68 class SmElementsControl : public Control
71 static const sal_uInt16 aUnaryBinaryOperatorsList[][2];
72 static const sal_uInt16 aRelationsList[][2];
73 static const sal_uInt16 aSetOperations[][2];
74 static const sal_uInt16 aFunctions[][2];
75 static const sal_uInt16 aOperators[][2];
76 static const sal_uInt16 aAttributes[][2];
77 static const sal_uInt16 aBrackets[][2];
78 static const sal_uInt16 aFormats[][2];
79 static const sal_uInt16 aOthers[][2];
81 Link aSelectHdlLink;
83 virtual void Paint(const Rectangle&) SAL_OVERRIDE;
84 virtual void MouseButtonDown(const MouseEvent& rMEvt) SAL_OVERRIDE;
85 virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
87 typedef boost::shared_ptr<SmElement> SmElementPointer;
88 typedef std::vector< SmElementPointer > SmElementList;
90 SmDocShell* mpDocShell;
91 SmFormat maFormat;
92 sal_uInt16 maCurrentSetId;
93 SmElement* mpCurrentElement;
95 SmElementList maElementList;
96 Size maMaxElementDimensions;
97 bool mbVerticalMode;
99 void addElement(const OUString& aElementVisual, const OUString& aElementSource, const OUString& aHelpText);
101 void addElements(const sal_uInt16 aElementsArray[][2], sal_uInt16 size);
103 void addSeparator();
105 void build();
107 public:
108 SmElementsControl(Window *pParent, const ResId& rResId);
109 virtual ~SmElementsControl();
111 void setElementSetId(sal_uInt16 aSetId);
113 void setVerticalMode(bool bVertical);
115 void SetSelectHdl(const Link& rLink) { aSelectHdlLink = rLink; }
118 class SmElementsDockingWindow : public SfxDockingWindow
120 static const sal_uInt16 aCategories[];
122 SmElementsControl maElementsControl;
123 ListBox maElementListBox;
125 virtual void Resize() SAL_OVERRIDE;
126 SmViewShell* GetView();
128 DECL_LINK(SelectClickHdl, SmElement*);
129 DECL_LINK(ElementSelectedHandle, ListBox*);
131 public:
133 SmElementsDockingWindow( SfxBindings* pBindings,
134 SfxChildWindow* pChildWindow,
135 Window* pParent );
136 virtual ~SmElementsDockingWindow();
138 virtual void EndDocking( const Rectangle& rReactangle, bool bFloatMode) SAL_OVERRIDE;
139 virtual void ToggleFloatingMode() SAL_OVERRIDE;
142 class SmElementsDockingWindowWrapper : public SfxChildWindow
144 SFX_DECL_CHILDWINDOW_WITHID(SmElementsDockingWindowWrapper);
146 protected:
147 SmElementsDockingWindowWrapper( Window* pParentWindow,
148 sal_uInt16 nId,
149 SfxBindings* pBindings,
150 SfxChildWinInfo* pInfo );
151 virtual ~SmElementsDockingWindowWrapper();
155 #endif // _SYMBOLDOCKINGWINDOW_HXX_
157 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */