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

Generated by: LCOV version 1.10