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 = new MultiLineEdit( 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 : boost::scoped_ptr<vcl::Window> aTemp(m_pTextWin);
42 0 : m_pTextWin = NULL;
43 0 : }
44 :
45 0 : void OTableDesignHelpBar::SetHelpText( const OUString& rText )
46 : {
47 0 : if(m_pTextWin)
48 0 : m_pTextWin->SetText( rText );
49 0 : Invalidate();
50 0 : }
51 :
52 0 : void OTableDesignHelpBar::Resize()
53 : {
54 : // Abmessungen parent window
55 0 : Size aOutputSize( GetOutputSizePixel() );
56 :
57 : // TextWin anpassen
58 0 : if(m_pTextWin)
59 : m_pTextWin->SetPosSizePixel( Point(STANDARD_MARGIN+1, STANDARD_MARGIN+1),
60 0 : Size(aOutputSize.Width()-(2*STANDARD_MARGIN)-2,
61 0 : aOutputSize.Height()-(2*STANDARD_MARGIN)-2) );
62 :
63 0 : }
64 :
65 0 : bool OTableDesignHelpBar::PreNotify( NotifyEvent& rNEvt )
66 : {
67 0 : if (rNEvt.GetType() == EVENT_LOSEFOCUS)
68 0 : SetHelpText(OUString());
69 0 : return TabPage::PreNotify(rNEvt);
70 : }
71 :
72 0 : bool OTableDesignHelpBar::isCopyAllowed()
73 : {
74 0 : return m_pTextWin && !m_pTextWin->GetSelected().isEmpty();
75 : }
76 :
77 0 : bool OTableDesignHelpBar::isCutAllowed()
78 : {
79 0 : return false;
80 : }
81 :
82 0 : bool OTableDesignHelpBar::isPasteAllowed()
83 : {
84 0 : return false;
85 : }
86 :
87 0 : void OTableDesignHelpBar::cut()
88 : {
89 0 : }
90 :
91 0 : void OTableDesignHelpBar::copy()
92 : {
93 0 : if ( m_pTextWin )
94 0 : m_pTextWin->Copy();
95 0 : }
96 :
97 0 : void OTableDesignHelpBar::paste()
98 : {
99 72 : }
100 :
101 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|