LCOV - code coverage report
Current view: top level - sc/inc - drwlayer.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 5 5 100.0 %
Date: 2015-06-13 12:38:46 Functions: 5 5 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             : 
      20             : #ifndef INCLUDED_SC_INC_DRWLAYER_HXX
      21             : #define INCLUDED_SC_INC_DRWLAYER_HXX
      22             : 
      23             : #include <vcl/graph.hxx>
      24             : #include <svx/fmmodel.hxx>
      25             : #include <svx/svdundo.hxx>
      26             : #include "global.hxx"
      27             : 
      28             : class ScDocument;
      29             : class SfxObjectShell;
      30             : class ScDrawObjData;
      31             : class ScIMapInfo;
      32             : class ScMacroInfo;
      33             : class IMapObject;
      34             : class ScMarkData;
      35             : class ScRange;
      36             : class ScAddress;
      37             : 
      38             : class ScTabDeletedHint : public SfxHint
      39             : {
      40             : private:
      41             :     SCTAB   nTab;
      42             : public:
      43             :             ScTabDeletedHint( SCTAB nTabNo = SCTAB_MAX );
      44             :     virtual ~ScTabDeletedHint();
      45             : 
      46          18 :     SCTAB   GetTab() const { return nTab; }
      47             : };
      48             : 
      49             : class ScTabSizeChangedHint : public SfxHint
      50             : {
      51             : private:
      52             :     SCTAB   nTab;
      53             : public:
      54             :             ScTabSizeChangedHint( SCTAB nTabNo = SCTAB_MAX );
      55             :     virtual ~ScTabSizeChangedHint();
      56             : 
      57         854 :     SCTAB   GetTab() const  { return nTab; }
      58             : };
      59             : 
      60             : //  Adjusting of detective UserData and draw undo's both have to be in SdrUndoGroup;
      61             : //  therefore derived from SdrUndoAction
      62             : 
      63             : class ScUndoObjData : public SdrUndoObj
      64             : {
      65             : private:
      66             :     ScAddress   aOldStt;
      67             :     ScAddress   aOldEnd;
      68             :     ScAddress   aNewStt;
      69             :     ScAddress   aNewEnd;
      70             : public:
      71             :                 ScUndoObjData( SdrObject* pObj, const ScAddress& rOS, const ScAddress& rOE,
      72             :                                                 const ScAddress& rNS, const ScAddress& rNE );
      73             :                 virtual ~ScUndoObjData();
      74             : 
      75             :     virtual void     Undo() SAL_OVERRIDE;
      76             :     virtual void     Redo() SAL_OVERRIDE;
      77             : };
      78             : 
      79             : class ScUndoAnchorData : public SdrUndoObj
      80             : {
      81             : private:
      82             :     bool                    mbWasCellAnchored;
      83             :     ScDocument*             mpDoc;
      84             :     SCTAB                   mnTab;
      85             : public:
      86             :                 ScUndoAnchorData( SdrObject* pObj, ScDocument* pDoc, SCTAB nTab );
      87             :                 virtual ~ScUndoAnchorData();
      88             : 
      89             :     virtual void     Undo() SAL_OVERRIDE;
      90             :     virtual void     Redo() SAL_OVERRIDE;
      91             : };
      92             : 
      93             : class SC_DLLPUBLIC ScDrawLayer : public FmFormModel
      94             : {
      95             : private:
      96             :     OUString        aName;
      97             :     ScDocument*     pDoc;
      98             :     SdrUndoGroup*   pUndoGroup;
      99             :     bool            bRecording;
     100             :     bool            bAdjustEnabled;
     101             :     bool            bHyphenatorSet;
     102             : 
     103             : private:
     104             :     void            MoveCells( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL nCol2,SCROW nRow2,
     105             :                                 SCsCOL nDx,SCsROW nDy, bool bUpdateNoteCaptionPos );
     106             : 
     107             :     void            RecalcPos( SdrObject* pObj, ScDrawObjData& rData, bool bNegativePage, bool bUpdateNoteCaptionPos );
     108             :     void            ResizeLastRectFromAnchor( SdrObject* pObj, ScDrawObjData& rData, bool bUseLogicRect, bool bNegativePage, bool bCanResize, bool bHiddenAsZero = true );
     109             : 
     110             : public:
     111             :                     ScDrawLayer( ScDocument* pDocument, const OUString& rName );
     112             :     virtual         ~ScDrawLayer();
     113             : 
     114             :     virtual SdrPage*  AllocPage(bool bMasterPage) SAL_OVERRIDE;
     115             :     virtual SdrModel* AllocModel() const SAL_OVERRIDE;
     116             :     virtual void    SetChanged( bool bFlg = true ) SAL_OVERRIDE;
     117             : 
     118             :     virtual SdrLayerID GetControlExportLayerId( const SdrObject & ) const SAL_OVERRIDE;
     119             : 
     120             :     bool            HasObjects() const;
     121             : 
     122             :     bool            ScAddPage( SCTAB nTab );
     123             :     void            ScRemovePage( SCTAB nTab );
     124             :     void            ScRenamePage( SCTAB nTab, const OUString& rNewName );
     125             :     void            ScMovePage( sal_uInt16 nOldPos, sal_uInt16 nNewPos );
     126             :     void            ScCopyPage( sal_uInt16 nOldPos, sal_uInt16 nNewPos);
     127             :     void            ResetTab( SCTAB nStart, SCTAB nEnd );
     128             : 
     129          18 :     ScDocument*     GetDocument() const { return pDoc; }
     130             : 
     131             :     void            UseHyphenator();
     132             : 
     133             :     bool            GetPrintArea( ScRange& rRange, bool bSetHor, bool bSetVer ) const;
     134             : 
     135             :                     //      automatic adjustments
     136             : 
     137         238 :     void            EnableAdjust( bool bSet = true )    { bAdjustEnabled = bSet; }
     138             : 
     139             :     void            BeginCalcUndo(bool bDisableTextEditUsesCommonUndoManager);
     140             :     SdrUndoGroup*   GetCalcUndo();
     141         114 :     bool            IsRecording() const         { return bRecording; }
     142             :     void            AddCalcUndo( SdrUndoAction* pUndo );
     143             : 
     144             :     void            MoveArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL nCol2,SCROW nRow2,
     145             :                                 SCsCOL nDx,SCsROW nDy, bool bInsDel, bool bUpdateNoteCaptionPos = true );
     146             : 
     147             :     bool            HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndRow );
     148             : 
     149             :     void            DeleteObjectsInArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1,
     150             :                                             SCCOL nCol2,SCROW nRow2 );
     151             :     void            DeleteObjectsInSelection( const ScMarkData& rMark );
     152             : 
     153             :     void            CopyToClip( ScDocument* pClipDoc, SCTAB nTab, const Rectangle& rRange );
     154             :     void            CopyFromClip( ScDrawLayer* pClipModel,
     155             :                                     SCTAB nSourceTab, const Rectangle& rSourceRange,
     156             :                                     const ScAddress& rDestPos, const Rectangle& rDestRange );
     157             : 
     158             :     void            SetPageSize( sal_uInt16 nPageNo, const Size& rSize, bool bUpdateNoteCaptionPos = true );
     159             : 
     160             :                     //  mirror or move between positive and negative positions for RTL
     161             :     void            MirrorRTL( SdrObject* pObj );
     162             :     static void     MirrorRectRTL( Rectangle& rRect );      // for bounding rectangles etc.
     163             : 
     164             :     /** Returns the rectangle for the passed cell address in 1/100 mm.
     165             :         @param bMergedCell  True = regards merged cells. False = use single column/row size. */
     166             :     static Rectangle GetCellRect( ScDocument& rDoc, const ScAddress& rPos, bool bMergedCell );
     167             : 
     168             :                     //  GetVisibleName: name for navigator etc: GetPersistName or GetName
     169             :                     //  (ChartListenerCollection etc. must use GetPersistName directly)
     170             :     static OUString GetVisibleName( SdrObject* pObj );
     171             : 
     172             :     SdrObject*      GetNamedObject( const OUString& rName, sal_uInt16 nId, SCTAB& rFoundTab ) const;
     173             :                     // if pnCounter != NULL, the search for a name starts with this index + 1,
     174             :                     // and the index really used is returned.
     175             :     OUString        GetNewGraphicName( long* pnCounter = NULL ) const;
     176             :     void            EnsureGraphicNames();
     177             : 
     178             :     static bool IsCellAnchored( const SdrObject& rObj );
     179             :     static void             SetPageAnchored( SdrObject& );
     180             :     static void             SetCellAnchored( SdrObject&, const ScDrawObjData &rAnchor );
     181             :     static void             SetVisualCellAnchored( SdrObject&, const ScDrawObjData &rAnchor );
     182             :     // Updates rAnchor based on position of rObj
     183             :     static void             GetCellAnchorFromPosition( SdrObject &rObj, ScDrawObjData &rAnchor, const ScDocument &rDoc, SCTAB nTab, bool bUseLogicRect = true, bool bHiddenAsZero = true );
     184             :     static void             SetCellAnchoredFromPosition( SdrObject &rObj, const ScDocument &rDoc, SCTAB nTab );
     185             :     static void             UpdateCellAnchorFromPositionEnd( SdrObject &rObj, ScDrawObjData &rAnchor, const ScDocument &rDoc, SCTAB nTab, bool bUseLogicRect = true );
     186             :     static ScAnchorType     GetAnchorType( const SdrObject& );
     187             : 
     188             :     // positions for detektive lines
     189             :     static ScDrawObjData* GetObjData( SdrObject* pObj, bool bCreate=false );
     190             :     static ScDrawObjData* GetNonRotatedObjData( SdrObject* pObj, bool bCreate=false );
     191             : 
     192             :     // The sheet information in ScDrawObjData isn't updated when sheets are inserted/deleted.
     193             :     // Use this method to get an object with positions on the specified sheet (should be the
     194             :     // sheet on which the object is inserted).
     195             :     static ScDrawObjData* GetObjDataTab( SdrObject* pObj, SCTAB nTab );
     196             : 
     197             :     /** Returns true, if the passed object is the caption of a cell note. */
     198             :     static bool     IsNoteCaption( SdrObject* pObj );
     199             : 
     200             :     /** Returns the object data, if the passed object is a cell note caption. */
     201             :     static ScDrawObjData* GetNoteCaptionData( SdrObject* pObj, SCTAB nTab );
     202             : 
     203             :     // Image-Map
     204             :     static ScIMapInfo* GetIMapInfo( SdrObject* pObj );
     205             : 
     206             :     static IMapObject* GetHitIMapObject( SdrObject* pObject,
     207             :                             const Point& rWinPoint, const vcl::Window& rCmpWnd );
     208             : 
     209             :     static ScMacroInfo* GetMacroInfo( SdrObject* pObj, bool bCreate = false );
     210             : 
     211             :     virtual ImageMap* GetImageMapForObject(SdrObject* pObj) SAL_OVERRIDE;
     212             :     virtual sal_Int32 GetHyperlinkCount(SdrObject* pObj) SAL_OVERRIDE;
     213             : 
     214             : private:
     215             :     static SfxObjectShell* pGlobalDrawPersist;          // for AllocModel
     216             : public:
     217             :     static void     SetGlobalDrawPersist(SfxObjectShell* pPersist);
     218             : protected:
     219             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createUnoModel() SAL_OVERRIDE;
     220             : };
     221             : 
     222             : #endif
     223             : 
     224             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11