LCOV - code coverage report
Current view: top level - sd/source/ui/inc - sdtreelb.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 3 0.0 %
Date: 2012-08-25 Functions: 0 5 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef _SDTREELB_HXX
      30                 :            : #define _SDTREELB_HXX
      31                 :            : 
      32                 :            : #include <svtools/transfer.hxx>
      33                 :            : 
      34                 :            : #include "sdresid.hxx"
      35                 :            : #include "pres.hxx"
      36                 :            : #include "sddllapi.h"
      37                 :            : #include <tools/string.hxx>
      38                 :            : #include <svtools/svtreebx.hxx>
      39                 :            : #include <svl/urlbmk.hxx>
      40                 :            : #include <tools/ref.hxx>
      41                 :            : #include "sdxfer.hxx"
      42                 :            : 
      43                 :            : class SdDrawDocument;
      44                 :            : class SfxMedium;
      45                 :            : class SfxViewFrame;
      46                 :            : class SdNavigatorWin;
      47                 :            : class SdrObject;
      48                 :            : class SdrObjList;
      49                 :            : class SdPage;
      50                 :            : class SvLBoxEntry;
      51                 :            : 
      52                 :            : namespace sd {
      53                 :            : class DrawDocShell;
      54                 :            : #ifndef SV_DECL_DRAW_DOC_SHELL_DEFINED
      55                 :            : #define SV_DECL_DRAW_DOC_SHELL_DEFINED
      56                 :          0 : SV_DECL_REF(DrawDocShell)
      57                 :            : #endif
      58                 :            : }
      59                 :            : 
      60                 :            : /*************************************************************************
      61                 :            : |*
      62                 :            : |* Effekte-Tab-Dialog
      63                 :            : |*
      64                 :            : \************************************************************************/
      65                 :            : 
      66                 :            : class SD_DLLPUBLIC SdPageObjsTLB : public SvTreeListBox
      67                 :            : {
      68                 :            : private:
      69                 :            : 
      70                 :            :     static sal_Bool  SD_DLLPRIVATE bIsInDrag;      // static, falls der Navigator im ExecuteDrag geloescht wird
      71                 :            : 
      72                 :            : public:
      73                 :            : 
      74                 :            :     // nested class to implement the TransferableHelper
      75                 :            :     class SdPageObjsTransferable : public SdTransferable
      76                 :            :     {
      77                 :            :     public:
      78                 :            :         SdPageObjsTransferable(
      79                 :            :             SdPageObjsTLB& rParent,
      80                 :            :             const INetBookmark& rBookmark,
      81                 :            :             ::sd::DrawDocShell& rDocShell,
      82                 :            :             NavigatorDragType eDragType,
      83                 :            :             const ::com::sun::star::uno::Any& rTreeListBoxData );
      84                 :            :         ::sd::DrawDocShell&     GetDocShell() const;
      85                 :            :         NavigatorDragType   GetDragType() const;
      86                 :            : 
      87                 :            :         static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
      88                 :            :         static SdPageObjsTransferable* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxData ) throw();
      89                 :            :         /** Return a temporary transferable data flavor that is used
      90                 :            :             internally in the navigator for reordering entries.  Its
      91                 :            :             lifetime ends with the office application.
      92                 :            :         */
      93                 :            :         static sal_uInt32 GetListBoxDropFormatId (void);
      94                 :            : 
      95                 :            :     private:
      96                 :            :         /** Temporary drop flavor id that is used internally in the
      97                 :            :             navigator.
      98                 :            :         */
      99                 :            :         static sal_uInt32 mnListBoxDropFormatId;
     100                 :            : 
     101                 :            :         SdPageObjsTLB&      mrParent;
     102                 :            :         INetBookmark        maBookmark;
     103                 :            :         ::sd::DrawDocShell&     mrDocShell;
     104                 :            :         NavigatorDragType   meDragType;
     105                 :            :         const ::com::sun::star::uno::Any maTreeListBoxData;
     106                 :            : 
     107                 :            :         SD_DLLPRIVATE virtual               ~SdPageObjsTransferable();
     108                 :            : 
     109                 :            :         SD_DLLPRIVATE virtual void      AddSupportedFormats();
     110                 :            :         SD_DLLPRIVATE virtual sal_Bool  GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
     111                 :            :         SD_DLLPRIVATE virtual void      DragFinished( sal_Int8 nDropAction );
     112                 :            : 
     113                 :            :         SD_DLLPRIVATE virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException );
     114                 :            :     };
     115                 :            : 
     116                 :            :     friend class SdPageObjsTLB::SdPageObjsTransferable;
     117                 :            : 
     118                 :            :     /** Determine whether the specified page belongs to the current show
     119                 :            :         which is either the standard show or a custom show.
     120                 :            :         @param pPage
     121                 :            :             Pointer to the page for which to check whether it belongs to the
     122                 :            :             show.
     123                 :            :         @return
     124                 :            :             Returns <FALSE/> if there is no custom show or if the current
     125                 :            :             show does not contain the specified page at least once.
     126                 :            :     */
     127                 :            :     bool PageBelongsToCurrentShow (const SdPage* pPage) const;
     128                 :            : 
     129                 :            : protected:
     130                 :            : 
     131                 :            :     Window*                 mpParent;
     132                 :            :     const SdDrawDocument*   mpDoc;
     133                 :            :     SdDrawDocument*         mpBookmarkDoc;
     134                 :            :     SfxMedium*              mpMedium;
     135                 :            :     SfxMedium*              mpOwnMedium;
     136                 :            :     Image                   maImgOle;
     137                 :            :     Image                   maImgGraphic;
     138                 :            :     sal_Bool                    mbLinkableSelected;
     139                 :            :     sal_Bool                    mbDragEnabled;
     140                 :            :     String                  maDocName;
     141                 :            :     ::sd::DrawDocShellRef       mxBookmarkDocShRef; // Zum Laden von Bookmarks
     142                 :            :     ::sd::DrawDocShell*         mpDropDocSh;
     143                 :            :     SdNavigatorWin*         mpDropNavWin;
     144                 :            :     SfxViewFrame*           mpFrame;
     145                 :            : 
     146                 :            :     // DragSourceHelper
     147                 :            :     virtual void            StartDrag( sal_Int8 nAction, const Point& rPosPixel );
     148                 :            : 
     149                 :            :     // DropTargetHelper
     150                 :            :     virtual sal_Int8        AcceptDrop( const AcceptDropEvent& rEvt );
     151                 :            :     virtual sal_Int8        ExecuteDrop( const ExecuteDropEvent& rEvt );
     152                 :            : 
     153                 :            :     virtual void            RequestingChildren( SvLBoxEntry* pParent );
     154                 :            : 
     155                 :            :     void                    DoDrag();
     156                 :            :     void                    OnDragFinished( sal_uInt8 nDropAction );
     157                 :            : 
     158                 :            :     /** Return the name of the object.  When the object has no user supplied
     159                 :            :         name and the bCreate flag is <TRUE/> then a name is created
     160                 :            :         automatically.  Additionally the mbShowAllShapes flag is taken into
     161                 :            :         account when there is no user supplied name.  When this flag is
     162                 :            :         <FALSE/> then no name is created.
     163                 :            :         @param pObject
     164                 :            :             When this is NULL then an empty string is returned, regardless
     165                 :            :             of the value of bCreate.
     166                 :            :         @param bCreate
     167                 :            :             This flag controls for objects without user supplied name
     168                 :            :             whether a name is created.  When a name is created then this
     169                 :            :             name is not stored in the object.
     170                 :            :     */
     171                 :            :     String GetObjectName (
     172                 :            :         const SdrObject* pObject,
     173                 :            :         const bool bCreate = true) const;
     174                 :            :     void                    CloseBookmarkDoc();
     175                 :            :                             DECL_STATIC_LINK(SdPageObjsTLB, ExecDragHdl, void*);
     176                 :            : 
     177                 :            :     /** Handle the reordering of entries in the navigator.  This method
     178                 :            :         reorders both the involved shapes in their page as well as the
     179                 :            :         associated list box entries.
     180                 :            :     */
     181                 :            :     virtual sal_Bool NotifyMoving(
     182                 :            :         SvLBoxEntry*  pTarget,
     183                 :            :         SvLBoxEntry*  pEntry,
     184                 :            :         SvLBoxEntry*& rpNewParent,
     185                 :            :         sal_uLong&        rNewChildPos);
     186                 :            : 
     187                 :            :     using Window::GetDropTarget;
     188                 :            :     virtual SvLBoxEntry* GetDropTarget (const Point& rLocation);
     189                 :            : 
     190                 :            : public:
     191                 :            : 
     192                 :            :                             SdPageObjsTLB( Window* pParent, const SdResId& rSdResId );
     193                 :            :                             ~SdPageObjsTLB();
     194                 :            : 
     195                 :            :     virtual void            SelectHdl();
     196                 :            :     virtual void            KeyInput( const KeyEvent& rKEvt );
     197                 :            : 
     198                 :          0 :     void                    SetViewFrame( SfxViewFrame* pViewFrame ) { mpFrame = pViewFrame; }
     199                 :            :     SfxViewFrame*           GetViewFrame() const { return mpFrame; }
     200                 :            : 
     201                 :            :     void                    Fill( const SdDrawDocument*, sal_Bool bAllPages, const String& rDocName );
     202                 :            :     void                    Fill( const SdDrawDocument*, SfxMedium* pSfxMedium, const String& rDocName );
     203                 :            :     void                    SetShowAllShapes (const bool bShowAllShapes, const bool bFill);
     204                 :            :     bool                    GetShowAllShapes (void) const;
     205                 :            :     sal_Bool                    IsEqualToDoc( const SdDrawDocument* pInDoc = NULL );
     206                 :            :     sal_Bool                    HasSelectedChildren( const String& rName );
     207                 :            :     sal_Bool                    SelectEntry( const String& rName );
     208                 :            :     String                  GetSelectEntry();
     209                 :            : 
     210                 :            :     /*************************************************************************
     211                 :            :     |*
     212                 :            :     |* Selektierte Eintrage zurueckgeben
     213                 :            :     |* nDepth == 0 -> Seiten
     214                 :            :     |* nDepth == 1 -> Objekte
     215                 :            :     |*
     216                 :            :     \************************************************************************/
     217                 :            : 
     218                 :            :     std::vector<rtl::OUString> GetSelectEntryList (const sal_uInt16 nDepth) const;
     219                 :            : 
     220                 :            :     SdDrawDocument*         GetBookmarkDoc(SfxMedium* pMedium = NULL);
     221                 :            :     ::sd::DrawDocShell*         GetDropDocSh() { return(mpDropDocSh); }
     222                 :            : 
     223                 :          0 :     sal_Bool                    IsLinkableSelected() const { return mbLinkableSelected; }
     224                 :            : 
     225                 :            :     static sal_Bool             IsInDrag();
     226                 :            :     using SvLBox::ExecuteDrop;
     227                 :            : 
     228                 :            :     using SvTreeListBox::SelectEntry;
     229                 :            : private:
     230                 :            :     /** This flag controls whether all shapes are shown as children of pages
     231                 :            :         and group shapes or only the named shapes.
     232                 :            :     */
     233                 :            :     bool mbShowAllShapes;
     234                 :            :     /** This flag controls whether to show all pages.
     235                 :            :     */
     236                 :            :     bool mbShowAllPages;
     237                 :            : 
     238                 :            :     /** Return <TRUE/> when the current transferable may be dropped at the
     239                 :            :         given list box entry.
     240                 :            :     */
     241                 :            :     bool IsDropAllowed (SvLBoxEntry* pEntry);
     242                 :            : 
     243                 :            :     /** This inner class is defined in sdtreelb.cxx and is basically a
     244                 :            :         container for the icons used in the list box for the entries.
     245                 :            :     */
     246                 :            :     class IconProvider;
     247                 :            : 
     248                 :            :     /** Add one list box entry for the parent of the given shapes and one child entry for
     249                 :            :         each of the given shapes.
     250                 :            :         @param rList
     251                 :            :             The container of shapes that are to be inserted.
     252                 :            :         @param pShape
     253                 :            :             The parent shape or NULL when the parent is a page.
     254                 :            :         @param rsName
     255                 :            :             The name to be displayed for the new parent node.
     256                 :            :         @param bIsExcluded
     257                 :            :             Some pages can be excluded (from the show?).
     258                 :            :         @param pParentEntry
     259                 :            :             The parent entry of the new parent entry.
     260                 :            :         @param rIconProvider
     261                 :            :             Icons used to visualize the different shape and page types.
     262                 :            :     */
     263                 :            :     void AddShapeList (
     264                 :            :         const SdrObjList& rList,
     265                 :            :         SdrObject* pShape,
     266                 :            :         const ::rtl::OUString& rsName,
     267                 :            :         const bool bIsExcluded,
     268                 :            :         SvLBoxEntry* pParentEntry,
     269                 :            :         const IconProvider& rIconProvider);
     270                 :            : 
     271                 :            :     /** Add the given object to a transferable object so that the object can
     272                 :            :         be dragged and dropped without having a name.
     273                 :            :     */
     274                 :            :     void AddShapeToTransferable (
     275                 :            :         SdTransferable& rTransferable,
     276                 :            :         SdrObject& rObject) const;
     277                 :            : };
     278                 :            : 
     279                 :            : #endif      // _SDTREELB_HXX
     280                 :            : 
     281                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10