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

Generated by: LCOV version 1.10