tdf#130857 qt weld: Implement QtInstanceWidget::get_text_height
[LibreOffice.git] / basctl / source / inc / dlged.hxx
blobc50faf51b36cb50e687ef2bffbe15a67f41660dc
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 #pragma once
22 #include <com/sun/star/awt/XControlContainer.hpp>
23 #include <com/sun/star/container/XNameContainer.hpp>
24 #include <com/sun/star/datatransfer/DataFlavor.hpp>
25 #include <com/sun/star/frame/XModel.hpp>
26 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
27 #include <o3tl/deleter.hxx>
28 #include <svl/SfxBroadcaster.hxx>
29 #include <svl/hint.hxx>
30 #include <svx/svdobjkind.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 ScrollAdaptor;
40 class Printer;
41 class KeyEvent;
42 class MouseEvent;
43 class Timer;
44 namespace vcl { class Window; }
46 namespace basctl
49 class DialogWindowLayout;
51 constexpr auto DLGED_PAGE_WIDTH_MIN = 1280;
52 constexpr auto DLGED_PAGE_HEIGHT_MIN = 1024;
54 // DlgEdHint
57 class DlgEdObj;
59 class DlgEdHint: public SfxHint
61 public:
62 enum Kind {
63 UNKNOWN,
64 WINDOWSCROLLED,
65 LAYERCHANGED,
66 OBJORDERCHANGED,
67 SELECTIONCHANGED,
70 private:
71 Kind eKind;
72 DlgEdObj* pDlgEdObj;
74 public:
75 DlgEdHint (Kind);
76 DlgEdHint (Kind, DlgEdObj* pObj);
77 virtual ~DlgEdHint() override;
79 Kind GetKind() const { return eKind; }
80 DlgEdObj* GetObject() const { return pDlgEdObj; }
84 // DlgEditor
87 class DlgEdModel;
88 class DlgEdPage;
89 class DlgEdView;
90 class DlgEdForm;
91 class DlgEdFactory;
92 class DlgEdFunc;
94 class DlgEditor: public SfxBroadcaster
96 public:
97 enum Mode {
98 INSERT,
99 SELECT,
100 TEST,
101 READONLY,
104 private:
105 DECL_LINK(MarkTimeout, Timer *, void);
107 static void Print( Printer* pPrinter, const OUString& rTitle );
109 private:
110 VclPtr<ScrollAdaptor> pHScroll;
111 VclPtr<ScrollAdaptor> pVScroll;
112 std::unique_ptr<DlgEdModel> pDlgEdModel; // never nullptr
113 DlgEdPage* pDlgEdPage; // never nullptr
114 std::unique_ptr<DlgEdView> pDlgEdView; // never nullptr
115 rtl::Reference<DlgEdForm> pDlgEdForm; // never nullptr
116 css::uno::Reference< css::container::XNameContainer > m_xUnoControlDialogModel;
117 css::uno::Reference< css::awt::XControlContainer > m_xControlContainer;
118 css::uno::Sequence< css::datatransfer::DataFlavor > m_ClipboardDataFlavors;
119 css::uno::Sequence< css::datatransfer::DataFlavor > m_ClipboardDataFlavorsResource;
120 css::uno::Reference< css::util::XNumberFormatsSupplier > m_xSupplier;
121 std::unique_ptr<DlgEdFactory, o3tl::default_delete<DlgEdFactory>> pObjFac; // never nullptr
122 vcl::Window& rWindow; // DialogWindow
123 std::unique_ptr<DlgEdFunc> pFunc;
124 DialogWindowLayout& rLayout;
125 Mode eMode;
126 SdrObjKind eActObj;
127 bool bFirstDraw;
128 bool bCreateOK;
129 tools::Rectangle aPaintRect;
130 bool bDialogModelChanged;
131 Idle aMarkIdle;
132 tools::Long mnPaintGuard;
133 css::uno::Reference< css::frame::XModel > m_xDocument;
135 public:
136 DlgEditor (
137 vcl::Window&, DialogWindowLayout&,
138 css::uno::Reference<css::frame::XModel> const& xModel,
139 css::uno::Reference<css::container::XNameContainer> const & xDialogModel
141 virtual ~DlgEditor() override;
143 vcl::Window& GetWindow() const { return rWindow; }
145 /** returns the control container associated with our window
146 @see GetWindow
147 @see SetWindow
149 css::uno::Reference< css::awt::XControlContainer > const &
150 GetWindowControlContainer();
152 void SetScrollBars(ScrollAdaptor* pHScroll, ScrollAdaptor* pVScroll);
153 void InitScrollBars();
154 ScrollAdaptor* GetHScroll() const { return pHScroll; }
155 ScrollAdaptor* GetVScroll() const { return pVScroll; }
156 void DoScroll();
157 void UpdateScrollBars();
159 void SetDialog (const css::uno::Reference<css::container::XNameContainer>& xUnoControlDialogModel);
160 void ResetDialog ();
161 const css::uno::Reference< css::container::XNameContainer >& GetDialog() const
162 {return m_xUnoControlDialogModel;}
164 css::uno::Reference< css::util::XNumberFormatsSupplier > const & GetNumberFormatsSupplier();
166 DlgEdModel& GetModel() const { return *pDlgEdModel; }
167 DlgEdView& GetView() const { return *pDlgEdView; }
168 DlgEdPage& GetPage() const { return *pDlgEdPage; }
170 void ShowDialog();
172 bool UnmarkDialog();
173 bool RemarkDialog();
175 void SetDialogModelChanged() { bDialogModelChanged = true; }
177 bool IsModified () const;
178 void ClearModifyFlag();
180 void MouseButtonDown( const MouseEvent& rMEvt );
181 void MouseButtonUp( const MouseEvent& rMEvt );
182 void MouseMove( const MouseEvent& rMEvt );
183 void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
184 bool KeyInput( const KeyEvent& rKEvt );
186 void SetMode (Mode eMode);
187 void SetInsertObj(SdrObjKind eObj);
188 void CreateDefaultObject();
189 Mode GetMode() const { return eMode; }
190 bool IsCreateOK() const { return bCreateOK; }
192 void Cut();
193 void Copy();
194 void Paste();
195 void Delete();
196 bool IsPasteAllowed();
198 void ShowProperties();
199 void UpdatePropertyBrowserDelayed();
201 static void printPage( sal_Int32 nPage, Printer* pPrinter, const OUString& );
203 bool AdjustPageSize();
205 bool isInPaint() const { return mnPaintGuard > 0; }
208 } // namespace basctl
210 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */