LCOV - code coverage report
Current view: top level - chart2/source/controller/main - SelectionHelper.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 1 1 100.0 %
Date: 2014-04-11 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : #ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_SELECTIONHELPER_HXX
      20             : #define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_SELECTIONHELPER_HXX
      21             : 
      22             : #include "DrawViewWrapper.hxx"
      23             : #include "ObjectIdentifier.hxx"
      24             : 
      25             : class SdrObject;
      26             : // header for enum SdrDragMode
      27             : #include <svx/svdtypes.hxx>
      28             : #include <com/sun/star/drawing/XShape.hpp>
      29             : 
      30             : namespace chart
      31             : {
      32             : 
      33             : class ObjectIdentifier;
      34             : 
      35          34 : class Selection
      36             : {
      37             : public: //methods
      38             :     bool hasSelection();
      39             : 
      40             :     OUString getSelectedCID();
      41             :     ::com::sun::star::uno::Reference<
      42             :                     ::com::sun::star::drawing::XShape > getSelectedAdditionalShape();
      43             :     ObjectIdentifier getSelectedOID() const;
      44             : 
      45             :     bool isResizeableObjectSelected();
      46             :     bool isRotateableObjectSelected( const ::com::sun::star::uno::Reference<
      47             :                         ::com::sun::star::frame::XModel >& xChartModel );
      48             :     bool isDragableObjectSelected();
      49             : 
      50             :     bool isAdditionalShapeSelected() const;
      51             : 
      52             :     //returns true if selection has changed
      53             :     bool setSelection( const OUString& rCID );
      54             :     bool setSelection( const ::com::sun::star::uno::Reference<
      55             :                     ::com::sun::star::drawing::XShape >& xShape );
      56             : 
      57             :     void clearSelection();
      58             : 
      59             :     //returns true if the selection has changed
      60             :     bool maybeSwitchSelectionAfterSingleClickWasEnsured();
      61             :     void resetPossibleSelectionAfterSingleClickWasEnsured();
      62             : 
      63             :     void remindSelectionBeforeMouseDown();
      64             :     bool isSelectionDifferentFromBeforeMouseDown() const;
      65             : 
      66             :     void adaptSelectionToNewPos( const Point& rMousePos, DrawViewWrapper* pDrawViewWrapper
      67             :                                        , bool bIsRightMouse, bool bWaitingForDoubleClick );
      68             : 
      69             :     void applySelection( DrawViewWrapper* pDrawViewWrapper );
      70             : 
      71             : private: //member
      72             :     //the selection could be given by a CID or by a shape
      73             :     //if m_aSelectedObjectCID is not empty this indicates the selection
      74             :     //the content of m_xSelectedShape is ignored in that case
      75             :     //the strings are used for autogenerated chart specific objects
      76             :     //the shape reference is used for additional shapes
      77             :     ObjectIdentifier    m_aSelectedOID; //only single object selection so far
      78             :     ObjectIdentifier    m_aSelectedOID_beforeMouseDown;
      79             :     ObjectIdentifier    m_aSelectedOID_selectOnlyIfNoDoubleClickIsFollowing;
      80             : };
      81             : 
      82             : class SelectionHelper : public MarkHandleProvider
      83             : {
      84             : public:
      85             :     static bool             findNamedParent( SdrObject*& pInOutObject
      86             :                                 , OUString& rOutName
      87             :                                 , bool bGivenObjectMayBeResult );
      88             :     static bool             findNamedParent( SdrObject*& pInOutObject
      89             :                                 , ObjectIdentifier& rOutObject
      90             :                                 , bool bGivenObjectMayBeResult );
      91             :     static SdrObject*       getMarkHandlesObject( SdrObject* pObj );
      92             :     static E3dScene*        getSceneToRotate( SdrObject* pObj );
      93             :     static bool             isDragableObjectHitTwice( const Point& rMPos
      94             :                                 , const OUString& rNameOfSelectedObject
      95             :                                 , const DrawViewWrapper& rDrawViewWrapper );
      96             : 
      97             :     static OUString getHitObjectCID(
      98             :         const Point& rMPos,
      99             :         DrawViewWrapper& rDrawViewWrapper,
     100             :         bool bGetDiagramInsteadOf_Wall=false );
     101             : 
     102             :     static bool isRotateableObject( const OUString& rCID
     103             :                     , const ::com::sun::star::uno::Reference<
     104             :                         ::com::sun::star::frame::XModel >& xChartModel );
     105             : 
     106             :     SelectionHelper( SdrObject* pSelectedObj );
     107             :     virtual ~SelectionHelper();
     108             : 
     109             :     //MarkHandleProvider:
     110             :     virtual bool getMarkHandles( SdrHdlList& rHdlList ) SAL_OVERRIDE;
     111             :     virtual bool getFrameDragSingles() SAL_OVERRIDE;
     112             : 
     113             :     SdrObject*   getObjectToMark();//sets also internally the mark object
     114             :     //-> getMarkHandles will behave different if this method has found a Mark Object different from m_pSelectedObj
     115             : 
     116             : private:
     117             :     SdrObject*      m_pSelectedObj;//hit and logically selected object
     118             :     SdrObject*      m_pMarkObj;//object that is marked instead to have more pretty handles
     119             : };
     120             : 
     121             : } //namespace chart
     122             : #endif
     123             : 
     124             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10