LCOV - code coverage report
Current view: top level - sd/source/ui/inc - View.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 6 14 42.9 %
Date: 2014-04-11 Functions: 3 11 27.3 %
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_SD_SOURCE_UI_INC_VIEW_HXX
      21             : #define INCLUDED_SD_SOURCE_UI_INC_VIEW_HXX
      22             : 
      23             : #include <boost/ptr_container/ptr_vector.hpp>
      24             : 
      25             : #include "pres.hxx"
      26             : #include <tools/gen.hxx>
      27             : #include <svtools/transfer.hxx>
      28             : #include <svx/fmview.hxx>
      29             : #include <svx/svdmark.hxx>
      30             : #include <svx/svdpage.hxx>
      31             : #include "fupoor.hxx"
      32             : 
      33             : #include "smarttag.hxx"
      34             : #include <editeng/numitem.hxx>
      35             : 
      36             : class SdDrawDocument;
      37             : class SdPage;
      38             : class SdrOle2Obj;
      39             : class SdrGrafObj;
      40             : class SdrMediaObj;
      41             : class OutputDevice;
      42             : class ImageMap;
      43             : class Point;
      44             : class Graphic;
      45             : class SdrOutliner;
      46             : class TransferableDataHelper;
      47             : struct StyleRequestData;
      48             : class Outliner;
      49             : 
      50             : namespace sd {
      51             : 
      52             : class DrawDocShell;
      53             : struct SdNavigatorDropEvent;
      54             : class ViewShell;
      55             : class Window;
      56             : class ViewClipboard;
      57             : 
      58             : 
      59             : // SdViewRedrawRec
      60           0 : struct SdViewRedrawRec
      61             : {
      62             :     OutputDevice* mpOut;
      63             :     Rectangle     aRect;
      64             : };
      65             : 
      66             : 
      67             : class View : public FmFormView
      68             : {
      69             : public:
      70             :     TYPEINFO_OVERRIDE();
      71             : 
      72             :     View (
      73             :         SdDrawDocument& rDrawDoc,
      74             :         OutputDevice* pOutDev,
      75             :         ViewShell* pViewSh=NULL);
      76             :     virtual ~View (void);
      77             : 
      78             :     void                    CompleteRedraw( OutputDevice* pOutDev, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector = 0L) SAL_OVERRIDE;
      79             : 
      80             :     virtual sal_Bool            GetAttributes( SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr=sal_False ) const;
      81             :     virtual sal_Bool            SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll = sal_False);
      82             :     virtual void            MarkListHasChanged() SAL_OVERRIDE;
      83             :     virtual void            ModelHasChanged() SAL_OVERRIDE;
      84             :     virtual void            SelectAll();
      85             :     virtual void            DoCut(::Window* pWindow=NULL);
      86             :     virtual void            DoCopy(::Window* pWindow=NULL);
      87             :     virtual void            DoPaste(::Window* pWindow=NULL);
      88             :     virtual void            DoConnect(SdrOle2Obj* pOleObj) SAL_OVERRIDE;
      89             :     virtual sal_Bool            SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr = sal_False);
      90             :     virtual void            StartDrag( const Point& rStartPos, ::Window* pWindow );
      91             :     virtual void            DragFinished( sal_Int8 nDropAction );
      92             :     virtual sal_Int8 AcceptDrop (
      93             :         const AcceptDropEvent& rEvt,
      94             :         DropTargetHelper& rTargetHelper,
      95             :         ::sd::Window* pTargetWindow = NULL,
      96             :         sal_uInt16 nPage = SDRPAGE_NOTFOUND,
      97             :         sal_uInt16 nLayer = SDRPAGE_NOTFOUND);
      98             :     virtual sal_Int8 ExecuteDrop (
      99             :         const ExecuteDropEvent& rEvt,
     100             :         DropTargetHelper& rTargetHelper,
     101             :         ::sd::Window* pTargetWindow = NULL,
     102             :         sal_uInt16 nPage = SDRPAGE_NOTFOUND,
     103             :         sal_uInt16 nLayer = SDRPAGE_NOTFOUND);
     104             : 
     105             :     ::com::sun::star::uno::Reference<
     106             :         ::com::sun::star::datatransfer::XTransferable>
     107             :         CreateClipboardDataObject (::sd::View*, ::Window& rWindow);
     108             :     ::com::sun::star::uno::Reference<
     109             :         ::com::sun::star::datatransfer::XTransferable>
     110             :         CreateDragDataObject (::sd::View*, ::Window& rWindow,
     111             :             const Point& rDragPos);
     112             :     ::com::sun::star::uno::Reference<
     113             :         ::com::sun::star::datatransfer::XTransferable>
     114             :         CreateSelectionDataObject (::sd::View*, ::Window& rWindow);
     115             : 
     116             :     void                    UpdateSelectionClipboard( sal_Bool bForceDeselect );
     117             : 
     118             :     inline DrawDocShell* GetDocSh (void) const;
     119             :     inline SdDrawDocument& GetDoc (void) const;
     120             :     inline ViewShell* GetViewShell (void) const;
     121             : 
     122             :     virtual bool SdrBeginTextEdit(SdrObject* pObj, SdrPageView* pPV = 0L, ::Window* pWin = 0L, bool bIsNewObj = false,
     123             :         SdrOutliner* pGivenOutliner = 0L, OutlinerView* pGivenOutlinerView = 0L,
     124             :         bool bDontDeleteOutliner = false, bool bOnlyOneView = false, bool bGrabFocus = true) SAL_OVERRIDE;
     125             : 
     126             :     virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally = false) SAL_OVERRIDE;
     127             : 
     128             :     bool RestoreDefaultText( SdrTextObj* pTextObj );
     129             : 
     130             :     sal_Bool                    InsertData( const TransferableDataHelper& rDataHelper,
     131             :                                         const Point& rPos, sal_Int8& rDnDAction, sal_Bool bDrag,
     132             :                                         sal_uLong nFormat = 0, sal_uInt16 nPage = SDRPAGE_NOTFOUND, sal_uInt16 nLayer = SDRLAYER_NOTFOUND );
     133             :     /** gets the metafile from the given transferable helper and insert it as a graphic shape.
     134             :         @param bOptimize if set to true, the metafile is analyzed and if only one bitmap action is
     135             :                          present, then is is inserted as a single graphic.
     136             :     */
     137             :     bool                    InsertMetaFile( TransferableDataHelper& rDataHelper,
     138             :                                             const Point& rInsertPos,
     139             :                                             ImageMap* pImageMap, bool bOptimize );
     140             : 
     141             :     SdrGrafObj*             InsertGraphic( const Graphic& rGraphic,
     142             :                                            sal_Int8& rAction, const Point& rPos,
     143             :                                            SdrObject* pSelectedObj, ImageMap* pImageMap );
     144             :     SdrMediaObj*            InsertMediaURL( const OUString& rMediaURL, sal_Int8& rAction,
     145             :                                             const Point& rPos, const Size& rSize,
     146             :                                             bool const bLink );
     147             : 
     148             :     SdrMediaObj*            Insert3DModelURL( const OUString& rModelURL, sal_Int8& rAction,
     149             :                                               const Point& rPos, const Size& rSize,
     150             :                                               bool const bLink );
     151             : 
     152             :     SdrMediaObj*            InsertMediaObj( const OUString& rURL, const OUString& rMimeType, sal_Int8& rAction,
     153             :                                             const Point& rPos, const Size& rSize );
     154             : 
     155             :     bool PasteRTFTable( SotStorageStreamRef xStm, SdrPage* pPage, sal_uLong nPasteOptions );
     156             : 
     157             :     sal_Bool                    IsPresObjSelected(sal_Bool bOnPage=sal_True, sal_Bool bOnMasterPage=sal_True, sal_Bool bCheckPresObjListOnly=sal_False, sal_Bool bCheckLayoutOnly=sal_False) const;
     158             : 
     159             :     void                    SetMarkedOriginalSize();
     160             : 
     161             :     sal_Bool                    IsMorphingAllowed() const;
     162             :     sal_Bool                    IsVectorizeAllowed() const;
     163             : 
     164             :     virtual SfxStyleSheet*  GetStyleSheet() const;
     165             : 
     166             :     /** return parameter:
     167             :         pExchangeList == NULL -> all names are unique
     168             :         bNameOK == sal_False -> cancel by user
     169             :         nType == 0 -> pages
     170             :         nType == 1 -> objects
     171             :         nType == 2 -> pages and objects    */
     172             : 
     173             :     bool GetExchangeList( std::vector<OUString> &rExchangeList,
     174             :                           std::vector<OUString> &rBookmarkList,
     175             :                           const sal_uInt16 nType );
     176             : 
     177             :     virtual void onAccessibilityOptionsChanged() SAL_OVERRIDE;
     178             : 
     179             :     virtual SdrModel*   GetMarkedObjModel() const SAL_OVERRIDE;
     180             :     virtual bool        Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0) SAL_OVERRIDE;
     181             :     using SdrExchangeView::Paste;
     182             : 
     183             :     /** returns true if we have an undo manager and there is an open list undo action */
     184             :     bool isRecordingUndo() const;
     185             : 
     186             :     virtual void AddCustomHdl() SAL_OVERRIDE;
     187             : 
     188           0 :     SmartTagSet& getSmartTags() { return maSmartTags; }
     189             :     void selectSmartTag( const SmartTagReference& xTag );
     190             :     void updateHandles();
     191             : 
     192             :     virtual SdrViewContext GetContext() const SAL_OVERRIDE;
     193             :     virtual bool HasMarkablePoints() const SAL_OVERRIDE;
     194             :     virtual sal_uLong GetMarkablePointCount() const SAL_OVERRIDE;
     195             :     virtual bool HasMarkedPoints() const SAL_OVERRIDE;
     196             :     virtual sal_uLong GetMarkedPointCount() const SAL_OVERRIDE;
     197             :     virtual bool IsPointMarkable(const SdrHdl& rHdl) const SAL_OVERRIDE;
     198             :     virtual bool MarkPoint(SdrHdl& rHdl, bool bUnmark=false) SAL_OVERRIDE;
     199             :     virtual void CheckPossibilities() SAL_OVERRIDE;
     200             :     virtual sal_Bool MarkPoints(const ::Rectangle* pRect, sal_Bool bUnmark);
     201             :     using SdrMarkView::MarkPoints;
     202             : 
     203             :     bool ShouldToggleOn(
     204             :         const bool bBulletOnOffMode,
     205             :         const bool bNormalBullet);
     206             : 
     207             :     /** change the bullets/numbering of the marked objects
     208             : 
     209             :         @param bToggle
     210             :         true: just toggle the current bullets/numbering on --> off resp. off --> on
     211             : 
     212             :         @param bHandleBullets
     213             :         true: handle bullets
     214             :         false: handle numbering
     215             : 
     216             :         @param pNumRule
     217             :         numbering rule which needs to be applied. can be 0.
     218             : 
     219             :         @param bSwitchOff
     220             :         true: switch off bullets/numbering
     221             :     */
     222             :     void ChangeMarkedObjectsBulletsNumbering(
     223             :         const bool bToggle,
     224             :         const bool bHandleBullets,
     225             :         const SvxNumRule* pNumRule,
     226             :         const bool bSwitchOff);
     227             : 
     228           0 :     void SetPossibilitiesDirty() { bPossibilitiesDirty = true; }
     229           0 :     void SetMoveAllowed( bool bSet ) { bMoveAllowed = bSet; }
     230           0 :     void SetMoveProtected( bool bSet ) { bMoveProtect = bSet; }
     231           0 :     void SetResizeFreeAllowed( bool bSet ) { bResizeFreeAllowed = bSet; }
     232           0 :     void SetResizePropAllowed( bool bSet ) { bResizePropAllowed = bSet; }
     233           0 :     void SetResizeProtected( bool bSet ) { bResizeProtect = bSet; }
     234             : 
     235             :     void SetMarkedPointsSmoothPossible( bool bSet ) { bSetMarkedPointsSmoothPossible = bSet; }
     236             :     void SetMarkedSegmentsKindPossible( bool bSet ) { bSetMarkedSegmentsKindPossible = bSet; }
     237             : 
     238             :     SdrObject* GetEmptyPresentationObject( PresObjKind eKind );
     239             :     SdPage* GetPage();
     240             :     SdrObject* GetSelectedSingleObject(SdPage* pPage);
     241             : 
     242             : protected:
     243             :     DECL_LINK( OnParagraphInsertedHdl, ::Outliner * );
     244             :     DECL_LINK( OnParagraphRemovingHdl, ::Outliner * );
     245             : 
     246             :     virtual void OnBeginPasteOrDrop( PasteOrDropInfos* pInfos ) SAL_OVERRIDE;
     247             :     virtual void OnEndPasteOrDrop( PasteOrDropInfos* pInfos ) SAL_OVERRIDE;
     248             : 
     249             :     SdDrawDocument&         mrDoc;
     250             :     DrawDocShell*           mpDocSh;
     251             :     ViewShell*              mpViewSh;
     252             :     SdrMarkList*            mpDragSrcMarkList;
     253             :     SdrObject*              mpDropMarkerObj;
     254             :     SdrDropMarkerOverlay*   mpDropMarker;
     255             :     sal_uInt16                  mnDragSrcPgNum;
     256             :     Point                   maDropPos;
     257             :     ::std::vector<OUString> maDropFileVector;
     258             :     sal_Int8                mnAction;
     259             :     Timer                   maDropErrorTimer;
     260             :     Timer                   maDropInsertFileTimer;
     261             :     sal_uInt16                  mnLockRedrawSmph;
     262             :     boost::ptr_vector<SdViewRedrawRec> maLockedRedraws;
     263             :     bool                    mbIsDropAllowed;
     264             : 
     265             :                             DECL_LINK( DropErrorHdl, void* );
     266             :                             DECL_LINK( DropInsertFileHdl, void* );
     267             :                             DECL_LINK( ExecuteNavigatorDrop, SdNavigatorDropEvent* pSdNavigatorDropEvent );
     268             : 
     269             :     void ImplClearDrawDropMarker();
     270             : 
     271             :     SmartTagSet             maSmartTags;
     272             : 
     273             : private:
     274             :     ::std::auto_ptr<ViewClipboard> mpClipboard;
     275             : };
     276             : 
     277             : 
     278          14 : DrawDocShell* View::GetDocSh (void) const
     279             : {
     280          14 :     return mpDocSh;
     281             : }
     282          14 : SdDrawDocument& View::GetDoc (void) const
     283             : {
     284          14 :     return mrDoc;
     285             : }
     286             : 
     287          82 : ViewShell* View::GetViewShell (void) const
     288             : {
     289          82 :     return mpViewSh;
     290             : }
     291             : 
     292             : } // end of namespace sd
     293             : 
     294             : #endif
     295             : 
     296             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10