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 <helpids.h>
22 
23 using namespace dbaui;
24 
25 #define DETAILS_MIN_HELP_WIDTH 200
26 
OTableDesignHelpBar(std::unique_ptr<weld::TextView> xTextWin)27 OTableDesignHelpBar::OTableDesignHelpBar(std::unique_ptr<weld::TextView> xTextWin)
28     : m_xTextWin(std::move(xTextWin))
29 {
30     m_xTextWin->set_size_request(DETAILS_MIN_HELP_WIDTH, -1);
31     m_xTextWin->set_help_id(HID_TAB_DESIGN_HELP_TEXT_FRAME);
32 }
33 
SetHelpText(const OUString & rText)34 void OTableDesignHelpBar::SetHelpText(const OUString& rText)
35 {
36     if (!m_xTextWin)
37         return;
38     m_xTextWin->set_text(rText);
39 }
40 
isCopyAllowed()41 bool OTableDesignHelpBar::isCopyAllowed()
42 {
43     int mStartPos, nEndPos;
44     return m_xTextWin && m_xTextWin->get_selection_bounds(mStartPos, nEndPos);
45 }
46 
isCutAllowed()47 bool OTableDesignHelpBar::isCutAllowed() { return false; }
48 
isPasteAllowed()49 bool OTableDesignHelpBar::isPasteAllowed() { return false; }
50 
cut()51 void OTableDesignHelpBar::cut() {}
52 
copy()53 void OTableDesignHelpBar::copy()
54 {
55     if (!m_xTextWin)
56         return;
57     m_xTextWin->copy_clipboard();
58 }
59 
paste()60 void OTableDesignHelpBar::paste() {}
61 
62 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
63