LibreOffice Module chart2 (master) 1
SelectionHelper.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19#pragma once
20
21#include "DrawViewWrapper.hxx"
22#include <ObjectIdentifier.hxx>
23
24class SdrObject;
25
26namespace com::sun::star::drawing { class XShape; }
27
28namespace chart
29{
30
32{
33public: //methods
34 bool hasSelection() const;
35
36 OUString const & getSelectedCID() const;
37 css::uno::Reference< css::drawing::XShape > const & getSelectedAdditionalShape() const;
39
40 bool isResizeableObjectSelected() const;
42 bool isDragableObjectSelected() const;
43
44 bool isAdditionalShapeSelected() const;
45
46 //returns true if selection has changed
47 bool setSelection( const OUString& rCID );
48 bool setSelection( const css::uno::Reference< css::drawing::XShape >& xShape );
49
50 void clearSelection();
51
52 //returns true if the selection has changed
55
58
59 void adaptSelectionToNewPos( const Point& rMousePos, DrawViewWrapper const * pDrawViewWrapper
60 , bool bIsRightMouse, bool bWaitingForDoubleClick );
61
62 void applySelection( DrawViewWrapper* pDrawViewWrapper );
63
64private: //member
65 //the selection could be given by a CID or by a shape
66 //if m_aSelectedObjectCID is not empty this indicates the selection
67 //the content of m_xSelectedShape is ignored in that case
68 //the strings are used for autogenerated chart specific objects
69 //the shape reference is used for additional shapes
70 ObjectIdentifier m_aSelectedOID; //only single object selection so far
73};
74
76{
77public:
78 static bool findNamedParent( SdrObject*& pInOutObject
79 , OUString& rOutName
80 , bool bGivenObjectMayBeResult );
81 static bool findNamedParent( SdrObject*& pInOutObject
82 , ObjectIdentifier& rOutObject
83 , bool bGivenObjectMayBeResult );
85 static E3dScene* getSceneToRotate( SdrObject* pObj );
86 static bool isDragableObjectHitTwice( const Point& rMPos
87 , const OUString& rNameOfSelectedObject
88 , const DrawViewWrapper& rDrawViewWrapper );
89
90 static OUString getHitObjectCID(
91 const Point& rMPos,
92 DrawViewWrapper const & rDrawViewWrapper,
93 bool bGetDiagramInsteadOf_Wall=false );
94
95 static bool isRotateableObject( std::u16string_view rCID
96 , const rtl::Reference<::chart::ChartModel>& xChartModel );
97
98 explicit SelectionHelper( SdrObject* pSelectedObj );
99 virtual ~SelectionHelper();
100
101 //MarkHandleProvider:
102 virtual bool getMarkHandles( SdrHdlList& rHdlList ) override;
103 virtual bool getFrameDragSingles() override;
104
105 SdrObject* getObjectToMark();//sets also internally the mark object
106 //-> getMarkHandles will behave different if this method has found a Mark Object different from m_pSelectedObj
107
108private:
109 SdrObject* m_pSelectedObj;//hit and logically selected object
110 SdrObject* m_pMarkObj;//object that is marked instead to have more pretty handles
111};
112
113} //namespace chart
114
115/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
The DrawViewWrapper should help us to reduce effort if the underlying DrawingLayer changes.
static OUString getHitObjectCID(const Point &rMPos, DrawViewWrapper const &rDrawViewWrapper, bool bGetDiagramInsteadOf_Wall=false)
static SdrObject * getMarkHandlesObject(SdrObject *pObj)
static bool findNamedParent(SdrObject *&pInOutObject, OUString &rOutName, bool bGivenObjectMayBeResult)
static bool isRotateableObject(std::u16string_view rCID, const rtl::Reference<::chart::ChartModel > &xChartModel)
SelectionHelper(SdrObject *pSelectedObj)
virtual bool getMarkHandles(SdrHdlList &rHdlList) override
static E3dScene * getSceneToRotate(SdrObject *pObj)
static bool isDragableObjectHitTwice(const Point &rMPos, const OUString &rNameOfSelectedObject, const DrawViewWrapper &rDrawViewWrapper)
virtual bool getFrameDragSingles() override
void remindSelectionBeforeMouseDown()
void resetPossibleSelectionAfterSingleClickWasEnsured()
bool isDragableObjectSelected() const
bool hasSelection() const
bool setSelection(const css::uno::Reference< css::drawing::XShape > &xShape)
bool isRotateableObjectSelected(const rtl::Reference<::chart::ChartModel > &xChartModel) const
ObjectIdentifier m_aSelectedOID_selectOnlyIfNoDoubleClickIsFollowing
bool isAdditionalShapeSelected() const
ObjectIdentifier m_aSelectedOID
const ObjectIdentifier & getSelectedOID() const
OUString const & getSelectedCID() const
bool maybeSwitchSelectionAfterSingleClickWasEnsured()
ObjectIdentifier m_aSelectedOID_beforeMouseDown
void adaptSelectionToNewPos(const Point &rMousePos, DrawViewWrapper const *pDrawViewWrapper, bool bIsRightMouse, bool bWaitingForDoubleClick)
bool isSelectionDifferentFromBeforeMouseDown() const
bool isResizeableObjectSelected() const
void applySelection(DrawViewWrapper *pDrawViewWrapper)
bool setSelection(const OUString &rCID)
css::uno::Reference< css::drawing::XShape > const & getSelectedAdditionalShape() const