tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / include / svx / svdpagv.hxx
blobe52814bb08ae9aab6e1c189b4cde5e4a85ee5d1b
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 <rtl/ustring.hxx>
24 #include <tools/color.hxx>
25 #include <svx/svdhlpln.hxx>
26 #include <svx/svdsob.hxx>
27 #include <svx/svdtypes.hxx>
28 #include <svx/svxdllapi.h>
30 #include <memory>
31 #include <vector>
32 #include <basegfx/range/b2irectangle.hxx>
35 namespace vcl { class Region; }
36 class SdrObjList;
37 class SdrObject;
38 class SdrPage;
39 class SdrUnoObj;
40 class SdrPaintWindow;
41 class SdrView;
42 class SdrPageObj;
43 class SdrPageView;
45 namespace sdr::contact
47 class ViewObjectContactRedirector;
48 class DisplayInfo;
49 class ViewObjectContactRedirector;
52 // typedefs for a list of SdrPageWindow
53 class SdrPageWindow;
55 class SVXCORE_DLLPUBLIC SdrPageView
57 private:
58 SdrView& mrView;
59 SdrPage* mpPage;
60 Point maPageOrigin; // The Page's point of origin
62 tools::Rectangle m_aMarkBound;
63 tools::Rectangle m_aMarkSnap;
64 bool mbHasMarked;
65 bool mbVisible;
67 SdrLayerIDSet m_aLayerVisi; // Set of visible Layers
68 SdrLayerIDSet m_aLayerLock; // Set of non-editable Layers
69 SdrLayerIDSet m_aLayerPrn; // Set of printable Layers
71 SdrObjList* m_pCurrentList; // Current List, usually the Page
72 SdrObject* m_pCurrentGroup; // Current Group; nullptr means none
74 SdrHelpLineList m_aHelpLines; // Helper lines and points
76 // #103911# Use one reserved slot (bReserveBool2) for the document color
77 Color maDocumentColor;
79 // #103834# Use one reserved slot (bReserveBool1) for the background color
80 Color maBackgroundColor;
82 std::vector< std::unique_ptr<SdrPageWindow> > maPageWindows;
84 // #i72752# member to remember with which SdrPageWindow the BeginDrawLayer
85 // was done
86 SdrPageWindow* mpPreparedPageWindow;
88 public:
89 sal_uInt32 PageWindowCount() const { return maPageWindows.size(); }
90 SdrPageWindow* FindPageWindow( const SdrPaintWindow& rPaintWindow ) const;
91 SdrPageWindow* FindPageWindow( const OutputDevice& rOutDev ) const;
92 SdrPageWindow* GetPageWindow(sal_uInt32 nIndex) const;
94 /**
95 * Finds the page window whose PaintWindow belongs to the given output device
96 * In opposite to FindPageWindow, this method also cares possibly patched PaintWindow instances.
97 * That is, a SdrPageWindow might have an original, and a patched SdrPaintWindow instance - if
98 * this is the case, then the original SdrPaintWindow is examined before the patched one.
100 const SdrPageWindow* FindPatchedPageWindow( const OutputDevice& rOutDev ) const;
102 private:
103 void ImpInvalidateHelpLineArea(sal_uInt16 nNum) const;
105 // return true if changed, false if unchanged
106 bool SetLayer(const OUString& rName, SdrLayerIDSet& rBS, bool bJa);
107 bool IsLayer(const OUString& rName, const SdrLayerIDSet& rBS) const;
109 /// Let's see if the current Group (pCurrentGroup) is still inserted
110 void CheckCurrentGroup();
112 void AdjHdl();
114 public:
115 SdrPageView(SdrPage* pPage1, SdrView& rNewView);
116 ~SdrPageView();
118 SdrPageView& operator=( SdrPageView const & ) = delete; // MSVC2017 workaround
119 SdrPageView( SdrPageView const & ) = delete; // MSVC2017 workaround
122 /// Is called by PaintView, when modal changes have finished
123 void ModelHasChanged();
125 void Show();
126 void Hide();
128 void AddPaintWindowToPageView(SdrPaintWindow& rPaintWindow);
129 void RemovePaintWindowFromPageView(SdrPaintWindow& rPaintWindow);
131 SdrView& GetView() { return mrView; }
132 const SdrView& GetView() const { return mrView; }
135 * Looks up the control container belonging to given output device
136 * @return
137 * If the given output device belongs to one of the SdrPageViewWinRecs associated with this
138 * SdrPageView instance, the XControlContainer for this output device is returned, <NULL/>
139 * otherwise.
141 css::uno::Reference< css::awt::XControlContainer >
142 GetControlContainer( const OutputDevice& _rDevice ) const;
144 /// Sets all elements in the view which support a design and an alive mode into the given mode
145 void SetDesignMode( bool _bDesignMode ) const;
147 bool IsVisible() const { return mbVisible; }
149 /// Invalidates the Page's whole area
150 void InvalidateAllWin();
152 /// PrePaint call forwarded from app windows
153 void PrePaint();
155 /// @param rReg refers to the OutDev and not to the Page
156 void CompleteRedraw( SdrPaintWindow& rPaintWindow, const vcl::Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector );
158 /// Write access to mpPreparedPageWindow
159 void setPreparedPageWindow(SdrPageWindow* pKnownTarget);
161 void DrawLayer(SdrLayerID nID, OutputDevice* pGivenTarget, sdr::contact::ViewObjectContactRedirector* pRedirector = nullptr,
162 const tools::Rectangle& rRect = tools::Rectangle(),
163 basegfx::B2IRectangle const* pPageFrame = nullptr);
164 void DrawPageViewGrid(OutputDevice& rOut, const tools::Rectangle& rRect, Color aColor = COL_BLACK );
166 tools::Rectangle GetPageRect() const;
167 SdrPage* GetPage() const { return mpPage; }
169 /// Return current List
170 SdrObjList* GetObjList() const { return m_pCurrentList; }
172 /// Return current Group
173 SdrObject* GetCurrentGroup() const { return m_pCurrentGroup; }
175 /// Set current Group and List
176 void SetCurrentGroupAndList(SdrObject* pNewGroup, SdrObjList* pNewList);
178 bool HasMarkedObjPageView() const { return mbHasMarked; }
179 void SetHasMarkedObj(bool bOn) { mbHasMarked = bOn; }
181 const tools::Rectangle& MarkBound() const { return m_aMarkBound; }
182 const tools::Rectangle& MarkSnap() const { return m_aMarkSnap; }
183 tools::Rectangle& MarkBound() { return m_aMarkBound; }
184 tools::Rectangle& MarkSnap() { return m_aMarkSnap; }
186 bool SetLayerVisible(const OUString& rName, bool bShow) {
187 const bool bChanged = SetLayer(rName, m_aLayerVisi, bShow);
188 if (!bChanged)
189 return false;
190 if(!bShow) AdjHdl();
191 InvalidateAllWin();
192 return true;
194 bool IsLayerVisible(const OUString& rName) const { return IsLayer(rName, m_aLayerVisi); }
196 void SetLayerLocked(const OUString& rName, bool bLock) { SetLayer(rName, m_aLayerLock, bLock); if(bLock) AdjHdl(); }
197 bool IsLayerLocked(const OUString& rName) const { return IsLayer(rName,m_aLayerLock); }
199 void SetLayerPrintable(const OUString& rName, bool bPrn) { SetLayer(rName, m_aLayerPrn, bPrn); }
200 bool IsLayerPrintable(const OUString& rName) const { return IsLayer(rName, m_aLayerPrn); }
202 /// PV represents a RefPage or a SubList of a RefObj, or the Model is ReadOnly
203 bool IsReadOnly() const;
205 /// The Origin always refers to the upper left corner of the Page
206 const Point& GetPageOrigin() const { return maPageOrigin; }
207 void SetPageOrigin(const Point& rOrg);
209 void LogicToPagePos(Point& rPnt) const { rPnt-=maPageOrigin; }
210 void LogicToPagePos(tools::Rectangle& rRect) const { rRect.Move(-maPageOrigin.X(),-maPageOrigin.Y()); }
211 void PagePosToLogic(Point& rPnt) const { rPnt+=maPageOrigin; }
213 void SetVisibleLayers(const SdrLayerIDSet& rSet) { m_aLayerVisi=rSet; }
214 const SdrLayerIDSet& GetVisibleLayers() const { return m_aLayerVisi; }
215 void SetPrintableLayers(const SdrLayerIDSet& rSet) { m_aLayerPrn=rSet; }
216 const SdrLayerIDSet& GetPrintableLayers() const { return m_aLayerPrn; }
217 void SetLockedLayers(const SdrLayerIDSet& rSet) { m_aLayerLock=rSet; }
218 const SdrLayerIDSet& GetLockedLayers() const { return m_aLayerLock; }
220 const SdrHelpLineList& GetHelpLines() const { return m_aHelpLines; }
221 void SetHelpLines(const SdrHelpLineList& rHLL);
222 //void SetHelpLinePos(sal_uInt16 nNum, const Point& rNewPos);
223 void SetHelpLine(sal_uInt16 nNum, const SdrHelpLine& rNewHelpLine);
224 void DeleteHelpLine(sal_uInt16 nNum);
225 void InsertHelpLine(const SdrHelpLine& rHL);
227 /// At least one member must be visible for the Group object and
228 /// it must not be locked
229 /// @returns
230 /// true, if the object's layer is visible and not locked
231 bool IsObjMarkable(SdrObject const * pObj) const;
233 /// Entering (editing) an object group
234 /// After that, we have direct access to all member objects of the group.
235 /// All other objects are not editable in the meantime (until the next
236 /// LeaveGroup())
237 bool EnterGroup(SdrObject* pObj);
239 /// Leave an object group we entered previously
240 void LeaveOneGroup();
242 /// Leave all object groups we entered previously
243 void LeaveAllGroup();
245 /// Determine, how deep we descended (0 = Root(Page))
246 sal_uInt16 GetEnteredLevel() const;
248 // #103834# Set background color for svx at SdrPageViews
249 void SetApplicationBackgroundColor(Color aBackgroundColor);
251 const Color& GetApplicationBackgroundColor() const { return maBackgroundColor;}
253 // #103911# Set/Get document color for svx at SdrPageViews
254 void SetApplicationDocumentColor(Color aDocumentColor);
255 const Color& GetApplicationDocumentColor() const { return maDocumentColor;}
258 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */