xref: /aoo41x/main/sd/source/ui/inc/futext.hxx (revision 67e470da)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SD_FU_TEXT_HXX
25 #define SD_FU_TEXT_HXX
26 
27 #ifndef _EDITDATA_HXX
28 #include <editeng/editdata.hxx>
29 #endif
30 #include "fuconstr.hxx"
31 #include <svx/svdotext.hxx>
32 
33 struct StyleRequestData;
34 class SdrTextObj;
35 class OutlinerParaObject;
36 class FontList;
37 class OutlinerView;
38 
39 namespace sd {
40 
41 /*************************************************************************
42 |*
43 |* Basisklasse fuer Textfunktionen
44 |*
45 \************************************************************************/
46 
47 class FuText
48     : public FuConstruct
49 {
50 public:
51 	TYPEINFO();
52 
53 	static FunctionReference Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
54 	virtual void DoExecute( SfxRequest& rReq );
55 
56 	virtual sal_Bool KeyInput(const KeyEvent& rKEvt);
57 	virtual sal_Bool MouseMove(const MouseEvent& rMEvt);
58 	virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt);
59 	virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt);
60 	virtual sal_Bool Command(const CommandEvent& rCEvt);
61 	virtual sal_Bool RequestHelp(const HelpEvent& rHEvt);
62 	virtual void ReceiveRequest(SfxRequest& rReq);
63 	virtual void DoubleClick(const MouseEvent& rMEvt);
64 
65 	virtual void Activate();		   // Function aktivieren
66 	virtual void Deactivate();		   // Function deaktivieren
67 
68 	void    SetInEditMode(const MouseEvent& rMEvt, sal_Bool bQuickDrag);
69 	sal_Bool	DeleteDefaultText();
GetTextObj()70 	SdrTextObj* GetTextObj() { return static_cast< SdrTextObj* >( mxTextObj.get() ); }
71 
72 	DECL_LINK(SpellError, void* );
73 
74 	// #97016#
75 	virtual SdrObject* CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle);
76 
77 	/** is called when the currenct function should be aborted. <p>
78 		This is used when a function gets a KEY_ESCAPE but can also
79 		be called directly.
80 
81 		@returns true if a active function was aborted
82 	*/
83 	virtual bool cancel();
84 
85     static void ChangeFontSize( bool, OutlinerView*, const FontList*, ::sd::View* );
86 
87 protected:
88 	FuText (ViewShell* pViewSh,
89         ::sd::Window* pWin,
90         ::sd::View* pView,
91         SdDrawDocument* pDoc,
92         SfxRequest& rReq);
93 
94 	virtual void disposing();
95 
96 	SdrObjectWeakRef	mxTextObj;
97 	Link                aOldLink;
98 	sal_Bool                bFirstObjCreated;
99 
100 	SfxRequest&			rRequest;
101 
102 private:
103 	// #97016#
104 	void ImpSetAttributesForNewTextObject(SdrTextObj* pTxtObj);
105 	void ImpSetAttributesFitToSize(SdrTextObj* pTxtObj);
106 	void ImpSetAttributesFitToSizeVertical(SdrTextObj* pTxtObj);
107 	void ImpSetAttributesFitCommon(SdrTextObj* pTxtObj);
108 };
109 
110 } // end of namespace sd
111 
112 #endif
113