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