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

Generated by: LCOV version 1.11