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

Generated by: LCOV version 1.10