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 : #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEDESIGNVIEW_HXX
20 : #define INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEDESIGNVIEW_HXX
21 :
22 : #include <dbaccess/dataview.hxx>
23 : #include <com/sun/star/beans/XPropertySet.hpp>
24 : #include <com/sun/star/frame/XController.hpp>
25 : #include <vcl/split.hxx>
26 : #include "IClipBoardTest.hxx"
27 :
28 : namespace dbaui
29 : {
30 : class OTableController;
31 : class OTableFieldDescWin;
32 : class OTableEditorCtrl;
33 : class OTableBorderWindow : public vcl::Window
34 : {
35 : VclPtr<Splitter> m_aHorzSplitter;
36 : VclPtr<OTableFieldDescWin> m_pFieldDescWin;
37 : VclPtr<OTableEditorCtrl> m_pEditorCtrl;
38 :
39 : void ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
40 : void ArrangeChildren( long nSplitPos ,Rectangle& rRect);
41 : DECL_LINK( SplitHdl, Splitter* );
42 : protected:
43 : virtual void DataChanged(const DataChangedEvent& rDCEvt) SAL_OVERRIDE;
44 : public:
45 : OTableBorderWindow(vcl::Window* pParent);
46 : virtual ~OTableBorderWindow();
47 : // Window overrides
48 : virtual void dispose() SAL_OVERRIDE;
49 : virtual void Resize() SAL_OVERRIDE;
50 : virtual void GetFocus() SAL_OVERRIDE;
51 :
52 0 : OTableEditorCtrl* GetEditorCtrl() const { return m_pEditorCtrl; }
53 0 : OTableFieldDescWin* GetDescWin() const { return m_pFieldDescWin; }
54 : };
55 : class OTableDesignView : public ODataView
56 : ,public IClipboardTest
57 : {
58 : enum ChildFocusState
59 : {
60 : DESCRIPTION,
61 : EDITOR,
62 : NONE
63 : };
64 : private:
65 : ::com::sun::star::lang::Locale m_aLocale;
66 : VclPtr<OTableBorderWindow> m_pWin;
67 : OTableController& m_rController;
68 : ChildFocusState m_eChildFocus;
69 :
70 : IClipboardTest* getActiveChild() const;
71 : protected:
72 :
73 : // return the Rectangle where I can paint myself
74 : virtual void resizeDocumentView(Rectangle& rRect) SAL_OVERRIDE;
75 :
76 : public:
77 : OTableDesignView( vcl::Window* pParent,
78 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&,
79 : OTableController& _rController);
80 : virtual ~OTableDesignView();
81 : virtual void dispose() SAL_OVERRIDE;
82 :
83 : // Window overrides
84 : virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
85 : virtual void GetFocus() SAL_OVERRIDE;
86 :
87 0 : OTableEditorCtrl* GetEditorCtrl() const { return m_pWin ? m_pWin->GetEditorCtrl() : NULL; }
88 0 : OTableFieldDescWin* GetDescWin() const { return m_pWin ? m_pWin->GetDescWin() : NULL; }
89 0 : OTableController& getController() const { return m_rController; }
90 :
91 0 : ::com::sun::star::lang::Locale getLocale() const { return m_aLocale;}
92 :
93 : // IClipboardTest
94 : virtual bool isCutAllowed() SAL_OVERRIDE;
95 : virtual bool isCopyAllowed() SAL_OVERRIDE;
96 : virtual bool isPasteAllowed() SAL_OVERRIDE;
97 0 : virtual bool hasChildPathFocus() SAL_OVERRIDE { return HasChildPathFocus(); }
98 : virtual void copy() SAL_OVERRIDE;
99 : virtual void cut() SAL_OVERRIDE;
100 : virtual void paste() SAL_OVERRIDE;
101 :
102 : // set the view readonly or not
103 : void setReadOnly(bool _bReadOnly);
104 :
105 : virtual void initialize() SAL_OVERRIDE;
106 : void reSync(); // resync window data with realdata
107 : };
108 : }
109 : #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEDESIGNVIEW_HXX
110 :
111 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|