LCOV - code coverage report
Current view: top level - sd/source/ui/inc - sdtreelb.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 4 0.0 %
Date: 2014-04-14 Functions: 0 4 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_SD_SOURCE_UI_INC_SDTREELB_HXX
      21             : #define INCLUDED_SD_SOURCE_UI_INC_SDTREELB_HXX
      22             : 
      23             : #include <svtools/transfer.hxx>
      24             : 
      25             : #include "sdresid.hxx"
      26             : #include "pres.hxx"
      27             : #include "sddllapi.h"
      28             : #include <svtools/treelistbox.hxx>
      29             : #include <svl/urlbmk.hxx>
      30             : #include <tools/ref.hxx>
      31             : #include "sdxfer.hxx"
      32             : #include <vector>
      33             : using namespace std;
      34             : #include <boost/scoped_ptr.hpp>
      35             : #include <boost/function.hpp>
      36             : 
      37             : class SdDrawDocument;
      38             : class SfxMedium;
      39             : class SfxViewFrame;
      40             : class SdNavigatorWin;
      41             : class SdrObject;
      42             : class SdrObjList;
      43             : class SdPage;
      44             : class SvTreeListEntry;
      45             : 
      46             : namespace sd {
      47             : class ViewShell;
      48             : 
      49             : class DrawDocShell;
      50             : #ifndef SV_DECL_DRAW_DOC_SHELL_DEFINED
      51             : #define SV_DECL_DRAW_DOC_SHELL_DEFINED
      52             : typedef ::tools::SvRef<DrawDocShell> DrawDocShellRef;
      53             : #endif
      54             : }
      55             : 
      56             : /**
      57             :  * Effect-Tab-Dialog
      58             :  */
      59             : class SD_DLLPUBLIC SdPageObjsTLB : public SvTreeListBox
      60             : {
      61             : private:
      62             : 
      63             :     static sal_Bool  SAL_DLLPRIVATE bIsInDrag;      ///< static, in the case the navigator is deleted in ExecuteDrag
      64             : 
      65             :     // set contenttree in SdNavigatorWin
      66             :     sal_Bool                           bisInSdNavigatorWin;
      67             : public:
      68             : 
      69             :     // nested class to implement the TransferableHelper
      70             :     class SdPageObjsTransferable : public SdTransferable
      71             :     {
      72             :     public:
      73             :         SdPageObjsTransferable(
      74             :             SdPageObjsTLB& rParent,
      75             :             const INetBookmark& rBookmark,
      76             :             ::sd::DrawDocShell& rDocShell,
      77             :             NavigatorDragType eDragType,
      78             :             const ::com::sun::star::uno::Any& rTreeListBoxData );
      79             :         ::sd::DrawDocShell&     GetDocShell() const;
      80             :         NavigatorDragType   GetDragType() const;
      81             : 
      82             :         static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
      83             :         static SdPageObjsTransferable* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxData ) throw();
      84             :         /** Return a temporary transferable data flavor that is used
      85             :             internally in the navigator for reordering entries.  Its
      86             :             lifetime ends with the office application.
      87             :         */
      88             :         static sal_uInt32 GetListBoxDropFormatId (void);
      89             : 
      90             :     private:
      91             :         /** Temporary drop flavor id that is used internally in the
      92             :             navigator.
      93             :         */
      94             :         static sal_uInt32 mnListBoxDropFormatId;
      95             : 
      96             :         SdPageObjsTLB&      mrParent;
      97             :         INetBookmark        maBookmark;
      98             :         ::sd::DrawDocShell&     mrDocShell;
      99             :         NavigatorDragType   meDragType;
     100             :         const ::com::sun::star::uno::Any maTreeListBoxData;
     101             :         SAL_DLLPRIVATE virtual               ~SdPageObjsTransferable();
     102             : 
     103             :         SAL_DLLPRIVATE virtual void      AddSupportedFormats() SAL_OVERRIDE;
     104             :         SAL_DLLPRIVATE virtual bool      GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) SAL_OVERRIDE;
     105             :         SAL_DLLPRIVATE virtual void      DragFinished( sal_Int8 nDropAction ) SAL_OVERRIDE;
     106             : 
     107             :         SAL_DLLPRIVATE virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     108             :     };
     109             : 
     110             :     friend class SdPageObjsTLB::SdPageObjsTransferable;
     111             : 
     112             :     /** Determine whether the specified page belongs to the current show
     113             :         which is either the standard show or a custom show.
     114             :         @param pPage
     115             :             Pointer to the page for which to check whether it belongs to the
     116             :             show.
     117             :         @return
     118             :             Returns <FALSE/> if there is no custom show or if the current
     119             :             show does not contain the specified page at least once.
     120             :     */
     121             :     bool PageBelongsToCurrentShow (const SdPage* pPage) const;
     122             : 
     123             : protected:
     124             : 
     125             :     Window*                 mpParent;
     126             :     const SdDrawDocument*   mpDoc;
     127             :     SdDrawDocument*         mpBookmarkDoc;
     128             :     SfxMedium*              mpMedium;
     129             :     SfxMedium*              mpOwnMedium;
     130             :     Image                   maImgOle;
     131             :     Image                   maImgGraphic;
     132             :     sal_Bool                mbLinkableSelected;
     133             :     OUString                maDocName;
     134             :     ::sd::DrawDocShellRef   mxBookmarkDocShRef; ///< for the loading of bookmarks
     135             :     SdNavigatorWin*         mpDropNavWin;
     136             :     SfxViewFrame*           mpFrame;
     137             :     vector<OUString>        maTreeItem;
     138             :     sal_Bool                mbSaveTreeItemState;
     139             :     OUString                maSelectionEntryText;
     140             : 
     141             :     // DragSourceHelper
     142             :     virtual void            StartDrag( sal_Int8 nAction, const Point& rPosPixel ) SAL_OVERRIDE;
     143             : 
     144             :     // DropTargetHelper
     145             :     virtual sal_Int8        AcceptDrop( const AcceptDropEvent& rEvt ) SAL_OVERRIDE;
     146             :     virtual sal_Int8        ExecuteDrop( const ExecuteDropEvent& rEvt ) SAL_OVERRIDE;
     147             : 
     148             :     virtual void            RequestingChildren( SvTreeListEntry* pParent ) SAL_OVERRIDE;
     149             : 
     150             :     void                    DoDrag();
     151             :     void                    OnDragFinished( sal_uInt8 nDropAction );
     152             : 
     153             :     /** Return the name of the object.  When the object has no user supplied
     154             :         name and the bCreate flag is <TRUE/> then a name is created
     155             :         automatically.  Additionally the mbShowAllShapes flag is taken into
     156             :         account when there is no user supplied name.  When this flag is
     157             :         <FALSE/> then no name is created.
     158             :         @param pObject
     159             :             When this is NULL then an empty string is returned, regardless
     160             :             of the value of bCreate.
     161             :         @param bCreate
     162             :             This flag controls for objects without user supplied name
     163             :             whether a name is created.  When a name is created then this
     164             :             name is not stored in the object.
     165             :     */
     166             :     OUString GetObjectName (
     167             :         const SdrObject* pObject,
     168             :         const bool bCreate = true) const;
     169             :     void                    CloseBookmarkDoc();
     170             :                             DECL_STATIC_LINK(SdPageObjsTLB, ExecDragHdl, void*);
     171             : 
     172             :     /** Handle the reordering of entries in the navigator.  This method
     173             :         reorders both the involved shapes in their page as well as the
     174             :         associated list box entries.
     175             :     */
     176             :     virtual TriState NotifyMoving(
     177             :         SvTreeListEntry*  pTarget,
     178             :         SvTreeListEntry*  pEntry,
     179             :         SvTreeListEntry*& rpNewParent,
     180             :         sal_uLong&        rNewChildPos) SAL_OVERRIDE;
     181             : 
     182             :     using Window::GetDropTarget;
     183             :     virtual SvTreeListEntry* GetDropTarget (const Point& rLocation) SAL_OVERRIDE;
     184             :     virtual void InitEntry(SvTreeListEntry*, const OUString&, const Image&, const Image&,SvLBoxButtonKind) SAL_OVERRIDE;
     185             : 
     186             : public:
     187             : 
     188             :     SdPageObjsTLB( Window* pParent, const SdResId& rSdResId );
     189             :     SdPageObjsTLB( Window* pParent, WinBits nStyle );
     190             :                             virtual ~SdPageObjsTLB();
     191             : 
     192             :    // helper function for   GetEntryAltText and GetEntryLongDescription
     193             :     OUString          getAltLongDescText( SvTreeListEntry* pEntry , sal_Bool isAltText) const;
     194             :     OUString          GetEntryAltText( SvTreeListEntry* pEntry ) const SAL_OVERRIDE;
     195             :     OUString          GetEntryLongDescription( SvTreeListEntry* pEntry ) const SAL_OVERRIDE;
     196             :     virtual void            SelectHdl() SAL_OVERRIDE;
     197             :     virtual void            KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
     198             : 
     199           0 :     void                    SetViewFrame( SfxViewFrame* pViewFrame ) { mpFrame = pViewFrame; }
     200             :     SfxViewFrame*           GetViewFrame() const { return mpFrame; }
     201             : 
     202             :     void                    Fill( const SdDrawDocument*, sal_Bool bAllPages, const OUString& rDocName );
     203             :     void                    Fill( const SdDrawDocument*, SfxMedium* pSfxMedium, const OUString& rDocName );
     204             :     void                    SetShowAllShapes (const bool bShowAllShapes, const bool bFill);
     205             :     bool                    GetShowAllShapes (void) const;
     206             :     sal_Bool                IsEqualToDoc( const SdDrawDocument* pInDoc = NULL );
     207             :     sal_Bool                HasSelectedChildren( const OUString& rName );
     208             :     sal_Bool                SelectEntry( const OUString& rName );
     209             :     OUString                GetSelectEntry();
     210             : 
     211             :     //Mark Current Entry
     212             :     void                    MarkCurEntry( const OUString& rName );
     213           0 :     void                    SetSdNavigatorWinFlag(sal_Bool isInSdNavigatorWin){bisInSdNavigatorWin =isInSdNavigatorWin;};
     214             :     void                    FreshCurEntry();
     215             : 
     216             :     void                    Clear();
     217           0 :     void                    SetSaveTreeItemStateFlag(sal_Bool bState){mbSaveTreeItemState = bState;}
     218             :     void                    SaveExpandedTreeItemState(SvTreeListEntry* pEntry, vector<OUString>& vectTreeItem);
     219             : 
     220             :     /** return selected entries
     221             :           nDepth == 0 -> pages
     222             :           nDepth == 1 -> objects  */
     223             : 
     224             :     std::vector<OUString> GetSelectEntryList (const sal_uInt16 nDepth) const;
     225             : 
     226             :     SdDrawDocument*         GetBookmarkDoc(SfxMedium* pMedium = NULL);
     227             : 
     228           0 :     sal_Bool                    IsLinkableSelected() const { return mbLinkableSelected; }
     229             : 
     230             :     static sal_Bool             IsInDrag();
     231             :     using SvTreeListBox::ExecuteDrop;
     232             : 
     233             :     using SvTreeListBox::SelectEntry;
     234             : 
     235             :     /** Return the view shell that is linked to the given doc shell.
     236             :         Call this method when the there is a chance that the doc shell
     237             :         has been disconnected from the view shell (but not the other
     238             :         way round.)
     239             :         @return
     240             :             May return <NULL/> when the link between view shell and
     241             :             doc shell has been severed.
     242             :     */
     243             :     static ::sd::ViewShell* GetViewShellForDocShell (::sd::DrawDocShell &rDocShell);
     244             : 
     245             : private:
     246             :     /** This flag controls whether all shapes are shown as children of pages
     247             :         and group shapes or only the named shapes.
     248             :     */
     249             :     bool mbShowAllShapes;
     250             :     /** This flag controls whether to show all pages.
     251             :     */
     252             :     bool mbShowAllPages;
     253             : 
     254             :     /** Return <TRUE/> when the current transferable may be dropped at the
     255             :         given list box entry.
     256             :     */
     257             :     bool IsDropAllowed (SvTreeListEntry* pEntry);
     258             : 
     259             :     /** This inner class is defined in sdtreelb.cxx and is basically a
     260             :         container for the icons used in the list box for the entries.
     261             :     */
     262             :     class IconProvider;
     263             : 
     264             :     /** Add one list box entry for the parent of the given shapes and one child entry for
     265             :         each of the given shapes.
     266             :         @param rList
     267             :             The container of shapes that are to be inserted.
     268             :         @param pShape
     269             :             The parent shape or NULL when the parent is a page.
     270             :         @param rsName
     271             :             The name to be displayed for the new parent node.
     272             :         @param bIsExcluded
     273             :             Some pages can be excluded (from the show?).
     274             :         @param pParentEntry
     275             :             The parent entry of the new parent entry.
     276             :         @param rIconProvider
     277             :             Icons used to visualize the different shape and page types.
     278             :     */
     279             :     void AddShapeList (
     280             :         const SdrObjList& rList,
     281             :         SdrObject* pShape,
     282             :         const OUString& rsName,
     283             :         const bool bIsExcluded,
     284             :         SvTreeListEntry* pParentEntry,
     285             :         const IconProvider& rIconProvider);
     286             : 
     287             :     /** Add the given object to a transferable object so that the object can
     288             :         be dragged and dropped without having a name.
     289             :     */
     290             :     void AddShapeToTransferable (
     291             :         SdTransferable& rTransferable,
     292             :         SdrObject& rObject) const;
     293             : };
     294             : 
     295             : #endif // INCLUDED_SD_SOURCE_UI_INC_SDTREELB_HXX
     296             : 
     297             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10