LCOV - code coverage report
Current view: top level - include/svtools - filectrl.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 2 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 2 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             : 
      20             : #ifndef INCLUDED_SVTOOLS_FILECTRL_HXX
      21             : #define INCLUDED_SVTOOLS_FILECTRL_HXX
      22             : 
      23             : #include <svtools/svtdllapi.h>
      24             : #include <vcl/window.hxx>
      25             : #include <vcl/edit.hxx>
      26             : #include <vcl/button.hxx>
      27             : 
      28             : 
      29             : #define STR_FILECTRL_BUTTONTEXT     333     // ID-Range?!
      30             : 
      31             : // Flags for FileControl
      32             : enum class FileControlMode
      33             : {
      34             :     NONE                    = 0x00,
      35             :     RESIZEBUTTONBYPATHLEN   = 0x01, //if this is set, the button will become small as soon as the Text in the Edit Field is to long to be shown completely
      36             : };
      37             : namespace o3tl
      38             : {
      39             :     template<> struct typed_flags<FileControlMode> : is_typed_flags<FileControlMode, 0x01> {};
      40             : }
      41             : 
      42             : // Flags for internal use of FileControl
      43             : enum class FileControlMode_Internal
      44             : {
      45             :     INRESIZE               = 0x0001,
      46             :     ORIGINALBUTTONTEXT     = 0x0002,
      47             : };
      48             : namespace o3tl
      49             : {
      50             :     template<> struct typed_flags<FileControlMode_Internal> : is_typed_flags<FileControlMode_Internal, 0x03> {};
      51             : }
      52             : 
      53             : 
      54             : class SVT_DLLPUBLIC FileControl : public vcl::Window
      55             : {
      56             : private:
      57             :     VclPtr<Edit>       maEdit;
      58             :     VclPtr<PushButton> maButton;
      59             : 
      60             :     OUString        maButtonText;
      61             :     bool            mbOpenDlg;
      62             : 
      63             :     Link<>          maDialogCreatedHdl;
      64             : 
      65             :     FileControlMode             mnFlags;
      66             :     FileControlMode_Internal    mnInternalFlags;
      67             : 
      68             : private:
      69             :     SVT_DLLPRIVATE void     ImplBrowseFile( );
      70             : 
      71             : protected:
      72             :     SVT_DLLPRIVATE void     Resize() SAL_OVERRIDE;
      73             :     SVT_DLLPRIVATE void     GetFocus() SAL_OVERRIDE;
      74             :     SVT_DLLPRIVATE void     StateChanged( StateChangedType nType ) SAL_OVERRIDE;
      75             :     SVT_DLLPRIVATE WinBits  ImplInitStyle( WinBits nStyle );
      76             :     DECL_DLLPRIVATE_LINK( ButtonHdl, void* );
      77             : 
      78             : public:
      79             :                     FileControl( vcl::Window* pParent, WinBits nStyle, FileControlMode = FileControlMode::NONE );
      80             :     virtual         ~FileControl();
      81             :     virtual void    dispose() SAL_OVERRIDE;
      82             : 
      83           0 :     Edit&           GetEdit() { return *maEdit.get(); }
      84           0 :     PushButton&     GetButton() { return *maButton.get(); }
      85             : 
      86             :     void            Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, DrawFlags nFlags ) SAL_OVERRIDE;
      87             : 
      88             :     void            SetOpenDialog( bool bOpen )     { mbOpenDlg = bOpen; }
      89             :     bool            IsOpenDialog() const            { return mbOpenDlg; }
      90             : 
      91             :     void            SetText( const OUString& rStr ) SAL_OVERRIDE;
      92             :     OUString        GetText() const SAL_OVERRIDE;
      93             :     OUString        GetSelectedText() const         { return maEdit->GetSelected(); }
      94             : 
      95             :     void            SetSelection( const Selection& rSelection ) { maEdit->SetSelection( rSelection ); }
      96             :     Selection       GetSelection() const                        { return maEdit->GetSelection(); }
      97             : 
      98             :     void            SetReadOnly( bool bReadOnly = true )    { maEdit->SetReadOnly( bReadOnly ); }
      99             :     bool            IsReadOnly() const                      { return maEdit->IsReadOnly(); }
     100             : 
     101             : 
     102             :     //use this to manipulate the dialog bevore executing it:
     103             :     void            SetDialogCreatedHdl( const Link<>& rLink ) { maDialogCreatedHdl = rLink; }
     104             :     const Link<>&   GetDialogCreatedHdl() const { return maDialogCreatedHdl; }
     105             : 
     106             :     void            SetEditModifyHdl( const Link<>& rLink );
     107             : };
     108             : 
     109             : #endif
     110             : 
     111             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11