LCOV - code coverage report
Current view: top level - include/svx/sdr/table - tablecontroller.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 2 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 2 0.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             : 
      20             : #ifndef INCLUDED_SVX_SDR_TABLE_TABLECONTROLLER_HXX
      21             : #define INCLUDED_SVX_SDR_TABLE_TABLECONTROLLER_HXX
      22             : 
      23             : #include <com/sun/star/util/XModifyListener.hpp>
      24             : #include <com/sun/star/table/XTable.hpp>
      25             : #include <rtl/ref.hxx>
      26             : 
      27             : #include <svx/sdr/overlay/overlayobjectlist.hxx>
      28             : #include <svx/selectioncontroller.hxx>
      29             : #include <svx/svdotable.hxx>
      30             : #include <svx/svdview.hxx>
      31             : 
      32             : class SdrObjEditView;
      33             : class SdrObject;
      34             : class SfxItemSet;
      35             : class SvxBoxInfoItem;
      36             : class SvxBoxItem;
      37             : 
      38             : namespace sdr { namespace table {
      39             : 
      40             : class TableModel;
      41             : 
      42             : class SVX_DLLPUBLIC SvxTableController: public sdr::SelectionController
      43             : {
      44             : public:
      45             :     SVX_DLLPRIVATE SvxTableController( SdrObjEditView* pView, const SdrObject* pObj );
      46             :     SVX_DLLPRIVATE virtual ~SvxTableController();
      47             : 
      48             :     // from sdr::SelectionController
      49             :     SVX_DLLPRIVATE virtual bool onKeyInput(const KeyEvent& rKEvt, vcl::Window* pWin) SAL_OVERRIDE;
      50             :     SVX_DLLPRIVATE virtual bool onMouseButtonDown(const MouseEvent& rMEvt, vcl::Window* pWin) SAL_OVERRIDE;
      51             :     SVX_DLLPRIVATE virtual bool onMouseButtonUp(const MouseEvent& rMEvt, vcl::Window* pWin) SAL_OVERRIDE;
      52             :     SVX_DLLPRIVATE virtual bool onMouseMove(const MouseEvent& rMEvt, vcl::Window* pWin) SAL_OVERRIDE;
      53             : 
      54             :     SVX_DLLPRIVATE virtual bool DeleteMarked() SAL_OVERRIDE;
      55             : 
      56             :     SVX_DLLPRIVATE virtual void onSelectionHasChanged() SAL_OVERRIDE;
      57             : 
      58             :     SVX_DLLPRIVATE virtual void GetState( SfxItemSet& rSet ) SAL_OVERRIDE;
      59             :     SVX_DLLPRIVATE virtual void Execute( SfxRequest& rReq ) SAL_OVERRIDE;
      60             : 
      61             :     SVX_DLLPRIVATE virtual bool GetStyleSheet( SfxStyleSheet* &rpStyleSheet ) const SAL_OVERRIDE;
      62             :     SVX_DLLPRIVATE virtual bool SetStyleSheet( SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr ) SAL_OVERRIDE;
      63             : 
      64             :     SVX_DLLPRIVATE virtual bool TakeFormatPaintBrush( std::shared_ptr< SfxItemSet >& rFormatSet  ) SAL_OVERRIDE;
      65             :     SVX_DLLPRIVATE virtual bool ApplyFormatPaintBrush( SfxItemSet& rFormatSet, bool bNoCharacterFormats, bool bNoParagraphFormats ) SAL_OVERRIDE;
      66             : 
      67             :     // slots
      68             :     SVX_DLLPRIVATE void onInsert( sal_uInt16 nSId, const SfxItemSet* pArgs = 0 );
      69             :     SVX_DLLPRIVATE void onDelete( sal_uInt16 nSId );
      70             :     SVX_DLLPRIVATE void onSelect( sal_uInt16 nSId );
      71             :     SVX_DLLPRIVATE void onFormatTable( SfxRequest& rReq );
      72             :     SVX_DLLPRIVATE void MergeMarkedCells();
      73             :     SVX_DLLPRIVATE void SplitMarkedCells();
      74             :     SVX_DLLPRIVATE void DistributeColumns();
      75             :     SVX_DLLPRIVATE void DistributeRows();
      76             :     SVX_DLLPRIVATE void SetVertical( sal_uInt16 nSId );
      77             : 
      78             :     SVX_DLLPRIVATE static rtl::Reference< sdr::SelectionController > create( SdrObjEditView* pView, const SdrObject* pObj, const rtl::Reference< sdr::SelectionController >& xRefController );
      79             : 
      80             :     SVX_DLLPRIVATE void MergeAttrFromSelectedCells(SfxItemSet& rAttr, bool bOnlyHardAttr) const;
      81             :     SVX_DLLPRIVATE void SetAttrToSelectedCells(const SfxItemSet& rAttr, bool bReplaceAll);
      82             :     /** Fill the values that are common for all selected cells.
      83             :       *
      84             :       * This lets the Borders dialog to display the line arrangement
      85             :       * properly.
      86             :       */
      87             :     SVX_DLLPRIVATE void FillCommonBorderAttrFromSelectedCells(SvxBoxItem& rBox, SvxBoxInfoItem& rBoxInfo) const;
      88             : 
      89             :     SVX_DLLPRIVATE virtual bool GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr) const SAL_OVERRIDE;
      90             :     SVX_DLLPRIVATE virtual bool SetAttributes(const SfxItemSet& rSet, bool bReplaceAll) SAL_OVERRIDE;
      91             : 
      92             :     SVX_DLLPRIVATE virtual bool GetMarkedObjModel( SdrPage* pNewPage ) SAL_OVERRIDE;
      93             :     SVX_DLLPRIVATE virtual bool PasteObjModel( const SdrModel& rModel ) SAL_OVERRIDE;
      94             : 
      95           0 :     SVX_DLLPRIVATE virtual bool hasSelectedCells() const SAL_OVERRIDE { return mbCellSelectionMode || mpView->IsTextEdit(); }
      96             :     /// @see sdr::SelectionController::setCursorLogicPosition().
      97             :     SVX_DLLPRIVATE virtual bool setCursorLogicPosition(const Point& rPosition, bool bPoint) SAL_OVERRIDE;
      98             : 
      99             :     void getSelectedCells( CellPos& rFirstPos, CellPos& rLastPos );
     100             :     void setSelectedCells( const CellPos& rFirstPos, const CellPos& rLastPos );
     101             :     void clearSelection();
     102             :     void selectAll();
     103             : 
     104             :     SVX_DLLPRIVATE void onTableModified();
     105             : 
     106             :     bool selectRow( sal_Int32 row );
     107             :     bool selectColumn( sal_Int32 column );
     108             :     bool deselectRow( sal_Int32 row );
     109             :     bool deselectColumn( sal_Int32 column );
     110             :     bool isRowSelected( sal_Int32 nRow );
     111             :     bool isColumnSelected( sal_Int32 nColumn );
     112             :     bool isRowHeader();
     113             :     bool isColumnHeader();
     114           0 :     sdr::table::SdrTableObj* GetTableObj() { return dynamic_cast< sdr::table::SdrTableObj* >( mxTableObj.get() ); }
     115             :     //declare event notification method
     116             :     void NotifySelection( const CellPos& firstPos, const CellPos& lastPos, const CellPos& newPos );
     117             : private:
     118             :     SvxTableController(SvxTableController &) SAL_DELETED_FUNCTION;
     119             :     void operator =(SvxTableController &) SAL_DELETED_FUNCTION;
     120             : 
     121             :     // internals
     122             :     SVX_DLLPRIVATE void ApplyBorderAttr( const SfxItemSet& rAttr );
     123             :     SVX_DLLPRIVATE void UpdateTableShape();
     124             : 
     125             :     SVX_DLLPRIVATE void SetTableStyle( const SfxItemSet* pArgs );
     126             :     SVX_DLLPRIVATE void SetTableStyleSettings( const SfxItemSet* pArgs );
     127             : 
     128             :     SVX_DLLPRIVATE bool PasteObject( SdrTableObj* pPasteTableObj );
     129             : 
     130             :     SVX_DLLPRIVATE bool checkTableObject();
     131             :     SVX_DLLPRIVATE bool updateTableObject();
     132             :     SVX_DLLPRIVATE const CellPos& getSelectionStart();
     133             :     SVX_DLLPRIVATE void setSelectionStart( const CellPos& rPos );
     134             :     SVX_DLLPRIVATE const CellPos& getSelectionEnd();
     135             :     SVX_DLLPRIVATE void checkCell( CellPos& rPos );
     136             : 
     137             :     SVX_DLLPRIVATE void MergeRange( sal_Int32 nFirstCol, sal_Int32 nFirstRow, sal_Int32 nLastCol, sal_Int32 nLastRow );
     138             : 
     139             :     SVX_DLLPRIVATE void EditCell( const CellPos& rPos, vcl::Window* pWindow, const ::com::sun::star::awt::MouseEvent* pMouseEvent = 0, sal_uInt16 nAction = 0 );
     140             :     SVX_DLLPRIVATE bool StopTextEdit();
     141             : 
     142             :     SVX_DLLPRIVATE sal_uInt16 getKeyboardAction( const KeyEvent& rKEvt, vcl::Window* pWindow );
     143             :     SVX_DLLPRIVATE bool executeAction( sal_uInt16 nAction, bool bSelect, vcl::Window* pWindow );
     144             :     SVX_DLLPRIVATE void gotoCell( const CellPos& rCell, bool bSelect, vcl::Window* pWindow, sal_uInt16 nAction = 0 );
     145             : 
     146             :     SVX_DLLPRIVATE void StartSelection( const CellPos& rPos );
     147             :     SVX_DLLPRIVATE void UpdateSelection( const CellPos& rPos );
     148             :     SVX_DLLPRIVATE void RemoveSelection();
     149             :     SVX_DLLPRIVATE void updateSelectionOverlay();
     150             :     SVX_DLLPRIVATE void destroySelectionOverlay();
     151             : 
     152             :     SVX_DLLPRIVATE void findMergeOrigin( CellPos& rPos );
     153             : 
     154             :     DECL_LINK( UpdateHdl, void * );
     155             : 
     156             :     //TableModelRef mxTable;
     157             :     rtl::Reference< TableModel > mxTable;
     158             : 
     159             :     CellPos maCursorFirstPos;
     160             :     CellPos maCursorLastPos;
     161             :     bool mbCellSelectionMode;
     162             :     CellPos maMouseDownPos;
     163             :     bool mbLeftButtonDown;
     164             :     sdr::overlay::OverlayObjectList*  mpSelectionOverlay;
     165             : 
     166             :     SdrView* mpView;
     167             :     SdrObjectWeakRef mxTableObj;
     168             :     SdrModel* mpModel;
     169             : 
     170             :     ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > mxModifyListener;
     171             : 
     172             :     ImplSVEvent * mnUpdateEvent;
     173             : };
     174             : 
     175             : rtl::Reference< sdr::SelectionController > CreateTableController( SdrObjEditView* pView, const SdrObject* pObj, const rtl::Reference< sdr::SelectionController >& xRefController );
     176             : 
     177             : } }
     178             : 
     179             : #endif // INCLUDED_SVX_SDR_TABLE_TABLECONTROLLER_HXX
     180             : 
     181             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11