Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / sc / source / ui / inc / tphfedit.hxx
blobfcb829f0472e5c0a28774bb268e5d6b6cb77b20f
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 .
20 #ifndef INCLUDED_SC_SOURCE_UI_INC_TPHFEDIT_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_TPHFEDIT_HXX
23 #include <sfx2/tabdlg.hxx>
24 #include <svx/pageitem.hxx>
25 #include <svtools/stdctrl.hxx>
26 #include <vcl/group.hxx>
27 #include <vcl/lstbox.hxx>
28 #include <vcl/timer.hxx>
29 #include <vcl/virdev.hxx>
30 #include "scdllapi.h"
31 #include "scitems.hxx"
32 #include "popmenu.hxx"
33 #include <com/sun/star/accessibility/XAccessible.hpp>
34 #include <cppuhelper/weakref.hxx>
36 #include <functional>
38 class ScHeaderEditEngine;
39 class ScPatternAttr;
40 class EditView;
41 class EditTextObject;
42 class SvxFieldItem;
43 class ScAccessibleEditObject;
44 class ScEditWindow;
46 enum ScEditWindowLocation
48 Left,
49 Center,
50 Right
53 class SC_DLLPUBLIC ScEditWindow : public Control
55 public:
56 ScEditWindow( vcl::Window* pParent, WinBits nBits , ScEditWindowLocation eLoc );
57 virtual ~ScEditWindow();
58 virtual void dispose() override;
60 using Control::SetFont;
61 void SetFont( const ScPatternAttr& rPattern );
62 using Control::SetText;
63 void SetText( const EditTextObject& rTextObject );
64 EditTextObject* CreateTextObject();
65 void SetCharAttributes();
67 void InsertField( const SvxFieldItem& rFld );
69 void SetNumType(SvxNumType eNumType);
71 virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
73 ScHeaderEditEngine* GetEditEngine() const { return pEdEngine; }
74 void SetObjectSelectHdl( const Link<ScEditWindow&,void>& aLink) { aObjectSelectLink = aLink; }
75 void SetGetFocusHdl(const std::function<void (ScEditWindow&)>& rLink) { m_GetFocusLink = rLink; }
77 void SetLocation(ScEditWindowLocation eLoc) { eLocation = eLoc; }
78 protected:
79 virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) override;
80 virtual void MouseMove( const MouseEvent& rMEvt ) override;
81 virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
82 virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
83 virtual void KeyInput( const KeyEvent& rKEvt ) override;
84 virtual void Command( const CommandEvent& rCEvt ) override;
85 virtual void GetFocus() override;
86 virtual void LoseFocus() override;
87 virtual void Resize() override;
89 private:
90 ScHeaderEditEngine* pEdEngine;
91 EditView* pEdView;
92 ScEditWindowLocation eLocation;
93 bool mbRTL;
95 css::uno::WeakReference< css::accessibility::XAccessible > xAcc;
96 ScAccessibleEditObject* pAcc;
98 Link<ScEditWindow&,void> aObjectSelectLink;
99 std::function<void (ScEditWindow&)> m_GetFocusLink;
102 class SC_DLLPUBLIC ScExtIButton : public ImageButton
104 private:
106 Idle aIdle;
107 PopupMenu* pPopupMenu;
108 Link<ScExtIButton&,void> aMLink;
109 sal_uInt16 nSelected;
110 OString aSelectedIdent;
112 DECL_DLLPRIVATE_LINK_TYPED( TimerHdl, Idle*, void );
114 protected:
116 virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
117 virtual void MouseButtonUp( const MouseEvent& rMEvt) override;
118 virtual void Click() override;
120 void StartPopup();
122 public:
124 ScExtIButton(vcl::Window* pParent, WinBits nBits );
126 void SetPopupMenu(PopupMenu* pPopUp);
128 sal_uInt16 GetSelected() const { return nSelected;}
129 const OString& GetSelectedIdent() const { return aSelectedIdent;}
131 void SetMenuHdl( const Link<ScExtIButton&,void>& rLink ) { aMLink = rLink; }
133 virtual bool PreNotify( NotifyEvent& rNEvt ) override;
136 #endif // INCLUDED_SC_SOURCE_UI_INC_TPHFEDIT_HXX
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */