1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: viewuno.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_VIEWUNO_HXX
32 #define SC_VIEWUNO_HXX
34 #ifndef _SFX_SFXBASECONTROLLER_HXX_
35 #include <bf_sfx2/sfxbasecontroller.hxx>
39 #include <bf_svtools/svarray.hxx>
42 #ifndef _SFX_ITEMPROP_HXX
43 #include <bf_svtools/itemprop.hxx>
46 #ifndef _COM_SUN_STAR_VIEW_XCONTROLACCESS_HPP_
47 #include <com/sun/star/view/XControlAccess.hpp>
49 #ifndef _COM_SUN_STAR_VIEW_XSELECTIONCHANGELISTENER_HPP_
50 #include <com/sun/star/view/XSelectionChangeListener.hpp>
52 #ifndef _COM_SUN_STAR_VIEW_XSELECTIONSUPPLIER_HPP_
53 #include <com/sun/star/view/XSelectionSupplier.hpp>
55 #ifndef _COM_SUN_STAR_SHEET_XCELLRANGEREFERRER_HPP_
56 #include <com/sun/star/sheet/XCellRangeReferrer.hpp>
58 #ifndef _COM_SUN_STAR_SHEET_XVIEWSPLITABLE_HPP_
59 #include <com/sun/star/sheet/XViewSplitable.hpp>
61 #ifndef _COM_SUN_STAR_SHEET_XVIEWFREEZABLE_HPP_
62 #include <com/sun/star/sheet/XViewFreezable.hpp>
64 #ifndef _COM_SUN_STAR_SHEET_XSPREADSHEETVIEW_HPP_
65 #include <com/sun/star/sheet/XSpreadsheetView.hpp>
67 #ifndef _COM_SUN_STAR_SHEET_XVIEWPANE_HPP_
68 #include <com/sun/star/sheet/XViewPane.hpp>
70 #ifndef _COM_SUN_STAR_SHEET_XRANGESELECTION_HPP_
71 #include <com/sun/star/sheet/XRangeSelection.hpp>
73 #ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
74 #include <com/sun/star/lang/XServiceInfo.hpp>
76 #ifndef _COM_SUN_STAR_CONTAINER_XENUMERATIONACCESS_HPP_
77 #include <com/sun/star/container/XEnumerationAccess.hpp>
79 #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
80 #include <com/sun/star/beans/XPropertySet.hpp>
82 #ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
83 #include <com/sun/star/lang/XUnoTunnel.hpp>
89 #define SC_VIEWPANE_ACTIVE 0xFFFF
92 typedef ::com::sun::star::uno::Reference
<
93 ::com::sun::star::sheet::XRangeSelectionListener
>* XRangeSelectionListenerPtr
;
94 SV_DECL_PTRARR_DEL( XRangeSelectionListenerArr_Impl
, XRangeSelectionListenerPtr
, 4, 4 )//STRIP008 ;
96 typedef ::com::sun::star::uno::Reference
<
97 ::com::sun::star::sheet::XRangeSelectionChangeListener
>* XRangeSelectionChangeListenerPtr
;
98 SV_DECL_PTRARR_DEL( XRangeSelectionChangeListenerArr_Impl
, XRangeSelectionChangeListenerPtr
, 4, 4 )//STRIP008 ;
100 typedef ::com::sun::star::uno::Reference
<
101 ::com::sun::star::view::XSelectionChangeListener
>* XSelectionChangeListenerPtr
;
102 SV_DECL_PTRARR_DEL( XSelectionChangeListenerArr_Impl
, XSelectionChangeListenerPtr
, 4, 4 )//STRIP008 ;
104 typedef ::com::sun::star::uno::Reference
<
105 ::com::sun::star::beans::XPropertyChangeListener
>* XViewPropertyChangeListenerPtr
;
106 SV_DECL_PTRARR_DEL( XViewPropertyChangeListenerArr_Impl
, XViewPropertyChangeListenerPtr
, 4, 4 )//STRIP008 ;
109 // ScViewPaneBase not derived from OWeakObject
110 // to avoid duplicate OWeakObject in ScTabViewObj
112 class ScViewPaneBase
: public ::com::sun::star::sheet::XViewPane
,
113 public ::com::sun::star::sheet::XCellRangeReferrer
,
114 public ::com::sun::star::view::XControlAccess
,
115 public ::com::sun::star::lang::XServiceInfo
,
116 public ::com::sun::star::lang::XTypeProvider
,
120 ScTabViewShell
* pViewShell
;
121 USHORT nPane
; // ScSplitPos oder SC_VIEWPANE_ACTIVE
124 ScTabViewShell
* GetViewShell() const { return pViewShell
; }
125 ::com::sun::star::awt::Rectangle
GetVisArea() const;
128 ScViewPaneBase(ScTabViewShell
* pViewSh
, USHORT nP
);
129 virtual ~ScViewPaneBase();
131 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface(
132 const ::com::sun::star::uno::Type
& rType
)
133 throw(::com::sun::star::uno::RuntimeException
);
135 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
138 virtual sal_Int32 SAL_CALL
getFirstVisibleColumn() throw(::com::sun::star::uno::RuntimeException
);
139 virtual void SAL_CALL
setFirstVisibleColumn( sal_Int32 nFirstVisibleColumn
)
140 throw(::com::sun::star::uno::RuntimeException
);
141 virtual sal_Int32 SAL_CALL
getFirstVisibleRow() throw(::com::sun::star::uno::RuntimeException
);
142 virtual void SAL_CALL
setFirstVisibleRow( sal_Int32 nFirstVisibleRow
)
143 throw(::com::sun::star::uno::RuntimeException
);
144 virtual ::com::sun::star::table::CellRangeAddress SAL_CALL
getVisibleRange()
145 throw(::com::sun::star::uno::RuntimeException
);
147 // XCellRangeReferrer
148 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::table::XCellRange
> SAL_CALL
149 getReferredCells() throw(::com::sun::star::uno::RuntimeException
);
152 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControl
> SAL_CALL
153 getControl( const ::com::sun::star::uno::Reference
<
154 ::com::sun::star::awt::XControlModel
>& xModel
)
155 throw(::com::sun::star::container::NoSuchElementException
,
156 ::com::sun::star::uno::RuntimeException
);
159 virtual ::rtl::OUString SAL_CALL
getImplementationName()
160 throw(::com::sun::star::uno::RuntimeException
);
161 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
162 throw(::com::sun::star::uno::RuntimeException
);
163 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames()
164 throw(::com::sun::star::uno::RuntimeException
);
167 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes()
168 throw(::com::sun::star::uno::RuntimeException
);
169 virtual ::com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId()
170 throw(::com::sun::star::uno::RuntimeException
);
174 // ScViewPaneObj for direct use (including OWeakObject)
176 class ScViewPaneObj
: public ScViewPaneBase
, public cppu::OWeakObject
179 ScViewPaneObj(ScTabViewShell
* pViewSh
, USHORT nP
);
180 virtual ~ScViewPaneObj();
182 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface(
183 const ::com::sun::star::uno::Type
& rType
)
184 throw(::com::sun::star::uno::RuntimeException
);
185 virtual void SAL_CALL
acquire() throw();
186 virtual void SAL_CALL
release() throw();
190 // OWeakObject is base of SfxBaseController -> use ScViewPaneBase
192 class ScTabViewObj
: public ScViewPaneBase
,
193 public SfxBaseController
,
194 public ::com::sun::star::sheet::XSpreadsheetView
,
195 public ::com::sun::star::container::XEnumerationAccess
,
196 public ::com::sun::star::container::XIndexAccess
,
197 public ::com::sun::star::view::XSelectionSupplier
,
198 public ::com::sun::star::beans::XPropertySet
,
199 public ::com::sun::star::sheet::XViewSplitable
,
200 public ::com::sun::star::sheet::XViewFreezable
,
201 public ::com::sun::star::sheet::XRangeSelection
,
202 public ::com::sun::star::lang::XUnoTunnel
205 SfxItemPropertySet aPropSet
;
206 XSelectionChangeListenerArr_Impl aSelectionListeners
;
207 XRangeSelectionListenerArr_Impl aRangeSelListeners
;
208 XRangeSelectionChangeListenerArr_Impl aRangeChgListeners
;
209 XViewPropertyChangeListenerArr_Impl aPropertyChgListeners
;
210 sal_Bool bDrawSelModeSet
;
212 ScViewPaneObj
* GetObjectByIndex_Impl(USHORT nIndex
) const;
213 INT16
GetZoom(void) const;
214 void SetZoom(INT16 Zoom
);
215 INT16
GetZoomType(void) const;
216 void SetZoomType(INT16 ZoomType
);
219 ScTabViewObj(ScTabViewShell
* pViewSh
);
220 virtual ~ScTabViewObj();
222 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface(
223 const ::com::sun::star::uno::Type
& rType
)
224 throw(::com::sun::star::uno::RuntimeException
);
225 virtual void SAL_CALL
acquire() throw();
226 virtual void SAL_CALL
release() throw();
228 void SelectionChanged();
229 void VisAreaChanged();
231 // XSelectionSupplier
232 virtual sal_Bool SAL_CALL
select( const ::com::sun::star::uno::Any
& aSelection
)
233 throw(::com::sun::star::lang::IllegalArgumentException
,
234 ::com::sun::star::uno::RuntimeException
);
235 virtual ::com::sun::star::uno::Any SAL_CALL
getSelection()
236 throw(::com::sun::star::uno::RuntimeException
);
237 virtual void SAL_CALL
addSelectionChangeListener( const ::com::sun::star::uno::Reference
<
238 ::com::sun::star::view::XSelectionChangeListener
>& xListener
)
239 throw(::com::sun::star::uno::RuntimeException
);
240 virtual void SAL_CALL
removeSelectionChangeListener( const ::com::sun::star::uno::Reference
<
241 ::com::sun::star::view::XSelectionChangeListener
>& xListener
)
242 throw(::com::sun::star::uno::RuntimeException
);
247 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
>
248 SAL_CALL
getPropertySetInfo()
249 throw(::com::sun::star::uno::RuntimeException
);
250 virtual void SAL_CALL
setPropertyValue( const ::rtl::OUString
& aPropertyName
,
251 const ::com::sun::star::uno::Any
& aValue
)
252 throw(::com::sun::star::beans::UnknownPropertyException
,
253 ::com::sun::star::beans::PropertyVetoException
,
254 ::com::sun::star::lang::IllegalArgumentException
,
255 ::com::sun::star::lang::WrappedTargetException
,
256 ::com::sun::star::uno::RuntimeException
);
257 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(
258 const ::rtl::OUString
& PropertyName
)
259 throw(::com::sun::star::beans::UnknownPropertyException
,
260 ::com::sun::star::lang::WrappedTargetException
,
261 ::com::sun::star::uno::RuntimeException
);
262 virtual void SAL_CALL
addPropertyChangeListener( const ::rtl::OUString
& aPropertyName
,
263 const ::com::sun::star::uno::Reference
<
264 ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
265 throw(::com::sun::star::beans::UnknownPropertyException
,
266 ::com::sun::star::lang::WrappedTargetException
,
267 ::com::sun::star::uno::RuntimeException
);
268 virtual void SAL_CALL
removePropertyChangeListener( const ::rtl::OUString
& aPropertyName
,
269 const ::com::sun::star::uno::Reference
<
270 ::com::sun::star::beans::XPropertyChangeListener
>& aListener
)
271 throw(::com::sun::star::beans::UnknownPropertyException
,
272 ::com::sun::star::lang::WrappedTargetException
,
273 ::com::sun::star::uno::RuntimeException
);
274 virtual void SAL_CALL
addVetoableChangeListener( const ::rtl::OUString
& PropertyName
,
275 const ::com::sun::star::uno::Reference
<
276 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
277 throw(::com::sun::star::beans::UnknownPropertyException
,
278 ::com::sun::star::lang::WrappedTargetException
,
279 ::com::sun::star::uno::RuntimeException
);
280 virtual void SAL_CALL
removeVetoableChangeListener( const ::rtl::OUString
& PropertyName
,
281 const ::com::sun::star::uno::Reference
<
282 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
283 throw(::com::sun::star::beans::UnknownPropertyException
,
284 ::com::sun::star::lang::WrappedTargetException
,
285 ::com::sun::star::uno::RuntimeException
);
287 // XEnumerationAccess
288 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XEnumeration
> SAL_CALL
289 createEnumeration() throw(::com::sun::star::uno::RuntimeException
);
292 virtual sal_Int32 SAL_CALL
getCount() throw(::com::sun::star::uno::RuntimeException
);
293 virtual ::com::sun::star::uno::Any SAL_CALL
getByIndex( sal_Int32 Index
)
294 throw(::com::sun::star::lang::IndexOutOfBoundsException
,
295 ::com::sun::star::lang::WrappedTargetException
,
296 ::com::sun::star::uno::RuntimeException
);
299 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
300 throw(::com::sun::star::uno::RuntimeException
);
301 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
);
304 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::sheet::XSpreadsheet
> SAL_CALL
305 getActiveSheet() throw(::com::sun::star::uno::RuntimeException
);
306 virtual void SAL_CALL
setActiveSheet( const ::com::sun::star::uno::Reference
<
307 ::com::sun::star::sheet::XSpreadsheet
>& xActiveSheet
)
308 throw(::com::sun::star::uno::RuntimeException
);
311 virtual sal_Bool SAL_CALL
getIsWindowSplit() throw(::com::sun::star::uno::RuntimeException
);
312 virtual sal_Int32 SAL_CALL
getSplitHorizontal() throw(::com::sun::star::uno::RuntimeException
);
313 virtual sal_Int32 SAL_CALL
getSplitVertical() throw(::com::sun::star::uno::RuntimeException
);
314 virtual sal_Int32 SAL_CALL
getSplitColumn() throw(::com::sun::star::uno::RuntimeException
);
315 virtual sal_Int32 SAL_CALL
getSplitRow() throw(::com::sun::star::uno::RuntimeException
);
316 virtual void SAL_CALL
splitAtPosition( sal_Int32 nPixelX
, sal_Int32 nPixelY
)
317 throw(::com::sun::star::uno::RuntimeException
);
320 virtual sal_Bool SAL_CALL
hasFrozenPanes() throw(::com::sun::star::uno::RuntimeException
);
321 virtual void SAL_CALL
freezeAtPosition( sal_Int32 nColumns
, sal_Int32 nRows
)
322 throw(::com::sun::star::uno::RuntimeException
);
325 virtual void SAL_CALL
startRangeSelection( const ::com::sun::star::uno::Sequence
<
326 ::com::sun::star::beans::PropertyValue
>& aArguments
)
327 throw(::com::sun::star::uno::RuntimeException
);
328 virtual void SAL_CALL
abortRangeSelection() throw(::com::sun::star::uno::RuntimeException
);
329 virtual void SAL_CALL
addRangeSelectionListener( const ::com::sun::star::uno::Reference
<
330 ::com::sun::star::sheet::XRangeSelectionListener
>& aListener
)
331 throw(::com::sun::star::uno::RuntimeException
);
332 virtual void SAL_CALL
removeRangeSelectionListener( const ::com::sun::star::uno::Reference
<
333 ::com::sun::star::sheet::XRangeSelectionListener
>& aListener
)
334 throw(::com::sun::star::uno::RuntimeException
);
335 virtual void SAL_CALL
addRangeSelectionChangeListener( const ::com::sun::star::uno::Reference
<
336 ::com::sun::star::sheet::XRangeSelectionChangeListener
>& aListener
)
337 throw(::com::sun::star::uno::RuntimeException
);
338 virtual void SAL_CALL
removeRangeSelectionChangeListener( const ::com::sun::star::uno::Reference
<
339 ::com::sun::star::sheet::XRangeSelectionChangeListener
>& aListener
)
340 throw(::com::sun::star::uno::RuntimeException
);
343 virtual ::rtl::OUString SAL_CALL
getImplementationName()
344 throw(::com::sun::star::uno::RuntimeException
);
345 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
346 throw(::com::sun::star::uno::RuntimeException
);
347 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames()
348 throw(::com::sun::star::uno::RuntimeException
);
351 virtual sal_Int64 SAL_CALL
getSomething( const ::com::sun::star::uno::Sequence
<
352 sal_Int8
>& aIdentifier
)
353 throw(::com::sun::star::uno::RuntimeException
);
355 static const ::com::sun::star::uno::Sequence
<sal_Int8
>& getUnoTunnelId();
356 static ScTabViewObj
* getImplementation( const ::com::sun::star::uno::Reference
<
357 ::com::sun::star::uno::XInterface
> xObj
);
360 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes()
361 throw(::com::sun::star::uno::RuntimeException
);
362 virtual ::com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId()
363 throw(::com::sun::star::uno::RuntimeException
);
367 } //namespace binfilter