merge the formfield patch from ooo-build
[ooovba.git] / basctl / source / inc / dlged.hxx
blob2805d45facd538752f7afcd1c28cf862a917a2dd
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: dlged.hxx,v $
10 * $Revision: 1.20 $
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 _BASCTL_DLGED_HXX
32 #define _BASCTL_DLGED_HXX
34 #include <com/sun/star/container/XNameContainer.hpp>
35 #include <com/sun/star/awt/XControlContainer.hpp>
36 #include <com/sun/star/datatransfer/DataFlavor.hpp>
37 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
38 #include <com/sun/star/frame/XModel.hpp>
39 #include <tools/link.hxx>
40 #include <tools/gen.hxx>
41 #include <vcl/timer.hxx>
42 #include <svtools/hint.hxx>
43 #include <svtools/brdcst.hxx>
45 #define DLGED_PAGE_WIDTH_MIN 1280
46 #define DLGED_PAGE_HEIGHT_MIN 1024
49 //============================================================================
50 // DlgEdHint
51 //============================================================================
53 enum DlgEdHintKind
55 DLGED_HINT_UNKNOWN,
56 DLGED_HINT_WINDOWSCROLLED,
57 DLGED_HINT_LAYERCHANGED,
58 DLGED_HINT_OBJORDERCHANGED,
59 DLGED_HINT_SELECTIONCHANGED
62 class DlgEdObj;
64 class DlgEdHint: public SfxHint
66 private:
67 DlgEdHintKind eHintKind;
68 DlgEdObj* pDlgEdObj;
70 public:
71 TYPEINFO();
72 DlgEdHint( DlgEdHintKind eHint );
73 DlgEdHint( DlgEdHintKind eHint, DlgEdObj* pObj );
74 virtual ~DlgEdHint();
76 DlgEdHintKind GetKind() const { return eHintKind; }
77 DlgEdObj* GetObject() const { return pDlgEdObj; }
81 //============================================================================
82 // DlgEditor
83 //============================================================================
85 enum DlgEdMode { DLGED_INSERT, DLGED_SELECT, DLGED_TEST, DLGED_READONLY };
87 class ScrollBar;
88 class DlgEdModel;
89 class DlgEdPage;
90 class DlgEdView;
91 class DlgEdForm;
92 class DlgEdFactory;
93 class DlgEdFunc;
94 class Printer;
95 class KeyEvent;
96 class MouseEvent;
97 class Timer;
98 class Window;
100 class DlgEditor: public SfxBroadcaster
102 private:
103 DECL_LINK( PaintTimeout, Timer * );
104 DECL_LINK( MarkTimeout, Timer * );
106 protected:
107 ScrollBar* pHScroll;
108 ScrollBar* pVScroll;
109 DlgEdModel* pDlgEdModel;
110 DlgEdPage* pDlgEdPage;
111 DlgEdView* pDlgEdView;
112 DlgEdForm* pDlgEdForm;
113 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > m_xUnoControlDialogModel;
114 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > m_xControlContainer;
115 ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > m_ClipboardDataFlavors;
116 ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > m_ClipboardDataFlavorsResource;
117 ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > m_xSupplier;
118 DlgEdFactory* pObjFac;
119 Window* pWindow;
120 DlgEdFunc* pFunc;
121 DlgEdMode eMode;
122 USHORT eActObj;
123 BOOL bFirstDraw;
124 Size aGridSize;
125 BOOL bGridVisible;
126 BOOL bGridSnap;
127 BOOL bCreateOK;
128 Timer aPaintTimer;
129 Rectangle aPaintRect;
130 BOOL bDialogModelChanged;
131 Timer aMarkTimer;
132 long mnPaintGuard;
133 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xDocument;
135 DlgEditor(); // not implemented
136 public:
137 DlgEditor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel );
138 ~DlgEditor();
140 void SetWindow( Window* pWindow );
141 Window* GetWindow() const { return pWindow; }
143 /** returns the control container associated with our window
144 @see GetWindow
145 @see SetWindow
147 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >
148 GetWindowControlContainer();
150 void SetDlgEdForm( DlgEdForm* pForm ) { pDlgEdForm = pForm; }
151 DlgEdForm* GetDlgEdForm() const { return pDlgEdForm; }
153 void SetScrollBars( ScrollBar* pHScroll, ScrollBar* pVScroll );
154 void InitScrollBars();
155 ScrollBar* GetHScroll() const { return pHScroll; }
156 ScrollBar* GetVScroll() const { return pVScroll; }
157 void DoScroll( ScrollBar* pActScroll );
158 void UpdateScrollBars();
160 void SetDialog( ::com::sun::star::uno::Reference<
161 ::com::sun::star::container::XNameContainer > xUnoControlDialogModel );
162 void ResetDialog( void );
163 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > GetDialog() const
164 {return m_xUnoControlDialogModel;}
166 ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > const & GetNumberFormatsSupplier();
168 DlgEdModel* GetModel() const { return pDlgEdModel; }
169 DlgEdView* GetView() const { return pDlgEdView; }
170 DlgEdPage* GetPage() const { return pDlgEdPage; }
172 void ShowDialog();
174 BOOL UnmarkDialog();
175 BOOL RemarkDialog();
177 void SetDialogModelChanged( BOOL bChanged = TRUE ) { bDialogModelChanged = bChanged; }
178 BOOL IsDialogModelChanged() const { return bDialogModelChanged; }
180 BOOL IsModified() const;
181 void ClearModifyFlag();
183 void MouseButtonDown( const MouseEvent& rMEvt );
184 void MouseButtonUp( const MouseEvent& rMEvt );
185 void MouseMove( const MouseEvent& rMEvt );
186 void Paint( const Rectangle& rRect );
187 BOOL KeyInput( const KeyEvent& rKEvt );
189 void SetMode( DlgEdMode eMode );
190 void SetInsertObj( USHORT eObj );
191 USHORT GetInsertObj() const;
192 void CreateDefaultObject();
193 DlgEdMode GetMode() const { return eMode; }
194 BOOL IsCreateOK() const { return bCreateOK; }
196 void Cut();
197 void Copy();
198 void Paste();
199 void Delete();
200 BOOL IsPasteAllowed();
202 void ShowProperties();
203 void UpdatePropertyBrowserDelayed();
205 void PrintData( Printer*, const String& rTitle ); // not working yet
207 bool AdjustPageSize();
209 bool isInPaint() const { return mnPaintGuard > 0; }
212 #endif //_BASCTL_DLGED_HXX