Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_REPORTDESIGN_SOURCE_UI_INC_REPORTSECTION_HXX
20 : #define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_REPORTSECTION_HXX
21 :
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 <svtools/transfer.hxx>
30 : #include <rtl/ref.hxx>
31 : #include <boost/shared_ptr.hpp>
32 : #include <memory>
33 :
34 : namespace rptui
35 : {
36 : class OReportModel;
37 : class OReportPage;
38 : class OSectionView;
39 : class OSectionWindow;
40 :
41 : class OReportSection : public vcl::Window
42 : , public ::cppu::BaseMutex
43 : , public ::comphelper::OPropertyChangeListener
44 : , public DropTargetHelper
45 : {
46 : OReportPage* m_pPage;
47 : OSectionView* m_pView;
48 : VclPtr<OSectionWindow> m_pParent;
49 : ::std::unique_ptr<DlgEdFunc> m_pFunc;
50 : ::boost::shared_ptr<OReportModel> m_pModel;
51 : ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pMulti;
52 : ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pReportListener;
53 : ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > m_xSection;
54 : sal_Int32 m_nPaintEntranceCount;
55 :
56 : DlgEdMode m_eMode;
57 : bool m_bDialogModelChanged;
58 :
59 : /** fills the section with all control from the report section
60 : */
61 : void fill();
62 : /** checks all objects if they fit in the new paper width.
63 : */
64 : void impl_adjustObjectSizePosition(sal_Int32 i_nPaperWidth,sal_Int32 i_nLeftMargin,sal_Int32 i_nRightMargin);
65 :
66 : OReportSection(OReportSection&) SAL_DELETED_FUNCTION;
67 : void operator =(OReportSection&) SAL_DELETED_FUNCTION;
68 : protected:
69 : // DropTargetHelper overridables
70 : virtual sal_Int8 AcceptDrop( const AcceptDropEvent& _rEvt ) SAL_OVERRIDE;
71 : virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& _rEvt ) SAL_OVERRIDE;
72 :
73 : // window overrides
74 : virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE;
75 : virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
76 : virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
77 : virtual void Resize() SAL_OVERRIDE;
78 :
79 : // OPropertyChangeListener
80 : virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& _rEvent) throw( ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
81 : public:
82 : OReportSection(OSectionWindow* _pParent,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection);
83 : virtual ~OReportSection();
84 : virtual void dispose() SAL_OVERRIDE;
85 :
86 : // window overrides
87 : virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
88 : virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
89 :
90 : /** copies the current selection in this section
91 : @param _rAllreadyCopiedObjects This is an out/in put param which contains all already copied objects.
92 : */
93 : void Copy(::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _rAllreadyCopiedObjects);
94 :
95 : void Copy(::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _rAllreadyCopiedObjects,bool _bEraseAnddNoClone);
96 :
97 : /** paste a new control in this section
98 : @param _aAllreadyCopiedObjects objects to paste into the section. Only objects are pasted where the name is equal to the section name.
99 : @param _bForce If set to <TRUE/> than the objects will be copied into this section. The name is not compared in this case.
100 : */
101 : void Paste(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _aAllreadyCopiedObjects,bool _bForce = false);
102 :
103 : /** Deletes the current selection in this section
104 : *
105 : */
106 : void Delete();
107 :
108 : /** All objects will be marked.
109 : */
110 : void SelectAll(const sal_uInt16 _nObjectType);
111 :
112 : /** makes the grid visible
113 : *
114 : * \param _bVisible when <TRUE/> the grid is made visible
115 : */
116 : void SetGridVisible(bool _bVisible);
117 :
118 0 : inline OSectionWindow* getSectionWindow() const { return m_pParent; }
119 0 : inline OSectionView& getSectionView() const { return *m_pView; }
120 0 : inline OReportPage* getPage() const { return m_pPage; }
121 0 : inline ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > getSection() const { return m_xSection; }
122 :
123 : void SetDialogModelChanged( bool bChanged = true ) { m_bDialogModelChanged = bChanged; }
124 : bool IsDialogModelChanged() const { return m_bDialogModelChanged; }
125 0 : DlgEdMode GetMode() const { return m_eMode; }
126 : void SetMode( DlgEdMode m_eMode );
127 :
128 : /** checks if the keycode is known by the child windows
129 : @param _rCode the keycode
130 : @return <TRUE/> if the keycode is handled otherwise <FALSE/>
131 : */
132 : bool handleKeyEvent(const KeyEvent& _rEvent);
133 :
134 : /** returns the current control report model or <NULL/>
135 : */
136 : ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent > getCurrentControlModel() const;
137 :
138 : /** fills the vector with all selected control models
139 : /param _rSelection The vector will be filled and will not be cleared before.
140 : */
141 : void fillControlModelSelection(::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >& _rSelection) const;
142 :
143 : /** creates a default object (custom shape)
144 : *
145 : * @param _sType
146 : */
147 : void createDefault(const OUString& _sType);
148 :
149 : /** creates a new default custom shape
150 : *
151 : * \param _sType
152 : * \param _pObj
153 : */
154 : static void createDefault(const OUString& _sType,SdrObject* _pObj);
155 : void stopScrollTimer();
156 :
157 : /** deactivate the current active ole object if any
158 : */
159 : void deactivateOle();
160 :
161 : /** returns true when an ole object is currently active
162 : */
163 : bool isUiActive() const;
164 : };
165 :
166 : } //rptui
167 :
168 : #endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_REPORTSECTION_HXX
169 :
170 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|