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 <vcl/settings.hxx>
24 : #include "dbaccess_helpid.hrc"
25 : #include <boost/scoped_ptr.hpp>
26 : using namespace dbaui;
27 : #define STANDARD_MARGIN 6
28 : // class OTableDesignHelpBar
29 0 : OTableDesignHelpBar::OTableDesignHelpBar( vcl::Window* pParent ) :
30 0 : TabPage( pParent, WB_3DLOOK )
31 : {
32 0 : m_pTextWin = VclPtr<MultiLineEdit>::Create( this, WB_VSCROLL | WB_LEFT | WB_BORDER | WB_NOTABSTOP | WB_READONLY);
33 0 : m_pTextWin->SetHelpId(HID_TABLE_DESIGN_HELP_WINDOW);
34 0 : m_pTextWin->SetReadOnly();
35 0 : m_pTextWin->SetControlBackground( GetSettings().GetStyleSettings().GetFaceColor() );
36 0 : m_pTextWin->Show();
37 0 : }
38 :
39 0 : OTableDesignHelpBar::~OTableDesignHelpBar()
40 : {
41 0 : disposeOnce();
42 0 : }
43 :
44 0 : void OTableDesignHelpBar::dispose()
45 : {
46 0 : m_pTextWin.disposeAndClear();
47 0 : TabPage::dispose();
48 0 : }
49 :
50 0 : void OTableDesignHelpBar::SetHelpText( const OUString& rText )
51 : {
52 0 : if(m_pTextWin)
53 0 : m_pTextWin->SetText( rText );
54 0 : Invalidate();
55 0 : }
56 :
57 0 : void OTableDesignHelpBar::Resize()
58 : {
59 : // Abmessungen parent window
60 0 : Size aOutputSize( GetOutputSizePixel() );
61 :
62 : // TextWin anpassen
63 0 : if(m_pTextWin)
64 0 : m_pTextWin->SetPosSizePixel( Point(STANDARD_MARGIN+1, STANDARD_MARGIN+1),
65 0 : Size(aOutputSize.Width()-(2*STANDARD_MARGIN)-2,
66 0 : aOutputSize.Height()-(2*STANDARD_MARGIN)-2) );
67 :
68 0 : }
69 :
70 0 : bool OTableDesignHelpBar::PreNotify( NotifyEvent& rNEvt )
71 : {
72 0 : if (rNEvt.GetType() == MouseNotifyEvent::LOSEFOCUS)
73 0 : SetHelpText(OUString());
74 0 : return TabPage::PreNotify(rNEvt);
75 : }
76 :
77 0 : bool OTableDesignHelpBar::isCopyAllowed()
78 : {
79 0 : return m_pTextWin && !m_pTextWin->GetSelected().isEmpty();
80 : }
81 :
82 0 : bool OTableDesignHelpBar::isCutAllowed()
83 : {
84 0 : return false;
85 : }
86 :
87 0 : bool OTableDesignHelpBar::isPasteAllowed()
88 : {
89 0 : return false;
90 : }
91 :
92 0 : void OTableDesignHelpBar::cut()
93 : {
94 0 : }
95 :
96 0 : void OTableDesignHelpBar::copy()
97 : {
98 0 : if ( m_pTextWin )
99 0 : m_pTextWin->Copy();
100 0 : }
101 :
102 0 : void OTableDesignHelpBar::paste()
103 : {
104 36 : }
105 :
106 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|