LCOV - code coverage report
Current view: top level - sfx2/source/inc - templdgi.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 24 0.0 %
Date: 2014-11-03 Functions: 0 25 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             : #ifndef INCLUDED_SFX2_SOURCE_INC_TEMPLDGI_HXX
      20             : #define INCLUDED_SFX2_SOURCE_INC_TEMPLDGI_HXX
      21             : 
      22             : class SfxTemplateControllerItem;
      23             : 
      24             : #include <vcl/button.hxx>
      25             : #include <vcl/toolbox.hxx>
      26             : #include <vcl/lstbox.hxx>
      27             : #include <svl/lstner.hxx>
      28             : #include <svtools/treelistbox.hxx>
      29             : #include <svl/eitem.hxx>
      30             : 
      31             : #include <rsc/rscsfx.hxx>
      32             : #include <tools/rtti.hxx>
      33             : 
      34             : #include <sfx2/childwin.hxx>
      35             : #include <sfx2/templdlg.hxx>
      36             : 
      37             : class SfxStyleFamilies;
      38             : class SfxStyleFamilyItem;
      39             : class SfxTemplateItem;
      40             : class SfxBindings;
      41             : class SfxStyleSheetBase;
      42             : class SfxStyleSheetBasePool;
      43             : class SvTreeListBox ;
      44             : class StyleTreeListBox_Impl;
      45             : class SfxTemplateDialog_Impl;
      46             : class SfxCommonTemplateDialog_Impl;
      47             : class SfxDockingWindow;
      48             : 
      49             : namespace com { namespace sun { namespace star { namespace frame { class XModuleManager2; } } } }
      50             : 
      51             : // class DropListBox_Impl ------------------------------------------------
      52             : 
      53           0 : class DropListBox_Impl : public SvTreeListBox
      54             : {
      55             : private:
      56             :     DECL_LINK(OnAsyncExecuteDrop, void *);
      57             : 
      58             : protected:
      59             :     SfxCommonTemplateDialog_Impl* pDialog;
      60             :     sal_uInt16                    nModifier;
      61             : 
      62             : public:
      63             :     DropListBox_Impl( vcl::Window* pParent, const ResId& rId, SfxCommonTemplateDialog_Impl* pD )
      64             :         : SvTreeListBox(pParent, rId)
      65             :         , pDialog(pD)
      66             :         , nModifier(0)
      67             :     {}
      68           0 :     DropListBox_Impl( vcl::Window* pParent, WinBits nWinBits, SfxCommonTemplateDialog_Impl* pD )
      69             :         : SvTreeListBox(pParent, nWinBits)
      70             :         , pDialog(pD)
      71           0 :         , nModifier(0)
      72           0 :     {}
      73             :     virtual void     MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
      74             :     virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) SAL_OVERRIDE;
      75             :     using SvTreeListBox::ExecuteDrop;
      76             :     virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) SAL_OVERRIDE;
      77             : 
      78           0 :     sal_uInt16           GetModifier() const { return nModifier; }
      79             : 
      80             :     virtual bool     Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
      81             : };
      82             : 
      83             : typedef std::vector<OUString> ExpandedEntries_t;
      84             : 
      85             : /*  [Description]
      86             : 
      87             :     TreeListBox class for displaying the hierarchical view of the templates
      88             : */
      89             : 
      90           0 : class StyleTreeListBox_Impl : public DropListBox_Impl
      91             : {
      92             : private:
      93             :     SvTreeListEntry*                pCurEntry;
      94             :     Link                            aDoubleClickLink;
      95             :     Link                            aDropLink;
      96             :     OUString                        aParent;
      97             :     OUString                        aStyle;
      98             : 
      99             : protected:
     100             :     virtual void    Command( const CommandEvent& rMEvt ) SAL_OVERRIDE;
     101             :     virtual bool    Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
     102             :     virtual bool    DoubleClickHdl() SAL_OVERRIDE;
     103             :     virtual bool    ExpandingHdl() SAL_OVERRIDE;
     104             :     virtual void    ExpandedHdl() SAL_OVERRIDE;
     105             :     virtual TriState NotifyMoving(SvTreeListEntry*  pTarget,
     106             :                                      SvTreeListEntry*  pEntry,
     107             :                                      SvTreeListEntry*& rpNewParent,
     108             :                                      sal_uIntPtr&        rNewChildPos) SAL_OVERRIDE;
     109             : public:
     110             :     StyleTreeListBox_Impl( SfxCommonTemplateDialog_Impl* pParent, WinBits nWinStyle = 0);
     111             : 
     112           0 :     void            SetDoubleClickHdl(const Link &rLink) { aDoubleClickLink = rLink; }
     113           0 :     void            SetDropHdl(const Link &rLink) { aDropLink = rLink; }
     114             :     using SvTreeListBox::GetParent;
     115           0 :     const OUString& GetParent() const { return aParent; }
     116           0 :     const OUString& GetStyle() const { return aStyle; }
     117             :     void            MakeExpanded_Impl(ExpandedEntries_t& rEntries) const;
     118             : 
     119             :     virtual PopupMenu* CreateContextMenu( void ) SAL_OVERRIDE;
     120             : };
     121             : 
     122             : // class SfxActionListBox ------------------------------------------------
     123             : 
     124           0 : class SfxActionListBox : public DropListBox_Impl
     125             : {
     126             : protected:
     127             : public:
     128             :     SfxActionListBox( SfxCommonTemplateDialog_Impl* pParent, WinBits nWinBits );
     129             : 
     130             :     virtual PopupMenu*  CreateContextMenu( void ) SAL_OVERRIDE;
     131             : };
     132             : 
     133             : // class SfxCommonTemplateDialog_Impl ------------------------------------
     134             : 
     135             : class SfxCommonTemplateDialog_Impl : public SfxListener
     136             : {
     137             : private:
     138             :     class DeletionWatcher;
     139             :     friend class DeletionWatcher;
     140             :     bool mbIgnoreSelect;
     141             : 
     142             :     void    ReadResource();
     143             :     void    ClearResource();
     144             :     void impl_clear();
     145             :     DeletionWatcher * impl_setDeletionWatcher(DeletionWatcher* pNewWatcher);
     146             : 
     147             : protected:
     148             : #define MAX_FAMILIES            5
     149             : #define COUNT_BOUND_FUNC        13
     150             : 
     151             : #define UPDATE_FAMILY_LIST      0x0001
     152             : #define UPDATE_FAMILY           0x0002
     153             : 
     154             :     friend class DropListBox_Impl;
     155             :     friend class SfxTemplateControllerItem;
     156             : 
     157             :     SfxBindings*                pBindings;
     158             :     SfxTemplateControllerItem*  pBoundItems[COUNT_BOUND_FUNC];
     159             : 
     160             :     vcl::Window*                     pWindow;
     161             :     SfxModule*                  pModule;
     162             :     Timer*                      pTimer;
     163             : 
     164             :     ResId*                      m_pStyleFamiliesId;
     165             :     SfxStyleFamilies*           pStyleFamilies;
     166             :     SfxTemplateItem*            pFamilyState[MAX_FAMILIES];
     167             :     SfxStyleSheetBasePool*      pStyleSheetPool;
     168             :     StyleTreeListBox_Impl*      pTreeBox;
     169             :     SfxObjectShell*             pCurObjShell;
     170             :     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 >
     171             :                                 xModuleManager;
     172             :     DeletionWatcher*            m_pDeletionWatcher;
     173             : 
     174             :     SfxActionListBox            aFmtLb;
     175             :     ListBox                     aFilterLb;
     176             :     Size                        aSize;
     177             : 
     178             :     sal_uInt16                      nActFamily; // Id in the ToolBox = Position - 1
     179             :     sal_uInt16                      nActFilter; // FilterIdx
     180             :     sal_uInt16                      nAppFilter; // Filter, which has set the application (for automatic)
     181             : 
     182             :     bool                        bDontUpdate             :1,
     183             :                                 bIsWater                :1,
     184             :                                 bEnabled                :1,
     185             :                                 bUpdate                 :1,
     186             :                                 bUpdateFamily           :1,
     187             :                                 bCanEdit                :1,
     188             :                                 bCanDel                 :1,
     189             :                                 bCanNew                 :1,
     190             :                                 bCanHide                :1,
     191             :                                 bCanShow                :1,
     192             :                                 bWaterDisabled          :1,
     193             :                                 bNewByExampleDisabled   :1,
     194             :                                 bUpdateByExampleDisabled:1,
     195             :                                 bTreeDrag               :1,
     196             :                                 bHierarchical           :1,
     197             :                                 m_bWantHierarchical     :1,
     198             :                                 bBindingUpdate          :1;
     199             : 
     200             :     DECL_LINK( FilterSelectHdl, ListBox * );
     201             :     DECL_LINK( FmtSelectHdl, SvTreeListBox * );
     202             :     DECL_LINK( ApplyHdl, Control * );
     203             :     DECL_LINK( DropHdl, StyleTreeListBox_Impl * );
     204             :     DECL_LINK( TimeOut, Timer * );
     205             : 
     206             : 
     207           0 :     virtual void        EnableItem( sal_uInt16 /*nMesId*/, bool /*bCheck*/ = true ) {}
     208           0 :     virtual void        CheckItem( sal_uInt16 /*nMesId*/, bool /*bCheck*/ = true ) {}
     209           0 :     virtual bool        IsCheckedItem( sal_uInt16 /*nMesId*/ ) { return true; }
     210           0 :     virtual void        LoadedFamilies() {}
     211           0 :     virtual void        Update() { UpdateStyles_Impl(UPDATE_FAMILY_LIST); }
     212             :     virtual void        InvalidateBindings();
     213             :     virtual void        InsertFamilyItem( sal_uInt16 nId, const SfxStyleFamilyItem* pIten ) = 0;
     214             :     virtual void        EnableFamilyItem( sal_uInt16 nId, bool bEnabled = true ) = 0;
     215             :     virtual void        ClearFamilyList() = 0;
     216             :     virtual void        ReplaceUpdateButtonByMenu();
     217             : 
     218             :     void                NewHdl( void* );
     219             :     void                EditHdl( void* );
     220             :     void                DeleteHdl( void* );
     221             :     void                HideHdl( void* );
     222             :     void                ShowHdl( void* );
     223             : 
     224             :     bool                Execute_Impl( sal_uInt16 nId, const OUString& rStr, const OUString& rRefStr,
     225             :                                       sal_uInt16 nFamily, sal_uInt16 nMask = 0,
     226             :                                       sal_uInt16* pIdx = NULL, const sal_uInt16* pModifier = NULL );
     227             : 
     228             :     void                        UpdateStyles_Impl(sal_uInt16 nFlags);
     229             :     const SfxStyleFamilyItem*   GetFamilyItem_Impl() const;
     230           0 :     bool                    IsInitialized() const { return nActFamily != 0xffff; }
     231             :     void                        ResetFocus();
     232             :     void                        EnableDelete();
     233             :     void                        Initialize();
     234             :     void                        EnableHierarchical(bool);
     235             : 
     236             :     void                FilterSelect( sal_uInt16 nFilterIdx, bool bForce = false );
     237             :     void                SetFamilyState( sal_uInt16 nSlotId, const SfxTemplateItem* );
     238             :     void                SetWaterCanState( const SfxBoolItem* pItem );
     239             : 
     240             :     void                SelectStyle( const OUString& rStyle );
     241             :     bool            HasSelectedStyle() const;
     242             :     SfxStyleSheetBase  *GetSelectedStyle() const;
     243             :     void                FillTreeBox();
     244             :     void                Update_Impl();
     245             :     void                UpdateFamily_Impl();
     246             : 
     247             :     // In which FamilyState do I have to look , in order to get the
     248             :     // information of the ith Family in the pStyleFamilies.
     249             :     sal_uInt16              StyleNrToInfoOffset( sal_uInt16 i );
     250             : 
     251             :     void                Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
     252             : 
     253             :     void                FamilySelect( sal_uInt16 nId );
     254             :     void                SetFamily( sal_uInt16 nId );
     255             :     void                ActionSelect( sal_uInt16 nId );
     256             : 
     257             :     sal_Int32           LoadFactoryStyleFilter( SfxObjectShell* i_pObjSh );
     258             :     void                SaveFactoryStyleFilter( SfxObjectShell* i_pObjSh, sal_Int32 i_nFilter );
     259             :     SfxObjectShell *    SaveSelection();
     260             : 
     261             : public:
     262             :     TYPEINFO_OVERRIDE();
     263             : 
     264             :     SfxCommonTemplateDialog_Impl( SfxBindings* pB, vcl::Window*, bool );
     265             :     virtual ~SfxCommonTemplateDialog_Impl();
     266             : 
     267             :     DECL_LINK( MenuSelectHdl, Menu * );
     268             : 
     269           0 :     virtual void        EnableEdit( bool b = true ) { bCanEdit = b; }
     270           0 :     virtual void        EnableDel( bool b = true )  { bCanDel = b; }
     271           0 :     virtual void        EnableNew( bool b = true )  { bCanNew = b; }
     272           0 :     virtual void        EnableHide( bool b = true )  { bCanHide = b; }
     273           0 :     virtual void        EnableShow( bool b = true )  { bCanShow = b; }
     274             : 
     275           0 :     vcl::Window*             GetWindow() { return pWindow; }
     276             : 
     277             :     void                EnableTreeDrag( bool b = true );
     278             :     void                ExecuteContextMenu_Impl( const Point& rPos, vcl::Window* pWin );
     279             :     void                EnableExample_Impl( sal_uInt16 nId, bool bEnable );
     280             :     SfxStyleFamily      GetActualFamily() const;
     281             :     OUString            GetSelectedEntry() const;
     282           0 :     SfxObjectShell*     GetObjectShell() const { return pCurObjShell; }
     283             : 
     284             :     virtual void        PrepareDeleteAction();  // disable buttons, change button text, etc. when del is going to happen
     285             : 
     286             :     inline bool         CanEdit( void ) const   { return bCanEdit; }
     287             :     inline bool         CanDel( void ) const    { return bCanDel; }
     288             :     inline bool         CanNew( void ) const    { return bCanNew; }
     289             :     inline bool         CanHide( void ) const    { return bCanHide; }
     290             :     inline bool         CanShow( void ) const    { return bCanShow; }
     291             : 
     292             :     // normally for derivates from SvTreeListBoxes, but in this case the dialog handles context menus
     293             :     virtual PopupMenu*  CreateContextMenu( void );
     294             : };
     295             : 
     296             : class DropToolBox_Impl : public ToolBox, public DropTargetHelper
     297             : {
     298             :     SfxTemplateDialog_Impl&     rParent;
     299             : protected:
     300             :     virtual sal_Int8    AcceptDrop( const AcceptDropEvent& rEvt ) SAL_OVERRIDE;
     301             :     virtual sal_Int8    ExecuteDrop( const ExecuteDropEvent& rEvt ) SAL_OVERRIDE;
     302             : public:
     303             :     DropToolBox_Impl(vcl::Window* pParent, SfxTemplateDialog_Impl* pTemplateDialog);
     304             :     virtual ~DropToolBox_Impl();
     305             : };
     306             : // class SfxTemplateDialog_Impl ------------------------------------------
     307             : 
     308             : class SfxTemplateDialog_Impl :  public SfxCommonTemplateDialog_Impl
     309             : {
     310             : private:
     311             :     friend class SfxTemplateControllerItem;
     312             :     friend class DropToolBox_Impl;
     313             :     friend class SfxTemplatePanelControl;
     314             : 
     315             :     vcl::Window* m_pFloat;
     316             :     bool            m_bZoomIn;
     317             :     DropToolBox_Impl    m_aActionTbL;
     318             :     ToolBox             m_aActionTbR;
     319             : 
     320             :     DECL_LINK( ToolBoxLSelect, ToolBox * );
     321             :     DECL_LINK( ToolBoxRSelect, ToolBox * );
     322             :     DECL_LINK( ToolBoxRClick, ToolBox * );
     323             :     DECL_LINK( MenuSelectHdl, Menu* );
     324             : 
     325             : protected:
     326             :     virtual void    Command( const CommandEvent& rMEvt );
     327             :     virtual void    EnableEdit( bool = true ) SAL_OVERRIDE;
     328             :     virtual void    EnableItem( sal_uInt16 nMesId, bool bCheck = true ) SAL_OVERRIDE;
     329             :     virtual void    CheckItem( sal_uInt16 nMesId, bool bCheck = true ) SAL_OVERRIDE;
     330             :     virtual bool    IsCheckedItem( sal_uInt16 nMesId ) SAL_OVERRIDE;
     331             :     virtual void    LoadedFamilies() SAL_OVERRIDE;
     332             :     virtual void    InsertFamilyItem( sal_uInt16 nId, const SfxStyleFamilyItem* pIten ) SAL_OVERRIDE;
     333             :     virtual void    EnableFamilyItem( sal_uInt16 nId, bool bEnabled = true ) SAL_OVERRIDE;
     334             :     virtual void    ClearFamilyList() SAL_OVERRIDE;
     335             :     virtual void    ReplaceUpdateButtonByMenu() SAL_OVERRIDE;
     336             : 
     337             :     void            Resize();
     338             :     Size            GetMinOutputSizePixel();
     339             : 
     340             :     void            updateFamilyImages();
     341             :     void            updateNonFamilyImages();
     342             : 
     343             : public:
     344             :     friend class SfxTemplateDialog;
     345             :     TYPEINFO_OVERRIDE();
     346             : 
     347             :     SfxTemplateDialog_Impl( SfxBindings*, SfxTemplatePanelControl* pDlgWindow );
     348             :     virtual ~SfxTemplateDialog_Impl();
     349             : 
     350             :     void Initialize();
     351             : };
     352             : 
     353             : #endif // INCLUDED_SFX2_SOURCE_INC_TEMPLDGI_HXX
     354             : 
     355             : 
     356             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10