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_UITOOLS_HXX
20 : #define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_UITOOLS_HXX
21 :
22 : #include <com/sun/star/report/XGroup.hpp>
23 : #include <com/sun/star/report/XReportControlFormat.hpp>
24 : #include <com/sun/star/report/XShape.hpp>
25 : #include <com/sun/star/awt/XWindow.hpp>
26 : #include <com/sun/star/beans/NamedValue.hpp>
27 : #include <com/sun/star/container/XIndexAccess.hpp>
28 : #include <com/sun/star/sdbc/XRowSet.hpp>
29 : #include <com/sun/star/uno/XComponentContext.hpp>
30 : #include "ReportSection.hxx"
31 : #include <rtl/ref.hxx>
32 : #include <vcl/taskpanelist.hxx>
33 : #include <comphelper/stl_types.hxx>
34 : #include <functional>
35 :
36 : class SdrPage;
37 : class SdrObject;
38 : class SdrUnoObj;
39 : class SdrView;
40 : class Rectangle;
41 : namespace comphelper
42 : {
43 : class OPropertyChangeMultiplexer;
44 : class OPropertyChangeListener;
45 : }
46 : namespace rptui
47 : {
48 : /** returns the position of the object inside the index container
49 : @param _xReportDefinition the report definition to get the groups
50 : @param _xGroup the group to search
51 : @return returns the position of the group in the list, otherwise -1
52 : */
53 0 : template<typename T> sal_Int32 getPositionInIndexAccess(
54 : const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& _xCollection
55 : ,const ::com::sun::star::uno::Reference< T >& _xSearch)
56 : {
57 0 : sal_Int32 nCount = _xCollection->getCount();
58 0 : sal_Int32 i = (nCount == 0) ? -1 : 0;
59 0 : for (;i<nCount ; ++i)
60 : {
61 0 : ::com::sun::star::uno::Reference< T > xObject(_xCollection->getByIndex(i),::com::sun::star::uno::UNO_QUERY);
62 0 : if ( xObject == _xSearch )
63 0 : break;
64 : }
65 0 : return i;
66 : }
67 :
68 : /** set the name of the header and footer of the group by the expression appended by the localized name of the section
69 : @param _xGroup the group where the header/footer name is set by the expression of the group
70 : */
71 : void adjustSectionName(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup >& _xGroup,sal_Int32 _nPos);
72 :
73 : /** add a listener for the properties size, left margin, right margin to the page style
74 : *
75 : * \param _xReportDefinition
76 : * \param _pListener
77 : * \return
78 : */
79 : ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> addStyleListener( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition >& _xReportDefinition
80 : ,::comphelper::OPropertyChangeListener* _pListener);
81 :
82 : /** opens the common character font dialog
83 : */
84 : bool openCharDialog(
85 : const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportControlFormat>& _xReportControlFormat,
86 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& _xWindow,
87 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _out_rNewValues
88 : );
89 :
90 : /** opens the area dialog for shapes
91 : */
92 : bool openAreaDialog(
93 : const ::com::sun::star::uno::Reference< ::com::sun::star::report::XShape >& _xShape
94 : ,const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& _xWindow
95 : );
96 :
97 : /** opens the formula dialog
98 : @param _out_rFormula
99 : the formula chosen by the user
100 : @precond
101 : we're really inspecting a database report (well, a RowSet at least)
102 : @return
103 : <TRUE/> if and only if the user successfully chose a clause
104 : */
105 : bool openDialogFormula_nothrow( OUString& _in_out_rFormula
106 : , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _xContext
107 : , const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& _xWindow
108 : , const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet >& _xRowSet
109 : );
110 :
111 : /** applies the character settings previously obtained via openCharDialog
112 : */
113 : void applyCharacterSettings(
114 : const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportControlFormat >& _rxReportControlFormat,
115 : const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _rSettings
116 : );
117 :
118 : /** notifySystemWindow adds or remove the given window _pToRegister at the Systemwindow found when search _pWindow.
119 : @param _pWindow
120 : The window which is used to search for the SystemWindow.
121 : @param _pToRegister
122 : The window which should be added or removed on the TaskPaneList.
123 : @param _rMemFunc
124 : The member function which should be called at the SystemWindow when found.
125 : Possible values are:
126 : ::comphelper::mem_fun(&TaskPaneList::AddWindow)
127 : ::comphelper::mem_fun(&TaskPaneList::RemoveWindow)
128 : */
129 : void notifySystemWindow(::vcl::Window* _pWindow, ::vcl::Window* _pToRegister, ::comphelper::mem_fun1_t<TaskPaneList, ::vcl::Window*> _rMemFunc);
130 :
131 :
132 : const sal_Int16 ISOVER_IGNORE_CUSTOMSHAPES = 1;
133 :
134 : /** checks whether the given rectangle overlapps another OUnoObject object in that view.
135 : *
136 : * \param _rRect
137 : * \param _rPage
138 : * \param _bAllObjects if <TRUE/> all objects are taken into account, otherwise only not marked ones
139 : * \return the object which is overlapped, otherwise <NULL/>
140 : */
141 : SdrObject* isOver(const Rectangle& _rRect,SdrPage& _rPage,SdrView& _rView,bool _bAllObjects = false,SdrObject* _pIgnore = NULL, sal_Int16 _nIgnoreType=0);
142 :
143 : SdrObject* isOver(const Rectangle& _rRect,SdrPage& _rPage,SdrView& _rView,bool _bAllObjects, SdrUnoObj* _pIgnoreList[], int _nIgnoreListLength);
144 :
145 : /** checks whether the given OUnoObject object rectangle overlapps another object in that view.
146 : *
147 : * \param _pObj
148 : * \param _rPage
149 : * \param _rView
150 : * \param _bAllObjects if <TRUE/> all objects are taken into account, otherwise only not marked ones
151 : * \return the object which is overlapped, otherwise <NULL/>. If the given object is not of type OUnoObject <NULL/> will be returned.
152 : */
153 : SdrObject* isOver(SdrObject* _pObj,SdrPage& _rPage,SdrView& _rView,bool _bAllObjects = false);
154 :
155 : /** retrieves the names of the parameters of the command which the given RowSet is bound to
156 : */
157 : ::com::sun::star::uno::Sequence< OUString >
158 : getParameterNames( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& _rxRowSet );
159 :
160 : /** ensures that no control overlaps the given one.
161 : *
162 : * \param pControl the control which should place in the section without overlapping
163 : * \param _pReportSection the section
164 : * \param _bInsert sal_True whe the control should be inserted, otherwise not.
165 : */
166 : void correctOverlapping(SdrObject* pControl,OReportSection& _aReportSection,bool _bInsert = true);
167 :
168 : /** returns a Rectangle of a given SdrObject
169 : *
170 : * \param pControl the SdrObject
171 : */
172 :
173 : Rectangle getRectangleFromControl(SdrObject* pControl);
174 :
175 : /** sets the map mode at the window
176 : @param _aZoom the zoom scale
177 : @param _rWindow where to set the map mode
178 : */
179 : void setZoomFactor(const Fraction& _aZoom, ::vcl::Window& _rWindow);
180 : }
181 : #endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_UITOOLS_HXX
182 :
183 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|