Use o3tl::convert in Math
[LibreOffice.git] / reportdesign / source / ui / inc / ReportWindow.hxx
blobc634dcf098f40e85086bf665fa11b6438657ac94
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 .
19 #ifndef INCLUDED_REPORTDESIGN_SOURCE_UI_INC_REPORTWINDOW_HXX
20 #define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_REPORTWINDOW_HXX
22 #include <com/sun/star/report/XSection.hpp>
23 #include "ReportDefines.hxx"
24 #include <o3tl/deleter.hxx>
25 #include <svtools/ruler.hxx>
26 #include <sfx2/zoomitem.hxx>
28 #include <memory>
29 #include <vector>
30 #include <comphelper/propmultiplex.hxx>
32 #include "MarkedSection.hxx"
33 #include "ViewsWindow.hxx"
35 namespace rptui
37 class ODesignView;
38 class OScrollWindowHelper;
39 class OSectionView;
40 class DlgEdFactory;
42 class OReportWindow : public vcl::Window
43 , public IMarkedSection
44 , public ::cppu::BaseMutex
45 , public ::comphelper::OPropertyChangeListener
47 VclPtr<Ruler> m_aHRuler;
48 VclPtr<ODesignView> m_pView;
49 VclPtr<OScrollWindowHelper> m_pParent;
50 VclPtr<OViewsWindow> m_aViewsWindow;
51 rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pReportListener;
52 std::unique_ptr<DlgEdFactory, o3tl::default_delete<DlgEdFactory>> m_pObjFac;
54 void ImplInitSettings();
56 sal_Int32 GetTotalHeight() const;
57 sal_Int32 impl_getRealPixelWidth() const;
59 OReportWindow(OReportWindow const &) = delete;
60 void operator =(OReportWindow const &) = delete;
61 protected:
62 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
63 // OPropertyChangeListener
64 virtual void _propertyChanged(const css::beans::PropertyChangeEvent& _rEvent) override;
65 public:
66 OReportWindow(OScrollWindowHelper* _pParent,ODesignView* _pView);
67 virtual ~OReportWindow() override;
68 virtual void dispose() override;
70 // Window overrides
71 virtual void Resize() override;
73 ODesignView* getReportView() const { return m_pView; }
74 OScrollWindowHelper* getScrollWindow() const { return m_pParent; }
76 void SetMode( DlgEdMode m_eMode );
77 void SetInsertObj(SdrObjKind eObj, const OUString& _sShapeType);
78 OUString const & GetInsertObjString() const;
79 void setGridSnap(bool bOn);
80 void setDragStripes(bool bOn);
82 /** copies the current selection in this section
84 void Copy();
86 /** returns if paste is allowed
88 * \return <TRUE/> if paste is allowed
90 bool IsPasteAllowed() const;
92 /** paste a new control in this section
94 void Paste();
96 /** Deletes the current selection in this section
99 void Delete();
101 /** All objects will be marked.
103 void SelectAll(const sal_uInt16 _nObjectType);
105 /** returns <TRUE/> when an object is marked
107 bool HasSelection() const;
109 Point getThumbPos() const;
111 /** removes the section at the given position.
113 * \param _nPosition Zero based.
115 void removeSection(sal_uInt16 _nPosition);
117 /** adds a new section at position _nPosition.
118 If the section is <NULL/> nothing happens.
119 If the position is grater than the current elements, the section will be appended.
121 void addSection(const css::uno::Reference< css::report::XSection >& _xSection
122 ,const OUString& _sColorEntry
123 ,sal_uInt16 _nPosition);
125 sal_uInt16 getSectionCount() const;
127 /** turns the grid on or off
129 * \param _bVisible
131 void toggleGrid(bool _bVisible);
134 /** shows the ruler
136 void showRuler(bool _bShow);
138 sal_Int32 getRulerHeight() const { return m_aHRuler->GetSizePixel().Height(); }
140 /** returns the total width of the first section
142 sal_Int32 GetTotalWidth() const;
144 /** calculate the max width of the markers
145 * The end marker will not be used for calculation.
147 * \return the max width
149 sal_Int32 getMaxMarkerWidth() const;
151 void ScrollChildren(const Point& _aThumbPos);
153 void notifySizeChanged();
155 /** unmark all objects on the views without the given one.
157 void unmarkAllObjects();
159 /** triggers the property browser with the report component or section
160 @param _xReportComponent
162 void showProperties( const css::uno::Reference< css::report::XSection>& _xReportComponent);
164 /** checks if the keycode is known by the child windows
165 @param _rCode the keycode
166 @return <TRUE/> if the keycode is handled otherwise <FALSE/>
168 bool handleKeyEvent(const KeyEvent& _rEvent);
170 /** the section as marked or not marked
171 @param _pSectionView the section where to set the marked flag
172 @param _bMark the marked flag
174 void setMarked(OSectionView const * _pSectionView, bool _bMark);
175 void setMarked(const css::uno::Reference< css::report::XSection>& _xSection, bool _bMark);
176 void setMarked(const css::uno::Sequence< css::uno::Reference< css::report::XReportComponent> >& _xShape, bool _bMark);
178 // IMarkedSection
179 OSectionWindow* getMarkedSection(NearSectionAccess nsa = CURRENT) const override;
180 OSectionWindow* getSectionWindow(const css::uno::Reference< css::report::XSection>& _xSection) const;
181 virtual void markSection(const sal_uInt16 _nPos) override;
184 /** fills the positions of all collapsed sections.
186 * \param _rCollapsedPositions Out parameter which holds afterwards all positions of the collapsed sections.
188 void fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const;
190 /** collapse all sections given by their position
192 * \param _aCollapsedSections The position of the sections which should be collapsed.
194 void collapseSections(const css::uno::Sequence< css::beans::PropertyValue>& _aCollapsedSections);
196 /** align all marked objects in all sections
198 void alignMarkedObjects(ControlModification _nControlModification, bool _bAlignAtSection);
200 sal_uInt32 getMarkedObjectCount() const;
202 /** zoom the ruler and view windows
204 void zoom(const Fraction& _aZoom);
206 /** fills the vector with all selected control models
207 /param _rSelection The vector will be filled and will not be cleared before.
209 void fillControlModelSelection(::std::vector< css::uno::Reference< css::uno::XInterface > >& _rSelection) const;
211 /** calculates the zoom factor.
212 @param _eType which kind of zoom is needed
214 sal_uInt16 getZoomFactor(SvxZoomType _eType) const;
217 } //rptui
219 #endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_REPORTWINDOW_HXX
221 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */