LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/filter/msfilter - mstoolbar.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 47 4.3 %
Date: 2012-08-25 Functions: 2 58 3.4 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1 58 1.7 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*
       3                 :            :  * Version: MPL 1.1 / GPLv3+ / LGPLv3+
       4                 :            :  *
       5                 :            :  * The contents of this file are subject to the Mozilla Public License Version
       6                 :            :  * 1.1 (the "License"); you may not use this file except in compliance with
       7                 :            :  * the License or as specified alternatively below. You may obtain a copy of
       8                 :            :  * the License at http://www.mozilla.org/MPL/
       9                 :            :  *
      10                 :            :  * Software distributed under the License is distributed on an "AS IS" basis,
      11                 :            :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12                 :            :  * for the specific language governing rights and limitations under the
      13                 :            :  * License.
      14                 :            :  *
      15                 :            :  * The Initial Developer of the Original Code is
      16                 :            :  *       Noel Power <noel.power@novell.com>
      17                 :            :  * Portions created by the Initial Developer are Copyright (C) 2010 the
      18                 :            :  * Initial Developer. All Rights Reserved.
      19                 :            :  *
      20                 :            :  * Contributor(s):
      21                 :            :  *       Noel Power <noel.power@novell.com>
      22                 :            :  *
      23                 :            :  * For minor contributions see the git repository.
      24                 :            :  *
      25                 :            :  * Alternatively, the contents of this file may be used under the terms of
      26                 :            :  * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
      27                 :            :  * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
      28                 :            :  * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
      29                 :            :  * instead of those above.
      30                 :            :  */
      31                 :            : #ifndef _MSTOOLBAR_HXX
      32                 :            : #define _MSTOOLBAR_HXX
      33                 :            : #include "filter/msfilter/msfilterdllapi.h"
      34                 :            : #include <sot/storage.hxx>
      35                 :            : #include <ostream>
      36                 :            : #include <memory>
      37                 :            : #include <vector>
      38                 :            : #include <boost/shared_ptr.hpp>
      39                 :            : #include <com/sun/star/frame/XModel.hpp>
      40                 :            : #include <com/sun/star/container/XIndexContainer.hpp>
      41                 :            : #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
      42                 :            : #include <com/sun/star/ui/ImageType.hpp>
      43                 :            : #include <com/sun/star/graphic/XGraphic.hpp>
      44                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      45                 :            : #include <vcl/bitmap.hxx>
      46                 :            : #include <cppuhelper/implbase1.hxx>
      47                 :            : 
      48                 :            : namespace css = ::com::sun::star;
      49                 :            : 
      50                 :            : class TBCHeader;
      51                 :            : 
      52                 :            : 
      53                 :          0 : class MSOCommandConvertor
      54                 :            : {
      55                 :            : public:
      56         [ #  # ]:          0 :     virtual ~MSOCommandConvertor() {}
      57                 :            :     virtual rtl::OUString MSOCommandToOOCommand( sal_Int16 msoCmd ) = 0;
      58                 :            :     virtual rtl::OUString MSOTCIDToOOCommand( sal_Int16 msoTCID ) = 0;
      59                 :            : };
      60                 :            : 
      61                 :            : class SfxObjectShell;
      62                 :            : 
      63         [ #  # ]:          0 : class MSFILTER_DLLPUBLIC CustomToolBarImportHelper
      64                 :            : {
      65                 :          0 :     struct iconcontrolitem
      66                 :            :     {
      67                 :            :         rtl::OUString sCommand;
      68                 :            :         css::uno::Reference< css::graphic::XGraphic > image;
      69                 :            :     };
      70                 :            :     std::vector< iconcontrolitem > iconcommands;
      71                 :            :     std::auto_ptr< MSOCommandConvertor > pMSOCmdConvertor;
      72                 :            :     css::uno::Reference< css::ui::XUIConfigurationManagerSupplier > m_xCfgSupp;
      73                 :            :     css::uno::Reference< css::ui::XUIConfigurationManager > m_xAppCfgMgr;
      74                 :            :     SfxObjectShell& mrDocSh;
      75                 :            :     void ScaleImage( css::uno::Reference< css::graphic::XGraphic >& xGraphic, long nNewSize );
      76                 :            : public:
      77                 :            :     CustomToolBarImportHelper( SfxObjectShell& rDocSh, const css::uno::Reference< css::ui::XUIConfigurationManager >& rxAppCfgMgr );
      78                 :            : 
      79                 :          0 :     void setMSOCommandMap( MSOCommandConvertor* pCnvtr ) { pMSOCmdConvertor.reset( pCnvtr ); }
      80                 :            :     css::uno::Reference< css::ui::XUIConfigurationManager > getCfgManager();
      81                 :            :     css::uno::Reference< css::ui::XUIConfigurationManager > getAppCfgManager();
      82                 :            : 
      83                 :            : 
      84                 :            :     css::uno::Any createCommandFromMacro( const rtl::OUString& sCmd );
      85                 :            : 
      86                 :            :     void addIcon( const css::uno::Reference< css::graphic::XGraphic >& xImage, const rtl::OUString& sString );
      87                 :            :     void applyIcons();
      88                 :            :     rtl::OUString MSOCommandToOOCommand( sal_Int16 msoCmd );
      89                 :            :     rtl::OUString MSOTCIDToOOCommand( sal_Int16 msoTCID );
      90                 :          0 :     SfxObjectShell& GetDocShell() { return mrDocSh; }
      91                 :            :     bool createMenu( const rtl::OUString& rName, const css::uno::Reference< css::container::XIndexAccess >& xMenuDesc, bool bPersist );
      92                 :            : };
      93                 :            : 
      94                 :          0 : class MSFILTER_DLLPUBLIC TBBase
      95                 :            : {
      96                 :            : friend class Indent;
      97                 :            :     static int nIndent; // num spaces to indent before printing
      98                 :            : protected:
      99                 :            :     void indent_printf(FILE* fp, const char* format, ... );
     100                 :            :     sal_uInt32 nOffSet; // usually for debug we can store the offset in the stream to this record
     101                 :            : public:
     102                 :        317 :     TBBase() : nOffSet( 0 ) {}
     103         [ -  + ]:        317 :     virtual ~TBBase(){}
     104                 :            : 
     105                 :            :     virtual bool Read(SvStream &rS) = 0;
     106                 :          0 :     virtual void Print( FILE* ) {} // #FIXME remove this an implement the debug routines in all the classes below to enable some sort of readable output
     107                 :          0 :     sal_uInt32 GetOffset() { return nOffSet; }
     108                 :            : };
     109                 :            : 
     110                 :            : class Indent
     111                 :            : {
     112                 :            : public:
     113                 :          0 :     Indent( bool binit = false )
     114                 :            :     {
     115         [ #  # ]:          0 :         if ( binit )
     116                 :          0 :             init();
     117                 :            :         else
     118                 :          0 :             TBBase::nIndent = TBBase::nIndent + 2;
     119                 :          0 :     }
     120                 :          0 :     ~Indent() { TBBase::nIndent = TBBase::nIndent - 2; }
     121                 :          0 :     void init() { TBBase::nIndent = 0; }
     122                 :            : };
     123                 :            : 
     124                 :            : 
     125                 :          0 : class MSFILTER_DLLPUBLIC WString : public TBBase
     126                 :            : {
     127                 :            :     rtl::OUString sString;
     128                 :            : 
     129                 :            : public:
     130                 :          0 :     WString(){};
     131         [ #  # ]:          0 :     ~WString(){};
     132                 :            :     bool Read(SvStream &rS);
     133                 :          0 :     rtl::OUString getString(){ return sString; }
     134                 :            : };
     135                 :            : 
     136                 :            : class MSFILTER_DLLPUBLIC TBCExtraInfo : public TBBase
     137                 :            : {
     138                 :            :     WString wstrHelpFile;
     139                 :            :     sal_Int32 idHelpContext;
     140                 :            :     WString wstrTag;
     141                 :            :     WString wstrOnAction;
     142                 :            :     WString wstrParam;
     143                 :            :     sal_Int8 tbcu;
     144                 :            :     sal_Int8 tbmg;
     145                 :            : 
     146                 :            :     TBCExtraInfo(const TBCExtraInfo&);
     147                 :            :     TBCExtraInfo& operator = ( const TBCExtraInfo&);
     148                 :            : public:
     149                 :            :     TBCExtraInfo();
     150         [ #  # ]:          0 :     ~TBCExtraInfo(){}
     151                 :            :     bool Read(SvStream &rS);
     152                 :            :     void Print( FILE* );
     153                 :            :     rtl::OUString getOnAction();
     154                 :            : };
     155                 :            : 
     156                 :            : class MSFILTER_DLLPUBLIC TBCGeneralInfo  : public TBBase
     157                 :            : {
     158                 :            :     sal_uInt8 bFlags;
     159                 :            :     WString customText;
     160                 :            :     WString descriptionText;
     161                 :            :     WString tooltip;
     162                 :            :     TBCExtraInfo extraInfo;
     163                 :            : 
     164                 :            : public:
     165                 :            :     TBCGeneralInfo();
     166         [ #  # ]:          0 :     ~TBCGeneralInfo() {}
     167                 :            :     bool Read(SvStream &rS);
     168                 :            :     void Print( FILE* );
     169                 :            :     bool ImportToolBarControlData( CustomToolBarImportHelper&, std::vector< css::beans::PropertyValue >& );
     170                 :          0 :     rtl::OUString CustomText() { return customText.getString(); }
     171                 :            :     rtl::OUString DescriptionText() { return descriptionText.getString(); }
     172                 :            :     rtl::OUString Tooltip() { return tooltip.getString(); }
     173                 :            : };
     174                 :            : 
     175                 :            : class MSFILTER_DLLPUBLIC TBCBitMap : public TBBase
     176                 :            : {
     177                 :            : friend class TBCBSpecific; // #FIXME hacky access, need to fix
     178                 :            :     sal_Int32 cbDIB;
     179                 :            :     Bitmap mBitMap;
     180                 :            :     int size;
     181                 :            : public:
     182                 :            :     TBCBitMap();
     183                 :            :     ~TBCBitMap();
     184                 :            :     bool Read(SvStream &rS);
     185                 :            :     void Print( FILE* );
     186                 :            :     Bitmap& getBitMap();
     187                 :            : };
     188                 :            : 
     189                 :            : class MSFILTER_DLLPUBLIC TBCMenuSpecific : public TBBase
     190                 :            : {
     191                 :            :     sal_Int32 tbid;
     192                 :            :     boost::shared_ptr< WString > name; //exist only if tbid equals 0x00000001
     193                 :            : public:
     194                 :            :     TBCMenuSpecific();
     195 [ #  # ][ #  # ]:          0 :     ~TBCMenuSpecific(){}
     196                 :            :     bool Read(SvStream &rS);
     197                 :            :     void Print( FILE* );
     198                 :            :     rtl::OUString Name();
     199                 :            : };
     200                 :            : 
     201                 :            : class MSFILTER_DLLPUBLIC TBCCDData : public TBBase
     202                 :            : {
     203                 :            :     sal_Int16 cwstrItems; //Signed integer that specifies the number of items in wstrList. MUST be positive.
     204                 :            :     std::vector< WString > wstrList;  // Zero-based index array of WString structures. Number of elements MUST be equal to cwstrItems.
     205                 :            :     sal_Int16 cwstrMRU; // Signed integer that specifies the number of most recently used string
     206                 :            :     sal_Int16 iSel ; // Signed integer that specifies the zero-based index of the selected item in the wstrList field. MUST be equal to 0xFFFF (-1) or greater than or equal to 0x0000.
     207                 :            :     sal_Int16 cLines; // Signed integer that specifies the suggested number of lines that the toolbar control will display at any time when displaying the elements of wstrList of available items.
     208                 :            :     sal_Int16 dxWidth; // Signed integer that specifies the width in pixels that the interior of the dropdown has. This excludes the width of the toolbar control border and scroll bar.
     209                 :            :     WString wstrEdit; //Structure of type WString. Editable text for editable area of the ComboBox toolbar control.
     210                 :            : 
     211                 :            : public:
     212                 :            :     TBCCDData();
     213                 :            :     ~TBCCDData();
     214                 :            :     bool Read(SvStream &rS);
     215                 :            :     void Print( FILE* );
     216                 :            : };
     217                 :            : 
     218 [ #  # ][ #  # ]:          0 : class TBCComboDropdownSpecific : public TBBase
     219                 :            : {
     220                 :            :     boost::shared_ptr< TBCCDData > data;
     221                 :            : public:
     222                 :            :     TBCComboDropdownSpecific( const TBCHeader& header );
     223                 :            :     TBCComboDropdownSpecific(){}
     224                 :            :     bool Read(SvStream &rS);
     225                 :            :     void Print( FILE* );
     226                 :            : };
     227                 :            : 
     228                 :            : class TBCBSpecific :  public TBBase
     229                 :            : {
     230                 :            :     sal_uInt8 bFlags;
     231                 :            :     boost::shared_ptr< TBCBitMap > icon; // optional
     232                 :            :     boost::shared_ptr< TBCBitMap > iconMask; // optional
     233                 :            :     boost::shared_ptr< sal_uInt16 > iBtnFace; // optional
     234                 :            :     boost::shared_ptr< WString > wstrAcc; // optional
     235                 :            : 
     236                 :            : public:
     237                 :            :     TBCBSpecific();
     238 [ #  # ][ #  # ]:          0 :     ~TBCBSpecific(){}
         [ #  # ][ #  # ]
                 [ #  # ]
     239                 :            :     bool Read(SvStream &rS);
     240                 :            :     void Print( FILE* );
     241                 :            :     // #TODO just add a getGraphic member here
     242                 :            :     TBCBitMap* getIcon();
     243                 :            :     TBCBitMap* getIconMask();
     244                 :          0 :     sal_uInt16* getBtnFace() { return iBtnFace.get(); }
     245                 :            : };
     246                 :            : 
     247                 :            : /* TBCHeader.tct                   controlSpecificInfo type
     248                 :            : 
     249                 :            : 0x01 (Button control)              TBCBSpecific
     250                 :            : 0x10 (ExpandingGrid control)       TBCBSpecific
     251                 :            : 0x0A (Popup control)               TBCMenuSpecific
     252                 :            : 0x0C (ButtonPopup control)         TBCMenuSpecific
     253                 :            : 0x0D (SplitButtonPopup control)    TBCMenuSpecific
     254                 :            : 0x0E (SplitButtonMRUPopup control) TBCMenuSpecific
     255                 :            : 0x02 (Edit control)                TBCComboDropdow nSpecific
     256                 :            : 0x04 (ComboBox control)            TBCComboDropdow nSpecific
     257                 :            : 0x14 (GraphicCombo control)        TBCComboDropdow nSpecific
     258                 :            : 0x03 (DropDown control)            TBCComboDropdow nSpecific
     259                 :            : 0x06 (SplitDropDown control)       TBCComboDropdow nSpecific
     260                 :            : 0x09 (GraphicDropDown control)     TBCComboDropdow nSpecific
     261                 :            : 0x07 (OCXDropDown control)         controlSpecificInfo MUST NOT exist
     262                 :            : 0x0F (Label control)               controlSpecificInfo MUST NOT exist
     263                 :            : 0x12 (Grid control)                controlSpecificInfo MUST NOT exist
     264                 :            : 0x13 (Gauge control)               controlSpecificInfo MUST NOT exist
     265                 :            : 0x16 (ActiveX control)             controlSpecificInfo MUST NOT exist
     266                 :            : 
     267                 :            : */
     268 [ #  # ][ #  # ]:          0 : class MSFILTER_DLLPUBLIC TBCHeader : public TBBase
     269                 :            : {
     270                 :            :     sal_Int8 bSignature;
     271                 :            :     sal_Int8 bVersion;
     272                 :            :     sal_uInt8 bFlagsTCR;
     273                 :            :     sal_uInt8 tct;
     274                 :            :     sal_uInt16 tcid;
     275                 :            :     sal_uInt32 tbct;
     276                 :            :     sal_uInt8 bPriority;
     277                 :            :     boost::shared_ptr< sal_uInt16 > width;  //optional
     278                 :            :     boost::shared_ptr< sal_uInt16 > height; //optional
     279                 :            : 
     280                 :            : public:
     281                 :            :     TBCHeader();
     282                 :            :     ~TBCHeader();
     283                 :          0 :     sal_uInt8 getTct() const { return tct; }
     284                 :          0 :     sal_uInt16 getTcID() const { return tcid; }
     285                 :          0 :     bool isVisible() { return !( bFlagsTCR & 0x1 ); }
     286                 :          0 :     bool isBeginGroup() { return ( bFlagsTCR & 0x2 ); }
     287                 :            :     bool Read(SvStream &rS);
     288                 :            :     void Print( FILE* );
     289                 :          0 :     sal_uInt32 getTbct() { return tbct; };
     290                 :            : };
     291                 :            : 
     292                 :            : class MSFILTER_DLLPUBLIC TBCData : public TBBase
     293                 :            : {
     294                 :            :     TBCHeader rHeader;
     295                 :            :     TBCGeneralInfo controlGeneralInfo;
     296                 :            :     boost::shared_ptr< TBBase > controlSpecificInfo; // can be one of TBCBSpecific, TBCMenuSpecific or TBCComboDropdow nSpecific depending on the control type specified by TBCHeader.tct
     297                 :            :     TBCData(const TBCData&);
     298                 :            :     TBCData& operator = ( const TBCData&);
     299                 :            : public:
     300                 :            :     TBCData( const TBCHeader& Header );
     301 [ #  # ][ #  # ]:          0 :     ~TBCData(){}
                 [ #  # ]
     302                 :            :     bool Read(SvStream &rS);
     303                 :            :     void Print( FILE* );
     304                 :            :     bool ImportToolBarControl( CustomToolBarImportHelper&, std::vector< css::beans::PropertyValue >&, bool& bBeginGroup, bool bIsMenuBar );
     305                 :          0 :     TBCGeneralInfo& getGeneralInfo() { return controlGeneralInfo; }
     306                 :            :     TBCMenuSpecific* getMenuSpecific();
     307                 :            : };
     308                 :            : 
     309         [ #  # ]:          0 : class MSFILTER_DLLPUBLIC TB : public TBBase
     310                 :            : {
     311                 :            :     sal_uInt8 bSignature;// Signed integer that specifies the toolbar signature number. MUST be 0x02.
     312                 :            :     sal_uInt8 bVersion; // Signed integer that specifies the toolbar version number. MUST be 0x01.
     313                 :            :     sal_Int16 cCL; // Signed integer that SHOULD  specify the number of toolbar controls contained in this toolbar.
     314                 :            :     sal_Int32 ltbid;// Signed integer that specifies the toolbar ID. MUST be 0x0001 (custom toolbar ID).
     315                 :            :     sal_uInt32 ltbtr;// Unsigned integer of type TBTRFlags that specifies the toolbar type and toolbar restrictions.
     316                 :            :     sal_uInt16 cRowsDefault;// Unsigned integer that specifies the number of preferred rows for the toolbar when the toolbar is not docked. MUST be less than or equal to 255.
     317                 :            :     sal_uInt16 bFlags; //Unsigned integer of type TBFlags.
     318                 :            :     WString name; //Structure of type WString that specifies the toolbar name
     319                 :            : public:
     320                 :            :     TB();
     321         [ #  # ]:          0 :     ~TB(){}
     322                 :            :     bool Read(SvStream &rS);
     323                 :            :     void Print( FILE* );
     324                 :          0 :     sal_Int16 getcCL(){ return cCL; }
     325                 :          0 :     WString& getName(){ return name; }
     326                 :            :     bool IsEnabled();
     327                 :          0 :     bool IsMenuToolbar(){ return ( ( ltbtr & 0x2000000 ) == 0x2000000 ); }
     328                 :            : };
     329                 :            : 
     330         [ #  # ]:          0 : class MSFILTER_DLLPUBLIC SRECT : public TBBase
     331                 :            : {
     332                 :            : public:
     333                 :          0 :     SRECT() : left(0), top(0), right(0), bottom(0) {}
     334                 :            :     sal_Int16 left;
     335                 :            :     sal_Int16 top;
     336                 :            :     sal_Int16 right;
     337                 :            :     sal_Int16 bottom;
     338                 :          0 :     bool Read( SvStream &rS ) { rS >> left >> top >> right >> bottom; return true; }
     339                 :            :     void Print( FILE* fo );
     340                 :            : };
     341                 :            : 
     342                 :            : typedef cppu::WeakImplHelper1< css::container::XIndexContainer > PropertyValueIndexContainer_BASE;
     343                 :            : 
     344 [ #  # ][ #  # ]:          0 : class MSFILTER_DLLPUBLIC TBVisualData : public TBBase
     345                 :            : {
     346                 :            :     sal_Int8 tbds;
     347                 :            :     sal_Int8 tbv;
     348                 :            :     sal_Int8 tbdsDock;
     349                 :            :     sal_Int8 iRow;
     350                 :            : 
     351                 :            :     SRECT rcDock;
     352                 :            :     SRECT rcFloat;
     353                 :            : 
     354                 :            : public:
     355                 :            :     TBVisualData();
     356 [ #  # ][ #  # ]:          0 :     ~TBVisualData(){}
                 [ #  # ]
     357                 :            :     bool Read(SvStream &rS);
     358                 :            :     void Print( FILE* );
     359                 :            : };
     360                 :            : #endif
     361                 :            : 
     362                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10