summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorSascha Ballach <sab@openoffice.org>2000-11-10 17:15:59 +0000
committerSascha Ballach <sab@openoffice.org>2000-11-10 17:15:59 +0000
commit4bf3f6572357a226633ff0bc21508cba5cc99846 (patch)
treeee1fdc5fda05026657c865c0cd8e66b5b2af0f5e /xmloff
parent0ae04cb5444d668efa13ac68e7ba2dbe1f7cdeea (diff)
XStatusIndicator added
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/prj/d.lst1
-rw-r--r--xmloff/source/core/ProgressBarHelper.cxx120
-rw-r--r--xmloff/source/core/makefile.mk8
-rw-r--r--xmloff/source/core/xmlexp.cxx16
-rw-r--r--xmloff/source/core/xmlimp.cxx16
5 files changed, 150 insertions, 11 deletions
diff --git a/xmloff/prj/d.lst b/xmloff/prj/d.lst
index 487ca9aa30f4..11af4517064e 100644
--- a/xmloff/prj/d.lst
+++ b/xmloff/prj/d.lst
@@ -79,3 +79,4 @@ hedabu: ..\inc\XMLTextMasterStylesContext.hxx %_DEST%\inc%_EXT%\xmloff\XMLTextMa
hedabu: ..\inc\XMLTextMasterPageContext.hxx %_DEST%\inc%_EXT%\xmloff\XMLTextMasterPageContext.hxx
hedabu: ..\inc\XMLTextTableContext.hxx %_DEST%\inc%_EXT%\xmloff\XMLTextTableContext.hxx
hedabu: ..\source\text\XMLTextShapeImportHelper.hxx %_DEST%\inc%_EXT%\xmloff\XMLTextShapeImportHelper.hxx
+hedabu: ..\inc\ProgressBarHelper.hxx %_DEST%\inc%_EXT%\xmloff\ProgressBarHelper.hxx
diff --git a/xmloff/source/core/ProgressBarHelper.cxx b/xmloff/source/core/ProgressBarHelper.cxx
new file mode 100644
index 000000000000..871c1cdfe51b
--- /dev/null
+++ b/xmloff/source/core/ProgressBarHelper.cxx
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ * $RCSfile: ProgressBarHelper.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: sab $ $Date: 2000-11-10 18:12:55 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef PCH
+#include "filt_pch.hxx"
+#endif
+
+#pragma hdrstop
+
+
+//___________________________________________________________________
+
+#ifndef _XMLOFF_PROGRESSBARHELPER_HXX
+#include "ProgressBarHelper.hxx"
+#endif
+#ifndef _COM_SUN_STAR_TASK_XSTATUSINDICATORFACTORY_HPP_
+#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
+#endif
+
+using namespace ::com::sun::star;
+
+const sal_Int32 nProgressBarRange = 1000000;
+
+ProgressBarHelper::ProgressBarHelper(const ::com::sun::star::uno::Reference < ::com::sun::star::frame::XModel>& rModel,
+ const ::rtl::OUString& rText)
+{
+ if (rModel.is())
+ {
+ uno::Reference<frame::XController> xController( rModel->getCurrentController());
+ if( xController.is())
+ {
+ uno::Reference<frame::XFrame> xFrame( xController->getFrame());
+ if( xFrame.is())
+ {
+ uno::Reference<task::XStatusIndicatorFactory> xFactory( xFrame, uno::UNO_QUERY );
+ if( xFactory.is())
+ {
+ xStatusIndicator = xFactory->createStatusIndicator();
+ if (xStatusIndicator.is())
+ xStatusIndicator->start(rText, nProgressBarRange);
+ }
+ }
+ }
+ }
+}
+
+ProgressBarHelper::~ProgressBarHelper()
+{
+ if (xStatusIndicator.is())
+ xStatusIndicator->end();
+}
+
+void ProgressBarHelper::SetValue(sal_Int32 nValue)
+{
+ if (xStatusIndicator.is())
+ {
+// sal_Int32 nNewValue = (((100 / nReference) * nValue) * nProgressBarRange) / 100;
+ sal_Int32 nNewValue = (nValue * nProgressBarRange) / nReference;
+ xStatusIndicator->setValue(nNewValue);
+ }
+}
+
diff --git a/xmloff/source/core/makefile.mk b/xmloff/source/core/makefile.mk
index 65174a1e9ffe..c1ad30e65bf3 100644
--- a/xmloff/source/core/makefile.mk
+++ b/xmloff/source/core/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.4 $
+# $Revision: 1.5 $
#
-# last change: $Author: cl $ $Date: 2000-11-08 12:03:08 $
+# last change: $Author: sab $ $Date: 2000-11-10 18:12:55 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -95,6 +95,7 @@ CXXFILES = \
xmlkywd.cxx \
xmltkmap.cxx \
xmluconv.cxx \
+ ProgressBarHelper.cxx \
PropertySetMerger.cxx
SLOFILES = \
@@ -110,11 +111,12 @@ SLOFILES = \
$(SLO)$/xmlkywd.obj \
$(SLO)$/xmltkmap.obj \
$(SLO)$/xmluconv.obj \
+ $(SLO)$/ProgressBarHelper.obj \
$(SLO)$/PropertySetMerger.obj
# NETBSD: somewhere we have to instantiate the static data members.
# NETBSD-1.2.1 doesn't know about weak symbols so the default mechanism for GCC won't work.
-# SCO and MACOSX: the linker does know about weak symbols, but we can't ignore multiple defined symbols
+# SCO and MACOSX: the linker does know about weak symbols, but we can't ignore multiple defined symbols
.IF "$(OS)"=="NETBSD" || "$(OS)"=="SCO" || "$(OS)$(COM)"=="OS2GCC" || "$(OS)"=="MACOSX"
SLOFILES+=$(SLO)$/staticmb.obj
.ENDIF
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index e5b0adc3c29b..3943114392e8 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlexp.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: sab $ $Date: 2000-10-20 05:35:38 $
+ * last change: $Author: sab $ $Date: 2000-11-10 18:12:55 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -104,6 +104,10 @@
#include "families.hxx"
#endif
+#ifndef _XMLOFF_PROGRESSBARHELPER_HXX
+#include "ProgressBarHelper.hxx"
+#endif
+
#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
#include <com/sun/star/container/XNameAccess.hpp>
#endif
@@ -183,7 +187,8 @@ SvXMLExport::SvXMLExport(
pAttrList( new SvXMLAttributeList ),
bExtended( sal_False ),
xHandler( rHandler ),
- xExtHandler( rHandler, uno::UNO_QUERY )
+ xExtHandler( rHandler, uno::UNO_QUERY ),
+ pProgressBarHelper( NULL )
{
_InitCtor();
}
@@ -205,7 +210,8 @@ SvXMLExport::SvXMLExport(
xExtHandler( rHandler, uno::UNO_QUERY ),
xModel( rModel ),
pNumExport(0L),
- xNumberFormatsSupplier (rModel, uno::UNO_QUERY)
+ xNumberFormatsSupplier (rModel, uno::UNO_QUERY),
+ pProgressBarHelper( new ProgressBarHelper(rModel, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "XML Export" ))))
{
_InitCtor();
if (xNumberFormatsSupplier.is())
@@ -216,6 +222,8 @@ SvXMLExport::~SvXMLExport()
{
delete pNamespaceMap;
delete pUnitConv;
+ if (pProgressBarHelper)
+ delete pProgressBarHelper;
}
void SvXMLExport::AddAttributeASCII( sal_uInt16 nPrefixKey,
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index d75af8ac5b18..293deda9ba13 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlimp.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: pw $ $Date: 2000-10-16 13:30:27 $
+ * last change: $Author: sab $ $Date: 2000-11-10 18:12:55 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -99,6 +99,10 @@
#include "xmlnumfi.hxx"
#endif
+#ifndef _XMLOFF_PROGRESSBARHELPER_HXX
+#include "ProgressBarHelper.hxx"
+#endif
+
#ifndef _COM_SUN_STAR_LANG_SERVICENOTREGISTEREDEXCEPTION_HDL_
#include <com/sun/star/lang/ServiceNotRegisteredException.hdl>
#endif
@@ -192,7 +196,8 @@ SvXMLImport::SvXMLImport() throw () :
pNamespaceMap( new SvXMLNamespaceMap ),
pUnitConv( new SvXMLUnitConverter( MAP_100TH_MM, MAP_100TH_MM ) ),
pContexts( new SvXMLImportContexts_Impl ),
- pNumImport( NULL )
+ pNumImport( NULL ),
+ pProgressBarHelper( NULL )
{
_InitCtor();
}
@@ -204,7 +209,8 @@ SvXMLImport::SvXMLImport( const Reference< XModel > & rModel ) throw () :
pContexts( new SvXMLImportContexts_Impl ),
pNumImport( NULL ),
xModel( rModel ),
- xNumberFormatsSupplier (xModel, uno::UNO_QUERY)
+ xNumberFormatsSupplier (rModel, uno::UNO_QUERY),
+ pProgressBarHelper( new ProgressBarHelper(rModel, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("XML Import"))))
{
_InitCtor();
if (xNumberFormatsSupplier.is())
@@ -218,6 +224,8 @@ SvXMLImport::~SvXMLImport() throw ()
delete pContexts;
if (pNumImport)
delete pNumImport;
+ if (pProgressBarHelper)
+ delete pProgressBarHelper;
}
// XUnoTunnel & co