1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
19 #ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_SELECTIONHELPER_HXX
20 #define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_SELECTIONHELPER_HXX
22 #include "DrawViewWrapper.hxx"
23 #include "ObjectIdentifier.hxx"
26 #include <svx/svdtypes.hxx>
27 #include <com/sun/star/drawing/XShape.hpp>
32 class ObjectIdentifier
;
39 OUString
getSelectedCID();
40 ::com::sun::star::uno::Reference
<
41 ::com::sun::star::drawing::XShape
> getSelectedAdditionalShape();
42 ObjectIdentifier
getSelectedOID() const { return m_aSelectedOID
;}
44 bool isResizeableObjectSelected();
45 bool isRotateableObjectSelected( const ::com::sun::star::uno::Reference
<
46 ::com::sun::star::frame::XModel
>& xChartModel
);
47 bool isDragableObjectSelected();
49 bool isAdditionalShapeSelected() const;
51 //returns true if selection has changed
52 bool setSelection( const OUString
& rCID
);
53 bool setSelection( const ::com::sun::star::uno::Reference
<
54 ::com::sun::star::drawing::XShape
>& xShape
);
56 void clearSelection();
58 //returns true if the selection has changed
59 bool maybeSwitchSelectionAfterSingleClickWasEnsured();
60 void resetPossibleSelectionAfterSingleClickWasEnsured();
62 void remindSelectionBeforeMouseDown();
63 bool isSelectionDifferentFromBeforeMouseDown() const;
65 void adaptSelectionToNewPos( const Point
& rMousePos
, DrawViewWrapper
* pDrawViewWrapper
66 , bool bIsRightMouse
, bool bWaitingForDoubleClick
);
68 void applySelection( DrawViewWrapper
* pDrawViewWrapper
);
71 //the selection could be given by a CID or by a shape
72 //if m_aSelectedObjectCID is not empty this indicates the selection
73 //the content of m_xSelectedShape is ignored in that case
74 //the strings are used for autogenerated chart specific objects
75 //the shape reference is used for additional shapes
76 ObjectIdentifier m_aSelectedOID
; //only single object selection so far
77 ObjectIdentifier m_aSelectedOID_beforeMouseDown
;
78 ObjectIdentifier m_aSelectedOID_selectOnlyIfNoDoubleClickIsFollowing
;
81 class SelectionHelper
: public MarkHandleProvider
84 static bool findNamedParent( SdrObject
*& pInOutObject
86 , bool bGivenObjectMayBeResult
);
87 static bool findNamedParent( SdrObject
*& pInOutObject
88 , ObjectIdentifier
& rOutObject
89 , bool bGivenObjectMayBeResult
);
90 static SdrObject
* getMarkHandlesObject( SdrObject
* pObj
);
91 static E3dScene
* getSceneToRotate( SdrObject
* pObj
);
92 static bool isDragableObjectHitTwice( const Point
& rMPos
93 , const OUString
& rNameOfSelectedObject
94 , const DrawViewWrapper
& rDrawViewWrapper
);
96 static OUString
getHitObjectCID(
98 DrawViewWrapper
& rDrawViewWrapper
,
99 bool bGetDiagramInsteadOf_Wall
=false );
101 static bool isRotateableObject( const OUString
& rCID
102 , const ::com::sun::star::uno::Reference
<
103 ::com::sun::star::frame::XModel
>& xChartModel
);
105 SelectionHelper( SdrObject
* pSelectedObj
);
106 virtual ~SelectionHelper();
108 //MarkHandleProvider:
109 virtual bool getMarkHandles( SdrHdlList
& rHdlList
) SAL_OVERRIDE
;
110 virtual bool getFrameDragSingles() SAL_OVERRIDE
;
112 SdrObject
* getObjectToMark();//sets also internally the mark object
113 //-> getMarkHandles will behave different if this method has found a Mark Object different from m_pSelectedObj
116 SdrObject
* m_pSelectedObj
;//hit and logically selected object
117 SdrObject
* m_pMarkObj
;//object that is marked instead to have more pretty handles
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */