LCOV - code coverage report
Current view: top level - basctl/source/inc - bastypes.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 21 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 21 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_BASCTL_SOURCE_INC_BASTYPES_HXX
      20             : #define INCLUDED_BASCTL_SOURCE_INC_BASTYPES_HXX
      21             : 
      22             : #include "scriptdocument.hxx"
      23             : 
      24             : #include <sbxitem.hxx>
      25             : #include <iderid.hxx>
      26             : #include <svtools/tabbar.hxx>
      27             : #include <vcl/toolbox.hxx>
      28             : 
      29             : #include <unordered_map>
      30             : 
      31             : class SbModule;
      32             : class SfxItemSet;
      33             : class SfxRequest;
      34             : class SvxSearchItem;
      35             : class Printer;
      36             : enum class SearchOptionFlags;
      37             : 
      38             : namespace svl
      39             : {
      40             :     class IUndoManager;
      41             : }
      42             : 
      43             : namespace basctl
      44             : {
      45             : 
      46             : class Layout;
      47             : class ModulWindow;
      48             : class DialogWindow;
      49             : 
      50             : #define LINE_SEP_CR     0x0D
      51             : #define LINE_SEP        0x0A
      52             : 
      53             : // Implementation: baside2b.cxx
      54             : sal_Int32 searchEOL( const OUString& rStr, sal_Int32 fromIndex );
      55             : 
      56             : // Meaning of bToBeKilled:
      57             : // While being in a reschedule-loop, I may not destroy the window.
      58             : // It must first break from the reschedule-loop to self-destroy then.
      59             : // Does unfortunately not work that way: Destroying Window with living Child!
      60             : 
      61             : struct BasicStatus
      62             : {
      63             :     bool bIsRunning : 1;
      64             :     bool bError : 1;
      65             :     bool bIsInReschedule : 1;
      66             :     sal_uInt16 nBasicFlags;
      67             : 
      68           0 :     BasicStatus():
      69             :         bIsRunning(false),
      70             :         bError(false),
      71             :         bIsInReschedule(false),
      72           0 :         nBasicFlags(0) { }
      73             : };
      74             : 
      75             : 
      76             : // basctl::DockingWindow -- special docking window for the Basic IDE
      77             : // Not to be confused with ::DockingWindow from vcl.
      78             : 
      79             : class DockingWindow : public ::DockingWindow
      80             : {
      81             : public:
      82             :     DockingWindow (vcl::Window* pParent);
      83             :     DockingWindow (Layout* pParent);
      84             :     virtual ~DockingWindow();
      85             :     virtual void dispose() SAL_OVERRIDE;
      86             :     void ResizeIfDocking (Point const&, Size const&);
      87             :     void ResizeIfDocking (Size const&);
      88           0 :     Size GetDockingSize () const { return aDockingRect.GetSize(); }
      89             :     void SetLayoutWindow (Layout*);
      90             : public:
      91             :     void Show (bool = true);
      92             :     void Hide ();
      93             : 
      94             : protected:
      95             :     virtual bool Docking( const Point& rPos, Rectangle& rRect ) SAL_OVERRIDE;
      96             :     virtual void     EndDocking( const Rectangle& rRect, bool bFloatMode ) SAL_OVERRIDE;
      97             :     virtual void     ToggleFloatingMode() SAL_OVERRIDE;
      98             :     virtual bool PrepareToggleFloatingMode() SAL_OVERRIDE;
      99             :     virtual void     StartDocking() SAL_OVERRIDE;
     100             : 
     101             : private:
     102             :     // the position and the size of the floating window
     103             :     Rectangle aFloatingRect;
     104             :     // the position and the size of the docking window
     105             :     Rectangle aDockingRect;
     106             :     // the parent layout window (only when docking)
     107             :     VclPtr<Layout> pLayout;
     108             :     // > 0: shown, <= 0: hidden, ++ by Show() and -- by Hide()
     109             :     int nShowCount;
     110             : 
     111             :     static WinBits const StyleBits;
     112             : 
     113             : private:
     114             :     void DockThis ();
     115             : };
     116             : 
     117             : 
     118             : // basctl::TabBar
     119             : // Not to be confused with ::TabBar from svtools.
     120             : 
     121           0 : class TabBar : public ::TabBar
     122             : {
     123             : protected:
     124             :     virtual void    MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
     125             :     virtual void    Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
     126             : 
     127             :     virtual TabBarAllowRenamingReturnCode  AllowRenaming() SAL_OVERRIDE;
     128             :     virtual void    EndRenaming() SAL_OVERRIDE;
     129             : 
     130             : public:
     131             :     TabBar (vcl::Window* pParent);
     132             : 
     133             :     void            Sort();
     134             : };
     135             : 
     136             : enum BasicWindowStatus
     137             : {
     138             :     BASWIN_OK           = 0x00,
     139             :     BASWIN_RUNNINGBASIC = 0x01,
     140             :     BASWIN_TOBEKILLED   = 0x02,
     141             :     BASWIN_SUSPENDED    = 0x04,
     142             :     BASWIN_INRESCHEDULE = 0x08
     143             : };
     144             : 
     145             : class EntryDescriptor;
     146             : 
     147             : 
     148             : // BaseWindow -- the base of both ModulWindow and DialogWindow.
     149             : 
     150             : class BaseWindow : public vcl::Window
     151             : {
     152             : private:
     153             :     VclPtr<ScrollBar>      pShellHScrollBar;
     154             :     VclPtr<ScrollBar>      pShellVScrollBar;
     155             : 
     156             :     DECL_LINK( ScrollHdl, ScrollBar * );
     157             :     int nStatus;
     158             : 
     159             :     ScriptDocument      m_aDocument;
     160             :     OUString            m_aLibName;
     161             :     OUString            m_aName;
     162             : 
     163             :     friend class ModulWindow;
     164             :     friend class DialogWindow;
     165             : 
     166             : protected:
     167             :     virtual void    DoScroll( ScrollBar* pCurScrollBar );
     168             : 
     169             : public:
     170             :                     TYPEINFO();
     171             :     BaseWindow( vcl::Window* pParent, const ScriptDocument& rDocument, const OUString& aLibName, const OUString& aName );
     172             :     virtual         ~BaseWindow();
     173             :     virtual void    dispose() SAL_OVERRIDE;
     174             : 
     175             :     void            Init();
     176             :     virtual void    DoInit();
     177             :     virtual void    Activating () = 0;
     178             :     virtual void    Deactivating () = 0;
     179             :     void            GrabScrollBars( ScrollBar* pHScroll, ScrollBar* pVScroll );
     180             : 
     181           0 :     ScrollBar*      GetHScrollBar() const { return pShellHScrollBar; }
     182           0 :     ScrollBar*      GetVScrollBar() const { return pShellVScrollBar; }
     183             : 
     184             :     virtual void    ExecuteCommand (SfxRequest&);
     185             :     virtual void    ExecuteGlobal (SfxRequest&);
     186             :     virtual void    GetState (SfxItemSet&) = 0;
     187             :     virtual bool    Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
     188             : 
     189             :     virtual void    StoreData();
     190             :     virtual void    UpdateData();
     191             :     virtual bool    CanClose();
     192             : 
     193             :     // return number of pages to be printed
     194             :     virtual sal_Int32 countPages( Printer* pPrinter ) = 0;
     195             :     // print page
     196             :     virtual void printPage( sal_Int32 nPage, Printer* pPrinter ) = 0;
     197             : 
     198             :     virtual OUString         GetTitle();
     199             :     OUString                 CreateQualifiedName();
     200             :     virtual EntryDescriptor  CreateEntryDescriptor() = 0;
     201             : 
     202             :     virtual bool    IsModified();
     203             :     virtual bool    IsPasteAllowed();
     204             : 
     205             :     virtual bool    AllowUndo();
     206             : 
     207             :     virtual void    SetReadOnly (bool bReadOnly);
     208             :     virtual bool    IsReadOnly();
     209             : 
     210           0 :     int GetStatus() { return nStatus; }
     211           0 :     void SetStatus(int n) { nStatus = n; }
     212           0 :     void AddStatus(int n) { nStatus |= n; }
     213           0 :     void ClearStatus(int n) { nStatus &= ~n; }
     214             : 
     215             :     virtual svl::IUndoManager* GetUndoManager ();
     216             : 
     217             :     virtual SearchOptionFlags  GetSearchOptions();
     218             :     virtual sal_uInt16  StartSearchAndReplace (SvxSearchItem const&, bool bFromStart = false);
     219             : 
     220             :     virtual void    BasicStarted();
     221             :     virtual void    BasicStopped();
     222             : 
     223           0 :     bool            IsSuspended() const { return nStatus & BASWIN_SUSPENDED; }
     224             : 
     225             :     const ScriptDocument&
     226           0 :                     GetDocument() const { return m_aDocument; }
     227             :     void            SetDocument( const ScriptDocument& rDocument ) { m_aDocument = rDocument; }
     228           0 :     bool            IsDocument( const ScriptDocument& rDocument ) const { return rDocument == m_aDocument; }
     229           0 :     const OUString&   GetLibName() const { return m_aLibName; }
     230             :     void            SetLibName( const OUString& aLibName ) { m_aLibName = aLibName; }
     231           0 :     const OUString&   GetName() const { return m_aName; }
     232           0 :     void            SetName( const OUString& aName ) { m_aName = aName; }
     233             : 
     234             :     virtual void OnNewDocument ();
     235             :     virtual char const* GetHid () const = 0;
     236             :     virtual ItemType GetType () const = 0;
     237             :     void InsertLibInfo () const;
     238             :     bool Is (ScriptDocument const&, OUString const&, OUString const&, ItemType, bool bFindSuspended);
     239             :     virtual bool HasActiveEditor () const;
     240             : };
     241             : 
     242             : class LibInfos
     243             : {
     244             : public:
     245             :     class Item;
     246             : public:
     247             :     LibInfos ();
     248             :     ~LibInfos ();
     249             : public:
     250             :     void InsertInfo (ScriptDocument const&, OUString const& rLibName, OUString const& rCurrentName, ItemType eCurrentType);
     251             :     void RemoveInfoFor (ScriptDocument const&);
     252             :     Item const* GetInfo (ScriptDocument const&, OUString const& rLibName);
     253             : 
     254             : private:
     255           0 :     class Key
     256             :     {
     257             :     private:
     258             :         ScriptDocument  m_aDocument;
     259             :         OUString        m_aLibName;
     260             : 
     261             :     public:
     262             :         Key (ScriptDocument const&, OUString const& rLibName);
     263             :         ~Key ();
     264             :     public:
     265             :         bool operator == (Key const&) const;
     266             :         struct Hash
     267             :         {
     268             :             size_t operator () (Key const&) const;
     269             :         };
     270             :     public:
     271           0 :         const ScriptDocument& GetDocument() const { return m_aDocument; }
     272             :         const OUString& GetLibName() const { return m_aLibName; }
     273             :     };
     274             : public:
     275           0 :     class Item
     276             :     {
     277             :     private:
     278             :         ScriptDocument  m_aDocument;
     279             :         OUString        m_aLibName;
     280             :         OUString        m_aCurrentName;
     281             :         ItemType        m_eCurrentType;
     282             : 
     283             :     public:
     284             :         Item (ScriptDocument const&, OUString const& rLibName, OUString const& rCurrentName, ItemType eCurrentType);
     285             :         ~Item ();
     286             :     public:
     287             :         const ScriptDocument&  GetDocument()    const { return m_aDocument; }
     288             :         const OUString& GetLibName()            const { return m_aLibName; }
     289           0 :         const OUString& GetCurrentName()        const { return m_aCurrentName; }
     290           0 :         ItemType               GetCurrentType() const { return m_eCurrentType; }
     291             :     };
     292             : private:
     293             :     typedef std::unordered_map<Key, Item, Key::Hash> Map;
     294             :     Map m_aMap;
     295             : };
     296             : 
     297             : void            CutLines( OUString& rStr, sal_Int32 nStartLine, sal_Int32 nLines, bool bEraseTrailingEmptyLines = false );
     298             : OUString CreateMgrAndLibStr( const OUString& rMgrName, const OUString& rLibName );
     299             : sal_uLong           CalcLineCount( SvStream& rStream );
     300             : 
     301             : bool QueryReplaceMacro( const OUString& rName, vcl::Window* pParent = 0 );
     302             : bool QueryDelMacro( const OUString& rName, vcl::Window* pParent = 0 );
     303             : bool QueryDelDialog( const OUString& rName, vcl::Window* pParent = 0 );
     304             : bool QueryDelModule( const OUString& rName, vcl::Window* pParent = 0 );
     305             : bool QueryDelLib( const OUString& rName, bool bRef = false, vcl::Window* pParent = 0 );
     306             : bool QueryPassword( const ::com::sun::star::uno::Reference< ::com::sun::star::script::XLibraryContainer >& xLibContainer, const OUString& rLibName, OUString& rPassword, bool bRepeat = false, bool bNewTitle = false );
     307             : 
     308             : class ModuleInfoHelper
     309             : {
     310             :     ModuleInfoHelper (const ModuleInfoHelper&) SAL_DELETED_FUNCTION;
     311             :     ModuleInfoHelper& operator = (const ModuleInfoHelper&) SAL_DELETED_FUNCTION;
     312             : public:
     313             :     static void getObjectName( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rLib, const OUString& rModName, OUString& rObjName );
     314             :     static sal_Int32 getModuleType(  const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rLib, const OUString& rModName );
     315             : };
     316             : 
     317             : } // namespace basctl
     318             : 
     319             : #endif // INCLUDED_BASCTL_SOURCE_INC_BASTYPES_HXX
     320             : 
     321             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11