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 : #ifndef INCLUDED_BASCTL_SOURCE_INC_DLGED_HXX
21 : #define INCLUDED_BASCTL_SOURCE_INC_DLGED_HXX
22 :
23 : #include <com/sun/star/awt/XControlContainer.hpp>
24 : #include <com/sun/star/container/XNameContainer.hpp>
25 : #include <com/sun/star/datatransfer/DataFlavor.hpp>
26 : #include <com/sun/star/frame/XModel.hpp>
27 : #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
28 : #include <svl/SfxBroadcaster.hxx>
29 : #include <svl/hint.hxx>
30 : #include <tools/gen.hxx>
31 : #include <vcl/timer.hxx>
32 : #include <vcl/idle.hxx>
33 : #include <vcl/vclptr.hxx>
34 : #include <vcl/window.hxx>
35 :
36 : #include <boost/scoped_ptr.hpp>
37 :
38 : class ScrollBar;
39 : class Printer;
40 : class KeyEvent;
41 : class MouseEvent;
42 : class Timer;
43 : namespace vcl { class Window; }
44 :
45 : namespace basctl
46 : {
47 :
48 : class DialogWindowLayout;
49 :
50 : #define DLGED_PAGE_WIDTH_MIN 1280
51 : #define DLGED_PAGE_HEIGHT_MIN 1024
52 :
53 :
54 : // DlgEdHint
55 :
56 :
57 : class DlgEdObj;
58 :
59 : class DlgEdHint: public SfxHint
60 : {
61 : public:
62 : enum Kind {
63 : UNKNOWN,
64 : WINDOWSCROLLED,
65 : LAYERCHANGED,
66 : OBJORDERCHANGED,
67 : SELECTIONCHANGED,
68 : };
69 :
70 : private:
71 : Kind eKind;
72 : DlgEdObj* pDlgEdObj;
73 :
74 : public:
75 : DlgEdHint (Kind);
76 : DlgEdHint (Kind, DlgEdObj* pObj);
77 : virtual ~DlgEdHint();
78 :
79 0 : Kind GetKind() const { return eKind; }
80 0 : DlgEdObj* GetObject() const { return pDlgEdObj; }
81 : };
82 :
83 :
84 :
85 : // DlgEditor
86 :
87 :
88 : class DlgEdModel;
89 : class DlgEdPage;
90 : class DlgEdView;
91 : class DlgEdForm;
92 : class DlgEdFactory;
93 : class DlgEdFunc;
94 :
95 : class DlgEditor: public SfxBroadcaster
96 : {
97 : public:
98 : enum Mode {
99 : INSERT,
100 : SELECT,
101 : TEST,
102 : READONLY,
103 : };
104 :
105 : private:
106 : DECL_LINK_TYPED(MarkTimeout, Idle *, void);
107 :
108 : static void Print( Printer* pPrinter, const OUString& rTitle );
109 :
110 : private:
111 : VclPtr<ScrollBar> pHScroll;
112 : VclPtr<ScrollBar> pVScroll;
113 : boost::scoped_ptr<DlgEdModel> pDlgEdModel; // never nullptr
114 : DlgEdPage* pDlgEdPage; // never nullptr
115 : boost::scoped_ptr<DlgEdView> pDlgEdView; // never nullptr
116 : DlgEdForm* pDlgEdForm; // never nullptr
117 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > m_xUnoControlDialogModel;
118 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > m_xControlContainer;
119 : ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > m_ClipboardDataFlavors;
120 : ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > m_ClipboardDataFlavorsResource;
121 : ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > m_xSupplier;
122 : boost::scoped_ptr<DlgEdFactory> pObjFac; // never nullptr
123 : vcl::Window& rWindow; // DialogWindow
124 : boost::scoped_ptr<DlgEdFunc> pFunc;
125 : DialogWindowLayout& rLayout;
126 : Mode eMode;
127 : sal_uInt16 eActObj;
128 : bool bFirstDraw;
129 : Size aGridSize;
130 : bool bGridVisible;
131 : bool bGridSnap;
132 : bool bCreateOK;
133 : Rectangle aPaintRect;
134 : bool bDialogModelChanged;
135 : Idle aMarkIdle;
136 : long mnPaintGuard;
137 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xDocument;
138 :
139 : public:
140 : DlgEditor (
141 : vcl::Window&, DialogWindowLayout&,
142 : com::sun::star::uno::Reference<com::sun::star::frame::XModel> const& xModel,
143 : com::sun::star::uno::Reference<com::sun::star::container::XNameContainer> xDialogModel
144 : );
145 : virtual ~DlgEditor();
146 :
147 0 : vcl::Window& GetWindow() const { return rWindow; }
148 :
149 : /** returns the control container associated with our window
150 : @see GetWindow
151 : @see SetWindow
152 : */
153 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >
154 : GetWindowControlContainer();
155 :
156 : void SetScrollBars( ScrollBar* pHScroll, ScrollBar* pVScroll );
157 : void InitScrollBars();
158 0 : ScrollBar* GetHScroll() const { return pHScroll; }
159 0 : ScrollBar* GetVScroll() const { return pVScroll; }
160 : void DoScroll( ScrollBar* pActScroll );
161 : void UpdateScrollBars();
162 :
163 : void SetDialog (com::sun::star::uno::Reference<com::sun::star::container::XNameContainer> xUnoControlDialogModel);
164 : void ResetDialog ();
165 0 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > GetDialog() const
166 0 : {return m_xUnoControlDialogModel;}
167 :
168 : ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > const & GetNumberFormatsSupplier();
169 :
170 0 : DlgEdModel& GetModel() const { return *pDlgEdModel; }
171 0 : DlgEdView& GetView() const { return *pDlgEdView; }
172 0 : DlgEdPage& GetPage() const { return *pDlgEdPage; }
173 :
174 : void ShowDialog();
175 :
176 : bool UnmarkDialog();
177 : bool RemarkDialog();
178 :
179 0 : void SetDialogModelChanged (bool bChanged = true) { bDialogModelChanged = bChanged; }
180 : bool IsDialogModelChanged () const { return bDialogModelChanged; }
181 :
182 : bool IsModified () const;
183 : void ClearModifyFlag();
184 :
185 : void MouseButtonDown( const MouseEvent& rMEvt );
186 : void MouseButtonUp( const MouseEvent& rMEvt );
187 : void MouseMove( const MouseEvent& rMEvt );
188 : void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect);
189 : bool KeyInput( const KeyEvent& rKEvt );
190 :
191 : void SetMode (Mode eMode);
192 : void SetInsertObj( sal_uInt16 eObj );
193 0 : sal_uInt16 GetInsertObj() const { return eActObj;}
194 : void CreateDefaultObject();
195 0 : Mode GetMode() const { return eMode; }
196 0 : bool IsCreateOK() const { return bCreateOK; }
197 :
198 : void Cut();
199 : void Copy();
200 : void Paste();
201 : void Delete();
202 : bool IsPasteAllowed();
203 :
204 : void ShowProperties();
205 : void UpdatePropertyBrowserDelayed();
206 :
207 : static void printPage( sal_Int32 nPage, Printer* pPrinter, const OUString& );
208 :
209 : bool AdjustPageSize();
210 :
211 0 : bool isInPaint() const { return mnPaintGuard > 0; }
212 : };
213 :
214 : } // namespace basctl
215 :
216 : #endif // INCLUDED_BASCTL_SOURCE_INC_DLGED_HXX
217 :
218 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|