1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: GroupBox.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_forms.hxx"
33 #include "GroupBox.hxx"
34 #include "property.hxx"
35 #ifndef _FRM_PROPERTY_HRC_
36 #include "property.hrc"
38 #include "services.hxx"
39 #include <tools/debug.hxx>
41 //.........................................................................
44 using namespace ::com::sun::star::uno
;
45 using namespace ::com::sun::star::sdb
;
46 using namespace ::com::sun::star::sdbc
;
47 using namespace ::com::sun::star::sdbcx
;
48 using namespace ::com::sun::star::beans
;
49 using namespace ::com::sun::star::container
;
50 using namespace ::com::sun::star::form
;
51 using namespace ::com::sun::star::awt
;
52 using namespace ::com::sun::star::io
;
53 using namespace ::com::sun::star::lang
;
54 using namespace ::com::sun::star::util
;
56 //==================================================================
58 //==================================================================
60 //------------------------------------------------------------------
61 InterfaceRef SAL_CALL
OGroupBoxModel_CreateInstance(const Reference
<starlang::XMultiServiceFactory
>& _rxFactory
) throw (RuntimeException
)
63 return *(new OGroupBoxModel(_rxFactory
));
66 //------------------------------------------------------------------
67 DBG_NAME( OGroupBoxModel
)
68 //------------------------------------------------------------------
69 OGroupBoxModel::OGroupBoxModel(const Reference
<starlang::XMultiServiceFactory
>& _rxFactory
)
70 :OControlModel(_rxFactory
, VCL_CONTROLMODEL_GROUPBOX
, VCL_CONTROL_GROUPBOX
)
72 DBG_CTOR( OGroupBoxModel
, NULL
);
73 m_nClassId
= FormComponentType::GROUPBOX
;
76 //------------------------------------------------------------------
77 OGroupBoxModel::OGroupBoxModel( const OGroupBoxModel
* _pOriginal
, const Reference
<starlang::XMultiServiceFactory
>& _rxFactory
)
78 :OControlModel( _pOriginal
, _rxFactory
)
80 DBG_CTOR( OGroupBoxModel
, NULL
);
84 //------------------------------------------------------------------------------
85 StringSequence SAL_CALL
OGroupBoxModel::getSupportedServiceNames() throw(RuntimeException
)
87 StringSequence aSupported
= OControlModel::getSupportedServiceNames();
88 aSupported
.realloc(aSupported
.getLength() + 1);
90 ::rtl::OUString
* pArray
= aSupported
.getArray();
91 pArray
[aSupported
.getLength()-1] = FRM_SUN_COMPONENT_GROUPBOX
;
95 //------------------------------------------------------------------
96 OGroupBoxModel::~OGroupBoxModel()
98 DBG_DTOR( OGroupBoxModel
, NULL
);
101 //------------------------------------------------------------------------------
102 IMPLEMENT_DEFAULT_CLONING( OGroupBoxModel
)
104 //------------------------------------------------------------------------------
105 void OGroupBoxModel::describeAggregateProperties( Sequence
< Property
>& _rAggregateProps
) const
107 OControlModel::describeAggregateProperties( _rAggregateProps
);
108 // don't want to have the TabStop property
109 RemoveProperty(_rAggregateProps
, PROPERTY_TABSTOP
);
112 //------------------------------------------------------------------------------
113 ::rtl::OUString SAL_CALL
OGroupBoxModel::getServiceName() throw(RuntimeException
)
115 return FRM_COMPONENT_GROUPBOX
; // old (non-sun) name for compatibility !
118 //------------------------------------------------------------------------------
119 void SAL_CALL
OGroupBoxModel::write(const Reference
< XObjectOutputStream
>& _rxOutStream
)
120 throw(IOException
, RuntimeException
)
122 OControlModel::write(_rxOutStream
);
125 _rxOutStream
->writeShort(0x0002);
126 writeHelpTextCompatibly(_rxOutStream
);
129 //------------------------------------------------------------------------------
130 void SAL_CALL
OGroupBoxModel::read(const Reference
< XObjectInputStream
>& _rxInStream
) throw(IOException
, RuntimeException
)
132 OControlModel::read( _rxInStream
);
135 sal_uInt16 nVersion
= _rxInStream
->readShort();
136 DBG_ASSERT(nVersion
> 0, "OGroupBoxModel::read : version 0 ? this should never have been written !");
137 // ups, ist das Englisch richtig ? ;)
140 readHelpTextCompatibly(_rxInStream
);
142 if (nVersion
> 0x0002)
144 DBG_ERROR("OGroupBoxModel::read : unknown version !");
148 //==================================================================
150 //==================================================================
152 //------------------------------------------------------------------
153 InterfaceRef SAL_CALL
OGroupBoxControl_CreateInstance(const Reference
<starlang::XMultiServiceFactory
>& _rxFactory
) throw (RuntimeException
)
155 return *(new OGroupBoxControl(_rxFactory
));
158 //------------------------------------------------------------------------------
159 OGroupBoxControl::OGroupBoxControl(const Reference
<starlang::XMultiServiceFactory
>& _rxFactory
)
160 :OControl(_rxFactory
, VCL_CONTROL_GROUPBOX
)
164 //------------------------------------------------------------------------------
165 StringSequence SAL_CALL
OGroupBoxControl::getSupportedServiceNames() throw(RuntimeException
)
167 StringSequence aSupported
= OControl::getSupportedServiceNames();
168 aSupported
.realloc(aSupported
.getLength() + 1);
170 ::rtl::OUString
* pArray
= aSupported
.getArray();
171 pArray
[aSupported
.getLength()-1] = FRM_SUN_CONTROL_GROUPBOX
;
175 //.........................................................................
177 //.........................................................................