merge the formfield patch from ooo-build
[ooovba.git] / basic / source / app / dataedit.hxx
blobcdf6ba679a4c3a56011a083740e58b63934feb99
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dataedit.hxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef DATAEDIT_HXX
32 #define DATAEDIT_HXX
34 #include <vcl/menu.hxx>
35 #include <tools/link.hxx>
36 #include <tools/gen.hxx>
37 #include <svtools/textdata.hxx>
39 class String;
40 class Font;
42 // Find, Load and Save must be implemented,
43 // the others must exist in MemberType
44 #define DATA_FUNC_DEF( MemberName, MemberType ) \
45 public: \
46 MemberType MemberName; \
47 BOOL Find( const String& rStr ); \
48 BOOL Load( const String& rStr ); \
49 BOOL Save( const String& rStr ); \
51 void GrabFocus(){ MemberName.GrabFocus(); } \
52 void Show(){ MemberName.Show(); } \
53 void SetPosPixel( const Point& rNewPos ){ MemberName.SetPosPixel(rNewPos); }\
54 void SetSizePixel( const Size& rNewSize ){ MemberName.SetSizePixel(rNewSize); } \
55 Size GetSizePixel(){ return MemberName.GetSizePixel(); } \
56 Point GetPosPixel(){ return MemberName.GetPosPixel(); } \
57 void Update(){ MemberName.Update(); } \
58 void SetFont( const Font& rNewFont ){ MemberName.SetFont(rNewFont); } \
60 void Delete(); \
61 void Cut(); \
62 void Copy(); \
63 void Paste(); \
64 void Undo(); \
65 void Redo(); \
66 String GetText() const; \
67 void SetText( const String& rStr ); \
68 BOOL HasText() const; \
69 String GetSelected(); \
70 TextSelection GetSelection() const; \
71 void SetSelection( const TextSelection& rSelection ); \
72 USHORT GetLineNr() const; \
73 void ReplaceSelected( const String& rStr ); \
74 BOOL IsModified(); \
75 void SetModifyHdl( Link l );
78 class DataEdit
80 public:
81 virtual ~DataEdit(){}
83 virtual void Delete()=0;
84 virtual void Cut()=0;
85 virtual void Copy()=0;
86 virtual void Paste()=0;
88 virtual void Undo()=0;
89 virtual void Redo()=0;
91 virtual BOOL Find( const String& )=0; // Find and select text
92 virtual BOOL Load( const String& )=0; // Load text from file
93 virtual BOOL Save( const String& )=0; // Save text to file
94 virtual String GetSelected()=0;
95 virtual void GrabFocus()=0;
96 virtual TextSelection GetSelection() const=0;
97 virtual void SetSelection( const TextSelection& rSelection )=0;
98 virtual USHORT GetLineNr() const=0;
99 virtual String GetText() const=0;
100 virtual void SetText( const String& rStr )=0;
101 virtual BOOL HasText() const=0; // to avoid GetText.Len()
102 virtual void ReplaceSelected( const String& rStr )=0;
103 virtual BOOL IsModified()=0;
104 virtual void SetModifyHdl( Link )=0;
105 virtual void Show()=0;
106 virtual void SetPosPixel( const Point& rNewPos )=0;
107 virtual void SetSizePixel( const Size& rNewSize )=0;
108 virtual Size GetSizePixel()=0;
109 virtual Point GetPosPixel()=0;
110 virtual void Update()=0;
111 virtual void SetFont( const Font& rNewFont )=0;
113 virtual void BuildKontextMenu( PopupMenu *&pMenu )
115 (void) pMenu; /* avoid warning about unused parameter */
119 #endif