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 #ifndef DBAUI_TABLEDESIGNVIEW_HXX 28 #define DBAUI_TABLEDESIGNVIEW_HXX 29 30 #ifndef DBAUI_DATAVIEW_HXX 31 #include "dataview.hxx" 32 #endif 33 #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ 34 #include <com/sun/star/beans/XPropertySet.hpp> 35 #endif 36 #ifndef _COM_SUN_STAR_FRAME_XCONTROLLER_HPP_ 37 #include <com/sun/star/frame/XController.hpp> 38 #endif 39 #ifndef _SV_SPLIT_HXX 40 #include <vcl/split.hxx> 41 #endif 42 #ifndef DBACCESS_TABLEDESIGN_ICLIPBOARDTEST_HXX 43 #include "IClipBoardTest.hxx" 44 #endif 45 46 namespace dbaui 47 { 48 class OTableController; 49 class OTableFieldDescWin; 50 class OTableEditorCtrl; 51 //================================================================== 52 class OTableBorderWindow : public Window 53 { 54 Splitter m_aHorzSplitter; 55 OTableFieldDescWin* m_pFieldDescWin; 56 OTableEditorCtrl* m_pEditorCtrl; 57 58 void ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground ); 59 void ArrangeChilds( long nSplitPos ,Rectangle& rRect); 60 DECL_LINK( SplitHdl, Splitter* ); 61 protected: 62 virtual void DataChanged(const DataChangedEvent& rDCEvt); 63 public: 64 OTableBorderWindow(Window* pParent); 65 ~OTableBorderWindow(); 66 // window overloads 67 virtual void Resize(); 68 virtual void GetFocus(); 69 70 OTableEditorCtrl* GetEditorCtrl() const { return m_pEditorCtrl; } 71 OTableFieldDescWin* GetDescWin() const { return m_pFieldDescWin; } 72 }; 73 //================================================================== 74 class OTableDesignView : public ODataView 75 ,public IClipboardTest 76 { 77 enum ChildFocusState 78 { 79 DESCRIPTION, 80 EDITOR, 81 NONE 82 }; 83 private: 84 ::com::sun::star::lang::Locale m_aLocale; 85 OTableBorderWindow* m_pWin; 86 OTableController& m_rController; 87 ChildFocusState m_eChildFocus; 88 89 IClipboardTest* getActiveChild() const; 90 protected: 91 92 93 // return the Rectangle where I can paint myself 94 virtual void resizeDocumentView(Rectangle& rRect); 95 96 public: 97 OTableDesignView( Window* pParent, 98 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&, 99 OTableController& _rController); 100 virtual ~OTableDesignView(); 101 102 // window overloads 103 virtual long PreNotify( NotifyEvent& rNEvt ); 104 virtual void GetFocus(); 105 106 OTableEditorCtrl* GetEditorCtrl() const { return m_pWin ? m_pWin->GetEditorCtrl() : NULL; } 107 OTableFieldDescWin* GetDescWin() const { return m_pWin ? m_pWin->GetDescWin() : NULL; } 108 OTableController& getController() const { return m_rController; } 109 110 ::com::sun::star::lang::Locale getLocale() const { return m_aLocale;} 111 112 // IClipboardTest 113 virtual sal_Bool isCutAllowed(); 114 virtual sal_Bool isCopyAllowed(); 115 virtual sal_Bool isPasteAllowed(); 116 virtual sal_Bool hasChildPathFocus() { return HasChildPathFocus(); } 117 virtual void copy(); 118 virtual void cut(); 119 virtual void paste(); 120 121 // set the view readonly or not 122 virtual void setReadOnly(sal_Bool _bReadOnly); 123 124 virtual void initialize(); 125 void reSync(); // resync window data with realdata 126 127 DECL_LINK( SwitchHdl, Accelerator* ); 128 }; 129 } 130 #endif // DBAUI_TABLEDESIGNVIEW_HXX 131 132