Impress Remote 1.0.5, tag sdremote-1.0.5
[LibreOffice.git] / sc / inc / viewuno.hxx
blobda2f96c152a460f7b6359cc55cf032ce855e904d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef SC_VIEWUNO_HXX
21 #define SC_VIEWUNO_HXX
23 #include <sfx2/sfxbasecontroller.hxx>
24 #include <svl/itemprop.hxx>
25 #include <com/sun/star/view/XFormLayerAccess.hpp>
26 #include <com/sun/star/view/XSelectionChangeListener.hpp>
27 #include <com/sun/star/view/XSelectionSupplier.hpp>
28 #include <com/sun/star/sheet/XCellRangeReferrer.hpp>
29 #include <com/sun/star/sheet/XViewSplitable.hpp>
30 #include <com/sun/star/sheet/XViewFreezable.hpp>
31 #include <com/sun/star/sheet/XSelectedSheetsSupplier.hpp>
32 #include <com/sun/star/sheet/XSpreadsheetView.hpp>
33 #include <com/sun/star/sheet/XEnhancedMouseClickBroadcaster.hpp>
34 #include <com/sun/star/sheet/XActivationBroadcaster.hpp>
35 #include <com/sun/star/sheet/XViewPane.hpp>
36 #include <com/sun/star/sheet/XRangeSelection.hpp>
37 #include <com/sun/star/lang/XServiceInfo.hpp>
38 #include <com/sun/star/container/XEnumerationAccess.hpp>
39 #include <com/sun/star/beans/XPropertySet.hpp>
40 #include <com/sun/star/lang/XUnoTunnel.hpp>
41 #include <com/sun/star/datatransfer/XTransferableSupplier.hpp>
43 #include "address.hxx"
44 #include "boost/ptr_container/ptr_vector.hpp"
46 class ScTabViewShell;
47 class ScPreviewShell;
49 #define SC_VIEWPANE_ACTIVE 0xFFFF
51 // ScViewPaneBase not derived from OWeakObject
52 // to avoid duplicate OWeakObject in ScTabViewObj
54 class ScViewPaneBase : public com::sun::star::sheet::XViewPane,
55 public com::sun::star::sheet::XCellRangeReferrer,
56 public com::sun::star::view::XFormLayerAccess,
57 public com::sun::star::lang::XServiceInfo,
58 public com::sun::star::lang::XTypeProvider,
59 public SfxListener
61 private:
62 ScTabViewShell* pViewShell;
63 sal_uInt16 nPane; // ScSplitPos oder SC_VIEWPANE_ACTIVE
65 protected:
66 ::com::sun::star::awt::Rectangle GetVisArea() const;
68 public:
69 ScViewPaneBase(ScTabViewShell* pViewSh, sal_uInt16 nP);
70 virtual ~ScViewPaneBase();
72 ScTabViewShell* GetViewShell() const { return pViewShell; }
74 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
75 const ::com::sun::star::uno::Type & rType )
76 throw(::com::sun::star::uno::RuntimeException);
78 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
80 // XViewPane
81 virtual sal_Int32 SAL_CALL getFirstVisibleColumn() throw(::com::sun::star::uno::RuntimeException);
82 virtual void SAL_CALL setFirstVisibleColumn( sal_Int32 nFirstVisibleColumn )
83 throw(::com::sun::star::uno::RuntimeException);
84 virtual sal_Int32 SAL_CALL getFirstVisibleRow() throw(::com::sun::star::uno::RuntimeException);
85 virtual void SAL_CALL setFirstVisibleRow( sal_Int32 nFirstVisibleRow )
86 throw(::com::sun::star::uno::RuntimeException);
87 virtual ::com::sun::star::table::CellRangeAddress SAL_CALL getVisibleRange()
88 throw(::com::sun::star::uno::RuntimeException);
90 // XCellRangeReferrer
91 virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL
92 getReferredCells() throw(::com::sun::star::uno::RuntimeException);
94 // XFormLayerAccess
95 virtual ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > SAL_CALL
96 getFormController( const ::com::sun::star::uno::Reference<
97 ::com::sun::star::form::XForm >& Form )
98 throw (::com::sun::star::uno::RuntimeException);
99 virtual ::sal_Bool SAL_CALL
100 isFormDesignMode( )
101 throw (::com::sun::star::uno::RuntimeException);
102 virtual void SAL_CALL setFormDesignMode( ::sal_Bool DesignMode )
103 throw (::com::sun::star::uno::RuntimeException);
105 // XControlAccess
106 virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > SAL_CALL
107 getControl( const ::com::sun::star::uno::Reference<
108 ::com::sun::star::awt::XControlModel >& xModel )
109 throw(::com::sun::star::container::NoSuchElementException,
110 ::com::sun::star::uno::RuntimeException);
112 // XServiceInfo
113 virtual ::rtl::OUString SAL_CALL getImplementationName()
114 throw(::com::sun::star::uno::RuntimeException);
115 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
116 throw(::com::sun::star::uno::RuntimeException);
117 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
118 throw(::com::sun::star::uno::RuntimeException);
120 // XTypeProvider
121 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
122 throw(::com::sun::star::uno::RuntimeException);
123 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
124 throw(::com::sun::star::uno::RuntimeException);
128 // ScViewPaneObj for direct use (including OWeakObject)
130 class ScViewPaneObj : public ScViewPaneBase, public cppu::OWeakObject
132 public:
133 ScViewPaneObj(ScTabViewShell* pViewSh, sal_uInt16 nP);
134 virtual ~ScViewPaneObj();
136 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
137 const ::com::sun::star::uno::Type & rType )
138 throw(::com::sun::star::uno::RuntimeException);
139 virtual void SAL_CALL acquire() throw();
140 virtual void SAL_CALL release() throw();
143 // OWeakObject is base of SfxBaseController -> use ScViewPaneBase
145 class ScTabViewObj : public ScViewPaneBase,
146 public SfxBaseController,
147 public com::sun::star::sheet::XSpreadsheetView,
148 public com::sun::star::sheet::XEnhancedMouseClickBroadcaster,
149 public com::sun::star::sheet::XActivationBroadcaster,
150 public com::sun::star::container::XEnumerationAccess,
151 public com::sun::star::container::XIndexAccess,
152 public com::sun::star::view::XSelectionSupplier,
153 public com::sun::star::beans::XPropertySet,
154 public com::sun::star::sheet::XViewSplitable,
155 public com::sun::star::sheet::XViewFreezable,
156 public com::sun::star::sheet::XRangeSelection,
157 public com::sun::star::lang::XUnoTunnel,
158 public com::sun::star::datatransfer::XTransferableSupplier,
159 public com::sun::star::sheet::XSelectedSheetsSupplier
161 private:
162 typedef ::com::sun::star::uno::Reference<
163 ::com::sun::star::sheet::XRangeSelectionListener > XRangeSelectionListenerUnoRef;
164 typedef boost::ptr_vector<XRangeSelectionListenerUnoRef> XRangeSelectionListenerVector;
166 typedef ::com::sun::star::uno::Reference<
167 ::com::sun::star::sheet::XRangeSelectionChangeListener > XRangeSelectionChangeListenerUnoRef;
168 typedef boost::ptr_vector<XRangeSelectionChangeListenerUnoRef> XRangeSelectionChangeListenerVector;
170 typedef ::com::sun::star::uno::Reference<
171 ::com::sun::star::view::XSelectionChangeListener > XSelectionChangeListenerUnoRef;
172 typedef boost::ptr_vector<XSelectionChangeListenerUnoRef> XSelectionChangeListenerVector;
174 typedef ::com::sun::star::uno::Reference<
175 ::com::sun::star::beans::XPropertyChangeListener > XViewPropertyChangeListenerUnoRef;
176 typedef boost::ptr_vector<XViewPropertyChangeListenerUnoRef> XViewPropertyChangeListenerVector;
178 typedef ::com::sun::star::uno::Reference<
179 ::com::sun::star::awt::XEnhancedMouseClickHandler > XMouseClickHandlerUnoRef;
180 typedef boost::ptr_vector<XMouseClickHandlerUnoRef> XMouseClickHandlerVector;
182 typedef ::com::sun::star::uno::Reference<
183 ::com::sun::star::sheet::XActivationEventListener > XActivationEventListenerUnoRef;
184 typedef boost::ptr_vector<XActivationEventListenerUnoRef> XActivationEventListenerVector;
186 SfxItemPropertySet aPropSet;
187 XSelectionChangeListenerVector aSelectionChgListeners;
188 XRangeSelectionListenerVector aRangeSelListeners;
189 XRangeSelectionChangeListenerVector aRangeChgListeners;
190 XViewPropertyChangeListenerVector aPropertyChgListeners;
191 XMouseClickHandlerVector aMouseClickHandlers;
192 XActivationEventListenerVector aActivationListeners;
193 SCTAB nPreviousTab;
194 sal_Bool bDrawSelModeSet;
195 sal_Bool bFilteredRangeSelection;
197 ScViewPaneObj* GetObjectByIndex_Impl(sal_uInt16 nIndex) const;
198 sal_Int16 GetZoom(void) const;
199 void SetZoom(sal_Int16 Zoom);
200 sal_Int16 GetZoomType(void) const;
201 void SetZoomType(sal_Int16 ZoomType);
203 com::sun::star::uno::Reference< com::sun::star::uno::XInterface > GetClickedObject(const Point& rPoint) const;
204 void StartMouseListening();
205 void EndMouseListening();
206 void StartActivationListening();
207 void EndActivationListening();
209 ScTabViewObj(); // disabled
210 public:
211 ScTabViewObj(ScTabViewShell* pViewSh);
212 virtual ~ScTabViewObj();
214 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
215 const ::com::sun::star::uno::Type & rType )
216 throw(::com::sun::star::uno::RuntimeException);
217 virtual void SAL_CALL acquire() throw();
218 virtual void SAL_CALL release() throw();
220 void SelectionChanged();
221 void VisAreaChanged();
222 // bSameTabButMoved = true if the same sheet as before is activated, used after moving/copying/inserting/deleting a sheet
223 void SheetChanged( bool bSameTabButMoved = false );
224 bool IsMouseListening() const;
225 sal_Bool MousePressed( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
226 sal_Bool MouseReleased( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
228 void RangeSelDone( const String& rText );
229 void RangeSelAborted( const String& rText );
230 void RangeSelChanged( const String& rText );
232 // XSelectionSupplier
233 virtual sal_Bool SAL_CALL select( const ::com::sun::star::uno::Any& aSelection )
234 throw(::com::sun::star::lang::IllegalArgumentException,
235 ::com::sun::star::uno::RuntimeException);
236 virtual ::com::sun::star::uno::Any SAL_CALL getSelection()
237 throw(::com::sun::star::uno::RuntimeException);
238 virtual void SAL_CALL addSelectionChangeListener( const ::com::sun::star::uno::Reference<
239 ::com::sun::star::view::XSelectionChangeListener >& xListener )
240 throw(::com::sun::star::uno::RuntimeException);
241 virtual void SAL_CALL removeSelectionChangeListener( const ::com::sun::star::uno::Reference<
242 ::com::sun::star::view::XSelectionChangeListener >& xListener )
243 throw(::com::sun::star::uno::RuntimeException);
245 //! XPrintable?
247 // XPropertySet
248 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
249 SAL_CALL getPropertySetInfo()
250 throw(::com::sun::star::uno::RuntimeException);
251 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName,
252 const ::com::sun::star::uno::Any& aValue )
253 throw(::com::sun::star::beans::UnknownPropertyException,
254 ::com::sun::star::beans::PropertyVetoException,
255 ::com::sun::star::lang::IllegalArgumentException,
256 ::com::sun::star::lang::WrappedTargetException,
257 ::com::sun::star::uno::RuntimeException);
258 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
259 const ::rtl::OUString& PropertyName )
260 throw(::com::sun::star::beans::UnknownPropertyException,
261 ::com::sun::star::lang::WrappedTargetException,
262 ::com::sun::star::uno::RuntimeException);
263 virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
264 const ::com::sun::star::uno::Reference<
265 ::com::sun::star::beans::XPropertyChangeListener >& xListener )
266 throw(::com::sun::star::beans::UnknownPropertyException,
267 ::com::sun::star::lang::WrappedTargetException,
268 ::com::sun::star::uno::RuntimeException);
269 virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName,
270 const ::com::sun::star::uno::Reference<
271 ::com::sun::star::beans::XPropertyChangeListener >& aListener )
272 throw(::com::sun::star::beans::UnknownPropertyException,
273 ::com::sun::star::lang::WrappedTargetException,
274 ::com::sun::star::uno::RuntimeException);
275 virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName,
276 const ::com::sun::star::uno::Reference<
277 ::com::sun::star::beans::XVetoableChangeListener >& aListener )
278 throw(::com::sun::star::beans::UnknownPropertyException,
279 ::com::sun::star::lang::WrappedTargetException,
280 ::com::sun::star::uno::RuntimeException);
281 virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName,
282 const ::com::sun::star::uno::Reference<
283 ::com::sun::star::beans::XVetoableChangeListener >& aListener )
284 throw(::com::sun::star::beans::UnknownPropertyException,
285 ::com::sun::star::lang::WrappedTargetException,
286 ::com::sun::star::uno::RuntimeException);
288 // XEnumerationAccess
289 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL
290 createEnumeration() throw(::com::sun::star::uno::RuntimeException);
292 // XIndexAccess
293 virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException);
294 virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
295 throw(::com::sun::star::lang::IndexOutOfBoundsException,
296 ::com::sun::star::lang::WrappedTargetException,
297 ::com::sun::star::uno::RuntimeException);
299 // XElementAccess
300 virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
301 throw(::com::sun::star::uno::RuntimeException);
302 virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
304 // XSpreadsheetView
305 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheet > SAL_CALL
306 getActiveSheet() throw(::com::sun::star::uno::RuntimeException);
307 virtual void SAL_CALL setActiveSheet( const ::com::sun::star::uno::Reference<
308 ::com::sun::star::sheet::XSpreadsheet >& xActiveSheet )
309 throw(::com::sun::star::uno::RuntimeException);
311 //XEnhancedMouseClickBroadcaster
313 virtual void SAL_CALL addEnhancedMouseClickHandler( const ::com::sun::star::uno::Reference<
314 ::com::sun::star::awt::XEnhancedMouseClickHandler >& aListener )
315 throw (::com::sun::star::uno::RuntimeException);
316 virtual void SAL_CALL removeEnhancedMouseClickHandler( const ::com::sun::star::uno::Reference<
317 ::com::sun::star::awt::XEnhancedMouseClickHandler >& aListener )
318 throw (::com::sun::star::uno::RuntimeException);
320 //XActivationBroadcaster
322 virtual void SAL_CALL addActivationEventListener( const ::com::sun::star::uno::Reference<
323 ::com::sun::star::sheet::XActivationEventListener >& aListener )
324 throw (::com::sun::star::uno::RuntimeException);
325 virtual void SAL_CALL removeActivationEventListener( const ::com::sun::star::uno::Reference<
326 ::com::sun::star::sheet::XActivationEventListener >& aListener )
327 throw (::com::sun::star::uno::RuntimeException);
329 // XViewSplitable
330 virtual sal_Bool SAL_CALL getIsWindowSplit() throw(::com::sun::star::uno::RuntimeException);
331 virtual sal_Int32 SAL_CALL getSplitHorizontal() throw(::com::sun::star::uno::RuntimeException);
332 virtual sal_Int32 SAL_CALL getSplitVertical() throw(::com::sun::star::uno::RuntimeException);
333 virtual sal_Int32 SAL_CALL getSplitColumn() throw(::com::sun::star::uno::RuntimeException);
334 virtual sal_Int32 SAL_CALL getSplitRow() throw(::com::sun::star::uno::RuntimeException);
335 virtual void SAL_CALL splitAtPosition( sal_Int32 nPixelX, sal_Int32 nPixelY )
336 throw(::com::sun::star::uno::RuntimeException);
338 // XViewFreezable
339 virtual sal_Bool SAL_CALL hasFrozenPanes() throw(::com::sun::star::uno::RuntimeException);
340 virtual void SAL_CALL freezeAtPosition( sal_Int32 nColumns, sal_Int32 nRows )
341 throw(::com::sun::star::uno::RuntimeException);
343 // XRangeSelection
344 virtual void SAL_CALL startRangeSelection( const ::com::sun::star::uno::Sequence<
345 ::com::sun::star::beans::PropertyValue >& aArguments )
346 throw(::com::sun::star::uno::RuntimeException);
347 virtual void SAL_CALL abortRangeSelection() throw(::com::sun::star::uno::RuntimeException);
348 virtual void SAL_CALL addRangeSelectionListener( const ::com::sun::star::uno::Reference<
349 ::com::sun::star::sheet::XRangeSelectionListener >& aListener )
350 throw(::com::sun::star::uno::RuntimeException);
351 virtual void SAL_CALL removeRangeSelectionListener( const ::com::sun::star::uno::Reference<
352 ::com::sun::star::sheet::XRangeSelectionListener >& aListener )
353 throw(::com::sun::star::uno::RuntimeException);
354 virtual void SAL_CALL addRangeSelectionChangeListener( const ::com::sun::star::uno::Reference<
355 ::com::sun::star::sheet::XRangeSelectionChangeListener >& aListener )
356 throw(::com::sun::star::uno::RuntimeException);
357 virtual void SAL_CALL removeRangeSelectionChangeListener( const ::com::sun::star::uno::Reference<
358 ::com::sun::star::sheet::XRangeSelectionChangeListener >& aListener )
359 throw(::com::sun::star::uno::RuntimeException);
361 // XServiceInfo
362 virtual ::rtl::OUString SAL_CALL getImplementationName()
363 throw(::com::sun::star::uno::RuntimeException);
364 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
365 throw(::com::sun::star::uno::RuntimeException);
366 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
367 throw(::com::sun::star::uno::RuntimeException);
369 // XUnoTunnel
370 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence<
371 sal_Int8 >& aIdentifier )
372 throw(::com::sun::star::uno::RuntimeException);
374 static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId();
375 static ScTabViewObj* getImplementation( const com::sun::star::uno::Reference<
376 com::sun::star::uno::XInterface> xObj );
378 // XTypeProvider
379 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
380 throw(::com::sun::star::uno::RuntimeException);
381 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
382 throw(::com::sun::star::uno::RuntimeException);
384 // XTransferableSupplier
385 virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > SAL_CALL getTransferable( ) throw (::com::sun::star::uno::RuntimeException);
386 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);
388 // XSelectedSheetsSupplier
389 virtual ::com::sun::star::uno::Sequence<sal_Int32> SAL_CALL getSelectedSheets()
390 throw(::com::sun::star::uno::RuntimeException);
393 class ScPreviewObj : public SfxBaseController,
394 public SfxListener,
395 public com::sun::star::sheet::XSelectedSheetsSupplier
397 ScPreviewShell* mpViewShell;
398 public:
399 ScPreviewObj(ScPreviewShell* pViewSh);
400 virtual ~ScPreviewObj();
402 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
403 const ::com::sun::star::uno::Type & rType)
404 throw(::com::sun::star::uno::RuntimeException);
406 virtual void SAL_CALL acquire() throw();
407 virtual void SAL_CALL release() throw();
409 virtual void Notify(SfxBroadcaster&, const SfxHint& rHint);
411 // XSelectedSheetsSupplier
412 virtual ::com::sun::star::uno::Sequence<sal_Int32> SAL_CALL getSelectedSheets()
413 throw(::com::sun::star::uno::RuntimeException);
416 #endif
418 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */