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 : Splitter m_aHorzSplitter;
36 : OTableFieldDescWin* m_pFieldDescWin;
37 : 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 overloads
48 : virtual void Resize() SAL_OVERRIDE;
49 : virtual void GetFocus() SAL_OVERRIDE;
50 :
51 0 : OTableEditorCtrl* GetEditorCtrl() const { return m_pEditorCtrl; }
52 0 : OTableFieldDescWin* GetDescWin() const { return m_pFieldDescWin; }
53 : };
54 : class OTableDesignView : public ODataView
55 : ,public IClipboardTest
56 : {
57 : enum ChildFocusState
58 : {
59 : DESCRIPTION,
60 : EDITOR,
61 : NONE
62 : };
63 : private:
64 : ::com::sun::star::lang::Locale m_aLocale;
65 : OTableBorderWindow* m_pWin;
66 : OTableController& m_rController;
67 : ChildFocusState m_eChildFocus;
68 :
69 : IClipboardTest* getActiveChild() const;
70 : protected:
71 :
72 : // return the Rectangle where I can paint myself
73 : virtual void resizeDocumentView(Rectangle& rRect) SAL_OVERRIDE;
74 :
75 : public:
76 : OTableDesignView( vcl::Window* pParent,
77 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&,
78 : OTableController& _rController);
79 : virtual ~OTableDesignView();
80 :
81 : // window overloads
82 : virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
83 : virtual void GetFocus() SAL_OVERRIDE;
84 :
85 0 : OTableEditorCtrl* GetEditorCtrl() const { return m_pWin ? m_pWin->GetEditorCtrl() : NULL; }
86 0 : OTableFieldDescWin* GetDescWin() const { return m_pWin ? m_pWin->GetDescWin() : NULL; }
87 0 : OTableController& getController() const { return m_rController; }
88 :
89 0 : ::com::sun::star::lang::Locale getLocale() const { return m_aLocale;}
90 :
91 : // IClipboardTest
92 : virtual bool isCutAllowed() SAL_OVERRIDE;
93 : virtual bool isCopyAllowed() SAL_OVERRIDE;
94 : virtual bool isPasteAllowed() SAL_OVERRIDE;
95 0 : virtual bool hasChildPathFocus() SAL_OVERRIDE { return HasChildPathFocus(); }
96 : virtual void copy() SAL_OVERRIDE;
97 : virtual void cut() SAL_OVERRIDE;
98 : virtual void paste() SAL_OVERRIDE;
99 :
100 : // set the view readonly or not
101 : virtual void setReadOnly(bool _bReadOnly);
102 :
103 : virtual void initialize() SAL_OVERRIDE;
104 : void reSync(); // resync window data with realdata
105 : };
106 : }
107 : #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_TABLEDESIGNVIEW_HXX
108 :
109 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|