merge the formfield patch from ooo-build
[ooovba.git] / sc / inc / viewuno.hxx
blob15276125780664199b4f5c0860c806f5439184a2
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: viewuno.hxx,v $
10 * $Revision: 1.12.32.2 $
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 #include <sfx2/sfxbasecontroller.hxx>
35 #include <svtools/svarray.hxx>
36 #include <svtools/itemprop.hxx>
37 #include <com/sun/star/view/XFormLayerAccess.hpp>
38 #include <com/sun/star/view/XSelectionChangeListener.hpp>
39 #include <com/sun/star/view/XSelectionSupplier.hpp>
40 #include <com/sun/star/sheet/XCellRangeReferrer.hpp>
41 #include <com/sun/star/sheet/XViewSplitable.hpp>
42 #include <com/sun/star/sheet/XViewFreezable.hpp>
43 #include <com/sun/star/sheet/XSpreadsheetView.hpp>
44 #include <com/sun/star/sheet/XEnhancedMouseClickBroadcaster.hpp>
45 #include <com/sun/star/sheet/XActivationBroadcaster.hpp>
46 #include <com/sun/star/sheet/XViewPane.hpp>
47 #include <com/sun/star/sheet/XRangeSelection.hpp>
48 #include <com/sun/star/lang/XServiceInfo.hpp>
49 #include <com/sun/star/container/XEnumerationAccess.hpp>
50 #include <com/sun/star/beans/XPropertySet.hpp>
51 #include <com/sun/star/lang/XUnoTunnel.hpp>
52 #include <com/sun/star/datatransfer/XTransferableSupplier.hpp>
54 class ScTabViewShell;
56 #define SC_VIEWPANE_ACTIVE 0xFFFF
59 typedef ::com::sun::star::uno::Reference<
60 ::com::sun::star::sheet::XRangeSelectionListener >* XRangeSelectionListenerPtr;
61 SV_DECL_PTRARR_DEL( XRangeSelectionListenerArr_Impl, XRangeSelectionListenerPtr, 4, 4 )
63 typedef ::com::sun::star::uno::Reference<
64 ::com::sun::star::sheet::XRangeSelectionChangeListener >* XRangeSelectionChangeListenerPtr;
65 SV_DECL_PTRARR_DEL( XRangeSelectionChangeListenerArr_Impl, XRangeSelectionChangeListenerPtr, 4, 4 )
67 typedef ::com::sun::star::uno::Reference<
68 ::com::sun::star::view::XSelectionChangeListener >* XSelectionChangeListenerPtr;
69 SV_DECL_PTRARR_DEL( XSelectionChangeListenerArr_Impl, XSelectionChangeListenerPtr, 4, 4 )
71 typedef ::com::sun::star::uno::Reference<
72 ::com::sun::star::beans::XPropertyChangeListener >* XViewPropertyChangeListenerPtr;
73 SV_DECL_PTRARR_DEL( XViewPropertyChangeListenerArr_Impl, XViewPropertyChangeListenerPtr, 4, 4 )
75 typedef ::com::sun::star::uno::Reference<
76 ::com::sun::star::awt::XEnhancedMouseClickHandler >* XMouseClickHandlerPtr;
77 SV_DECL_PTRARR_DEL( XMouseClickHandlerArr_Impl, XMouseClickHandlerPtr, 4, 4 )
79 typedef ::com::sun::star::uno::Reference<
80 ::com::sun::star::sheet::XActivationEventListener >* XActivationEventListenerPtr;
81 SV_DECL_PTRARR_DEL( XActivationEventListenerArr_Impl, XActivationEventListenerPtr, 4, 4 )
84 // ScViewPaneBase not derived from OWeakObject
85 // to avoid duplicate OWeakObject in ScTabViewObj
87 class ScViewPaneBase : public com::sun::star::sheet::XViewPane,
88 public com::sun::star::sheet::XCellRangeReferrer,
89 public com::sun::star::view::XFormLayerAccess,
90 public com::sun::star::lang::XServiceInfo,
91 public com::sun::star::lang::XTypeProvider,
92 public SfxListener
94 private:
95 ScTabViewShell* pViewShell;
96 USHORT nPane; // ScSplitPos oder SC_VIEWPANE_ACTIVE
98 protected:
99 ScTabViewShell* GetViewShell() const { return pViewShell; }
100 ::com::sun::star::awt::Rectangle GetVisArea() const;
102 public:
103 ScViewPaneBase(ScTabViewShell* pViewSh, USHORT nP);
104 virtual ~ScViewPaneBase();
106 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
107 const ::com::sun::star::uno::Type & rType )
108 throw(::com::sun::star::uno::RuntimeException);
110 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
112 // XViewPane
113 virtual sal_Int32 SAL_CALL getFirstVisibleColumn() throw(::com::sun::star::uno::RuntimeException);
114 virtual void SAL_CALL setFirstVisibleColumn( sal_Int32 nFirstVisibleColumn )
115 throw(::com::sun::star::uno::RuntimeException);
116 virtual sal_Int32 SAL_CALL getFirstVisibleRow() throw(::com::sun::star::uno::RuntimeException);
117 virtual void SAL_CALL setFirstVisibleRow( sal_Int32 nFirstVisibleRow )
118 throw(::com::sun::star::uno::RuntimeException);
119 virtual ::com::sun::star::table::CellRangeAddress SAL_CALL getVisibleRange()
120 throw(::com::sun::star::uno::RuntimeException);
122 // XCellRangeReferrer
123 virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL
124 getReferredCells() throw(::com::sun::star::uno::RuntimeException);
126 // XFormLayerAccess
127 virtual ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > SAL_CALL
128 getFormController( const ::com::sun::star::uno::Reference<
129 ::com::sun::star::form::XForm >& Form )
130 throw (::com::sun::star::uno::RuntimeException);
131 virtual ::sal_Bool SAL_CALL
132 isFormDesignMode( )
133 throw (::com::sun::star::uno::RuntimeException);
134 virtual void SAL_CALL setFormDesignMode( ::sal_Bool DesignMode )
135 throw (::com::sun::star::uno::RuntimeException);
137 // XControlAccess
138 virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > SAL_CALL
139 getControl( const ::com::sun::star::uno::Reference<
140 ::com::sun::star::awt::XControlModel >& xModel )
141 throw(::com::sun::star::container::NoSuchElementException,
142 ::com::sun::star::uno::RuntimeException);
144 // XServiceInfo
145 virtual ::rtl::OUString SAL_CALL getImplementationName()
146 throw(::com::sun::star::uno::RuntimeException);
147 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
148 throw(::com::sun::star::uno::RuntimeException);
149 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
150 throw(::com::sun::star::uno::RuntimeException);
152 // XTypeProvider
153 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
154 throw(::com::sun::star::uno::RuntimeException);
155 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
156 throw(::com::sun::star::uno::RuntimeException);
160 // ScViewPaneObj for direct use (including OWeakObject)
162 class ScViewPaneObj : public ScViewPaneBase, public cppu::OWeakObject
164 public:
165 ScViewPaneObj(ScTabViewShell* pViewSh, USHORT nP);
166 virtual ~ScViewPaneObj();
168 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
169 const ::com::sun::star::uno::Type & rType )
170 throw(::com::sun::star::uno::RuntimeException);
171 virtual void SAL_CALL acquire() throw();
172 virtual void SAL_CALL release() throw();
175 // OWeakObject is base of SfxBaseController -> use ScViewPaneBase
177 class ScTabViewObj : public ScViewPaneBase,
178 public SfxBaseController,
179 public com::sun::star::sheet::XSpreadsheetView,
180 public com::sun::star::sheet::XEnhancedMouseClickBroadcaster,
181 public com::sun::star::sheet::XActivationBroadcaster,
182 public com::sun::star::container::XEnumerationAccess,
183 public com::sun::star::container::XIndexAccess,
184 public com::sun::star::view::XSelectionSupplier,
185 public com::sun::star::beans::XPropertySet,
186 public com::sun::star::sheet::XViewSplitable,
187 public com::sun::star::sheet::XViewFreezable,
188 public com::sun::star::sheet::XRangeSelection,
189 public com::sun::star::lang::XUnoTunnel,
190 public com::sun::star::datatransfer::XTransferableSupplier
192 private:
193 SfxItemPropertySet aPropSet;
194 XSelectionChangeListenerArr_Impl aSelectionListeners;
195 XRangeSelectionListenerArr_Impl aRangeSelListeners;
196 XRangeSelectionChangeListenerArr_Impl aRangeChgListeners;
197 XViewPropertyChangeListenerArr_Impl aPropertyChgListeners;
198 XMouseClickHandlerArr_Impl aMouseClickHandlers;
199 XActivationEventListenerArr_Impl aActivationListeners;
200 sal_Bool bDrawSelModeSet;
201 sal_Bool bFilteredRangeSelection;
203 ScViewPaneObj* GetObjectByIndex_Impl(USHORT nIndex) const;
204 INT16 GetZoom(void) const;
205 void SetZoom(INT16 Zoom);
206 INT16 GetZoomType(void) const;
207 void SetZoomType(INT16 ZoomType);
209 com::sun::star::uno::Reference< com::sun::star::uno::XInterface > GetClickedObject(const Point& rPoint) const;
210 void StartMouseListening();
211 void EndMouseListening();
212 void StartActivationListening();
213 void EndActivationListening();
215 ScTabViewObj(); // disabled
216 public:
217 ScTabViewObj(ScTabViewShell* pViewSh);
218 virtual ~ScTabViewObj();
220 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
221 const ::com::sun::star::uno::Type & rType )
222 throw(::com::sun::star::uno::RuntimeException);
223 virtual void SAL_CALL acquire() throw();
224 virtual void SAL_CALL release() throw();
226 void SelectionChanged();
227 void VisAreaChanged();
228 void SheetChanged();
229 sal_Bool IsMouseListening() { return aMouseClickHandlers.Count() > 0; }
230 sal_Bool MousePressed( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
231 sal_Bool MouseReleased( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
233 void RangeSelDone( const String& rText );
234 void RangeSelAborted( const String& rText );
235 void RangeSelChanged( const String& rText );
237 // XSelectionSupplier
238 virtual sal_Bool SAL_CALL select( const ::com::sun::star::uno::Any& aSelection )
239 throw(::com::sun::star::lang::IllegalArgumentException,
240 ::com::sun::star::uno::RuntimeException);
241 virtual ::com::sun::star::uno::Any SAL_CALL getSelection()
242 throw(::com::sun::star::uno::RuntimeException);
243 virtual void SAL_CALL addSelectionChangeListener( const ::com::sun::star::uno::Reference<
244 ::com::sun::star::view::XSelectionChangeListener >& xListener )
245 throw(::com::sun::star::uno::RuntimeException);
246 virtual void SAL_CALL removeSelectionChangeListener( const ::com::sun::star::uno::Reference<
247 ::com::sun::star::view::XSelectionChangeListener >& xListener )
248 throw(::com::sun::star::uno::RuntimeException);
250 //! XPrintable?
252 // XPropertySet
253 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
254 SAL_CALL getPropertySetInfo()
255 throw(::com::sun::star::uno::RuntimeException);
256 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName,
257 const ::com::sun::star::uno::Any& aValue )
258 throw(::com::sun::star::beans::UnknownPropertyException,
259 ::com::sun::star::beans::PropertyVetoException,
260 ::com::sun::star::lang::IllegalArgumentException,
261 ::com::sun::star::lang::WrappedTargetException,
262 ::com::sun::star::uno::RuntimeException);
263 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
264 const ::rtl::OUString& PropertyName )
265 throw(::com::sun::star::beans::UnknownPropertyException,
266 ::com::sun::star::lang::WrappedTargetException,
267 ::com::sun::star::uno::RuntimeException);
268 virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
269 const ::com::sun::star::uno::Reference<
270 ::com::sun::star::beans::XPropertyChangeListener >& xListener )
271 throw(::com::sun::star::beans::UnknownPropertyException,
272 ::com::sun::star::lang::WrappedTargetException,
273 ::com::sun::star::uno::RuntimeException);
274 virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName,
275 const ::com::sun::star::uno::Reference<
276 ::com::sun::star::beans::XPropertyChangeListener >& 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 addVetoableChangeListener( 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);
286 virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName,
287 const ::com::sun::star::uno::Reference<
288 ::com::sun::star::beans::XVetoableChangeListener >& aListener )
289 throw(::com::sun::star::beans::UnknownPropertyException,
290 ::com::sun::star::lang::WrappedTargetException,
291 ::com::sun::star::uno::RuntimeException);
293 // XEnumerationAccess
294 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL
295 createEnumeration() throw(::com::sun::star::uno::RuntimeException);
297 // XIndexAccess
298 virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
299 virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
300 throw(::com::sun::star::lang::IndexOutOfBoundsException,
301 ::com::sun::star::lang::WrappedTargetException,
302 ::com::sun::star::uno::RuntimeException);
304 // XElementAccess
305 virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
306 throw(::com::sun::star::uno::RuntimeException);
307 virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
309 // XSpreadsheetView
310 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheet > SAL_CALL
311 getActiveSheet() throw(::com::sun::star::uno::RuntimeException);
312 virtual void SAL_CALL setActiveSheet( const ::com::sun::star::uno::Reference<
313 ::com::sun::star::sheet::XSpreadsheet >& xActiveSheet )
314 throw(::com::sun::star::uno::RuntimeException);
316 //XEnhancedMouseClickBroadcaster
318 virtual void SAL_CALL addEnhancedMouseClickHandler( const ::com::sun::star::uno::Reference<
319 ::com::sun::star::awt::XEnhancedMouseClickHandler >& aListener )
320 throw (::com::sun::star::uno::RuntimeException);
321 virtual void SAL_CALL removeEnhancedMouseClickHandler( const ::com::sun::star::uno::Reference<
322 ::com::sun::star::awt::XEnhancedMouseClickHandler >& aListener )
323 throw (::com::sun::star::uno::RuntimeException);
325 //XActivationBroadcaster
327 virtual void SAL_CALL addActivationEventListener( const ::com::sun::star::uno::Reference<
328 ::com::sun::star::sheet::XActivationEventListener >& aListener )
329 throw (::com::sun::star::uno::RuntimeException);
330 virtual void SAL_CALL removeActivationEventListener( const ::com::sun::star::uno::Reference<
331 ::com::sun::star::sheet::XActivationEventListener >& aListener )
332 throw (::com::sun::star::uno::RuntimeException);
334 // XViewSplitable
335 virtual sal_Bool SAL_CALL getIsWindowSplit() throw(::com::sun::star::uno::RuntimeException);
336 virtual sal_Int32 SAL_CALL getSplitHorizontal() throw(::com::sun::star::uno::RuntimeException);
337 virtual sal_Int32 SAL_CALL getSplitVertical() throw(::com::sun::star::uno::RuntimeException);
338 virtual sal_Int32 SAL_CALL getSplitColumn() throw(::com::sun::star::uno::RuntimeException);
339 virtual sal_Int32 SAL_CALL getSplitRow() throw(::com::sun::star::uno::RuntimeException);
340 virtual void SAL_CALL splitAtPosition( sal_Int32 nPixelX, sal_Int32 nPixelY )
341 throw(::com::sun::star::uno::RuntimeException);
343 // XViewFreezable
344 virtual sal_Bool SAL_CALL hasFrozenPanes() throw(::com::sun::star::uno::RuntimeException);
345 virtual void SAL_CALL freezeAtPosition( sal_Int32 nColumns, sal_Int32 nRows )
346 throw(::com::sun::star::uno::RuntimeException);
348 // XRangeSelection
349 virtual void SAL_CALL startRangeSelection( const ::com::sun::star::uno::Sequence<
350 ::com::sun::star::beans::PropertyValue >& aArguments )
351 throw(::com::sun::star::uno::RuntimeException);
352 virtual void SAL_CALL abortRangeSelection() throw(::com::sun::star::uno::RuntimeException);
353 virtual void SAL_CALL addRangeSelectionListener( const ::com::sun::star::uno::Reference<
354 ::com::sun::star::sheet::XRangeSelectionListener >& aListener )
355 throw(::com::sun::star::uno::RuntimeException);
356 virtual void SAL_CALL removeRangeSelectionListener( const ::com::sun::star::uno::Reference<
357 ::com::sun::star::sheet::XRangeSelectionListener >& aListener )
358 throw(::com::sun::star::uno::RuntimeException);
359 virtual void SAL_CALL addRangeSelectionChangeListener( const ::com::sun::star::uno::Reference<
360 ::com::sun::star::sheet::XRangeSelectionChangeListener >& aListener )
361 throw(::com::sun::star::uno::RuntimeException);
362 virtual void SAL_CALL removeRangeSelectionChangeListener( const ::com::sun::star::uno::Reference<
363 ::com::sun::star::sheet::XRangeSelectionChangeListener >& aListener )
364 throw(::com::sun::star::uno::RuntimeException);
366 // XServiceInfo
367 virtual ::rtl::OUString SAL_CALL getImplementationName()
368 throw(::com::sun::star::uno::RuntimeException);
369 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
370 throw(::com::sun::star::uno::RuntimeException);
371 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
372 throw(::com::sun::star::uno::RuntimeException);
374 // XUnoTunnel
375 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence<
376 sal_Int8 >& aIdentifier )
377 throw(::com::sun::star::uno::RuntimeException);
379 static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId();
380 static ScTabViewObj* getImplementation( const com::sun::star::uno::Reference<
381 com::sun::star::uno::XInterface> xObj );
383 // XTypeProvider
384 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
385 throw(::com::sun::star::uno::RuntimeException);
386 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
387 throw(::com::sun::star::uno::RuntimeException);
389 //XTransferableSupplier
390 virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > SAL_CALL getTransferable( ) throw (::com::sun::star::uno::RuntimeException);
391 virtual void SAL_CALL insertTransferable( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTrans ) throw (::com::sun::star::datatransfer::UnsupportedFlavorException, ::com::sun::star::uno::RuntimeException);
395 #endif