Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "TableDesignHelpBar.hxx"
21 : #include <tools/debug.hxx>
22 : #include <svtools/svmedit.hxx>
23 : #include "dbaccess_helpid.hrc"
24 : #include <memory>
25 : using namespace dbaui;
26 : #define STANDARD_MARGIN 6
27 : //==================================================================
28 : // class OTableDesignHelpBar
29 : //==================================================================
30 : DBG_NAME(OTableDesignHelpBar)
31 : //------------------------------------------------------------------------------
32 0 : OTableDesignHelpBar::OTableDesignHelpBar( Window* pParent ) :
33 0 : TabPage( pParent, WB_3DLOOK )
34 : {
35 : DBG_CTOR(OTableDesignHelpBar,NULL);
36 0 : m_pTextWin = new MultiLineEdit( this, WB_VSCROLL | WB_LEFT | WB_BORDER | WB_NOTABSTOP | WB_READONLY);
37 0 : m_pTextWin->SetHelpId(HID_TABLE_DESIGN_HELP_WINDOW);
38 0 : m_pTextWin->SetReadOnly();
39 0 : m_pTextWin->SetControlBackground( GetSettings().GetStyleSettings().GetFaceColor() );
40 0 : m_pTextWin->Show();
41 0 : }
42 :
43 : //------------------------------------------------------------------------------
44 0 : OTableDesignHelpBar::~OTableDesignHelpBar()
45 : {
46 : DBG_DTOR(OTableDesignHelpBar,NULL);
47 0 : ::std::auto_ptr<Window> aTemp(m_pTextWin);
48 0 : m_pTextWin = NULL;
49 0 : }
50 :
51 : //------------------------------------------------------------------------------
52 0 : void OTableDesignHelpBar::SetHelpText( const String& rText )
53 : {
54 : DBG_CHKTHIS(OTableDesignHelpBar,NULL);
55 0 : if(m_pTextWin)
56 0 : m_pTextWin->SetText( rText );
57 0 : Invalidate();
58 0 : }
59 :
60 : //------------------------------------------------------------------------------
61 0 : void OTableDesignHelpBar::Resize()
62 : {
63 : DBG_CHKTHIS(OTableDesignHelpBar,NULL);
64 : //////////////////////////////////////////////////////////////////////
65 : // Abmessungen parent window
66 0 : Size aOutputSize( GetOutputSizePixel() );
67 :
68 : //////////////////////////////////////////////////////////////////////
69 : // TextWin anpassen
70 0 : if(m_pTextWin)
71 : m_pTextWin->SetPosSizePixel( Point(STANDARD_MARGIN+1, STANDARD_MARGIN+1),
72 0 : Size(aOutputSize.Width()-(2*STANDARD_MARGIN)-2,
73 0 : aOutputSize.Height()-(2*STANDARD_MARGIN)-2) );
74 :
75 0 : }
76 :
77 : //------------------------------------------------------------------------------
78 0 : long OTableDesignHelpBar::PreNotify( NotifyEvent& rNEvt )
79 : {
80 0 : if (rNEvt.GetType() == EVENT_LOSEFOCUS)
81 0 : SetHelpText(String());
82 0 : return TabPage::PreNotify(rNEvt);
83 : }
84 : // -----------------------------------------------------------------------------
85 0 : sal_Bool OTableDesignHelpBar::isCopyAllowed()
86 : {
87 0 : return m_pTextWin && m_pTextWin->GetSelected().Len();
88 : }
89 : // -----------------------------------------------------------------------------
90 0 : sal_Bool OTableDesignHelpBar::isCutAllowed()
91 : {
92 0 : return sal_False;
93 : }
94 : // -----------------------------------------------------------------------------
95 0 : sal_Bool OTableDesignHelpBar::isPasteAllowed()
96 : {
97 0 : return sal_False;
98 : }
99 : // -----------------------------------------------------------------------------
100 0 : void OTableDesignHelpBar::cut()
101 : {
102 0 : }
103 : // -----------------------------------------------------------------------------
104 0 : void OTableDesignHelpBar::copy()
105 : {
106 0 : if ( m_pTextWin )
107 0 : m_pTextWin->Copy();
108 0 : }
109 : // -----------------------------------------------------------------------------
110 0 : void OTableDesignHelpBar::paste()
111 : {
112 0 : }
113 :
114 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|