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