LCOV - code coverage report
Current view: top level - svtools/source/contnr - templwin.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 24 0.0 %
Date: 2014-04-14 Functions: 0 22 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_SVTOOLS_SOURCE_CONTNR_TEMPLWIN_HXX
      20             : #define INCLUDED_SVTOOLS_SOURCE_CONTNR_TEMPLWIN_HXX
      21             : 
      22             : #include <tools/resary.hxx>
      23             : #include <vcl/splitwin.hxx>
      24             : #include <vcl/toolbox.hxx>
      25             : #include <vcl/window.hxx>
      26             : #include <svtools/headbar.hxx>
      27             : #include <svtools/fileview.hxx>
      28             : #include <svtools/ivctrl.hxx>
      29             : #include <svtools/svmedit2.hxx>
      30             : #include <com/sun/star/frame/XDispatch.hpp>
      31             : #include <com/sun/star/lang/Locale.hpp>
      32             : 
      33             : namespace com{ namespace sun { namespace star { namespace awt   { class XWindow; } } } }
      34             : namespace com{ namespace sun { namespace star { namespace frame { class XFrame2; } } } }
      35             : namespace com{ namespace sun { namespace star { namespace document {
      36             :     class XDocumentProperties;
      37             : } } } }
      38             : namespace svtools
      39             : {
      40             :     class ODocumentInfoPreview;
      41             : }
      42             : 
      43             : // class SvtDummyHeaderBar_Impl ------------------------------------------
      44             : 
      45             : class SvtDummyHeaderBar_Impl : public Window
      46             : {
      47             : private:
      48             :     void                UpdateBackgroundColor();
      49             : 
      50             : public:
      51             :                         SvtDummyHeaderBar_Impl( Window* pParent );
      52             :                         virtual ~SvtDummyHeaderBar_Impl();
      53             : 
      54             :     virtual void        DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
      55             : };
      56             : 
      57             : // class SvtIconWindow_Impl ----------------------------------------------
      58             : 
      59             : class SvtIconWindow_Impl : public Window
      60             : {
      61             : private:
      62             :     SvtDummyHeaderBar_Impl  aDummyHeaderBar;    // spaceholder instead of HeaderBar
      63             :     SvtIconChoiceCtrl   aIconCtrl;
      64             : 
      65             :     OUString            aNewDocumentRootURL;
      66             :     OUString            aTemplateRootURL;
      67             :     OUString            aMyDocumentsRootURL;
      68             :     OUString            aSamplesFolderRootURL;
      69             : 
      70             :     long                nMaxTextLength;
      71             : 
      72             :     SvxIconChoiceCtrlEntry* GetEntry( const OUString& rURL ) const;
      73             : 
      74             : public:
      75             :     SvtIconWindow_Impl( Window* pParent );
      76             :     virtual ~SvtIconWindow_Impl();
      77             : 
      78             :     virtual void        Resize() SAL_OVERRIDE;
      79             : 
      80           0 :     inline long         GetMaxTextLength() const { return nMaxTextLength; }
      81           0 :     inline void         SetClickHdl( const Link& rLink ) { aIconCtrl.SetClickHdl( rLink ); }
      82             : 
      83             :     OUString            GetSelectedIconURL() const;
      84             :     OUString            GetCursorPosIconURL() const;
      85             :     OUString            GetIconText( const OUString& rURL ) const;
      86             :     void                InvalidateIconControl();
      87             :     void                SetCursorPos( sal_uLong nPos );
      88             :     sal_uLong           GetCursorPos() const;
      89             :     sal_uLong           GetSelectEntryPos() const;
      90             :     void                SetFocus();
      91             :     long                CalcHeight() const;
      92             :     sal_Bool            IsRootURL( const OUString& rURL ) const;
      93             :     sal_uLong           GetRootPos( const OUString& rURL ) const;
      94             :     void                UpdateIcons();
      95             : 
      96             :     inline sal_Bool         ProcessKeyEvent( const KeyEvent& rKEvt );
      97             : 
      98           0 :     inline const OUString&    GetTemplateRootURL() const      { return aTemplateRootURL; }
      99           0 :     inline const OUString&    GetMyDocumentsRootURL() const   { return aMyDocumentsRootURL; }
     100           0 :     inline const OUString&    GetSamplesFolderURL() const     { return aSamplesFolderRootURL; }
     101             : 
     102             :     void                SelectFolder(sal_Int32 nFolderPos);
     103             : };
     104             : 
     105           0 : inline sal_Bool SvtIconWindow_Impl::ProcessKeyEvent( const KeyEvent& rKEvt )
     106             : {
     107           0 :     return ( rKEvt.GetKeyCode().IsMod2() ? aIconCtrl.DoKeyInput( rKEvt ) : sal_False );
     108             : }
     109             : 
     110             : // class SvtFileViewWindow_Impl ------------------------------------------
     111             : 
     112             : class SvtTemplateWindow;
     113             : 
     114             : class SvtFileViewWindow_Impl : public Window
     115             : {
     116             : private:
     117             :     SvtTemplateWindow&  rParent;
     118             :     SvtFileView         aFileView;
     119             :     Link                aNewFolderLink;
     120             :     OUString            aCurrentRootURL;
     121             :     OUString            aFolderURL;
     122             :     OUString            aMyDocumentsURL;
     123             :     OUString            aSamplesFolderURL;
     124             : 
     125             :     sal_Bool            bIsTemplateFolder;
     126             : 
     127             :     ::com::sun::star::uno::Sequence< OUString >
     128             :                         GetNewDocContents() const;
     129             : 
     130             : public:
     131             :     SvtFileViewWindow_Impl( SvtTemplateWindow* pParent );
     132             :     virtual ~SvtFileViewWindow_Impl();
     133             : 
     134             :     virtual void        Resize() SAL_OVERRIDE;
     135             : 
     136           0 :     inline void         SetSelectHdl( const Link& rLink ) { aFileView.SetSelectHdl( rLink ); }
     137           0 :     inline void         SetDoubleClickHdl( const Link& rLink ) { aFileView.SetDoubleClickHdl( rLink ); }
     138           0 :     inline void         SetNewFolderHdl( const Link& rLink ) { aNewFolderLink = rLink; }
     139           0 :     inline sal_Bool     IsTemplateFolder() const { return bIsTemplateFolder; }
     140           0 :     inline OUString     GetFolderURL() const { return aFolderURL; }
     141           0 :     inline OUString     GetRootURL() const { return aCurrentRootURL; }
     142           0 :     inline void         OpenRoot( const OUString& rRootURL )
     143           0 :                             { aCurrentRootURL = rRootURL; OpenFolder( rRootURL ); }
     144           0 :     inline void         SetMyDocumentsURL( const OUString& _rNewURL ) { aMyDocumentsURL = _rNewURL; }
     145           0 :     inline void         SetSamplesFolderURL( const OUString& _rNewURL ) { aSamplesFolderURL = _rNewURL; }
     146             : 
     147             :     OUString            GetSelectedFile() const;
     148             :     void                OpenFolder( const OUString& rURL );
     149             :     sal_Bool            HasPreviousLevel( OUString& rURL ) const;
     150             :     OUString            GetFolderTitle() const;
     151             :     void                SetFocus();
     152             : };
     153             : 
     154             : // class SvtFrameWindow_Impl ---------------------------------------------
     155             : 
     156           0 : class SvtDocInfoTable_Impl : public ResStringArray
     157             : {
     158             : public:
     159             :     SvtDocInfoTable_Impl();
     160             : 
     161             :     OUString GetString( long nId ) const;
     162             : };
     163             : 
     164             : class SvtFrameWindow_Impl : public Window
     165             : {
     166             : private:
     167             :     ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame2 >
     168             :                                 m_xFrame;
     169             :     ::com::sun::star::uno::Reference < ::com::sun::star::document::XDocumentProperties>
     170             :                                 m_xDocProps;
     171             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >
     172             :                                 xWindow;
     173             : 
     174             :     ::svtools::ODocumentInfoPreview*
     175             :                                     pEditWin;
     176             :     Window*                         pTextWin;
     177             :     Window*                         pEmptyWin;
     178             :     ::com::sun::star::lang::Locale  aLocale;
     179             :     SvtDocInfoTable_Impl            aInfoTable;
     180             :     OUString                        aCurrentURL;
     181             :     OUString                 m_aOpenURL;
     182             :     sal_Bool                        bDocInfo;
     183             : 
     184             :     void                    ShowDocInfo( const OUString& rURL );
     185             :     void                    ViewEditWin();
     186             :     void                    ViewTextWin();
     187             :     void                    ViewEmptyWin();
     188             :     void                    ViewNonEmptyWin();  // views depending on bDocInfo
     189             : 
     190             :     struct SvtExecuteInfo
     191             :     {
     192             :         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch >     xDispatch;
     193             :         ::com::sun::star::util::URL                                                aTargetURL;
     194             :     };
     195             : 
     196             : public:
     197             :     SvtFrameWindow_Impl( Window* pParent );
     198             :     virtual ~SvtFrameWindow_Impl();
     199             : 
     200             :     virtual void            Resize() SAL_OVERRIDE;
     201             : 
     202             :     void                    OpenFile( const OUString& rURL, sal_Bool bPreview, sal_Bool bIsTemplate, sal_Bool bAsTemplate );
     203             :     void                    ToggleView( sal_Bool bDocInfo );
     204             : };
     205             : 
     206             : // class SvtTemplateWindow -----------------------------------------------
     207             : 
     208             : struct FolderHistory;
     209             : typedef ::std::vector< FolderHistory* > HistoryList_Impl;
     210             : 
     211             : class SvtTemplateWindow : public Window
     212             : {
     213             : private:
     214             :     ToolBox                     aFileViewTB;
     215             :     ToolBox                     aFrameWinTB;
     216             :     SplitWindow                 aSplitWin;
     217             : 
     218             :     SvtIconWindow_Impl*         pIconWin;
     219             :     SvtFileViewWindow_Impl*     pFileWin;
     220             :     SvtFrameWindow_Impl*        pFrameWin;
     221             :     HistoryList_Impl*           pHistoryList;
     222             : 
     223             :     Link                        aSelectHdl;
     224             :     Link                        aDoubleClickHdl;
     225             :     Link                        aNewFolderHdl;
     226             :     Link                        aSendFocusHdl;
     227             : 
     228             :     Timer                       aSelectTimer;
     229             : 
     230             :     OUString                    aFolderTitle;
     231             : 
     232             :     virtual void        Resize() SAL_OVERRIDE;
     233             : 
     234             :     DECL_LINK(IconClickHdl_Impl, void *);
     235             :     DECL_LINK(FileSelectHdl_Impl, void *);
     236             :     DECL_LINK(FileDblClickHdl_Impl, void *);
     237             :     DECL_LINK(NewFolderHdl_Impl, void *);
     238             :     DECL_LINK(TimeoutHdl_Impl, void *);
     239             :     DECL_LINK(          ClickHdl_Impl, ToolBox* );
     240             :     DECL_LINK(ResizeHdl_Impl, void *);     // used for split and initial setting of toolbar pos
     241             : 
     242             :     void                PrintFile( const OUString& rURL );
     243             :     void                AppendHistoryURL( const OUString& rURL, sal_uLong nGroup );
     244             :     void                OpenHistory();
     245             :     void                DoAction( sal_uInt16 nAction );
     246             :     void                InitToolBoxes();
     247             :     void                InitToolBoxImages();
     248             :     void                UpdateIcons();
     249             : 
     250             : protected:
     251             :     virtual bool        PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
     252             :     virtual void        DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
     253             : 
     254             : public:
     255             :     SvtTemplateWindow( Window* pParent );
     256             :     virtual ~SvtTemplateWindow();
     257             : 
     258           0 :     inline void         SetSelectHdl( const Link& rLink ) { aSelectHdl = rLink; }
     259           0 :     inline void         SetDoubleClickHdl( const Link& rLink ) { aDoubleClickHdl = rLink; }
     260           0 :     inline void         SetNewFolderHdl( const Link& rLink ) { aNewFolderHdl = rLink; }
     261           0 :     inline void         SetSendFocusHdl( const Link& rLink ) { aSendFocusHdl = rLink; }
     262           0 :     inline sal_Bool     IsTemplateFolderOpen() const { return pFileWin->IsTemplateFolder(); }
     263           0 :     inline sal_Bool     HasIconWinFocus() const { return pIconWin->HasChildPathFocus(); }
     264             : 
     265             :     void                ReadViewSettings( );
     266             :     void                WriteViewSettings( );
     267             :     sal_Bool            IsFileSelected() const;
     268             :     OUString            GetSelectedFile() const;
     269             :     void                OpenFile( sal_Bool bNotAsTemplate );
     270             :     OUString            GetFolderTitle() const;
     271             :     OUString            GetFolderURL() const;
     272             :     void                SetFocus( sal_Bool bIconWin );
     273             :     void                OpenTemplateRoot();
     274             :     void                SetPrevLevelButtonState( const OUString& rURL );  // sets state (enable/disable) for previous level button
     275             :     void                ClearHistory();
     276             :     long                CalcHeight() const;
     277             : 
     278             :     void                SelectFolder(sal_Int32 nFolderPosition);
     279             : };
     280             : 
     281             : #endif // INCLUDED_SVTOOLS_SOURCE_CONTNR_TEMPLWIN_HXX
     282             : 
     283             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10