LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/oox/ole - axcontrol.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 16 46 34.8 %
Date: 2012-08-25 Functions: 17 78 21.8 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 24 220 10.9 %

           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                 :            : 
      20                 :            : #ifndef OOX_OLE_AXCONTROL_HXX
      21                 :            : #define OOX_OLE_AXCONTROL_HXX
      22                 :            : 
      23                 :            : #include <boost/shared_ptr.hpp>
      24                 :            : #include "oox/helper/binarystreambase.hxx"
      25                 :            : #include "oox/helper/propertyset.hxx"
      26                 :            : #include "oox/ole/axbinaryreader.hxx"
      27                 :            : #include "oox/ole/olehelper.hxx"
      28                 :            : #include "oox/dllapi.h"
      29                 :            : 
      30                 :            : namespace com { namespace sun { namespace star {
      31                 :            :     namespace awt { class XControlModel; }
      32                 :            :     namespace container { class XIndexContainer; }
      33                 :            :     namespace drawing { class XDrawPage; }
      34                 :            :     namespace frame { class XModel; }
      35                 :            :     namespace form { class XFormsSupplier; }
      36                 :            :     namespace lang { class XMultiServiceFactory; }
      37                 :            : } } }
      38                 :            : 
      39                 :            : namespace oox {
      40                 :            :     class BinaryInputStream;
      41                 :            :     class GraphicHelper;
      42                 :            :     class PropertyMap;
      43                 :            : }
      44                 :            : 
      45                 :            : namespace oox {
      46                 :            : namespace ole {
      47                 :            : 
      48                 :            : // ============================================================================
      49                 :            : 
      50                 :            : #define COMCTL_GUID_SCROLLBAR_60   "{FE38753A-44A3-11D1-B5B7-0000C09000C4}"
      51                 :            : #define COMCTL_GUID_PROGRESSBAR_50 "{0713E8D2-850A-101B-AFC0-4210102A8DA7}"
      52                 :            : #define COMCTL_GUID_PROGRESSBAR_60 "{35053A22-8589-11D1-B16A-00C0F0283628}"
      53                 :            : 
      54                 :            : const sal_uInt16 COMCTL_VERSION_50          = 5;
      55                 :            : const sal_uInt16 COMCTL_VERSION_60          = 6;
      56                 :            : 
      57                 :            : // ----------------------------------------------------------------------------
      58                 :            : 
      59                 :            : #define AX_GUID_COMMANDBUTTON "{D7053240-CE69-11CD-a777-00dd01143c57}"
      60                 :            : #define AX_GUID_LABEL         "{978C9E23-D4B0-11CE-bf2d-00aa003f40d0}"
      61                 :            : #define AX_GUID_IMAGE         "{4C599241-6926-101B-9992-00000b65c6f9}"
      62                 :            : #define AX_GUID_TOGGLEBUTTON  "{8BD21D60-EC42-11CE-9e0d-00aa006002f3}"
      63                 :            : #define AX_GUID_CHECKBOX      "{8BD21D40-EC42-11CE-9e0d-00aa006002f3}"
      64                 :            : #define AX_GUID_OPTIONBUTTON  "{8BD21D50-EC42-11CE-9e0d-00aa006002f3}"
      65                 :            : #define AX_GUID_TEXTBOX       "{8BD21D10-EC42-11CE-9e0d-00aa006002f3}"
      66                 :            : #define AX_GUID_LISTBOX       "{8BD21D20-EC42-11CE-9e0d-00aa006002f3}"
      67                 :            : #define AX_GUID_COMBOBOX      "{8BD21D30-EC42-11CE-9e0d-00aa006002f3}"
      68                 :            : #define AX_GUID_SPINBUTTON    "{79176FB0-B7F2-11CE-97ef-00aa006d2776}"
      69                 :            : #define AX_GUID_SCROLLBAR     "{DFD181E0-5E2F-11CE-a449-00aa004a803d}"
      70                 :            : #define AX_GUID_FRAME         "{6E182020-F460-11CE-9bcd-00aa00608e01}"
      71                 :            : 
      72                 :            : // Html control GUID(s)
      73                 :            : 
      74                 :            : #define HTML_GUID_SELECT      "{5512D122-5CC6-11CF-8d67-00aa00bdce1d}"
      75                 :            : #define HTML_GUID_TEXTBOX     "{5512D124-5CC6-11CF-8d67-00aa00bdce1d}"
      76                 :            : 
      77                 :            : const sal_uInt32 AX_SYSCOLOR_WINDOWBACK     = 0x80000005;
      78                 :            : const sal_uInt32 AX_SYSCOLOR_WINDOWFRAME    = 0x80000006;
      79                 :            : const sal_uInt32 AX_SYSCOLOR_WINDOWTEXT     = 0x80000008;
      80                 :            : const sal_uInt32 AX_SYSCOLOR_BUTTONFACE     = 0x8000000F;
      81                 :            : const sal_uInt32 AX_SYSCOLOR_BUTTONTEXT     = 0x80000012;
      82                 :            : 
      83                 :            : const sal_uInt32 AX_FLAGS_ENABLED           = 0x00000002;
      84                 :            : const sal_uInt32 AX_FLAGS_LOCKED            = 0x00000004;
      85                 :            : const sal_uInt32 AX_FLAGS_OPAQUE            = 0x00000008;
      86                 :            : const sal_uInt32 AX_FLAGS_COLUMNHEADS       = 0x00000400;
      87                 :            : const sal_uInt32 AX_FLAGS_ENTIREROWS        = 0x00000800;
      88                 :            : const sal_uInt32 AX_FLAGS_EXISTINGENTRIES   = 0x00001000;
      89                 :            : const sal_uInt32 AX_FLAGS_CAPTIONLEFT       = 0x00002000;
      90                 :            : const sal_uInt32 AX_FLAGS_EDITABLE          = 0x00004000;
      91                 :            : const sal_uInt32 AX_FLAGS_IMEMODE_MASK      = 0x00078000;
      92                 :            : const sal_uInt32 AX_FLAGS_DRAGENABLED       = 0x00080000;
      93                 :            : const sal_uInt32 AX_FLAGS_ENTERASNEWLINE    = 0x00100000;
      94                 :            : const sal_uInt32 AX_FLAGS_KEEPSELECTION     = 0x00200000;
      95                 :            : const sal_uInt32 AX_FLAGS_TABASCHARACTER    = 0x00400000;
      96                 :            : const sal_uInt32 AX_FLAGS_WORDWRAP          = 0x00800000;
      97                 :            : const sal_uInt32 AX_FLAGS_BORDERSSUPPRESSED = 0x02000000;
      98                 :            : const sal_uInt32 AX_FLAGS_SELECTLINE        = 0x04000000;
      99                 :            : const sal_uInt32 AX_FLAGS_SINGLECHARSELECT  = 0x08000000;
     100                 :            : const sal_uInt32 AX_FLAGS_AUTOSIZE          = 0x10000000;
     101                 :            : const sal_uInt32 AX_FLAGS_HIDESELECTION     = 0x20000000;
     102                 :            : const sal_uInt32 AX_FLAGS_MAXLENAUTOTAB     = 0x40000000;
     103                 :            : const sal_uInt32 AX_FLAGS_MULTILINE         = 0x80000000;
     104                 :            : 
     105                 :            : const sal_Int32 AX_BORDERSTYLE_NONE         = 0;
     106                 :            : const sal_Int32 AX_BORDERSTYLE_SINGLE       = 1;
     107                 :            : 
     108                 :            : const sal_Int32 AX_SPECIALEFFECT_FLAT       = 0;
     109                 :            : const sal_Int32 AX_SPECIALEFFECT_RAISED     = 1;
     110                 :            : const sal_Int32 AX_SPECIALEFFECT_SUNKEN     = 2;
     111                 :            : const sal_Int32 AX_SPECIALEFFECT_ETCHED     = 3;
     112                 :            : const sal_Int32 AX_SPECIALEFFECT_BUMPED     = 6;
     113                 :            : 
     114                 :            : const sal_Int32 AX_PICSIZE_CLIP             = 0;
     115                 :            : const sal_Int32 AX_PICSIZE_STRETCH          = 1;
     116                 :            : const sal_Int32 AX_PICSIZE_ZOOM             = 3;
     117                 :            : 
     118                 :            : const sal_Int32 AX_PICALIGN_TOPLEFT         = 0;
     119                 :            : const sal_Int32 AX_PICALIGN_TOPRIGHT        = 1;
     120                 :            : const sal_Int32 AX_PICALIGN_CENTER          = 2;
     121                 :            : const sal_Int32 AX_PICALIGN_BOTTOMLEFT      = 3;
     122                 :            : const sal_Int32 AX_PICALIGN_BOTTOMRIGHT     = 4;
     123                 :            : 
     124                 :            : const sal_Int32 AX_DISPLAYSTYLE_TEXT        = 1;
     125                 :            : const sal_Int32 AX_DISPLAYSTYLE_LISTBOX     = 2;
     126                 :            : const sal_Int32 AX_DISPLAYSTYLE_COMBOBOX    = 3;
     127                 :            : const sal_Int32 AX_DISPLAYSTYLE_CHECKBOX    = 4;
     128                 :            : const sal_Int32 AX_DISPLAYSTYLE_OPTBUTTON   = 5;
     129                 :            : const sal_Int32 AX_DISPLAYSTYLE_TOGGLE      = 6;
     130                 :            : const sal_Int32 AX_DISPLAYSTYLE_DROPDOWN    = 7;
     131                 :            : 
     132                 :            : const sal_Int32 AX_SELCTION_SINGLE          = 0;
     133                 :            : const sal_Int32 AX_SELCTION_MULTI           = 1;
     134                 :            : const sal_Int32 AX_SELCTION_EXTENDED        = 2;
     135                 :            : 
     136                 :            : const sal_Int32 AX_SHOWDROPBUTTON_NEVER     = 0;
     137                 :            : const sal_Int32 AX_SHOWDROPBUTTON_FOCUS     = 1;
     138                 :            : const sal_Int32 AX_SHOWDROPBUTTON_ALWAYS    = 2;
     139                 :            : 
     140                 :            : const sal_Int32 AX_SCROLLBAR_NONE           = 0x00;
     141                 :            : const sal_Int32 AX_SCROLLBAR_HORIZONTAL     = 0x01;
     142                 :            : const sal_Int32 AX_SCROLLBAR_VERTICAL       = 0x02;
     143                 :            : 
     144                 :            : // ----------------------------------------------------------------------------
     145                 :            : 
     146                 :            : /** Enumerates all UNO API control types supported by these filters. */
     147                 :            : enum ApiControlType
     148                 :            : {
     149                 :            :     API_CONTROL_BUTTON,
     150                 :            :     API_CONTROL_FIXEDTEXT,
     151                 :            :     API_CONTROL_IMAGE,
     152                 :            :     API_CONTROL_CHECKBOX,
     153                 :            :     API_CONTROL_RADIOBUTTON,
     154                 :            :     API_CONTROL_EDIT,
     155                 :            :     API_CONTROL_NUMERIC,
     156                 :            :     API_CONTROL_LISTBOX,
     157                 :            :     API_CONTROL_COMBOBOX,
     158                 :            :     API_CONTROL_SPINBUTTON,
     159                 :            :     API_CONTROL_SCROLLBAR,
     160                 :            :     API_CONTROL_TABSTRIP,
     161                 :            :     API_CONTROL_PROGRESSBAR,
     162                 :            :     API_CONTROL_GROUPBOX,
     163                 :            :     API_CONTROL_FRAME,
     164                 :            :     API_CONTROL_PAGE,
     165                 :            :     API_CONTROL_MULTIPAGE,
     166                 :            :     API_CONTROL_DIALOG
     167                 :            : };
     168                 :            : 
     169                 :            : // ============================================================================
     170                 :            : 
     171                 :            : /** Specifies how a form control supports transparent background. */
     172                 :            : enum ApiTransparencyMode
     173                 :            : {
     174                 :            :     API_TRANSPARENCY_NOTSUPPORTED,      ///< Control does not support transparency.
     175                 :            :     API_TRANSPARENCY_VOID,              ///< Transparency is enabled by missing fill color.
     176                 :            :     API_TRANSPARENCY_PAINTTRANSPARENT   ///< Transparency is enabled by the 'PaintTransparent' property.
     177                 :            : };
     178                 :            : 
     179                 :            : /** Specifies how a form control supports the DefaultState property. */
     180                 :            : enum ApiDefaultStateMode
     181                 :            : {
     182                 :            :     API_DEFAULTSTATE_BOOLEAN,           ///< Control does not support tri-state, state is given as boolean.
     183                 :            :     API_DEFAULTSTATE_SHORT,             ///< Control does not support tri-state, state is given as short.
     184                 :            :     API_DEFAULTSTATE_TRISTATE           ///< Control supports tri-state, state is given as short.
     185                 :            : };
     186                 :            : 
     187                 :            : // ----------------------------------------------------------------------------
     188                 :            : 
     189                 :            : /** A base class with useful helper functions for something that is able to
     190                 :            :     convert ActiveX and ComCtl form controls.
     191                 :            :  */
     192                 :            : class OOX_DLLPUBLIC ControlConverter
     193                 :            : {
     194                 :            : public:
     195                 :            :     explicit            ControlConverter(
     196                 :            :                             const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxDocModel,
     197                 :            :                             const GraphicHelper& rGraphicHelper,
     198                 :            :                             bool bDefaultColorBgr = true );
     199                 :            :     virtual             ~ControlConverter();
     200                 :            : 
     201                 :            :     // Generic conversion -----------------------------------------------------
     202                 :            : 
     203                 :            :     /** Converts the passed position in 1/100 mm to UNO properties. */
     204                 :            :     void                convertPosition(
     205                 :            :                             PropertyMap& rPropMap,
     206                 :            :                             const AxPairData& rPos ) const;
     207                 :            : 
     208                 :            :     /** Converts the passed size in 1/100 mm to UNO properties. */
     209                 :            :     void                convertSize(
     210                 :            :                             PropertyMap& rPropMap,
     211                 :            :                             const AxPairData& rSize ) const;
     212                 :            : 
     213                 :            :     /** Converts the passed encoded OLE color to UNO properties. */
     214                 :            :     void                convertColor(
     215                 :            :                             PropertyMap& rPropMap,
     216                 :            :                             sal_Int32 nPropId,
     217                 :            :                             sal_uInt32 nOleColor ) const;
     218                 :            : 
     219                 :            :     void                convertToMSColor(
     220                 :            :                             PropertySet& rPropSet,
     221                 :            :                             sal_Int32 nPropId,
     222                 :            :                             sal_uInt32& nOleColor,
     223                 :            :                             sal_uInt32 nDefault = 0 ) const;
     224                 :            : 
     225                 :            : 
     226                 :            :     /** Converts the passed StdPic picture stream to UNO properties. */
     227                 :            :     void                convertPicture(
     228                 :            :                             PropertyMap& rPropMap,
     229                 :            :                             const StreamDataSequence& rPicData ) const;
     230                 :            : 
     231                 :            :     /** Converts the control orientation to UNO properties. */
     232                 :            :     void                convertOrientation(
     233                 :            :                             PropertyMap& rPropMap,
     234                 :            :                             bool bHorizontal ) const;
     235                 :            : 
     236                 :            :     void                convertToMSOrientation(
     237                 :            :                             PropertySet& rPropMap,
     238                 :            :                             bool& bHorizontal ) const;
     239                 :            : 
     240                 :            :     /** Converts the vertical alignment to UNO properties. */
     241                 :            :     /** Converts the vertical alignment to UNO properties. */
     242                 :            :     void                convertVerticalAlign(
     243                 :            :                             PropertyMap& rPropMap,
     244                 :            :                             sal_Int32 nVerticalAlign ) const;
     245                 :            : 
     246                 :            :     /** Converts common scrollbar settings to UNO properties. */
     247                 :            :     void                convertScrollBar(
     248                 :            :                             PropertyMap& rPropMap,
     249                 :            :                             sal_Int32 nMin, sal_Int32 nMax, sal_Int32 nPosition,
     250                 :            :                             sal_Int32 nSmallChange, sal_Int32 nLargeChange, bool bAwtModel ) const;
     251                 :            : 
     252                 :            :     /** Binds the passed control model to the passed data sources. The
     253                 :            :         implementation will check which source types are supported. */
     254                 :            :     void                bindToSources(
     255                 :            :                             const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxCtrlModel,
     256                 :            :                             const ::rtl::OUString& rCtrlSource,
     257                 :            :                             const ::rtl::OUString& rRowSource,
     258                 :            :                             sal_Int32 nRefSheet = 0 ) const;
     259                 :            : 
     260                 :            :     // ActiveX (Forms 2.0) specific conversion --------------------------------
     261                 :            : 
     262                 :            :     /** Converts the Forms 2.0 background formatting to UNO properties. */
     263                 :            :     void                convertAxBackground(
     264                 :            :                             PropertyMap& rPropMap,
     265                 :            :                             sal_uInt32 nBackColor,
     266                 :            :                             sal_uInt32 nFlags,
     267                 :            :                             ApiTransparencyMode eTranspMode ) const;
     268                 :            : 
     269                 :            :     /** Converts the Forms 2.0 border formatting to UNO properties. */
     270                 :            :     void                convertAxBorder(
     271                 :            :                             PropertyMap& rPropMap,
     272                 :            :                             sal_uInt32 nBorderColor,
     273                 :            :                             sal_Int32 nBorderStyle,
     274                 :            :                             sal_Int32 nSpecialEffect ) const;
     275                 :            : 
     276                 :            :     void                convertToAxBorder(
     277                 :            :                             PropertySet& rPropSet,
     278                 :            :                             sal_uInt32& nBorderColor,
     279                 :            :                             sal_Int32& nBorderStyle,
     280                 :            :                             sal_Int32& nSpecialEffect ) const;
     281                 :            : 
     282                 :            :     /** Converts the Forms 2.0 special effect to UNO properties. */
     283                 :            :     void                convertAxVisualEffect(
     284                 :            :                             PropertyMap& rPropMap,
     285                 :            :                             sal_Int32 nSpecialEffect ) const;
     286                 :            : 
     287                 :            :     void                convertToAxVisualEffect(
     288                 :            :                             PropertySet& rPropSet,
     289                 :            :                             sal_Int32& nSpecialEffect ) const;
     290                 :            : 
     291                 :            :     /** Converts the passed picture stream and Forms 2.0 position to UNO
     292                 :            :         properties. */
     293                 :            :     void                convertAxPicture(
     294                 :            :                             PropertyMap& rPropMap,
     295                 :            :                             const StreamDataSequence& rPicData,
     296                 :            :                             sal_uInt32 nPicPos ) const;
     297                 :            : 
     298                 :            :     /** Converts the passed picture stream and Forms 2.0 position to UNO
     299                 :            :         properties. */
     300                 :            :     void                convertAxPicture(
     301                 :            :                             PropertyMap& rPropMap,
     302                 :            :                             const StreamDataSequence& rPicData,
     303                 :            :                             sal_Int32 nPicSizeMode,
     304                 :            :                             sal_Int32 nPicAlign,
     305                 :            :                             bool bPicTiling ) const;
     306                 :            : 
     307                 :            :     /** Converts the Forms 2.0 value for checked/unchecked/dontknow to UNO
     308                 :            :         properties. */
     309                 :            :     void                convertAxState(
     310                 :            :                             PropertyMap& rPropMap,
     311                 :            :                             const ::rtl::OUString& rValue,
     312                 :            :                             sal_Int32 nMultiSelect,
     313                 :            :                             ApiDefaultStateMode eDefStateMode,
     314                 :            :                             bool bAwtModel ) const;
     315                 :            : 
     316                 :            :     void                convertToAxState(
     317                 :            :                             PropertySet& rPropSet,
     318                 :            :                             ::rtl::OUString& rValue,
     319                 :            :                             sal_Int32& nMultiSelect,
     320                 :            :                             ApiDefaultStateMode eDefStateMode,
     321                 :            :                             bool bAwtModel ) const;
     322                 :            : 
     323                 :            :     /** Converts the Forms 2.0 control orientation to UNO properties. */
     324                 :            :     void                convertAxOrientation(
     325                 :            :                             PropertyMap& rPropMap,
     326                 :            :                             const AxPairData& rSize,
     327                 :            :                             sal_Int32 nOrientation ) const;
     328                 :            : 
     329                 :            :     void                convertToAxOrientation(
     330                 :            :                             PropertySet& rPropSet,
     331                 :            :                             const AxPairData& rSize,
     332                 :            :                             sal_Int32& nOrientation ) const;
     333                 :            : 
     334                 :            : private:
     335                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxDocModel;
     336                 :            :     const GraphicHelper& mrGraphicHelper;
     337                 :            :     mutable PropertySet maAddressConverter;
     338                 :            :     mutable PropertySet maRangeConverter;
     339                 :            :     bool                mbDefaultColorBgr;
     340                 :            : };
     341                 :            : 
     342                 :            : // ============================================================================
     343                 :            : 
     344                 :            : /** Base class for all models of form controls. */
     345                 :            : class OOX_DLLPUBLIC ControlModelBase
     346                 :            : {
     347                 :            : public:
     348                 :            :     explicit            ControlModelBase();
     349                 :            :     virtual             ~ControlModelBase();
     350                 :            : 
     351                 :            :     /** Sets this control model to AWT model mode. */
     352                 :          0 :     inline void         setAwtModelMode() { mbAwtModel = true; }
     353                 :            :     /** Sets this control model to form component mode. */
     354                 :         20 :     inline void         setFormComponentMode() { mbAwtModel = false; }
     355                 :            : 
     356                 :            :     /** Returns the UNO service name used to construct the AWT control model,
     357                 :            :         or the control form component. */
     358                 :            :     ::rtl::OUString     getServiceName() const;
     359                 :            : 
     360                 :            :     /** Derived classes set specific OOXML properties at the model structure. */
     361                 :            :     virtual void        importProperty( sal_Int32 nPropId, const ::rtl::OUString& rValue );
     362                 :            :     /** Derived classes set binary data (picture, mouse icon) at the model structure. */
     363                 :            :     virtual void        importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm );
     364                 :            :     /** Derived classes import a form control model from the passed input stream. */
     365                 :            :     virtual bool        importBinaryModel( BinaryInputStream& rInStrm ) = 0;
     366                 :            :     /** Derived classes export a form control model to the passed output stream. */
     367                 :          0 :     virtual void        exportBinaryModel( BinaryOutputStream& /*rOutStrm*/ ) {}
     368                 :            :     /** Derived classes export CompObjStream contents. */
     369                 :          0 :     virtual void        exportCompObj( BinaryOutputStream& /*rOutStrm*/ ) {}
     370                 :            :     /** Derived classes return the UNO control type enum value. */
     371                 :            :     virtual ApiControlType getControlType() const = 0;
     372                 :            :     /** Derived classes convert all control properties. */
     373                 :            :     virtual void        convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
     374                 :            :     /** Derived classes convert from uno control properties to equiv. MS values. */
     375                 :            :     virtual void        convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
     376                 :            : 
     377                 :            :     /** Converts the control size to UNO properties. */
     378                 :            :     void                convertSize( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
     379                 :            : 
     380                 :            : public: // direct access needed for legacy VML drawing controls
     381                 :            :     AxPairData          maSize;         ///< Size of the control in 1/100 mm.
     382                 :            : 
     383                 :            : protected:
     384                 :            :     bool                mbAwtModel;     ///< True = AWT control model, false = form component.
     385                 :            : };
     386                 :            : 
     387                 :            : typedef ::boost::shared_ptr< ControlModelBase > ControlModelRef;
     388                 :            : 
     389                 :            : // ============================================================================
     390                 :            : 
     391                 :            : /** Base class for all models of ComCtl form controls. */
     392 [ #  # ][ #  # ]:          0 : class ComCtlModelBase : public ControlModelBase
     393                 :            : {
     394                 :            : public:
     395                 :            :     explicit            ComCtlModelBase(
     396                 :            :                             sal_uInt32 nDataPartId5, sal_uInt32 nDataPartId6, sal_uInt16 nVersion,
     397                 :            :                             bool bCommonPart, bool bComplexPart );
     398                 :            : 
     399                 :            :     virtual bool        importBinaryModel( BinaryInputStream& rInStrm );
     400                 :            :     virtual void        convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
     401                 :            : 
     402                 :            : protected:
     403                 :            :     virtual void        importControlData( BinaryInputStream& rInStrm ) = 0;
     404                 :            :     virtual void        importCommonExtraData( BinaryInputStream& rInStrm );
     405                 :            :     virtual void        importCommonTrailingData( BinaryInputStream& rInStrm );
     406                 :            : 
     407                 :            : private:
     408                 :            :     /** Returns the data part identifier according to the model version. */
     409                 :            :     sal_uInt32          getDataPartId() const;
     410                 :            : 
     411                 :            :     bool                readPartHeader( BinaryInputStream& rInStrm,
     412                 :            :                             sal_uInt32 nExpPartId,
     413                 :            :                             sal_uInt16 nExpMajor = SAL_MAX_UINT16,
     414                 :            :                             sal_uInt16 nExpMinor = SAL_MAX_UINT16 );
     415                 :            : 
     416                 :            :     bool                importSizePart( BinaryInputStream& rInStrm );
     417                 :            :     bool                importCommonPart( BinaryInputStream& rInStrm, sal_uInt32 nPartSize );
     418                 :            :     bool                importComplexPart( BinaryInputStream& rInStrm );
     419                 :            : 
     420                 :            : protected:
     421                 :            :     StdFontInfo         maFontData;         ///< Font formatting.
     422                 :            :     StreamDataSequence  maMouseIcon;        ///< Binary picture stream for mouse icon.
     423                 :            :     sal_uInt32          mnFlags;            ///< Common flags for ComCtl controls.
     424                 :            :     const sal_uInt16    mnVersion;          ///< Current version of the ComCtl control model.
     425                 :            : 
     426                 :            : private:
     427                 :            :     sal_uInt32          mnDataPartId5;      ///< Identifier for version 5.0 control data.
     428                 :            :     sal_uInt32          mnDataPartId6;      ///< Identifier for version 6.0 control data.
     429                 :            :     bool                mbCommonPart;       ///< True = the COMCTL_COMMONDATA part exists.
     430                 :            :     bool                mbComplexPart;      ///< True = the COMCTL_COMPLEXDATA part exists.
     431                 :            : };
     432                 :            : 
     433                 :            : // ============================================================================
     434                 :            : 
     435                 :            : /** Model for a ComCtl scroll bar. */
     436         [ #  # ]:          0 : class ComCtlScrollBarModel : public ComCtlModelBase
     437                 :            : {
     438                 :            : public:
     439                 :            :     explicit            ComCtlScrollBarModel( sal_uInt16 nVersion );
     440                 :            : 
     441                 :            :     virtual ApiControlType getControlType() const;
     442                 :            :     virtual void        convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
     443                 :            : 
     444                 :            : protected:
     445                 :            :     virtual void        importControlData( BinaryInputStream& rInStrm );
     446                 :            : 
     447                 :            : private:
     448                 :            :     sal_uInt32          mnScrollBarFlags;   ///< Special flags for scroll bar model.
     449                 :            :     sal_Int32           mnLargeChange;      ///< Increment step size (thumb).
     450                 :            :     sal_Int32           mnSmallChange;      ///< Increment step size (buttons).
     451                 :            :     sal_Int32           mnMin;              ///< Minimum of the value range.
     452                 :            :     sal_Int32           mnMax;              ///< Maximum of the value range.
     453                 :            :     sal_Int32           mnPosition;         ///< Value of the spin button.
     454                 :            : };
     455                 :            : 
     456                 :            : // ============================================================================
     457                 :            : 
     458                 :            : /** Model for a ComCtl progress bar. */
     459         [ #  # ]:          0 : class ComCtlProgressBarModel : public ComCtlModelBase
     460                 :            : {
     461                 :            : public:
     462                 :            :     explicit            ComCtlProgressBarModel( sal_uInt16 nVersion );
     463                 :            : 
     464                 :            :     virtual ApiControlType getControlType() const;
     465                 :            :     virtual void        convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
     466                 :            : 
     467                 :            : protected:
     468                 :            :     virtual void        importControlData( BinaryInputStream& rInStrm );
     469                 :            : 
     470                 :            : private:
     471                 :            :     float               mfMin;              ///< Minimum of the value range.
     472                 :            :     float               mfMax;              ///< Maximum of the value range.
     473                 :            :     sal_uInt16          mnVertical;         ///< 0 = horizontal, 1 = vertical.
     474                 :            :     sal_uInt16          mnSmooth;           ///< 0 = progress blocks, 1 = pixel resolution.
     475                 :            : };
     476                 :            : 
     477                 :            : // ============================================================================
     478                 :            : 
     479                 :            : /** Base class for all models of Form 2.0 form controls. */
     480         [ -  + ]:         20 : class OOX_DLLPUBLIC AxControlModelBase : public ControlModelBase
     481                 :            : {
     482                 :            : public:
     483                 :            :     explicit            AxControlModelBase();
     484                 :            : 
     485                 :            :     virtual void        importProperty( sal_Int32 nPropId, const ::rtl::OUString& rValue );
     486                 :            : };
     487                 :            : 
     488                 :            : // ============================================================================
     489                 :            : 
     490                 :            : /** Base class for Forms 2.0 controls supporting text formatting. */
     491 [ +  - ][ -  + ]:         20 : class OOX_DLLPUBLIC AxFontDataModel : public AxControlModelBase
     492                 :            : {
     493                 :            : public:
     494                 :            :     explicit            AxFontDataModel( bool bSupportsAlign = true );
     495                 :            : 
     496                 :            :     virtual void        importProperty( sal_Int32 nPropId, const ::rtl::OUString& rValue );
     497                 :            :     virtual bool        importBinaryModel( BinaryInputStream& rInStrm );
     498                 :            :     virtual void        exportBinaryModel( BinaryOutputStream& rOutStrm );
     499                 :            :     virtual void        convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
     500                 :            :     virtual void        convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
     501                 :            : 
     502                 :            :     /** Returns the font height in points. */
     503                 :            :     inline sal_Int16    getFontHeight() const { return maFontData.getHeightPoints(); }
     504                 :            : 
     505                 :            : public: // direct access needed for legacy VML drawing controls
     506                 :            :     AxFontData          maFontData;         ///< The font settings.
     507                 :            : 
     508                 :            : private:
     509                 :            :     bool                mbSupportsAlign;    ///< True = UNO model supports Align property.
     510                 :            : };
     511                 :            : 
     512                 :            : // ============================================================================
     513                 :            : 
     514                 :            : /** Model for a Forms 2.0 command button. */
     515 [ +  - ][ -  + ]:         22 : class OOX_DLLPUBLIC AxCommandButtonModel : public AxFontDataModel
     516                 :            : {
     517                 :            : public:
     518                 :            :     explicit            AxCommandButtonModel();
     519                 :            : 
     520                 :            :     virtual void        importProperty( sal_Int32 nPropId, const ::rtl::OUString& rValue );
     521                 :            :     virtual void        importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm );
     522                 :            :     virtual bool        importBinaryModel( BinaryInputStream& rInStrm );
     523                 :            :     virtual void        exportBinaryModel( BinaryOutputStream& rOutStrm );
     524                 :            :     virtual void        exportCompObj( BinaryOutputStream& rOutStrm );
     525                 :            : 
     526                 :            :     virtual ApiControlType getControlType() const;
     527                 :            :     virtual void        convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
     528                 :            :     virtual void        convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
     529                 :            : 
     530                 :            : public: // direct access needed for legacy VML drawing controls
     531                 :            :     StreamDataSequence  maPictureData;      ///< Binary picture stream.
     532                 :            :     ::rtl::OUString     maCaption;          ///< Visible caption of the button.
     533                 :            :     sal_uInt32          mnTextColor;        ///< Text color.
     534                 :            :     sal_uInt32          mnBackColor;        ///< Fill color.
     535                 :            :     sal_uInt32          mnFlags;            ///< Various flags.
     536                 :            :     sal_uInt32          mnPicturePos;       ///< Position of the picture relative to text.
     537                 :            :     sal_Int32           mnVerticalAlign;    ///< Vertical alignment (legacy VML drawing controls only).
     538                 :            :     bool                mbFocusOnClick;     ///< True = take focus on click.
     539                 :            : };
     540                 :            : 
     541                 :            : // ============================================================================
     542                 :            : 
     543                 :            : /** Model for a Forms 2.0 label. */
     544         [ #  # ]:          0 : class OOX_DLLPUBLIC AxLabelModel : public AxFontDataModel
     545                 :            : {
     546                 :            : public:
     547                 :            :     explicit            AxLabelModel();
     548                 :            : 
     549                 :            :     virtual void        importProperty( sal_Int32 nPropId, const ::rtl::OUString& rValue );
     550                 :            :     virtual bool        importBinaryModel( BinaryInputStream& rInStrm );
     551                 :            :     virtual void        exportBinaryModel( BinaryOutputStream& rOutStrm );
     552                 :            :     virtual void        exportCompObj( BinaryOutputStream& rOutStrm );
     553                 :            : 
     554                 :            :     virtual ApiControlType getControlType() const;
     555                 :            :     virtual void        convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
     556                 :            :     virtual void        convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
     557                 :            : 
     558                 :            : public: // direct access needed for legacy VML drawing controls
     559                 :            :     ::rtl::OUString     maCaption;          ///< Visible caption of the button.
     560                 :            :     sal_uInt32          mnTextColor;        ///< Text color.
     561                 :            :     sal_uInt32          mnBackColor;        ///< Fill color.
     562                 :            :     sal_uInt32          mnFlags;            ///< Various flags.
     563                 :            :     sal_uInt32          mnBorderColor;      ///< Flat border color.
     564                 :            :     sal_Int32           mnBorderStyle;      ///< Flat border style.
     565                 :            :     sal_Int32           mnSpecialEffect;    ///< 3D border effect.
     566                 :            :     sal_Int32           mnVerticalAlign;    ///< Vertical alignment (legacy VML drawing controls only).
     567                 :            : };
     568                 :            : 
     569                 :            : // ============================================================================
     570                 :            : 
     571                 :            : /** Model for a Forms 2.0 image. */
     572 [ #  # ][ #  # ]:          0 : class OOX_DLLPUBLIC AxImageModel : public AxControlModelBase
     573                 :            : {
     574                 :            : public:
     575                 :            :     explicit            AxImageModel();
     576                 :            : 
     577                 :            :     virtual void        importProperty( sal_Int32 nPropId, const ::rtl::OUString& rValue );
     578                 :            :     virtual void        importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm );
     579                 :            :     virtual bool        importBinaryModel( BinaryInputStream& rInStrm );
     580                 :            :     virtual void        exportBinaryModel( BinaryOutputStream& rOutStrm );
     581                 :            :     virtual void        exportCompObj( BinaryOutputStream& rOutStrm );
     582                 :            : 
     583                 :            :     virtual ApiControlType getControlType() const;
     584                 :            :     virtual void        convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
     585                 :            : 
     586                 :            : private:
     587                 :            :     StreamDataSequence  maPictureData;      ///< Binary picture stream.
     588                 :            :     sal_uInt32          mnBackColor;        ///< Fill color.
     589                 :            :     sal_uInt32          mnFlags;            ///< Various flags.
     590                 :            :     sal_uInt32          mnBorderColor;      ///< Flat border color.
     591                 :            :     sal_Int32           mnBorderStyle;      ///< Flat border style.
     592                 :            :     sal_Int32           mnSpecialEffect;    ///< 3D border effect.
     593                 :            :     sal_Int32           mnPicSizeMode;      ///< Clip, stretch, zoom.
     594                 :            :     sal_Int32           mnPicAlign;         ///< Anchor position of the picture.
     595                 :            :     bool                mbPicTiling;        ///< True = picture is repeated.
     596                 :            : };
     597                 :            : 
     598                 :            : // ============================================================================
     599                 :            : 
     600                 :            : /** Base class for a Forms 2.0 morph data control. */
     601 [ +  - ][ -  + ]:          9 : class OOX_DLLPUBLIC AxMorphDataModelBase : public AxFontDataModel
     602                 :            : {
     603                 :            : public:
     604                 :            :     explicit            AxMorphDataModelBase();
     605                 :            : 
     606                 :            :     virtual void        importProperty( sal_Int32 nPropId, const ::rtl::OUString& rValue );
     607                 :            :     virtual void        importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm );
     608                 :            :     virtual bool        importBinaryModel( BinaryInputStream& rInStrm );
     609                 :            :     virtual void        exportBinaryModel( BinaryOutputStream& rOutStrm );
     610                 :            :     virtual void        convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
     611                 :            : 
     612                 :            : public: // direct access needed for legacy VML drawing controls
     613                 :            :     StreamDataSequence  maPictureData;      ///< Binary picture stream.
     614                 :            :     ::rtl::OUString     maCaption;          ///< Visible caption of the button.
     615                 :            :     ::rtl::OUString     maValue;            ///< Current value of the control.
     616                 :            :     ::rtl::OUString     maGroupName;        ///< Group name for option buttons.
     617                 :            :     sal_uInt32          mnTextColor;        ///< Text color.
     618                 :            :     sal_uInt32          mnBackColor;        ///< Fill color.
     619                 :            :     sal_uInt32          mnFlags;            ///< Various flags.
     620                 :            :     sal_uInt32          mnPicturePos;       ///< Position of the picture relative to text.
     621                 :            :     sal_uInt32          mnBorderColor;      ///< Flat border color.
     622                 :            :     sal_Int32           mnBorderStyle;      ///< Flat border style.
     623                 :            :     sal_Int32           mnSpecialEffect;    ///< 3D border effect.
     624                 :            :     sal_Int32           mnDisplayStyle;     ///< Type of the morph control.
     625                 :            :     sal_Int32           mnMultiSelect;      ///< Selection mode.
     626                 :            :     sal_Int32           mnScrollBars;       ///< Horizontal/vertical scroll bar.
     627                 :            :     sal_Int32           mnMatchEntry;       ///< Auto completion mode.
     628                 :            :     sal_Int32           mnShowDropButton;   ///< When to show the dropdown button.
     629                 :            :     sal_Int32           mnMaxLength;        ///< Maximum character count.
     630                 :            :     sal_Int32           mnPasswordChar;     ///< Password character in edit fields.
     631                 :            :     sal_Int32           mnListRows;         ///< Number of rows in dropdown box.
     632                 :            :     sal_Int32           mnVerticalAlign;    ///< Vertical alignment (legacy VML drawing controls only).
     633                 :            : };
     634                 :            : 
     635                 :            : // ============================================================================
     636                 :            : 
     637                 :            : /** Model for a Forms 2.0 toggle button. */
     638         [ #  # ]:          0 : class OOX_DLLPUBLIC AxToggleButtonModel : public AxMorphDataModelBase
     639                 :            : {
     640                 :            : public:
     641                 :            :     explicit            AxToggleButtonModel();
     642                 :            : 
     643                 :            :     virtual ApiControlType getControlType() const;
     644                 :            :     virtual void        convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
     645                 :            :     virtual void        convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
     646                 :            :     virtual void        exportCompObj( BinaryOutputStream& rOutStrm );
     647                 :            : };
     648                 :            : 
     649                 :            : // ============================================================================
     650                 :            : 
     651                 :            : /** Model for a Forms 2.0 check box. */
     652         [ -  + ]:          6 : class OOX_DLLPUBLIC AxCheckBoxModel : public AxMorphDataModelBase
     653                 :            : {
     654                 :            : public:
     655                 :            :     explicit            AxCheckBoxModel();
     656                 :            : 
     657                 :            :     virtual ApiControlType getControlType() const;
     658                 :            :     virtual void        convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
     659                 :            :     virtual void        convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
     660                 :            :     virtual void        exportCompObj( BinaryOutputStream& rOutStrm );
     661                 :            : };
     662                 :            : 
     663                 :            : // ============================================================================
     664                 :            : 
     665                 :            : /** Model for a Forms 2.0 option button. */
     666         [ #  # ]:          0 : class OOX_DLLPUBLIC AxOptionButtonModel : public AxMorphDataModelBase
     667                 :            : {
     668                 :            : public:
     669                 :            :     explicit            AxOptionButtonModel();
     670                 :            : 
     671                 :            :     /** Returns the group name used to goup several option buttons gogether. */
     672                 :          0 :     inline const ::rtl::OUString& getGroupName() const { return maGroupName; }
     673                 :            : 
     674                 :            :     virtual ApiControlType getControlType() const;
     675                 :            :     virtual void        convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
     676                 :            :     virtual void        convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
     677                 :            :     virtual void        exportCompObj( BinaryOutputStream& rOutStrm );
     678                 :            : };
     679                 :            : 
     680                 :            : // ============================================================================
     681                 :            : 
     682                 :            : /** Model for a Forms 2.0 text box. */
     683         [ -  + ]:         12 : class OOX_DLLPUBLIC AxTextBoxModel : public AxMorphDataModelBase
     684                 :            : {
     685                 :            : public:
     686                 :            :     explicit            AxTextBoxModel();
     687                 :            : 
     688                 :            :     virtual ApiControlType getControlType() const;
     689                 :            :     virtual void        convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
     690                 :            :     virtual void        convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
     691                 :            :     virtual void        exportCompObj( BinaryOutputStream& rOutStrm );
     692                 :            : };
     693                 :            : 
     694                 :            : // ============================================================================
     695                 :            : 
     696                 :            : /** Model for a numeric field (legacy drawing controls only). */
     697         [ #  # ]:          0 : class OOX_DLLPUBLIC AxNumericFieldModel : public AxMorphDataModelBase
     698                 :            : {
     699                 :            : public:
     700                 :            :     explicit            AxNumericFieldModel();
     701                 :            : 
     702                 :            :     virtual ApiControlType getControlType() const;
     703                 :            :     virtual void        convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
     704                 :            :     virtual void        convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
     705                 :            :     virtual void        exportCompObj( BinaryOutputStream& rOutStrm );
     706                 :            : };
     707                 :            : 
     708                 :            : // ============================================================================
     709                 :            : 
     710                 :            : /** Model for a Forms 2.0 list box. */
     711         [ #  # ]:          0 : class OOX_DLLPUBLIC AxListBoxModel : public AxMorphDataModelBase
     712                 :            : {
     713                 :            : public:
     714                 :            :     explicit            AxListBoxModel();
     715                 :            : 
     716                 :            :     virtual ApiControlType getControlType() const;
     717                 :            :     virtual void        convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
     718                 :            :     virtual void        convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
     719                 :            :     virtual void        exportCompObj( BinaryOutputStream& rOutStrm );
     720                 :            : };
     721                 :            : 
     722                 :            : // ============================================================================
     723                 :            : 
     724                 :            : /** Model for a Forms 2.0 combo box. */
     725         [ #  # ]:          0 : class OOX_DLLPUBLIC AxComboBoxModel : public AxMorphDataModelBase
     726                 :            : {
     727                 :            : public:
     728                 :            :     explicit            AxComboBoxModel();
     729                 :            : 
     730                 :            :     virtual ApiControlType getControlType() const;
     731                 :            :     virtual void        convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
     732                 :            :     virtual void        convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
     733                 :            :     virtual void        exportCompObj( BinaryOutputStream& rOutStrm );
     734                 :            : };
     735                 :            : 
     736                 :            : // ============================================================================
     737                 :            : 
     738                 :            : /** Model for a Forms 2.0 spin button. */
     739         [ #  # ]:          0 : class OOX_DLLPUBLIC AxSpinButtonModel : public AxControlModelBase
     740                 :            : {
     741                 :            : public:
     742                 :            :     explicit            AxSpinButtonModel();
     743                 :            : 
     744                 :            :     virtual void        importProperty( sal_Int32 nPropId, const ::rtl::OUString& rValue );
     745                 :            :     virtual bool        importBinaryModel( BinaryInputStream& rInStrm );
     746                 :            :     virtual void        exportBinaryModel( BinaryOutputStream& rOutStrm );
     747                 :            : 
     748                 :            :     virtual ApiControlType getControlType() const;
     749                 :            :     virtual void        convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
     750                 :            :     virtual void        convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
     751                 :            :     virtual void        exportCompObj( BinaryOutputStream& rOutStrm );
     752                 :            : 
     753                 :            : public: // direct access needed for legacy VML drawing controls
     754                 :            :     sal_uInt32          mnArrowColor;       ///< Button arrow color.
     755                 :            :     sal_uInt32          mnBackColor;        ///< Fill color.
     756                 :            :     sal_uInt32          mnFlags;            ///< Various flags.
     757                 :            :     sal_Int32           mnOrientation;      ///< Orientation of the buttons.
     758                 :            :     sal_Int32           mnMin;              ///< Minimum of the value range.
     759                 :            :     sal_Int32           mnMax;              ///< Maximum of the value range.
     760                 :            :     sal_Int32           mnPosition;         ///< Value of the spin button.
     761                 :            :     sal_Int32           mnSmallChange;      ///< Increment step size.
     762                 :            :     sal_Int32           mnDelay;            ///< Repeat delay in milliseconds.
     763                 :            : };
     764                 :            : 
     765                 :            : // ============================================================================
     766                 :            : 
     767                 :            : /** Model for a Forms 2.0 scroll bar. */
     768         [ #  # ]:          0 : class OOX_DLLPUBLIC AxScrollBarModel : public AxControlModelBase
     769                 :            : {
     770                 :            : public:
     771                 :            :     explicit            AxScrollBarModel();
     772                 :            : 
     773                 :            :     virtual void        importProperty( sal_Int32 nPropId, const ::rtl::OUString& rValue );
     774                 :            :     virtual bool        importBinaryModel( BinaryInputStream& rInStrm );
     775                 :            :     virtual void        exportBinaryModel( BinaryOutputStream& rOutStrm );
     776                 :            :     virtual void        exportCompObj( BinaryOutputStream& rOutStrm );
     777                 :            : 
     778                 :            :     virtual ApiControlType getControlType() const;
     779                 :            :     virtual void        convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
     780                 :            :     virtual void        convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
     781                 :            : 
     782                 :            : public: // direct access needed for legacy VML drawing controls
     783                 :            :     sal_uInt32          mnArrowColor;       ///< Button arrow color.
     784                 :            :     sal_uInt32          mnBackColor;        ///< Fill color.
     785                 :            :     sal_uInt32          mnFlags;            ///< Various flags.
     786                 :            :     sal_Int32           mnOrientation;      ///< Orientation of the buttons.
     787                 :            :     sal_Int32           mnPropThumb;        ///< Proportional thumb size.
     788                 :            :     sal_Int32           mnMin;              ///< Minimum of the value range.
     789                 :            :     sal_Int32           mnMax;              ///< Maximum of the value range.
     790                 :            :     sal_Int32           mnPosition;         ///< Value of the spin button.
     791                 :            :     sal_Int32           mnSmallChange;      ///< Increment step size (buttons).
     792                 :            :     sal_Int32           mnLargeChange;      ///< Increment step size (thumb).
     793                 :            :     sal_Int32           mnDelay;            ///< Repeat delay in milliseconds.
     794                 :            : };
     795                 :            : 
     796                 :            : // ============================================================================
     797                 :            : 
     798                 :            : /** Model for a Forms 2.0 tabstrip control. */
     799         [ #  # ]:          0 : class OOX_DLLPUBLIC AxTabStripModel : public AxFontDataModel
     800                 :            : {
     801                 :            : public:
     802                 :            :     explicit            AxTabStripModel();
     803                 :            : 
     804                 :            :     virtual bool        importBinaryModel( BinaryInputStream& rInStrm );
     805                 :            : 
     806                 :            :     virtual ApiControlType getControlType() const;
     807                 :            :     virtual void        convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
     808                 :            : 
     809                 :            :     /** Returns the caption with the specified zero-based index. */
     810                 :            :     ::rtl::OUString     getCaption( sal_Int32 nIndex ) const;
     811                 :            : 
     812                 :            : private:
     813                 :            :     AxStringArray       maCaptions;         ///< Captions of all tabs.
     814                 :            :     sal_uInt32          mnBackColor;        ///< Fill color.
     815                 :            :     sal_uInt32          mnTextColor;        ///< Text color.
     816                 :            :     sal_uInt32          mnFlags;            ///< Various flags.
     817                 :            :     sal_Int32           mnSelectedTab;      ///< The index of the selected tab.
     818                 :            :     sal_uInt32          mnTabStyle;         ///< Visual style of the tabs.
     819                 :            :     sal_Int32           mnTabFlagCount;     ///< Number of entries in tab flag array.
     820                 :            : };
     821                 :            : 
     822                 :            : typedef ::boost::shared_ptr< AxTabStripModel > AxTabStripModelRef;
     823                 :            : 
     824                 :            : // ============================================================================
     825                 :            : 
     826                 :            : typedef ::std::vector< ::rtl::OUString > AxClassTable;
     827                 :            : 
     828                 :            : /** Base class for ActiveX container controls. */
     829 [ #  # ][ #  # ]:          0 : class OOX_DLLPUBLIC AxContainerModelBase : public AxFontDataModel
     830                 :            : {
     831                 :            : public:
     832                 :            :     explicit            AxContainerModelBase( bool bFontSupport = false );
     833                 :            : 
     834                 :            :     /** Allows to set single properties specified by XML token identifier. */
     835                 :            :     virtual void        importProperty( sal_Int32 nPropId, const ::rtl::OUString& rValue );
     836                 :            :     /** Reads the leading structure in the 'f' stream containing the model for
     837                 :            :         this control. */
     838                 :            :     virtual bool        importBinaryModel( BinaryInputStream& rInStrm );
     839                 :            :     /** Converts font settings if supported. */
     840                 :            :     virtual void        convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
     841                 :            : 
     842                 :            :     /** Reads the class table structure for embedded controls following the own
     843                 :            :         model from the 'f' stream. */
     844                 :            :     bool                importClassTable( BinaryInputStream& rInStrm, AxClassTable& orClassTable );
     845                 :            : 
     846                 :            : public: // direct access needed for legacy VML drawing controls
     847                 :            :     StreamDataSequence  maPictureData;      ///< Binary picture stream.
     848                 :            :     ::rtl::OUString     maCaption;          ///< Visible caption of the form.
     849                 :            :     AxPairData          maLogicalSize;      ///< Logical form size (scroll area).
     850                 :            :     AxPairData          maScrollPos;        ///< Scroll position.
     851                 :            :     sal_uInt32          mnBackColor;        ///< Fill color.
     852                 :            :     sal_uInt32          mnTextColor;        ///< Text color.
     853                 :            :     sal_uInt32          mnFlags;            ///< Various flags.
     854                 :            :     sal_uInt32          mnBorderColor;      ///< Flat border color.
     855                 :            :     sal_Int32           mnBorderStyle;      ///< Flat border style.
     856                 :            :     sal_Int32           mnScrollBars;       ///< Horizontal/vertical scroll bar.
     857                 :            :     sal_Int32           mnCycleType;        ///< Cycle in all forms or in this form.
     858                 :            :     sal_Int32           mnSpecialEffect;    ///< 3D border effect.
     859                 :            :     sal_Int32           mnPicAlign;         ///< Anchor position of the picture.
     860                 :            :     sal_Int32           mnPicSizeMode;      ///< Clip, stretch, zoom.
     861                 :            :     bool                mbPicTiling;        ///< True = picture is repeated.
     862                 :            :     bool                mbFontSupport;      ///< True = control supports the font property.
     863                 :            : };
     864                 :            : 
     865                 :            : typedef ::boost::shared_ptr< AxContainerModelBase > AxContainerModelRef;
     866                 :            : 
     867                 :            : // ============================================================================
     868                 :            : 
     869                 :            : /** Model for a Forms 2.0 frame control. */
     870         [ #  # ]:          0 : class OOX_DLLPUBLIC AxFrameModel : public AxContainerModelBase
     871                 :            : {
     872                 :            : public:
     873                 :            :     explicit            AxFrameModel();
     874                 :            : 
     875                 :            :     virtual ApiControlType getControlType() const;
     876                 :            :     virtual void        convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
     877                 :            : };
     878                 :            : 
     879                 :            : // ============================================================================
     880                 :            : 
     881                 :            : /** Model for a Forms 2.0 formpage control (a single page in a multipage control). */
     882         [ #  # ]:          0 : class OOX_DLLPUBLIC AxFormPageModel : public AxContainerModelBase
     883                 :            : {
     884                 :            : public:
     885                 :            :     explicit            AxFormPageModel();
     886                 :            : 
     887                 :            :     virtual ApiControlType getControlType() const;
     888                 :            :     virtual void        convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
     889                 :            : };
     890                 :            : 
     891                 :            : // ============================================================================
     892                 :            : 
     893                 :            : /** Model for a Forms 2.0 multipage control. Contains the tabstrip control
     894                 :            :     (class AxTabStripModel) and the single pages (class AxFormPageModel). */
     895 [ #  # ][ #  # ]:          0 : class OOX_DLLPUBLIC AxMultiPageModel : public AxContainerModelBase
     896                 :            : {
     897                 :            : public:
     898                 :            :     explicit            AxMultiPageModel();
     899                 :            : 
     900                 :            :     virtual ApiControlType getControlType() const;
     901                 :            :     virtual void        convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
     902                 :            : 
     903                 :            :     /** Sets the tabstrip control model related to this multipage control.
     904                 :            :         Contains all formatting attributes of the page tabs. */
     905                 :            :     void                setTabStripModel( const AxTabStripModelRef& rxTabStrip );
     906                 :            : 
     907                 :            : private:
     908                 :            :     AxTabStripModelRef  mxTabStrip;
     909                 :            : };
     910                 :            : 
     911                 :            : // ============================================================================
     912                 :            : 
     913                 :            : /** Model for a Forms 2.0 user form. */
     914         [ #  # ]:          0 : class OOX_DLLPUBLIC AxUserFormModel : public AxContainerModelBase
     915                 :            : {
     916                 :            : public:
     917                 :            :     explicit            AxUserFormModel();
     918                 :            : 
     919                 :            :     virtual ApiControlType getControlType() const;
     920                 :            :     virtual void        convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
     921                 :            : };
     922                 :            : 
     923 [ #  # ][ #  # ]:          0 : class HtmlSelectModel : public AxListBoxModel
                 [ #  # ]
     924                 :            : {
     925                 :            :     com::sun::star::uno::Sequence< rtl::OUString > msListData;
     926                 :            :     com::sun::star::uno::Sequence< sal_Int16 > msIndices;
     927                 :            : public:
     928                 :            :     HtmlSelectModel();
     929                 :            :     virtual bool        importBinaryModel( BinaryInputStream& rInStrm );
     930                 :            :     virtual void        convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
     931                 :            : };
     932                 :            : 
     933         [ #  # ]:          0 : class HtmlTextBoxModel : public AxTextBoxModel
     934                 :            : {
     935                 :            : public:
     936                 :            :     explicit            HtmlTextBoxModel();
     937                 :            :     virtual bool        importBinaryModel( BinaryInputStream& rInStrm );
     938                 :            : };
     939                 :            : // ============================================================================
     940                 :            : 
     941                 :            : /** A form control embedded in a document draw page. Contains a specific model
     942                 :            :     structure according to the type of the control. */
     943                 :          3 : class OOX_DLLPUBLIC EmbeddedControl
     944                 :            : {
     945                 :            : public:
     946                 :            :     explicit            EmbeddedControl( const ::rtl::OUString& rName );
     947                 :            :     virtual             ~EmbeddedControl();
     948                 :            : 
     949                 :            :     /** Creates and returns the internal control model of the specified type. */
     950                 :            :     template< typename ModelType >
     951                 :            :     inline ModelType&   createModel();
     952                 :            : 
     953                 :            :     /** Creates and returns the internal control model of the specified type. */
     954                 :            :     template< typename ModelType, typename ParamType >
     955                 :            :     inline ModelType&   createModel( const ParamType& rParam );
     956                 :            : 
     957                 :            :     /** Creates and returns the internal control model according to the passed
     958                 :            :         MS class identifier. */
     959                 :            :     ControlModelBase*   createModelFromGuid( const ::rtl::OUString& rClassId );
     960                 :            : 
     961                 :            :     /** Returns true, if the internal control model exists. */
     962                 :          3 :     inline bool         hasModel() const { return mxModel.get() != 0; }
     963                 :            :     /** Returns read-only access to the internal control model. */
     964                 :            :     inline const ControlModelBase* getModel() const { return mxModel.get(); }
     965                 :            :     /** Returns read/write access to the internal control model. */
     966                 :          3 :     inline ControlModelBase* getModel() { return mxModel.get(); }
     967                 :            : 
     968                 :            :     /** Returns the UNO service name needed to construct the control model. */
     969                 :            :     ::rtl::OUString     getServiceName() const;
     970                 :            : 
     971                 :            :     /** Converts all control properties and inserts them into the passed model. */
     972                 :            :     bool                convertProperties(
     973                 :            :                             const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxCtrlModel,
     974                 :            :                             const ControlConverter& rConv ) const;
     975                 :            : 
     976                 :            :     bool                convertFromProperties(
     977                 :            :                             const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxCtrlModel,
     978                 :            :                             const ControlConverter& rConv );
     979                 :            : 
     980                 :            : private:
     981                 :            :     ControlModelRef     mxModel;            ///< Control model containing the properties.
     982                 :            :     ::rtl::OUString     maName;             ///< Name of the control.
     983                 :            : };
     984                 :            : 
     985                 :            : // ----------------------------------------------------------------------------
     986                 :            : 
     987                 :            : template< typename ModelType >
     988                 :         20 : inline ModelType& EmbeddedControl::createModel()
     989                 :            : {
     990 [ #  # ][ #  # ]:         20 :     ::boost::shared_ptr< ModelType > xModel( new ModelType );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ +  - ]
         [ +  - ][ +  - ]
         [ #  # ][ #  # ]
         [ #  # ][ +  - ]
         [ +  - ][ +  - ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ +  - ]
         [ +  - ][ +  - ]
     991 [ #  # ][ #  # ]:         20 :     mxModel = xModel;
         [ #  # ][ #  # ]
         [ #  # ][ +  - ]
         [ #  # ][ +  - ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ +  - ]
     992                 :         20 :     xModel->setFormComponentMode();
     993 [ #  # ][ #  # ]:         20 :     return *xModel;
         [ #  # ][ #  # ]
         [ +  - ][ #  # ]
         [ +  - ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ +  - ][ #  # ]
     994                 :            : }
     995                 :            : 
     996                 :            : template< typename ModelType, typename ParamType >
     997                 :          0 : inline ModelType& EmbeddedControl::createModel( const ParamType& rParam )
     998                 :            : {
     999 [ #  # ][ #  # ]:          0 :     ::boost::shared_ptr< ModelType > xModel( new ModelType( rParam ) );
                 [ #  # ]
    1000         [ #  # ]:          0 :     mxModel = xModel;
    1001                 :          0 :     xModel->setFormComponentMode();
    1002         [ #  # ]:          0 :     return *xModel;
    1003                 :            : }
    1004                 :            : 
    1005                 :            : // ============================================================================
    1006                 :            : 
    1007                 :            : /** A wrapper for a control form embedded directly in a draw page. */
    1008                 :          3 : class EmbeddedForm
    1009                 :            : {
    1010                 :            : public:
    1011                 :            :     explicit            EmbeddedForm(
    1012                 :            :                             const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxDocModel,
    1013                 :            :                             const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& rxDrawPage,
    1014                 :            :                             const GraphicHelper& rGraphicHelper,
    1015                 :            :                             bool bDefaultColorBgr = true );
    1016                 :            : 
    1017                 :            :     /** Converts the passed control and inserts the control model into the form.
    1018                 :            :         @return  The API control model, if conversion was successful. */
    1019                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >
    1020                 :            :                         convertAndInsert( const EmbeddedControl& rControl, sal_Int32& rnCtrlIndex );
    1021                 :            : 
    1022                 :            :     /** Returns the XIndexContainer interface of the UNO control form, if existing. */
    1023                 :            :     inline ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >
    1024                 :          0 :                         getXForm() const { return mxFormIC; }
    1025                 :            : 
    1026                 :            : private:
    1027                 :            :     /** Creates the form that will hold the form controls. */
    1028                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >
    1029                 :            :                         createXForm();
    1030                 :            : 
    1031                 :            : private:
    1032                 :            :     ControlConverter    maControlConv;
    1033                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxModelFactory;
    1034                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormsSupplier > mxFormsSupp;
    1035                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > mxFormIC;
    1036                 :            : };
    1037                 :            : 
    1038                 :            : // ============================================================================
    1039                 :            : 
    1040                 :            : } // namespace ole
    1041                 :            : } // namespace oox
    1042                 :            : 
    1043                 :            : #endif
    1044                 :            : 
    1045                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10