namespace com::sun::star { namespace awt { class XControlModel; } namespace container { class XIndexContainer; } namespace drawing { class XDrawPage; } namespace frame { class XModel; } namespace form { class XFormsSupplier; } namespace lang { class XMultiServiceFactory; }
}
namespace oox { class BinaryInputStream; class BinaryOutputStream; class GraphicHelper; class PropertyMap;
}
/** Enumerates all UNO API control types supported by these filters. */ enum ApiControlType
{
API_CONTROL_BUTTON,
API_CONTROL_FIXEDTEXT,
API_CONTROL_IMAGE,
API_CONTROL_CHECKBOX,
API_CONTROL_RADIOBUTTON,
API_CONTROL_EDIT,
API_CONTROL_NUMERIC,
API_CONTROL_LISTBOX,
API_CONTROL_COMBOBOX,
API_CONTROL_SPINBUTTON,
API_CONTROL_SCROLLBAR,
API_CONTROL_TABSTRIP, //11
API_CONTROL_PROGRESSBAR,
API_CONTROL_GROUPBOX,
API_CONTROL_FRAME, // 14
API_CONTROL_PAGE, // 15
API_CONTROL_MULTIPAGE, // 16
API_CONTROL_DIALOG // 17
};
/** Specifies how a form control supports transparent background. */ enumclass ApiTransparencyMode
{
NotSupported, ///< Control does not support transparency. Void, ///< Transparency is enabled by missing fill color.
};
/** Specifies how a form control supports the DefaultState property. */ enum ApiDefaultStateMode
{
API_DEFAULTSTATE_BOOLEAN, ///< Control does not support tri-state, state is given as boolean.
API_DEFAULTSTATE_SHORT, ///< Control does not support tri-state, state is given as short.
API_DEFAULTSTATE_TRISTATE ///< Control supports tri-state, state is given as short.
};
/** A base class with useful helper functions for something that is able to convertActiveXandComCtlformcontrols.
*/ class OOX_DLLPUBLIC ControlConverter final
{ public: explicit ControlConverter( const css::uno::Reference< css::frame::XModel >& rxDocModel, const GraphicHelper& rGraphicHelper, bool bDefaultColorBgr = true );
~ControlConverter();
/** Converts the passed position in 1/100 mm to UNO properties. */ void convertPosition(
PropertyMap& rPropMap, const AxPairData& rPos ) const;
/** Converts the passed size in 1/100 mm to UNO properties. */ void convertSize(
PropertyMap& rPropMap, const AxPairData& rSize ) const;
/** Converts the passed encoded OLE color to UNO properties. */ void convertColor(
PropertyMap& rPropMap,
sal_Int32 nPropId,
sal_uInt32 nOleColor ) const;
/** Binds the passed control model to the passed data sources. The
implementation will check which source types are supported. */ void bindToSources( const css::uno::Reference< css::awt::XControlModel >& rxCtrlModel, const OUString& rCtrlSource, const OUString& rRowSource,
sal_Int32 nRefSheet = 0 ) const;
// ActiveX (Forms 2.0) specific conversion --------------------------------
/** Converts the Forms 2.0 background formatting to UNO properties. */ void convertAxBackground(
PropertyMap& rPropMap,
sal_uInt32 nBackColor,
sal_uInt32 nFlags,
ApiTransparencyMode eTranspMode ) const;
/** Converts the Forms 2.0 border formatting to UNO properties. */ void convertAxBorder(
PropertyMap& rPropMap,
sal_uInt32 nBorderColor,
sal_Int32 nBorderStyle,
sal_Int32 nSpecialEffect ) const;
/** Converts the passed picture stream and Forms 2.0 position to UNO
properties. */ void convertAxPicture(
PropertyMap& rPropMap, const StreamDataSequence& rPicData,
sal_uInt32 nPicPos ) const;
/** Converts the passed picture stream and Forms 2.0 position to UNO
properties. */ void convertAxPicture(
PropertyMap& rPropMap, const StreamDataSequence& rPicData,
sal_Int32 nPicSizeMode ) const;
/** Converts the Forms 2.0 value for checked/unchecked/dontknow to UNO
properties. */ staticvoid convertAxState(
PropertyMap& rPropMap,
std::u16string_view rValue,
sal_Int32 nMultiSelect,
ApiDefaultStateMode eDefStateMode, bool bAwtModel );
/** Converts the Forms 2.0 control orientation to UNO properties. */ staticvoid convertAxOrientation(
PropertyMap& rPropMap, const AxPairData& rSize,
sal_Int32 nOrientation );
/** Base class for all models of form controls. */ class OOX_DLLPUBLIC ControlModelBase
{ public: explicit ControlModelBase(); virtual ~ControlModelBase();
/** Sets this control model to AWT model mode. */ void setAwtModelMode() { mbAwtModel = true; } /** Sets this control model to form component mode. */ void setFormComponentMode() { mbAwtModel = false; }
/** Returns the UNO service name used to construct the AWT control model,
or the control form component. */
OUString getServiceName() const;
/** Derived classes set specific OOXML properties at the model structure. */ virtualvoid importProperty( sal_Int32 nPropId, const OUString& rValue ); /** Derived classes set binary data (picture, mouse icon) at the model structure. */ virtualvoid importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm ); /** Derived classes import a form control model from the passed input stream. */ virtualbool importBinaryModel( BinaryInputStream& rInStrm ) = 0; /** Derived classes export a form control model to the passed output stream. */ virtualvoid exportBinaryModel( BinaryOutputStream& /*rOutStrm*/ ) {} /** Derived classes export CompObjStream contents. */ virtualvoid exportCompObj( BinaryOutputStream& /*rOutStrm*/ ) {} /** Derived classes return the UNO control type enum value. */ virtual ApiControlType getControlType() const = 0; /** Derived classes convert all control properties. */ virtualvoid convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const; /** Derived classes convert from uno control properties to equiv. MS values. */ virtualvoid convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
/** Converts the control size to UNO properties. */ void convertSize( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
public: // direct access needed for legacy VML drawing controls
AxPairData maSize; ///< Size of the control in 1/100 mm.
protected: bool mbAwtModel; ///< True = AWT control model, false = form component.
};
/** Base class for all models of ComCtl form controls. */ class ComCtlModelBase : public ControlModelBase
{ public: explicit ComCtlModelBase(
sal_uInt32 nDataPartId5, sal_uInt32 nDataPartId6, sal_uInt16 nVersion );
protected:
StdFontInfo maFontData; ///< Font formatting.
StreamDataSequence maMouseIcon; ///< Binary picture stream for mouse icon.
sal_uInt32 mnFlags; ///< Common flags for ComCtl controls. const sal_uInt16 mnVersion; ///< Current version of the ComCtl control model.
private:
sal_uInt32 mnDataPartId5; ///< Identifier for version 5.0 control data.
sal_uInt32 mnDataPartId6; ///< Identifier for version 6.0 control data. bool mbCommonPart; ///< True = the COMCTL_COMMONDATA part exists. bool mbComplexPart; ///< True = the COMCTL_COMPLEXDATA part exists.
};
/** Model for a ComCtl scroll bar. */ class ComCtlScrollBarModel final : public ComCtlModelBase
{ public: explicit ComCtlScrollBarModel( sal_uInt16 nVersion );
sal_uInt32 mnScrollBarFlags; ///< Special flags for scroll bar model.
sal_Int32 mnLargeChange; ///< Increment step size (thumb).
sal_Int32 mnSmallChange; ///< Increment step size (buttons).
sal_Int32 mnMin; ///< Minimum of the value range.
sal_Int32 mnMax; ///< Maximum of the value range.
sal_Int32 mnPosition; ///< Value of the spin button.
};
/** Model for a ComCtl progress bar. */ class ComCtlProgressBarModel final : public ComCtlModelBase
{ public: explicit ComCtlProgressBarModel( sal_uInt16 nVersion );
float mfMin; ///< Minimum of the value range. float mfMax; ///< Maximum of the value range.
sal_uInt16 mnVertical; ///< 0 = horizontal, 1 = vertical.
sal_uInt16 mnSmooth; ///< 0 = progress blocks, 1 = pixel resolution.
};
/** Base class for all models of Form 2.0 form controls. */ class OOX_DLLPUBLIC AxControlModelBase : public ControlModelBase
{ public: explicit AxControlModelBase();
/** Base class for Forms 2.0 controls supporting text formatting. */ class OOX_DLLPUBLIC AxFontDataModel : public AxControlModelBase
{ public: explicit AxFontDataModel( bool bSupportsAlign = true );
/** Returns the font height in points. */
sal_Int16 getFontHeight() const { return maFontData.getHeightPoints(); }
public: // direct access needed for legacy VML drawing controls
AxFontData maFontData; ///< The font settings.
private: bool mbSupportsAlign; ///< True = UNO model supports Align property.
};
/** Model for a Forms 2.0 command button. */ class OOX_DLLPUBLIC AxCommandButtonModel final : public AxFontDataModel
{ public: explicit AxCommandButtonModel();
public: // direct access needed for legacy VML drawing controls
OUString maCaption; ///< Visible caption of the button.
sal_uInt32 mnTextColor; ///< Text color.
sal_uInt32 mnBackColor; ///< Fill color.
sal_uInt32 mnFlags; ///< Various flags.
sal_uInt32 mnBorderColor; ///< Flat border color.
sal_Int32 mnBorderStyle; ///< Flat border style.
sal_Int32 mnSpecialEffect; ///< 3D border effect.
sal_Int32 mnVerticalAlign; ///< Vertical alignment (legacy VML drawing controls only).
};
/** Model for a Forms 2.0 image. */ class UNLESS_MERGELIBS(OOX_DLLPUBLIC) AxImageModel final : public AxControlModelBase
{ public: explicit AxImageModel();
public:
sal_uInt32 mnListIndex;
sal_uInt32 mnTabStyle;
sal_uInt32 mnTabData;
sal_uInt32 mnVariousPropertyBits;
std::vector< OUString > maItems; // captions for each tab
std::vector< OUString > maTabNames; // names for each tab
};
/** Base class for a Forms 2.0 morph data control. */ class OOX_DLLPUBLIC AxMorphDataModelBase : public AxFontDataModel
{ public: explicit AxMorphDataModelBase();
public: // direct access needed for legacy VML drawing controls
StreamDataSequence maPictureData; ///< Binary picture stream.
OUString maCaption; ///< Visible caption of the button.
OUString maValue; ///< Current value of the control.
OUString maGroupName; ///< Group name for option buttons.
sal_uInt32 mnTextColor; ///< Text color.
sal_uInt32 mnBackColor; ///< Fill color.
sal_uInt32 mnFlags; ///< Various flags.
sal_uInt32 mnPicturePos; ///< Position of the picture relative to text.
sal_uInt32 mnBorderColor; ///< Flat border color.
sal_Int32 mnBorderStyle; ///< Flat border style.
sal_Int32 mnSpecialEffect; ///< 3D border effect.
sal_Int32 mnDisplayStyle; ///< Type of the morph control.
sal_Int32 mnMultiSelect; ///< Selection mode.
sal_Int32 mnScrollBars; ///< Horizontal/vertical scroll bar.
sal_Int32 mnMatchEntry; ///< Auto completion mode.
sal_Int32 mnShowDropButton; ///< When to show the dropdown button.
sal_Int32 mnMaxLength; ///< Maximum character count.
sal_Int32 mnPasswordChar; ///< Password character in edit fields.
sal_Int32 mnListRows; ///< Number of rows in dropdown box.
sal_Int32 mnVerticalAlign; ///< Vertical alignment (legacy VML drawing controls only).
};
/** Model for a Forms 2.0 toggle button. */ class UNLESS_MERGELIBS(OOX_DLLPUBLIC) AxToggleButtonModel final : public AxMorphDataModelBase
{ public: explicit AxToggleButtonModel();
/** Model for a Forms 2.0 option button. */ class OOX_DLLPUBLIC AxOptionButtonModel final : public AxMorphDataModelBase
{ public: explicit AxOptionButtonModel();
/** Returns the group name used to group several option buttons together. */ const OUString& getGroupName() const { return maGroupName; }
/** Model for a numeric field (legacy drawing controls only). */ class OOX_DLLPUBLIC AxNumericFieldModel final : public AxMorphDataModelBase
{ public: explicit AxNumericFieldModel();
/** Model for a Forms 2.0 spin button. */ class OOX_DLLPUBLIC AxSpinButtonModel final : public AxControlModelBase
{ public: explicit AxSpinButtonModel();
public: // direct access needed for legacy VML drawing controls
sal_uInt32 mnArrowColor; ///< Button arrow color.
sal_uInt32 mnBackColor; ///< Fill color.
sal_uInt32 mnFlags; ///< Various flags.
sal_Int32 mnOrientation; ///< Orientation of the buttons.
sal_Int32 mnMin; ///< Minimum of the value range.
sal_Int32 mnMax; ///< Maximum of the value range.
sal_Int32 mnPosition; ///< Value of the spin button.
sal_Int32 mnSmallChange; ///< Increment step size.
sal_Int32 mnDelay; ///< Repeat delay in milliseconds.
};
/** Model for a Forms 2.0 scroll bar. */ class OOX_DLLPUBLIC AxScrollBarModel final : public AxControlModelBase
{ public: explicit AxScrollBarModel();
public: // direct access needed for legacy VML drawing controls
sal_uInt32 mnArrowColor; ///< Button arrow color.
sal_uInt32 mnBackColor; ///< Fill color.
sal_uInt32 mnFlags; ///< Various flags.
sal_Int32 mnOrientation; ///< Orientation of the buttons.
sal_Int32 mnPropThumb; ///< Proportional thumb size.
sal_Int32 mnMin; ///< Minimum of the value range.
sal_Int32 mnMax; ///< Maximum of the value range.
sal_Int32 mnPosition; ///< Value of the spin button.
sal_Int32 mnSmallChange; ///< Increment step size (buttons).
sal_Int32 mnLargeChange; ///< Increment step size (thumb).
sal_Int32 mnDelay; ///< Repeat delay in milliseconds.
};
typedef ::std::vector< OUString > AxClassTable;
/** Base class for ActiveX container controls. */ class OOX_DLLPUBLIC AxContainerModelBase : public AxFontDataModel
{ public: explicit AxContainerModelBase( bool bFontSupport = false );
/** Allows to set single properties specified by XML token identifier. */ virtualvoid importProperty( sal_Int32 nPropId, const OUString& rValue ) override; /** Reads the leading structure in the 'f' stream containing the model for
this control. */ virtualbool importBinaryModel( BinaryInputStream& rInStrm ) override; /** Converts font settings if supported. */ virtualvoid convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const override;
/** Reads the class table structure for embedded controls following the own
model from the 'f' stream. */ bool importClassTable( BinaryInputStream& rInStrm, AxClassTable& orClassTable );
public: // direct access needed for legacy VML drawing controls
StreamDataSequence maPictureData; ///< Binary picture stream.
OUString maCaption; ///< Visible caption of the form.
AxPairData maLogicalSize; ///< Logical form size (scroll area).
AxPairData maScrollPos; ///< Scroll position.
sal_uInt32 mnBackColor; ///< Fill color.
sal_uInt32 mnTextColor; ///< Text color.
sal_uInt32 mnFlags; ///< Various flags.
sal_uInt32 mnBorderColor; ///< Flat border color.
sal_Int32 mnBorderStyle; ///< Flat border style.
sal_Int32 mnScrollBars; ///< Horizontal/vertical scroll bar.
sal_Int32 mnCycleType; ///< Cycle in all forms or in this form.
sal_Int32 mnSpecialEffect; ///< 3D border effect.
sal_Int32 mnPicAlign; ///< Anchor position of the picture.
sal_Int32 mnPicSizeMode; ///< Clip, stretch, zoom. bool mbPicTiling; ///< True = picture is repeated. bool mbFontSupport; ///< True = control supports the font property.
};
/** Model for a Forms 2.0 frame control. */ class OOX_DLLPUBLIC AxFrameModel final : public AxContainerModelBase
{ public: explicit AxFrameModel();
/** Model for a Forms 2.0 user form. */ class UNLESS_MERGELIBS(OOX_DLLPUBLIC) AxUserFormModel final : public AxContainerModelBase
{ public: explicit AxUserFormModel();
class HtmlTextBoxModel final : public AxTextBoxModel
{ public: explicit HtmlTextBoxModel(); virtualbool importBinaryModel( BinaryInputStream& rInStrm ) override;
};
/** A form control embedded in a document draw page. Contains a specific model
structure according to the type of the control. */ class OOX_DLLPUBLIC EmbeddedControl
{ public: explicit EmbeddedControl( OUString aName );
/** Creates and returns the internal control model of the specified type. */ template< typename ModelType > inline ModelType& createModel();
/** Creates and returns the internal control model of the specified type. */ template< typename ModelType, typename ParamType > inline ModelType& createModel( const ParamType& rParam );
/** Creates and returns the internal control model according to the passed
MS class identifier. */
ControlModelBase* createModelFromGuid( std::u16string_view rClassId );
/** Returns true, if the internal control model exists. */ bool hasModel() const { returnbool(mxModel); } /** Returns read-only access to the internal control model. */ const ControlModelBase* getModel() const { return mxModel.get(); } /** Returns read/write access to the internal control model. */
ControlModelBase* getModel() { return mxModel.get(); }
/** Returns the UNO service name needed to construct the control model. */
OUString getServiceName() const;
/** Converts all control properties and inserts them into the passed model. */ bool convertProperties( const css::uno::Reference< css::awt::XControlModel >& rxCtrlModel, const ControlConverter& rConv ) const;
/** A wrapper for a control form embedded directly in a draw page. */ class EmbeddedForm
{ public: explicit EmbeddedForm( const css::uno::Reference< css::frame::XModel >& rxDocModel, const css::uno::Reference< css::drawing::XDrawPage >& rxDrawPage, const GraphicHelper& rGraphicHelper );
/** Converts the passed control and inserts the control model into the form.
@return The API control model, if conversion was successful. */
css::uno::Reference< css::awt::XControlModel >
convertAndInsert( const EmbeddedControl& rControl, sal_Int32& rnCtrlIndex );
/** Returns the XIndexContainer interface of the UNO control form, if existing. */ const css::uno::Reference< css::container::XIndexContainer >&
getXForm() const { return mxFormIC; }
private: /** Creates the form that will hold the form controls. */
css::uno::Reference< css::container::XIndexContainer > const &
createXForm();
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.