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 _BASCTL_DLGED_HXX 29 #define _BASCTL_DLGED_HXX 30 31 #include <com/sun/star/container/XNameContainer.hpp> 32 #include <com/sun/star/awt/XControlContainer.hpp> 33 #include <com/sun/star/datatransfer/DataFlavor.hpp> 34 #include <com/sun/star/util/XNumberFormatsSupplier.hpp> 35 #include <tools/link.hxx> 36 #include <tools/gen.hxx> 37 #include <vcl/timer.hxx> 38 #include <svl/hint.hxx> 39 #include <svl/brdcst.hxx> 40 41 #define DLGED_PAGE_WIDTH_MIN 1280 42 #define DLGED_PAGE_HEIGHT_MIN 1024 43 44 45 //============================================================================ 46 // DlgEdHint 47 //============================================================================ 48 49 enum DlgEdHintKind 50 { 51 DLGED_HINT_UNKNOWN, 52 DLGED_HINT_WINDOWSCROLLED, 53 DLGED_HINT_LAYERCHANGED, 54 DLGED_HINT_OBJORDERCHANGED, 55 DLGED_HINT_SELECTIONCHANGED 56 }; 57 58 class DlgEdObj; 59 60 class DlgEdHint: public SfxHint 61 { 62 private: 63 DlgEdHintKind eHintKind; 64 DlgEdObj* pDlgEdObj; 65 66 public: 67 TYPEINFO(); 68 DlgEdHint( DlgEdHintKind eHint ); 69 DlgEdHint( DlgEdHintKind eHint, DlgEdObj* pObj ); 70 virtual ~DlgEdHint(); 71 72 DlgEdHintKind GetKind() const { return eHintKind; } 73 DlgEdObj* GetObject() const { return pDlgEdObj; } 74 }; 75 76 77 //============================================================================ 78 // DlgEditor 79 //============================================================================ 80 81 enum DlgEdMode { DLGED_INSERT, DLGED_SELECT, DLGED_TEST, DLGED_READONLY }; 82 83 class ScrollBar; 84 class DlgEdModel; 85 class DlgEdPage; 86 class DlgEdView; 87 class DlgEdForm; 88 class DlgEdFactory; 89 class DlgEdFunc; 90 class Printer; 91 class KeyEvent; 92 class MouseEvent; 93 class Timer; 94 class Window; 95 96 class DlgEditor: public SfxBroadcaster 97 { 98 private: 99 DECL_LINK( PaintTimeout, Timer * ); 100 DECL_LINK( MarkTimeout, Timer * ); 101 102 void Print( Printer* pPrinter, const String& rTitle ); 103 104 protected: 105 ScrollBar* pHScroll; 106 ScrollBar* pVScroll; 107 DlgEdModel* pDlgEdModel; 108 DlgEdPage* pDlgEdPage; 109 DlgEdView* pDlgEdView; 110 DlgEdForm* pDlgEdForm; 111 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > m_xUnoControlDialogModel; 112 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > m_xControlContainer; 113 ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > m_ClipboardDataFlavors; 114 ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > m_ClipboardDataFlavorsResource; 115 ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > m_xSupplier; 116 DlgEdFactory* pObjFac; 117 Window* pWindow; 118 DlgEdFunc* pFunc; 119 DlgEdMode eMode; 120 sal_uInt16 eActObj; 121 sal_Bool bFirstDraw; 122 Size aGridSize; 123 sal_Bool bGridVisible; 124 sal_Bool bGridSnap; 125 sal_Bool bCreateOK; 126 Timer aPaintTimer; 127 Rectangle aPaintRect; 128 sal_Bool bDialogModelChanged; 129 Timer aMarkTimer; 130 long mnPaintGuard; 131 132 public: 133 DlgEditor(); 134 ~DlgEditor(); 135 136 void SetWindow( Window* pWindow ); 137 Window* GetWindow() const { return pWindow; } 138 139 /** returns the control container associated with our window 140 @see GetWindow 141 @see SetWindow 142 */ 143 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > 144 GetWindowControlContainer(); 145 146 void SetDlgEdForm( DlgEdForm* pForm ) { pDlgEdForm = pForm; } 147 DlgEdForm* GetDlgEdForm() const { return pDlgEdForm; } 148 149 void SetScrollBars( ScrollBar* pHScroll, ScrollBar* pVScroll ); 150 void InitScrollBars(); 151 ScrollBar* GetHScroll() const { return pHScroll; } 152 ScrollBar* GetVScroll() const { return pVScroll; } 153 void DoScroll( ScrollBar* pActScroll ); 154 void UpdateScrollBars(); 155 156 void SetDialog( ::com::sun::star::uno::Reference< 157 ::com::sun::star::container::XNameContainer > xUnoControlDialogModel ); 158 void ResetDialog( void ); 159 ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > GetDialog() const 160 {return m_xUnoControlDialogModel;} 161 162 ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > const & GetNumberFormatsSupplier(); 163 164 DlgEdModel* GetModel() const { return pDlgEdModel; } 165 DlgEdView* GetView() const { return pDlgEdView; } 166 DlgEdPage* GetPage() const { return pDlgEdPage; } 167 168 void ShowDialog(); 169 170 sal_Bool UnmarkDialog(); 171 sal_Bool RemarkDialog(); 172 173 void SetDialogModelChanged( sal_Bool bChanged = sal_True ) { bDialogModelChanged = bChanged; } 174 sal_Bool IsDialogModelChanged() const { return bDialogModelChanged; } 175 176 sal_Bool IsModified() const; 177 void ClearModifyFlag(); 178 179 void MouseButtonDown( const MouseEvent& rMEvt ); 180 void MouseButtonUp( const MouseEvent& rMEvt ); 181 void MouseMove( const MouseEvent& rMEvt ); 182 void Paint( const Rectangle& rRect ); 183 sal_Bool KeyInput( const KeyEvent& rKEvt ); 184 185 void SetMode( DlgEdMode eMode ); 186 void SetInsertObj( sal_uInt16 eObj ); 187 sal_uInt16 GetInsertObj() const; 188 void CreateDefaultObject(); 189 DlgEdMode GetMode() const { return eMode; } 190 sal_Bool IsCreateOK() const { return bCreateOK; } 191 192 void Cut(); 193 void Copy(); 194 void Paste(); 195 void Delete(); 196 sal_Bool IsPasteAllowed(); 197 198 void ShowProperties(); 199 void UpdatePropertyBrowserDelayed(); 200 201 sal_Int32 countPages( Printer* pPrinter ); 202 void printPage( sal_Int32 nPage, Printer* pPrinter, const String& ); 203 204 bool AdjustPageSize(); 205 206 bool isInPaint() const { return mnPaintGuard > 0; } 207 }; 208 209 #endif //_BASCTL_DLGED_HXX 210