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 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_dbaccess.hxx" 30 #ifndef DBAUI_TABLEDESIGNHELPBAR_HXX 31 #include "TableDesignHelpBar.hxx" 32 #endif 33 #ifndef _TOOLS_DEBUG_HXX 34 #include <tools/debug.hxx> 35 #endif 36 #ifndef _SVEDIT_HXX 37 #include <svtools/svmedit.hxx> 38 #endif 39 #ifndef _DBA_DBACCESS_HELPID_HRC_ 40 #include "dbaccess_helpid.hrc" 41 #endif 42 #include <memory> 43 using namespace dbaui; 44 #define STANDARD_MARGIN 6 45 //================================================================== 46 // class OTableDesignHelpBar 47 //================================================================== 48 DBG_NAME(OTableDesignHelpBar) 49 //------------------------------------------------------------------------------ 50 OTableDesignHelpBar::OTableDesignHelpBar( Window* pParent ) : 51 TabPage( pParent, WB_3DLOOK ) 52 { 53 DBG_CTOR(OTableDesignHelpBar,NULL); 54 m_pTextWin = new MultiLineEdit( this, WB_VSCROLL | WB_LEFT | WB_BORDER | WB_NOTABSTOP | WB_READONLY); 55 m_pTextWin->SetHelpId(HID_TABLE_DESIGN_HELP_WINDOW); 56 m_pTextWin->SetReadOnly(); 57 m_pTextWin->SetControlBackground( GetSettings().GetStyleSettings().GetFaceColor() ); 58 m_pTextWin->Show(); 59 } 60 61 //------------------------------------------------------------------------------ 62 OTableDesignHelpBar::~OTableDesignHelpBar() 63 { 64 DBG_DTOR(OTableDesignHelpBar,NULL); 65 ::std::auto_ptr<Window> aTemp(m_pTextWin); 66 m_pTextWin = NULL; 67 } 68 69 //------------------------------------------------------------------------------ 70 void OTableDesignHelpBar::SetHelpText( const String& rText ) 71 { 72 DBG_CHKTHIS(OTableDesignHelpBar,NULL); 73 if(m_pTextWin) 74 m_pTextWin->SetText( rText ); 75 Invalidate(); 76 } 77 78 //------------------------------------------------------------------------------ 79 void OTableDesignHelpBar::Resize() 80 { 81 DBG_CHKTHIS(OTableDesignHelpBar,NULL); 82 ////////////////////////////////////////////////////////////////////// 83 // Abmessungen parent window 84 Size aOutputSize( GetOutputSizePixel() ); 85 86 ////////////////////////////////////////////////////////////////////// 87 // TextWin anpassen 88 if(m_pTextWin) 89 m_pTextWin->SetPosSizePixel( Point(STANDARD_MARGIN+1, STANDARD_MARGIN+1), 90 Size(aOutputSize.Width()-(2*STANDARD_MARGIN)-2, 91 aOutputSize.Height()-(2*STANDARD_MARGIN)-2) ); 92 93 } 94 95 //------------------------------------------------------------------------------ 96 long OTableDesignHelpBar::PreNotify( NotifyEvent& rNEvt ) 97 { 98 if (rNEvt.GetType() == EVENT_LOSEFOCUS) 99 SetHelpText(String()); 100 return TabPage::PreNotify(rNEvt); 101 } 102 // ----------------------------------------------------------------------------- 103 sal_Bool OTableDesignHelpBar::isCopyAllowed() 104 { 105 return m_pTextWin && m_pTextWin->GetSelected().Len(); 106 } 107 // ----------------------------------------------------------------------------- 108 sal_Bool OTableDesignHelpBar::isCutAllowed() 109 { 110 return sal_False; 111 } 112 // ----------------------------------------------------------------------------- 113 sal_Bool OTableDesignHelpBar::isPasteAllowed() 114 { 115 return sal_False; 116 } 117 // ----------------------------------------------------------------------------- 118 void OTableDesignHelpBar::cut() 119 { 120 } 121 // ----------------------------------------------------------------------------- 122 void OTableDesignHelpBar::copy() 123 { 124 if ( m_pTextWin ) 125 m_pTextWin->Copy(); 126 } 127 // ----------------------------------------------------------------------------- 128 void OTableDesignHelpBar::paste() 129 { 130 } 131