1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_REPORTSECTION_HXX
20 #define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_REPORTSECTION_HXX
22 #include <vcl/window.hxx>
23 #include <RptPage.hxx>
24 #include <com/sun/star/beans/NamedValue.hpp>
25 #include <comphelper/propmultiplex.hxx>
26 #include <cppuhelper/basemutex.hxx>
27 #include "ReportDefines.hxx"
28 #include "dlgedfunc.hxx"
29 #include <vcl/transfer.hxx>
30 #include <rtl/ref.hxx>
40 class OReportSection
: public vcl::Window
41 , public ::cppu::BaseMutex
42 , public ::comphelper::OPropertyChangeListener
43 , public DropTargetHelper
46 OSectionView
* m_pView
;
47 VclPtr
<OSectionWindow
> m_pParent
;
48 ::std::unique_ptr
<DlgEdFunc
> m_pFunc
;
49 std::shared_ptr
<OReportModel
> m_pModel
;
50 ::rtl::Reference
< comphelper::OPropertyChangeMultiplexer
> m_pMulti
;
51 ::rtl::Reference
< comphelper::OPropertyChangeMultiplexer
> m_pReportListener
;
52 css::uno::Reference
< css::report::XSection
> m_xSection
;
53 sal_Int32 m_nPaintEntranceCount
;
57 /** fills the section with all control from the report section
60 /** checks all objects if they fit in the new paper width.
62 void impl_adjustObjectSizePosition(sal_Int32 i_nPaperWidth
,sal_Int32 i_nLeftMargin
,sal_Int32 i_nRightMargin
);
64 OReportSection(OReportSection
const &) = delete;
65 void operator =(OReportSection
const &) = delete;
67 // DropTargetHelper overridables
68 virtual sal_Int8
AcceptDrop( const AcceptDropEvent
& _rEvt
) override
;
69 virtual sal_Int8
ExecuteDrop( const ExecuteDropEvent
& _rEvt
) override
;
72 virtual void Paint( vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
) override
;
73 virtual void MouseMove( const MouseEvent
& rMEvt
) override
;
74 virtual void Command( const CommandEvent
& rCEvt
) override
;
76 // OPropertyChangeListener
77 virtual void _propertyChanged(const css::beans::PropertyChangeEvent
& _rEvent
) override
;
79 OReportSection(OSectionWindow
* _pParent
,const css::uno::Reference
< css::report::XSection
>& _xSection
);
80 virtual ~OReportSection() override
;
81 virtual void dispose() override
;
84 virtual void MouseButtonDown( const MouseEvent
& rMEvt
) override
;
85 virtual void MouseButtonUp( const MouseEvent
& rMEvt
) override
;
87 /** copies the current selection in this section
88 @param _rAllreadyCopiedObjects This is an out/in put param which contains all already copied objects.
90 void Copy(css::uno::Sequence
< css::beans::NamedValue
>& _rAllreadyCopiedObjects
);
92 void Copy(css::uno::Sequence
< css::beans::NamedValue
>& _rAllreadyCopiedObjects
,bool _bEraseAnddNoClone
);
94 /** paste a new control in this section
95 @param _aAllreadyCopiedObjects objects to paste into the section. Only objects are pasted where the name is equal to the section name.
96 @param _bForce If set to <TRUE/> than the objects will be copied into this section. The name is not compared in this case.
98 void Paste(const css::uno::Sequence
< css::beans::NamedValue
>& _aAllreadyCopiedObjects
,bool _bForce
= false);
100 /** Deletes the current selection in this section
105 /** All objects will be marked.
107 void SelectAll(const sal_uInt16 _nObjectType
);
109 /** makes the grid visible
111 * \param _bVisible when <TRUE/> the grid is made visible
113 void SetGridVisible(bool _bVisible
);
115 OSectionWindow
* getSectionWindow() const { return m_pParent
; }
116 OSectionView
& getSectionView() const { return *m_pView
; }
117 OReportPage
* getPage() const { return m_pPage
; }
118 const css::uno::Reference
< css::report::XSection
>& getSection() const { return m_xSection
; }
120 void SetMode( DlgEdMode m_eMode
);
122 /** checks if the keycode is known by the child windows
123 @param _rCode the keycode
124 @return <TRUE/> if the keycode is handled otherwise <FALSE/>
126 bool handleKeyEvent(const KeyEvent
& _rEvent
);
128 /** returns the current control report model or <NULL/>
130 css::uno::Reference
< css::report::XReportComponent
> getCurrentControlModel() const;
132 /** fills the vector with all selected control models
133 /param _rSelection The vector will be filled and will not be cleared before.
135 void fillControlModelSelection(::std::vector
< css::uno::Reference
< css::uno::XInterface
> >& _rSelection
) const;
137 /** creates a default object (custom shape)
141 void createDefault(const OUString
& _sType
);
143 /** creates a new default custom shape
148 static void createDefault(const OUString
& _sType
,SdrObject
* _pObj
);
149 void stopScrollTimer();
151 /** deactivate the current active ole object if any
153 void deactivateOle();
155 /** returns true when an ole object is currently active
157 bool isUiActive() const;
162 #endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_REPORTSECTION_HXX
164 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */