Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / basctl / source / inc / dlged.hxx
blob6654b454a42dc8c36a8470bcfd2d6f934a0f5589
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_BASCTL_SOURCE_INC_DLGED_HXX
21 #define INCLUDED_BASCTL_SOURCE_INC_DLGED_HXX
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 <o3tl/deleter.hxx>
29 #include <svl/SfxBroadcaster.hxx>
30 #include <svl/hint.hxx>
31 #include <tools/gen.hxx>
32 #include <vcl/timer.hxx>
33 #include <vcl/idle.hxx>
34 #include <vcl/vclptr.hxx>
35 #include <vcl/window.hxx>
37 #include <memory>
39 class ScrollBar;
40 class Printer;
41 class KeyEvent;
42 class MouseEvent;
43 class Timer;
44 namespace vcl { class Window; }
46 namespace basctl
49 class DialogWindowLayout;
51 #define DLGED_PAGE_WIDTH_MIN 1280
52 #define DLGED_PAGE_HEIGHT_MIN 1024
55 // DlgEdHint
58 class DlgEdObj;
60 class DlgEdHint: public SfxHint
62 public:
63 enum Kind {
64 UNKNOWN,
65 WINDOWSCROLLED,
66 LAYERCHANGED,
67 OBJORDERCHANGED,
68 SELECTIONCHANGED,
71 private:
72 Kind eKind;
73 DlgEdObj* pDlgEdObj;
75 public:
76 DlgEdHint (Kind);
77 DlgEdHint (Kind, DlgEdObj* pObj);
78 virtual ~DlgEdHint() override;
80 Kind GetKind() const { return eKind; }
81 DlgEdObj* GetObject() const { return pDlgEdObj; }
85 // DlgEditor
88 class DlgEdModel;
89 class DlgEdPage;
90 class DlgEdView;
91 class DlgEdForm;
92 class DlgEdFactory;
93 class DlgEdFunc;
95 class DlgEditor: public SfxBroadcaster
97 public:
98 enum Mode {
99 INSERT,
100 SELECT,
101 TEST,
102 READONLY,
105 private:
106 DECL_LINK(MarkTimeout, Timer *, void);
108 static void Print( Printer* pPrinter, const OUString& rTitle );
110 private:
111 VclPtr<ScrollBar> pHScroll;
112 VclPtr<ScrollBar> pVScroll;
113 std::unique_ptr<DlgEdModel> pDlgEdModel; // never nullptr
114 DlgEdPage* pDlgEdPage; // never nullptr
115 std::unique_ptr<DlgEdView> pDlgEdView; // never nullptr
116 DlgEdForm* pDlgEdForm; // never nullptr
117 css::uno::Reference< css::container::XNameContainer > m_xUnoControlDialogModel;
118 css::uno::Reference< css::awt::XControlContainer > m_xControlContainer;
119 css::uno::Sequence< css::datatransfer::DataFlavor > m_ClipboardDataFlavors;
120 css::uno::Sequence< css::datatransfer::DataFlavor > m_ClipboardDataFlavorsResource;
121 css::uno::Reference< css::util::XNumberFormatsSupplier > m_xSupplier;
122 std::unique_ptr<DlgEdFactory, o3tl::default_delete<DlgEdFactory>> pObjFac; // never nullptr
123 vcl::Window& rWindow; // DialogWindow
124 std::unique_ptr<DlgEdFunc> pFunc;
125 DialogWindowLayout& rLayout;
126 Mode eMode;
127 sal_uInt16 eActObj;
128 bool bFirstDraw;
129 bool bCreateOK;
130 tools::Rectangle aPaintRect;
131 bool bDialogModelChanged;
132 Idle aMarkIdle;
133 long mnPaintGuard;
134 css::uno::Reference< css::frame::XModel > m_xDocument;
136 public:
137 DlgEditor (
138 vcl::Window&, DialogWindowLayout&,
139 css::uno::Reference<css::frame::XModel> const& xModel,
140 css::uno::Reference<css::container::XNameContainer> const & xDialogModel
142 virtual ~DlgEditor() override;
144 vcl::Window& GetWindow() const { return rWindow; }
146 /** returns the control container associated with our window
147 @see GetWindow
148 @see SetWindow
150 css::uno::Reference< css::awt::XControlContainer > const &
151 GetWindowControlContainer();
153 void SetScrollBars( ScrollBar* pHScroll, ScrollBar* pVScroll );
154 void InitScrollBars();
155 ScrollBar* GetHScroll() const { return pHScroll; }
156 ScrollBar* GetVScroll() const { return pVScroll; }
157 void DoScroll();
158 void UpdateScrollBars();
160 void SetDialog (const css::uno::Reference<css::container::XNameContainer>& xUnoControlDialogModel);
161 void ResetDialog ();
162 const css::uno::Reference< css::container::XNameContainer >& GetDialog() const
163 {return m_xUnoControlDialogModel;}
165 css::uno::Reference< css::util::XNumberFormatsSupplier > const & GetNumberFormatsSupplier();
167 DlgEdModel& GetModel() const { return *pDlgEdModel; }
168 DlgEdView& GetView() const { return *pDlgEdView; }
169 DlgEdPage& GetPage() const { return *pDlgEdPage; }
171 void ShowDialog();
173 bool UnmarkDialog();
174 bool RemarkDialog();
176 void SetDialogModelChanged() { bDialogModelChanged = true; }
178 bool IsModified () const;
179 void ClearModifyFlag();
181 void MouseButtonDown( const MouseEvent& rMEvt );
182 void MouseButtonUp( const MouseEvent& rMEvt );
183 void MouseMove( const MouseEvent& rMEvt );
184 void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
185 bool KeyInput( const KeyEvent& rKEvt );
187 void SetMode (Mode eMode);
188 void SetInsertObj( sal_uInt16 eObj );
189 void CreateDefaultObject();
190 Mode GetMode() const { return eMode; }
191 bool IsCreateOK() const { return bCreateOK; }
193 void Cut();
194 void Copy();
195 void Paste();
196 void Delete();
197 bool IsPasteAllowed();
199 void ShowProperties();
200 void UpdatePropertyBrowserDelayed();
202 static void printPage( sal_Int32 nPage, Printer* pPrinter, const OUString& );
204 bool AdjustPageSize();
206 bool isInPaint() const { return mnPaintGuard > 0; }
209 } // namespace basctl
211 #endif // INCLUDED_BASCTL_SOURCE_INC_DLGED_HXX
213 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */