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

Generated by: LCOV version 1.10