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 REPORT_REPORTSECTION_HXX
20 : #define REPORT_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 Window
42 : , public ::cppu::BaseMutex
43 : , public ::comphelper::OPropertyChangeListener
44 : , public DropTargetHelper
45 : {
46 : OReportPage* m_pPage;
47 : OSectionView* m_pView;
48 : OSectionWindow* m_pParent;
49 : ::std::auto_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 : sal_Bool m_bDialogModelChanged;
58 : sal_Bool m_bInDrag;
59 :
60 : /** fills the section with all control from the report section
61 : */
62 : void fill();
63 : /** checks all objects if they fit in the new paper width.
64 : */
65 : void impl_adjustObjectSizePosition(sal_Int32 i_nPaperWidth,sal_Int32 i_nLeftMargin,sal_Int32 i_nRightMargin);
66 :
67 : OReportSection(OReportSection&);
68 : void operator =(OReportSection&);
69 : protected:
70 : // DropTargetHelper overridables
71 : virtual sal_Int8 AcceptDrop( const AcceptDropEvent& _rEvt ) SAL_OVERRIDE;
72 : virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& _rEvt ) SAL_OVERRIDE;
73 :
74 : // window overrides
75 : virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
76 : virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
77 : virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
78 : virtual void Resize() SAL_OVERRIDE;
79 :
80 : // OPropertyChangeListener
81 : virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& _rEvent) throw( ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
82 : public:
83 : OReportSection(OSectionWindow* _pParent,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection);
84 : virtual ~OReportSection();
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(sal_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( sal_Bool bChanged = sal_True ) { m_bDialogModelChanged = bChanged; }
124 : sal_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 : sal_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 : void createDefault(const OUString& _sType,SdrObject* _pObj);
155 : void stopScrollTimer();
156 :
157 : /** deactivate the currect 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 // REPORT_REPORTSECTION_HXX
169 :
170 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|