LCOV - code coverage report
Current view: top level - libreoffice/sd/source/ui/inc - sdtreelb.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 3 0.0 %
Date: 2012-12-27 Functions: 0 5 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 _SDTREELB_HXX
      21             : #define _SDTREELB_HXX
      22             : 
      23             : #include <svtools/transfer.hxx>
      24             : 
      25             : #include "sdresid.hxx"
      26             : #include "pres.hxx"
      27             : #include "sddllapi.h"
      28             : #include <tools/string.hxx>
      29             : #include <svtools/treelistbox.hxx>
      30             : #include <svl/urlbmk.hxx>
      31             : #include <tools/ref.hxx>
      32             : #include "sdxfer.hxx"
      33             : #include <boost/scoped_ptr.hpp>
      34             : #include <boost/function.hpp>
      35             : 
      36             : class SdDrawDocument;
      37             : class SfxMedium;
      38             : class SfxViewFrame;
      39             : class SdNavigatorWin;
      40             : class SdrObject;
      41             : class SdrObjList;
      42             : class SdPage;
      43             : class SvTreeListEntry;
      44             : 
      45             : namespace sd {
      46             : class ViewShell;
      47             : 
      48             : class DrawDocShell;
      49             : #ifndef SV_DECL_DRAW_DOC_SHELL_DEFINED
      50             : #define SV_DECL_DRAW_DOC_SHELL_DEFINED
      51           0 : SV_DECL_REF(DrawDocShell)
      52             : #endif
      53             : }
      54             : 
      55             : /*************************************************************************
      56             : |*
      57             : |* Effekte-Tab-Dialog
      58             : |*
      59             : \************************************************************************/
      60             : 
      61             : class SD_DLLPUBLIC SdPageObjsTLB : public SvTreeListBox
      62             : {
      63             : private:
      64             : 
      65             :     static sal_Bool  SD_DLLPRIVATE bIsInDrag;      // static, falls der Navigator im ExecuteDrag geloescht wird
      66             : 
      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             :         SD_DLLPRIVATE virtual               ~SdPageObjsTransferable();
     102             : 
     103             :         SD_DLLPRIVATE virtual void      AddSupportedFormats();
     104             :         SD_DLLPRIVATE virtual sal_Bool  GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
     105             :         SD_DLLPRIVATE virtual void      DragFinished( sal_Int8 nDropAction );
     106             : 
     107             :         SD_DLLPRIVATE virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException );
     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             :     sal_Bool                    mbDragEnabled;
     134             :     String                  maDocName;
     135             :     ::sd::DrawDocShellRef       mxBookmarkDocShRef; // Zum Laden von Bookmarks
     136             :     ::sd::DrawDocShell*         mpDropDocSh;
     137             :     SdNavigatorWin*         mpDropNavWin;
     138             :     SfxViewFrame*           mpFrame;
     139             : 
     140             :     // DragSourceHelper
     141             :     virtual void            StartDrag( sal_Int8 nAction, const Point& rPosPixel );
     142             : 
     143             :     // DropTargetHelper
     144             :     virtual sal_Int8        AcceptDrop( const AcceptDropEvent& rEvt );
     145             :     virtual sal_Int8        ExecuteDrop( const ExecuteDropEvent& rEvt );
     146             : 
     147             :     virtual void            RequestingChildren( SvTreeListEntry* pParent );
     148             : 
     149             :     void                    DoDrag();
     150             :     void                    OnDragFinished( sal_uInt8 nDropAction );
     151             : 
     152             :     /** Return the name of the object.  When the object has no user supplied
     153             :         name and the bCreate flag is <TRUE/> then a name is created
     154             :         automatically.  Additionally the mbShowAllShapes flag is taken into
     155             :         account when there is no user supplied name.  When this flag is
     156             :         <FALSE/> then no name is created.
     157             :         @param pObject
     158             :             When this is NULL then an empty string is returned, regardless
     159             :             of the value of bCreate.
     160             :         @param bCreate
     161             :             This flag controls for objects without user supplied name
     162             :             whether a name is created.  When a name is created then this
     163             :             name is not stored in the object.
     164             :     */
     165             :     String GetObjectName (
     166             :         const SdrObject* pObject,
     167             :         const bool bCreate = true) const;
     168             :     void                    CloseBookmarkDoc();
     169             :                             DECL_STATIC_LINK(SdPageObjsTLB, ExecDragHdl, void*);
     170             : 
     171             :     /** Handle the reordering of entries in the navigator.  This method
     172             :         reorders both the involved shapes in their page as well as the
     173             :         associated list box entries.
     174             :     */
     175             :     virtual sal_Bool NotifyMoving(
     176             :         SvTreeListEntry*  pTarget,
     177             :         SvTreeListEntry*  pEntry,
     178             :         SvTreeListEntry*& rpNewParent,
     179             :         sal_uLong&        rNewChildPos);
     180             : 
     181             :     using Window::GetDropTarget;
     182             :     virtual SvTreeListEntry* GetDropTarget (const Point& rLocation);
     183             : 
     184             : public:
     185             : 
     186             :                             SdPageObjsTLB( Window* pParent, const SdResId& rSdResId );
     187             :                             ~SdPageObjsTLB();
     188             : 
     189             :     virtual void            SelectHdl();
     190             :     virtual void            KeyInput( const KeyEvent& rKEvt );
     191             : 
     192           0 :     void                    SetViewFrame( SfxViewFrame* pViewFrame ) { mpFrame = pViewFrame; }
     193             :     SfxViewFrame*           GetViewFrame() const { return mpFrame; }
     194             : 
     195             :     void                    Fill( const SdDrawDocument*, sal_Bool bAllPages, const String& rDocName );
     196             :     void                    Fill( const SdDrawDocument*, SfxMedium* pSfxMedium, const String& rDocName );
     197             :     void                    SetShowAllShapes (const bool bShowAllShapes, const bool bFill);
     198             :     bool                    GetShowAllShapes (void) const;
     199             :     sal_Bool                    IsEqualToDoc( const SdDrawDocument* pInDoc = NULL );
     200             :     sal_Bool                    HasSelectedChildren( const String& rName );
     201             :     sal_Bool                    SelectEntry( const String& rName );
     202             :     String                  GetSelectEntry();
     203             : 
     204             :     /*************************************************************************
     205             :     |*
     206             :     |* Selektierte Eintrage zurueckgeben
     207             :     |* nDepth == 0 -> Seiten
     208             :     |* nDepth == 1 -> Objekte
     209             :     |*
     210             :     \************************************************************************/
     211             : 
     212             :     std::vector<rtl::OUString> GetSelectEntryList (const sal_uInt16 nDepth) const;
     213             : 
     214             :     SdDrawDocument*         GetBookmarkDoc(SfxMedium* pMedium = NULL);
     215             :     ::sd::DrawDocShell*         GetDropDocSh() { return(mpDropDocSh); }
     216             : 
     217           0 :     sal_Bool                    IsLinkableSelected() const { return mbLinkableSelected; }
     218             : 
     219             :     static sal_Bool             IsInDrag();
     220             :     using SvTreeListBox::ExecuteDrop;
     221             : 
     222             :     using SvTreeListBox::SelectEntry;
     223             : 
     224             :     /** Return the view shell that is linked to the given doc shell.
     225             :         Call this method when the there is a chance that the doc shell
     226             :         has been disconnected from the view shell (but not the other
     227             :         way round.)
     228             :         @return
     229             :             May return <NULL/> when the link between view shell and
     230             :             doc shell has been severed.
     231             :     */
     232             :     static ::sd::ViewShell* GetViewShellForDocShell (::sd::DrawDocShell &rDocShell);
     233             : 
     234             : private:
     235             :     /** This flag controls whether all shapes are shown as children of pages
     236             :         and group shapes or only the named shapes.
     237             :     */
     238             :     bool mbShowAllShapes;
     239             :     /** This flag controls whether to show all pages.
     240             :     */
     241             :     bool mbShowAllPages;
     242             : 
     243             :     /** Return <TRUE/> when the current transferable may be dropped at the
     244             :         given list box entry.
     245             :     */
     246             :     bool IsDropAllowed (SvTreeListEntry* pEntry);
     247             : 
     248             :     /** This inner class is defined in sdtreelb.cxx and is basically a
     249             :         container for the icons used in the list box for the entries.
     250             :     */
     251             :     class IconProvider;
     252             : 
     253             :     /** Add one list box entry for the parent of the given shapes and one child entry for
     254             :         each of the given shapes.
     255             :         @param rList
     256             :             The container of shapes that are to be inserted.
     257             :         @param pShape
     258             :             The parent shape or NULL when the parent is a page.
     259             :         @param rsName
     260             :             The name to be displayed for the new parent node.
     261             :         @param bIsExcluded
     262             :             Some pages can be excluded (from the show?).
     263             :         @param pParentEntry
     264             :             The parent entry of the new parent entry.
     265             :         @param rIconProvider
     266             :             Icons used to visualize the different shape and page types.
     267             :     */
     268             :     void AddShapeList (
     269             :         const SdrObjList& rList,
     270             :         SdrObject* pShape,
     271             :         const ::rtl::OUString& rsName,
     272             :         const bool bIsExcluded,
     273             :         SvTreeListEntry* pParentEntry,
     274             :         const IconProvider& rIconProvider);
     275             : 
     276             :     /** Add the given object to a transferable object so that the object can
     277             :         be dragged and dropped without having a name.
     278             :     */
     279             :     void AddShapeToTransferable (
     280             :         SdTransferable& rTransferable,
     281             :         SdrObject& rObject) const;
     282             : };
     283             : 
     284             : #endif      // _SDTREELB_HXX
     285             : 
     286             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10