1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_dbaccess.hxx"
26 #ifndef DBAUI_TABLEDESIGNHELPBAR_HXX
27 #include "TableDesignHelpBar.hxx"
28 #endif
29 #ifndef _TOOLS_DEBUG_HXX
30 #include <tools/debug.hxx>
31 #endif
32 #ifndef _SVEDIT_HXX
33 #include <svtools/svmedit.hxx>
34 #endif
35 #ifndef _DBA_DBACCESS_HELPID_HRC_
36 #include "dbaccess_helpid.hrc"
37 #endif
38 #include <memory>
39 using namespace dbaui;
40 #define STANDARD_MARGIN 6
41 //==================================================================
42 // class OTableDesignHelpBar
43 //==================================================================
DBG_NAME(OTableDesignHelpBar)44 DBG_NAME(OTableDesignHelpBar)
45 //------------------------------------------------------------------------------
46 OTableDesignHelpBar::OTableDesignHelpBar( Window* pParent ) :
47 TabPage( pParent, WB_3DLOOK )
48 {
49 DBG_CTOR(OTableDesignHelpBar,NULL);
50 m_pTextWin = new MultiLineEdit( this, WB_VSCROLL | WB_LEFT | WB_BORDER | WB_NOTABSTOP | WB_READONLY);
51 m_pTextWin->SetHelpId(HID_TABLE_DESIGN_HELP_WINDOW);
52 m_pTextWin->SetReadOnly();
53 m_pTextWin->SetControlBackground( GetSettings().GetStyleSettings().GetFaceColor() );
54 m_pTextWin->Show();
55 }
56
57 //------------------------------------------------------------------------------
~OTableDesignHelpBar()58 OTableDesignHelpBar::~OTableDesignHelpBar()
59 {
60 DBG_DTOR(OTableDesignHelpBar,NULL);
61 ::std::auto_ptr<Window> aTemp(m_pTextWin);
62 m_pTextWin = NULL;
63 }
64
65 //------------------------------------------------------------------------------
SetHelpText(const String & rText)66 void OTableDesignHelpBar::SetHelpText( const String& rText )
67 {
68 DBG_CHKTHIS(OTableDesignHelpBar,NULL);
69 if(m_pTextWin)
70 m_pTextWin->SetText( rText );
71 Invalidate();
72 }
73
74 //------------------------------------------------------------------------------
Resize()75 void OTableDesignHelpBar::Resize()
76 {
77 DBG_CHKTHIS(OTableDesignHelpBar,NULL);
78 //////////////////////////////////////////////////////////////////////
79 // Abmessungen parent window
80 Size aOutputSize( GetOutputSizePixel() );
81
82 //////////////////////////////////////////////////////////////////////
83 // TextWin anpassen
84 if(m_pTextWin)
85 m_pTextWin->SetPosSizePixel( Point(STANDARD_MARGIN+1, STANDARD_MARGIN+1),
86 Size(aOutputSize.Width()-(2*STANDARD_MARGIN)-2,
87 aOutputSize.Height()-(2*STANDARD_MARGIN)-2) );
88
89 }
90
91 //------------------------------------------------------------------------------
PreNotify(NotifyEvent & rNEvt)92 long OTableDesignHelpBar::PreNotify( NotifyEvent& rNEvt )
93 {
94 if (rNEvt.GetType() == EVENT_LOSEFOCUS)
95 SetHelpText(String());
96 return TabPage::PreNotify(rNEvt);
97 }
98 // -----------------------------------------------------------------------------
isCopyAllowed()99 sal_Bool OTableDesignHelpBar::isCopyAllowed()
100 {
101 return m_pTextWin && m_pTextWin->GetSelected().Len();
102 }
103 // -----------------------------------------------------------------------------
isCutAllowed()104 sal_Bool OTableDesignHelpBar::isCutAllowed()
105 {
106 return sal_False;
107 }
108 // -----------------------------------------------------------------------------
isPasteAllowed()109 sal_Bool OTableDesignHelpBar::isPasteAllowed()
110 {
111 return sal_False;
112 }
113 // -----------------------------------------------------------------------------
cut()114 void OTableDesignHelpBar::cut()
115 {
116 }
117 // -----------------------------------------------------------------------------
copy()118 void OTableDesignHelpBar::copy()
119 {
120 if ( m_pTextWin )
121 m_pTextWin->Copy();
122 }
123 // -----------------------------------------------------------------------------
paste()124 void OTableDesignHelpBar::paste()
125 {
126 }
127