LCOV - code coverage report
Current view: top level - chart2/source/controller/main - SelectionHelper.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 2 50.0 %
Date: 2014-11-03 Functions: 2 3 66.7 %
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             : #include <svx/svdtypes.hxx>
      27             : #include <com/sun/star/drawing/XShape.hpp>
      28             : 
      29             : namespace chart
      30             : {
      31             : 
      32             : class ObjectIdentifier;
      33             : 
      34          36 : class Selection
      35             : {
      36             : public: //methods
      37             :     bool hasSelection();
      38             : 
      39             :     OUString getSelectedCID();
      40             :     ::com::sun::star::uno::Reference<
      41             :                     ::com::sun::star::drawing::XShape > getSelectedAdditionalShape();
      42           0 :     ObjectIdentifier getSelectedOID() const { return m_aSelectedOID;}
      43             : 
      44             :     bool isResizeableObjectSelected();
      45             :     bool isRotateableObjectSelected( const ::com::sun::star::uno::Reference<
      46             :                         ::com::sun::star::frame::XModel >& xChartModel );
      47             :     bool isDragableObjectSelected();
      48             : 
      49             :     bool isAdditionalShapeSelected() const;
      50             : 
      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 );
      55             : 
      56             :     void clearSelection();
      57             : 
      58             :     //returns true if the selection has changed
      59             :     bool maybeSwitchSelectionAfterSingleClickWasEnsured();
      60             :     void resetPossibleSelectionAfterSingleClickWasEnsured();
      61             : 
      62             :     void remindSelectionBeforeMouseDown();
      63             :     bool isSelectionDifferentFromBeforeMouseDown() const;
      64             : 
      65             :     void adaptSelectionToNewPos( const Point& rMousePos, DrawViewWrapper* pDrawViewWrapper
      66             :                                        , bool bIsRightMouse, bool bWaitingForDoubleClick );
      67             : 
      68             :     void applySelection( DrawViewWrapper* pDrawViewWrapper );
      69             : 
      70             : private: //member
      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;
      79             : };
      80             : 
      81             : class SelectionHelper : public MarkHandleProvider
      82             : {
      83             : public:
      84             :     static bool             findNamedParent( SdrObject*& pInOutObject
      85             :                                 , OUString& rOutName
      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 );
      95             : 
      96             :     static OUString getHitObjectCID(
      97             :         const Point& rMPos,
      98             :         DrawViewWrapper& rDrawViewWrapper,
      99             :         bool bGetDiagramInsteadOf_Wall=false );
     100             : 
     101             :     static bool isRotateableObject( const OUString& rCID
     102             :                     , const ::com::sun::star::uno::Reference<
     103             :                         ::com::sun::star::frame::XModel >& xChartModel );
     104             : 
     105             :     SelectionHelper( SdrObject* pSelectedObj );
     106             :     virtual ~SelectionHelper();
     107             : 
     108             :     //MarkHandleProvider:
     109             :     virtual bool getMarkHandles( SdrHdlList& rHdlList ) SAL_OVERRIDE;
     110             :     virtual bool getFrameDragSingles() SAL_OVERRIDE;
     111             : 
     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
     114             : 
     115             : private:
     116             :     SdrObject*      m_pSelectedObj;//hit and logically selected object
     117             :     SdrObject*      m_pMarkObj;//object that is marked instead to have more pretty handles
     118             : };
     119             : 
     120             : } //namespace chart
     121             : #endif
     122             : 
     123             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10