summaryrefslogtreecommitdiff
path: root/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
diff options
context:
space:
mode:
authorNoel Power <noel.power@novell.com>2010-11-02 16:22:07 +0000
committerNoel Power <noel.power@novell.com>2010-11-02 19:52:04 +0000
commit928159ff71d19a3910d1fd1e472a11ef1c89415b (patch)
tree25f0500b8985d8c5eb2aad05acd3302efc9845b6 /xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
parent919a8118197dbcce6aa363124cde1707f9d797e9 (diff)
initial import of latest cws container_controls
Diffstat (limited to 'xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx')
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx551
1 files changed, 398 insertions, 153 deletions
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
index a2abb08d5c0f..2d955fd5c5d5 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
@@ -39,8 +39,7 @@
#include <com/sun/star/document/XStorageBasedDocument.hpp>
#include <com/sun/star/document/XGraphicObjectResolver.hpp>
#include <comphelper/componentcontext.hxx>
-#include <comphelper/processfactory.hxx>
-
+#include <com/sun/star/lang/XServiceInfo.hpp>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -49,66 +48,6 @@ using ::rtl::OUString;
namespace xmlscript
{
-void lclExportBindableAndListSourceBits( Reference< frame::XModel > const & xDocument, const Reference< beans::XPropertySet >& _xProps, ElementDescriptor& rModel )
-{
- Reference< lang::XMultiServiceFactory > xFac;
- if ( xDocument.is() )
- xFac.set( xDocument, uno::UNO_QUERY );
-
- Reference< form::binding::XBindableValue > xBinding( _xProps, UNO_QUERY );
-
- if ( xFac.is() && xBinding.is() )
- {
- try
- {
- Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY );
- Reference< beans::XPropertySet > xBindable( xBinding->getValueBinding(), UNO_QUERY );
- if ( xBindable.is() )
- {
- table::CellAddress aAddress;
- xBindable->getPropertyValue( OUSTR("BoundCell") ) >>= aAddress;
- xConvertor->setPropertyValue( OUSTR("Address"), makeAny( aAddress ) );
- rtl::OUString sAddress;
- xConvertor->getPropertyValue( OUSTR("PersistentRepresentation") ) >>= sAddress;
- if ( sAddress.getLength() > 0 )
- rModel.addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell"), sAddress );
-
- OSL_TRACE( "*** Bindable value %s", rtl::OUStringToOString( sAddress, RTL_TEXTENCODING_UTF8 ).getStr() );
-
- }
- }
- catch( uno::Exception& )
- {
- }
- }
- Reference< form::binding::XListEntrySink > xEntrySink( _xProps, UNO_QUERY );
- if ( xEntrySink.is() )
- {
- Reference< beans::XPropertySet > xListSource( xEntrySink->getListEntrySource(), UNO_QUERY );
- if ( xListSource.is() )
- {
- try
- {
- Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY );
-
- table::CellRangeAddress aAddress;
- xListSource->getPropertyValue( OUSTR( "CellRange" ) ) >>= aAddress;
-
- rtl::OUString sAddress;
- xConvertor->setPropertyValue( OUSTR("Address"), makeAny( aAddress ) );
- xConvertor->getPropertyValue( OUSTR("PersistentRepresentation") ) >>= sAddress;
- OSL_TRACE("**** cell range source list %s",
- rtl::OUStringToOString( sAddress, RTL_TEXTENCODING_UTF8 ).getStr() );
- if ( sAddress.getLength() > 0 )
- rModel.addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":source-cell-range"), sAddress );
- }
- catch( uno::Exception& )
- {
- }
- }
- }
-
-}
static inline bool readBorderProps(
ElementDescriptor * element, Style & style )
{
@@ -138,7 +77,9 @@ static inline bool readFontProps( ElementDescriptor * element, Style & style )
void ElementDescriptor::readMultiPageModel( StyleBag * all_styles )
{
// collect styles
- Style aStyle( 0x2 | 0x8 | 0x20 );
+ Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
+ aStyle._set |= 0x1;
if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
aStyle._set |= 0x2;
if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
@@ -153,24 +94,101 @@ void ElementDescriptor::readMultiPageModel( StyleBag * all_styles )
// collect elements
readDefaults();
- readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ),
+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiPageValue") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
- readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
+ Any aDecorationAny( _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Decoration") ) ) );
+ bool bDecoration = sal_True;
+ if ( (aDecorationAny >>= bDecoration) && !bDecoration )
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":withtabs") ), OUString( RTL_CONSTASCII_USTRINGPARAM("false") ) );
+
+ readEvents();
+ uno::Reference< container::XNameContainer > xPagesContainer( _xProps, uno::UNO_QUERY );
+ if ( xPagesContainer.is() && xPagesContainer->getElementNames().getLength() )
+ {
+ ElementDescriptor * pElem = new ElementDescriptor( _xProps, _xPropState, OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":bulletinboard") ), _xDocument );
+ pElem->readBullitinBoard( all_styles );
+ addSubElement( pElem );
+ }
+}
+//__________________________________________________________________________________________________
+void ElementDescriptor::readFrameModel( StyleBag * all_styles )
+{
+ // collect styles
+ Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
+/*
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
+ aStyle._set |= 0x1;
+*/
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
+ aStyle._set |= 0x2;
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
+ aStyle._set |= 0x20;
+ if (readFontProps( this, aStyle ))
+ aStyle._set |= 0x8;
+ if (aStyle._set)
+ {
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
+ all_styles->getStyleId( aStyle ) );
+ }
+ // collect elements
+ readDefaults();
OUString aTitle;
- if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ) ) >>= aTitle)
+
+ if ( readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ) ) >>= aTitle)
{
ElementDescriptor * title = new ElementDescriptor(
_xProps, _xPropState,
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ), _xDocument );
title->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ),
aTitle );
addSubElement( title );
}
+ uno::Reference< container::XNameContainer > xControlContainer( _xProps, uno::UNO_QUERY );
+ if ( xControlContainer.is() && xControlContainer->getElementNames().getLength() )
+ {
+ ElementDescriptor * pElem = new ElementDescriptor( _xProps, _xPropState, OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":bulletinboard") ), _xDocument );
+ pElem->readBullitinBoard( all_styles );
+ addSubElement( pElem );
+ }
+ readEvents();
+}
+//__________________________________________________________________________________________________
+void ElementDescriptor::readPageModel( StyleBag * all_styles )
+{
+ // collect styles
+ Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
+ aStyle._set |= 0x1;
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
+ aStyle._set |= 0x2;
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
+ aStyle._set |= 0x20;
+ if (readFontProps( this, aStyle ))
+ aStyle._set |= 0x8;
+ if (aStyle._set)
+ {
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
+ all_styles->getStyleId( aStyle ) );
+ }
+
+ // collect elements
+ readDefaults();
+ rtl::OUString aTitle;
+ readStringAttr(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ) );
+ uno::Reference< container::XNameContainer > xControlContainer( _xProps, uno::UNO_QUERY );
+ if ( xControlContainer.is() && xControlContainer->getElementNames().getLength() )
+ {
+ ElementDescriptor * pElem = new ElementDescriptor( _xProps, _xPropState, OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":bulletinboard") ), _xDocument );
+ pElem->readBullitinBoard( all_styles );
+ addSubElement( pElem );
+ }
readEvents();
}
+
void ElementDescriptor::readButtonModel( StyleBag * all_styles )
SAL_THROW( (Exception) )
{
@@ -204,8 +222,10 @@ void ElementDescriptor::readButtonModel( StyleBag * all_styles )
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":valign") ) );
readButtonTypeAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("PushButtonType") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":button-type") ) );
- readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) );
+ readImageURLAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) );
+
+
readImagePositionAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-position") ) );
readImageAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageAlign") ),
@@ -275,8 +295,8 @@ void ElementDescriptor::readCheckBoxModel( StyleBag * all_styles )
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
readVerticalAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":valign") ) );
- readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) );
+ readImageURLAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) );
readImagePositionAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-position") ) );
readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
@@ -312,7 +332,7 @@ void ElementDescriptor::readCheckBoxModel( StyleBag * all_styles )
readEvents();
}
//__________________________________________________________________________________________________
-void ElementDescriptor::readComboBoxModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
+void ElementDescriptor::readComboBoxModel( StyleBag * all_styles )
SAL_THROW( (Exception) )
{
// collect styles
@@ -354,7 +374,9 @@ void ElementDescriptor::readComboBoxModel( StyleBag * all_styles, Reference< fra
readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linecount") ) );
// Cell Range, Ref Cell etc.
- lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
+ readDataAwareAttr( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell") );
+ readDataAwareAttr( OUSTR( XMLNS_DIALOGS_PREFIX ":source-cell-range") );
+
// string item list
Sequence< OUString > itemValues;
if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ) ) >>= itemValues) &&
@@ -362,14 +384,14 @@ void ElementDescriptor::readComboBoxModel( StyleBag * all_styles, Reference< fra
{
ElementDescriptor * popup = new ElementDescriptor(
_xProps, _xPropState,
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menupopup") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menupopup") ), _xDocument );
OUString const * pItemValues = itemValues.getConstArray();
for ( sal_Int32 nPos = 0; nPos < itemValues.getLength(); ++nPos )
{
ElementDescriptor * item = new ElementDescriptor(
_xProps, _xPropState,
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menuitem") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menuitem") ), _xDocument );
item->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ),
pItemValues[ nPos ] );
popup->addSubElement( item );
@@ -380,7 +402,7 @@ void ElementDescriptor::readComboBoxModel( StyleBag * all_styles, Reference< fra
readEvents();
}
//__________________________________________________________________________________________________
-void ElementDescriptor::readListBoxModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
+void ElementDescriptor::readListBoxModel( StyleBag * all_styles )
SAL_THROW( (Exception) )
{
// collect styles
@@ -415,7 +437,8 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles, Reference< fram
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linecount") ) );
readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
- lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
+ readDataAwareAttr( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell") );
+ readDataAwareAttr( OUSTR( XMLNS_DIALOGS_PREFIX ":source-cell-range") );
// string item list
Sequence< OUString > itemValues;
if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ) ) >>= itemValues) &&
@@ -423,7 +446,7 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles, Reference< fram
{
ElementDescriptor * popup = new ElementDescriptor(
_xProps, _xPropState,
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menupopup") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menupopup") ), _xDocument );
OUString const * pItemValues = itemValues.getConstArray();
sal_Int32 nPos;
@@ -431,7 +454,7 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles, Reference< fram
{
ElementDescriptor * item = new ElementDescriptor(
_xProps, _xPropState,
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menuitem") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menuitem") ), _xDocument );
item->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ),
pItemValues[ nPos ] );
popup->addSubElement( item );
@@ -455,7 +478,7 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles, Reference< fram
readEvents();
}
//__________________________________________________________________________________________________
-void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
+void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles )
SAL_THROW( (Exception) )
{
// collect styles
@@ -486,8 +509,8 @@ void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles, Reference<
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
readVerticalAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("VerticalAlign") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":valign") ) );
- readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) );
+ readImageURLAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) );
readImagePositionAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImagePosition") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-position") ) );
readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
@@ -513,7 +536,7 @@ void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles, Reference<
break;
}
}
- lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
+ readDataAwareAttr( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell") );
readEvents();
}
//__________________________________________________________________________________________________
@@ -542,7 +565,7 @@ void ElementDescriptor::readGroupBoxModel( StyleBag * all_styles )
{
ElementDescriptor * title = new ElementDescriptor(
_xProps, _xPropState,
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ), _xDocument );
title->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ),
aTitle );
addSubElement( title );
@@ -683,10 +706,11 @@ void ElementDescriptor::readEditModel( StyleBag * all_styles )
addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":echochar") ),
OUString( &cEcho, 1 ) );
}
+ readDataAwareAttr( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell") );
readEvents();
}
//__________________________________________________________________________________________________
-void ElementDescriptor::readImageControlModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
+void ElementDescriptor::readImageControlModel( StyleBag * all_styles )
SAL_THROW( (Exception) )
{
// collect styles
@@ -705,33 +729,10 @@ void ElementDescriptor::readImageControlModel( StyleBag * all_styles, com::sun::
readDefaults();
readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleImage") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":scale-image") ) );
- rtl::OUString sURL;
- _xProps->getPropertyValue( OUSTR("ImageURL") ) >>= sURL;
-
- if ( sURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:" ) ) ) == 0 )
- {
- Reference< document::XStorageBasedDocument > xDocStorage( xDocument, UNO_QUERY );
-
- if ( xDocStorage.is() )
- {
- uno::Sequence< Any > aArgs( 1 );
- aArgs[ 0 ] <<= xDocStorage->getDocumentStorage();
-
- ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
- uno::Reference< document::XGraphicObjectResolver > xGraphicResolver;
- aContext.createComponentWithArguments( OUSTR( "com.sun.star.comp.Svx.GraphicExportHelper" ), aArgs, xGraphicResolver );
- if ( xGraphicResolver.is() )
- {
- sURL = xGraphicResolver->resolveGraphicObjectURL( sURL );
- }
- }
- }
- if ( sURL.getLength() > 0 )
- {
- addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":src"), sURL );
- }
readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
+ readImageURLAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":src") ) );
readEvents();
}
//__________________________________________________________________________________________________
@@ -1151,6 +1152,45 @@ void ElementDescriptor::readFormattedFieldModel( StyleBag * all_styles )
readEvents();
}
+
+void ElementDescriptor::readSpinButtonModel( StyleBag * all_styles )
+ SAL_THROW( (Exception) )
+{
+ // collect styles
+ Style aStyle( 0x1 | 0x4 );
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
+ aStyle._set |= 0x1;
+ if (readBorderProps( this, aStyle ))
+ aStyle._set |= 0x4;
+ if (aStyle._set)
+ {
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
+ all_styles->getStyleId( aStyle ) );
+ }
+
+ // collect elements
+ readDefaults();
+ readOrientationAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinIncrement") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":increment") ) );
+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValue") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":curval") ) );
+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValueMax") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxval") ) );
+ readLongAttr( OUSTR("SpinValueMin"),
+ OUSTR(XMLNS_DIALOGS_PREFIX ":minval") );
+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Repeat") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":repeat") ) );
+ readLongAttr( OUSTR("RepeatDelay"), OUSTR(XMLNS_DIALOGS_PREFIX ":repeat-delay") );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
+ readHexLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":symbol-color") ) );
+ readDataAwareAttr( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell") );
+ readEvents();
+}
+
//__________________________________________________________________________________________________
void ElementDescriptor::readFixedLineModel( StyleBag * all_styles )
SAL_THROW( (Exception) )
@@ -1206,7 +1246,7 @@ void ElementDescriptor::readProgressBarModel( StyleBag * all_styles )
readEvents();
}
//__________________________________________________________________________________________________
-void ElementDescriptor::readScrollBarModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
+void ElementDescriptor::readScrollBarModel( StyleBag * all_styles )
SAL_THROW( (Exception) )
{
// collect styles
@@ -1244,47 +1284,7 @@ void ElementDescriptor::readScrollBarModel( StyleBag * all_styles, Reference< fr
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":live-scroll") ) );
readHexLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":symbol-color") ) );
- // Cell Range, Ref Cell etc.
- lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
- readEvents();
-}
-//__________________________________________________________________________________________________
-void ElementDescriptor::readSpinButtonModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
- SAL_THROW( (Exception) )
-{
- // collect styles
- Style aStyle( 0x1 | 0x4 );
- if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
- aStyle._set |= 0x1;
- if (readBorderProps( this, aStyle ))
- aStyle._set |= 0x4;
- if (aStyle._set)
- {
- addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
- all_styles->getStyleId( aStyle ) );
- }
-
- // collect elements
- readDefaults();
- readOrientationAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
- readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinIncrement") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":increment") ) );
- readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValue") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":curval") ) );
- readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValueMax") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxval") ) );
- readLongAttr( OUSTR("SpinValueMin"),
- OUSTR(XMLNS_DIALOGS_PREFIX ":minval") );
- readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Repeat") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":repeat") ) );
- readLongAttr( OUSTR("RepeatDelay"), OUSTR(XMLNS_DIALOGS_PREFIX ":repeat-delay") );
- readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
- readHexLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":symbol-color") ) );
- // Cell Range, Ref Cell etc.
- lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
+ readDataAwareAttr( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell") );
readEvents();
}
//__________________________________________________________________________________________________
@@ -1340,6 +1340,251 @@ void ElementDescriptor::readDialogModel( StyleBag * all_styles )
readEvents();
}
+void ElementDescriptor::readBullitinBoard( StyleBag * all_styles )
+ SAL_THROW( (Exception) )
+{
+ // collect elements
+ ::std::vector< ElementDescriptor* > all_elements;
+ // read out all props
+ Reference< container::XNameContainer > xDialogModel( _xProps, UNO_QUERY );
+ if ( !xDialogModel.is() )
+ return; // #TODO throw???
+ Sequence< OUString > aElements( xDialogModel->getElementNames() );
+ OUString const * pElements = aElements.getConstArray();
+
+ ElementDescriptor * pRadioGroup = 0;
+
+ sal_Int32 nPos;
+ for ( nPos = 0; nPos < aElements.getLength(); ++nPos )
+ {
+ Any aControlModel( xDialogModel->getByName( pElements[ nPos ] ) );
+ Reference< beans::XPropertySet > xProps;
+ OSL_VERIFY( aControlModel >>= xProps );
+ if (! xProps.is())
+ continue;
+ Reference< beans::XPropertyState > xPropState( xProps, UNO_QUERY );
+ OSL_ENSURE( xPropState.is(), "no XPropertyState!" );
+ if (! xPropState.is())
+ continue;
+ Reference< lang::XServiceInfo > xServiceInfo( xProps, UNO_QUERY );
+ OSL_ENSURE( xServiceInfo.is(), "no XServiceInfo!" );
+ if (! xServiceInfo.is())
+ continue;
+
+ ElementDescriptor * pElem = 0;
+
+ // group up radio buttons
+ if ( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) ) )
+ {
+ if (! pRadioGroup) // open radiogroup
+ {
+ pRadioGroup = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":radiogroup") ), _xDocument );
+ all_elements.push_back( pRadioGroup );
+ }
+
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":radio") ), _xDocument );
+ pElem->readRadioButtonModel( all_styles );
+ pRadioGroup->addSubElement( pElem );
+ }
+ else // no radio
+ {
+ pRadioGroup = 0; // close radiogroup
+
+ if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlButtonModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":button") ), _xDocument );
+ pElem->readButtonModel( all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCheckBoxModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":checkbox") ), _xDocument );
+ pElem->readCheckBoxModel( all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":combobox") ), _xDocument );
+ pElem->readComboBoxModel( all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menulist") ), _xDocument );
+ pElem->readListBoxModel( all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":titledbox") ), _xDocument );
+ pElem->readGroupBoxModel( all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multipage") ), _xDocument );
+ pElem->readMultiPageModel( all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoFrameModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":frame") ), _xDocument );
+ pElem->readFrameModel( all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoPageModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":page") ), _xDocument );
+ pElem->readPageModel( all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":text") ), _xDocument );
+ pElem->readFixedTextModel( all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlEditModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":textfield") ), _xDocument );
+ pElem->readEditModel( all_styles );
+ }
+ // FixedHyperLink
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedHyperlinkModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linklabel") ), _xDocument );
+ pElem->readFixedHyperLinkModel( all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlImageControlModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":img") ), _xDocument );
+ pElem->readImageControlModel( all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFileControlModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":filecontrol") ), _xDocument );
+ pElem->readFileControlModel( all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.tree.TreeControlModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":treecontrol") ), _xDocument );
+ pElem->readTreeControlModel( all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCurrencyFieldModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":currencyfield") ), _xDocument );
+ pElem->readCurrencyFieldModel( all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlDateFieldModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":datefield") ), _xDocument );
+ pElem->readDateFieldModel( all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlNumericFieldModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":numericfield") ), _xDocument );
+ pElem->readNumericFieldModel( all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlTimeFieldModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":timefield") ) , _xDocument);
+ pElem->readTimeFieldModel( all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlPatternFieldModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":patternfield") ), _xDocument );
+ pElem->readPatternFieldModel( all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFormattedFieldModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":formattedfield") ), _xDocument );
+ pElem->readFormattedFieldModel( all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedLineModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":fixedline") ), _xDocument );
+ pElem->readFixedLineModel( all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":scrollbar") ), _xDocument );
+ pElem->readScrollBarModel( all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlSpinButtonModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spinbutton") ), _xDocument );
+ pElem->readSpinButtonModel( all_styles );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":progressmeter") ), _xDocument );
+ pElem->readProgressBarModel( all_styles );
+ }
+ //
+
+ if (pElem)
+ {
+ all_elements.push_back( pElem );
+ }
+ else
+ {
+ OSL_ENSURE( sal_False, "unknown control type!" );
+ continue;
+ }
+ }
+ }
+ if (! all_elements.empty())
+ {
+ for ( std::size_t n = 0; n < all_elements.size(); ++n )
+ {
+ addSubElement( all_elements[ n ] );
+ }
+ }
+}
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */