Bump for 3.6-28
[LibreOffice.git] / chart2 / source / controller / main / SelectionHelper.hxx
blob0eaba382d9f73a0e0234e84e11ae36e64c1084ac
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
28 #ifndef _CHART2_SELECTIONHELPER_HXX
29 #define _CHART2_SELECTIONHELPER_HXX
31 #include "DrawViewWrapper.hxx"
32 #include "ObjectIdentifier.hxx"
34 class SdrObject;
35 // header for enum SdrDragMode
36 #include <svx/svdtypes.hxx>
37 #include <com/sun/star/drawing/XShape.hpp>
39 //.............................................................................
40 namespace chart
42 //.............................................................................
44 class ObjectIdentifier;
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();
56 ObjectIdentifier getSelectedOID() const;
58 bool isResizeableObjectSelected();
59 bool isRotateableObjectSelected( const ::com::sun::star::uno::Reference<
60 ::com::sun::star::frame::XModel >& xChartModel );
61 bool isDragableObjectSelected();
63 bool isAdditionalShapeSelected() const;
65 //returns true if selection has changed
66 bool setSelection( const ::rtl::OUString& rCID );
67 bool setSelection( const ::com::sun::star::uno::Reference<
68 ::com::sun::star::drawing::XShape >& xShape );
70 void clearSelection();
72 //returns true if the selection has changed
73 bool maybeSwitchSelectionAfterSingleClickWasEnsured();
74 void resetPossibleSelectionAfterSingleClickWasEnsured();
76 void remindSelectionBeforeMouseDown();
77 bool isSelectionDifferentFromBeforeMouseDown() const;
79 void adaptSelectionToNewPos( const Point& rMousePos, DrawViewWrapper* pDrawViewWrapper
80 , bool bIsRightMouse, bool bWaitingForDoubleClick );
82 void applySelection( DrawViewWrapper* pDrawViewWrapper );
84 private: //member
85 //the selection could be given by a CID or by a shape
86 //if m_aSelectedObjectCID is not empty this indicates the selection
87 //the content of m_xSelectedShape is ignored in that case
88 //the strings are used for autogenerated chart specific objects
89 //the shape reference is used for additional shapes
90 ObjectIdentifier m_aSelectedOID; //only single object selection so far
91 ObjectIdentifier m_aSelectedOID_beforeMouseDown;
92 ObjectIdentifier m_aSelectedOID_selectOnlyIfNoDoubleClickIsFollowing;
95 class SelectionHelper : public MarkHandleProvider
97 public:
98 static bool findNamedParent( SdrObject*& pInOutObject
99 , rtl::OUString& rOutName
100 , bool bGivenObjectMayBeResult );
101 static bool findNamedParent( SdrObject*& pInOutObject
102 , ObjectIdentifier& rOutObject
103 , bool bGivenObjectMayBeResult );
104 static SdrObject* getMarkHandlesObject( SdrObject* pObj );
105 static E3dScene* getSceneToRotate( SdrObject* pObj );
106 static bool isDragableObjectHitTwice( const Point& rMPos
107 , const rtl::OUString& rNameOfSelectedObject
108 , const DrawViewWrapper& rDrawViewWrapper );
110 static ::rtl::OUString getHitObjectCID(
111 const Point& rMPos,
112 DrawViewWrapper& rDrawViewWrapper,
113 bool bGetDiagramInsteadOf_Wall=false );
115 static bool isRotateableObject( const ::rtl::OUString& rCID
116 , const ::com::sun::star::uno::Reference<
117 ::com::sun::star::frame::XModel >& xChartModel );
120 SelectionHelper( SdrObject* pSelectedObj );
121 virtual ~SelectionHelper();
124 //MarkHandleProvider:
125 virtual bool getMarkHandles( SdrHdlList& rHdlList );
126 virtual bool getFrameDragSingles();
128 SdrObject* getObjectToMark();//sets also internally the mark object
129 //-> getMarkHandles will behave different if this method has found a Mark Object different from m_pSelectedObj
131 private:
132 SdrObject* m_pSelectedObj;//hit and logically selected object
133 SdrObject* m_pMarkObj;//object that is marked instead to have more pretty handles
136 //.............................................................................
137 } //namespace chart
138 //.............................................................................
139 #endif
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */