summaryrefslogtreecommitdiff
path: root/xmloff/source/core
diff options
context:
space:
mode:
authorSascha Ballach <sab@openoffice.org>2001-04-20 07:07:16 +0000
committerSascha Ballach <sab@openoffice.org>2001-04-20 07:07:16 +0000
commit434684158556ff5dad68399010ba5b2b932f889f (patch)
tree19453aa3db1707decb1c67e72fa283d74b940b44 /xmloff/source/core
parent6d5d371c7073f87be2228e905044d42a85ff5928 (diff)
#86162#; transport the information about loaded/saved number styles
Diffstat (limited to 'xmloff/source/core')
-rw-r--r--xmloff/source/core/xmlexp.cxx60
-rw-r--r--xmloff/source/core/xmlimp.cxx81
2 files changed, 119 insertions, 22 deletions
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index 94c83b6b1da1..e04f77a77444 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlexp.cxx,v $
*
- * $Revision: 1.54 $
+ * $Revision: 1.55 $
*
- * last change: $Author: sab $ $Date: 2001-04-04 05:26:04 $
+ * last change: $Author: sab $ $Date: 2001-04-20 08:04:24 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -362,32 +362,47 @@ SvXMLExport::~SvXMLExport()
{
delete pImageMapExport;
delete pEventExport;
- delete pNumExport;
delete pNamespaceMap;
delete pUnitConv;
- if (pProgressBarHelper)
+ if (pProgressBarHelper || pNumExport)
{
if (xExportInfo.is())
{
uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = xExportInfo->getPropertySetInfo();
if (xPropertySetInfo.is())
{
- OUString sProgressMax(RTL_CONSTASCII_USTRINGPARAM(XML_PROGRESSMAX));
- OUString sProgressCurrent(RTL_CONSTASCII_USTRINGPARAM(XML_PROGRESSCURRENT));
- if (xPropertySetInfo->hasPropertyByName(sProgressMax) &&
- xPropertySetInfo->hasPropertyByName(sProgressCurrent))
+ if (pProgressBarHelper)
{
- sal_Int32 nProgressMax(pProgressBarHelper->GetReference());
- sal_Int32 nProgressCurrent(pProgressBarHelper->GetValue());
- uno::Any aAny;
- aAny <<= nProgressMax;
- xExportInfo->setPropertyValue(sProgressMax, aAny);
- aAny <<= nProgressCurrent;
- xExportInfo->setPropertyValue(sProgressCurrent, aAny);
+ OUString sProgressMax(RTL_CONSTASCII_USTRINGPARAM(XML_PROGRESSMAX));
+ OUString sProgressCurrent(RTL_CONSTASCII_USTRINGPARAM(XML_PROGRESSCURRENT));
+ if (xPropertySetInfo->hasPropertyByName(sProgressMax) &&
+ xPropertySetInfo->hasPropertyByName(sProgressCurrent))
+ {
+ sal_Int32 nProgressMax(pProgressBarHelper->GetReference());
+ sal_Int32 nProgressCurrent(pProgressBarHelper->GetValue());
+ uno::Any aAny;
+ aAny <<= nProgressMax;
+ xExportInfo->setPropertyValue(sProgressMax, aAny);
+ aAny <<= nProgressCurrent;
+ xExportInfo->setPropertyValue(sProgressCurrent, aAny);
+ }
+ }
+ if (pNumExport)
+ {
+ OUString sWrittenNumberFormats(RTL_CONSTASCII_USTRINGPARAM(XML_WRITTENNUMBERFORMATS));
+ if (xPropertySetInfo->hasPropertyByName(sWrittenNumberFormats))
+ {
+ uno::Sequence<sal_Int32> aWasUsed;
+ pNumExport->GetWasUsed(aWasUsed);
+ uno::Any aAny;
+ aAny <<= aWasUsed;
+ xExportInfo->setPropertyValue(sWrittenNumberFormats, aAny);
+ }
}
}
}
delete pProgressBarHelper;
+ delete pNumExport;
}
}
@@ -407,6 +422,21 @@ void SAL_CALL SvXMLExport::setSourceDocument( const uno::Reference< lang::XCompo
if(xNumberFormatsSupplier.is() && xHandler.is())
pNumExport = new SvXMLNumFmtExport(xHandler, xNumberFormatsSupplier);
}
+ if (xExportInfo.is() && pNumExport)
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = xExportInfo->getPropertySetInfo();
+ if (xPropertySetInfo.is())
+ {
+ OUString sWrittenNumberFormats(RTL_CONSTASCII_USTRINGPARAM(XML_WRITTENNUMBERFORMATS));
+ if (xPropertySetInfo->hasPropertyByName(sWrittenNumberFormats))
+ {
+ uno::Any aAny = xExportInfo->getPropertyValue(sWrittenNumberFormats);
+ uno::Sequence<sal_Int32> aWasUsed;
+ if(aAny >>= aWasUsed)
+ pNumExport->SetWasUsed(aWasUsed);
+ }
+ }
+ }
}
// XInitialize
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index a0500070b072..1d7fef30a784 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlimp.cxx,v $
*
- * $Revision: 1.32 $
+ * $Revision: 1.33 $
*
- * last change: $Author: sab $ $Date: 2001-03-30 10:46:46 $
+ * last change: $Author: sab $ $Date: 2001-04-20 08:04:24 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -118,6 +118,10 @@
#include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
#endif
+#ifndef _COMPHELPER_NAMECONTAINER_HXX_
+#include <comphelper/namecontainer.hxx>
+#endif
+
using namespace ::rtl;
using namespace ::osl;
using namespace ::com::sun::star;
@@ -278,12 +282,12 @@ SvXMLImport::~SvXMLImport() throw ()
// delete pImageMapImportHelper;
if (pNumImport)
delete pNumImport;
- if (pProgressBarHelper)
+ if (xImportInfo.is())
{
- if (xImportInfo.is())
+ uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = xImportInfo->getPropertySetInfo();
+ if (xPropertySetInfo.is())
{
- uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = xImportInfo->getPropertySetInfo();
- if (xPropertySetInfo.is())
+ if (pProgressBarHelper)
{
OUString sProgressMax(RTL_CONSTASCII_USTRINGPARAM(XML_PROGRESSMAX));
OUString sProgressCurrent(RTL_CONSTASCII_USTRINGPARAM(XML_PROGRESSCURRENT));
@@ -298,9 +302,16 @@ SvXMLImport::~SvXMLImport() throw ()
aAny <<= nProgressCurrent;
xImportInfo->setPropertyValue(sProgressCurrent, aAny);
}
+ delete pProgressBarHelper;
+ }
+ OUString sNumberStyles(RTL_CONSTASCII_USTRINGPARAM(XML_NUMBERSTYLES));
+ if (xNumberStyles.is() && xPropertySetInfo->hasPropertyByName(sNumberStyles))
+ {
+ uno::Any aAny;
+ aAny <<= xNumberStyles;
+ xImportInfo->setPropertyValue(sNumberStyles, aAny);
}
}
- delete pProgressBarHelper;
}
if( xFontDecls.Is() )
@@ -573,6 +584,19 @@ void SAL_CALL SvXMLImport::initialize( const uno::Sequence< uno::Any >& aArgumen
else if( pAny->getValueType() == ::getCppuType((const uno::Reference< beans::XPropertySet >*)0))
{
*pAny >>= xImportInfo;
+ if (xImportInfo.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = xImportInfo->getPropertySetInfo();
+ if (xPropertySetInfo.is())
+ {
+ OUString sNumberStyles(RTL_CONSTASCII_USTRINGPARAM(XML_NUMBERSTYLES));
+ if (xPropertySetInfo->hasPropertyByName(sNumberStyles))
+ {
+ uno::Any aAny = xImportInfo->getPropertyValue(sNumberStyles);
+ aAny >>= xNumberStyles;
+ }
+ }
+ }
}
}
}
@@ -860,6 +884,23 @@ ProgressBarHelper* SvXMLImport::GetProgressBarHelper()
return pProgressBarHelper;
}
+void SvXMLImport::AddNumberStyle(sal_Int32 nKey, const OUString& rName)
+{
+ if (!xNumberStyles.is())
+ {
+ uno::Reference< container::XNameContainer > xTempNumberStyles( comphelper::NameContainer_createInstance( ::getCppuType((const sal_Int32*)0)) );
+ xNumberStyles = xTempNumberStyles;
+ }
+ if (xNumberStyles.is())
+ {
+ uno::Any aAny;
+ aAny <<= nKey;
+ xNumberStyles->insertByName(rName, aAny);
+ }
+ else
+ DBG_ERROR("not possible to create NameContainer");
+}
+
XMLEventImportHelper& SvXMLImport::GetEventImport()
{
if (!pEventImportHelper)
@@ -889,6 +930,32 @@ void SvXMLImport::SetStyles( SvXMLStylesContext *pStyles )
void SvXMLImport::SetAutoStyles( SvXMLStylesContext *pAutoStyles )
{
+ if (pAutoStyles && xNumberStyles.is() && (mnImportFlags & IMPORT_CONTENT) )
+ {
+ uno::Reference<xml::sax::XAttributeList> xAttrList;
+ uno::Sequence< ::rtl::OUString > aNames = xNumberStyles->getElementNames();
+ sal_uInt32 nCount(aNames.getLength());
+ if (nCount)
+ {
+ const OUString* pNames = aNames.getConstArray();
+ if ( pNames )
+ {
+ SvXMLStyleContext* pContext;
+ uno::Any aAny;
+ sal_Int32 nKey(0);
+ for (sal_uInt32 i = 0; i < nCount; i++, pNames++)
+ {
+ aAny = xNumberStyles->getByName(*pNames);
+ if (aAny >>= nKey)
+ {
+ pContext = new SvXMLNumFormatContext( *this, XML_NAMESPACE_NUMBER,
+ *pNames, xAttrList, nKey, *pAutoStyles );
+ pAutoStyles->AddStyle(*pContext);
+ }
+ }
+ }
+ }
+ }
xAutoStyles = pAutoStyles;
GetTextImport()->SetAutoStyles( pAutoStyles );
GetShapeImport()->SetAutoStylesContext( pAutoStyles );