Update ooo320-m1
[ooovba.git] / chart2 / source / controller / main / SelectionHelper.hxx
blob1b9be72e86039499b61e013972d6201799ebbd41
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: SelectionHelper.hxx,v $
10 * $Revision: 1.6 $
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 ************************************************************************/
30 #ifndef _CHART2_SELECTIONHELPER_HXX
31 #define _CHART2_SELECTIONHELPER_HXX
33 #include "DrawViewWrapper.hxx"
35 class SdrObject;
36 // header for enum SdrDragMode
37 #include <svx/svdtypes.hxx>
38 #include <com/sun/star/drawing/XShape.hpp>
40 //.............................................................................
41 namespace chart
43 //.............................................................................
45 //-----------------------------------------------------------------------------
46 /**
48 class Selection
50 public: //methods
51 bool hasSelection();
53 rtl::OUString getSelectedCID();
54 ::com::sun::star::uno::Reference<
55 ::com::sun::star::drawing::XShape > getSelectedAdditionalShape();
57 bool isResizeableObjectSelected();
58 bool isRotateableObjectSelected( const ::com::sun::star::uno::Reference<
59 ::com::sun::star::frame::XModel >& xChartModel );
60 bool isDragableObjectSelected();
62 //returns true if selection has changed
63 bool setSelection( const ::rtl::OUString& rCID );
64 bool setSelection( const ::com::sun::star::uno::Reference<
65 ::com::sun::star::drawing::XShape >& xShape );
67 void clearSelection();
69 //returns true if the selection has changed
70 bool maybeSwitchSelectionAfterSingleClickWasEnsured();
71 void resetPossibleSelectionAfterSingleClickWasEnsured();
73 void remindSelectionBeforeMouseDown();
74 bool isSelectionDifferentFromBeforeMouseDown();
76 void adaptSelectionToNewPos( const Point& rMousePos, DrawViewWrapper* pDrawViewWrapper
77 , bool bIsRightMouse, bool bWaitingForDoubleClick );
79 void applySelection( DrawViewWrapper* pDrawViewWrapper );
81 private: //member
82 //the selection could be given by a CID or by a shape
83 //if m_aSelectedObjectCID is not empty this indicates the selection
84 //the content of m_xSelectedShape is ignored in that case
85 //the strings are used for autogenerated chart specific objects
86 //the shape reference is used for additional shapes
87 ::rtl::OUString m_aSelectedObjectCID;//only single object selection so far
88 ::rtl::OUString m_aSelectedObjectCID_beforeMouseDown;
89 ::rtl::OUString m_aSelectedObjectCID_selectOnlyIfNoDoubleClickIsFollowing;
91 ::com::sun::star::uno::Reference<
92 ::com::sun::star::drawing::XShape > m_xSelectAdditionalShape;
95 class SelectionHelper : public MarkHandleProvider
97 public:
98 static bool findNamedParent( SdrObject*& pInOutObject
99 , rtl::OUString& rOutName
100 , bool bGivenObjectMayBeResult );
101 static SdrObject* getMarkHandlesObject( SdrObject* pObj );
102 static E3dScene* getSceneToRotate( SdrObject* pObj );
103 static bool isDragableObjectHitTwice( const Point& rMPos
104 , const rtl::OUString& rNameOfSelectedObject
105 , const DrawViewWrapper& rDrawViewWrapper );
107 static ::rtl::OUString getHitObjectCID(
108 const Point& rMPos,
109 DrawViewWrapper& rDrawViewWrapper,
110 bool bGetDiagramInsteadOf_Wall=false );
112 static bool isRotateableObject( const ::rtl::OUString& rCID
113 , const ::com::sun::star::uno::Reference<
114 ::com::sun::star::frame::XModel >& xChartModel );
117 SelectionHelper( SdrObject* pSelectedObj );
118 virtual ~SelectionHelper();
121 //MarkHandleProvider:
122 virtual bool getMarkHandles( SdrHdlList& rHdlList );
123 virtual bool getFrameDragSingles();
125 SdrObject* getObjectToMark();//sets also internally the mark object
126 //-> getMarkHandles will behave different if this method has found a Mark Object different from m_pSelectedObj
128 private:
129 SdrObject* m_pSelectedObj;//hit and logically selected object
130 SdrObject* m_pMarkObj;//object that is marked instead to have more pretty handles
133 //.............................................................................
134 } //namespace chart
135 //.............................................................................
136 #endif