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
const & getSelectedCID();
40 css::uno::Reference
< css::drawing::XShape
> const & getSelectedAdditionalShape();
41 const ObjectIdentifier
& getSelectedOID() const { return m_aSelectedOID
;}
43 bool isResizeableObjectSelected();
44 bool isRotateableObjectSelected( const css::uno::Reference
< css::frame::XModel
>& xChartModel
);
45 bool isDragableObjectSelected();
47 bool isAdditionalShapeSelected() const;
49 //returns true if selection has changed
50 bool setSelection( const OUString
& rCID
);
51 bool setSelection( const css::uno::Reference
< css::drawing::XShape
>& xShape
);
53 void clearSelection();
55 //returns true if the selection has changed
56 bool maybeSwitchSelectionAfterSingleClickWasEnsured();
57 void resetPossibleSelectionAfterSingleClickWasEnsured();
59 void remindSelectionBeforeMouseDown();
60 bool isSelectionDifferentFromBeforeMouseDown() const;
62 void adaptSelectionToNewPos( const Point
& rMousePos
, DrawViewWrapper
const * pDrawViewWrapper
63 , bool bIsRightMouse
, bool bWaitingForDoubleClick
);
65 void applySelection( DrawViewWrapper
* pDrawViewWrapper
);
68 //the selection could be given by a CID or by a shape
69 //if m_aSelectedObjectCID is not empty this indicates the selection
70 //the content of m_xSelectedShape is ignored in that case
71 //the strings are used for autogenerated chart specific objects
72 //the shape reference is used for additional shapes
73 ObjectIdentifier m_aSelectedOID
; //only single object selection so far
74 ObjectIdentifier m_aSelectedOID_beforeMouseDown
;
75 ObjectIdentifier m_aSelectedOID_selectOnlyIfNoDoubleClickIsFollowing
;
78 class SelectionHelper
: public MarkHandleProvider
81 static bool findNamedParent( SdrObject
*& pInOutObject
83 , bool bGivenObjectMayBeResult
);
84 static bool findNamedParent( SdrObject
*& pInOutObject
85 , ObjectIdentifier
& rOutObject
86 , bool bGivenObjectMayBeResult
);
87 static SdrObject
* getMarkHandlesObject( SdrObject
* pObj
);
88 static E3dScene
* getSceneToRotate( SdrObject
* pObj
);
89 static bool isDragableObjectHitTwice( const Point
& rMPos
90 , const OUString
& rNameOfSelectedObject
91 , const DrawViewWrapper
& rDrawViewWrapper
);
93 static OUString
getHitObjectCID(
95 DrawViewWrapper
const & rDrawViewWrapper
,
96 bool bGetDiagramInsteadOf_Wall
=false );
98 static bool isRotateableObject( const OUString
& rCID
99 , const css::uno::Reference
< css::frame::XModel
>& xChartModel
);
101 explicit SelectionHelper( SdrObject
* pSelectedObj
);
102 virtual ~SelectionHelper();
104 //MarkHandleProvider:
105 virtual bool getMarkHandles( SdrHdlList
& rHdlList
) override
;
106 virtual bool getFrameDragSingles() override
;
108 SdrObject
* getObjectToMark();//sets also internally the mark object
109 //-> getMarkHandles will behave different if this method has found a Mark Object different from m_pSelectedObj
112 SdrObject
* m_pSelectedObj
;//hit and logically selected object
113 SdrObject
* m_pMarkObj
;//object that is marked instead to have more pretty handles
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */