1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef _BASCTL_DLGED_HXX 29*cdf0e10cSrcweir #define _BASCTL_DLGED_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp> 32*cdf0e10cSrcweir #include <com/sun/star/awt/XControlContainer.hpp> 33*cdf0e10cSrcweir #include <com/sun/star/datatransfer/DataFlavor.hpp> 34*cdf0e10cSrcweir #include <com/sun/star/util/XNumberFormatsSupplier.hpp> 35*cdf0e10cSrcweir #include <tools/link.hxx> 36*cdf0e10cSrcweir #include <tools/gen.hxx> 37*cdf0e10cSrcweir #include <vcl/timer.hxx> 38*cdf0e10cSrcweir #include <svl/hint.hxx> 39*cdf0e10cSrcweir #include <svl/brdcst.hxx> 40*cdf0e10cSrcweir 41*cdf0e10cSrcweir #define DLGED_PAGE_WIDTH_MIN 1280 42*cdf0e10cSrcweir #define DLGED_PAGE_HEIGHT_MIN 1024 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir //============================================================================ 46*cdf0e10cSrcweir // DlgEdHint 47*cdf0e10cSrcweir //============================================================================ 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir enum DlgEdHintKind 50*cdf0e10cSrcweir { 51*cdf0e10cSrcweir DLGED_HINT_UNKNOWN, 52*cdf0e10cSrcweir DLGED_HINT_WINDOWSCROLLED, 53*cdf0e10cSrcweir DLGED_HINT_LAYERCHANGED, 54*cdf0e10cSrcweir DLGED_HINT_OBJORDERCHANGED, 55*cdf0e10cSrcweir DLGED_HINT_SELECTIONCHANGED 56*cdf0e10cSrcweir }; 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir class DlgEdObj; 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir class DlgEdHint: public SfxHint 61*cdf0e10cSrcweir { 62*cdf0e10cSrcweir private: 63*cdf0e10cSrcweir DlgEdHintKind eHintKind; 64*cdf0e10cSrcweir DlgEdObj* pDlgEdObj; 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir public: 67*cdf0e10cSrcweir TYPEINFO(); 68*cdf0e10cSrcweir DlgEdHint( DlgEdHintKind eHint ); 69*cdf0e10cSrcweir DlgEdHint( DlgEdHintKind eHint, DlgEdObj* pObj ); 70*cdf0e10cSrcweir virtual ~DlgEdHint(); 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir DlgEdHintKind GetKind() const { return eHintKind; } 73*cdf0e10cSrcweir DlgEdObj* GetObject() const { return pDlgEdObj; } 74*cdf0e10cSrcweir }; 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir //============================================================================ 78*cdf0e10cSrcweir // DlgEditor 79*cdf0e10cSrcweir //============================================================================ 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir enum DlgEdMode { DLGED_INSERT, DLGED_SELECT, DLGED_TEST, DLGED_READONLY }; 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir class ScrollBar; 84*cdf0e10cSrcweir class DlgEdModel; 85*cdf0e10cSrcweir class DlgEdPage; 86*cdf0e10cSrcweir class DlgEdView; 87*cdf0e10cSrcweir class DlgEdForm; 88*cdf0e10cSrcweir class DlgEdFactory; 89*cdf0e10cSrcweir class DlgEdFunc; 90*cdf0e10cSrcweir class Printer; 91*cdf0e10cSrcweir class KeyEvent; 92*cdf0e10cSrcweir class MouseEvent; 93*cdf0e10cSrcweir class Timer; 94*cdf0e10cSrcweir class Window; 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir class DlgEditor: public SfxBroadcaster 97*cdf0e10cSrcweir { 98*cdf0e10cSrcweir private: 99*cdf0e10cSrcweir DECL_LINK( PaintTimeout, Timer * ); 100*cdf0e10cSrcweir DECL_LINK( MarkTimeout, Timer * ); 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir void Print( Printer* pPrinter, const String& rTitle ); 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir protected: 105*cdf0e10cSrcweir ScrollBar* pHScroll; 106*cdf0e10cSrcweir ScrollBar* pVScroll; 107*cdf0e10cSrcweir DlgEdModel* pDlgEdModel; 108*cdf0e10cSrcweir DlgEdPage* pDlgEdPage; 109*cdf0e10cSrcweir DlgEdView* pDlgEdView; 110*cdf0e10cSrcweir DlgEdForm* pDlgEdForm; 111*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > m_xUnoControlDialogModel; 112*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > m_xControlContainer; 113*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > m_ClipboardDataFlavors; 114*cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > m_ClipboardDataFlavorsResource; 115*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > m_xSupplier; 116*cdf0e10cSrcweir DlgEdFactory* pObjFac; 117*cdf0e10cSrcweir Window* pWindow; 118*cdf0e10cSrcweir DlgEdFunc* pFunc; 119*cdf0e10cSrcweir DlgEdMode eMode; 120*cdf0e10cSrcweir sal_uInt16 eActObj; 121*cdf0e10cSrcweir sal_Bool bFirstDraw; 122*cdf0e10cSrcweir Size aGridSize; 123*cdf0e10cSrcweir sal_Bool bGridVisible; 124*cdf0e10cSrcweir sal_Bool bGridSnap; 125*cdf0e10cSrcweir sal_Bool bCreateOK; 126*cdf0e10cSrcweir Timer aPaintTimer; 127*cdf0e10cSrcweir Rectangle aPaintRect; 128*cdf0e10cSrcweir sal_Bool bDialogModelChanged; 129*cdf0e10cSrcweir Timer aMarkTimer; 130*cdf0e10cSrcweir long mnPaintGuard; 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir public: 133*cdf0e10cSrcweir DlgEditor(); 134*cdf0e10cSrcweir ~DlgEditor(); 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir void SetWindow( Window* pWindow ); 137*cdf0e10cSrcweir Window* GetWindow() const { return pWindow; } 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir /** returns the control container associated with our window 140*cdf0e10cSrcweir @see GetWindow 141*cdf0e10cSrcweir @see SetWindow 142*cdf0e10cSrcweir */ 143*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > 144*cdf0e10cSrcweir GetWindowControlContainer(); 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir void SetDlgEdForm( DlgEdForm* pForm ) { pDlgEdForm = pForm; } 147*cdf0e10cSrcweir DlgEdForm* GetDlgEdForm() const { return pDlgEdForm; } 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir void SetScrollBars( ScrollBar* pHScroll, ScrollBar* pVScroll ); 150*cdf0e10cSrcweir void InitScrollBars(); 151*cdf0e10cSrcweir ScrollBar* GetHScroll() const { return pHScroll; } 152*cdf0e10cSrcweir ScrollBar* GetVScroll() const { return pVScroll; } 153*cdf0e10cSrcweir void DoScroll( ScrollBar* pActScroll ); 154*cdf0e10cSrcweir void UpdateScrollBars(); 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir void SetDialog( ::com::sun::star::uno::Reference< 157*cdf0e10cSrcweir ::com::sun::star::container::XNameContainer > xUnoControlDialogModel ); 158*cdf0e10cSrcweir void ResetDialog( void ); 159*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > GetDialog() const 160*cdf0e10cSrcweir {return m_xUnoControlDialogModel;} 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > const & GetNumberFormatsSupplier(); 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir DlgEdModel* GetModel() const { return pDlgEdModel; } 165*cdf0e10cSrcweir DlgEdView* GetView() const { return pDlgEdView; } 166*cdf0e10cSrcweir DlgEdPage* GetPage() const { return pDlgEdPage; } 167*cdf0e10cSrcweir 168*cdf0e10cSrcweir void ShowDialog(); 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir sal_Bool UnmarkDialog(); 171*cdf0e10cSrcweir sal_Bool RemarkDialog(); 172*cdf0e10cSrcweir 173*cdf0e10cSrcweir void SetDialogModelChanged( sal_Bool bChanged = sal_True ) { bDialogModelChanged = bChanged; } 174*cdf0e10cSrcweir sal_Bool IsDialogModelChanged() const { return bDialogModelChanged; } 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir sal_Bool IsModified() const; 177*cdf0e10cSrcweir void ClearModifyFlag(); 178*cdf0e10cSrcweir 179*cdf0e10cSrcweir void MouseButtonDown( const MouseEvent& rMEvt ); 180*cdf0e10cSrcweir void MouseButtonUp( const MouseEvent& rMEvt ); 181*cdf0e10cSrcweir void MouseMove( const MouseEvent& rMEvt ); 182*cdf0e10cSrcweir void Paint( const Rectangle& rRect ); 183*cdf0e10cSrcweir sal_Bool KeyInput( const KeyEvent& rKEvt ); 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir void SetMode( DlgEdMode eMode ); 186*cdf0e10cSrcweir void SetInsertObj( sal_uInt16 eObj ); 187*cdf0e10cSrcweir sal_uInt16 GetInsertObj() const; 188*cdf0e10cSrcweir void CreateDefaultObject(); 189*cdf0e10cSrcweir DlgEdMode GetMode() const { return eMode; } 190*cdf0e10cSrcweir sal_Bool IsCreateOK() const { return bCreateOK; } 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir void Cut(); 193*cdf0e10cSrcweir void Copy(); 194*cdf0e10cSrcweir void Paste(); 195*cdf0e10cSrcweir void Delete(); 196*cdf0e10cSrcweir sal_Bool IsPasteAllowed(); 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir void ShowProperties(); 199*cdf0e10cSrcweir void UpdatePropertyBrowserDelayed(); 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir sal_Int32 countPages( Printer* pPrinter ); 202*cdf0e10cSrcweir void printPage( sal_Int32 nPage, Printer* pPrinter, const String& ); 203*cdf0e10cSrcweir 204*cdf0e10cSrcweir bool AdjustPageSize(); 205*cdf0e10cSrcweir 206*cdf0e10cSrcweir bool isInPaint() const { return mnPaintGuard > 0; } 207*cdf0e10cSrcweir }; 208*cdf0e10cSrcweir 209*cdf0e10cSrcweir #endif //_BASCTL_DLGED_HXX 210