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