merge the formfield patch from ooo-build
[ooovba.git] / dbaccess / source / ui / tabledesign / TableDesignHelpBar.cxx
blob96f2df733afe77d3467c2aa1abee1d5548f3551e
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: TableDesignHelpBar.cxx,v $
10 * $Revision: 1.9 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_dbaccess.hxx"
33 #ifndef DBAUI_TABLEDESIGNHELPBAR_HXX
34 #include "TableDesignHelpBar.hxx"
35 #endif
36 #ifndef _TOOLS_DEBUG_HXX
37 #include <tools/debug.hxx>
38 #endif
39 #ifndef _SVEDIT_HXX
40 #include <svtools/svmedit.hxx>
41 #endif
42 #ifndef _DBA_DBACCESS_HELPID_HRC_
43 #include "dbaccess_helpid.hrc"
44 #endif
45 #include <memory>
46 using namespace dbaui;
47 #define STANDARD_MARGIN 6
48 //==================================================================
49 // class OTableDesignHelpBar
50 //==================================================================
51 DBG_NAME(OTableDesignHelpBar)
52 //------------------------------------------------------------------------------
53 OTableDesignHelpBar::OTableDesignHelpBar( Window* pParent ) :
54 TabPage( pParent, WB_3DLOOK )
56 DBG_CTOR(OTableDesignHelpBar,NULL);
57 m_pTextWin = new MultiLineEdit( this, WB_VSCROLL | WB_LEFT | WB_BORDER | WB_NOTABSTOP | WB_READONLY);
58 m_pTextWin->SetHelpId(HID_TABLE_DESIGN_HELP_WINDOW);
59 m_pTextWin->SetReadOnly();
60 m_pTextWin->SetControlBackground( GetSettings().GetStyleSettings().GetFaceColor() );
61 m_pTextWin->Show();
64 //------------------------------------------------------------------------------
65 OTableDesignHelpBar::~OTableDesignHelpBar()
67 DBG_DTOR(OTableDesignHelpBar,NULL);
68 ::std::auto_ptr<Window> aTemp(m_pTextWin);
69 m_pTextWin = NULL;
72 //------------------------------------------------------------------------------
73 void OTableDesignHelpBar::SetHelpText( const String& rText )
75 DBG_CHKTHIS(OTableDesignHelpBar,NULL);
76 if(m_pTextWin)
77 m_pTextWin->SetText( rText );
78 Invalidate();
81 //------------------------------------------------------------------------------
82 void OTableDesignHelpBar::Resize()
84 DBG_CHKTHIS(OTableDesignHelpBar,NULL);
85 //////////////////////////////////////////////////////////////////////
86 // Abmessungen parent window
87 Size aOutputSize( GetOutputSizePixel() );
89 //////////////////////////////////////////////////////////////////////
90 // TextWin anpassen
91 if(m_pTextWin)
92 m_pTextWin->SetPosSizePixel( Point(STANDARD_MARGIN+1, STANDARD_MARGIN+1),
93 Size(aOutputSize.Width()-(2*STANDARD_MARGIN)-2,
94 aOutputSize.Height()-(2*STANDARD_MARGIN)-2) );
98 //------------------------------------------------------------------------------
99 long OTableDesignHelpBar::PreNotify( NotifyEvent& rNEvt )
101 if (rNEvt.GetType() == EVENT_LOSEFOCUS)
102 SetHelpText(String());
103 return TabPage::PreNotify(rNEvt);
105 // -----------------------------------------------------------------------------
106 sal_Bool OTableDesignHelpBar::isCopyAllowed()
108 return m_pTextWin && m_pTextWin->GetSelected().Len();
110 // -----------------------------------------------------------------------------
111 sal_Bool OTableDesignHelpBar::isCutAllowed()
113 return sal_False;
115 // -----------------------------------------------------------------------------
116 sal_Bool OTableDesignHelpBar::isPasteAllowed()
118 return sal_False;
120 // -----------------------------------------------------------------------------
121 void OTableDesignHelpBar::cut()
124 // -----------------------------------------------------------------------------
125 void OTableDesignHelpBar::copy()
127 if ( m_pTextWin )
128 m_pTextWin->Copy();
130 // -----------------------------------------------------------------------------
131 void OTableDesignHelpBar::paste()