xref: /aoo41x/main/basctl/source/inc/dlged.hxx (revision 96821c26)
1*96821c26SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*96821c26SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*96821c26SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*96821c26SAndrew Rist  * distributed with this work for additional information
6*96821c26SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*96821c26SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*96821c26SAndrew Rist  * "License"); you may not use this file except in compliance
9*96821c26SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*96821c26SAndrew Rist  *
11*96821c26SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*96821c26SAndrew Rist  *
13*96821c26SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*96821c26SAndrew Rist  * software distributed under the License is distributed on an
15*96821c26SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*96821c26SAndrew Rist  * KIND, either express or implied.  See the License for the
17*96821c26SAndrew Rist  * specific language governing permissions and limitations
18*96821c26SAndrew Rist  * under the License.
19*96821c26SAndrew Rist  *
20*96821c26SAndrew Rist  *************************************************************/
21*96821c26SAndrew Rist 
22*96821c26SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _BASCTL_DLGED_HXX
25cdf0e10cSrcweir #define _BASCTL_DLGED_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp>
28cdf0e10cSrcweir #include <com/sun/star/awt/XControlContainer.hpp>
29cdf0e10cSrcweir #include <com/sun/star/datatransfer/DataFlavor.hpp>
30cdf0e10cSrcweir #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
31cdf0e10cSrcweir #include <tools/link.hxx>
32cdf0e10cSrcweir #include <tools/gen.hxx>
33cdf0e10cSrcweir #include <vcl/timer.hxx>
34cdf0e10cSrcweir #include <svl/hint.hxx>
35cdf0e10cSrcweir #include <svl/brdcst.hxx>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir #define DLGED_PAGE_WIDTH_MIN    1280
38cdf0e10cSrcweir #define DLGED_PAGE_HEIGHT_MIN   1024
39cdf0e10cSrcweir 
40cdf0e10cSrcweir 
41cdf0e10cSrcweir //============================================================================
42cdf0e10cSrcweir // DlgEdHint
43cdf0e10cSrcweir //============================================================================
44cdf0e10cSrcweir 
45cdf0e10cSrcweir enum DlgEdHintKind
46cdf0e10cSrcweir {
47cdf0e10cSrcweir 	DLGED_HINT_UNKNOWN,
48cdf0e10cSrcweir 	DLGED_HINT_WINDOWSCROLLED,
49cdf0e10cSrcweir 	DLGED_HINT_LAYERCHANGED,
50cdf0e10cSrcweir 	DLGED_HINT_OBJORDERCHANGED,
51cdf0e10cSrcweir 	DLGED_HINT_SELECTIONCHANGED
52cdf0e10cSrcweir };
53cdf0e10cSrcweir 
54cdf0e10cSrcweir class DlgEdObj;
55cdf0e10cSrcweir 
56cdf0e10cSrcweir class DlgEdHint: public SfxHint
57cdf0e10cSrcweir {
58cdf0e10cSrcweir private:
59cdf0e10cSrcweir 	DlgEdHintKind	eHintKind;
60cdf0e10cSrcweir 	DlgEdObj*		pDlgEdObj;
61cdf0e10cSrcweir 
62cdf0e10cSrcweir public:
63cdf0e10cSrcweir 	TYPEINFO();
64cdf0e10cSrcweir 	DlgEdHint( DlgEdHintKind eHint );
65cdf0e10cSrcweir 	DlgEdHint( DlgEdHintKind eHint, DlgEdObj* pObj );
66cdf0e10cSrcweir 	virtual ~DlgEdHint();
67cdf0e10cSrcweir 
GetKind() const68cdf0e10cSrcweir 	DlgEdHintKind	GetKind() const	{ return eHintKind; }
GetObject() const69cdf0e10cSrcweir 	DlgEdObj*		GetObject() const { return pDlgEdObj; }
70cdf0e10cSrcweir };
71cdf0e10cSrcweir 
72cdf0e10cSrcweir 
73cdf0e10cSrcweir //============================================================================
74cdf0e10cSrcweir // DlgEditor
75cdf0e10cSrcweir //============================================================================
76cdf0e10cSrcweir 
77cdf0e10cSrcweir enum DlgEdMode { DLGED_INSERT, DLGED_SELECT, DLGED_TEST, DLGED_READONLY };
78cdf0e10cSrcweir 
79cdf0e10cSrcweir class ScrollBar;
80cdf0e10cSrcweir class DlgEdModel;
81cdf0e10cSrcweir class DlgEdPage;
82cdf0e10cSrcweir class DlgEdView;
83cdf0e10cSrcweir class DlgEdForm;
84cdf0e10cSrcweir class DlgEdFactory;
85cdf0e10cSrcweir class DlgEdFunc;
86cdf0e10cSrcweir class Printer;
87cdf0e10cSrcweir class KeyEvent;
88cdf0e10cSrcweir class MouseEvent;
89cdf0e10cSrcweir class Timer;
90cdf0e10cSrcweir class Window;
91cdf0e10cSrcweir 
92cdf0e10cSrcweir class DlgEditor: public SfxBroadcaster
93cdf0e10cSrcweir {
94cdf0e10cSrcweir private:
95cdf0e10cSrcweir 	DECL_LINK( PaintTimeout, Timer * );
96cdf0e10cSrcweir 	DECL_LINK( MarkTimeout, Timer * );
97cdf0e10cSrcweir 
98cdf0e10cSrcweir     void Print( Printer* pPrinter, const String& rTitle );
99cdf0e10cSrcweir 
100cdf0e10cSrcweir protected:
101cdf0e10cSrcweir 	ScrollBar*			pHScroll;
102cdf0e10cSrcweir 	ScrollBar*			pVScroll;
103cdf0e10cSrcweir 	DlgEdModel*			pDlgEdModel;
104cdf0e10cSrcweir 	DlgEdPage*			pDlgEdPage;
105cdf0e10cSrcweir 	DlgEdView*			pDlgEdView;
106cdf0e10cSrcweir 	DlgEdForm*			pDlgEdForm;
107cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >		m_xUnoControlDialogModel;
108cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >        m_xControlContainer;
109cdf0e10cSrcweir 	::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor >		m_ClipboardDataFlavors;
110cdf0e10cSrcweir 	::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor >		m_ClipboardDataFlavorsResource;
111cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >  m_xSupplier;
112cdf0e10cSrcweir 	DlgEdFactory*		pObjFac;
113cdf0e10cSrcweir 	Window*				pWindow;
114cdf0e10cSrcweir 	DlgEdFunc*			pFunc;
115cdf0e10cSrcweir 	DlgEdMode			eMode;
116cdf0e10cSrcweir 	sal_uInt16				eActObj;
117cdf0e10cSrcweir 	sal_Bool				bFirstDraw;
118cdf0e10cSrcweir 	Size				aGridSize;
119cdf0e10cSrcweir 	sal_Bool				bGridVisible;
120cdf0e10cSrcweir 	sal_Bool				bGridSnap;
121cdf0e10cSrcweir 	sal_Bool				bCreateOK;
122cdf0e10cSrcweir 	Timer				aPaintTimer;
123cdf0e10cSrcweir 	Rectangle			aPaintRect;
124cdf0e10cSrcweir 	sal_Bool				bDialogModelChanged;
125cdf0e10cSrcweir     Timer               aMarkTimer;
126cdf0e10cSrcweir 	long				mnPaintGuard;
127cdf0e10cSrcweir 
128cdf0e10cSrcweir public:
129cdf0e10cSrcweir 	DlgEditor();
130cdf0e10cSrcweir 	~DlgEditor();
131cdf0e10cSrcweir 
132cdf0e10cSrcweir 	void			SetWindow( Window* pWindow );
GetWindow() const133cdf0e10cSrcweir 	Window*			GetWindow() const { return pWindow; }
134cdf0e10cSrcweir 
135cdf0e10cSrcweir     /** returns the control container associated with our window
136cdf0e10cSrcweir         @see GetWindow
137cdf0e10cSrcweir         @see SetWindow
138cdf0e10cSrcweir     */
139cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >
140cdf0e10cSrcweir                     GetWindowControlContainer();
141cdf0e10cSrcweir 
SetDlgEdForm(DlgEdForm * pForm)142cdf0e10cSrcweir 	void			SetDlgEdForm( DlgEdForm* pForm ) { pDlgEdForm = pForm; }
GetDlgEdForm() const143cdf0e10cSrcweir 	DlgEdForm*		GetDlgEdForm() const { return pDlgEdForm; }
144cdf0e10cSrcweir 
145cdf0e10cSrcweir 	void			SetScrollBars( ScrollBar* pHScroll, ScrollBar* pVScroll );
146cdf0e10cSrcweir     void            InitScrollBars();
GetHScroll() const147cdf0e10cSrcweir 	ScrollBar* 		GetHScroll() const { return pHScroll; }
GetVScroll() const148cdf0e10cSrcweir 	ScrollBar*		GetVScroll() const { return pVScroll; }
149cdf0e10cSrcweir 	void			DoScroll( ScrollBar* pActScroll );
150cdf0e10cSrcweir 	void			UpdateScrollBars();
151cdf0e10cSrcweir 
152cdf0e10cSrcweir 	void			SetDialog( ::com::sun::star::uno::Reference<
153cdf0e10cSrcweir 						::com::sun::star::container::XNameContainer > xUnoControlDialogModel );
154cdf0e10cSrcweir 	void			ResetDialog( void );
GetDialog() const155cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >	GetDialog() const
156cdf0e10cSrcweir 						{return m_xUnoControlDialogModel;}
157cdf0e10cSrcweir 
158cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > const & GetNumberFormatsSupplier();
159cdf0e10cSrcweir 
GetModel() const160cdf0e10cSrcweir 	DlgEdModel*		GetModel() 		const { return pDlgEdModel; }
GetView() const161cdf0e10cSrcweir 	DlgEdView*		GetView() 	 	const { return pDlgEdView; }
GetPage() const162cdf0e10cSrcweir 	DlgEdPage*		GetPage()		const { return pDlgEdPage; }
163cdf0e10cSrcweir 
164cdf0e10cSrcweir 	void			ShowDialog();
165cdf0e10cSrcweir 
166cdf0e10cSrcweir 	sal_Bool			UnmarkDialog();
167cdf0e10cSrcweir 	sal_Bool			RemarkDialog();
168cdf0e10cSrcweir 
SetDialogModelChanged(sal_Bool bChanged=sal_True)169cdf0e10cSrcweir 	void			SetDialogModelChanged( sal_Bool bChanged = sal_True ) { bDialogModelChanged = bChanged; }
IsDialogModelChanged() const170cdf0e10cSrcweir 	sal_Bool			IsDialogModelChanged() const { return bDialogModelChanged; }
171cdf0e10cSrcweir 
172cdf0e10cSrcweir 	sal_Bool			IsModified() const;
173cdf0e10cSrcweir 	void			ClearModifyFlag();
174cdf0e10cSrcweir 
175cdf0e10cSrcweir 	void			MouseButtonDown( const MouseEvent& rMEvt );
176cdf0e10cSrcweir 	void			MouseButtonUp( const MouseEvent& rMEvt );
177cdf0e10cSrcweir 	void			MouseMove( const MouseEvent& rMEvt );
178cdf0e10cSrcweir 	void			Paint( const Rectangle& rRect );
179cdf0e10cSrcweir 	sal_Bool			KeyInput( const KeyEvent& rKEvt );
180cdf0e10cSrcweir 
181cdf0e10cSrcweir 	void 			SetMode( DlgEdMode eMode );
182cdf0e10cSrcweir 	void			SetInsertObj( sal_uInt16 eObj );
183cdf0e10cSrcweir 	sal_uInt16    		GetInsertObj() const;
184cdf0e10cSrcweir 	void			CreateDefaultObject();
GetMode() const185cdf0e10cSrcweir 	DlgEdMode   	GetMode() const { return eMode; }
IsCreateOK() const186cdf0e10cSrcweir 	sal_Bool			IsCreateOK() const { return bCreateOK; }
187cdf0e10cSrcweir 
188cdf0e10cSrcweir 	void			Cut();
189cdf0e10cSrcweir 	void			Copy();
190cdf0e10cSrcweir 	void			Paste();
191cdf0e10cSrcweir 	void			Delete();
192cdf0e10cSrcweir     sal_Bool            IsPasteAllowed();
193cdf0e10cSrcweir 
194cdf0e10cSrcweir 	void			ShowProperties();
195cdf0e10cSrcweir     void            UpdatePropertyBrowserDelayed();
196cdf0e10cSrcweir 
197cdf0e10cSrcweir     sal_Int32       countPages( Printer* pPrinter );
198cdf0e10cSrcweir     void            printPage( sal_Int32 nPage, Printer* pPrinter, const String& );
199cdf0e10cSrcweir 
200cdf0e10cSrcweir     bool            AdjustPageSize();
201cdf0e10cSrcweir 
isInPaint() const202cdf0e10cSrcweir 	bool			isInPaint() const { return mnPaintGuard > 0; }
203cdf0e10cSrcweir };
204cdf0e10cSrcweir 
205cdf0e10cSrcweir #endif //_BASCTL_DLGED_HXX
206