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 <sfx2/dockwin.hxx>
24 #include <svx/dlgctrl.hxx>
25 #include <vcl/scrbar.hxx>
35 std::unique_ptr
<SmNode
> mpNode
;
42 SmElement(std::unique_ptr
<SmNode
>&& pNode
, const OUString
& aText
, const OUString
& aHelpText
);
45 const std::unique_ptr
<SmNode
>& getNode();
46 const OUString
& getText()
51 const OUString
& getHelpText()
56 virtual bool isSeparator()
62 class SmElementSeparator
: public SmElement
67 virtual bool isSeparator() override
73 class SmElementsControl
: public Control
75 friend class ElementSelectorUIObject
;
76 friend class ElementUIObject
;
78 static const std::pair
<const char*, const char*> aUnaryBinaryOperatorsList
[];
79 static const std::pair
<const char*, const char*> aRelationsList
[];
80 static const std::pair
<const char*, const char*> aSetOperations
[];
81 static const std::pair
<const char*, const char*> aFunctions
[];
82 static const std::pair
<const char*, const char*> aOperators
[];
83 static const std::pair
<const char*, const char*> aAttributes
[];
84 static const std::pair
<const char*, const char*> aBrackets
[];
85 static const std::pair
<const char*, const char*> aFormats
[];
86 static const std::pair
<const char*, const char*> aOthers
[];
88 virtual void Paint(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
&) override
;
89 virtual void MouseButtonDown(const MouseEvent
& rMEvt
) override
;
90 virtual void MouseMove(const MouseEvent
& rMEvt
) override
;
91 virtual void RequestHelp(const HelpEvent
& rHEvt
) override
;
93 SmDocShell
* mpDocShell
;
95 OString msCurrentSetId
;
96 SmElement
* mpCurrentElement
;
97 Link
<SmElement
&,void> maSelectHdlLink
;
99 std::vector
< std::unique_ptr
<SmElement
> > maElementList
;
100 Size maMaxElementDimensions
;
102 VclPtr
< ScrollBar
> mxScroll
;
104 void addElement(const OUString
& aElementVisual
, const OUString
& aElementSource
, const OUString
& aHelpText
);
106 void addElements(const std::pair
<const char*, const char*> aElementsArray
[], sal_uInt16 size
);
110 //if pContext is not NULL, then draw, otherwise
112 void LayoutOrPaintContents(vcl::RenderContext
*pContext
= nullptr);
115 explicit SmElementsControl(vcl::Window
*pParent
);
116 virtual ~SmElementsControl() override
;
117 virtual void dispose() override
;
119 void setElementSetId(const char* pSetId
);
121 void setVerticalMode(bool bVertical
);
123 Size
GetOptimalSize() const override
;
125 DECL_LINK( ScrollHdl
, ScrollBar
*, void );
126 void DoScroll(long nDelta
);
128 void SetSelectHdl(const Link
<SmElement
&,void>& rLink
) { maSelectHdlLink
= rLink
; }
130 virtual FactoryFunction
GetUITestFactory() const override
;
133 class SmElementsDockingWindow
: public SfxDockingWindow
135 static const char* aCategories
[];
137 VclPtr
<SmElementsControl
> mpElementsControl
;
138 VclPtr
<ListBox
> mpElementListBox
;
140 virtual void Resize() override
;
141 SmViewShell
* GetView();
143 DECL_LINK(SelectClickHandler
, SmElement
&, void);
144 DECL_LINK(ElementSelectedHandle
, ListBox
&, void);
148 SmElementsDockingWindow( SfxBindings
* pBindings
,
149 SfxChildWindow
* pChildWindow
,
150 vcl::Window
* pParent
);
151 virtual ~SmElementsDockingWindow() override
;
152 virtual void dispose() override
;
154 virtual void EndDocking( const tools::Rectangle
& rReactangle
, bool bFloatMode
) override
;
155 virtual void ToggleFloatingMode() override
;
158 class SmElementsDockingWindowWrapper final
: public SfxChildWindow
160 SFX_DECL_CHILDWINDOW_WITHID(SmElementsDockingWindowWrapper
);
162 SmElementsDockingWindowWrapper( vcl::Window
* pParentWindow
,
164 SfxBindings
* pBindings
,
165 SfxChildWinInfo
* pInfo
);
166 virtual ~SmElementsDockingWindowWrapper() override
;
169 #endif // INCLUDED_STARMATH_INC_ELEMENTSDOCKINGWINDOW_HXX
171 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */