Gtk-WARNING gtktreestore.c:1047: Invalid column number 1 added to iter
[LibreOffice.git] / dbaccess / source / ui / inc / TableDesignView.hxx
blob077eb211e3b47fd908d1459a941c08eb3a557b89
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #pragma once
21 #include <dbaccess/dataview.hxx>
22 #include <com/sun/star/lang/Locale.hpp>
23 #include <vcl/InterimItemWindow.hxx>
24 #include <vcl/weld.hxx>
25 #include "IClipBoardTest.hxx"
27 namespace dbaui
29 class OTableController;
30 class OTableDesignView;
31 class OTableFieldDescWin;
32 class OTableEditorCtrl;
34 class OTableBorderWindow final : public InterimItemWindow
36 std::unique_ptr<weld::Paned> m_xHorzSplitter;
37 std::unique_ptr<weld::Container> m_xEditorParent;
38 css::uno::Reference<css::awt::XWindow> m_xEditorParentWin;
39 VclPtr<OTableEditorCtrl> m_xEditorCtrl;
40 std::unique_ptr<weld::Container> m_xFieldDescParent;
41 std::unique_ptr<OTableFieldDescWin> m_xFieldDescWin;
43 public:
44 OTableBorderWindow(OTableDesignView* pParent);
45 virtual ~OTableBorderWindow() override;
46 // Window overrides
47 virtual void dispose() override;
49 virtual void GetFocus() override;
50 virtual void Layout() override;
52 OTableEditorCtrl* GetEditorCtrl() const { return m_xEditorCtrl.get(); }
53 OTableFieldDescWin* GetDescWin() const { return m_xFieldDescWin.get(); }
56 class OTableDesignView : public ODataView
57 , public IClipboardTest
59 enum ChildFocusState
61 DESCRIPTION,
62 EDITOR,
63 NONE
65 private:
66 css::lang::Locale m_aLocale;
67 VclPtr<OTableBorderWindow> m_pWin;
68 OTableController& m_rController;
69 ChildFocusState m_eChildFocus;
71 IClipboardTest* getActiveChild() const;
73 DECL_LINK( FieldDescFocusIn, weld::Widget&, void );
74 protected:
76 // return the Rectangle where I can paint myself
77 virtual void resizeDocumentView(tools::Rectangle& rRect) override;
79 public:
80 OTableDesignView( vcl::Window* pParent,
81 const css::uno::Reference< css::uno::XComponentContext >&,
82 OTableController& _rController);
83 virtual ~OTableDesignView() override;
84 virtual void dispose() override;
86 // Window overrides
87 virtual bool PreNotify( NotifyEvent& rNEvt ) override;
88 virtual void GetFocus() override;
90 OTableEditorCtrl* GetEditorCtrl() const { return m_pWin ? m_pWin->GetEditorCtrl() : nullptr; }
91 OTableFieldDescWin* GetDescWin() const { return m_pWin ? m_pWin->GetDescWin() : nullptr; }
92 OTableController& getController() const { return m_rController; }
94 const css::lang::Locale& getLocale() const { return m_aLocale;}
96 // IClipboardTest
97 virtual bool isCutAllowed() override;
98 virtual bool isCopyAllowed() override;
99 virtual bool isPasteAllowed() override;
100 virtual void copy() override;
101 virtual void cut() override;
102 virtual void paste() override;
104 // set the view readonly or not
105 void setReadOnly(bool _bReadOnly);
107 virtual void initialize() override;
108 void reSync(); // resync window data with realdata
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */