LCOV - code coverage report
Current view: top level - sd/source/ui/dlg - RemoteDialogClientBox.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 5 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_SD_SOURCE_UI_DLG_REMOTEDIALOGCLIENTBOX_HXX
      21             : #define INCLUDED_SD_SOURCE_UI_DLG_REMOTEDIALOGCLIENTBOX_HXX
      22             : 
      23             : #include "rtl/ustring.hxx"
      24             : #include "vcl/scrbar.hxx"
      25             : #include "vcl/fixed.hxx"
      26             : #include "vcl/button.hxx"
      27             : #include "vcl/dialog.hxx"
      28             : #include "vcl/field.hxx"
      29             : 
      30             : #include "svtools/extensionlistbox.hxx"
      31             : #include "cppuhelper/implbase1.hxx"
      32             : 
      33             : #include "com/sun/star/lang/Locale.hpp"
      34             : #include "com/sun/star/lang/XEventListener.hpp"
      35             : #include "com/sun/star/deployment/XPackage.hpp"
      36             : 
      37             : #include <boost/shared_ptr.hpp>
      38             : 
      39             : #include "sdresid.hxx"
      40             : 
      41             : namespace sd {
      42             : 
      43             : #define SMALL_ICON_SIZE     16
      44             : #define TOP_OFFSET           5
      45             : #define ICON_HEIGHT         42
      46             : #define ICON_WIDTH          47
      47             : #define ICON_OFFSET         72
      48             : #define RIGHT_ICON_OFFSET    5
      49             : #define SPACE_BETWEEN        3
      50             : 
      51             : // struct ClientBoxEntry
      52             : struct ClientBoxEntry;
      53             : struct ClientInfo;
      54             : 
      55             : typedef boost::shared_ptr<ClientBoxEntry> TClientBoxEntry;
      56             : 
      57             : struct ClientBoxEntry
      58             : {
      59             :     bool m_bActive :1;
      60             :     boost::shared_ptr<ClientInfo> m_pClientInfo;
      61             : 
      62             :     ClientBoxEntry(boost::shared_ptr<ClientInfo> pClientInfo);
      63             :    ~ClientBoxEntry();
      64             : 
      65             : };
      66             : 
      67             : // class ExtensionBox_Impl
      68             : class ClientBox;
      69             : 
      70             : class ClientRemovedListener : public ::cppu::WeakImplHelper1<css::lang::XEventListener>
      71             : {
      72             :     VclPtr<ClientBox> m_pParent;
      73             : 
      74             : public:
      75             : 
      76           0 :     ClientRemovedListener(ClientBox *pParent)
      77           0 :     {
      78           0 :         m_pParent = pParent;
      79           0 :     }
      80             :     virtual ~ClientRemovedListener();
      81             : 
      82             :     // XEventListener
      83             :     virtual void SAL_CALL disposing(css::lang::EventObject const & evt)
      84             :         throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      85             : };
      86             : 
      87             : class ClientBox : public Control
      88             : {
      89             :     bool m_bHasScrollBar : 1;
      90             :     bool m_bHasActive : 1;
      91             :     bool m_bNeedsRecalc : 1;
      92             :     bool m_bInCheckMode : 1;
      93             :     bool m_bAdjustActive : 1;
      94             :     bool m_bInDelete : 1;
      95             :     //Must be guarded together with m_vEntries to ensure a valid index at all times.
      96             :     //Use m_entriesMutex as guard.
      97             :     long m_nActive;
      98             :     long m_nTopIndex;
      99             :     long m_nStdHeight;
     100             :     long m_nActiveHeight;
     101             :     long m_nExtraHeight;
     102             :     Size            m_aOutputSize;
     103             :     Link<>          m_aClickHdl;
     104             :     Link<>          m_aDeauthoriseHdl;
     105             : 
     106             :     VclPtr<NumericBox> m_aPinBox;
     107             :     VclPtr<PushButton> m_aDeauthoriseButton;
     108             :     Rectangle m_sPinTextRect;
     109             : 
     110             :     VclPtr<ScrollBar> m_aScrollBar;
     111             : 
     112             :     css::uno::Reference< ClientRemovedListener > m_xRemoveListener;
     113             : 
     114             :     //This mutex is used for synchronizing access to m_vEntries.
     115             :     //Currently it is used to synchronize adding, removing entries and
     116             :     //functions like getItemName, getItemDescription, etc. to prevent
     117             :     //that m_vEntries is accessed at an invalid index.
     118             :     //ToDo: There are many more places where m_vEntries is read and which may
     119             :     //fail. For example the Paint method is probable called from the main thread
     120             :     //while new entries are added / removed in a separate thread.
     121             :     mutable ::osl::Mutex    m_entriesMutex;
     122             :     std::vector< TClientBoxEntry > m_vEntries;
     123             :     std::vector< TClientBoxEntry > m_vRemovedEntries;
     124             : 
     125             :     void CalcActiveHeight( const long nPos );
     126             :     long GetTotalHeight() const;
     127             :     void SetupScrollBar();
     128             :     void DrawRow(vcl::RenderContext& rRenderContext, const Rectangle& rRect, const TClientBoxEntry& rEntry);
     129             :     bool HandleTabKey( bool bReverse );
     130             :     bool HandleCursorKey( sal_uInt16 nKeyCode );
     131             :     void DeleteRemoved();
     132             : 
     133             :     DECL_DLLPRIVATE_LINK( ScrollHdl, ScrollBar* );
     134             :     DECL_DLLPRIVATE_LINK( DeauthoriseHdl, void * );
     135             :     //Index starts with 1.
     136             :     //Throws an com::sun::star::lang::IllegalArgumentException, when the index is invalid.
     137             :     void checkIndex(sal_Int32 pos) const;
     138             : 
     139             : public:
     140             :     ClientBox( vcl::Window* pParent, WinBits nStyle );
     141             :     virtual ~ClientBox();
     142             :     virtual void dispose() SAL_OVERRIDE;
     143             : 
     144             :     void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
     145             :     void Paint( vcl::RenderContext& rRenderContext, const Rectangle &rPaintRect ) SAL_OVERRIDE;
     146             :     void Resize() SAL_OVERRIDE;
     147             :     Size GetOptimalSize() const SAL_OVERRIDE;
     148             :     bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
     149             : 
     150             :     const Size GetMinOutputSizePixel() const;
     151             :     void SetExtraSize( long nSize ) { m_nExtraHeight = nSize; }
     152           0 :     TClientBoxEntry GetEntryData( long nPos ) { return m_vEntries[ nPos ]; }
     153             :     long GetActiveEntryIndex();
     154             :     long GetEntryCount() { return (long) m_vEntries.size(); }
     155             :     Rectangle GetEntryRect( const long nPos ) const;
     156             :     bool HasActive() { return m_bHasActive; }
     157             :     long PointToPos( const Point& rPos );
     158             :     void SetScrollHdl( const Link<>& rLink );
     159             :     void DoScroll( long nDelta );
     160             :     void SetHyperlinkHdl( const Link<>& rLink ){ m_aClickHdl = rLink; }
     161             :     void RecalcAll();
     162             :     void RemoveUnlocked();
     163             : 
     164             :     void selectEntry( const long nPos );
     165             :     long addEntry(boost::shared_ptr<ClientInfo> pClientInfo);
     166             :     void clearEntries();
     167             : 
     168             :     void prepareChecking();
     169             :     void checkEntries();
     170             : 
     171             :     OUString getPin();
     172             :     void populateEntries();
     173             : };
     174             : 
     175             : } // end namespace sd
     176             : 
     177             : #endif // INCLUDED_SD_SOURCE_UI_DLG_REMOTEDIALOGCLIENTBOX_HXX
     178             : 
     179             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11