ms_oforms/controls/ole_site_concrete/
mod.rs

1//! Specifies properties stored for each embedded control in a UserForm control.
2pub mod stream;
3pub mod parser;
4
5use crate::properties::types::Position;
6
7bitflags!{
8    /// Specifies Boolean properties of an embedded control on a form.
9    ///
10    /// Unless otherwise specified,
11    /// each bit applies to all control types. All bits that do not apply to a particular type of
12    /// control MUST be set to zero for that control.
13    pub struct SiteFlags: u32 {
14        /// Specifies whether the control can receive focus while the user is navigating
15        /// controls using the TAB key.
16        const TAB_STOP          = 0x00000001;
17        /// Specifies whether the control is displayed.
18        const VISIBLE           = 0x00000002;
19        /// Specifies whether the control is the default option on the form.
20        const DEFAULT           = 0x00000004;
21        /// Specifies whether the control is the cancel option on the form.
22        const CANCEL            = 0x00000008;
23        /// Specifies whether the control is stored in the Object stream of the form. A value of
24        /// zero specifies that the control has its own storage.
25        const STREAMED          = 0x00000010;
26        /// Specifies whether the control automatically resizes to display its entire contents.
27        const AUTO_SIZE         = 0x00000020;
28
29        /// Specifies whether to preserve the height of a control when resizing. Applies to ListBox.
30        const PRESERVE_HEIGHT   = 0x00000100;
31        /// Specifies whether to adjust the size of a control when the size of its parent changes.
32        const FIT_TO_PARENT     = 0x00000200;
33
34        /// Specifies whether to select the first child of a container control when the container
35        /// control is the next control to which the user is navigating.
36        const SELECT_CHILD      = 0x00002000;
37
38        /// Specifies whether child controls are identified as child objects of the
39        /// control or as child objects of the parent of the control. MUST be set to 1 for the
40        /// following controls: Frame, MultiPage and Page. MUST be set to zero for all other
41        /// controls.
42        const PROMOTE_CONTROLS  = 0x00040000;
43    }
44}
45
46#[derive(Debug)]
47pub enum Clsid {
48    ClassTable(u16),
49    Invalid,
50    Global(u16),
51}
52
53/// Specifies properties stored for each embedded control in a UserForm control.
54#[derive(Debug)]
55pub struct OleSiteConcrete {
56    pub id: i32,
57    pub help_context_id: i32,
58    /// A SITE_FLAG that specifies Boolean properties of an embedded control on a form.
59    ///
60    /// The file format default is 0x00000033, which means that the following flags are set to TRUE:
61    /// fTabStop, fVisible, fStreamed, and fAutoSize.
62    pub bit_flags: SiteFlags,
63    /// An unsigned integer that specifies the size, in bytes, of an embedded control that is
64    /// persisted to the Object stream of a Form.
65    ///
66    /// The file format default is 0x00000000.
67    pub object_stream_size: u32,
68    /// A signed integer that specifies the index of an embedded control in the tab order of a form.
69    /// Values less than zero specify an invalid index in the tab order.
70    ///
71    /// The file format default is 0xFFFF, or –1, an invalid index.
72    pub tab_index: i16,
73    /// An unsigned integer that specifies the type of a FormEmbeddedActiveXControl on a parent control. A
74    /// value less than 0x7FFF specifies an index value for FormEmbeddedActiveXControlCached. A value of
75    /// 0x7FFF specifies that the index is invalid. A value greater than or equal to 0x8000 specifies an index
76    /// into the FormSiteData.ClassTable of the FormControl in which the control is embedded, where
77    /// information about the control is specified by the entry in ClassTable that corresponds to the value of
78    /// this property minus 0x8000.
79    ///
80    /// The file format default is 0x7FFF, an invalid index.
81    pub clsid_cache_index: Clsid,
82    /// An unsigned integer that specifies the control group of a control. A value of zero specifies that the
83    /// control is not in a control group. A value greater than zero specifies the unique identifier of the control
84    /// group to which the control belongs. All controls that have the same value for this property are in the
85    /// same control group.
86    ///
87    /// The file format default is 0x0000.
88    pub group_id: u16,
89
90    /// An fmString that specifies the name of a control.
91    ///
92    /// The file format default is a zero-length string.
93    pub name: String,
94
95    /// An fmString that is associated with a control and that contains data entered by the user. SHOULD be
96    /// ignored.<13>
97    ///
98    /// The file format default is a zero-length string.
99    pub tag: String,
100
101    /// An fmPosition that specifies the location of the top-left corner of an embedded control on a form,
102    /// relative to the top-left corner of the LogicalSize of the form.
103    /// The file format default is (0, 0), which specifies that the top-left corner of the embedded control is at
104    /// the top-left corner of the form.
105    pub site_position: Position,
106
107    /// An fmString that specifies the tooltip for the control.
108    ///
109    /// The file format default is a zero-length string.
110    pub control_tip_text: String,
111
112    /// An fmString that specifies the license key of a control.
113    ///
114    /// The file format default is a zero-length string.
115    pub runtime_lic_key: String,
116
117    /// An fmString that specifies a cell in a worksheet that sets the Value property of a control when the
118    /// control is loaded and to which the new value of the Value property is stored after it changes in the
119    /// control.
120    ///
121    /// The file format default is a zero-length string.
122    pub control_source: String,
123
124    /// An fmString that specifies the source for the list of values in a ComboBox or ListBox that is embedded
125    /// in a form. This property MUST NOT be set for other controls. The format of the string is a range of
126    /// cells in a worksheet.
127    ///
128    /// The file format default is a zero-length string.
129    pub row_source: String,
130}