LCOV - code coverage report
Current view: top level - basctl/source/inc - bastypes.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 27 0.0 %
Date: 2012-08-25 Functions: 0 25 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

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

Generated by: LCOV version 1.10