/src/libreoffice/sd/source/ui/inc/futext.hxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
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/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
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 . |
18 | | */ |
19 | | |
20 | | #pragma once |
21 | | |
22 | | #include "fuconstr.hxx" |
23 | | #include <svx/svdotext.hxx> |
24 | | #include <unotools/weakref.hxx> |
25 | | |
26 | | class FontList; |
27 | | class OutlinerView; |
28 | | |
29 | | namespace sd { |
30 | | |
31 | | /** |
32 | | * Base class for text functions |
33 | | */ |
34 | | class FuText |
35 | | : public FuConstruct |
36 | | { |
37 | | public: |
38 | | |
39 | | static rtl::Reference<FuPoor> Create( ViewShell& rViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument& rDoc, SfxRequest& rReq ); |
40 | | virtual void DoExecute( SfxRequest& rReq ) override; |
41 | | |
42 | | virtual bool KeyInput(const KeyEvent& rKEvt) override; |
43 | | virtual bool MouseMove(const MouseEvent& rMEvt) override; |
44 | | virtual bool MouseButtonUp(const MouseEvent& rMEvt) override; |
45 | | virtual bool MouseButtonDown(const MouseEvent& rMEvt) override; |
46 | | virtual bool RequestHelp(const HelpEvent& rHEvt) override; |
47 | | virtual void ReceiveRequest(SfxRequest& rReq) override; |
48 | | virtual void DoubleClick(const MouseEvent& rMEvt) override; |
49 | | |
50 | | virtual void Activate() override; ///< activates the function |
51 | | virtual void Deactivate() override; ///< deactivates the function |
52 | | |
53 | | void SetInEditMode(const MouseEvent& rMEvt, bool bQuickDrag); |
54 | | void DeleteDefaultText(); |
55 | 0 | SdrTextObj* GetTextObj() { return mxTextObj.get().get(); } |
56 | | |
57 | | virtual rtl::Reference<SdrObject> CreateDefaultObject(const sal_uInt16 nID, const ::tools::Rectangle& rRectangle) override; |
58 | | |
59 | | /** is called when the current function should be aborted. <p> |
60 | | This is used when a function gets a KEY_ESCAPE but can also |
61 | | be called directly. |
62 | | |
63 | | @returns true if an active function was aborted |
64 | | */ |
65 | | virtual bool cancel() override; |
66 | | |
67 | | static void ChangeFontSize( bool, OutlinerView*, const FontList*, ::sd::View* ); |
68 | | |
69 | | void InvalidateBindings(); |
70 | | |
71 | | |
72 | | protected: |
73 | | FuText (ViewShell& rViewSh, |
74 | | ::sd::Window* pWin, |
75 | | ::sd::View* pView, |
76 | | SdDrawDocument& rDoc, |
77 | | SfxRequest& rReq); |
78 | | |
79 | | private: |
80 | | virtual void disposing() override; |
81 | | |
82 | | ::unotools::WeakReference<SdrTextObj> |
83 | | mxTextObj; |
84 | | bool bFirstObjCreated; |
85 | | bool bJustEndedEdit; |
86 | | |
87 | | SfxRequest& rRequest; |
88 | | |
89 | | void ImpSetAttributesForNewTextObject(SdrTextObj* pTxtObj); |
90 | | void ImpSetAttributesFitToSize(SdrTextObj* pTxtObj); |
91 | | void ImpSetAttributesFitToSizeVertical(SdrTextObj* pTxtObj); |
92 | | }; |
93 | | |
94 | | } // end of namespace sd |
95 | | |
96 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |