xref: /trunk/main/sd/source/ui/inc/futext.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SD_FU_TEXT_HXX
29 #define SD_FU_TEXT_HXX
30 
31 #ifndef _EDITDATA_HXX
32 #include <editeng/editdata.hxx>
33 #endif
34 #include "fuconstr.hxx"
35 #include <svx/svdotext.hxx>
36 
37 struct StyleRequestData;
38 class SdrTextObj;
39 class OutlinerParaObject;
40 class FontList;
41 class OutlinerView;
42 
43 namespace sd {
44 
45 /*************************************************************************
46 |*
47 |* Basisklasse fuer Textfunktionen
48 |*
49 \************************************************************************/
50 
51 class FuText
52     : public FuConstruct
53 {
54 public:
55     TYPEINFO();
56 
57     static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
58     virtual void DoExecute( SfxRequest& rReq );
59 
60     virtual sal_Bool KeyInput(const KeyEvent& rKEvt);
61     virtual sal_Bool MouseMove(const MouseEvent& rMEvt);
62     virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt);
63     virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt);
64     virtual sal_Bool Command(const CommandEvent& rCEvt);
65     virtual sal_Bool RequestHelp(const HelpEvent& rHEvt);
66     virtual void ReceiveRequest(SfxRequest& rReq);
67     virtual void DoubleClick(const MouseEvent& rMEvt);
68 
69     virtual void Activate();           // Function aktivieren
70     virtual void Deactivate();         // Function deaktivieren
71 
72     void    SetInEditMode(const MouseEvent& rMEvt, sal_Bool bQuickDrag);
73     sal_Bool    DeleteDefaultText();
74     SdrTextObj* GetTextObj() { return static_cast< SdrTextObj* >( mxTextObj.get() ); }
75 
76     DECL_LINK(SpellError, void* );
77 
78     // #97016#
79     virtual SdrObject* CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle);
80 
81     /** is called when the currenct function should be aborted. <p>
82         This is used when a function gets a KEY_ESCAPE but can also
83         be called directly.
84 
85         @returns true if a active function was aborted
86     */
87     virtual bool cancel();
88 
89     static void ChangeFontSize( bool, OutlinerView*, const FontList*, ::sd::View* );
90 
91 protected:
92     FuText (ViewShell* pViewSh,
93         ::sd::Window* pWin,
94         ::sd::View* pView,
95         SdDrawDocument* pDoc,
96         SfxRequest& rReq);
97 
98     virtual void disposing();
99 
100     SdrObjectWeakRef    mxTextObj;
101     Link                aOldLink;
102     sal_Bool                bFirstObjCreated;
103 
104     SfxRequest&         rRequest;
105 
106 private:
107     // #97016#
108     void ImpSetAttributesForNewTextObject(SdrTextObj* pTxtObj);
109     void ImpSetAttributesFitToSize(SdrTextObj* pTxtObj);
110     void ImpSetAttributesFitToSizeVertical(SdrTextObj* pTxtObj);
111     void ImpSetAttributesFitCommon(SdrTextObj* pTxtObj);
112 };
113 
114 } // end of namespace sd
115 
116 #endif
117