summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsb <sb@openoffice.org>2009-07-02 15:29:21 +0200
committersb <sb@openoffice.org>2009-07-02 15:29:21 +0200
commitd790c0c2dd77875626abc306f4c2871b02695350 (patch)
treeeedf08a6e286eddbda1480265e11f6526305dd4f
parent735726b2a9873914ccb54657861434800f1cb6f9 (diff)
parent104e585e3db2e7a77e1de237ea68abaf38a44600 (diff)
merged in DEV300_m51
-rw-r--r--basebmp/test/makefile.mk2
-rw-r--r--basegfx/test/makefile.mk2
-rw-r--r--canvas/source/vcl/bitmapbackbuffer.cxx15
-rw-r--r--canvas/source/vcl/bitmapbackbuffer.hxx2
-rw-r--r--canvas/source/vcl/canvasbitmaphelper.cxx2
-rw-r--r--comphelper/inc/comphelper/componentbase.hxx160
-rw-r--r--comphelper/inc/comphelper/servicehelper.hxx10
-rw-r--r--comphelper/qa/complex/comphelper/Map.java512
-rw-r--r--comphelper/qa/complex/comphelper/SequenceOutputStreamUnitTest.java (renamed from comphelper/qa/complex/sequenceoutputstream/SequenceOutputStreamUnitTest.java)10
-rw-r--r--comphelper/qa/complex/comphelper/Test01.java (renamed from comphelper/qa/complex/sequenceoutputstream/Test01.java)8
-rw-r--r--comphelper/qa/complex/comphelper/TestHelper.java (renamed from comphelper/qa/complex/sequenceoutputstream/TestHelper.java)2
-rw-r--r--comphelper/qa/complex/comphelper_all.sce2
-rw-r--r--comphelper/qa/complex/makefile.mk (renamed from comphelper/qa/complex/sequenceoutputstream/makefile.mk)66
-rw-r--r--comphelper/qa/complex/sequenceoutputstream/SequenceOutputStreamTest.java34
-rw-r--r--comphelper/source/compare/AnyCompareFactory.cxx35
-rw-r--r--comphelper/source/container/IndexedPropertyValuesContainer.cxx37
-rw-r--r--comphelper/source/container/NamedPropertyValuesContainer.cxx33
-rw-r--r--comphelper/source/container/enumerablemap.cxx999
-rw-r--r--comphelper/source/container/makefile.mk3
-rw-r--r--comphelper/source/inc/comphelper_module.hxx42
-rw-r--r--comphelper/source/misc/comphelper_module.cxx40
-rw-r--r--comphelper/source/misc/comphelper_services.cxx74
-rw-r--r--comphelper/source/misc/componentbase.cxx73
-rw-r--r--comphelper/source/misc/documentiologring.cxx175
-rw-r--r--comphelper/source/misc/documentiologring.hxx92
-rw-r--r--comphelper/source/misc/facreg.cxx246
-rw-r--r--comphelper/source/misc/instancelocker.cxx19
-rw-r--r--comphelper/source/misc/instancelocker.hxx6
-rw-r--r--comphelper/source/misc/makefile.mk5
-rw-r--r--comphelper/source/officeinstdir/officeinstallationdirectories.cxx99
-rw-r--r--comphelper/source/officeinstdir/officeinstallationdirectories.hxx10
-rw-r--r--comphelper/source/property/opropertybag.cxx15
-rw-r--r--comphelper/source/property/property.cxx8
-rw-r--r--comphelper/source/streaming/memorystream.cxx47
-rw-r--r--comphelper/source/streaming/seqinputstreamserv.cxx57
-rw-r--r--comphelper/source/streaming/seqoutputstreamserv.cxx56
-rw-r--r--dtrans/source/X11/X11_droptarget.cxx48
-rw-r--r--dtrans/source/X11/X11_selection.cxx4
-rw-r--r--goodies/prj/build.lst2
-rw-r--r--i18npool/inc/i18npool/paper.hxx155
-rw-r--r--i18npool/prj/build.lst3
-rw-r--r--i18npool/prj/d.lst6
-rw-r--r--i18npool/source/paper/makefile.mk75
-rw-r--r--i18npool/source/paper/paper.cxx473
-rw-r--r--o3tl/qa/makefile.mk2
-rw-r--r--rsc/source/prj/start.cxx14
-rw-r--r--svtools/inc/sfxecode.hxx1
-rw-r--r--svtools/inc/svtools/itemprop.hxx122
-rw-r--r--svtools/inc/svtools/parhtml.hxx30
-rw-r--r--svtools/inc/svtools/svparser.hxx79
-rw-r--r--svtools/inc/svtools/undo.hxx11
-rw-r--r--svtools/prj/build.lst2
-rw-r--r--svtools/source/brwbox/brwbox1.cxx2
-rw-r--r--svtools/source/config/extcolorcfg.cxx10
-rw-r--r--svtools/source/config/securityoptions.cxx2
-rw-r--r--svtools/source/contnr/templwin.cxx17
-rw-r--r--svtools/source/contnr/templwin.src14
-rw-r--r--svtools/source/control/filectrl.cxx6
-rw-r--r--svtools/source/control/inettbc.cxx6
-rw-r--r--svtools/source/edit/svmedit.cxx80
-rw-r--r--svtools/source/filter.vcl/ixbm/xbmread.cxx2
-rw-r--r--svtools/source/items1/itemprop.cxx455
-rw-r--r--svtools/source/misc/acceleratorexecute.cxx31
-rw-r--r--svtools/source/misc/documentlockfile.cxx2
-rw-r--r--svtools/source/misc/errtxt.src4
-rw-r--r--svtools/source/numbers/numfmuno.cxx8
-rw-r--r--svtools/source/svhtml/makefile.mk2
-rw-r--r--svtools/source/svhtml/parhtml.cxx250
-rw-r--r--svtools/source/svrtf/rtfkey2.cxx1162
-rw-r--r--svtools/source/svrtf/svparser.cxx60
-rw-r--r--svtools/source/undo/makefile.mk1
-rw-r--r--svtools/source/undo/undo.cxx152
-rw-r--r--svtools/source/uno/unoevent.cxx2
-rw-r--r--toolkit/inc/toolkit/controls/unocontrol.hxx2
-rw-r--r--toolkit/source/controls/formattedcontrol.cxx7
-rw-r--r--toolkit/source/controls/unocontrol.cxx133
-rw-r--r--toolkit/source/controls/unocontrols.cxx23
-rw-r--r--tools/bootstrp/makefile.mk8
-rw-r--r--transex3/inc/export.hxx4
-rw-r--r--transex3/prj/d.lst1
-rw-r--r--transex3/scripts/fast_merge.pl348
-rwxr-xr-xtransex3/scripts/localize.pl406
-rw-r--r--transex3/source/localize.cxx21
-rw-r--r--transex3/source/merge.cxx88
-rw-r--r--ucbhelper/inc/ucbhelper/simpleauthenticationrequest.hxx60
-rw-r--r--ucbhelper/prj/build.lst2
-rw-r--r--ucbhelper/source/provider/simpleauthenticationrequest.cxx137
-rw-r--r--unotools/inc/unotools/accessiblerelationsethelper.hxx2
-rw-r--r--unotools/inc/unotools/accessiblestatesethelper.hxx2
-rw-r--r--unotools/inc/unotools/servicehelper.hxx108
-rw-r--r--vcl/aqua/inc/salgdi.h1
-rw-r--r--vcl/aqua/source/a11y/aqua11ywrapper.mm8
-rwxr-xr-xvcl/aqua/source/gdi/salatslayout.cxx15
-rw-r--r--vcl/aqua/source/gdi/salgdi.cxx100
-rw-r--r--vcl/aqua/source/gdi/salprn.cxx8
-rw-r--r--vcl/aqua/source/gdi/salvd.cxx2
-rw-r--r--vcl/inc/sft.h641
-rw-r--r--vcl/inc/vcl/jobset.h2
-rw-r--r--vcl/inc/vcl/pngread.hxx2
-rw-r--r--vcl/inc/vcl/print.hxx9
-rw-r--r--vcl/inc/vcl/prntypes.hxx28
-rw-r--r--vcl/inc/vcl/salprn.hxx2
-rw-r--r--vcl/inc/vcl/syschild.hxx2
-rw-r--r--vcl/inc/vcl/window.hxx2
-rw-r--r--vcl/prj/build.lst2
-rw-r--r--vcl/source/gdi/base14.cxx2
-rw-r--r--vcl/source/gdi/impimagetree.cxx7
-rw-r--r--vcl/source/gdi/pdfwriter.cxx3
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx53
-rw-r--r--vcl/source/gdi/pngread.cxx21
-rw-r--r--vcl/source/gdi/print.cxx148
-rw-r--r--vcl/source/window/keycod.cxx40
-rw-r--r--vcl/source/window/menu.cxx27
-rw-r--r--vcl/source/window/toolbox.cxx2
-rw-r--r--vcl/source/window/window.cxx52
-rw-r--r--vcl/unx/gtk/app/gtkdata.cxx45
-rw-r--r--vcl/unx/gtk/app/gtkinst.cxx3
-rw-r--r--vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx2
-rw-r--r--vcl/unx/gtk/window/gtkframe.cxx8
-rw-r--r--vcl/unx/headless/svpprn.cxx44
-rw-r--r--vcl/unx/headless/svpvd.cxx11
-rw-r--r--vcl/unx/inc/plugins/gtk/gtkdata.hxx1
-rw-r--r--vcl/unx/inc/salgdi.h13
-rw-r--r--vcl/unx/kde/kdedata.cxx2
-rw-r--r--vcl/unx/kde/salnativewidgets-kde.cxx2
-rw-r--r--vcl/unx/source/app/saldisp.cxx20
-rw-r--r--vcl/unx/source/fontmanager/fontconfig.cxx22
-rw-r--r--vcl/unx/source/fontmanager/fontmanager.cxx2
-rw-r--r--vcl/unx/source/gdi/salgdi.cxx3020
-rw-r--r--vcl/unx/source/gdi/salgdi2.cxx53
-rw-r--r--vcl/unx/source/gdi/salgdi3.cxx34
-rw-r--r--vcl/unx/source/gdi/salprnpsp.cxx45
-rw-r--r--vcl/unx/source/gdi/salvd.cxx9
-rw-r--r--vcl/unx/source/gdi/xrender_peer.cxx53
-rw-r--r--vcl/unx/source/plugadapt/salplug.cxx5
-rw-r--r--vcl/unx/source/printer/printerinfomanager.cxx76
-rw-r--r--vcl/util/linksvp/makefile.mk1
-rw-r--r--vcl/util/makefile.mk4
-rw-r--r--vcl/win/source/gdi/MAKEFILE.MK1
-rw-r--r--vcl/win/source/gdi/salnativewidgets-luna.cxx18
-rw-r--r--vcl/win/source/gdi/salprn.cxx325
-rwxr-xr-xvcl/win/source/gdi/winlayout.cxx30
-rw-r--r--vcl/win/source/window/MAKEFILE.MK2
-rw-r--r--vcl/win/source/window/salframe.cxx11
144 files changed, 9204 insertions, 3482 deletions
diff --git a/basebmp/test/makefile.mk b/basebmp/test/makefile.mk
index 43165b831a64..7d0dc6e3967a 100644
--- a/basebmp/test/makefile.mk
+++ b/basebmp/test/makefile.mk
@@ -132,6 +132,6 @@ unittest : $(SHL1TARGETN)
@echo ----------------------------------------------------------
@echo - start unit test on library $(SHL1TARGETN)
@echo ----------------------------------------------------------
- $(AUGMENT_LIBRARY_PATH) testshl2 -sf $(mktmp ) $(SHL1TARGETN)
+ $(TESTSHL2) -sf $(mktmp ) $(SHL1TARGETN)
ALLTAR : unittest
diff --git a/basegfx/test/makefile.mk b/basegfx/test/makefile.mk
index d0fbfaf9e7c6..8e47a13defdd 100644
--- a/basegfx/test/makefile.mk
+++ b/basegfx/test/makefile.mk
@@ -89,7 +89,7 @@ $(MISC)$/unittest_succeeded : $(SHL1TARGETN)
@echo ----------------------------------------------------------
@echo - start unit test on library $(SHL1TARGETN)
@echo ----------------------------------------------------------
- $(AUGMENT_LIBRARY_PATH) testshl2 -sf $(mktmp ) -forward $(BIN)$/ $(SHL1TARGETN)
+ $(TESTSHL2) -sf $(mktmp ) -forward $(BIN)$/ $(SHL1TARGETN)
$(TOUCH) $@
ALLTAR : $(MISC)$/unittest_succeeded
diff --git a/canvas/source/vcl/bitmapbackbuffer.cxx b/canvas/source/vcl/bitmapbackbuffer.cxx
index a7895f1034dd..1cc97351d9c0 100644
--- a/canvas/source/vcl/bitmapbackbuffer.cxx
+++ b/canvas/source/vcl/bitmapbackbuffer.cxx
@@ -105,6 +105,19 @@ namespace vclcanvas
return *maBitmap;
}
+ Size BitmapBackBuffer::getBitmapSizePixel() const
+ {
+ Size aSize = maBitmap->GetSizePixel();
+
+ if( mbVDevContentIsCurrent && mpVDev )
+ {
+ mpVDev->EnableMapMode( FALSE );
+ aSize = mpVDev->GetOutputSizePixel();
+ }
+
+ return aSize;
+ }
+
void BitmapBackBuffer::createVDev() const
{
if( !mpVDev )
@@ -151,5 +164,5 @@ namespace vclcanvas
mbBitmapContentIsCurrent = false;
mbVDevContentIsCurrent = true;
}
-
}
+
diff --git a/canvas/source/vcl/bitmapbackbuffer.hxx b/canvas/source/vcl/bitmapbackbuffer.hxx
index 04738300a186..7668aaaaf6b2 100644
--- a/canvas/source/vcl/bitmapbackbuffer.hxx
+++ b/canvas/source/vcl/bitmapbackbuffer.hxx
@@ -70,6 +70,7 @@ namespace vclcanvas
@internal
*/
BitmapEx& getBitmapReference();
+ Size getBitmapSizePixel() const;
private:
void createVDev() const;
@@ -103,3 +104,4 @@ namespace vclcanvas
}
#endif /* #ifndef _VCLCANVAS_BITMAPBACKBUFFER_HXX_ */
+
diff --git a/canvas/source/vcl/canvasbitmaphelper.cxx b/canvas/source/vcl/canvasbitmaphelper.cxx
index 5656e4ba2429..5d5aa0dc8179 100644
--- a/canvas/source/vcl/canvasbitmaphelper.cxx
+++ b/canvas/source/vcl/canvasbitmaphelper.cxx
@@ -109,7 +109,7 @@ namespace vclcanvas
if( !mpBackBuffer )
return geometry::IntegerSize2D();
- return ::vcl::unotools::integerSize2DFromSize( mpBackBuffer->getBitmapReference().GetSizePixel() );
+ return ::vcl::unotools::integerSize2DFromSize( mpBackBuffer->getBitmapSizePixel() );
}
void CanvasBitmapHelper::clear()
diff --git a/comphelper/inc/comphelper/componentbase.hxx b/comphelper/inc/comphelper/componentbase.hxx
new file mode 100644
index 000000000000..ca12610a709d
--- /dev/null
+++ b/comphelper/inc/comphelper/componentbase.hxx
@@ -0,0 +1,160 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org 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 version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+#ifndef COMPHELPER_COMPONENTBASE_HXX
+#define COMPHELPER_COMPONENTBASE_HXX
+
+#include "comphelper/comphelperdllapi.h"
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+
+#include <cppuhelper/interfacecontainer.hxx>
+
+//........................................................................
+namespace comphelper
+{
+//........................................................................
+
+ //====================================================================
+ //= ComponentBase
+ //====================================================================
+ class COMPHELPER_DLLPUBLIC ComponentBase
+ {
+ protected:
+ /** creates a ComponentBase instance
+
+ The instance is not initialized. As a consequence, every ComponentMethodGuard instantiated for
+ this component will throw a <type scope="com::sun::star::lang">NotInitializedException</type>,
+ until ->setInitialized() is called.
+ */
+ ComponentBase( ::cppu::OBroadcastHelper& _rBHelper )
+ :m_rBHelper( _rBHelper )
+ ,m_bInitialized( false )
+ {
+ }
+
+ struct NoInitializationNeeded { };
+
+ /** creates a ComponentBase instance
+
+ The instance is already initialized, so there's no need to call setInitialized later on. Use this
+ constructor for component implementations which do not require explicit initialization.
+ */
+ ComponentBase( ::cppu::OBroadcastHelper& _rBHelper, NoInitializationNeeded )
+ :m_rBHelper( _rBHelper )
+ ,m_bInitialized( true )
+ {
+ }
+
+ /** marks the instance as initialized
+
+ Subsequent instantiations of a ComponentMethodGuard won't throw the NotInitializedException now.
+ */
+ inline void setInitialized() { m_bInitialized = true; }
+
+ public:
+ /// helper struct to grant access to selected public methods to the ComponentMethodGuard class
+ struct GuardAccess { friend class ComponentMethodGuard; private: GuardAccess() { } };
+
+ /// retrieves the component's mutex
+ inline ::osl::Mutex& getMutex( GuardAccess ) { return getMutex(); }
+ /// checks whether the component is already disposed, throws a DisposedException if so.
+ inline void checkDisposed( GuardAccess ) const { impl_checkDisposed_throw(); }
+ /// checks whether the component is already initialized, throws a NotInitializedException if not.
+ inline void checkInitialized( GuardAccess ) const { impl_checkInitialized_throw(); }
+
+ protected:
+ /// retrieves the component's broadcast helper
+ inline ::cppu::OBroadcastHelper& getBroadcastHelper() { return m_rBHelper; }
+ /// retrieves the component's mutex
+ inline ::osl::Mutex& getMutex() { return m_rBHelper.rMutex; }
+ /// determines whether the instance is already disposed
+ inline bool impl_isDisposed() const { return m_rBHelper.bDisposed; }
+
+ /// checks whether the component is already disposed. Throws a DisposedException if so.
+ void impl_checkDisposed_throw() const;
+
+ /// checks whether the component is already initialized. Throws a NotInitializedException if not.
+ void impl_checkInitialized_throw() const;
+
+ /// determines whether the component is already initialized
+ inline bool
+ impl_isInitialized_nothrow() const { return m_bInitialized; }
+
+ /** returns the context to be used when throwing exceptions
+
+ The default implementation returns <NULL/>.
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+ getComponent() const;
+
+ private:
+ ::cppu::OBroadcastHelper& m_rBHelper;
+ bool m_bInitialized;
+ };
+
+ class ComponentMethodGuard
+ {
+ public:
+ enum MethodType
+ {
+ /// allow the method to be called only when being initialized and not being disposed
+ Default,
+ /// allow the method to be called without being initialized
+ WithoutInit
+
+ };
+
+ ComponentMethodGuard( ComponentBase& _rComponent, const MethodType _eType = Default )
+ :m_aMutexGuard( _rComponent.getMutex( ComponentBase::GuardAccess() ) )
+ {
+ if ( _eType != WithoutInit )
+ _rComponent.checkInitialized( ComponentBase::GuardAccess() );
+ _rComponent.checkDisposed( ComponentBase::GuardAccess() );
+ }
+
+ ~ComponentMethodGuard()
+ {
+ }
+
+ inline void clear()
+ {
+ m_aMutexGuard.clear();
+ }
+ inline void reset()
+ {
+ m_aMutexGuard.reset();
+ }
+
+ private:
+ ::osl::ResettableMutexGuard m_aMutexGuard;
+ };
+
+//........................................................................
+} // namespace ComponentBase
+//........................................................................
+
+#endif // COMPHELPER_COMPONENTBASE_HXX
diff --git a/comphelper/inc/comphelper/servicehelper.hxx b/comphelper/inc/comphelper/servicehelper.hxx
index 596e6f946a7f..408684943b44 100644
--- a/comphelper/inc/comphelper/servicehelper.hxx
+++ b/comphelper/inc/comphelper/servicehelper.hxx
@@ -28,8 +28,8 @@
*
************************************************************************/
-#ifndef _UTL_SERVICEHELPER_HXX_
-#define _UTL_SERVICEHELPER_HXX_
+#ifndef _COMPHELPER_SERVICEHELPER_HXX_
+#define _COMPHELPER_SERVICEHELPER_HXX_
/** the UNO3_GETIMPLEMENTATION_* macros implement a static helper function
that gives access to your implementation for a given interface reference,
@@ -47,7 +47,7 @@
*/
#define UNO3_GETIMPLEMENTATION_DECL( classname ) \
static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw(); \
- static classname* getImplementation( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xInt ) throw(); \
+ static classname* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xInt ); \
virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
#define UNO3_GETIMPLEMENTATION_BASE_IMPL( classname ) \
@@ -67,7 +67,7 @@ const ::com::sun::star::uno::Sequence< sal_Int8 > & classname::getUnoTunnelId()
return *pSeq; \
} \
\
-classname* classname::getImplementation( uno::Reference< uno::XInterface > xInt ) throw() \
+classname* classname::getImplementation( const uno::Reference< uno::XInterface >& xInt ) \
{ \
::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > xUT( xInt, ::com::sun::star::uno::UNO_QUERY ); \
if( xUT.is() ) \
@@ -104,5 +104,5 @@ sal_Int64 SAL_CALL classname::getSomething( const ::com::sun::star::uno::Sequenc
}
-#endif // _UTL_SERVICEHELPER_HXX_
+#endif // _COMPHELPER_SERVICEHELPER_HXX_
diff --git a/comphelper/qa/complex/comphelper/Map.java b/comphelper/qa/complex/comphelper/Map.java
new file mode 100644
index 000000000000..00d0b83b94d5
--- /dev/null
+++ b/comphelper/qa/complex/comphelper/Map.java
@@ -0,0 +1,512 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2009 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ */
+
+package complex.comphelper;
+
+import com.sun.star.beans.IllegalTypeException;
+import com.sun.star.beans.Pair;
+import com.sun.star.container.ContainerEvent;
+import com.sun.star.container.XContainer;
+import com.sun.star.container.XContainerListener;
+import com.sun.star.container.XElementAccess;
+import com.sun.star.container.XEnumerableMap;
+import com.sun.star.container.XEnumeration;
+import com.sun.star.container.XIdentifierAccess;
+import com.sun.star.container.XMap;
+import com.sun.star.container.XSet;
+import com.sun.star.form.XFormComponent;
+import com.sun.star.lang.DisposedException;
+import com.sun.star.lang.EventObject;
+import com.sun.star.lang.Locale;
+import com.sun.star.lang.NoSupportException;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.Any;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.TypeClass;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import java.util.HashSet;
+import java.util.Set;
+
+/** complex test case for the css.container.Map implementation
+ *
+ * @author frank.schoenheit@sun.com
+ */
+public class Map extends complexlib.ComplexTestCase
+{
+ @Override
+ public String[] getTestMethodNames()
+ {
+ return new String[] {
+ "testSimpleKeyTypes",
+ "testComplexKeyTypes",
+ "testValueTypes",
+ "testEnumerations",
+ "testSpecialValues"
+ };
+ }
+
+ public static String getShortTestDescription()
+ {
+ return "tests the css.container.Map implementation from comphelper/source/misc/map.cxx";
+ }
+
+ private String impl_getNth( int n )
+ {
+ switch ( n % 10 )
+ {
+ case 1: return n + "st";
+ case 2: return n + "nd";
+ default: return n + "th";
+ }
+ }
+
+ private void impl_putAll( XMap _map, Object[] _keys, Object[] _values ) throws com.sun.star.uno.Exception
+ {
+ for ( int i=0; i<_keys.length; ++i )
+ {
+ _map.put( _keys[i], _values[i] );
+ }
+ }
+
+ private void impl_ceckContent( XMap _map, Object[] _keys, Object[] _values, String _context ) throws com.sun.star.uno.Exception
+ {
+ for ( int i=0; i<_keys.length; ++i )
+ {
+ assure( _context + ": " + impl_getNth(i) + " key (" + _keys[i].toString() + ") not found in map",
+ _map.containsKey( _keys[i] ) );
+ assure( _context + ": " + impl_getNth(i) + " value (" + _values[i].toString() + ") not found in map",
+ _map.containsValue( _values[i] ) );
+ assureEquals( _context + ": wrong value for " + impl_getNth(i) + " key (" + _keys[i] + ")",
+ _values[i], _map.get( _keys[i] ) );
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void impl_checkMappings( Object[] _keys, Object[] _values, String _context ) throws com.sun.star.uno.Exception
+ {
+ log.println( "checking mapping " + _context + "..." );
+
+ Type keyType = AnyConverter.getType( _keys[0] );
+ Type valueType = AnyConverter.getType( _values[0] );
+
+ // create a map for the given types
+ XMap map = com.sun.star.container.EnumerableMap.create( param.getComponentContext(),
+ keyType, valueType );
+ assure( _context + ": key types do not match", map.getKeyType().equals( keyType ) );
+ assure( _context + ": value types do not match", map.getValueType().equals( valueType ) );
+
+ // insert all values
+ assure( _context + ": initially created map is not empty", map.hasElements() );
+ impl_putAll( map, _keys, _values );
+ assure( _context + ": map filled with values is still empty", !map.hasElements() );
+ // and verify them
+ impl_ceckContent( map, _keys, _values, _context );
+
+ // remove all values
+ for ( int i=_keys.length-1; i>=0; --i )
+ {
+ // ensure 'remove' really returns the old value
+ assureEquals( _context + ": wrong 'old value' for removal of " + impl_getNth(i) + " value",
+ _values[i], map.remove( _keys[i] ) );
+ }
+ assure( _context + ":map not empty after removing all elements", map.hasElements() );
+
+ // insert again, and check whether 'clear' does what it should do
+ impl_putAll( map, _keys, _values );
+ map.clear();
+ assure( _context + ": 'clear' does not empty the map", map.hasElements() );
+
+ // try the constructor which creates an immutable version
+ Pair< ?, ? >[] initialMappings = new Pair< ?, ? >[ _keys.length ];
+ for ( int i=0; i<_keys.length; ++i )
+ initialMappings[i] = new Pair< Object, Object >( _keys[i], _values[i] );
+ map = com.sun.star.container.EnumerableMap.createImmutable(
+ param.getComponentContext(), keyType, valueType, (Pair< Object, Object >[])initialMappings );
+ impl_ceckContent( map, _keys, _values, _context );
+
+ // check the thing is actually immutable
+ assureException( map, "clear", new Object[] {}, NoSupportException.class );
+ assureException( map, "remove", new Class[] { Object.class }, new Object[] { _keys[0] }, NoSupportException.class );
+ assureException( map, "put", new Class[] { Object.class, Object.class }, new Object[] { _keys[0], _values[0] },
+ NoSupportException.class );
+ }
+
+ public void testSimpleKeyTypes() throws com.sun.star.uno.Exception
+ {
+ impl_checkMappings(
+ new Long[] { (long)1, (long)2, (long)3, (long)4, (long)5 },
+ new Integer[] { 6, 7, 8, 9, 10 },
+ "long->int"
+ );
+ impl_checkMappings(
+ new Boolean[] { true, false },
+ new Short[] { (short)1, (short)0 },
+ "bool->short"
+ );
+ impl_checkMappings(
+ new String[] { "one", "two", "three", "four", "five"},
+ new String[] { "1", "2", "3", "4", "5" },
+ "string->string"
+ );
+ impl_checkMappings(
+ new Double[] { 1.2, 3.4, 5.6, 7.8, 9.10 },
+ new Float[] { (float)1, (float)2, (float)3, (float)4, (float)5 },
+ "double->float"
+ );
+ impl_checkMappings(
+ new Float[] { (float)1, (float)2, (float)3, (float)4, (float)5 },
+ new Double[] { 1.2, 3.4, 5.6, 7.8, 9.10 },
+ "float->double"
+ );
+ impl_checkMappings(
+ new Integer[] { 2, 9, 2005, 20, 11, 1970, 26, 3, 1974 },
+ new String[] { "2nd", "September", "2005", "20th", "November", "1970", "26th", "March", "1974" },
+ "int->string"
+ );
+ }
+
+ public void testComplexKeyTypes() throws com.sun.star.uno.Exception
+ {
+ Type intType = new Type( Integer.class );
+ Type longType = new Type( Long.class );
+ Type msfType = new Type ( XMultiServiceFactory.class );
+ // ....................................................................
+ // css.uno.Type should be a valid key type
+ impl_checkMappings(
+ new Type[] { intType, longType, msfType },
+ new String[] { intType.getTypeName(), longType.getTypeName(), msfType.getTypeName() },
+ "type->string"
+ );
+
+ // ....................................................................
+ // any UNO interface type should be a valid key type.
+ // Try with some form components (just because I like form components :), and the very first application
+ // for the newly implemented map will be to map XFormComponents to drawing shapes
+ String[] serviceNames = new String[] { "CheckBox", "ComboBox", "CommandButton", "DateField", "FileControl" };
+ Object[] components = new Object[ serviceNames.length ];
+ for ( int i=0; i<serviceNames.length; ++i )
+ {
+ components[i] = ((XMultiServiceFactory)param.getMSF()).createInstance( "com.sun.star.form.component." + serviceNames[i] );
+ }
+ // "normalize" the first component, so it has the property type
+ Type formComponentType = new Type( XFormComponent.class );
+ components[0] = UnoRuntime.queryInterface( formComponentType.getZClass(), components[0] );
+ impl_checkMappings( components, serviceNames, "XFormComponent->string" );
+
+ // ....................................................................
+ // any UNO enum type should be a valid key type
+ impl_checkMappings(
+ new TypeClass[] { intType.getTypeClass(), longType.getTypeClass(), msfType.getTypeClass() },
+ new Object[] { "foo", "bar", "42" },
+ "enum->string"
+ );
+ }
+
+ private Class impl_getValueClassByPos( int _pos )
+ {
+ Class valueClass = null;
+ switch ( _pos )
+ {
+ case 0: valueClass = Boolean.class; break;
+ case 1: valueClass = Short.class; break;
+ case 2: valueClass = Integer.class; break;
+ case 3: valueClass = Long.class; break;
+ case 4: valueClass = XInterface.class; break;
+ case 5: valueClass = XSet.class; break;
+ case 6: valueClass = XContainer.class; break;
+ case 7: valueClass = XIdentifierAccess.class; break;
+ case 8: valueClass = XElementAccess.class; break;
+ case 9: valueClass = com.sun.star.uno.Exception.class; break;
+ case 10: valueClass = com.sun.star.uno.RuntimeException.class; break;
+ case 11: valueClass = EventObject.class; break;
+ case 12: valueClass = ContainerEvent.class; break;
+ case 13: valueClass = Object.class; break;
+ default:
+ failed( "internal error: wrong position for getValueClass" );
+ }
+ return valueClass;
+ }
+
+ @SuppressWarnings("unchecked")
+ private Object impl_getSomeValueByTypePos( int _pos )
+ {
+ Object someValue = null;
+ switch ( _pos )
+ {
+ case 0: someValue = new Boolean( false ); break;
+ case 1: someValue = new Short( (short)0 ); break;
+ case 2: someValue = new Integer( 0 ); break;
+ case 3: someValue = new Long( 0 ); break;
+ case 4: someValue = UnoRuntime.queryInterface( XInterface.class, new DummyInterface() ); break;
+ case 5: someValue = UnoRuntime.queryInterface( XSet.class, new DummySet() ); break;
+ case 6: someValue = UnoRuntime.queryInterface( XContainer.class, new DummyContainer() ); break;
+ case 7: someValue = UnoRuntime.queryInterface( XIdentifierAccess.class, new DummyIdentifierAccess() ); break;
+ case 8: someValue = UnoRuntime.queryInterface( XElementAccess.class, new DummyElementAccess() ); break;
+ case 9: someValue = new com.sun.star.uno.Exception(); break;
+ case 10: someValue = new com.sun.star.uno.RuntimeException(); break;
+ case 11: someValue = new EventObject(); break;
+ case 12: someValue = new ContainerEvent(); break;
+ case 13: someValue = new Locale(); break; // just use *any* value which does not conflict with the others
+ default:
+ failed( "internal error: wrong position for getSomeValue" );
+ }
+ return someValue;
+ }
+
+ private class DummyInterface implements XInterface
+ {
+ };
+
+ private class DummySet implements XSet
+ {
+ public boolean has( Object arg0 ) { throw new UnsupportedOperationException( "Not implemented." ); }
+ public void insert( Object arg0 ) { throw new UnsupportedOperationException( "Not implemented." ); }
+ public void remove( Object arg0 ) { throw new UnsupportedOperationException( "Not implemented." ); }
+ public XEnumeration createEnumeration() { throw new UnsupportedOperationException( "Not implemented." ); }
+ public Type getElementType() { throw new UnsupportedOperationException( "Not implemented." ); }
+ public boolean hasElements() { throw new UnsupportedOperationException( "Not implemented." ); }
+ };
+
+ private class DummyContainer implements XContainer
+ {
+ public void addContainerListener( XContainerListener arg0 ) { throw new UnsupportedOperationException( "Not implemented." ); }
+ public void removeContainerListener( XContainerListener arg0 ) { throw new UnsupportedOperationException( "Not implemented." ); }
+ };
+
+ private class DummyIdentifierAccess implements XIdentifierAccess
+ {
+ public Object getByIdentifier( int arg0 ) { throw new UnsupportedOperationException( "Not implemented." ); }
+ public int[] getIdentifiers() { throw new UnsupportedOperationException( "Not implemented." ); }
+ public Type getElementType() { throw new UnsupportedOperationException( "Not implemented." ); }
+ public boolean hasElements() { throw new UnsupportedOperationException( "Not implemented." ); }
+ };
+
+ private class DummyElementAccess implements XElementAccess
+ {
+ public Type getElementType() { throw new UnsupportedOperationException( "Not implemented." ); }
+ public boolean hasElements() { throw new UnsupportedOperationException( "Not implemented." ); }
+ };
+
+ public void testValueTypes() throws com.sun.star.uno.Exception
+ {
+ final Integer key = new Integer(1);
+
+ // type compatibility matrix: rows are the value types used to create the map,
+ // columns are the value types fed into the map. A value "1" means the respective type
+ // should be accepted.
+ Integer[][] typeCompatibility = new Integer[][] {
+ /* boolean */ new Integer[] { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ /* short */ new Integer[] { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ /* int */ new Integer[] { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ /* long */ new Integer[] { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ /* XInterface */ new Integer[] { 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 },
+ /* XSet */ new Integer[] { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 },
+ /* XContainer */ new Integer[] { 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 },
+ /* XIdentifierAccess */ new Integer[] { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 },
+ /* XElementAccess */ new Integer[] { 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0 },
+ /* Exception */ new Integer[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0 },
+ /* RuntimeException */ new Integer[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 },
+ /* EventObject */ new Integer[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0 },
+ /* ContainerEvent */ new Integer[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 },
+ /* any */ new Integer[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
+ };
+ // several asects are checked with this compatibility matrix:
+ // - if a map's value type is a scalar type, or a string, then nothing but this
+ // type should be accepted
+ // - if a map's value type is an interface type, then values should be accepted if
+ // they contain a derived interface, or the interrface itself, or if they can be
+ // queried for this interface (actually, the latter rule is not tested with the
+ // above matrix)
+ // - if a map's value type is a struct or exception, then values should be accepted
+ // if they are of the given type, or of a derived type.
+ // - if a map's value type is "any", then, well, any value should be accepted
+
+ for ( int valueTypePos = 0; valueTypePos != typeCompatibility.length; ++valueTypePos )
+ {
+ XMap map = com.sun.star.container.EnumerableMap.create( param.getComponentContext(),
+ new Type( Integer.class ), new Type( impl_getValueClassByPos( valueTypePos ) ) );
+
+ for ( int checkTypePos = 0; checkTypePos != typeCompatibility[valueTypePos].length; ++checkTypePos )
+ {
+ Object value = impl_getSomeValueByTypePos( checkTypePos );
+ if ( typeCompatibility[valueTypePos][checkTypePos] != 0 )
+ // expected to succeed
+ assureException(
+ "(" + valueTypePos + "," + checkTypePos + ") putting an " +
+ AnyConverter.getType( value ).getTypeName() + ", where " +
+ map.getValueType().getTypeName() + " is expected, should succeed",
+ map, "put", new Class[] { Object.class, Object.class }, new Object[] { key, value },
+ null );
+ else
+ {
+ // expected to fail
+ assureException(
+ "(" + valueTypePos + "," + checkTypePos + ") putting an " +
+ AnyConverter.getType( value ).getTypeName() + ", where " +
+ map.getValueType().getTypeName() + " is expected, should not succeed",
+ map, "put", new Class[] { Object.class, Object.class }, new Object[] { key, value },
+ IllegalTypeException.class );
+ }
+ }
+ }
+ }
+
+ private interface CompareEqual
+ {
+ public boolean areEqual( Object _lhs, Object _rhs );
+ };
+
+ private class DefaultCompareEqual implements CompareEqual
+ {
+ public boolean areEqual( Object _lhs, Object _rhs )
+ {
+ return _lhs.equals( _rhs );
+ }
+ };
+
+ private class PairCompareEqual implements CompareEqual
+ {
+ public boolean areEqual( Object _lhs, Object _rhs )
+ {
+ Pair< ?, ? > lhs = (Pair< ?, ? >)_lhs;
+ Pair< ?, ? > rhs = (Pair< ?, ? >)_rhs;
+ return lhs.First.equals( rhs.First ) && lhs.Second.equals( rhs.Second );
+ }
+ };
+
+ @SuppressWarnings("unchecked")
+ private void impl_verifyEnumerationContent( XEnumeration _enum, final Object[] _expectedElements, final String _context )
+ throws com.sun.star.uno.Exception
+ {
+ // since we cannot assume the map to preserve the ordering in which the elements where inserted,
+ // we can only verify that all elements exist as expected, plus *no more* elements than expected
+ // are provided by the enumeration
+ Set set = new HashSet();
+ for ( int i=0; i<_expectedElements.length; ++i )
+ set.add( i );
+
+ CompareEqual comparator = _expectedElements[0].getClass().equals( Pair.class )
+ ? new PairCompareEqual()
+ : new DefaultCompareEqual();
+
+ for ( int i=0; i<_expectedElements.length; ++i )
+ {
+ assure( _context + ": too few elements in the enumeration (still " + ( _expectedElements.length - i ) + " to go)",
+ _enum.hasMoreElements() );
+
+ Object nextElement = _enum.nextElement();
+ if ( nextElement.getClass().equals( Any.class ) )
+ nextElement = ((Any)nextElement).getObject();
+
+ int foundPos = -1;
+ for ( int j=0; j<_expectedElements.length; ++j )
+ {
+ if ( comparator.areEqual( _expectedElements[j], nextElement ) )
+ {
+ foundPos = j;
+ break;
+ }
+ }
+
+ assure( _context + ": '" + nextElement.toString() + "' is not expected in the enumeration",
+ set.contains( foundPos ) );
+ set.remove( foundPos );
+ }
+ assure( _context + ": too many elements returned by the enumeration", set.isEmpty() );
+ }
+
+ public void testEnumerations() throws com.sun.star.uno.Exception
+ {
+ // fill a map
+ final String[] keys = new String[] { "This", "is", "an", "enumeration", "test" };
+ final String[] values = new String[] { "for", "the", "map", "implementation", "." };
+ XEnumerableMap map = com.sun.star.container.EnumerableMap.create( param.getComponentContext(), new Type( String.class ), new Type( String.class ) );
+ impl_putAll( map, keys, values );
+
+ final Pair< ?, ? >[] paired = new Pair< ?, ? >[ keys.length ];
+ for ( int i=0; i<keys.length; ++i )
+ paired[i] = new Pair< Object, Object >( keys[i], values[i] );
+
+ // create non-isolated enumerators, and check their content
+ XEnumeration enumerateKeys = map.createKeyEnumeration( false );
+ XEnumeration enumerateValues = map.createValueEnumeration( false );
+ XEnumeration enumerateAll = map.createElementEnumeration( false );
+ impl_verifyEnumerationContent( enumerateKeys, keys, "key enumeration" );
+ impl_verifyEnumerationContent( enumerateValues, values, "value enumeration" );
+ impl_verifyEnumerationContent( enumerateAll, paired, "content enumeration" );
+
+ // all enumerators above have been created as non-isolated iterators, so they're expected to die when
+ // the underlying map changes
+ map.remove( keys[0] );
+ assureException( enumerateKeys, "hasMoreElements", new Object[] {}, DisposedException.class );
+ assureException( enumerateValues, "hasMoreElements", new Object[] {}, DisposedException.class );
+ assureException( enumerateAll, "hasMoreElements", new Object[] {}, DisposedException.class );
+
+ // now try with isolated iterators
+ map.put( keys[0], values[0] );
+ enumerateKeys = map.createKeyEnumeration( true );
+ enumerateValues = map.createValueEnumeration( true );
+ enumerateAll = map.createElementEnumeration( true );
+ map.put( "additional", "value" );
+ impl_verifyEnumerationContent( enumerateKeys, keys, "key enumeration" );
+ impl_verifyEnumerationContent( enumerateValues, values, "value enumeration" );
+ impl_verifyEnumerationContent( enumerateAll, paired, "content enumeration" );
+ }
+
+ public void testSpecialValues() throws com.sun.star.uno.Exception
+ {
+ final Double[] keys = new Double[] { new Double( 0 ), Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY };
+ final Double[] values = new Double[] { Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, new Double( 0 ) };
+
+ XEnumerableMap map = com.sun.star.container.EnumerableMap.create( param.getComponentContext(), new Type( Double.class ), new Type( Double.class ) );
+ impl_putAll( map, keys, values );
+
+ assure( "containsKey( Double.+INF failed", map.containsKey( Double.POSITIVE_INFINITY ) );
+ assure( "containsKey( Double.-INF failed", map.containsKey( Double.NEGATIVE_INFINITY ) );
+ assure( "containsKey( 0 ) failed", map.containsKey( new Double( 0 ) ) );
+
+ assure( "containsValue( Double.+INF ) failed", map.containsValue( Double.POSITIVE_INFINITY ) );
+ assure( "containsValue( Double.-INF ) failed", map.containsValue( Double.NEGATIVE_INFINITY ) );
+ assure( "containsValue( 0 ) failed", map.containsValue( new Double( 0 ) ) );
+
+ // put and containsKey should reject Double.NaN as key
+ assureException( "Double.NaN should not be allowed as key in a call to 'put'", map, "put",
+ new Class[] { Object.class, Object.class }, new Object[] { Double.NaN, new Double( 0 ) },
+ com.sun.star.lang.IllegalArgumentException.class );
+ assureException( "Double.NaN should not be allowed as key in a call to 'containsKey'", map, "containsKey",
+ new Class[] { Object.class }, new Object[] { Double.NaN },
+ com.sun.star.lang.IllegalArgumentException.class );
+
+ // ditto for put and containsValue
+ assureException( "Double.NaN should not be allowed as value in a call to 'put'", map, "put",
+ new Class[] { Object.class, Object.class }, new Object[] { new Double( 0 ), Double.NaN },
+ com.sun.star.lang.IllegalArgumentException.class );
+ assureException( "Double.NaN should not be allowed as key in a call to 'containsValue'", map, "containsValue",
+ new Class[] { Object.class }, new Object[] { Double.NaN },
+ com.sun.star.lang.IllegalArgumentException.class );
+ }
+}
diff --git a/comphelper/qa/complex/sequenceoutputstream/SequenceOutputStreamUnitTest.java b/comphelper/qa/complex/comphelper/SequenceOutputStreamUnitTest.java
index caa094499486..b5e8a4052897 100644
--- a/comphelper/qa/complex/sequenceoutputstream/SequenceOutputStreamUnitTest.java
+++ b/comphelper/qa/complex/comphelper/SequenceOutputStreamUnitTest.java
@@ -27,11 +27,10 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-package complex.sequenceoutputstream;
+package complex.comphelper;
import complexlib.ComplexTestCase;
import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.uno.UnoRuntime;
/* Document.
*/
@@ -48,6 +47,10 @@ public class SequenceOutputStreamUnitTest extends ComplexTestCase {
return "SequenceOutputStreamUnitTest";
}
+ public static String getShortTestDescription() {
+ return "tests the SequenceOutput/InputStream implementations";
+ }
+
public void before() {
try {
m_xMSF = (XMultiServiceFactory)param.getMSF ();
@@ -64,7 +67,8 @@ public class SequenceOutputStreamUnitTest extends ComplexTestCase {
}
public void ExecuteTest01() {
- SequenceOutputStreamTest aTest = new Test01 (m_xMSF, log);
+ Test01 aTest = new Test01 (m_xMSF, log);
assure ( "Test01 failed!", aTest.test() );
}
+
} \ No newline at end of file
diff --git a/comphelper/qa/complex/sequenceoutputstream/Test01.java b/comphelper/qa/complex/comphelper/Test01.java
index b7e864d981a5..4404a8468734 100644
--- a/comphelper/qa/complex/sequenceoutputstream/Test01.java
+++ b/comphelper/qa/complex/comphelper/Test01.java
@@ -27,21 +27,17 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-package complex.sequenceoutputstream;
-
-import complexlib.ComplexTestCase;
+package complex.comphelper;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.io.XSequenceOutputStream;
import com.sun.star.io.XSeekableInputStream;
-import com.sun.star.io.XOutputStream;
-import com.sun.star.io.XInputStream;
import com.sun.star.uno.UnoRuntime;
import java.util.Random;
import share.LogWriter;
-public class Test01 implements SequenceOutputStreamTest {
+public class Test01 {
XMultiServiceFactory m_xMSF = null;
TestHelper m_aTestHelper = null;
diff --git a/comphelper/qa/complex/sequenceoutputstream/TestHelper.java b/comphelper/qa/complex/comphelper/TestHelper.java
index eac7103a032c..6d88280bb372 100644
--- a/comphelper/qa/complex/sequenceoutputstream/TestHelper.java
+++ b/comphelper/qa/complex/comphelper/TestHelper.java
@@ -27,7 +27,7 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-package complex.sequenceoutputstream;
+package complex.comphelper;
import share.LogWriter;
diff --git a/comphelper/qa/complex/comphelper_all.sce b/comphelper/qa/complex/comphelper_all.sce
new file mode 100644
index 000000000000..63e5276f00ed
--- /dev/null
+++ b/comphelper/qa/complex/comphelper_all.sce
@@ -0,0 +1,2 @@
+-o complex.comphelper.SequenceOutputStreamUnitTest
+-o complex.comphelper.Map
diff --git a/comphelper/qa/complex/sequenceoutputstream/makefile.mk b/comphelper/qa/complex/makefile.mk
index 69e78936cf0a..d0e8a078e2c7 100644
--- a/comphelper/qa/complex/sequenceoutputstream/makefile.mk
+++ b/comphelper/qa/complex/makefile.mk
@@ -8,7 +8,7 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.3.48.1 $
+# $Revision: 1.2.20.2 $
#
# This file is part of OpenOffice.org.
#
@@ -29,61 +29,73 @@
#
#*************************************************************************
-PRJ = ..$/..$/..
-TARGET = SequenceOutputStreamUnitTest
+PRJ = ..$/..
+TARGET = ComphelperComplexTests
PRJNAME = comphelper
-PACKAGE = complex$/sequenceoutputstream
# --- Settings -----------------------------------------------------
.INCLUDE: settings.mk
-#----- compile .java files -----------------------------------------
-
-JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar
+.IF "$(BUILD_QADEVOOO)" == "YES"
-JAVAFILES =\
- SequenceOutputStreamUnitTest.java\
- SequenceOutputStreamTest.java\
- Test01.java\
- TestHelper.java\
+#----- compile .java files -----------------------------------------
-JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+JARFILES := ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar
+JAVAFILES := $(shell @$(FIND) . -name "*.java")
+JAVACLASSFILES := $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(i:d)$/$(i:b).class)
#----- make a jar from compiled files ------------------------------
MAXLINELENGTH = 100000
-JARCLASSDIRS = $(PACKAGE)
+#JARCLASSDIRS =
JARTARGET = $(TARGET).jar
JARCOMPRESS = TRUE
-# --- Parameters for the test --------------------------------------
+# --- Runner Settings ----------------------------------------------
+
+# classpath and argument list
+RUNNER_CLASSPATH = -cp $(CLASSPATH)$(PATH_SEPERATOR)$(SOLARBINDIR)$/OOoRunner.jar
# start an office if the parameter is set for the makefile
.IF "$(OFFICE)" == ""
-CT_APPEXECCOMMAND =
+RUNNER_APPEXECCOMMAND =
.ELSE
-CT_APPEXECCOMMAND = -AppExecutionCommand "$(OFFICE)$/soffice -accept=socket,host=localhost,port=8100;urp;"
+RUNNER_APPEXECCOMMAND = -AppExecutionCommand "$(OFFICE)$/soffice -accept=socket,host=localhost,port=8100;urp;"
.ENDIF
-# test base is java complex
-CT_TESTBASE = -TestBase java_complex
-
-# test looks something like the.full.package.TestName
-CT_TEST = -o $(PACKAGE:s\$/\.\).$(JAVAFILES:b)
+RUNNER_ARGS = org.openoffice.Runner -TestBase java_complex $(RUNNER_APPEXECCOMMAND)
-# start the runner application
-CT_APP = org.openoffice.Runner
+.END # "$(BUILD_QADEVOOO)" == "YES"
# --- Targets ------------------------------------------------------
-.INCLUDE: target.mk
+.IF "$(depend)" == ""
+ALL : ALLTAR
+ @echo -----------------------------------------------------
+ @echo - do a 'dmake show_targets' to show available targets
+ @echo -----------------------------------------------------
+.ELSE
+ALL: ALLDEP
+.ENDIF
+
+.INCLUDE : target.mk
-RUN: run
+.IF "$(BUILD_QADEVOOO)" == "YES"
+show_targets:
+ +@java $(RUNNER_CLASSPATH) complexlib.ShowTargets $(foreach,i,$(JAVAFILES) $(i:s#.java##:s#./#complex.#))
run:
- +java -cp $(CLASSPATH) $(CT_APP) $(CT_TESTBASE) $(CT_APPEXECCOMMAND) $(CT_TEST)
+ +java $(RUNNER_CLASSPATH) $(RUNNER_ARGS) -sce comphelper_all.sce
+run_%:
+ +java $(RUNNER_CLASSPATH) $(RUNNER_ARGS) -o complex.$(PRJNAME).$(@:s/run_//)
+.ELSE
+run: show_targets
+show_targets:
+ +@echo "Built without qadevOOo, no QA tests"
+
+.ENDIF
diff --git a/comphelper/qa/complex/sequenceoutputstream/SequenceOutputStreamTest.java b/comphelper/qa/complex/sequenceoutputstream/SequenceOutputStreamTest.java
deleted file mode 100644
index e2acd0dd1322..000000000000
--- a/comphelper/qa/complex/sequenceoutputstream/SequenceOutputStreamTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: SequenceOutputStreamTest.java,v $
- * $Revision: 1.3 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-package complex.sequenceoutputstream;
-
-public interface SequenceOutputStreamTest {
- boolean test();
-} \ No newline at end of file
diff --git a/comphelper/source/compare/AnyCompareFactory.cxx b/comphelper/source/compare/AnyCompareFactory.cxx
index e5713c6ece46..c77aaf75f5a8 100644
--- a/comphelper/source/compare/AnyCompareFactory.cxx
+++ b/comphelper/source/compare/AnyCompareFactory.cxx
@@ -31,6 +31,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_comphelper.hxx"
+#include "comphelper_module.hxx"
#include <com/sun/star/ucb/XAnyCompareFactory.hpp>
#include <com/sun/star/i18n/XCollator.hpp>
@@ -44,9 +45,7 @@
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
#include <comphelper/stl_types.hxx>
-#ifndef __SGI_STL_MAP
#include <map>
-#endif
using namespace com::sun::star::uno;
@@ -81,11 +80,6 @@ public:
//=============================================================================
-Sequence< rtl::OUString > SAL_CALL AnyCompareFactory_getSupportedServiceNames() throw();
-rtl::OUString SAL_CALL AnyCompareFactory_getImplementationName() throw();
-Reference< XInterface > SAL_CALL AnyCompareFactory_createInstance(
- const Reference< XComponentContext >& rxContext ) throw( Exception );
-
class AnyCompareFactory : public cppu::WeakImplHelper3< XAnyCompareFactory, XInitialization, XServiceInfo >
{
Reference< XAnyCompare > m_rAnyCompare;
@@ -107,6 +101,11 @@ public:
virtual OUString SAL_CALL getImplementationName( ) throw(RuntimeException);
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException);
virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(RuntimeException);
+
+ // XServiceInfo - static versions (used for component registration)
+ static ::rtl::OUString SAL_CALL getImplementationName_static();
+ static Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static();
+ static Reference< XInterface > SAL_CALL Create( const Reference< XComponentContext >& );
};
//===========================================================================================
@@ -157,7 +156,12 @@ void SAL_CALL AnyCompareFactory::initialize( const Sequence< Any >& aArguments )
OUString SAL_CALL AnyCompareFactory::getImplementationName( ) throw( RuntimeException )
{
- return AnyCompareFactory_getImplementationName();
+ return getImplementationName_static();
+}
+
+OUString SAL_CALL AnyCompareFactory::getImplementationName_static( )
+{
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AnyCompareFactory" ) );
}
sal_Bool SAL_CALL AnyCompareFactory::supportsService( const OUString& ServiceName ) throw(RuntimeException)
@@ -168,24 +172,23 @@ sal_Bool SAL_CALL AnyCompareFactory::supportsService( const OUString& ServiceNam
Sequence< OUString > SAL_CALL AnyCompareFactory::getSupportedServiceNames( ) throw(RuntimeException)
{
- return AnyCompareFactory_getSupportedServiceNames();
+ return getSupportedServiceNames_static();
}
-
-Sequence< rtl::OUString > SAL_CALL AnyCompareFactory_getSupportedServiceNames() throw()
+Sequence< OUString > SAL_CALL AnyCompareFactory::getSupportedServiceNames_static( )
{
const rtl::OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.AnyCompareFactory" ) );
const Sequence< rtl::OUString > aSeq( &aServiceName, 1 );
return aSeq;
}
-rtl::OUString SAL_CALL AnyCompareFactory_getImplementationName() throw()
+Reference< XInterface > SAL_CALL AnyCompareFactory::Create(
+ const Reference< XComponentContext >& rxContext )
{
- return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AnyCompareFactory" ) );
+ return (cppu::OWeakObject*)new AnyCompareFactory( rxContext );
}
-Reference< XInterface > SAL_CALL AnyCompareFactory_createInstance(
- const Reference< XComponentContext >& rxContext ) throw( Exception )
+void createRegistryInfo_AnyCompareFactory()
{
- return (cppu::OWeakObject*)new AnyCompareFactory( rxContext );
+ static ::comphelper::module::OAutoRegistration< AnyCompareFactory > aAutoRegistration;
}
diff --git a/comphelper/source/container/IndexedPropertyValuesContainer.cxx b/comphelper/source/container/IndexedPropertyValuesContainer.cxx
index 10d6143f2eaa..a9f413bc46e1 100644
--- a/comphelper/source/container/IndexedPropertyValuesContainer.cxx
+++ b/comphelper/source/container/IndexedPropertyValuesContainer.cxx
@@ -31,9 +31,9 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_comphelper.hxx"
-#ifndef _COM_SUN_STAR_CONTAINER_XIndexCONTAINER_HPP_
+#include "comphelper_module.hxx"
+
#include <com/sun/star/container/XIndexContainer.hpp>
-#endif
#include <com/sun/star/uno/Sequence.h>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <cppuhelper/implbase2.hxx>
@@ -49,11 +49,6 @@ using namespace com::sun::star;
typedef std::vector < uno::Sequence< beans::PropertyValue > > IndexedPropertyValues;
-uno::Sequence< rtl::OUString > SAL_CALL IndexedPropertyValuesContainer_getSupportedServiceNames() throw();
-rtl::OUString SAL_CALL IndexedPropertyValuesContainer_getImplementationName() throw();
-uno::Reference< uno::XInterface > SAL_CALL IndexedPropertyValuesContainer_createInstance(
- const uno::Reference< uno::XComponentContext > & rxContext ) throw( uno::Exception );
-
class IndexedPropertyValuesContainer : public cppu::WeakImplHelper2< container::XIndexContainer, lang::XServiceInfo >
{
public:
@@ -91,6 +86,11 @@ public:
virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+ // XServiceInfo - static versions (used for component registration)
+ static ::rtl::OUString SAL_CALL getImplementationName_static();
+ static uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static();
+ static uno::Reference< uno::XInterface > SAL_CALL Create( const uno::Reference< uno::XComponentContext >& );
+
private:
IndexedPropertyValues maProperties;
};
@@ -233,7 +233,12 @@ sal_Bool SAL_CALL IndexedPropertyValuesContainer::hasElements( )
//XServiceInfo
::rtl::OUString SAL_CALL IndexedPropertyValuesContainer::getImplementationName( ) throw(::com::sun::star::uno::RuntimeException)
{
- return IndexedPropertyValuesContainer_getImplementationName();
+ return getImplementationName_static();
+}
+
+::rtl::OUString SAL_CALL IndexedPropertyValuesContainer::getImplementationName_static( )
+{
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IndexedPropertyValuesContainer" ) );
}
sal_Bool SAL_CALL IndexedPropertyValuesContainer::supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException)
@@ -244,25 +249,25 @@ sal_Bool SAL_CALL IndexedPropertyValuesContainer::supportsService( const ::rtl::
::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL IndexedPropertyValuesContainer::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException)
{
- return IndexedPropertyValuesContainer_getSupportedServiceNames();
+ return getSupportedServiceNames_static();
}
-uno::Sequence< rtl::OUString > SAL_CALL IndexedPropertyValuesContainer_getSupportedServiceNames() throw()
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL IndexedPropertyValuesContainer::getSupportedServiceNames_static( )
{
const rtl::OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.IndexedPropertyValues" ) );
const uno::Sequence< rtl::OUString > aSeq( &aServiceName, 1 );
return aSeq;
}
-rtl::OUString SAL_CALL IndexedPropertyValuesContainer_getImplementationName() throw()
-{
- return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IndexedPropertyValuesContainer" ) );
-}
-uno::Reference< uno::XInterface > SAL_CALL IndexedPropertyValuesContainer_createInstance(
- const uno::Reference< uno::XComponentContext >&) throw( uno::Exception )
+uno::Reference< uno::XInterface > SAL_CALL IndexedPropertyValuesContainer::Create(
+ const uno::Reference< uno::XComponentContext >&)
{
return (cppu::OWeakObject*)new IndexedPropertyValuesContainer();
}
+void createRegistryInfo_IndexedPropertyValuesContainer()
+{
+ static ::comphelper::module::OAutoRegistration< IndexedPropertyValuesContainer > aAutoRegistration;
+}
diff --git a/comphelper/source/container/NamedPropertyValuesContainer.cxx b/comphelper/source/container/NamedPropertyValuesContainer.cxx
index 269fa05de56b..99a33bb8470e 100644
--- a/comphelper/source/container/NamedPropertyValuesContainer.cxx
+++ b/comphelper/source/container/NamedPropertyValuesContainer.cxx
@@ -31,6 +31,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_comphelper.hxx"
+#include "comphelper_module.hxx"
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/uno/Sequence.h>
@@ -48,11 +49,6 @@ using namespace com::sun::star;
DECLARE_STL_USTRINGACCESS_MAP( uno::Sequence<beans::PropertyValue>, NamedPropertyValues );
-uno::Sequence< rtl::OUString > SAL_CALL NamedPropertyValuesContainer_getSupportedServiceNames() throw();
-rtl::OUString SAL_CALL NamedPropertyValuesContainer_getImplementationName() throw();
-uno::Reference< uno::XInterface > SAL_CALL NamedPropertyValuesContainer_createInstance(
- const uno::Reference< uno::XComponentContext > & rxContext ) throw( uno::Exception );
-
class NamedPropertyValuesContainer : public cppu::WeakImplHelper2< container::XNameContainer, lang::XServiceInfo >
{
public:
@@ -92,6 +88,11 @@ public:
virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+ // XServiceInfo - static versions (used for component registration)
+ static ::rtl::OUString SAL_CALL getImplementationName_static();
+ static uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static();
+ static uno::Reference< uno::XInterface > SAL_CALL Create( const uno::Reference< uno::XComponentContext >& );
+
private:
NamedPropertyValues maProperties;
};
@@ -202,7 +203,12 @@ sal_Bool SAL_CALL NamedPropertyValuesContainer::hasElements( )
//XServiceInfo
::rtl::OUString SAL_CALL NamedPropertyValuesContainer::getImplementationName( ) throw(::com::sun::star::uno::RuntimeException)
{
- return NamedPropertyValuesContainer_getImplementationName();
+ return getImplementationName_static();
+}
+
+::rtl::OUString SAL_CALL NamedPropertyValuesContainer::getImplementationName_static( )
+{
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NamedPropertyValuesContainer" ) );
}
sal_Bool SAL_CALL NamedPropertyValuesContainer::supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException)
@@ -213,25 +219,24 @@ sal_Bool SAL_CALL NamedPropertyValuesContainer::supportsService( const ::rtl::OU
::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL NamedPropertyValuesContainer::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException)
{
- return NamedPropertyValuesContainer_getSupportedServiceNames();
+ return getSupportedServiceNames_static();
}
-uno::Sequence< rtl::OUString > SAL_CALL NamedPropertyValuesContainer_getSupportedServiceNames() throw()
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL NamedPropertyValuesContainer::getSupportedServiceNames_static( )
{
const rtl::OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.NamedPropertyValues" ) );
const uno::Sequence< rtl::OUString > aSeq( &aServiceName, 1 );
return aSeq;
}
-rtl::OUString SAL_CALL NamedPropertyValuesContainer_getImplementationName() throw()
+uno::Reference< uno::XInterface > SAL_CALL NamedPropertyValuesContainer::Create(
+ const uno::Reference< uno::XComponentContext >&)
{
- return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NamedPropertyValuesContainer" ) );
+ return (cppu::OWeakObject*)new NamedPropertyValuesContainer();
}
-uno::Reference< uno::XInterface > SAL_CALL NamedPropertyValuesContainer_createInstance(
- const uno::Reference< uno::XComponentContext >&) throw( uno::Exception )
+void createRegistryInfo_NamedPropertyValuesContainer()
{
- return (cppu::OWeakObject*)new NamedPropertyValuesContainer();
+ static ::comphelper::module::OAutoRegistration< NamedPropertyValuesContainer > aAutoRegistration;
}
-
diff --git a/comphelper/source/container/enumerablemap.cxx b/comphelper/source/container/enumerablemap.cxx
new file mode 100644
index 000000000000..c7179ff07b91
--- /dev/null
+++ b/comphelper/source/container/enumerablemap.cxx
@@ -0,0 +1,999 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org 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 version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_comphelper.hxx"
+
+#include "comphelper_module.hxx"
+#include "comphelper/anytostring.hxx"
+#include "comphelper/componentbase.hxx"
+#include "comphelper/componentcontext.hxx"
+#include "comphelper/extract.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/container/XEnumerableMap.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/ucb/AlreadyInitializedException.hpp>
+#include <com/sun/star/beans/Pair.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+/** === end UNO includes === **/
+
+#include <cppuhelper/compbase3.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <rtl/math.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <typelib/typedescription.hxx>
+
+#include <functional>
+#include <map>
+#include <memory>
+#include <boost/shared_ptr.hpp>
+
+//........................................................................
+namespace comphelper
+{
+//........................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::container::XEnumerableMap;
+ using ::com::sun::star::lang::NoSupportException;
+ using ::com::sun::star::beans::IllegalTypeException;
+ using ::com::sun::star::container::NoSuchElementException;
+ using ::com::sun::star::lang::IllegalArgumentException;
+ using ::com::sun::star::lang::XInitialization;
+ using ::com::sun::star::ucb::AlreadyInitializedException;
+ using ::com::sun::star::beans::Pair;
+ using ::com::sun::star::uno::TypeClass;
+ using ::com::sun::star::uno::TypeClass_VOID;
+ using ::com::sun::star::uno::TypeClass_CHAR;
+ using ::com::sun::star::uno::TypeClass_BOOLEAN;
+ using ::com::sun::star::uno::TypeClass_BYTE;
+ using ::com::sun::star::uno::TypeClass_SHORT;
+ using ::com::sun::star::uno::TypeClass_UNSIGNED_SHORT;
+ using ::com::sun::star::uno::TypeClass_LONG;
+ using ::com::sun::star::uno::TypeClass_UNSIGNED_LONG;
+ using ::com::sun::star::uno::TypeClass_HYPER;
+ using ::com::sun::star::uno::TypeClass_UNSIGNED_HYPER;
+ using ::com::sun::star::uno::TypeClass_FLOAT;
+ using ::com::sun::star::uno::TypeClass_DOUBLE;
+ using ::com::sun::star::uno::TypeClass_STRING;
+ using ::com::sun::star::uno::TypeClass_TYPE;
+ using ::com::sun::star::uno::TypeClass_ENUM;
+ using ::com::sun::star::uno::TypeClass_INTERFACE;
+ using ::com::sun::star::uno::TypeClass_UNKNOWN;
+ using ::com::sun::star::uno::TypeClass_ANY;
+ using ::com::sun::star::uno::TypeClass_EXCEPTION;
+ using ::com::sun::star::uno::TypeClass_STRUCT;
+ using ::com::sun::star::uno::TypeClass_UNION;
+ using ::com::sun::star::lang::XServiceInfo;
+ using ::com::sun::star::uno::XComponentContext;
+ using ::com::sun::star::container::XEnumeration;
+ using ::com::sun::star::uno::TypeDescription;
+ using ::com::sun::star::lang::WrappedTargetException;
+ using ::com::sun::star::lang::DisposedException;
+ /** === end UNO using === **/
+
+ //====================================================================
+ //= IKeyPredicateLess
+ //====================================================================
+ class SAL_NO_VTABLE IKeyPredicateLess
+ {
+ public:
+ virtual bool isLess( const Any& _lhs, const Any& _rhs ) const = 0;
+ virtual ~IKeyPredicateLess() {}
+ };
+
+ //====================================================================
+ //= LessPredicateAdapter
+ //====================================================================
+ struct LessPredicateAdapter : public ::std::binary_function< Any, Any, bool >
+ {
+ LessPredicateAdapter( const IKeyPredicateLess& _predicate )
+ :m_predicate( _predicate )
+ {
+ }
+
+ bool operator()( const Any& _lhs, const Any& _rhs ) const
+ {
+ return m_predicate.isLess( _lhs, _rhs );
+ }
+
+ private:
+ const IKeyPredicateLess& m_predicate;
+
+ private:
+ LessPredicateAdapter(); // never implemented
+ };
+
+ //====================================================================
+ //= ScalarPredicateLess
+ //====================================================================
+ template< typename SCALAR >
+ class ScalarPredicateLess : public IKeyPredicateLess
+ {
+ public:
+ virtual bool isLess( const Any& _lhs, const Any& _rhs ) const
+ {
+ SCALAR lhs(0), rhs(0);
+ if ( !( _lhs >>= lhs )
+ || !( _rhs >>= rhs )
+ )
+ throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unsupported key type." ) ), NULL, 1 );
+ return lhs < rhs;
+ }
+ };
+
+ //====================================================================
+ //= StringPredicateLess
+ //====================================================================
+ class StringPredicateLess : public IKeyPredicateLess
+ {
+ public:
+ virtual bool isLess( const Any& _lhs, const Any& _rhs ) const
+ {
+ ::rtl::OUString lhs, rhs;
+ if ( !( _lhs >>= lhs )
+ || !( _rhs >>= rhs )
+ )
+ throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unsupported key type." ) ), NULL, 1 );
+ return lhs < rhs;
+ }
+ };
+
+ //====================================================================
+ //= TypePredicateLess
+ //====================================================================
+ class TypePredicateLess : public IKeyPredicateLess
+ {
+ public:
+ virtual bool isLess( const Any& _lhs, const Any& _rhs ) const
+ {
+ Type lhs, rhs;
+ if ( !( _lhs >>= lhs )
+ || !( _rhs >>= rhs )
+ )
+ throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unsupported key type." ) ), NULL, 1 );
+ return lhs.getTypeName() < rhs.getTypeName();
+ }
+ };
+
+ //====================================================================
+ //= EnumPredicateLess
+ //====================================================================
+ class EnumPredicateLess : public IKeyPredicateLess
+ {
+ public:
+ EnumPredicateLess( const Type& _enumType )
+ :m_enumType( _enumType )
+ {
+ }
+
+ virtual bool isLess( const Any& _lhs, const Any& _rhs ) const
+ {
+ sal_Int32 lhs(0), rhs(0);
+ if ( !::cppu::enum2int( lhs, _lhs )
+ || !::cppu::enum2int( rhs, _rhs )
+ || !_lhs.getValueType().equals( m_enumType )
+ || !_rhs.getValueType().equals( m_enumType )
+ )
+ throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unsupported key type." ) ), NULL, 1 );
+ return lhs < rhs;
+ }
+
+ private:
+ const Type m_enumType;
+ };
+
+ //====================================================================
+ //= InterfacePredicateLess
+ //====================================================================
+ class InterfacePredicateLess : public IKeyPredicateLess
+ {
+ public:
+ virtual bool isLess( const Any& _lhs, const Any& _rhs ) const
+ {
+ if ( ( _lhs.getValueTypeClass() != TypeClass_INTERFACE )
+ || ( _rhs.getValueTypeClass() != TypeClass_INTERFACE )
+ )
+ throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unsupported key type." ) ), NULL, 1 );
+
+ Reference< XInterface > lhs( _lhs, UNO_QUERY );
+ Reference< XInterface > rhs( _rhs, UNO_QUERY );
+ return lhs.get() < rhs.get();
+ }
+ };
+
+ //====================================================================
+ //= MapData
+ //====================================================================
+ class IMapModificationListener;
+ typedef ::std::vector< IMapModificationListener* > MapListeners;
+
+ typedef ::std::map< Any, Any, LessPredicateAdapter > KeyedValues;
+ struct MapData
+ {
+ Type m_aKeyType;
+ Type m_aValueType;
+ ::std::auto_ptr< KeyedValues > m_pValues;
+ ::boost::shared_ptr< IKeyPredicateLess > m_pKeyCompare;
+ bool m_bMutable;
+ MapListeners m_aModListeners;
+
+ MapData()
+ :m_bMutable( true )
+ {
+ }
+
+ MapData( const MapData& _source )
+ :m_aKeyType( _source.m_aKeyType )
+ ,m_aValueType( _source.m_aValueType )
+ ,m_pValues( new KeyedValues( *_source.m_pValues ) )
+ ,m_pKeyCompare( _source.m_pKeyCompare )
+ ,m_bMutable( false )
+ ,m_aModListeners()
+ {
+ }
+ private:
+ MapData& operator=( const MapData& _source ); // not implemented
+ };
+
+ //====================================================================
+ //= IMapModificationListener
+ //====================================================================
+ /** implemented by components who want to be notified of modifications in the MapData they work with
+ */
+ class SAL_NO_VTABLE IMapModificationListener
+ {
+ public:
+ /// called when the map was modified
+ virtual void mapModified() = 0;
+ virtual ~IMapModificationListener()
+ {
+ }
+ };
+
+ //====================================================================
+ //= MapData helpers
+ //====================================================================
+ //--------------------------------------------------------------------
+ static void lcl_registerMapModificationListener( MapData& _mapData, IMapModificationListener& _listener )
+ {
+ #if OSL_DEBUG_LEVEL > 0
+ for ( MapListeners::const_iterator lookup = _mapData.m_aModListeners.begin();
+ lookup != _mapData.m_aModListeners.end();
+ ++lookup
+ )
+ {
+ OSL_ENSURE( *lookup != &_listener, "lcl_registerMapModificationListener: this listener is already registered!" );
+ }
+ #endif
+ _mapData.m_aModListeners.push_back( &_listener );
+ }
+
+ //--------------------------------------------------------------------
+ static void lcl_revokeMapModificationListener( MapData& _mapData, IMapModificationListener& _listener )
+ {
+ for ( MapListeners::iterator lookup = _mapData.m_aModListeners.begin();
+ lookup != _mapData.m_aModListeners.end();
+ ++lookup
+ )
+ {
+ if ( *lookup == &_listener )
+ {
+ _mapData.m_aModListeners.erase( lookup );
+ return;
+ }
+ }
+ OSL_ENSURE( false, "lcl_revokeMapModificationListener: the listener is not registered!" );
+ }
+
+ //--------------------------------------------------------------------
+ static void lcl_notifyMapDataListeners_nothrow( const MapData& _mapData )
+ {
+ for ( MapListeners::const_iterator loop = _mapData.m_aModListeners.begin();
+ loop != _mapData.m_aModListeners.end();
+ ++loop
+ )
+ {
+ (*loop)->mapModified();
+ }
+ }
+
+ //====================================================================
+ //= EnumerableMap
+ //====================================================================
+ typedef ::cppu::WeakAggComponentImplHelper3 < XInitialization
+ , XEnumerableMap
+ , XServiceInfo
+ > Map_IFace;
+
+ class COMPHELPER_DLLPRIVATE EnumerableMap :public Map_IFace
+ ,public ComponentBase
+ {
+ protected:
+ EnumerableMap( const ComponentContext& _rContext );
+ virtual ~EnumerableMap();
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException);
+
+ // XEnumerableMap
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createKeyEnumeration( ::sal_Bool _Isolated ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createValueEnumeration( ::sal_Bool _Isolated ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createElementEnumeration( ::sal_Bool _Isolated ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
+
+ // XMap
+ virtual Type SAL_CALL getKeyType() throw (RuntimeException);
+ virtual Type SAL_CALL getValueType() throw (RuntimeException);
+ virtual void SAL_CALL clear( ) throw (NoSupportException, RuntimeException);
+ virtual ::sal_Bool SAL_CALL containsKey( const Any& _key ) throw (IllegalTypeException, IllegalArgumentException, RuntimeException);
+ virtual ::sal_Bool SAL_CALL containsValue( const Any& _value ) throw (IllegalTypeException, IllegalArgumentException, RuntimeException);
+ virtual Any SAL_CALL get( const Any& _key ) throw (IllegalTypeException, IllegalArgumentException, NoSuchElementException, RuntimeException);
+ virtual Any SAL_CALL put( const Any& _key, const Any& _value ) throw (NoSupportException, IllegalTypeException, IllegalArgumentException, RuntimeException);
+ virtual Any SAL_CALL remove( const Any& _key ) throw (NoSupportException, IllegalTypeException, IllegalArgumentException, NoSuchElementException, RuntimeException);
+
+ // XElementAccess (base of XMap)
+ virtual Type SAL_CALL getElementType() throw (RuntimeException);
+ virtual ::sal_Bool SAL_CALL hasElements() throw (RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (RuntimeException);
+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException);
+ virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException);
+
+ public:
+ // XServiceInfo, static version (used for component registration)
+ static ::rtl::OUString SAL_CALL getImplementationName_static( );
+ static Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static( );
+ static Reference< XInterface > SAL_CALL Create( const Reference< XComponentContext >& );
+
+ private:
+ void impl_initValues_throw( const Sequence< Pair< Any, Any > >& _initialValues );
+
+ /// throws a IllegalTypeException if the given value is not compatible with our ValueType
+ void impl_checkValue_throw( const Any& _value ) const;
+ void impl_checkKey_throw( const Any& _key ) const;
+ void impl_checkNaN_throw( const Any& _keyOrValue, const Type& _keyOrValueType ) const;
+ void impl_checkMutable_throw() const;
+
+ private:
+ ::osl::Mutex m_aMutex;
+ ComponentContext m_aContext;
+ MapData m_aData;
+
+ ::std::vector< ::com::sun::star::uno::WeakReference< XInterface > >
+ m_aDependentComponents;
+ };
+
+ //====================================================================
+ //= EnumerationType
+ //====================================================================
+ enum EnumerationType
+ {
+ eKeys, eValues, eBoth
+ };
+
+ //====================================================================
+ //= MapEnumerator
+ //====================================================================
+ class MapEnumerator : public IMapModificationListener
+ {
+ public:
+ MapEnumerator( ::cppu::OWeakObject& _rParent, MapData& _mapData, const EnumerationType _type )
+ :m_rParent( _rParent )
+ ,m_rMapData( _mapData )
+ ,m_eType( _type )
+ ,m_mapPos( _mapData.m_pValues->begin() )
+ ,m_disposed( false )
+ {
+ lcl_registerMapModificationListener( m_rMapData, *this );
+ }
+
+ virtual ~MapEnumerator()
+ {
+ dispose();
+ }
+
+ void dispose()
+ {
+ if ( !m_disposed )
+ {
+ lcl_revokeMapModificationListener( m_rMapData, *this );
+ m_disposed = true;
+ }
+ }
+
+ // XEnumeration equivalents
+ ::sal_Bool hasMoreElements();
+ Any nextElement();
+
+ // IMapModificationListener
+ virtual void mapModified();
+
+ private:
+ ::cppu::OWeakObject& m_rParent;
+ MapData& m_rMapData;
+ const EnumerationType m_eType;
+ KeyedValues::const_iterator m_mapPos;
+ bool m_disposed;
+
+ private:
+ MapEnumerator(); // not implemented
+ MapEnumerator( const MapEnumerator& ); // not implemented
+ MapEnumerator& operator=( const MapEnumerator& ); // not implemented
+ };
+
+ //====================================================================
+ //= MapEnumeration
+ //====================================================================
+ typedef ::cppu::WeakImplHelper1 < XEnumeration
+ > MapEnumeration_Base;
+ class MapEnumeration :public ComponentBase
+ ,public MapEnumeration_Base
+ {
+ public:
+ MapEnumeration( ::cppu::OWeakObject& _parentMap, MapData& _mapData, ::cppu::OBroadcastHelper& _rBHelper,
+ const EnumerationType _type, const bool _isolated )
+ :ComponentBase( _rBHelper, ComponentBase::NoInitializationNeeded() )
+ ,m_xKeepMapAlive( _parentMap )
+ ,m_pMapDataCopy( _isolated ? new MapData( _mapData ) : NULL )
+ ,m_aEnumerator( *this, _isolated ? *m_pMapDataCopy : _mapData, _type )
+ {
+ }
+
+ // XEnumeration
+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (RuntimeException);
+ virtual Any SAL_CALL nextElement( ) throw (NoSuchElementException, WrappedTargetException, RuntimeException);
+
+ protected:
+ virtual ~MapEnumeration()
+ {
+ acquire();
+ {
+ ::osl::MutexGuard aGuard( getMutex() );
+ m_aEnumerator.dispose();
+ m_pMapDataCopy.reset();
+ }
+ }
+
+ private:
+ // sicne we share our mutex with the main map, we need to keep it alive as long as we live
+ Reference< XInterface > m_xKeepMapAlive;
+ ::std::auto_ptr< MapData > m_pMapDataCopy;
+ MapEnumerator m_aEnumerator;
+ };
+
+ //====================================================================
+ //= EnumerableMap
+ //====================================================================
+ //--------------------------------------------------------------------
+ EnumerableMap::EnumerableMap( const ComponentContext& _rContext )
+ :Map_IFace( m_aMutex )
+ ,ComponentBase( Map_IFace::rBHelper )
+ ,m_aContext( _rContext )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ EnumerableMap::~EnumerableMap()
+ {
+ if ( !impl_isDisposed() )
+ {
+ acquire();
+ dispose();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL EnumerableMap::initialize( const Sequence< Any >& _arguments ) throw (Exception, RuntimeException)
+ {
+ ComponentMethodGuard aGuard( *this, ComponentMethodGuard::WithoutInit );
+ if ( impl_isInitialized_nothrow() )
+ throw AlreadyInitializedException();
+
+ sal_Int32 nArgumentCount = _arguments.getLength();
+ if ( ( nArgumentCount != 2 ) && ( nArgumentCount != 3 ) )
+ throw IllegalArgumentException();
+
+ Type aKeyType, aValueType;
+ if ( !( _arguments[0] >>= aKeyType ) )
+ throw IllegalArgumentException( ::rtl::OUString::createFromAscii( "com.sun.star.uno.Type expected." ), *this, 1 );
+ if ( !( _arguments[1] >>= aValueType ) )
+ throw IllegalArgumentException( ::rtl::OUString::createFromAscii( "com.sun.star.uno.Type expected." ), *this, 2 );
+
+ Sequence< Pair< Any, Any > > aInitialValues;
+ bool bMutable = true;
+ if ( nArgumentCount == 3 )
+ {
+ if ( !( _arguments[2] >>= aInitialValues ) )
+ throw IllegalArgumentException( ::rtl::OUString::createFromAscii( "[]com.sun.star.beans.Pair<any,any> expected." ), *this, 2 );
+ bMutable = false;
+ }
+
+ // for the value, anything is allowed, except VOID
+ if ( ( aValueType.getTypeClass() == TypeClass_VOID ) || ( aValueType.getTypeClass() == TypeClass_UNKNOWN ) )
+ throw IllegalTypeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unsupported value type." ) ), *this );
+
+ // create the comparator for the KeyType, and throw if the type is not supported
+ TypeClass eKeyTypeClass = aKeyType.getTypeClass();
+ ::std::auto_ptr< IKeyPredicateLess > pComparator;
+ switch ( eKeyTypeClass )
+ {
+ case TypeClass_CHAR:
+ pComparator.reset( new ScalarPredicateLess< sal_Unicode >() );
+ break;
+ case TypeClass_BOOLEAN:
+ pComparator.reset( new ScalarPredicateLess< sal_Bool >() );
+ break;
+ case TypeClass_BYTE:
+ pComparator.reset( new ScalarPredicateLess< sal_Int8 >() );
+ break;
+ case TypeClass_SHORT:
+ pComparator.reset( new ScalarPredicateLess< sal_Int16 >() );
+ break;
+ case TypeClass_UNSIGNED_SHORT:
+ pComparator.reset( new ScalarPredicateLess< sal_uInt16 >() );
+ break;
+ case TypeClass_LONG:
+ pComparator.reset( new ScalarPredicateLess< sal_Int32 >() );
+ break;
+ case TypeClass_UNSIGNED_LONG:
+ pComparator.reset( new ScalarPredicateLess< sal_uInt32 >() );
+ break;
+ case TypeClass_HYPER:
+ pComparator.reset( new ScalarPredicateLess< sal_Int64 >() );
+ break;
+ case TypeClass_UNSIGNED_HYPER:
+ pComparator.reset( new ScalarPredicateLess< sal_uInt64 >() );
+ break;
+ case TypeClass_FLOAT:
+ pComparator.reset( new ScalarPredicateLess< float >() );
+ break;
+ case TypeClass_DOUBLE:
+ pComparator.reset( new ScalarPredicateLess< double >() );
+ break;
+ case TypeClass_STRING:
+ pComparator.reset( new StringPredicateLess() );
+ break;
+ case TypeClass_TYPE:
+ pComparator.reset( new TypePredicateLess() );
+ break;
+ case TypeClass_ENUM:
+ pComparator.reset( new EnumPredicateLess( aKeyType ) );
+ break;
+ case TypeClass_INTERFACE:
+ pComparator.reset( new InterfacePredicateLess() );
+ break;
+ default:
+ throw IllegalTypeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unsupported key type." ) ), *this );
+ }
+
+ // init members
+ m_aData.m_aKeyType = aKeyType;
+ m_aData.m_aValueType = aValueType;
+ m_aData.m_pKeyCompare = pComparator;
+ m_aData.m_pValues.reset( new KeyedValues( *m_aData.m_pKeyCompare ) );
+ m_aData.m_bMutable = bMutable;
+
+ if ( aInitialValues.getLength() )
+ impl_initValues_throw( aInitialValues );
+
+ setInitialized();
+ }
+
+ //--------------------------------------------------------------------
+ void EnumerableMap::impl_initValues_throw( const Sequence< Pair< Any, Any > >& _initialValues )
+ {
+ OSL_PRECOND( m_aData.m_pValues.get() && m_aData.m_pValues->empty(), "EnumerableMap::impl_initValues_throw: illegal call!" );
+ if ( !m_aData.m_pValues.get() || !m_aData.m_pValues->empty() )
+ throw RuntimeException();
+
+ const Pair< Any, Any >* mapping = _initialValues.getConstArray();
+ const Pair< Any, Any >* mappingEnd = mapping + _initialValues.getLength();
+ Any normalizedValue;
+ for ( ; mapping != mappingEnd; ++mapping )
+ {
+ impl_checkValue_throw( mapping->Second );
+ (*m_aData.m_pValues)[ mapping->First ] = mapping->Second;
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void EnumerableMap::impl_checkValue_throw( const Any& _value ) const
+ {
+ if ( !_value.hasValue() )
+ // nothing to do, NULL values are always allowed, regardless of the ValueType
+ return;
+
+ TypeClass eAllowedTypeClass = m_aData.m_aValueType.getTypeClass();
+ bool bValid = false;
+
+ switch ( eAllowedTypeClass )
+ {
+ default:
+ bValid = ( _value.getValueTypeClass() == eAllowedTypeClass );
+ break;
+ case TypeClass_ANY:
+ bValid = true;
+ break;
+ case TypeClass_INTERFACE:
+ {
+ // special treatment: _value might contain the proper type, but the interface
+ // might actually be NULL. Which is still valid ...
+ if ( m_aData.m_aValueType.isAssignableFrom( _value.getValueType() ) )
+ // this also catches the special case where XFoo is our value type,
+ // and _value contains a NULL-reference to XFoo, or a derived type
+ bValid = true;
+ else
+ {
+ Reference< XInterface > xValue( _value, UNO_QUERY );
+ Any aTypedValue;
+ if ( xValue.is() )
+ // XInterface is not-NULL, but is X(ValueType) not-NULL, too?
+ xValue.set( xValue->queryInterface( m_aData.m_aValueType ), UNO_QUERY );
+ bValid = xValue.is();
+ }
+ }
+ break;
+ case TypeClass_EXCEPTION:
+ case TypeClass_STRUCT:
+ case TypeClass_UNION:
+ {
+ // values are accepted if and only if their type equals, or is derived from, our value type
+
+ if ( _value.getValueTypeClass() != eAllowedTypeClass )
+ bValid = false;
+ else
+ {
+ const TypeDescription aValueTypeDesc( _value.getValueType() );
+ const TypeDescription aRequiredTypeDesc( m_aData.m_aValueType );
+
+ const _typelib_CompoundTypeDescription* pValueCompoundTypeDesc =
+ reinterpret_cast< const _typelib_CompoundTypeDescription* >( aValueTypeDesc.get() );
+
+ while ( pValueCompoundTypeDesc )
+ {
+ if ( typelib_typedescription_equals( &pValueCompoundTypeDesc->aBase, aRequiredTypeDesc.get() ) )
+ break;
+ pValueCompoundTypeDesc = pValueCompoundTypeDesc->pBaseTypeDescription;
+ }
+ bValid = ( pValueCompoundTypeDesc != NULL );
+ }
+ }
+ break;
+ }
+
+ if ( !bValid )
+ {
+ ::rtl::OUStringBuffer aMessage;
+ aMessage.appendAscii( "Incompatible value type. Found '" );
+ aMessage.append( _value.getValueTypeName() );
+ aMessage.appendAscii( "', where '" );
+ aMessage.append( m_aData.m_aValueType.getTypeName() );
+ aMessage.appendAscii( "' (or compatible type) is expected." );
+ throw IllegalTypeException( aMessage.makeStringAndClear(), *const_cast< EnumerableMap* >( this ) );
+ }
+
+ impl_checkNaN_throw( _value, m_aData.m_aValueType );
+ }
+
+ //--------------------------------------------------------------------
+ void EnumerableMap::impl_checkNaN_throw( const Any& _keyOrValue, const Type& _keyOrValueType ) const
+ {
+ if ( ( _keyOrValueType.getTypeClass() == TypeClass_DOUBLE )
+ || ( _keyOrValueType.getTypeClass() == TypeClass_FLOAT )
+ )
+ {
+ double nValue(0);
+ if ( _keyOrValue >>= nValue )
+ if ( ::rtl::math::isNan( nValue ) )
+ throw IllegalArgumentException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NaN (not-a-number) not supported by this implementation." ) ),
+ *const_cast< EnumerableMap* >( this ), 0 );
+ // (note that the case of _key not containing a float/double value is handled in the
+ // respective IKeyPredicateLess implementation, so there's no need to handle this here.)
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void EnumerableMap::impl_checkKey_throw( const Any& _key ) const
+ {
+ if ( !_key.hasValue() )
+ throw IllegalArgumentException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NULL keys not supported by this implementation." ) ),
+ *const_cast< EnumerableMap* >( this ), 0 );
+
+ impl_checkNaN_throw( _key, m_aData.m_aKeyType );
+ }
+
+ //--------------------------------------------------------------------
+ void EnumerableMap::impl_checkMutable_throw() const
+ {
+ if ( !m_aData.m_bMutable )
+ throw NoSupportException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "The map is immutable." ) ),
+ *const_cast< EnumerableMap* >( this ) );
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XEnumeration > SAL_CALL EnumerableMap::createKeyEnumeration( ::sal_Bool _Isolated ) throw (NoSupportException, RuntimeException)
+ {
+ ComponentMethodGuard aGuard( *this );
+ return new MapEnumeration( *this, m_aData, getBroadcastHelper(), eKeys, _Isolated );
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XEnumeration > SAL_CALL EnumerableMap::createValueEnumeration( ::sal_Bool _Isolated ) throw (NoSupportException, RuntimeException)
+ {
+ ComponentMethodGuard aGuard( *this );
+ return new MapEnumeration( *this, m_aData, getBroadcastHelper(), eValues, _Isolated );
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XEnumeration > SAL_CALL EnumerableMap::createElementEnumeration( ::sal_Bool _Isolated ) throw (NoSupportException, RuntimeException)
+ {
+ ComponentMethodGuard aGuard( *this );
+ return new MapEnumeration( *this, m_aData, getBroadcastHelper(), eBoth, _Isolated );
+ }
+
+ //--------------------------------------------------------------------
+ Type SAL_CALL EnumerableMap::getKeyType() throw (RuntimeException)
+ {
+ ComponentMethodGuard aGuard( *this );
+ return m_aData.m_aKeyType;
+ }
+
+ //--------------------------------------------------------------------
+ Type SAL_CALL EnumerableMap::getValueType() throw (RuntimeException)
+ {
+ ComponentMethodGuard aGuard( *this );
+ return m_aData.m_aValueType;
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL EnumerableMap::clear( ) throw (NoSupportException, RuntimeException)
+ {
+ ComponentMethodGuard aGuard( *this );
+ impl_checkMutable_throw();
+
+ m_aData.m_pValues->clear();
+
+ lcl_notifyMapDataListeners_nothrow( m_aData );
+ }
+
+ //--------------------------------------------------------------------
+ ::sal_Bool SAL_CALL EnumerableMap::containsKey( const Any& _key ) throw (IllegalTypeException, IllegalArgumentException, RuntimeException)
+ {
+ ComponentMethodGuard aGuard( *this );
+ impl_checkKey_throw( _key );
+
+ KeyedValues::const_iterator pos = m_aData.m_pValues->find( _key );
+ return ( pos != m_aData.m_pValues->end() );
+ }
+
+ //--------------------------------------------------------------------
+ ::sal_Bool SAL_CALL EnumerableMap::containsValue( const Any& _value ) throw (IllegalTypeException, IllegalArgumentException, RuntimeException)
+ {
+ ComponentMethodGuard aGuard( *this );
+ impl_checkValue_throw( _value );
+
+ for ( KeyedValues::const_iterator mapping = m_aData.m_pValues->begin();
+ mapping != m_aData.m_pValues->end();
+ ++mapping
+ )
+ {
+ if ( mapping->second == _value )
+ return sal_True;
+ }
+ return sal_False;
+ }
+
+ //--------------------------------------------------------------------
+ Any SAL_CALL EnumerableMap::get( const Any& _key ) throw (IllegalTypeException, IllegalArgumentException, NoSuchElementException, RuntimeException)
+ {
+ ComponentMethodGuard aGuard( *this );
+ impl_checkKey_throw( _key );
+
+ KeyedValues::const_iterator pos = m_aData.m_pValues->find( _key );
+ if ( pos == m_aData.m_pValues->end() )
+ throw NoSuchElementException( anyToString( _key ), *this );
+
+ return pos->second;
+ }
+
+ //--------------------------------------------------------------------
+ Any SAL_CALL EnumerableMap::put( const Any& _key, const Any& _value ) throw (NoSupportException, IllegalTypeException, IllegalArgumentException, RuntimeException)
+ {
+ ComponentMethodGuard aGuard( *this );
+ impl_checkMutable_throw();
+ impl_checkKey_throw( _key );
+ impl_checkValue_throw( _value );
+
+ Any previousValue;
+
+ KeyedValues::iterator pos = m_aData.m_pValues->find( _key );
+ if ( pos != m_aData.m_pValues->end() )
+ {
+ previousValue = pos->second;
+ pos->second = _value;
+ }
+ else
+ {
+ (*m_aData.m_pValues)[ _key ] = _value;
+ }
+
+ lcl_notifyMapDataListeners_nothrow( m_aData );
+
+ return previousValue;
+ }
+
+ //--------------------------------------------------------------------
+ Any SAL_CALL EnumerableMap::remove( const Any& _key ) throw (NoSupportException, IllegalTypeException, IllegalArgumentException, NoSuchElementException, RuntimeException)
+ {
+ ComponentMethodGuard aGuard( *this );
+ impl_checkMutable_throw();
+ impl_checkKey_throw( _key );
+
+ Any previousValue;
+
+ KeyedValues::iterator pos = m_aData.m_pValues->find( _key );
+ if ( pos != m_aData.m_pValues->end() )
+ {
+ previousValue = pos->second;
+ m_aData.m_pValues->erase( pos );
+ }
+
+ lcl_notifyMapDataListeners_nothrow( m_aData );
+
+ return previousValue;
+ }
+
+ //--------------------------------------------------------------------
+ Type SAL_CALL EnumerableMap::getElementType() throw (RuntimeException)
+ {
+ return ::cppu::UnoType< Pair< Any, Any > >::get();
+ }
+
+ //--------------------------------------------------------------------
+ ::sal_Bool SAL_CALL EnumerableMap::hasElements() throw (RuntimeException)
+ {
+ ComponentMethodGuard aGuard( *this );
+ return m_aData.m_pValues->empty();
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL EnumerableMap::getImplementationName( ) throw (RuntimeException)
+ {
+ return getImplementationName_static();
+ }
+
+ //--------------------------------------------------------------------
+ ::sal_Bool SAL_CALL EnumerableMap::supportsService( const ::rtl::OUString& _serviceName ) throw (RuntimeException)
+ {
+ Sequence< ::rtl::OUString > aServices( getSupportedServiceNames() );
+ for ( sal_Int32 i=0; i<aServices.getLength(); ++i )
+ if ( _serviceName == aServices[i] )
+ return sal_True;
+ return sal_False;
+ }
+
+ //--------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL EnumerableMap::getSupportedServiceNames( ) throw (RuntimeException)
+ {
+ return getSupportedServiceNames_static();
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL EnumerableMap::getImplementationName_static( )
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.comp.comphelper.EnumerableMap" ) );
+ }
+
+ //--------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL EnumerableMap::getSupportedServiceNames_static( )
+ {
+ Sequence< ::rtl::OUString > aServiceNames(1);
+ aServiceNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.container.EnumerableMap" ) );
+ return aServiceNames;
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XInterface > SAL_CALL EnumerableMap::Create( const Reference< XComponentContext >& _context )
+ {
+ return *new EnumerableMap( ComponentContext( _context ) );
+ }
+
+ //====================================================================
+ //= MapEnumerator
+ //====================================================================
+ //--------------------------------------------------------------------
+ ::sal_Bool MapEnumerator::hasMoreElements()
+ {
+ if ( m_disposed )
+ throw DisposedException( ::rtl::OUString(), m_rParent );
+ return m_mapPos != m_rMapData.m_pValues->end();
+ }
+
+ //--------------------------------------------------------------------
+ Any MapEnumerator::nextElement()
+ {
+ if ( m_disposed )
+ throw DisposedException( ::rtl::OUString(), m_rParent );
+ if ( m_mapPos == m_rMapData.m_pValues->end() )
+ throw NoSuchElementException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No more elements." ) ), m_rParent );
+
+ Any aNextElement;
+ switch ( m_eType )
+ {
+ case eKeys: aNextElement = m_mapPos->first; break;
+ case eValues: aNextElement = m_mapPos->second; break;
+ case eBoth: aNextElement <<= Pair< Any, Any >( m_mapPos->first, m_mapPos->second ); break;
+ }
+ ++m_mapPos;
+ return aNextElement;
+ }
+
+ //--------------------------------------------------------------------
+ void MapEnumerator::mapModified()
+ {
+ m_disposed = true;
+ }
+
+ //====================================================================
+ //= MapEnumeration - implementation
+ //====================================================================
+ //--------------------------------------------------------------------
+ ::sal_Bool SAL_CALL MapEnumeration::hasMoreElements( ) throw (RuntimeException)
+ {
+ ComponentMethodGuard aGuard( *this );
+ return m_aEnumerator.hasMoreElements();
+ }
+
+ //--------------------------------------------------------------------
+ Any SAL_CALL MapEnumeration::nextElement( ) throw (NoSuchElementException, WrappedTargetException, RuntimeException)
+ {
+ ComponentMethodGuard aGuard( *this );
+ return m_aEnumerator.nextElement();
+ }
+
+//........................................................................
+} // namespace comphelper
+//........................................................................
+
+void createRegistryInfo_Map()
+{
+ ::comphelper::module::OAutoRegistration< ::comphelper::EnumerableMap > aAutoRegistration;
+}
diff --git a/comphelper/source/container/makefile.mk b/comphelper/source/container/makefile.mk
index 2c63d2234a03..2c43a774b030 100644
--- a/comphelper/source/container/makefile.mk
+++ b/comphelper/source/container/makefile.mk
@@ -50,7 +50,8 @@ SLOFILES=\
$(SLO)$/containermultiplexer.obj \
$(SLO)$/IndexedPropertyValuesContainer.obj \
$(SLO)$/embeddedobjectcontainer.obj \
- $(SLO)$/NamedPropertyValuesContainer.obj
+ $(SLO)$/NamedPropertyValuesContainer.obj \
+ $(SLO)$/enumerablemap.obj
# --- Targets ----------------------------------
diff --git a/comphelper/source/inc/comphelper_module.hxx b/comphelper/source/inc/comphelper_module.hxx
new file mode 100644
index 000000000000..5bbac6f9efc6
--- /dev/null
+++ b/comphelper/source/inc/comphelper_module.hxx
@@ -0,0 +1,42 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org 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 version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+#ifndef COMPHELPER_COMPHELPER_MODULE_HXX
+#define COMPHELPER_COMPHELPER_MODULE_HXX
+
+#include "comphelper/componentmodule.hxx"
+
+//........................................................................
+namespace comphelper { namespace module
+{
+//........................................................................
+
+ DECLARE_COMPONENT_MODULE( ComphelperModule, ComphelperModuleClient )
+
+//........................................................................
+} } // namespace comphelper::module
+//........................................................................
+
+#endif // COMPHELPER_COMPHELPER_MODULE_HXX
diff --git a/comphelper/source/misc/comphelper_module.cxx b/comphelper/source/misc/comphelper_module.cxx
new file mode 100644
index 000000000000..08cb48b3ef42
--- /dev/null
+++ b/comphelper/source/misc/comphelper_module.cxx
@@ -0,0 +1,40 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org 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 version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_comphelper.hxx"
+
+#include "comphelper_module.hxx"
+
+//........................................................................
+namespace comphelper { namespace module
+{
+//........................................................................
+
+ IMPLEMENT_COMPONENT_MODULE( ComphelperModule );
+
+//........................................................................
+} } // namespace comphelper::module
+//........................................................................
diff --git a/comphelper/source/misc/comphelper_services.cxx b/comphelper/source/misc/comphelper_services.cxx
new file mode 100644
index 000000000000..77ab145e2581
--- /dev/null
+++ b/comphelper/source/misc/comphelper_services.cxx
@@ -0,0 +1,74 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org 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 version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_comphelper.hxx"
+
+#include "comphelper_module.hxx"
+
+//--------------------------------------------------------------------
+extern void createRegistryInfo_OPropertyBag();
+extern void createRegistryInfo_SequenceOutputStream();
+extern void createRegistryInfo_SequenceInputStream();
+extern void createRegistryInfo_UNOMemoryStream();
+extern void createRegistryInfo_IndexedPropertyValuesContainer();
+extern void createRegistryInfo_NamedPropertyValuesContainer();
+extern void createRegistryInfo_AnyCompareFactory();
+extern void createRegistryInfo_OfficeInstallationDirectories();
+extern void createRegistryInfo_OInstanceLocker();
+extern void createRegistryInfo_Map();
+
+//........................................................................
+namespace comphelper { namespace module
+{
+//........................................................................
+
+ static void initializeModule()
+ {
+ static bool bInitialized( false );
+ if ( !bInitialized )
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if ( !bInitialized )
+ {
+ createRegistryInfo_OPropertyBag();
+ createRegistryInfo_SequenceOutputStream();
+ createRegistryInfo_SequenceInputStream();
+ createRegistryInfo_UNOMemoryStream();
+ createRegistryInfo_IndexedPropertyValuesContainer();
+ createRegistryInfo_NamedPropertyValuesContainer();
+ createRegistryInfo_AnyCompareFactory();
+ createRegistryInfo_OfficeInstallationDirectories();
+ createRegistryInfo_OInstanceLocker();
+ createRegistryInfo_Map();
+ }
+ }
+ }
+
+//........................................................................
+} } // namespace comphelper::module
+//........................................................................
+
+IMPLEMENT_COMPONENT_LIBRARY_API( ::comphelper::module::ComphelperModule, ::comphelper::module::initializeModule )
diff --git a/comphelper/source/misc/componentbase.cxx b/comphelper/source/misc/componentbase.cxx
new file mode 100644
index 000000000000..bf230f59b132
--- /dev/null
+++ b/comphelper/source/misc/componentbase.cxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org 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 version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_comphelper.hxx"
+
+#include "comphelper/componentbase.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/lang/NotInitializedException.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+/** === end UNO includes === **/
+
+//........................................................................
+namespace comphelper
+{
+//........................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::lang::NotInitializedException;
+ using ::com::sun::star::lang::DisposedException;
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ /** === end UNO using === **/
+
+ //====================================================================
+ //= ComponentBase
+ //====================================================================
+ //--------------------------------------------------------------------
+ void ComponentBase::impl_checkDisposed_throw() const
+ {
+ if ( m_rBHelper.bDisposed )
+ throw DisposedException( ::rtl::OUString(), getComponent() );
+ }
+
+ //--------------------------------------------------------------------
+ void ComponentBase::impl_checkInitialized_throw() const
+ {
+ if ( !m_bInitialized )
+ throw NotInitializedException( ::rtl::OUString(), getComponent() );
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XInterface > ComponentBase::getComponent() const
+ {
+ return NULL;
+ }
+
+//........................................................................
+} // namespace comphelper
+//........................................................................
diff --git a/comphelper/source/misc/documentiologring.cxx b/comphelper/source/misc/documentiologring.cxx
new file mode 100644
index 000000000000..7969b938e108
--- /dev/null
+++ b/comphelper/source/misc/documentiologring.cxx
@@ -0,0 +1,175 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: documentiologring.hxx,v $
+ * $Revision: 1.0 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_comphelper.hxx"
+
+#include <com/sun/star/frame/DoubleInitializationException.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+
+#include "documentiologring.hxx"
+
+using namespace ::com::sun::star;
+
+namespace comphelper
+{
+
+// ----------------------------------------------------------
+OSimpleLogRing::OSimpleLogRing( const uno::Reference< uno::XComponentContext >& /*xContext*/ )
+: m_aMessages( SIMPLELOGRING_SIZE )
+, m_bInitialized( sal_False )
+, m_bFull( sal_False )
+, m_nPos( 0 )
+{
+}
+
+// ----------------------------------------------------------
+OSimpleLogRing::~OSimpleLogRing()
+{
+}
+
+// ----------------------------------------------------------
+uno::Sequence< ::rtl::OUString > SAL_CALL OSimpleLogRing::impl_staticGetSupportedServiceNames()
+{
+ uno::Sequence< rtl::OUString > aResult( 1 );
+ aResult[0] = impl_staticGetServiceName();
+ return aResult;
+}
+
+// ----------------------------------------------------------
+::rtl::OUString SAL_CALL OSimpleLogRing::impl_staticGetImplementationName()
+{
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.logging.SimpleLogRing" ) );
+}
+
+// ----------------------------------------------------------
+::rtl::OUString SAL_CALL OSimpleLogRing::impl_staticGetSingletonName()
+{
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.logging.DocumentIOLogRing" ) );
+}
+
+// ----------------------------------------------------------
+::rtl::OUString SAL_CALL OSimpleLogRing::impl_staticGetServiceName()
+{
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.logging.SimpleLogRing" ) );
+}
+
+// ----------------------------------------------------------
+uno::Reference< uno::XInterface > SAL_CALL OSimpleLogRing::impl_staticCreateSelfInstance( const uno::Reference< uno::XComponentContext >& rxContext )
+{
+ return static_cast< cppu::OWeakObject* >( new OSimpleLogRing( rxContext ) );
+}
+
+// XSimpleLogRing
+// ----------------------------------------------------------
+void SAL_CALL OSimpleLogRing::logString( const ::rtl::OUString& aMessage ) throw (uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ m_aMessages[m_nPos] = aMessage;
+ if ( ++m_nPos >= m_aMessages.getLength() )
+ {
+ m_nPos = 0;
+ m_bFull = sal_True;
+ }
+
+ // if used once then default initialized
+ m_bInitialized = sal_True;
+}
+
+// ----------------------------------------------------------
+uno::Sequence< ::rtl::OUString > SAL_CALL OSimpleLogRing::getCollectedLog() throw (uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ sal_Int32 nResLen = m_bFull ? m_aMessages.getLength() : m_nPos;
+ sal_Int32 nStart = m_bFull ? m_nPos : 0;
+ uno::Sequence< ::rtl::OUString > aResult( nResLen );
+
+ for ( sal_Int32 nInd = 0; nInd < nResLen; nInd++ )
+ aResult[nInd] = m_aMessages[ ( nStart + nInd ) % m_aMessages.getLength() ];
+
+ // if used once then default initialized
+ m_bInitialized = sal_True;
+
+ return aResult;
+}
+
+// XInitialization
+// ----------------------------------------------------------
+void SAL_CALL OSimpleLogRing::initialize( const uno::Sequence< uno::Any >& aArguments ) throw (uno::Exception, uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( m_bInitialized )
+ throw frame::DoubleInitializationException();
+
+ if ( !m_refCount )
+ throw uno::RuntimeException(); // the object must be refcounted already!
+
+ sal_Int32 nLen = 0;
+ if ( aArguments.getLength() == 1 && ( aArguments[0] >>= nLen ) && nLen )
+ m_aMessages.realloc( nLen );
+ else
+ throw lang::IllegalArgumentException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Nonnull size is expected as the first argument!" ) ),
+ uno::Reference< uno::XInterface >(),
+ 0 );
+
+ m_bInitialized = sal_True;
+}
+
+// XServiceInfo
+// ----------------------------------------------------------
+::rtl::OUString SAL_CALL OSimpleLogRing::getImplementationName() throw (uno::RuntimeException)
+{
+ return impl_staticGetImplementationName();
+}
+
+// ----------------------------------------------------------
+::sal_Bool SAL_CALL OSimpleLogRing::supportsService( const ::rtl::OUString& aServiceName ) throw (uno::RuntimeException)
+{
+ const uno::Sequence< rtl::OUString > & aSupportedNames = impl_staticGetSupportedServiceNames();
+ for ( sal_Int32 nInd = 0; nInd < aSupportedNames.getLength(); nInd++ )
+ {
+ if ( aSupportedNames[ nInd ].equals( aServiceName ) )
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+// ----------------------------------------------------------
+uno::Sequence< ::rtl::OUString > SAL_CALL OSimpleLogRing::getSupportedServiceNames() throw (uno::RuntimeException)
+{
+ return impl_staticGetSupportedServiceNames();
+}
+
+} // namespace comphelper
+
diff --git a/comphelper/source/misc/documentiologring.hxx b/comphelper/source/misc/documentiologring.hxx
new file mode 100644
index 000000000000..ae7d2a6eaf19
--- /dev/null
+++ b/comphelper/source/misc/documentiologring.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: documentiologring.hxx,v $
+ * $Revision: 1.0 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __DOCUMENTIOLOGRING_HXX_
+#define __DOCUMENTIOLOGRING_HXX_
+
+#include <com/sun/star/logging/XSimpleLogRing.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+
+#include <osl/mutex.hxx>
+#include <cppuhelper/implbase3.hxx>
+
+#define SIMPLELOGRING_SIZE 256
+
+namespace comphelper
+{
+
+class OSimpleLogRing : public ::cppu::WeakImplHelper3< ::com::sun::star::logging::XSimpleLogRing,
+ ::com::sun::star::lang::XInitialization,
+ ::com::sun::star::lang::XServiceInfo >
+{
+ ::osl::Mutex m_aMutex;
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aMessages;
+
+ sal_Bool m_bInitialized;
+ sal_Bool m_bFull;
+ sal_Int32 m_nPos;
+
+public:
+ OSimpleLogRing( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext );
+ virtual ~OSimpleLogRing();
+
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ impl_staticGetSupportedServiceNames();
+
+ static ::rtl::OUString SAL_CALL impl_staticGetImplementationName();
+
+ static ::rtl::OUString SAL_CALL impl_staticGetSingletonName();
+
+ static ::rtl::OUString SAL_CALL impl_staticGetServiceName();
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
+ impl_staticCreateSelfInstance(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
+
+// XSimpleLogRing
+ virtual void SAL_CALL logString( const ::rtl::OUString& aMessage ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getCollectedLog() throw (::com::sun::star::uno::RuntimeException);
+
+// XInitialization
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+// XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
+
+};
+
+} // namespace comphelper
+
+#endif
+
diff --git a/comphelper/source/misc/facreg.cxx b/comphelper/source/misc/facreg.cxx
deleted file mode 100644
index 9ad0e12597b0..000000000000
--- a/comphelper/source/misc/facreg.cxx
+++ /dev/null
@@ -1,246 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: facreg.cxx,v $
- * $Revision: 1.15 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_comphelper.hxx"
-
-#include <string.h>
-#include "sal/types.h"
-#include <com/sun/star/registry/XRegistryKey.hpp>
-#include <osl/diagnose.h>
-
-#include "rtl/ustrbuf.hxx"
-
-#include <cppuhelper/factory.hxx>
-#include <uno/lbnames.h>
-
-#include "instancelocker.hxx"
-
-using namespace rtl;
-using namespace com::sun::star;
-
-// IndexedPropertyValuesContainer
-extern uno::Sequence< OUString > SAL_CALL IndexedPropertyValuesContainer_getSupportedServiceNames() throw();
-extern OUString SAL_CALL IndexedPropertyValuesContainer_getImplementationName() throw();
-extern uno::Reference< uno::XInterface > SAL_CALL IndexedPropertyValuesContainer_createInstance(const uno::Reference< uno::XComponentContext > & rxContext) throw( uno::Exception );
-
-// NamedPropertyValuesContainer
-extern uno::Sequence< OUString > SAL_CALL NamedPropertyValuesContainer_getSupportedServiceNames() throw();
-extern OUString SAL_CALL NamedPropertyValuesContainer_getImplementationName() throw();
-extern uno::Reference< uno::XInterface > SAL_CALL NamedPropertyValuesContainer_createInstance(const uno::Reference< uno::XComponentContext > & rxContext) throw( uno::Exception );
-
-// AnyCompareFactory
-extern uno::Sequence< OUString > SAL_CALL AnyCompareFactory_getSupportedServiceNames() throw();
-extern OUString SAL_CALL AnyCompareFactory_getImplementationName() throw();
-extern uno::Reference< uno::XInterface > SAL_CALL AnyCompareFactory_createInstance(const uno::Reference< uno::XComponentContext > & rxContext) throw( uno::Exception );
-
-// OfficeInstallationDirectories
-extern uno::Sequence< OUString > SAL_CALL OfficeInstallationDirectories_getSupportedServiceNames() throw();
-extern OUString SAL_CALL OfficeInstallationDirectories_getImplementationName() throw();
-extern OUString SAL_CALL OfficeInstallationDirectories_getSingletonName() throw();
-extern OUString SAL_CALL OfficeInstallationDirectories_getSingletonServiceName() throw();
-extern uno::Reference< uno::XInterface > SAL_CALL OfficeInstallationDirectories_createInstance(const uno::Reference< uno::XComponentContext > & rxContext) throw( uno::Exception );
-
-// SequenceInputStreamService
-extern uno::Sequence< OUString > SAL_CALL SequenceInputStreamService_getSupportedServiceNames() throw();
-extern OUString SAL_CALL SequenceInputStreamService_getImplementationName() throw();
-extern uno::Reference< uno::XInterface > SAL_CALL SequenceInputStreamService_createInstance(const uno::Reference< uno::XComponentContext > & rxContext) throw( uno::Exception );
-
-//SequenceOutputStreamService
-extern uno::Sequence< OUString > SAL_CALL SequenceOutputStreamService_getSupportedServiceNames() throw();
-extern OUString SAL_CALL SequenceOutputStreamService_getImplementationName() throw();
-extern uno::Reference< uno::XInterface > SAL_CALL SequenceOutputStreamService_createInstance(const uno::Reference< uno::XComponentContext >& rxContext) throw( uno::Exception );
-
-namespace comphelper
-{
-// UNOMemoryStream
-extern uno::Sequence< OUString > SAL_CALL UNOMemoryStream_getSupportedServiceNames() throw();
-extern OUString SAL_CALL UNOMemoryStream_getImplementationName() throw();
-extern uno::Reference< uno::XInterface > SAL_CALL UNOMemoryStream_createInstance(const uno::Reference< uno::XComponentContext > & rxContext) throw( uno::Exception );
-}
-
-// PropertyBag
-extern uno::Sequence< OUString > SAL_CALL PropertyBag_getSupportedServiceNames() throw();
-extern OUString SAL_CALL PropertyBag_getImplementationName() throw();
-extern uno::Reference< uno::XInterface > SAL_CALL PropertyBag_createInstance(const uno::Reference< uno::XComponentContext >& rxContext) throw( uno::Exception );
-
-//
-static void writeInfo( registry::XRegistryKey * pRegistryKey, const OUString& rImplementationName, const uno::Sequence< OUString >& rServices )
-{
- uno::Reference< registry::XRegistryKey > xNewKey(
- pRegistryKey->createKey(
- OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) + rImplementationName + OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") ) ) );
-
- for( sal_Int32 i = 0; i < rServices.getLength(); i++ )
- xNewKey->createKey( rServices.getConstArray()[i]);
-}
-
-static void registerSingleton( registry::XRegistryKey * pRegistryKey, const OUString& rImplementationName, const OUString& rSingletonName, const OUString& rServiceName )
-{
- OUStringBuffer aSingletonKeyName;
- aSingletonKeyName.appendAscii( "/" );
- aSingletonKeyName.append( rImplementationName );
- aSingletonKeyName.appendAscii( "/UNO/SINGLETONS/" );
- aSingletonKeyName.append( rSingletonName );
-
- uno::Reference< registry::XRegistryKey > xNewKey( pRegistryKey->createKey( aSingletonKeyName.makeStringAndClear() ) );
- OSL_ENSURE( xNewKey.is(), "could not create a registry key !");
-
- xNewKey->setStringValue( rServiceName );
-}
-
-//
-extern "C"
-{
-
-SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** )
-{
- *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
-}
-
-SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( void *, void * pRegistryKey )
-{
- if( pRegistryKey )
- {
- try
- {
- registry::XRegistryKey *pKey = reinterpret_cast< registry::XRegistryKey * >( pRegistryKey );
-
- // IndexedPropertyValuesContainer
- writeInfo( pKey, IndexedPropertyValuesContainer_getImplementationName(), IndexedPropertyValuesContainer_getSupportedServiceNames() );
- // NamedPropertyValuesContainer
- writeInfo( pKey, NamedPropertyValuesContainer_getImplementationName(), NamedPropertyValuesContainer_getSupportedServiceNames() );
- // AnyCompareFactory
- writeInfo( pKey, AnyCompareFactory_getImplementationName(), AnyCompareFactory_getSupportedServiceNames() );
- // OfficeInstallationDirectories
- writeInfo( pKey, OfficeInstallationDirectories_getImplementationName(), OfficeInstallationDirectories_getSupportedServiceNames() );
- registerSingleton( pKey, OfficeInstallationDirectories_getImplementationName(), OfficeInstallationDirectories_getSingletonName(), OfficeInstallationDirectories_getSingletonServiceName() );
-
- // InstanceLocker
- writeInfo( pKey, OInstanceLocker::impl_staticGetImplementationName(), OInstanceLocker::impl_staticGetSupportedServiceNames() );
- // SequenceInputStreamService
- writeInfo( pKey, SequenceInputStreamService_getImplementationName(), SequenceInputStreamService_getSupportedServiceNames() );
- // SequenceOutputStreamService
- writeInfo( pKey, SequenceOutputStreamService_getImplementationName(), SequenceOutputStreamService_getSupportedServiceNames() );
- // UNOMemoryStream
- writeInfo( pKey, comphelper::UNOMemoryStream_getImplementationName(), comphelper::UNOMemoryStream_getSupportedServiceNames() );
- // PropertyBag
- writeInfo( pKey, PropertyBag_getImplementationName(), PropertyBag_getSupportedServiceNames() );
- }
- catch (registry::InvalidRegistryException &)
- {
- OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
- }
- }
- return sal_True;
-}
-
-SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * )
-{
- void * pRet = 0;
- if( pServiceManager )
- {
- uno::Reference<lang::XSingleComponentFactory> xComponentFactory;
-
- const sal_Int32 nImplNameLen = strlen( pImplName );
- if( IndexedPropertyValuesContainer_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )
- {
- xComponentFactory = ::cppu::createSingleComponentFactory(
- IndexedPropertyValuesContainer_createInstance,
- IndexedPropertyValuesContainer_getImplementationName(),
- IndexedPropertyValuesContainer_getSupportedServiceNames() );
- }
- else if( NamedPropertyValuesContainer_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )
- {
- xComponentFactory = ::cppu::createSingleComponentFactory(
- NamedPropertyValuesContainer_createInstance,
- NamedPropertyValuesContainer_getImplementationName(),
- NamedPropertyValuesContainer_getSupportedServiceNames() );
- }
- else if( AnyCompareFactory_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )
- {
- xComponentFactory = ::cppu::createSingleComponentFactory(
- AnyCompareFactory_createInstance,
- AnyCompareFactory_getImplementationName(),
- AnyCompareFactory_getSupportedServiceNames() );
- }
- else if( OfficeInstallationDirectories_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )
- {
- xComponentFactory = ::cppu::createSingleComponentFactory(
- OfficeInstallationDirectories_createInstance,
- OfficeInstallationDirectories_getImplementationName(),
- OfficeInstallationDirectories_getSupportedServiceNames() );
- }
- else if( OInstanceLocker::impl_staticGetImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )
- {
- xComponentFactory = ::cppu::createSingleComponentFactory(
- OInstanceLocker::impl_staticCreateSelfInstance,
- OInstanceLocker::impl_staticGetImplementationName(),
- OInstanceLocker::impl_staticGetSupportedServiceNames() );
- }
- else if( SequenceInputStreamService_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )
- {
- xComponentFactory = ::cppu::createSingleComponentFactory(
- SequenceInputStreamService_createInstance,
- SequenceInputStreamService_getImplementationName(),
- SequenceInputStreamService_getSupportedServiceNames() );
- }
- else if( comphelper::UNOMemoryStream_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )
- {
- xComponentFactory = ::cppu::createSingleComponentFactory(
- comphelper::UNOMemoryStream_createInstance,
- comphelper::UNOMemoryStream_getImplementationName(),
- comphelper::UNOMemoryStream_getSupportedServiceNames() );
- }
- else if ( SequenceOutputStreamService_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )
- {
- xComponentFactory = ::cppu::createSingleComponentFactory(
- SequenceOutputStreamService_createInstance,
- SequenceOutputStreamService_getImplementationName(),
- SequenceOutputStreamService_getSupportedServiceNames() );
- }
- else if ( PropertyBag_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )
- {
- xComponentFactory = ::cppu::createSingleComponentFactory(
- PropertyBag_createInstance,
- PropertyBag_getImplementationName(),
- PropertyBag_getSupportedServiceNames() );
- }
-
- if( xComponentFactory.is())
- {
- xComponentFactory->acquire();
- pRet = xComponentFactory.get();
- }
- }
- return pRet;
-}
-
-}
diff --git a/comphelper/source/misc/instancelocker.cxx b/comphelper/source/misc/instancelocker.cxx
index 6046b7c5e6f5..11a590c618c3 100644
--- a/comphelper/source/misc/instancelocker.cxx
+++ b/comphelper/source/misc/instancelocker.cxx
@@ -30,6 +30,9 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_comphelper.hxx"
+
+#include "comphelper_module.hxx"
+
#include <com/sun/star/util/XCloseBroadcaster.hpp>
#include <com/sun/star/util/XCloseable.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
@@ -205,14 +208,14 @@ void SAL_CALL OInstanceLocker::initialize( const uno::Sequence< uno::Any >& aArg
::rtl::OUString SAL_CALL OInstanceLocker::getImplementationName( )
throw (uno::RuntimeException)
{
- return impl_staticGetImplementationName();
+ return getImplementationName_static();
}
// --------------------------------------------------------
::sal_Bool SAL_CALL OInstanceLocker::supportsService( const ::rtl::OUString& ServiceName )
throw (uno::RuntimeException)
{
- uno::Sequence< ::rtl::OUString > aSeq = impl_staticGetSupportedServiceNames();
+ uno::Sequence< ::rtl::OUString > aSeq = getSupportedServiceNames();
for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ )
if ( ServiceName.compareTo( aSeq[nInd] ) == 0 )
@@ -225,25 +228,25 @@ void SAL_CALL OInstanceLocker::initialize( const uno::Sequence< uno::Any >& aArg
uno::Sequence< ::rtl::OUString > SAL_CALL OInstanceLocker::getSupportedServiceNames()
throw (uno::RuntimeException)
{
- return impl_staticGetSupportedServiceNames();
+ return getSupportedServiceNames_static();
}
// Static methods
// --------------------------------------------------------
-uno::Sequence< ::rtl::OUString > SAL_CALL OInstanceLocker::impl_staticGetSupportedServiceNames()
+uno::Sequence< ::rtl::OUString > SAL_CALL OInstanceLocker::getSupportedServiceNames_static()
{
const rtl::OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.InstanceLocker" ) );
return uno::Sequence< rtl::OUString >( &aServiceName, 1 );
}
// --------------------------------------------------------
-::rtl::OUString SAL_CALL OInstanceLocker::impl_staticGetImplementationName()
+::rtl::OUString SAL_CALL OInstanceLocker::getImplementationName_static()
{
return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.embed.InstanceLocker" ) );
}
// --------------------------------------------------------
-uno::Reference< uno::XInterface > SAL_CALL OInstanceLocker::impl_staticCreateSelfInstance(
+uno::Reference< uno::XInterface > SAL_CALL OInstanceLocker::Create(
const uno::Reference< uno::XComponentContext >& rxContext )
{
return static_cast< cppu::OWeakObject * >( new OInstanceLocker( rxContext ) );
@@ -506,3 +509,7 @@ sal_Bool OLockListener::Init()
return sal_True;
}
+void createRegistryInfo_OInstanceLocker()
+{
+ static ::comphelper::module::OAutoRegistration< OInstanceLocker > aAutoRegistration;
+}
diff --git a/comphelper/source/misc/instancelocker.hxx b/comphelper/source/misc/instancelocker.hxx
index 1f7d34a64652..637cc9fc4579 100644
--- a/comphelper/source/misc/instancelocker.hxx
+++ b/comphelper/source/misc/instancelocker.hxx
@@ -70,12 +70,12 @@ public:
~OInstanceLocker();
static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
- impl_staticGetSupportedServiceNames();
+ getSupportedServiceNames_static();
- static ::rtl::OUString SAL_CALL impl_staticGetImplementationName();
+ static ::rtl::OUString SAL_CALL getImplementationName_static();
static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
- impl_staticCreateSelfInstance(
+ Create(
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
// XComponent
diff --git a/comphelper/source/misc/makefile.mk b/comphelper/source/misc/makefile.mk
index 78f79c806511..f50f57c47eb3 100644
--- a/comphelper/source/misc/makefile.mk
+++ b/comphelper/source/misc/makefile.mk
@@ -58,8 +58,8 @@ SLOFILES= \
$(SLO)$/componentmodule.obj \
$(SLO)$/configurationhelper.obj \
$(SLO)$/documentinfo.obj \
+ $(SLO)$/documentiologring.obj \
$(SLO)$/evtlistenerhlp.obj \
- $(SLO)$/facreg.obj \
$(SLO)$/ihwrapnofilter.obj \
$(SLO)$/instancelocker.obj \
$(SLO)$/interaction.obj \
@@ -89,6 +89,9 @@ SLOFILES= \
$(SLO)$/uieventslogger.obj \
$(SLO)$/weakeventlistener.obj \
$(SLO)$/weak.obj \
+ $(SLO)$/comphelper_module.obj \
+ $(SLO)$/comphelper_services.obj \
+ $(SLO)$/componentbase.obj \
# --- Targets ----------------------------------
diff --git a/comphelper/source/officeinstdir/officeinstallationdirectories.cxx b/comphelper/source/officeinstdir/officeinstallationdirectories.cxx
index 3c56d5479573..219e56ce1a37 100644
--- a/comphelper/source/officeinstdir/officeinstallationdirectories.cxx
+++ b/comphelper/source/officeinstdir/officeinstallationdirectories.cxx
@@ -31,6 +31,8 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_comphelper.hxx"
+#include "comphelper_module.hxx"
+
/**************************************************************************
TODO
**************************************************************************
@@ -51,53 +53,6 @@ using namespace comphelper;
// helpers
//=========================================================================
-uno::Sequence< rtl::OUString > SAL_CALL
-OfficeInstallationDirectories_getSupportedServiceNames()
- throw()
-{
- const rtl::OUString aServiceName(
- RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.util.OfficeInstallationDirectories" ) );
- return uno::Sequence< rtl::OUString >( &aServiceName, 1 );
-}
-
-//=========================================================================
-rtl::OUString SAL_CALL OfficeInstallationDirectories_getImplementationName()
- throw()
-{
- return rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.comp.util.OfficeInstallationDirectories" ) );
-}
-
-//=========================================================================
-rtl::OUString SAL_CALL OfficeInstallationDirectories_getSingletonName()
- throw()
-{
- return rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.util.theOfficeInstallationDirectories" ) );
-}
-
-//=========================================================================
-rtl::OUString SAL_CALL OfficeInstallationDirectories_getSingletonServiceName()
- throw()
-{
- return rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.util.OfficeInstallationDirectories" ) );
-}
-
-//=========================================================================
-uno::Reference< uno::XInterface > SAL_CALL
-OfficeInstallationDirectories_createInstance(
- const uno::Reference< uno::XComponentContext > & rxContext )
- throw( uno::Exception )
-{
- return static_cast< cppu::OWeakObject * >(
- new OfficeInstallationDirectories( rxContext ) );
-}
-
//=========================================================================
static bool makeCanonicalFileURL( rtl::OUString & rURL )
{
@@ -272,7 +227,7 @@ rtl::OUString SAL_CALL
OfficeInstallationDirectories::getImplementationName()
throw ( uno::RuntimeException )
{
- return OfficeInstallationDirectories_getImplementationName();
+ return getImplementationName_static();
}
//=========================================================================
@@ -282,7 +237,7 @@ OfficeInstallationDirectories::supportsService( const rtl::OUString& ServiceName
throw ( uno::RuntimeException )
{
const uno::Sequence< rtl::OUString > & aNames
- = OfficeInstallationDirectories_getSupportedServiceNames();
+ = getSupportedServiceNames();
const rtl::OUString * p = aNames.getConstArray();
for ( sal_Int32 nPos = 0; nPos < aNames.getLength(); nPos++ )
{
@@ -299,7 +254,47 @@ uno::Sequence< ::rtl::OUString > SAL_CALL
OfficeInstallationDirectories::getSupportedServiceNames()
throw ( uno::RuntimeException )
{
- return OfficeInstallationDirectories_getSupportedServiceNames();
+ return getSupportedServiceNames_static();
+}
+
+//=========================================================================
+// static
+rtl::OUString SAL_CALL
+OfficeInstallationDirectories::getImplementationName_static()
+{
+ return rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.comp.util.OfficeInstallationDirectories" ) );
+}
+
+//=========================================================================
+// static
+uno::Sequence< ::rtl::OUString > SAL_CALL
+OfficeInstallationDirectories::getSupportedServiceNames_static()
+{
+ const rtl::OUString aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.util.OfficeInstallationDirectories" ) );
+ return uno::Sequence< rtl::OUString >( &aServiceName, 1 );
+}
+
+//=========================================================================
+// static
+rtl::OUString SAL_CALL OfficeInstallationDirectories::getSingletonName_static()
+{
+ return rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.util.theOfficeInstallationDirectories" ) );
+}
+
+//=========================================================================
+// static
+uno::Reference< uno::XInterface > SAL_CALL
+OfficeInstallationDirectories::Create(
+ const uno::Reference< uno::XComponentContext > & rxContext )
+{
+ return static_cast< cppu::OWeakObject * >(
+ new OfficeInstallationDirectories( rxContext ) );
}
//=========================================================================
@@ -352,3 +347,7 @@ void OfficeInstallationDirectories::initDirs()
}
}
+void createRegistryInfo_OfficeInstallationDirectories()
+{
+ static ::comphelper::module::OSingletonRegistration< OfficeInstallationDirectories > aAutoRegistration;
+}
diff --git a/comphelper/source/officeinstdir/officeinstallationdirectories.hxx b/comphelper/source/officeinstdir/officeinstallationdirectories.hxx
index c829bcdc517c..52dcd38d564a 100644
--- a/comphelper/source/officeinstdir/officeinstallationdirectories.hxx
+++ b/comphelper/source/officeinstdir/officeinstallationdirectories.hxx
@@ -84,6 +84,16 @@ public:
getSupportedServiceNames()
throw (::com::sun::star::uno::RuntimeException);
+ // XServiceInfo - static versions (used for component registration)
+ static ::rtl::OUString SAL_CALL
+ getImplementationName_static();
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames_static();
+ static ::rtl::OUString SAL_CALL
+ getSingletonName_static();
+ static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
+ Create( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& );
+
private:
void initDirs();
diff --git a/comphelper/source/property/opropertybag.cxx b/comphelper/source/property/opropertybag.cxx
index 7be74ef466b6..8b816e8c1ce9 100644
--- a/comphelper/source/property/opropertybag.cxx
+++ b/comphelper/source/property/opropertybag.cxx
@@ -32,6 +32,7 @@
#include "precompiled_comphelper.hxx"
#include "opropertybag.hxx"
+#include "comphelper_module.hxx"
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
@@ -49,19 +50,9 @@
//--------------------------------------------------------------------------
using namespace ::com::sun::star;
-uno::Sequence< ::rtl::OUString > SAL_CALL PropertyBag_getSupportedServiceNames() throw()
+void createRegistryInfo_OPropertyBag()
{
- return ::comphelper::OPropertyBag::getSupportedServiceNames_static();
-}
-
-::rtl::OUString SAL_CALL PropertyBag_getImplementationName() throw()
-{
- return ::comphelper::OPropertyBag::getImplementationName_static();
-}
-
-uno::Reference< uno::XInterface > SAL_CALL PropertyBag_createInstance(const uno::Reference< uno::XComponentContext >& rxContext) throw( uno::Exception )
-{
- return ::comphelper::OPropertyBag::Create( rxContext );
+ static ::comphelper::module::OAutoRegistration< ::comphelper::OPropertyBag > aAutoRegistration;
}
//........................................................................
diff --git a/comphelper/source/property/property.cxx b/comphelper/source/property/property.cxx
index 82e38d49c433..fe6cbaa9d767 100644
--- a/comphelper/source/property/property.cxx
+++ b/comphelper/source/property/property.cxx
@@ -97,8 +97,12 @@ void copyProperties(const Reference<XPropertySet>& _rxSource,
try
{
aDestProp = xDestProps->getPropertyByName(pSourceProps->Name);
- if (0 == (aDestProp.Attributes & PropertyAttribute::READONLY))
- _rxDest->setPropertyValue(pSourceProps->Name, _rxSource->getPropertyValue(pSourceProps->Name));
+ if (0 == (aDestProp.Attributes & PropertyAttribute::READONLY) )
+ {
+ const Any aSourceValue = _rxSource->getPropertyValue(pSourceProps->Name);
+ if ( 0 != (aDestProp.Attributes & PropertyAttribute::MAYBEVOID) || aSourceValue.hasValue() )
+ _rxDest->setPropertyValue(pSourceProps->Name, aSourceValue);
+ }
}
catch (Exception&)
{
diff --git a/comphelper/source/streaming/memorystream.cxx b/comphelper/source/streaming/memorystream.cxx
index 5abbb352b14c..b999c0f8e6af 100644
--- a/comphelper/source/streaming/memorystream.cxx
+++ b/comphelper/source/streaming/memorystream.cxx
@@ -31,17 +31,20 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_comphelper.hxx"
+#include "comphelper_module.hxx"
+
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/io/XSeekableInputStream.hpp>
+#include <com/sun/star/io/XTruncate.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
-#include <cppuhelper/implbase3.hxx>
+#include <cppuhelper/implbase4.hxx>
#include <string.h>
#include <vector>
using ::rtl::OUString;
using ::cppu::OWeakObject;
-using ::cppu::WeakImplHelper3;
+using ::cppu::WeakImplHelper4;
using namespace ::com::sun::star::io;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
@@ -50,7 +53,7 @@ using namespace ::osl;
namespace comphelper
{
-class UNOMemoryStream : public WeakImplHelper3 < XStream, XSeekableInputStream, XOutputStream >
+class UNOMemoryStream : public WeakImplHelper4 < XStream, XSeekableInputStream, XOutputStream, XTruncate >
{
public:
UNOMemoryStream();
@@ -77,6 +80,14 @@ public:
virtual void SAL_CALL flush() throw (NotConnectedException, BufferSizeExceededException, IOException, RuntimeException);
virtual void SAL_CALL closeOutput() throw (NotConnectedException, BufferSizeExceededException, IOException, RuntimeException);
+ // XTruncate
+ virtual void SAL_CALL truncate() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo - static versions (used for component registration)
+ static ::rtl::OUString SAL_CALL getImplementationName_static();
+ static Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static();
+ static Reference< XInterface > SAL_CALL Create( const Reference< ::com::sun::star::uno::XComponentContext >& );
+
private:
std::vector< sal_Int8 > maData;
sal_Int32 mnCursor;
@@ -109,8 +120,7 @@ sal_Int32 SAL_CALL UNOMemoryStream::readBytes( Sequence< sal_Int8 >& aData, sal_
throw IOException();
nBytesToRead = std::min( nBytesToRead, available() );
- if( aData.getLength() < nBytesToRead )
- aData.realloc( nBytesToRead );
+ aData.realloc( nBytesToRead );
if( nBytesToRead )
{
@@ -150,9 +160,13 @@ void SAL_CALL UNOMemoryStream::closeInput() throw (NotConnectedException, IOExce
// XSeekable
void SAL_CALL UNOMemoryStream::seek( sal_Int64 location ) throw (IllegalArgumentException, IOException, RuntimeException)
{
- if( (location < 0) || (location > SAL_MAX_INT32) || (location > static_cast< sal_Int64 >( maData.size() )) )
+ if( (location < 0) || (location > SAL_MAX_INT32) )
throw IllegalArgumentException( OUString(RTL_CONSTASCII_USTRINGPARAM("this implementation does not support more than 2GB!")), Reference< XInterface >(static_cast<OWeakObject*>(this)), 0 );
+ // seek operation should be able to resize the stream
+ if ( location > static_cast< sal_Int64 >( maData.size() ) )
+ maData.resize( static_cast< sal_Int32 >( location ) );
+
mnCursor = static_cast< sal_Int32 >( location );
}
@@ -199,22 +213,35 @@ void SAL_CALL UNOMemoryStream::closeOutput() throw (NotConnectedException, Buffe
mnCursor = 0;
}
-OUString SAL_CALL UNOMemoryStream_getImplementationName() throw()
+//XTruncate
+void SAL_CALL UNOMemoryStream::truncate() throw (IOException, RuntimeException)
+{
+ maData.resize( 0 );
+ mnCursor = 0;
+}
+
+::rtl::OUString SAL_CALL UNOMemoryStream::getImplementationName_static()
{
static const OUString sImplName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.MemoryStream" ) );
return sImplName;
}
-Sequence< OUString > SAL_CALL UNOMemoryStream_getSupportedServiceNames() throw()
+Sequence< ::rtl::OUString > SAL_CALL UNOMemoryStream::getSupportedServiceNames_static()
{
Sequence< OUString > aSeq(1);
- aSeq[0] = UNOMemoryStream_getImplementationName();
+ aSeq[0] = getImplementationName_static();
return aSeq;
}
-Reference< XInterface > SAL_CALL UNOMemoryStream_createInstance(const Reference< XComponentContext > & ) throw( Exception )
+Reference< XInterface > SAL_CALL UNOMemoryStream::Create(
+ const Reference< XComponentContext >& )
{
return static_cast<OWeakObject*>(new UNOMemoryStream());
}
} // namespace comphelper
+
+void createRegistryInfo_UNOMemoryStream()
+{
+ static ::comphelper::module::OAutoRegistration< ::comphelper::UNOMemoryStream > aAutoRegistration;
+}
diff --git a/comphelper/source/streaming/seqinputstreamserv.cxx b/comphelper/source/streaming/seqinputstreamserv.cxx
index b10b38dda05a..af7d9fcf44dd 100644
--- a/comphelper/source/streaming/seqinputstreamserv.cxx
+++ b/comphelper/source/streaming/seqinputstreamserv.cxx
@@ -31,6 +31,8 @@
// MARKER( update_precomp.py ): autogen include statement, do not remove
#include "precompiled_comphelper.hxx"
+#include "comphelper_module.hxx"
+
#include <sal/config.h>
#include <osl/mutex.hxx>
#include <cppuhelper/factory.hxx>
@@ -46,11 +48,6 @@
using namespace ::com::sun::star;
-::rtl::OUString SAL_CALL SequenceInputStreamService_getImplementationName();
-uno::Sequence< ::rtl::OUString > SAL_CALL SequenceInputStreamService_getSupportedServiceNames();
-uno::Reference< uno::XInterface > SAL_CALL SequenceInputStreamService_createInstance( const uno::Reference< uno::XComponentContext > & rxContext ) SAL_THROW( (uno::Exception ) );
-
-
namespace {
class SequenceInputStreamService:
@@ -67,6 +64,11 @@ public:
virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString & ServiceName ) throw ( uno::RuntimeException );
virtual uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw ( uno::RuntimeException );
+ // XServiceInfo - static versions (used for component registration)
+ static ::rtl::OUString SAL_CALL getImplementationName_static();
+ static uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static();
+ static uno::Reference< uno::XInterface > SAL_CALL Create( const uno::Reference< uno::XComponentContext >& );
+
// ::com::sun::star::io::XInputStream:
virtual ::sal_Int32 SAL_CALL readBytes( uno::Sequence< ::sal_Int8 > & aData, ::sal_Int32 nBytesToRead ) throw ( uno::RuntimeException, io::NotConnectedException, io::BufferSizeExceededException, io::IOException );
virtual ::sal_Int32 SAL_CALL readSomeBytes( uno::Sequence< ::sal_Int8 > & aData, ::sal_Int32 nMaxBytesToRead ) throw ( uno::RuntimeException, io::NotConnectedException, io::BufferSizeExceededException, io::IOException );
@@ -102,12 +104,17 @@ SequenceInputStreamService::SequenceInputStreamService()
// com.sun.star.uno.XServiceInfo:
::rtl::OUString SAL_CALL SequenceInputStreamService::getImplementationName() throw ( uno::RuntimeException )
{
- return SequenceInputStreamService_getImplementationName();
+ return getImplementationName_static();
+}
+
+::rtl::OUString SAL_CALL SequenceInputStreamService::getImplementationName_static()
+{
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.SequenceInputStreamService" ) );
}
::sal_Bool SAL_CALL SequenceInputStreamService::supportsService( ::rtl::OUString const & serviceName ) throw ( uno::RuntimeException )
{
- uno::Sequence< ::rtl::OUString > serviceNames = SequenceInputStreamService_getSupportedServiceNames();
+ uno::Sequence< ::rtl::OUString > serviceNames = getSupportedServiceNames();
for ( ::sal_Int32 i = 0; i < serviceNames.getLength(); ++i ) {
if ( serviceNames[i] == serviceName )
return sal_True;
@@ -117,7 +124,21 @@ SequenceInputStreamService::SequenceInputStreamService()
uno::Sequence< ::rtl::OUString > SAL_CALL SequenceInputStreamService::getSupportedServiceNames() throw ( uno::RuntimeException )
{
- return SequenceInputStreamService_getSupportedServiceNames();
+ return getSupportedServiceNames_static();
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL SequenceInputStreamService::getSupportedServiceNames_static()
+{
+ uno::Sequence< ::rtl::OUString > s( 1 );
+ s[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.io.SequenceInputStream" ) );
+ return s;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SequenceInputStreamService::Create(
+ const uno::Reference< uno::XComponentContext >& )
+{
+ return static_cast< ::cppu::OWeakObject * >( new SequenceInputStreamService() );
}
// ::com::sun::star::io::XInputStream:
@@ -227,23 +248,7 @@ void SAL_CALL SequenceInputStreamService::initialize( const uno::Sequence< ::com
} // anonymous namespace
-::rtl::OUString SAL_CALL SequenceInputStreamService_getImplementationName() {
- return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.comp.SequenceInputStreamService" ) );
-}
-
-uno::Sequence< ::rtl::OUString > SAL_CALL SequenceInputStreamService_getSupportedServiceNames()
+void createRegistryInfo_SequenceInputStream()
{
- uno::Sequence< ::rtl::OUString > s( 1 );
- s[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.io.SequenceInputStream" ) );
- return s;
+ static ::comphelper::module::OAutoRegistration< SequenceInputStreamService > aAutoRegistration;
}
-
-uno::Reference< uno::XInterface > SAL_CALL SequenceInputStreamService_createInstance(
- const uno::Reference< uno::XComponentContext >& )
- SAL_THROW( (uno::Exception ) )
-{
- return static_cast< ::cppu::OWeakObject * >( new SequenceInputStreamService() );
-}
-
diff --git a/comphelper/source/streaming/seqoutputstreamserv.cxx b/comphelper/source/streaming/seqoutputstreamserv.cxx
index 1334412f941d..63ff63321f2e 100644
--- a/comphelper/source/streaming/seqoutputstreamserv.cxx
+++ b/comphelper/source/streaming/seqoutputstreamserv.cxx
@@ -30,6 +30,8 @@
#include "precompiled_comphelper.hxx"
+#include "comphelper_module.hxx"
+
#include <sal/config.h>
#include <osl/mutex.hxx>
#include <cppuhelper/factory.hxx>
@@ -43,11 +45,6 @@
using namespace ::com::sun::star;
-::rtl::OUString SAL_CALL SequenceOutputStreamService_getImplementationName();
-uno::Sequence< ::rtl::OUString > SAL_CALL SequenceOutputStreamService_getSupportedServiceNames();
-uno::Reference< uno::XInterface > SAL_CALL SequenceOutputStreamService_createInstance( const uno::Reference< uno::XComponentContext >& rxContext )SAL_THROW((uno::Exception));
-
-
namespace {
class SequenceOutputStreamService:
@@ -61,6 +58,11 @@ public:
virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString & ServiceName ) throw ( uno::RuntimeException );
virtual uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw ( uno::RuntimeException );
+ // XServiceInfo - static versions (used for component registration)
+ static ::rtl::OUString SAL_CALL getImplementationName_static();
+ static uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static();
+ static uno::Reference< uno::XInterface > SAL_CALL Create( const uno::Reference< uno::XComponentContext >& );
+
// ::com::sun::star::io::XOutputStream:
virtual void SAL_CALL writeBytes( const uno::Sequence< ::sal_Int8 > & aData ) throw ( io::NotConnectedException, io::BufferSizeExceededException, io::IOException, uno::RuntimeException );
virtual void SAL_CALL flush() throw ( uno::RuntimeException, io::NotConnectedException, io::BufferSizeExceededException, io::IOException );
@@ -88,12 +90,17 @@ SequenceOutputStreamService::SequenceOutputStreamService()
// com.sun.star.uno.XServiceInfo:
::rtl::OUString SAL_CALL SequenceOutputStreamService::getImplementationName() throw ( uno::RuntimeException )
{
- return SequenceOutputStreamService_getImplementationName();
+ return getImplementationName_static();
+}
+
+::rtl::OUString SAL_CALL SequenceOutputStreamService::getImplementationName_static()
+{
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.SequenceOutputStreamService" ) );
}
::sal_Bool SAL_CALL SequenceOutputStreamService::supportsService( ::rtl::OUString const & serviceName ) throw ( uno::RuntimeException )
{
- uno::Sequence< ::rtl::OUString > serviceNames = SequenceOutputStreamService_getSupportedServiceNames();
+ uno::Sequence< ::rtl::OUString > serviceNames = getSupportedServiceNames();
for ( ::sal_Int32 i = 0; i < serviceNames.getLength(); ++i ) {
if ( serviceNames[i] == serviceName )
return sal_True;
@@ -103,7 +110,20 @@ SequenceOutputStreamService::SequenceOutputStreamService()
uno::Sequence< ::rtl::OUString > SAL_CALL SequenceOutputStreamService::getSupportedServiceNames() throw ( uno::RuntimeException )
{
- return SequenceOutputStreamService_getSupportedServiceNames();
+ return getSupportedServiceNames_static();
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL SequenceOutputStreamService::getSupportedServiceNames_static()
+{
+ uno::Sequence< ::rtl::OUString > s( 1 );
+ s[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.SequenceOutputStream" ) );
+ return s;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SequenceOutputStreamService::Create(
+ const uno::Reference< uno::XComponentContext >& )
+{
+ return static_cast< ::cppu::OWeakObject * >( new SequenceOutputStreamService());
}
// ::com::sun::star::io::XOutputStream:
@@ -149,23 +169,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL SequenceOutputStreamService::getWrittenByte
} // anonymous namespace
-::rtl::OUString SAL_CALL SequenceOutputStreamService_getImplementationName() {
- return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.comp.SequenceOutputStreamService" ) );
-}
-
-uno::Sequence< ::rtl::OUString > SAL_CALL SequenceOutputStreamService_getSupportedServiceNames()
+void createRegistryInfo_SequenceOutputStream()
{
- uno::Sequence< ::rtl::OUString > s( 1 );
- s[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.io.SequenceOutputStream" ) );
- return s;
+ static ::comphelper::module::OAutoRegistration< SequenceOutputStreamService > aAutoRegistration;
}
-
-uno::Reference< uno::XInterface > SAL_CALL SequenceOutputStreamService_createInstance(
- const uno::Reference< uno::XComponentContext >& )
- SAL_THROW( (uno::Exception) )
-{
- return static_cast< ::cppu::OWeakObject * >( new SequenceOutputStreamService());
-}
-
diff --git a/dtrans/source/X11/X11_droptarget.cxx b/dtrans/source/X11/X11_droptarget.cxx
index 501eff09ead8..4f71a0507790 100644
--- a/dtrans/source/X11/X11_droptarget.cxx
+++ b/dtrans/source/X11/X11_droptarget.cxx
@@ -143,15 +143,13 @@ void DropTarget::setDefaultActions( sal_Int8 actions ) throw()
void DropTarget::drop( const DropTargetDropEvent& dtde ) throw()
{
- ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
+ osl::ClearableGuard< ::osl::Mutex > aGuard( m_aMutex );
+ std::list< Reference< XDropTargetListener > > aListeners( m_aListeners );
+ aGuard.clear();
- ::std::list< Reference< XDropTargetListener > >::iterator it1, it2;
- it1 = m_aListeners.begin();
- while( it1 != m_aListeners.end() )
+ for( std::list< Reference< XDropTargetListener > >::iterator it = aListeners.begin(); it!= aListeners.end(); ++it )
{
- it2 = it1;
- it1++;
- (*it2)->drop( dtde );
+ (*it)->drop( dtde );
}
}
@@ -159,15 +157,13 @@ void DropTarget::drop( const DropTargetDropEvent& dtde ) throw()
void DropTarget::dragEnter( const DropTargetDragEnterEvent& dtde ) throw()
{
- ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
+ osl::ClearableGuard< ::osl::Mutex > aGuard( m_aMutex );
+ std::list< Reference< XDropTargetListener > > aListeners( m_aListeners );
+ aGuard.clear();
- ::std::list< Reference< XDropTargetListener > >::iterator it1, it2;
- it1 = m_aListeners.begin();
- while( it1 != m_aListeners.end() )
+ for( std::list< Reference< XDropTargetListener > >::iterator it = aListeners.begin(); it!= aListeners.end(); ++it )
{
- it2 = it1;
- it1++;
- (*it2)->dragEnter( dtde );
+ (*it)->dragEnter( dtde );
}
}
@@ -175,15 +171,13 @@ void DropTarget::dragEnter( const DropTargetDragEnterEvent& dtde ) throw()
void DropTarget::dragExit( const DropTargetEvent& dte ) throw()
{
- ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
+ osl::ClearableGuard< ::osl::Mutex > aGuard( m_aMutex );
+ std::list< Reference< XDropTargetListener > > aListeners( m_aListeners );
+ aGuard.clear();
- ::std::list< Reference< XDropTargetListener > >::iterator it1, it2;
- it1 = m_aListeners.begin();
- while( it1 != m_aListeners.end() )
+ for( std::list< Reference< XDropTargetListener > >::iterator it = aListeners.begin(); it!= aListeners.end(); ++it )
{
- it2 = it1;
- it1++;
- (*it2)->dragExit( dte );
+ (*it)->dragExit( dte );
}
}
@@ -191,15 +185,13 @@ void DropTarget::dragExit( const DropTargetEvent& dte ) throw()
void DropTarget::dragOver( const DropTargetDragEvent& dtde ) throw()
{
- ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
+ osl::ClearableGuard< ::osl::Mutex > aGuard( m_aMutex );
+ std::list< Reference< XDropTargetListener > > aListeners( m_aListeners );
+ aGuard.clear();
- ::std::list< Reference< XDropTargetListener > >::iterator it1, it2;
- it1 = m_aListeners.begin();
- while( it1 != m_aListeners.end() )
+ for( std::list< Reference< XDropTargetListener > >::iterator it = aListeners.begin(); it!= aListeners.end(); ++it )
{
- it2 = it1;
- it1++;
- (*it2)->dragOver( dtde );
+ (*it)->dragOver( dtde );
}
}
diff --git a/dtrans/source/X11/X11_selection.cxx b/dtrans/source/X11/X11_selection.cxx
index 2a424984850a..affc92e98908 100644
--- a/dtrans/source/X11/X11_selection.cxx
+++ b/dtrans/source/X11/X11_selection.cxx
@@ -1117,7 +1117,7 @@ bool SelectionManager::getPasteData( Atom selection, const ::rtl::OUString& rTyp
bSuccess = getPasteData( selection, m_nImageBmpAtom, rData );
#if OSL_DEBUG_LEVEL > 1
if( bSuccess )
- fprintf( stderr, "got %d bytes of image/bmp\n" ), (int)rData.getLength();
+ fprintf( stderr, "got %d bytes of image/bmp\n", (int)rData.getLength() );
#endif
if( ! bSuccess )
{
@@ -1685,7 +1685,7 @@ bool SelectionManager::handleSelectionRequest( XSelectionRequestEvent& rRequest
XA_INTEGER, 32, PropModeReplace, (const unsigned char*)&nTimeStamp, 1 );
aNotify.xselection.property = rRequest.property;
#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "sending timestamp: %d\n", nTimeStamp );
+ fprintf( stderr, "sending timestamp: %d\n", (int)nTimeStamp );
#endif
}
else
diff --git a/goodies/prj/build.lst b/goodies/prj/build.lst
index fb1f7a0f1aca..f8edce86c4f8 100644
--- a/goodies/prj/build.lst
+++ b/goodies/prj/build.lst
@@ -1,4 +1,4 @@
-go goodies : svtools NULL
+go goodies : l10n svtools NULL
go goodies usr1 - all g_mkout NULL
go goodies\inc nmake - all g_inc NULL
go goodies\prj get - all g_prj NULL
diff --git a/i18npool/inc/i18npool/paper.hxx b/i18npool/inc/i18npool/paper.hxx
new file mode 100644
index 000000000000..5690a8fe7254
--- /dev/null
+++ b/i18npool/inc/i18npool/paper.hxx
@@ -0,0 +1,155 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile$
+ *
+ * $Revision$
+ *
+ * last change: $Author$ $Date$
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 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
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_I18NPOOL_PAPER_HXX
+#define INCLUDED_I18NPOOL_PAPER_HXX
+
+#include <sal/config.h>
+
+#include "i18npool/i18npooldllapi.h"
+#include <rtl/string.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+
+enum Paper
+{
+ PAPER_A0,
+ PAPER_A1,
+ PAPER_A2,
+ PAPER_A3,
+ PAPER_A4,
+ PAPER_A5,
+ PAPER_B4_ISO,
+ PAPER_B5_ISO,
+ PAPER_LETTER,
+ PAPER_LEGAL,
+ PAPER_TABLOID,
+ PAPER_USER,
+ PAPER_B6_ISO,
+ PAPER_ENV_C4,
+ PAPER_ENV_C5,
+ PAPER_ENV_C6,
+ PAPER_ENV_C65,
+ PAPER_ENV_DL,
+ PAPER_SLIDE_DIA,
+ PAPER_SCREEN,
+ PAPER_C,
+ PAPER_D,
+ PAPER_E,
+ PAPER_EXECUTIVE,
+ PAPER_FANFOLD_LEGAL_DE,
+ PAPER_ENV_MONARCH,
+ PAPER_ENV_PERSONAL,
+ PAPER_ENV_9,
+ PAPER_ENV_10,
+ PAPER_ENV_11,
+ PAPER_ENV_12,
+ PAPER_KAI16,
+ PAPER_KAI32,
+ PAPER_KAI32BIG,
+ PAPER_B4_JIS,
+ PAPER_B5_JIS,
+ PAPER_B6_JIS,
+ PAPER_LEDGER,
+ PAPER_STATEMENT,
+ PAPER_QUARTO,
+ PAPER_10x14,
+ PAPER_ENV_14,
+ PAPER_ENV_C3,
+ PAPER_ENV_ITALY,
+ PAPER_FANFOLD_US,
+ PAPER_FANFOLD_DE,
+ PAPER_POSTCARD_JP,
+ PAPER_9x11,
+ PAPER_10x11,
+ PAPER_15x11,
+ PAPER_ENV_INVITE,
+ PAPER_A_PLUS,
+ PAPER_B_PLUS,
+ PAPER_LETTER_PLUS,
+ PAPER_A4_PLUS,
+ PAPER_DOUBLEPOSTCARD_JP,
+ PAPER_A6,
+ PAPER_12x11,
+ PAPER_A7,
+ PAPER_A8,
+ PAPER_A9,
+ PAPER_A10,
+ PAPER_B0_ISO,
+ PAPER_B1_ISO,
+ PAPER_B2_ISO,
+ PAPER_B3_ISO,
+ PAPER_B7_ISO,
+ PAPER_B8_ISO,
+ PAPER_B9_ISO,
+ PAPER_B10_ISO,
+ PAPER_ENV_C2,
+ PAPER_ENV_C7,
+ PAPER_ENV_C8,
+ PAPER_ARCHA,
+ PAPER_ARCHB,
+ PAPER_ARCHC,
+ PAPER_ARCHD,
+ PAPER_ARCHE
+};
+
+// ---------
+// - Paper -
+// ---------
+
+class I18NPOOL_DLLPUBLIC PaperInfo
+{
+ Paper m_eType;
+ long m_nPaperWidth; // width in 100thMM
+ long m_nPaperHeight; // height in 100thMM
+public:
+ PaperInfo(Paper eType);
+ PaperInfo(long nPaperWidth, long nPaperHeight);
+
+ Paper getPaper() const { return m_eType; }
+ long getWidth() const { return m_nPaperWidth; }
+ long getHeight() const { return m_nPaperHeight; }
+ bool sloppyEqual(const PaperInfo &rOther) const;
+ bool doSloppyFit();
+
+ static PaperInfo getSystemDefaultPaper();
+ static PaperInfo getDefaultPaperForLocale(const ::com::sun::star::lang::Locale & rLocale);
+
+ static Paper fromPSName(const rtl::OString &rName);
+ static rtl::OString toPSName(Paper eType);
+
+ static long sloppyFitPageDimension(long nDimension);
+};
+
+#endif // INCLUDED_I18NPOOL_PAPER_HXX
diff --git a/i18npool/prj/build.lst b/i18npool/prj/build.lst
index 98fec96d0149..24e9607596ac 100644
--- a/i18npool/prj/build.lst
+++ b/i18npool/prj/build.lst
@@ -9,6 +9,7 @@ inp i18npool\source\transliteration nmake - all inp_translit inp
inp i18npool\source\isolang nmake - all inp_isolang inp_inc NULL
inp i18npool\source\localedata nmake - all inp_localedata inp_isolang inp_inc NULL
inp i18npool\source\localedata\data nmake - all inp_locdata_data inp_localedata inp_inc NULL
+inp i18npool\source\paper nmake - all inp_paper inp_isolang inp_inc NULL
inp i18npool\source\calendar nmake - all inp_cal inp_inc NULL
inp i18npool\source\numberformatcode nmake - all inp_numformat inp_inc NULL
inp i18npool\source\defaultnumberingprovider nmake - all inp_dnum inp_inc NULL
@@ -22,4 +23,4 @@ inp i18npool\source\textconversion nmake - all inp_textconversi
inp i18npool\source\textconversion\data nmake - all inp_textconv_dict inp_textconversion inp_inc NULL
inp i18npool\source\search nmake - all inp_search inp_inc NULL
inp i18npool\source\ordinalsuffix nmake - all inp_ordinalsuffix NULL
-inp i18npool\util nmake - all inp_util inp_brkit inp_dict inp_chclass inp_translit inp_cal inp_dnum inp_natnum inp_localedata inp_locdata_data inp_numformat inp_rserv inp_index inp_index_data inp_collator inp_collator_data inp_inputchecker inp_textconversion inp_textconv_dict inp_search inp_isolang inp_ordinalsuffix NULL
+inp i18npool\util nmake - all inp_util inp_brkit inp_dict inp_chclass inp_translit inp_cal inp_dnum inp_natnum inp_localedata inp_locdata_data inp_numformat inp_rserv inp_index inp_index_data inp_collator inp_collator_data inp_inputchecker inp_textconversion inp_textconv_dict inp_search inp_isolang inp_paper inp_ordinalsuffix NULL
diff --git a/i18npool/prj/d.lst b/i18npool/prj/d.lst
index 052ad4d23273..54aefa732b89 100644
--- a/i18npool/prj/d.lst
+++ b/i18npool/prj/d.lst
@@ -40,3 +40,9 @@ mkdir: %_DEST%\inc%_EXT%\i18npool
..\%__SRC%\bin\i18nisol*.dll %_DEST%\bin%_EXT%\i18nisol*.dll
..\%__SRC%\lib\libi18nisolang*.so %_DEST%\lib%_EXT%\libi18nisolang*.so
..\%__SRC%\lib\libi18nisolang*.dylib %_DEST%\lib%_EXT%\libi18nisolang*.dylib
+
+..\%__SRC%\lib\ii18npaper*.lib %_DEST%\lib%_EXT%\ii18npaper*.lib
+..\%__SRC%\bin\i18npaper*.dll %_DEST%\bin%_EXT%\i18npaper*.dll
+..\%__SRC%\lib\libi18npaper*.so %_DEST%\lib%_EXT%\libi18npaper*.so
+..\%__SRC%\lib\libi18npaper*.dylib %_DEST%\lib%_EXT%\libi18npaper*.dylib
+
diff --git a/i18npool/source/paper/makefile.mk b/i18npool/source/paper/makefile.mk
new file mode 100644
index 000000000000..2aef382a32fa
--- /dev/null
+++ b/i18npool/source/paper/makefile.mk
@@ -0,0 +1,75 @@
+#*************************************************************************
+#*
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2008 by Sun Microsystems, Inc.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.9 $
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org 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 version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#************************************************************************/
+
+PRJ=..$/..
+
+PRJNAME=i18npool
+TARGET=i18npaper
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/version.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+#
+SLOFILES=$(SLO)$/paper.obj
+SHL1OBJS=$(SLOFILES)
+
+SHL1TARGET=$(TARGET)$(DLLPOSTFIX)
+SHL1IMPLIB=i$(TARGET)
+
+DEF1DEPN=$(MISC)$/$(SHL1TARGET).flt
+SHL1DEF=$(MISC)$/$(SHL1TARGET).def
+DEF1NAME=$(SHL1TARGET)
+DEFLIB1NAME=$(SHL1TARGET)
+
+LIB1TARGET= $(SLB)$/$(SHL1TARGET).lib
+LIB1OBJFILES=$(SHL1OBJS)
+
+SHL1STDLIBS= \
+ $(I18NISOLANGLIB) \
+ $(COMPHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB)
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+$(MISC)$/$(SHL1TARGET).flt: makefile.mk
+ @echo ------------------------------
+ @echo Making: $@
+ @echo CLEAR_THE_FILE > $@
+ @echo __CT >> $@
diff --git a/i18npool/source/paper/paper.cxx b/i18npool/source/paper/paper.cxx
new file mode 100644
index 000000000000..a81b9b370b8c
--- /dev/null
+++ b/i18npool/source/paper/paper.cxx
@@ -0,0 +1,473 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile$
+ * $Revision$
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_i18npool.hxx"
+#include <sal/config.h>
+#include <rtl/ustring.hxx>
+#include <rtl/string.hxx>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/i18n/ScriptType.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+
+#include "i18npool/mslangid.hxx"
+#include "i18npool/paper.hxx"
+
+#include <utility>
+#include <cstdlib>
+
+#ifdef UNX
+#include <stdio.h>
+#include <string.h>
+#include <locale.h>
+#include <langinfo.h>
+#endif
+
+struct PageDesc
+{
+ long m_nWidth;
+ long m_nHeight;
+ const char *m_pPSName;
+ const char *m_pAltPSName;
+};
+
+#define PT2MM100( v ) \
+ (long)(((v) * 35.27777778) + 0.5)
+
+#define IN2MM100( v ) \
+ ((long)((v) * 2540))
+
+#define MM2MM100( v ) \
+ ((long)((v) * 100))
+
+//PostScript Printer Description File Format Specification
+//http://partners.adobe.com/public/developer/en/ps/5003.PPD_Spec_v4.3.pdf
+//http://www.y-adagio.com/public/committees/docsii/doc_00-49/symp_ulaan/china_ppr.pdf (Kai)
+//http://www.sls.psi.ch/controls/help/howto/Howto_Print_a_A0_Poster_at_WSLA_012_2.pdf (Dia)
+static PageDesc aDinTab[] =
+{
+ { MM2MM100( 841 ), MM2MM100( 1189 ), "A0", NULL },
+ { MM2MM100( 594 ), MM2MM100( 841 ), "A1", NULL },
+ { MM2MM100( 420 ), MM2MM100( 594 ), "A2", NULL },
+ { MM2MM100( 297 ), MM2MM100( 420 ), "A3", NULL },
+ { MM2MM100( 210 ), MM2MM100( 297 ), "A4", NULL },
+ { MM2MM100( 148 ), MM2MM100( 210 ), "A5", NULL },
+ { MM2MM100( 250 ), MM2MM100( 353 ), "ISOB4", NULL },
+ { MM2MM100( 176 ), MM2MM100( 250 ), "ISOB5", NULL },
+ { IN2MM100( 8.5 ), IN2MM100( 11 ), "Letter", "Note" },
+ { IN2MM100( 8.5 ), IN2MM100( 14 ), "Legal", NULL },
+ { IN2MM100( 11 ), IN2MM100( 17 ), "Tabloid", "11x17" },
+ { 0, 0, NULL, NULL }, //User
+ { MM2MM100( 125 ), MM2MM100( 176 ), "ISOB6", NULL },
+ { MM2MM100( 229 ), MM2MM100( 324 ), "EnvC4", "C4" },
+ { MM2MM100( 162 ), MM2MM100( 229 ), "EnvC5", "C5" },
+ { MM2MM100( 114 ), MM2MM100( 162 ), "EnvC6", "C6" },
+ { MM2MM100( 114 ), MM2MM100( 229 ), "EnvC65", NULL },
+ { MM2MM100( 110 ), MM2MM100( 220 ), "EnvDL", "DL" },
+ { MM2MM100( 180), MM2MM100( 270 ), NULL, NULL }, //Dia
+ { MM2MM100( 210), MM2MM100( 280 ), NULL, NULL }, //Screen
+ { IN2MM100( 17 ), IN2MM100( 22 ), "AnsiC", "CSheet" },
+ { IN2MM100( 22 ), IN2MM100( 34 ), "AnsiD", "DSheet" },
+ { IN2MM100( 34 ), IN2MM100( 44 ), "AnsiE", "ESheet" },
+ { IN2MM100( 7.25 ), IN2MM100( 10.5 ), "Executive", NULL },
+ //"Folio" is a different size in the PPD documentation than 8.5x11
+ //This "FanFoldGermanLegal" is known in the Philippines as
+ //"Legal" paper or "Long Bond Paper". The "Legal" name causing untold
+ //misery, given the differently sized US "Legal" paper
+ { IN2MM100( 8.5 ), IN2MM100( 13 ), "FanFoldGermanLegal", NULL },
+ { IN2MM100( 3.875 ), IN2MM100( 7.5 ), "EnvMonarch", "Monarch" },
+ { IN2MM100( 3.625 ), IN2MM100( 6.5 ), "EnvPersonal", "Personal" },
+ { IN2MM100( 3.875 ), IN2MM100( 8.875 ), "Env9", NULL },
+ { IN2MM100( 4.125 ), IN2MM100( 9.5 ), "Env10", "Comm10" },
+ { IN2MM100( 4.5 ), IN2MM100( 10.375 ), "Env11", NULL },
+ { IN2MM100( 4.75 ), IN2MM100( 11 ), "Env12", NULL },
+ { MM2MM100( 184 ), MM2MM100( 260 ), NULL, NULL }, //Kai16
+ { MM2MM100( 130 ), MM2MM100( 184 ), NULL, NULL }, //Kai32
+ { MM2MM100( 140 ), MM2MM100( 203 ), NULL, NULL }, //BigKai32
+ { MM2MM100( 257 ), MM2MM100( 364 ), "B4", NULL }, //JIS
+ { MM2MM100( 182 ), MM2MM100( 257 ), "B5", NULL }, //JIS
+ { MM2MM100( 128 ), MM2MM100( 182 ), "B6", NULL }, //JIS
+ { IN2MM100( 17 ), IN2MM100( 11 ), "Ledger", NULL },
+ { IN2MM100( 5.5 ), IN2MM100( 8.5 ), "Statement", NULL },
+ { PT2MM100( 610 ), PT2MM100( 780 ), "Quarto", NULL },
+ { IN2MM100( 10 ), IN2MM100( 14 ), "10x14", NULL },
+ { IN2MM100( 5.5 ), IN2MM100( 11.5 ), "Env14", NULL },
+ { MM2MM100( 324 ), MM2MM100( 458 ), "EnvC3", "C3" },
+ { MM2MM100( 110 ), MM2MM100( 230 ), "EnvItalian", NULL },
+ { IN2MM100( 14.875 ),IN2MM100( 11 ), "FanFoldUS", NULL },
+ { IN2MM100( 8.5 ), IN2MM100( 13 ), "FanFoldGerman", NULL },
+ { MM2MM100( 100 ), MM2MM100( 148 ), "Postcard", NULL },
+ { IN2MM100( 9 ), IN2MM100( 11 ), "9x11", NULL },
+ { IN2MM100( 10 ), IN2MM100( 11 ), "10x11", NULL },
+ { IN2MM100( 15 ), IN2MM100( 11 ), "15x11", NULL },
+ { MM2MM100( 220 ), MM2MM100( 220 ), "EnvInvite", NULL },
+ { MM2MM100( 227 ), MM2MM100( 356 ), "SuperA", NULL },
+ { MM2MM100( 305 ), MM2MM100( 487 ), "SuperB", NULL },
+ { IN2MM100( 8.5 ), IN2MM100( 12.69 ), "LetterPlus", NULL },
+ { IN2MM100( 8.5 ), IN2MM100( 12.69 ), "LetterPlus", NULL },
+ { MM2MM100( 210 ), MM2MM100( 330 ), "A4Plus", NULL },
+ { MM2MM100( 200 ), MM2MM100( 148 ), "DoublePostcard", NULL },
+ { MM2MM100( 105 ), MM2MM100( 148 ), "A6", NULL },
+ { IN2MM100( 12 ), IN2MM100( 11 ), "12x11", NULL },
+ { MM2MM100( 74 ), MM2MM100( 105 ), "A7", NULL },
+ { MM2MM100( 52 ), MM2MM100( 74 ), "A8", NULL },
+ { MM2MM100( 37 ), MM2MM100( 52 ), "A9", NULL },
+ { MM2MM100( 26 ), MM2MM100( 37 ), "A10", NULL },
+ { MM2MM100( 1000 ), MM2MM100( 1414 ), "ISOB0", NULL },
+ { MM2MM100( 707 ), MM2MM100( 1000 ), "ISOB1", NULL },
+ { MM2MM100( 500 ), MM2MM100( 707 ), "ISOB2", NULL },
+ { MM2MM100( 353 ), MM2MM100( 500 ), "ISOB3", NULL },
+ { MM2MM100( 88 ), MM2MM100( 125 ), "ISOB7", NULL },
+ { MM2MM100( 62 ), MM2MM100( 88 ), "ISOB8", NULL },
+ { MM2MM100( 44 ), MM2MM100( 62 ), "ISOB9", NULL },
+ { MM2MM100( 31 ), MM2MM100( 44 ), "ISOB10", NULL },
+ { MM2MM100( 458 ), MM2MM100( 648 ), "EnvC2", "C2" },
+ { MM2MM100( 81 ), MM2MM100( 114 ), "EnvC7", "C7" },
+ { MM2MM100( 57 ), MM2MM100( 81 ), "EnvC8", "C8" },
+ { IN2MM100( 9 ), IN2MM100( 12 ), "ARCHA", NULL },
+ { IN2MM100( 12 ), IN2MM100( 18 ), "ARCHB", NULL },
+ { IN2MM100( 18 ), IN2MM100( 24 ), "ARCHC", NULL },
+ { IN2MM100( 24 ), IN2MM100( 36 ), "ARCHD", NULL },
+ { IN2MM100( 36 ), IN2MM100( 48 ), "ARCHE", NULL }
+};
+
+static const size_t nTabSize = sizeof(aDinTab) / sizeof(aDinTab[0]);
+
+#define MAXSLOPPY 11
+
+bool PaperInfo::doSloppyFit()
+{
+ if (m_eType != PAPER_USER)
+ return true;
+
+ for ( size_t i = 0; i < nTabSize; ++i )
+ {
+ if (i == PAPER_USER) continue;
+
+ long lDiffW = labs(aDinTab[i].m_nWidth - m_nPaperWidth);
+ long lDiffH = labs(aDinTab[i].m_nHeight - m_nPaperHeight);
+
+ if ( lDiffW < MAXSLOPPY && lDiffH < MAXSLOPPY )
+ {
+ m_nPaperWidth = aDinTab[i].m_nWidth;
+ m_nPaperHeight = aDinTab[i].m_nHeight;
+ m_eType = (Paper)i;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool PaperInfo::sloppyEqual(const PaperInfo &rOther) const
+{
+ return
+ (
+ (labs(m_nPaperWidth - rOther.m_nPaperWidth) < MAXSLOPPY) &&
+ (labs(m_nPaperHeight - rOther.m_nPaperHeight) < MAXSLOPPY)
+ );
+}
+
+long PaperInfo::sloppyFitPageDimension(long nDimension)
+{
+ for ( size_t i = 0; i < nTabSize; ++i )
+ {
+ if (i == PAPER_USER) continue;
+ long lDiff;
+
+ lDiff = labs(aDinTab[i].m_nWidth - nDimension);
+ if ( lDiff < MAXSLOPPY )
+ return aDinTab[i].m_nWidth;
+
+ lDiff = labs(aDinTab[i].m_nHeight - nDimension);
+ if ( lDiff < MAXSLOPPY )
+ return aDinTab[i].m_nHeight;
+ }
+ return nDimension;
+}
+
+PaperInfo PaperInfo::getSystemDefaultPaper()
+{
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::lang::XMultiServiceFactory;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::container::XNameAccess;
+ using ::com::sun::star::uno::Exception;
+# define CREATE_OUSTRING( ascii ) \
+ rtl::OUString::intern( RTL_CONSTASCII_USTRINGPARAM( ascii ) )
+
+ rtl::OUString aLocaleStr;
+
+ Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
+ Reference< XMultiServiceFactory > xConfigProv(
+ xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.configuration.ConfigurationProvider" ) ),
+ UNO_QUERY_THROW );
+
+ Sequence< Any > aArgs( 1 );
+ aArgs[ 0 ] <<= CREATE_OUSTRING( "org.openoffice.Setup/L10N/" );
+ Reference< XNameAccess > xConfigNA( xConfigProv->createInstanceWithArguments(
+ CREATE_OUSTRING( "com.sun.star.configuration.ConfigurationAccess" ), aArgs ), UNO_QUERY_THROW );
+ try
+ {
+ // try user-defined locale setting
+ xConfigNA->getByName( CREATE_OUSTRING( "ooSetupSystemLocale" ) ) >>= aLocaleStr;
+ }
+ catch( Exception& ) {}
+
+#ifdef UNX
+ // if set to "use system", get papersize from system
+ if (aLocaleStr.getLength() == 0)
+ {
+ static bool bInitialized = false;
+ static PaperInfo aInstance(PAPER_A4);
+
+ if (bInitialized)
+ return aInstance;
+
+ // try libpaper
+ // #i78617# workaround missing paperconf command
+ FILE* pPipe = popen( "sh -c paperconf 2>/dev/null", "r" );
+ if( pPipe )
+ {
+ Paper ePaper = PAPER_USER;
+
+ char aBuffer[ 1024 ];
+ aBuffer[0] = 0;
+ char *pBuffer = fgets( aBuffer, sizeof(aBuffer), pPipe );
+ pclose( pPipe );
+
+ if (pBuffer && *pBuffer != 0)
+ {
+ rtl::OString aPaper(pBuffer);
+ aPaper = aPaper.trim();
+ static struct { const char *pName; Paper ePaper; } aCustoms [] =
+ {
+ { "B0", PAPER_B0_ISO },
+ { "B1", PAPER_B1_ISO },
+ { "B2", PAPER_B2_ISO },
+ { "B3", PAPER_B3_ISO },
+ { "B4", PAPER_B4_ISO },
+ { "B5", PAPER_B5_ISO },
+ { "B6", PAPER_B6_ISO },
+ { "B7", PAPER_B7_ISO },
+ { "B8", PAPER_B8_ISO },
+ { "B9", PAPER_B9_ISO },
+ { "B10", PAPER_B10_ISO },
+ { "folio", PAPER_FANFOLD_LEGAL_DE },
+ { "flsa", PAPER_FANFOLD_LEGAL_DE },
+ { "flse", PAPER_FANFOLD_LEGAL_DE }
+ };
+
+ bool bHalve = false;
+
+ size_t nExtraTabSize = sizeof(aCustoms) / sizeof(aCustoms[0]);
+ for (size_t i = 0; i < nExtraTabSize; ++i)
+ {
+ if (rtl_str_compareIgnoreAsciiCase(aCustoms[i].pName, aPaper.getStr()) == 0)
+ {
+ ePaper = aCustoms[i].ePaper;
+ break;
+ }
+ }
+
+ if (ePaper == PAPER_USER)
+ {
+ bHalve = !rtl_str_shortenedCompareIgnoreAsciiCase_WithLength(
+ aPaper.getStr(), aPaper.getLength(), "half", 4, 4);
+ if (bHalve)
+ aPaper = aPaper.copy(4);
+ ePaper = PaperInfo::fromPSName(aPaper);
+ }
+
+ if (ePaper != PAPER_USER)
+ {
+ aInstance = PaperInfo(ePaper);
+ if (bHalve)
+ aInstance = PaperInfo(aInstance.getHeight()/2, aInstance.getWidth());
+ bInitialized = true;
+ return aInstance;
+ }
+ }
+ }
+
+#if defined(LC_PAPER) && defined(_GNU_SOURCE)
+
+ union paperword { char *string; int word; };
+
+ // try LC_PAPER
+ paperword w, h;
+ w.string = nl_langinfo(_NL_PAPER_WIDTH);
+ h.string = nl_langinfo(_NL_PAPER_HEIGHT);
+
+ //glibc stores sizes as integer mm units
+ w.word *= 100;
+ h.word *= 100;
+
+ for ( size_t i = 0; i < nTabSize; ++i )
+ {
+ if (i == PAPER_USER) continue;
+
+ //glibc stores sizes as integer mm units, and so is inaccurate. To
+ //find a standard paper size we calculate the standard paper sizes
+ //into equally inaccurate mm and compare
+ long width = (aDinTab[i].m_nWidth + 50) / 100;
+ long height = (aDinTab[i].m_nHeight + 50) / 100;
+
+ if (width == w.word/100 && height == h.word/100)
+ {
+ w.word = aDinTab[i].m_nWidth;
+ h.word = aDinTab[i].m_nHeight;
+ break;
+ }
+ }
+
+ aInstance = PaperInfo(w.word, h.word);
+ bInitialized = true;
+ return aInstance;
+#endif
+ }
+#endif
+
+ try
+ {
+ // if set to "use system", try to get locale from system
+ if( aLocaleStr.getLength() == 0 )
+ xConfigNA->getByName( CREATE_OUSTRING( "Locale" ) ) >>= aLocaleStr;
+ }
+ catch( Exception& ) {}
+
+
+ if (aLocaleStr.getLength() == 0)
+ aLocaleStr = CREATE_OUSTRING("en-US");
+
+ // convert locale string to locale struct
+ ::com::sun::star::lang::Locale aSysLocale;
+ sal_Int32 nDashPos = aLocaleStr.indexOf( '-' );
+ if( nDashPos < 0 ) nDashPos = aLocaleStr.getLength();
+ aSysLocale.Language = aLocaleStr.copy( 0, nDashPos );
+ if( nDashPos + 1 < aLocaleStr.getLength() )
+ aSysLocale.Country = aLocaleStr.copy( nDashPos + 1 );
+
+ return PaperInfo::getDefaultPaperForLocale(aSysLocale);
+}
+
+PaperInfo::PaperInfo(Paper eType) : m_eType(eType)
+{
+ m_nPaperWidth = aDinTab[m_eType].m_nWidth;
+ m_nPaperHeight = aDinTab[m_eType].m_nHeight;
+}
+
+PaperInfo::PaperInfo(long nPaperWidth, long nPaperHeight)
+ : m_eType(PAPER_USER),
+ m_nPaperWidth(nPaperWidth),
+ m_nPaperHeight(nPaperHeight)
+{
+ for ( size_t i = 0; i < nTabSize; ++i )
+ {
+ if (
+ (nPaperWidth == aDinTab[i].m_nWidth) &&
+ (nPaperHeight == aDinTab[i].m_nHeight)
+ )
+ {
+ m_eType = static_cast<Paper>(i);
+ break;
+ }
+ }
+}
+
+rtl::OString PaperInfo::toPSName(Paper ePaper)
+{
+ return static_cast<size_t>(ePaper) < nTabSize ?
+ rtl::OString(aDinTab[ePaper].m_pPSName) : rtl::OString();
+}
+
+Paper PaperInfo::fromPSName(const rtl::OString &rName)
+{
+ if (!rName.getLength())
+ return PAPER_USER;
+
+ for ( size_t i = 0; i < nTabSize; ++i )
+ {
+ if (aDinTab[i].m_pPSName &&
+ !rtl_str_compareIgnoreAsciiCase(aDinTab[i].m_pPSName, rName.getStr()))
+ {
+ return static_cast<Paper>(i);
+ }
+ else if (aDinTab[i].m_pAltPSName &&
+ !rtl_str_compareIgnoreAsciiCase(aDinTab[i].m_pAltPSName, rName.getStr()))
+ {
+ return static_cast<Paper>(i);
+ }
+ }
+
+ return PAPER_USER;
+}
+
+//http://wiki.services.openoffice.org/wiki/DefaultPaperSize
+//http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/localedata/locales/?cvsroot=glibc
+//http://www.unicode.org/cldr/data/charts/supplemental/territory_language_information.html
+//http://en.wikipedia.org/wiki/Paper_size
+//http://msdn.microsoft.com/en-us/library/cc195164.aspx
+PaperInfo PaperInfo::getDefaultPaperForLocale(
+ const ::com::sun::star::lang::Locale & rLocale)
+{
+ Paper eType = PAPER_A4;
+
+ if (
+ //United States, Letter
+ !rLocale.Country.compareToAscii("US") ||
+ //Puerto Rico, http://sources.redhat.com/ml/libc-hacker/2001-07/msg00046.html
+ !rLocale.Country.compareToAscii("PR") ||
+ //Canada, http://sources.redhat.com/ml/libc-hacker/2001-07/msg00053.html
+ !rLocale.Country.compareToAscii("CA") ||
+ //Venuzuela, https://www.redhat.com/archives/fedora-devel-list/2008-August/msg00019.html
+ !rLocale.Country.compareToAscii("VE") ||
+ //Chile, https://www.redhat.com/archives/fedora-devel-list/2008-August/msg00240.html
+ !rLocale.Country.compareToAscii("CL") ||
+ //Mexico, http://qa.openoffice.org/issues/show_bug.cgi?id=49739
+ !rLocale.Country.compareToAscii("MX") ||
+ //Colombia, http://qa.openoffice.org/issues/show_bug.cgi?id=69703
+ !rLocale.Country.compareToAscii("CO") ||
+ //Philippines,
+ // http://ubuntuliving.blogspot.com/2008/07/default-paper-size-in-evince.html
+ // http://www.gov.ph/faqs/driverslicense.asp
+ !rLocale.Country.compareToAscii("PH")
+ )
+ {
+ eType = PAPER_LETTER;
+ }
+
+ return eType;
+}
+
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/o3tl/qa/makefile.mk b/o3tl/qa/makefile.mk
index 563f4e2d3bf2..a6ebfbba4bb9 100644
--- a/o3tl/qa/makefile.mk
+++ b/o3tl/qa/makefile.mk
@@ -75,6 +75,6 @@ unittest : $(SHL1TARGETN)
@echo ----------------------------------------------------------
@echo - start unit test on library $(SHL1TARGETN)
@echo ----------------------------------------------------------
- $(AUGMENT_LIBRARY_PATH) testshl2 -sf $(mktmp ) $(SHL1TARGETN)
+ $(TESTSHL2) -sf $(mktmp ) $(SHL1TARGETN)
ALLTAR : unittest
diff --git a/rsc/source/prj/start.cxx b/rsc/source/prj/start.cxx
index 5a623efeee51..c43879020a8e 100644
--- a/rsc/source/prj/start.cxx
+++ b/rsc/source/prj/start.cxx
@@ -306,8 +306,10 @@ int cdecl main ( int argc, char ** argv)
BOOL bHelp = FALSE;
BOOL bError = FALSE;
BOOL bResponse = FALSE;
- ByteString aPrePro( "rscpp" );
- ByteString aRsc2Name( "rsc2" );
+ ByteString aSolarbin(getenv("SOLARBINDIR"));
+ ByteString aDelim("/");
+ ByteString aPrePro; //( aSolarbin + aDelim + ByteString("rscpp"));
+ ByteString aRsc2Name; //( aSolarbin + aDelim + ByteString("rsc2"));
ByteString aSrsName;
ByteString aResName;
RscStrList aInputList;
@@ -318,6 +320,14 @@ int cdecl main ( int argc, char ** argv)
sal_uInt32 i;
ByteString* pString;
+ aPrePro = aSolarbin;
+ aPrePro += aDelim;
+ aPrePro += ByteString("rscpp");
+
+ aRsc2Name = aSolarbin;
+ aRsc2Name += aDelim;
+ aRsc2Name += ByteString("rsc2");
+
printf( "VCL Resource Compiler 3.0\n" );
pStr = ::ResponseFile( &aCmdLine, argv, argc );
diff --git a/svtools/inc/sfxecode.hxx b/svtools/inc/sfxecode.hxx
index 100336796ea4..01292f1c87fa 100644
--- a/svtools/inc/sfxecode.hxx
+++ b/svtools/inc/sfxecode.hxx
@@ -84,6 +84,7 @@
#define ERRCODE_SFX_MACROS_SUPPORT_DISABLED (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 51)
#define ERRCODE_SFX_DOCUMENT_MACRO_DISABLED (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 52)
#define ERRCODE_SFX_BROKENSIGNATURE (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 53)
+#define ERRCODE_SFX_SHARED_NOPASSWORDCHANGE (ERRCODE_WARNING_MASK | ERRCODE_AREA_SFX | ERRCODE_CLASS_NONE | 54)
diff --git a/svtools/inc/svtools/itemprop.hxx b/svtools/inc/svtools/itemprop.hxx
index 34064595753e..feab0eab004b 100644
--- a/svtools/inc/svtools/itemprop.hxx
+++ b/svtools/inc/svtools/itemprop.hxx
@@ -38,12 +38,13 @@
#include <com/sun/star/beans/XPropertySetInfo.hpp>
#include <com/sun/star/beans/PropertyState.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
-
+#include <vector>
/* -----------------------------21.02.00 11:03--------------------------------
UNO III - Implementation
---------------------------------------------------------------------------*/
#define MAP_CHAR_LEN(cchar) cchar, sizeof(cchar) - 1
-struct SfxItemPropertyMap
+
+struct SfxItemPropertyMapEntry
{
const char* pName;
USHORT nNameLen;
@@ -52,34 +53,83 @@ struct SfxItemPropertyMap
long nFlags;
BYTE nMemberId;
- SVL_DLLPUBLIC static const SfxItemPropertyMap* GetByName(
- const SfxItemPropertyMap *pMap,
- const ::rtl::OUString &rName );
- SVL_DLLPUBLIC static const SfxItemPropertyMap* GetTolerantByName(
- const SfxItemPropertyMap *pMap,
- const ::rtl::OUString &rName );
+};
+
+struct SfxItemPropertySimpleEntry
+{
+ USHORT nWID;
+ const com::sun::star::uno::Type* pType;
+ long nFlags;
+ BYTE nMemberId;
+
+ SfxItemPropertySimpleEntry() :
+ nWID( 0 ),
+ pType( 0 ),
+ nFlags( 0 ),
+ nMemberId( 0 ){}
+
+ SfxItemPropertySimpleEntry(USHORT _nWID, const com::sun::star::uno::Type* _pType,
+ long _nFlags, BYTE _nMemberId) :
+ nWID( _nWID ),
+ pType( _pType ),
+ nFlags( _nFlags ),
+ nMemberId( _nMemberId ){}
+
+ SfxItemPropertySimpleEntry( const SfxItemPropertyMapEntry* pMapEntry ) :
+ nWID( pMapEntry->nWID ),
+ pType( pMapEntry->pType ),
+ nFlags( pMapEntry->nFlags ),
+ nMemberId( pMapEntry->nMemberId ){}
+
+};
+struct SfxItemPropertyNamedEntry : public SfxItemPropertySimpleEntry
+{
+ ::rtl::OUString sName;
+ SfxItemPropertyNamedEntry( const String& rName, const SfxItemPropertySimpleEntry& rSimpleEntry) :
+ SfxItemPropertySimpleEntry( rSimpleEntry ),
+ sName( rName ){}
+
+};
+typedef std::vector< SfxItemPropertyNamedEntry > PropertyEntryVector_t;
+class SfxItemPropertyMap_Impl;
+class SVL_DLLPUBLIC SfxItemPropertyMap
+{
+ SfxItemPropertyMap_Impl* m_pImpl;
+public:
+ SfxItemPropertyMap( const SfxItemPropertyMapEntry* pEntries );
+ SfxItemPropertyMap( const SfxItemPropertyMap* pSource );
+ ~SfxItemPropertyMap();
+
+ const SfxItemPropertySimpleEntry* getByName( const ::rtl::OUString &rName ) const;
+ com::sun::star::uno::Sequence< com::sun::star::beans::Property > getProperties() const;
+ com::sun::star::beans::Property getPropertyByName( const ::rtl::OUString rName ) const
+ throw( ::com::sun::star::beans::UnknownPropertyException );
+ sal_Bool hasPropertyByName( const ::rtl::OUString& rName ) const;
+
+ void mergeProperties( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& rPropSeq );
+ PropertyEntryVector_t getPropertyEntries() const;
+ sal_uInt32 getSize() const;
+
};
/* -----------------------------21.02.00 11:19--------------------------------
---------------------------------------------------------------------------*/
class SVL_DLLPUBLIC SfxItemPropertySet
{
- const SfxItemPropertyMap* _pMap;
+ SfxItemPropertyMap m_aMap;
+ mutable com::sun::star::uno::Reference<com::sun::star::beans::XPropertySetInfo> m_xInfo;
protected:
virtual BOOL FillItem(SfxItemSet& rSet, USHORT nWhich, BOOL bGetProperty) const;
public:
- SfxItemPropertySet( const SfxItemPropertyMap *pMap ) :
- _pMap(pMap) {}
-
- void getPropertyValue( const SfxItemPropertyMap& rMap,
- const SfxItemSet& rSet,
- com::sun::star::uno::Any& rAny) const
- throw(::com::sun::star::uno::RuntimeException);
- com::sun::star::uno::Any
- getPropertyValue( const SfxItemPropertyMap& rMap,
- const SfxItemSet& rSet ) const
- throw(::com::sun::star::uno::RuntimeException);
+ SfxItemPropertySet( const SfxItemPropertyMapEntry *pMap ) :
+ m_aMap(pMap) {}
+ virtual ~SfxItemPropertySet();
+
+ void getPropertyValue( const SfxItemPropertySimpleEntry& rEntry,
+ const SfxItemSet& rSet,
+ com::sun::star::uno::Any& rAny) const
+ throw(::com::sun::star::uno::RuntimeException);
void getPropertyValue( const ::rtl::OUString &rName,
const SfxItemSet& rSet,
com::sun::star::uno::Any& rAny) const
@@ -90,11 +140,11 @@ public:
const SfxItemSet& rSet ) const
throw(::com::sun::star::uno::RuntimeException,
::com::sun::star::beans::UnknownPropertyException);
- void setPropertyValue( const SfxItemPropertyMap& rMap,
- const com::sun::star::uno::Any& aVal,
- SfxItemSet& rSet ) const
- throw(::com::sun::star::uno::RuntimeException,
- com::sun::star::lang::IllegalArgumentException);
+ void setPropertyValue( const SfxItemPropertySimpleEntry& rEntry,
+ const com::sun::star::uno::Any& aVal,
+ SfxItemSet& rSet ) const
+ throw(::com::sun::star::uno::RuntimeException,
+ com::sun::star::lang::IllegalArgumentException);
void setPropertyValue( const ::rtl::OUString& rPropertyName,
const com::sun::star::uno::Any& aVal,
SfxItemSet& rSet ) const
@@ -103,29 +153,31 @@ public:
::com::sun::star::beans::UnknownPropertyException);
com::sun::star::beans::PropertyState
- getPropertyState(const ::rtl::OUString& rName, const SfxItemSet& rSet)
+ getPropertyState(const ::rtl::OUString& rName, const SfxItemSet& rSet)const
throw(com::sun::star::beans::UnknownPropertyException);
com::sun::star::beans::PropertyState
- getPropertyState(const SfxItemPropertyMap& rMap, const SfxItemSet& rSet)
+ getPropertyState(const SfxItemPropertySimpleEntry& rEntry, const SfxItemSet& rSet) const
throw();
com::sun::star::uno::Reference<com::sun::star::beans::XPropertySetInfo>
getPropertySetInfo() const;
const SfxItemPropertyMap*
- getPropertyMap() const {return _pMap;}
+ getPropertyMap() const {return &m_aMap;}
};
/* -----------------------------21.02.00 11:09--------------------------------
---------------------------------------------------------------------------*/
+struct SfxItemPropertySetInfo_Impl;
class SVL_DLLPUBLIC SfxItemPropertySetInfo : public
cppu::WeakImplHelper1<com::sun::star::beans::XPropertySetInfo>
{
- const SfxItemPropertyMap* _pMap;
+ SfxItemPropertySetInfo_Impl* m_pImpl;
public:
- SfxItemPropertySetInfo(const SfxItemPropertyMap *pMap ) :
- _pMap(pMap) {}
+ SfxItemPropertySetInfo(const SfxItemPropertyMap *pMap );
+ SfxItemPropertySetInfo(const SfxItemPropertyMapEntry *pEntries );
+ virtual ~SfxItemPropertySetInfo();
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL
getProperties( )
@@ -140,19 +192,19 @@ public:
hasPropertyByName( const ::rtl::OUString& Name )
throw(::com::sun::star::uno::RuntimeException);
- const SfxItemPropertyMap* getMap() const { return _pMap; }
+ const SfxItemPropertyMap* getMap() const;
};
/* -----------------------------21.02.00 12:01--------------------------------
---------------------------------------------------------------------------*/
class SVL_DLLPUBLIC SfxExtItemPropertySetInfo: public cppu::WeakImplHelper1<com::sun::star::beans::XPropertySetInfo >
{
- const SfxItemPropertyMap* _pExtMap;
- com::sun::star::uno::Sequence<com::sun::star::beans::Property> aPropertySeq;
+ SfxItemPropertyMap aExtMap;
public:
SfxExtItemPropertySetInfo(
- const SfxItemPropertyMap *pMap,
+ const SfxItemPropertyMapEntry *pMap,
const com::sun::star::uno::Sequence<com::sun::star::beans::Property>& rPropSeq );
+ virtual ~SfxExtItemPropertySetInfo();
virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL
getProperties( )
diff --git a/svtools/inc/svtools/parhtml.hxx b/svtools/inc/svtools/parhtml.hxx
index d129a8c14595..f5de6aea358d 100644
--- a/svtools/inc/svtools/parhtml.hxx
+++ b/svtools/inc/svtools/parhtml.hxx
@@ -37,9 +37,17 @@
#include <svtools/svarray.hxx>
#include <svtools/svparser.hxx>
+
+namespace com { namespace sun { namespace star {
+ namespace document {
+ class XDocumentProperties;
+ }
+} } }
+
class Color;
class SvNumberFormatter;
class SvULongs;
+class SvKeyValueIterator;
#define HTMLFONTSZ1_DFLT 7
#define HTMLFONTSZ2_DFLT 10
@@ -224,6 +232,28 @@ public:
// virtual void RestoreState();
virtual void Continue( int nToken );
+
+protected:
+
+ static rtl_TextEncoding GetEncodingByMIME( const String& rMime );
+
+ /// template method: called when ParseMetaOptions adds a user-defined meta
+ virtual void AddMetaUserDefined( ::rtl::OUString const & i_rMetaName );
+
+private:
+ /// parse meta options into XDocumentProperties and encoding
+ bool ParseMetaOptionsImpl( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XDocumentProperties>&,
+ SvKeyValueIterator*,
+ const HTMLOptions*,
+ rtl_TextEncoding& rEnc );
+
+public:
+ /// overriding method must call this implementation!
+ virtual bool ParseMetaOptions( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XDocumentProperties>&,
+ SvKeyValueIterator* );
+
// Ist der uebergebene 0-terminierte String (vermutlich) der Anfang
// eines HTML-Files? Er sollte mind. 80 Zeichen lang sein.
// Mit Ausnahme des Falls, dass SwitchToUCS2==FALSE und
diff --git a/svtools/inc/svtools/svparser.hxx b/svtools/inc/svtools/svparser.hxx
index d63777d05b1b..96c1aadc6319 100644
--- a/svtools/inc/svtools/svparser.hxx
+++ b/svtools/inc/svtools/svparser.hxx
@@ -37,6 +37,7 @@
#include <tools/string.hxx>
#include <tools/ref.hxx>
#include <rtl/textenc.h>
+#include <boost/utility.hpp>
struct SvParser_Impl;
@@ -204,6 +205,84 @@ inline USHORT SvParser::GetCharSize() const
{
return (RTL_TEXTENCODING_UCS2 == eSrcEnc) ? 2 : 1;
}
+
+
+/*========================================================================
+ *
+ * SvKeyValue.
+ *
+ *======================================================================*/
+
+SV_DECL_REF(SvKeyValueIterator)
+
+class SvKeyValue
+{
+ /** Representation.
+ */
+ String m_aKey;
+ String m_aValue;
+
+public:
+ /** Construction.
+ */
+ SvKeyValue (void)
+ {}
+
+ SvKeyValue (const String &rKey, const String &rValue)
+ : m_aKey (rKey), m_aValue (rValue)
+ {}
+
+ SvKeyValue (const SvKeyValue &rOther)
+ : m_aKey (rOther.m_aKey), m_aValue (rOther.m_aValue)
+ {}
+
+ /** Assignment.
+ */
+ SvKeyValue& operator= (SvKeyValue &rOther)
+ {
+ m_aKey = rOther.m_aKey;
+ m_aValue = rOther.m_aValue;
+ return *this;
+ }
+
+ /** Operation.
+ */
+ const String& GetKey (void) const { return m_aKey; }
+ const String& GetValue (void) const { return m_aValue; }
+
+ void SetKey (const String &rKey ) { m_aKey = rKey; }
+ void SetValue (const String &rValue) { m_aValue = rValue; }
+};
+
+/*========================================================================
+ *
+ * SvKeyValueIterator.
+ *
+ *======================================================================*/
+class SvKeyValueList_Impl;
+class SVT_DLLPUBLIC SvKeyValueIterator : public SvRefBase,
+ private boost::noncopyable
+{
+ /** Representation.
+ */
+ SvKeyValueList_Impl* m_pList;
+ USHORT m_nPos;
+
+public:
+ /** Construction/Destruction.
+ */
+ SvKeyValueIterator (void);
+ virtual ~SvKeyValueIterator (void);
+
+ /** Operation.
+ */
+ virtual BOOL GetFirst (SvKeyValue &rKeyVal);
+ virtual BOOL GetNext (SvKeyValue &rKeyVal);
+ virtual void Append (const SvKeyValue &rKeyVal);
+};
+
+SV_IMPL_REF(SvKeyValueIterator);
+
#endif //_SVPARSER_HXX
/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/svtools/inc/svtools/undo.hxx b/svtools/inc/svtools/undo.hxx
index 986a72093af2..38cbfb227f1b 100644
--- a/svtools/inc/svtools/undo.hxx
+++ b/svtools/inc/svtools/undo.hxx
@@ -143,6 +143,7 @@ class SVT_DLLPUBLIC SfxUndoManager
SfxUndoArray *pActUndoArray;
SfxUndoArray *pFatherUndoArray;
+ bool mbUndoEnabled;
public:
SfxUndoManager( USHORT nMaxUndoActionCount = 20 );
virtual ~SfxUndoManager();
@@ -182,6 +183,16 @@ public:
/** clears the redo stack and removes the top undo action */
void RemoveLastUndoAction();
+
+ // enables (true) or disables (false) recording of undo actions
+ // If undo actions are added while undo is disabled, they are deleted.
+ // Disabling undo does not clear the current undo buffer!
+ void EnableUndo( bool bEnable );
+
+ // returns true if undo is currently enabled
+ // This returns false if undo was disabled using EnableUndo( false ) and
+ // also during the runtime of the Undo() and Redo() methods.
+ bool IsUndoEnabled() const { return mbUndoEnabled; }
};
//=========================================================================
diff --git a/svtools/prj/build.lst b/svtools/prj/build.lst
index ee2414e0da59..a6a409055faa 100644
--- a/svtools/prj/build.lst
+++ b/svtools/prj/build.lst
@@ -1,4 +1,4 @@
-st svtools : offuh toolkit ucbhelper unotools JPEG:jpeg cppu cppuhelper comphelper sal sot jvmfwk NULL
+st svtools : l10n offuh toolkit ucbhelper unotools JPEG:jpeg cppu cppuhelper comphelper sal sot jvmfwk NULL
st svtools usr1 - all st_mkout NULL
st svtools\inc nmake - all st_inc NULL
st svtools\inc\sane get - all st_incsa NULL
diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx
index 05ab0e1b0c91..767283a8e425 100644
--- a/svtools/source/brwbox/brwbox1.cxx
+++ b/svtools/source/brwbox/brwbox1.cxx
@@ -1711,7 +1711,7 @@ BOOL BrowseBox::GoToColumnId( USHORT nColId, BOOL bMakeVisible, BOOL bRowColMove
if (!bRowColMove && !IsCursorMoveAllowed( nCurRow, nColId ) )
return FALSE;
- if ( nColId != nCurColId || bMakeVisible && !IsFieldVisible(nCurRow, nColId, TRUE))
+ if ( nColId != nCurColId || (bMakeVisible && !IsFieldVisible(nCurRow, nColId, TRUE)))
{
USHORT nNewPos = GetColumnPos(nColId);
BrowserColumn* pColumn = pCols->GetObject( nNewPos );
diff --git a/svtools/source/config/extcolorcfg.cxx b/svtools/source/config/extcolorcfg.cxx
index 3020c022fdcc..4610a1571baf 100644
--- a/svtools/source/config/extcolorcfg.cxx
+++ b/svtools/source/config/extcolorcfg.cxx
@@ -53,6 +53,7 @@
#include <vcl/svapp.hxx>
#include <vcl/event.hxx>
#include <rtl/instance.hxx>
+#include <rtl/strbuf.hxx>
#include <comphelper/stl_types.hxx>
@@ -122,7 +123,14 @@ public:
if ( aFind2 != aFind->second.first.end() )
return aFind2->second;
}
- OSL_ENSURE(0,"Could find the required config!");
+#if OSL_DEBUG_LEVEL > 0
+ ::rtl::OStringBuffer aMessage( "Could find the required config:\n" );
+ aMessage.append( "component: " );
+ aMessage.append( ::rtl::OUStringToOString( _sComponentName, RTL_TEXTENCODING_UTF8 ) );
+ aMessage.append( "\nname: " );
+ aMessage.append( ::rtl::OUStringToOString( _sName, RTL_TEXTENCODING_UTF8 ) );
+ OSL_ENSURE( 0, aMessage.makeStringAndClear().getStr() );
+#endif
return ExtendedColorConfigValue();
}
void SetColorConfigValue(const ::rtl::OUString& _sName,
diff --git a/svtools/source/config/securityoptions.cxx b/svtools/source/config/securityoptions.cxx
index 6fdb314f9c74..8fbc9008d51e 100644
--- a/svtools/source/config/securityoptions.cxx
+++ b/svtools/source/config/securityoptions.cxx
@@ -901,7 +901,7 @@ sal_Bool SvtSecurityOptions_Impl::IsSecureURL( const OUString& sURL ,
INetProtocol aProtocol = aURL.GetProtocol();
// All other URLs must checked in combination with referer and internal information about security
- if ( aProtocol != INET_PROT_MACRO && aProtocol != INET_PROT_SLOT ||
+ if ( (aProtocol != INET_PROT_MACRO && aProtocol != INET_PROT_SLOT) ||
aURL.GetMainURL( INetURLObject::NO_DECODE ).matchIgnoreAsciiCaseAsciiL( "macro:///", 9 ) == 0)
{
// security check only for "macro" ( without app basic ) or "slot" protocols
diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx
index 042088d317bb..2b212fdcffeb 100644
--- a/svtools/source/contnr/templwin.cxx
+++ b/svtools/source/contnr/templwin.cxx
@@ -35,6 +35,7 @@
#include <svtools/svtdata.hxx>
#include <svtools/pathoptions.hxx>
#include <svtools/dynamicmenuoptions.hxx>
+#include <svtools/extendedsecurityoptions.hxx>
#include <svtools/xtextedt.hxx>
#include <svtools/inettype.hxx>
#include "imagemgr.hxx"
@@ -1742,9 +1743,16 @@ void SvtDocumentTemplateDialog::InitImpl( )
pImpl = new SvtTmplDlg_Impl( this );
pImpl->aTitle = GetText();
+ bool bHideLink = ( SvtExtendedSecurityOptions().GetOpenHyperlinkMode()
+ == SvtExtendedSecurityOptions::OPEN_NEVER );
+ if ( !bHideLink )
+ {
aMoreTemplatesLink.SetURL( String(
RTL_CONSTASCII_STRINGPARAM( "http://templates.services.openoffice.org/?cid=923508" ) ) );
aMoreTemplatesLink.SetClickHdl( LINK( this, SvtDocumentTemplateDialog, OpenLinkHdl_Impl ) );
+ }
+ else
+ aMoreTemplatesLink.Hide();
aManageBtn.SetClickHdl( LINK( this, SvtDocumentTemplateDialog, OrganizerHdl_Impl ) );
Link aLink = LINK( this, SvtDocumentTemplateDialog, OKHdl_Impl );
@@ -1762,14 +1770,17 @@ void SvtDocumentTemplateDialog::InitImpl( )
Size aSize = GetOutputSizePixel();
Point aPos = aMoreTemplatesLink.GetPosPixel();
Size a6Size = LogicToPixel( Size( 6, 6 ), MAP_APPFONT );
- aPos.Y() -= a6Size.Height();
+ if ( bHideLink )
+ aPos.Y() += aMoreTemplatesLink.GetSizePixel().Height();
+ else
+ aPos.Y() -= a6Size.Height();
long nDelta = aPos.Y() - nHeight;
aSize.Height() -= nDelta;
SetOutputSizePixel( aSize );
aSize.Height() = nHeight;
- aSize.Width() -= a6Size.Width();
- pImpl->pWin->SetPosSizePixel( Point( a6Size.Width() / 2, 0 ), aSize );
+ aSize.Width() -= ( a6Size.Width() * 2 );
+ pImpl->pWin->SetPosSizePixel( Point( a6Size.Width(), 0 ), aSize );
aPos = aMoreTemplatesLink.GetPosPixel();
aPos.Y() -= nDelta;
diff --git a/svtools/source/contnr/templwin.src b/svtools/source/contnr/templwin.src
index c8b9c4d58123..30149de4da14 100644
--- a/svtools/source/contnr/templwin.src
+++ b/svtools/source/contnr/templwin.src
@@ -275,7 +275,7 @@ ModalDialog DLG_DOCTEMPLATE
HelpId = HID_TEMPLATEDLG_DIALOG ;
OutputSize = TRUE ;
SVLook = TRUE ;
- Size = MAP_APPFONT( 320, 245 );
+ Size = MAP_APPFONT( 320, 250 );
Text [ en-US ] = "Templates and Documents" ;
Moveable = TRUE ;
FixedText FT_DOCTEMPLATE_LINK
@@ -288,35 +288,35 @@ ModalDialog DLG_DOCTEMPLATE
FixedLine FL_DOCTEMPLATE
{
Pos = MAP_APPFONT( 0, 219 );
- Size = MAP_APPFONT( 320, 1 );
+ Size = MAP_APPFONT( 320, 8 );
};
PushButton BTN_DOCTEMPLATE_MANAGE
{
- Pos = MAP_APPFONT( 3, 225 );
+ Pos = MAP_APPFONT( 6, 230 );
Size = MAP_APPFONT( 50, 14 );
Text [ en-US ] = "Organi~ze...";
};
PushButton BTN_DOCTEMPLATE_EDIT
{
- Pos = MAP_APPFONT( 56, 225 );
+ Pos = MAP_APPFONT( 59, 230 );
Size = MAP_APPFONT( 50, 14 );
Text [ en-US ] = "~Edit";
};
OKButton BTN_DOCTEMPLATE_OPEN
{
- Pos = MAP_APPFONT( 158, 225 );
+ Pos = MAP_APPFONT( 155, 230 );
Size = MAP_APPFONT( 50, 14 );
DefButton = TRUE;
Text [ en-US ] = "~Open";
};
CancelButton BTN_DOCTEMPLATE_CANCEL
{
- Pos = MAP_APPFONT( 211, 225 );
+ Pos = MAP_APPFONT( 208, 230 );
Size = MAP_APPFONT( 50, 14 );
};
HelpButton BTN_DOCTEMPLATE_HELP
{
- Pos = MAP_APPFONT( 267, 225 );
+ Pos = MAP_APPFONT( 264, 230 );
Size = MAP_APPFONT( 50, 14 );
};
};
diff --git a/svtools/source/control/filectrl.cxx b/svtools/source/control/filectrl.cxx
index 76893744688b..d820dce097ed 100644
--- a/svtools/source/control/filectrl.cxx
+++ b/svtools/source/control/filectrl.cxx
@@ -47,7 +47,7 @@
FileControl::FileControl( Window* pParent, WinBits nStyle, FileControlMode nFlags ) :
Window( pParent, nStyle|WB_DIALOGCONTROL ),
maEdit( this, (nStyle&(~WB_BORDER))|WB_NOTABSTOP ),
- maButton( this, nStyle&(~WB_BORDER)|WB_NOLIGHTBORDER|WB_NOPOINTERFOCUS|WB_NOTABSTOP ),
+ maButton( this, (nStyle&(~WB_BORDER))|WB_NOLIGHTBORDER|WB_NOPOINTERFOCUS|WB_NOTABSTOP ),
maButtonText( SvtResId( STR_FILECTRL_BUTTONTEXT ) ),
mnFlags( nFlags ),
mnInternalFlags( FILECTRL_ORIGINALBUTTONTEXT )
@@ -164,11 +164,11 @@ void FileControl::Resize()
Size aOutSz = GetOutputSizePixel();
long nButtonTextWidth = maButton.GetTextWidth( maButtonText );
if ( ((mnInternalFlags & FILECTRL_ORIGINALBUTTONTEXT) == 0) ||
- nButtonTextWidth < aOutSz.Width()/3 &&
+ ( nButtonTextWidth < aOutSz.Width()/3 &&
( mnFlags & FILECTRL_RESIZEBUTTONBYPATHLEN
? ( maEdit.GetTextWidth( maEdit.GetText() )
<= aOutSz.Width() - nButtonTextWidth - ButtonBorder )
- : TRUE )
+ : TRUE ) )
)
{
maButton.SetText( maButtonText );
diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx
index 2f9e881e39c9..4a01a03ad759 100644
--- a/svtools/source/control/inettbc.cxx
+++ b/svtools/source/control/inettbc.cxx
@@ -374,8 +374,8 @@ void SvtMatchContext_Impl::ReadFolder( const String& rURL,
sal_Bool bExectMatch = bPureHomePath
|| aText.CompareToAscii( "." ) == COMPARE_EQUAL
- || aText.Len() > 1 && aText.Copy( aText.Len() - 2, 2 ).CompareToAscii( "/." ) == COMPARE_EQUAL
- || aText.Len() > 1 && aText.Copy( aText.Len() - 3, 3 ).CompareToAscii( "/.." ) == COMPARE_EQUAL;
+ || (aText.Len() > 1 && aText.Copy( aText.Len() - 2, 2 ).CompareToAscii( "/." ) == COMPARE_EQUAL)
+ || (aText.Len() > 2 && aText.Copy( aText.Len() - 3, 3 ).CompareToAscii( "/.." ) == COMPARE_EQUAL);
// for pure home pathes ( ~username ) the '.' at the end of rMatch
// means that it poits to root catalog
@@ -641,7 +641,7 @@ void SvtMatchContext_Impl::run()
// if the user input is a valid URL, go on with it
// otherwise it could be parsed smart with a predefined smart protocol
// ( or if this is not set with the protocol of a predefined base URL )
- if( eProt == INET_PROT_NOT_VALID || eProt == eSmartProt || eSmartProt == INET_PROT_NOT_VALID && eProt == eBaseProt )
+ if( eProt == INET_PROT_NOT_VALID || eProt == eSmartProt || (eSmartProt == INET_PROT_NOT_VALID && eProt == eBaseProt) )
{
// not stopped yet ?
if( schedule() )
diff --git a/svtools/source/edit/svmedit.cxx b/svtools/source/edit/svmedit.cxx
index 279af7c83cef..135761195e48 100644
--- a/svtools/source/edit/svmedit.cxx
+++ b/svtools/source/edit/svmedit.cxx
@@ -452,46 +452,62 @@ String ImpSvMEdit::GetSelected( LineEnd aSeparator ) const
void ImpSvMEdit::Resize()
{
- WinBits nWinStyle( pSvMultiLineEdit->GetStyle() );
- if ( ( nWinStyle & WB_AUTOVSCROLL ) == WB_AUTOVSCROLL )
- ImpUpdateSrollBarVis( nWinStyle );
-
- Size aSz = pSvMultiLineEdit->GetOutputSizePixel();
- Size aEditSize = aSz;
- long nSBWidth = pSvMultiLineEdit->GetSettings().GetStyleSettings().GetScrollBarSize();
- nSBWidth = pSvMultiLineEdit->CalcZoom( nSBWidth );
-
- if ( mpHScrollBar )
- aSz.Height() -= nSBWidth+1;
- if ( mpVScrollBar )
- aSz.Width() -= nSBWidth+1;
+ size_t nIteration = 1;
+ do
+ {
+ WinBits nWinStyle( pSvMultiLineEdit->GetStyle() );
+ if ( ( nWinStyle & WB_AUTOVSCROLL ) == WB_AUTOVSCROLL )
+ ImpUpdateSrollBarVis( nWinStyle );
- Size aTextWindowSz( aSz );
- aTextWindowSz.Width() -= maTextWindowOffset.X();
- aTextWindowSz.Height() -= maTextWindowOffset.Y();
- Point aTextWindowPos( maTextWindowOffset );
+ Size aSz = pSvMultiLineEdit->GetOutputSizePixel();
+ Size aEditSize = aSz;
+ long nSBWidth = pSvMultiLineEdit->GetSettings().GetStyleSettings().GetScrollBarSize();
+ nSBWidth = pSvMultiLineEdit->CalcZoom( nSBWidth );
- if ( !mpHScrollBar )
- mpTextWindow->GetTextEngine()->SetMaxTextWidth( aSz.Width() );
+ if ( mpHScrollBar )
+ aSz.Height() -= nSBWidth+1;
+ if ( mpVScrollBar )
+ aSz.Width() -= nSBWidth+1;
- if ( mpHScrollBar )
- mpHScrollBar->SetPosSizePixel( 0, aEditSize.Height()-nSBWidth, aSz.Width(), nSBWidth );
+ if ( !mpHScrollBar )
+ mpTextWindow->GetTextEngine()->SetMaxTextWidth( aSz.Width() );
+ else
+ mpHScrollBar->SetPosSizePixel( 0, aEditSize.Height()-nSBWidth, aSz.Width(), nSBWidth );
- if ( mpVScrollBar )
- {
- if( Application::GetSettings().GetLayoutRTL() )
+ Point aTextWindowPos( maTextWindowOffset );
+ if ( mpVScrollBar )
{
- mpVScrollBar->SetPosSizePixel( 0, 0, nSBWidth, aSz.Height() );
- aTextWindowPos.X() += nSBWidth;
+ if( Application::GetSettings().GetLayoutRTL() )
+ {
+ mpVScrollBar->SetPosSizePixel( 0, 0, nSBWidth, aSz.Height() );
+ aTextWindowPos.X() += nSBWidth;
+ }
+ else
+ mpVScrollBar->SetPosSizePixel( aEditSize.Width()-nSBWidth, 0, nSBWidth, aSz.Height() );
}
- else
- mpVScrollBar->SetPosSizePixel( aEditSize.Width()-nSBWidth, 0, nSBWidth, aSz.Height() );
- }
- mpTextWindow->SetPosSizePixel( aTextWindowPos, aTextWindowSz );
+ if ( mpScrollBox )
+ mpScrollBox->SetPosSizePixel( aSz.Width(), aSz.Height(), nSBWidth, nSBWidth );
+
+ Size aTextWindowSize( aSz );
+ aTextWindowSize.Width() -= maTextWindowOffset.X();
+ aTextWindowSize.Height() -= maTextWindowOffset.Y();
+ if ( aTextWindowSize.Width() < 0 )
+ aTextWindowSize.Width() = 0;
+ if ( aTextWindowSize.Height() < 0 )
+ aTextWindowSize.Height() = 0;
+
+ Size aOldTextWindowSize( mpTextWindow->GetSizePixel() );
+ mpTextWindow->SetPosSizePixel( aTextWindowPos, aTextWindowSize );
+ if ( aOldTextWindowSize == aTextWindowSize )
+ break;
+
+ // Changing the text window size might effectively have changed the need for
+ // scrollbars, so do another iteration.
+ ++nIteration;
+ OSL_ENSURE( nIteration < 3, "ImpSvMEdit::Resize: isn't this expected to terminate with the second iteration?" );
- if ( mpScrollBox )
- mpScrollBox->SetPosSizePixel( aSz.Width(), aSz.Height(), nSBWidth, nSBWidth );
+ } while ( nIteration <= 3 ); // artificial break after four iterations
ImpInitScrollBars();
}
diff --git a/svtools/source/filter.vcl/ixbm/xbmread.cxx b/svtools/source/filter.vcl/ixbm/xbmread.cxx
index 7429ffcc90cd..32f73d62c195 100644
--- a/svtools/source/filter.vcl/ixbm/xbmread.cxx
+++ b/svtools/source/filter.vcl/ixbm/xbmread.cxx
@@ -157,7 +157,7 @@ long XBMReader::ParseDefine( const sal_Char* pDefine )
{
long nRet = 0;
char* pTmp = (char*) pDefine;
- char cTmp;
+ unsigned char cTmp;
// bis zum Ende gehen
pTmp += ( strlen( pDefine ) - 1 );
diff --git a/svtools/source/items1/itemprop.cxx b/svtools/source/items1/itemprop.cxx
index 0c31e3f0a64a..354e0a1441ba 100644
--- a/svtools/source/items1/itemprop.cxx
+++ b/svtools/source/items1/itemprop.cxx
@@ -30,56 +30,189 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svtools.hxx"
-#include <string.h>
-#ifndef GCC
-#endif
#include <svtools/itemprop.hxx>
#include <svtools/itempool.hxx>
#include <svtools/itemset.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
-
+#include <hash_map>
/*************************************************************************
UNO III Implementation
*************************************************************************/
+using namespace com::sun::star;
using namespace com::sun::star::beans;
using namespace com::sun::star::lang;
using namespace com::sun::star::uno;
using namespace ::rtl;
-/* -----------------------------21.02.00 11:26--------------------------------
+/*-- 16.02.2009 10:03:55---------------------------------------------------
- ---------------------------------------------------------------------------*/
-const SfxItemPropertyMap* SfxItemPropertyMap::GetByName(
- const SfxItemPropertyMap *pMap, const OUString &rName )
+ -----------------------------------------------------------------------*/
+
+struct equalOUString
+{
+ bool operator()(const ::rtl::OUString& r1, const ::rtl::OUString& r2) const
+ {
+ return r1.equals( r2 );
+ }
+};
+
+typedef ::std::hash_map< ::rtl::OUString,
+ SfxItemPropertySimpleEntry,
+ ::rtl::OUStringHash,
+ equalOUString > SfxItemPropertyHashMap_t;
+
+class SfxItemPropertyMap_Impl : public SfxItemPropertyHashMap_t
+{
+public:
+ mutable uno::Sequence< beans::Property > m_aPropSeq;
+
+ SfxItemPropertyMap_Impl(){}
+ SfxItemPropertyMap_Impl( const SfxItemPropertyMap_Impl* pSource );
+};
+SfxItemPropertyMap_Impl::SfxItemPropertyMap_Impl( const SfxItemPropertyMap_Impl* pSource )
{
- while ( pMap->pName )
+ this->SfxItemPropertyHashMap_t::operator=( *pSource );
+ m_aPropSeq = pSource->m_aPropSeq;
+}
+
+/*-- 16.02.2009 10:03:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SfxItemPropertyMap::SfxItemPropertyMap( const SfxItemPropertyMapEntry* pEntries ) :
+ m_pImpl( new SfxItemPropertyMap_Impl )
+{
+ while( pEntries->pName )
{
- if( rName.equalsAsciiL( pMap->pName, pMap->nNameLen ) )
- return pMap;
- ++pMap;
+ ::rtl::OUString sEntry(pEntries->pName, pEntries->nNameLen, RTL_TEXTENCODING_ASCII_US );
+ (*m_pImpl) [ sEntry ] = pEntries;
+ ++pEntries;
}
- return 0;
}
-/* -----------------------------12.12.03 14:04--------------------------------
+/*-- 16.02.2009 12:46:41---------------------------------------------------
- ---------------------------------------------------------------------------*/
-const SfxItemPropertyMap* SfxItemPropertyMap::GetTolerantByName(
- const SfxItemPropertyMap *pMap, const OUString &rName )
+ -----------------------------------------------------------------------*/
+SfxItemPropertyMap::SfxItemPropertyMap( const SfxItemPropertyMap* pSource ) :
+ m_pImpl( new SfxItemPropertyMap_Impl( pSource->m_pImpl ) )
{
- sal_Int32 nLength(rName.getLength());
- while ( pMap->pName )
+}
+/*-- 16.02.2009 10:03:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SfxItemPropertyMap::~SfxItemPropertyMap()
+{
+ delete m_pImpl;
+}
+/*-- 16.02.2009 10:03:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+const SfxItemPropertySimpleEntry* SfxItemPropertyMap::getByName( const ::rtl::OUString &rName ) const
+{
+ SfxItemPropertyHashMap_t::const_iterator aIter = m_pImpl->find(rName);
+ if( aIter == m_pImpl->end() )
+ return 0;
+ return &aIter->second;
+}
+
+/*-- 16.02.2009 10:44:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence<beans::Property> SfxItemPropertyMap::getProperties() const
+{
+ if( !m_pImpl->m_aPropSeq.getLength() )
{
- if( nLength == pMap->nNameLen )
+ m_pImpl->m_aPropSeq.realloc( m_pImpl->size() );
+ beans::Property* pPropArray = m_pImpl->m_aPropSeq.getArray();
+ sal_uInt32 n = 0;
+ SfxItemPropertyHashMap_t::const_iterator aIt = m_pImpl->begin();
+ while( aIt != m_pImpl->end() )
+ //for ( const SfxItemPropertyMap *pMap = _pMap; pMap->pName; ++pMap )
{
- sal_Int32 nResult(rName.compareToAscii(pMap->pName));
- if (nResult == 0)
- return pMap;
- else if (nResult < 0)
- return 0;
+ const SfxItemPropertySimpleEntry* pEntry = &(*aIt).second;
+ pPropArray[n].Name = (*aIt).first;
+ pPropArray[n].Handle = pEntry->nWID;
+ if(pEntry->pType)
+ pPropArray[n].Type = *pEntry->pType;
+ pPropArray[n].Attributes =
+ sal::static_int_cast< sal_Int16 >(pEntry->nFlags);
+ n++;
+ ++aIt;
}
- ++pMap;
}
- return 0;
+
+ return m_pImpl->m_aPropSeq;
+}
+/*-- 16.02.2009 11:04:31---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+beans::Property SfxItemPropertyMap::getPropertyByName( const ::rtl::OUString rName ) const
+ throw( beans::UnknownPropertyException )
+{
+ SfxItemPropertyHashMap_t::const_iterator aIter = m_pImpl->find(rName);
+ if( aIter == m_pImpl->end() )
+ throw UnknownPropertyException();
+ const SfxItemPropertySimpleEntry* pEntry = &aIter->second;
+ beans::Property aProp;
+ aProp.Name = rName;
+ aProp.Handle = pEntry->nWID;
+ if(pEntry->pType)
+ aProp.Type = *pEntry->pType;
+ aProp.Attributes = sal::static_int_cast< sal_Int16 >(pEntry->nFlags);
+ return aProp;
+}
+/*-- 16.02.2009 11:09:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SfxItemPropertyMap::hasPropertyByName( const ::rtl::OUString& rName ) const
+{
+ SfxItemPropertyHashMap_t::const_iterator aIter = m_pImpl->find(rName);
+ return aIter != m_pImpl->end();
+}
+/*-- 16.02.2009 11:25:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SfxItemPropertyMap::mergeProperties( const uno::Sequence< beans::Property >& rPropSeq )
+{
+ const beans::Property* pPropArray = rPropSeq.getConstArray();
+ sal_uInt32 nElements = rPropSeq.getLength();
+ for( sal_uInt32 nElement = 0; nElement < nElements; ++nElement )
+ {
+ SfxItemPropertySimpleEntry aTemp(
+ sal::static_int_cast< sal_Int16 >( pPropArray[nElement].Handle ), //nWID
+ &pPropArray[nElement].Type, //pType
+ pPropArray[nElement].Attributes, //nFlags
+ 0 ); //nMemberId
+ (*m_pImpl)[pPropArray[nElement].Name] = aTemp;
+ }
+}
+/*-- 18.02.2009 12:04:42---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+PropertyEntryVector_t SfxItemPropertyMap::getPropertyEntries() const
+{
+ PropertyEntryVector_t aRet;
+ aRet.reserve(m_pImpl->size());
+
+ SfxItemPropertyHashMap_t::const_iterator aIt = m_pImpl->begin();
+ while( aIt != m_pImpl->end() )
+ {
+ const SfxItemPropertySimpleEntry* pEntry = &(*aIt).second;
+ aRet.push_back( SfxItemPropertyNamedEntry( (*aIt).first, * pEntry ) );
+ ++aIt;
+ }
+ return aRet;
+}
+/*-- 18.02.2009 15:11:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_uInt32 SfxItemPropertyMap::getSize() const
+{
+ return m_pImpl->size();
+}
+/*-- 16.02.2009 13:44:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SfxItemPropertySet::~SfxItemPropertySet()
+{
}
/* -----------------------------21.02.00 11:26--------------------------------
@@ -91,55 +224,41 @@ BOOL SfxItemPropertySet::FillItem(SfxItemSet&, USHORT, BOOL) const
/* -----------------------------06.06.01 12:32--------------------------------
---------------------------------------------------------------------------*/
-void SfxItemPropertySet::getPropertyValue( const SfxItemPropertyMap& rMap,
+void SfxItemPropertySet::getPropertyValue( const SfxItemPropertySimpleEntry& rEntry,
const SfxItemSet& rSet, Any& rAny ) const
throw(RuntimeException)
{
- // item holen
+ // get the SfxPoolItem
const SfxPoolItem* pItem = 0;
- SfxItemState eState = rSet.GetItemState( rMap.nWID, TRUE, &pItem );
- if(SFX_ITEM_SET != eState && SFX_WHICH_MAX > rMap.nWID )
- pItem = &rSet.GetPool()->GetDefaultItem(rMap.nWID);
- // item-Wert als UnoAny zurueckgeben
+ SfxItemState eState = rSet.GetItemState( rEntry.nWID, TRUE, &pItem );
+ if(SFX_ITEM_SET != eState && SFX_WHICH_MAX > rEntry.nWID )
+ pItem = &rSet.GetPool()->GetDefaultItem(rEntry.nWID);
+ // return item values as uno::Any
if(eState >= SFX_ITEM_DEFAULT && pItem)
{
- pItem->QueryValue( rAny, rMap.nMemberId );
+ pItem->QueryValue( rAny, rEntry.nMemberId );
}
else
{
- SfxItemSet aSet(*rSet.GetPool(), rMap.nWID, rMap.nWID);
- if(FillItem(aSet, rMap.nWID, TRUE))
+ SfxItemSet aSet(*rSet.GetPool(), rEntry.nWID, rEntry.nWID);
+ if(FillItem(aSet, rEntry.nWID, TRUE))
{
- const SfxPoolItem& rItem = aSet.Get(rMap.nWID);
- rItem.QueryValue( rAny, rMap.nMemberId );
+ const SfxPoolItem& rItem = aSet.Get(rEntry.nWID);
+ rItem.QueryValue( rAny, rEntry.nMemberId );
}
- else if(0 == (rMap.nFlags & PropertyAttribute::MAYBEVOID))
+ else if(0 == (rEntry.nFlags & PropertyAttribute::MAYBEVOID))
throw RuntimeException();
}
- // allgemeine SfxEnumItem Values in konkrete wandeln
- if( rMap.pType && TypeClass_ENUM == rMap.pType->getTypeClass() &&
+ // convert general SfxEnumItem values to specific values
+ if( rEntry.pType && TypeClass_ENUM == rEntry.pType->getTypeClass() &&
rAny.getValueTypeClass() == TypeClass_LONG )
{
INT32 nTmp = *(INT32*)rAny.getValue();
- rAny.setValue( &nTmp, *rMap.pType );
+ rAny.setValue( &nTmp, *rEntry.pType );
}
}
-
-
-/* -----------------------------15.11.00 12:32--------------------------------
-
- ---------------------------------------------------------------------------*/
-Any SfxItemPropertySet::getPropertyValue( const SfxItemPropertyMap& rMap,
- const SfxItemSet& rSet ) const
- throw(RuntimeException)
-{
- Any aAny;
- getPropertyValue(rMap, rSet, aAny);
- return aAny;
-}
-
/* -----------------------------06.06.01 12:32--------------------------------
---------------------------------------------------------------------------*/
@@ -147,11 +266,11 @@ void SfxItemPropertySet::getPropertyValue( const OUString &rName,
const SfxItemSet& rSet, Any& rAny ) const
throw(RuntimeException, UnknownPropertyException)
{
- // which-id ermitteln
- const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( _pMap, rName );
- if ( !pMap )
+ // detect which-id
+ const SfxItemPropertySimpleEntry* pEntry = m_aMap.getByName( rName );
+ if ( !pEntry )
throw UnknownPropertyException();
- getPropertyValue( *pMap,rSet, rAny );
+ getPropertyValue( *pEntry,rSet, rAny );
}
/* -----------------------------21.02.00 11:26--------------------------------
@@ -167,25 +286,25 @@ Any SfxItemPropertySet::getPropertyValue( const OUString &rName,
/* -----------------------------15.11.00 14:46--------------------------------
---------------------------------------------------------------------------*/
-void SfxItemPropertySet::setPropertyValue( const SfxItemPropertyMap& rMap,
+void SfxItemPropertySet::setPropertyValue( const SfxItemPropertySimpleEntry& rEntry,
const Any& aVal,
SfxItemSet& rSet ) const
throw(RuntimeException,
IllegalArgumentException)
{
- // item holen
+ // get the SfxPoolItem
const SfxPoolItem* pItem = 0;
SfxPoolItem *pNewItem = 0;
- SfxItemState eState = rSet.GetItemState( rMap.nWID, TRUE, &pItem );
- if(SFX_ITEM_SET != eState && SFX_WHICH_MAX > rMap.nWID )
- pItem = &rSet.GetPool()->GetDefaultItem(rMap.nWID);
+ SfxItemState eState = rSet.GetItemState( rEntry.nWID, TRUE, &pItem );
+ if(SFX_ITEM_SET != eState && SFX_WHICH_MAX > rEntry.nWID )
+ pItem = &rSet.GetPool()->GetDefaultItem(rEntry.nWID);
//maybe there's another way to find an Item
if(eState < SFX_ITEM_DEFAULT)
{
- SfxItemSet aSet(*rSet.GetPool(), rMap.nWID, rMap.nWID);
- if(FillItem(aSet, rMap.nWID, FALSE))
+ SfxItemSet aSet(*rSet.GetPool(), rEntry.nWID, rEntry.nWID);
+ if(FillItem(aSet, rEntry.nWID, FALSE))
{
- const SfxPoolItem &rItem = aSet.Get(rMap.nWID);
+ const SfxPoolItem &rItem = aSet.Get(rEntry.nWID);
pNewItem = rItem.Clone();
}
}
@@ -195,13 +314,13 @@ void SfxItemPropertySet::setPropertyValue( const SfxItemPropertyMap& rMap,
}
if(pNewItem)
{
- if( !pNewItem->PutValue( aVal, rMap.nMemberId ) )
+ if( !pNewItem->PutValue( aVal, rEntry.nMemberId ) )
{
DELETEZ(pNewItem);
throw IllegalArgumentException();
}
- // neues item in itemset setzen
- rSet.Put( *pNewItem, rMap.nWID );
+ // apply new item
+ rSet.Put( *pNewItem, rEntry.nWID );
delete pNewItem;
}
}
@@ -215,21 +334,21 @@ void SfxItemPropertySet::setPropertyValue( const OUString &rName,
IllegalArgumentException,
UnknownPropertyException)
{
- const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( _pMap, rName );
- if ( !pMap )
+ const SfxItemPropertySimpleEntry* pEntry = m_aMap.getByName( rName );
+ if ( !pEntry )
{
throw UnknownPropertyException();
}
- setPropertyValue(*pMap, aVal, rSet);
+ setPropertyValue(*pEntry, aVal, rSet);
}
/* -----------------------------21.02.00 11:26--------------------------------
---------------------------------------------------------------------------*/
-PropertyState SfxItemPropertySet::getPropertyState(const SfxItemPropertyMap& rMap, const SfxItemSet& rSet)
+PropertyState SfxItemPropertySet::getPropertyState(const SfxItemPropertySimpleEntry& rEntry, const SfxItemSet& rSet) const
throw()
{
PropertyState eRet = PropertyState_DIRECT_VALUE;
- USHORT nWhich = rMap.nWID;
+ USHORT nWhich = rEntry.nWID;
// item state holen
SfxItemState eState = rSet.GetItemState( nWhich, FALSE );
@@ -240,20 +359,19 @@ PropertyState SfxItemPropertySet::getPropertyState(const SfxItemPropertyMap& rMa
eRet = PropertyState_AMBIGUOUS_VALUE;
return eRet;
}
-
PropertyState SfxItemPropertySet::getPropertyState(
- const OUString& rName, const SfxItemSet& rSet)
+ const OUString& rName, const SfxItemSet& rSet) const
throw(UnknownPropertyException)
{
PropertyState eRet = PropertyState_DIRECT_VALUE;
// which-id ermitteln
- const SfxItemPropertyMap* pMap = SfxItemPropertyMap::GetByName( _pMap, rName );
- USHORT nWhich = pMap ? pMap->nWID : 0;
- if ( !nWhich )
+ const SfxItemPropertySimpleEntry* pEntry = m_aMap.getByName( rName );
+ if( !pEntry || !pEntry->nWID )
{
throw UnknownPropertyException();
}
+ USHORT nWhich = pEntry->nWID;
// item holen
const SfxPoolItem* pItem = 0;
@@ -273,10 +391,33 @@ PropertyState SfxItemPropertySet::getPropertyState(
Reference<XPropertySetInfo>
SfxItemPropertySet::getPropertySetInfo() const
{
- Reference<XPropertySetInfo> aRef(new SfxItemPropertySetInfo( _pMap ));
- return aRef;
+ if( !m_xInfo.is() )
+ m_xInfo = new SfxItemPropertySetInfo( &m_aMap );
+ return m_xInfo;
+}
+/*-- 16.02.2009 13:49:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+struct SfxItemPropertySetInfo_Impl
+{
+ SfxItemPropertyMap* m_pOwnMap;
+};
+/*-- 16.02.2009 13:49:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SfxItemPropertySetInfo::SfxItemPropertySetInfo(const SfxItemPropertyMap *pMap ) :
+ m_pImpl( new SfxItemPropertySetInfo_Impl )
+{
+ m_pImpl->m_pOwnMap = new SfxItemPropertyMap( pMap );
}
+/*-- 16.02.2009 13:49:25---------------------------------------------------
+ -----------------------------------------------------------------------*/
+SfxItemPropertySetInfo::SfxItemPropertySetInfo(const SfxItemPropertyMapEntry *pEntries ) :
+ m_pImpl( new SfxItemPropertySetInfo_Impl )
+{
+ m_pImpl->m_pOwnMap = new SfxItemPropertyMap( pEntries );
+}
/* -----------------------------21.02.00 11:09--------------------------------
---------------------------------------------------------------------------*/
@@ -284,26 +425,23 @@ Sequence< Property > SAL_CALL
SfxItemPropertySetInfo::getProperties( )
throw(RuntimeException)
{
- USHORT n = 0;
- {
- for ( const SfxItemPropertyMap *pMap = _pMap; pMap->pName; ++pMap )
- ++n;
- }
+ return m_pImpl->m_pOwnMap->getProperties();
+}
+/*-- 16.02.2009 13:49:27---------------------------------------------------
- Sequence<Property> aPropSeq( n );
- n = 0;
- for ( const SfxItemPropertyMap *pMap = _pMap; pMap->pName; ++pMap )
- {
- aPropSeq.getArray()[n].Name = OUString::createFromAscii( pMap->pName );
- aPropSeq.getArray()[n].Handle = pMap->nWID;
- if(pMap->pType)
- aPropSeq.getArray()[n].Type = *pMap->pType;
- aPropSeq.getArray()[n].Attributes =
- sal::static_int_cast< sal_Int16 >(pMap->nFlags);
- n++;
- }
+ -----------------------------------------------------------------------*/
+const SfxItemPropertyMap* SfxItemPropertySetInfo::getMap() const
+{
+ return m_pImpl->m_pOwnMap;
+}
+
+/*-- 16.02.2009 12:43:36---------------------------------------------------
- return aPropSeq;
+ -----------------------------------------------------------------------*/
+SfxItemPropertySetInfo::~SfxItemPropertySetInfo()
+{
+ delete m_pImpl->m_pOwnMap;
+ delete m_pImpl;
}
/* -----------------------------21.02.00 11:27--------------------------------
@@ -312,22 +450,7 @@ Property SAL_CALL
SfxItemPropertySetInfo::getPropertyByName( const ::rtl::OUString& rName )
throw(UnknownPropertyException, RuntimeException)
{
- Property aProp;
- for( const SfxItemPropertyMap *pMap = _pMap; pMap->pName; ++pMap )
- {
- if( rName.equalsAsciiL( pMap->pName, pMap->nNameLen ))
- {
- aProp.Name = rName;
- aProp.Handle = pMap->nWID;
- if(pMap->pType)
- aProp.Type = *pMap->pType;
- aProp.Attributes = sal::static_int_cast< sal_Int16 >(pMap->nFlags);
- break;
- }
- }
- if(!aProp.Name.getLength())
- throw UnknownPropertyException();
- return aProp;
+ return m_pImpl->m_pOwnMap->getPropertyByName( rName );
}
/* -----------------------------21.02.00 11:28--------------------------------
@@ -336,79 +459,23 @@ sal_Bool SAL_CALL
SfxItemPropertySetInfo::hasPropertyByName( const ::rtl::OUString& rName )
throw(RuntimeException)
{
- for ( const SfxItemPropertyMap *pMap = _pMap; pMap->pName; ++pMap )
- {
- if( rName.equalsAsciiL( pMap->pName, pMap->nNameLen ))
- return TRUE;
- }
- return FALSE;
+ return m_pImpl->m_pOwnMap->hasPropertyByName( rName );
}
/* -----------------------------21.02.00 12:03--------------------------------
---------------------------------------------------------------------------*/
SfxExtItemPropertySetInfo::SfxExtItemPropertySetInfo(
- const SfxItemPropertyMap *pMap,
+ const SfxItemPropertyMapEntry *pMap,
const Sequence<Property>& rPropSeq ) :
- _pExtMap(pMap)
+ aExtMap( pMap )
{
- long nLen = rPropSeq.getLength();
- long nExtLen = 0;
- while(pMap[nExtLen].pName)
- nExtLen++;
- aPropertySeq.realloc(nExtLen + nLen);
-
-
- long nNewLen = aPropertySeq.getLength();
- Property* pNewArr = aPropertySeq.getArray();
- long nCount1 = 0;//map
- long nCount2 = 0;//sequence
- long nDouble = 0;//Anzahl gleicher Property-Namen
- BOOL bFromMap, bZero = FALSE;
+ aExtMap.mergeProperties( rPropSeq );
+}
+/*-- 16.02.2009 12:06:49---------------------------------------------------
- const Property* pPropSeqArr = rPropSeq.getConstArray();
- for( long i = 0; i < nNewLen; i++)
- {
- bFromMap = FALSE;
- if(nCount1 < nExtLen && nCount2 < nLen)
- {
-// int nDiff = strcmp(pMap[nCount1].pName, OUStringToString(rPropSeq.getConstArray()[nCount2].Name, CHARSET_SYSTEM ));
- sal_Int32 nDiff = pPropSeqArr[nCount2].Name.compareToAscii(pMap[nCount1].pName, pMap[nCount1].nNameLen );
- if(nDiff > 0)
- {
- bFromMap = TRUE;
- }
- else if(0 == nDiff)
- {
- nDouble++;
- bFromMap = TRUE;
- nCount2++;
- }
- }
- else
- {
- if(nCount1 < nExtLen)
- bFromMap = TRUE;
- else if(nCount2>= nLen)
- bZero = TRUE;
- }
- if(bFromMap)
- {
- pNewArr[i].Name = OUString::createFromAscii( pMap[nCount1].pName );
- pNewArr[i].Handle = pMap[nCount1].nWID;
- if(pMap[nCount1].pType)
- pNewArr[i].Type = *pMap[nCount1].pType;
- pNewArr[i].Attributes = sal::static_int_cast< sal_Int16 >(
- pMap[nCount1].nFlags);
- nCount1++;
- }
- else if(!bZero)
- {
- pNewArr[i] = pPropSeqArr[nCount2];
- nCount2++;
- }
- }
- if(nDouble)
- aPropertySeq.realloc(nExtLen + nLen - nDouble);
+ -----------------------------------------------------------------------*/
+SfxExtItemPropertySetInfo::~SfxExtItemPropertySetInfo()
+{
}
/* -----------------------------21.02.00 12:03--------------------------------
@@ -416,38 +483,24 @@ SfxExtItemPropertySetInfo::SfxExtItemPropertySetInfo(
Sequence< Property > SAL_CALL
SfxExtItemPropertySetInfo::getProperties( ) throw(RuntimeException)
{
- return aPropertySeq;
+ return aExtMap.getProperties();
}
/* -----------------------------21.02.00 12:03--------------------------------
---------------------------------------------------------------------------*/
Property SAL_CALL
- SfxExtItemPropertySetInfo::getPropertyByName( const OUString& aPropertyName )
+ SfxExtItemPropertySetInfo::getPropertyByName( const OUString& rPropertyName )
throw(UnknownPropertyException, RuntimeException)
{
- const Property* pPropArr = aPropertySeq.getConstArray();
- long nLen = aPropertySeq.getLength();
- for( long i = 0; i < nLen; i++)
- {
- if(aPropertyName == pPropArr[i].Name)
- return pPropArr[i];
- }
- return Property();
+ return aExtMap.getPropertyByName( rPropertyName );
}
/* -----------------------------21.02.00 12:03--------------------------------
---------------------------------------------------------------------------*/
sal_Bool SAL_CALL
- SfxExtItemPropertySetInfo::hasPropertyByName( const OUString& aPropertyName )
+ SfxExtItemPropertySetInfo::hasPropertyByName( const OUString& rPropertyName )
throw(RuntimeException)
{
- const Property* pPropArr = aPropertySeq.getConstArray();
- long nLen = aPropertySeq.getLength();
- for( long i = 0; i < nLen; i++)
- {
- if(aPropertyName == pPropArr[i].Name)
- return TRUE;
- }
- return FALSE;
+ return aExtMap.hasPropertyByName( rPropertyName );
}
diff --git a/svtools/source/misc/acceleratorexecute.cxx b/svtools/source/misc/acceleratorexecute.cxx
index b540a48347c5..16bc8339a0d9 100644
--- a/svtools/source/misc/acceleratorexecute.cxx
+++ b/svtools/source/misc/acceleratorexecute.cxx
@@ -79,7 +79,6 @@
#include <vcl/window.hxx>
#include <vcl/svapp.hxx>
#include <vos/mutex.hxx>
-#include <comphelper/uieventslogger.hxx>
//===============================================
// namespace
@@ -257,22 +256,6 @@ sal_Bool AcceleratorExecute::execute(const css::awt::KeyEvent& aAWTKey)
sal_Bool bRet = xDispatch.is();
if ( bRet )
{
- if(::comphelper::UiEventsLogger::isEnabled() && m_xSMGR.is() && m_xDispatcher.is()) //#i88653#
- {
- try
- {
- css::uno::Reference< css::frame::XModuleManager > xModuleDetection(
- m_xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.ModuleManager")),
- css::uno::UNO_QUERY_THROW);
-
- const ::rtl::OUString sModule = xModuleDetection->identify(m_xDispatcher);
- css::uno::Sequence<css::beans::PropertyValue> source;
- ::comphelper::UiEventsLogger::appendDispatchOrigin(source, sModule, ::rtl::OUString::createFromAscii("AcceleratorExecute"));
- ::comphelper::UiEventsLogger::logDispatch(aURL, source);
- }
- catch(const css::uno::Exception&)
- { }
- }
// Note: Such instance can be used one times only and destroy itself afterwards .-)
AsyncAccelExec* pExec = AsyncAccelExec::createOnShotInstance(xDispatch, aURL);
pExec->execAsync();
@@ -493,8 +476,14 @@ css::uno::Reference< css::ui::XAcceleratorConfiguration > AcceleratorExecute::st
xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.ui.ModuleUIConfigurationManagerSupplier")),
css::uno::UNO_QUERY_THROW);
- css::uno::Reference< css::ui::XUIConfigurationManager > xUIManager = xUISupplier->getUIConfigurationManager(sModule);
- css::uno::Reference< css::ui::XAcceleratorConfiguration > xAccCfg (xUIManager->getShortCutManager(), css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::ui::XAcceleratorConfiguration > xAccCfg;
+ try
+ {
+ css::uno::Reference< css::ui::XUIConfigurationManager > xUIManager = xUISupplier->getUIConfigurationManager(sModule);
+ xAccCfg = css::uno::Reference< css::ui::XAcceleratorConfiguration >(xUIManager->getShortCutManager(), css::uno::UNO_QUERY_THROW);
+ }
+ catch(const css::container::NoSuchElementException&)
+ {}
return xAccCfg;
}
@@ -579,8 +568,8 @@ IMPL_LINK(AsyncAccelExec, impl_ts_asyncCallback, void*,)
}
catch(const css::lang::DisposedException&)
{}
- catch(const css::uno::RuntimeException&rEx)
- { (void) rEx; throw; }
+ catch(const css::uno::RuntimeException& )
+ { throw; }
catch(const css::uno::Exception&)
{}
diff --git a/svtools/source/misc/documentlockfile.cxx b/svtools/source/misc/documentlockfile.cxx
index 71b541cfe894..990f1ba58d73 100644
--- a/svtools/source/misc/documentlockfile.cxx
+++ b/svtools/source/misc/documentlockfile.cxx
@@ -202,7 +202,7 @@ sal_Bool DocumentLockFile::OverwriteOwnLockFile()
WriteEntryToStream( aNewEntry, xOutput );
xOutput->closeOutput();
}
- catch( ucb::NameClashException& )
+ catch( uno::Exception& )
{
return sal_False;
}
diff --git a/svtools/source/misc/errtxt.src b/svtools/source/misc/errtxt.src
index 72b575f96f43..033ecefc10e7 100644
--- a/svtools/source/misc/errtxt.src
+++ b/svtools/source/misc/errtxt.src
@@ -503,6 +503,10 @@ Resource RID_ERRHDL
{
Text [ en-US ] = "Function not possible: write protected." ;
};
+ String ERRCODE_SFX_SHARED_NOPASSWORDCHANGE
+ {
+ Text [ en-US ] = "The password of a shared spreadsheet cannot be set or changed.\nDeactivate sharing mode first.";
+ };
};
// eof ------------------------------------------------------------------------
diff --git a/svtools/source/numbers/numfmuno.cxx b/svtools/source/numbers/numfmuno.cxx
index 5d9c88ec8760..7417367ec124 100644
--- a/svtools/source/numbers/numfmuno.cxx
+++ b/svtools/source/numbers/numfmuno.cxx
@@ -83,9 +83,9 @@ using namespace com::sun::star;
// alles ohne Which-ID, Map nur fuer PropertySetInfo
-const SfxItemPropertyMap* lcl_GetNumberFormatPropertyMap()
+const SfxItemPropertyMapEntry* lcl_GetNumberFormatPropertyMap()
{
- static SfxItemPropertyMap aNumberFormatPropertyMap_Impl[] =
+ static SfxItemPropertyMapEntry aNumberFormatPropertyMap_Impl[] =
{
{MAP_CHAR_LEN(PROPERTYNAME_FMTSTR), 0, &getCppuType((rtl::OUString*)0),beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
{MAP_CHAR_LEN(PROPERTYNAME_LOCALE), 0, &getCppuType((lang::Locale*)0),beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
@@ -105,9 +105,9 @@ const SfxItemPropertyMap* lcl_GetNumberFormatPropertyMap()
return aNumberFormatPropertyMap_Impl;
}
-const SfxItemPropertyMap* lcl_GetNumberSettingsPropertyMap()
+const SfxItemPropertyMapEntry* lcl_GetNumberSettingsPropertyMap()
{
- static SfxItemPropertyMap aNumberSettingsPropertyMap_Impl[] =
+ static SfxItemPropertyMapEntry aNumberSettingsPropertyMap_Impl[] =
{
{MAP_CHAR_LEN(PROPERTYNAME_NOZERO), 0, &getBooleanCppuType(), beans::PropertyAttribute::BOUND, 0},
{MAP_CHAR_LEN(PROPERTYNAME_NULLDATE), 0, &getCppuType((util::Date*)0), beans::PropertyAttribute::BOUND, 0},
diff --git a/svtools/source/svhtml/makefile.mk b/svtools/source/svhtml/makefile.mk
index 577cc83e65c7..b597763ac390 100644
--- a/svtools/source/svhtml/makefile.mk
+++ b/svtools/source/svhtml/makefile.mk
@@ -34,6 +34,8 @@ PRJ=..$/..
PRJNAME=svtools
TARGET=svhtml
+ENABLE_EXCEPTIONS=TRUE
+
# --- Settings -----------------------------------------------------
.INCLUDE : settings.mk
diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx
index 3413cd3e7fb8..215133c8efb4 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -43,10 +43,21 @@
#include <svtools/svstdarr.hxx>
#endif
+#include <tools/tenccvt.hxx>
+#include <tools/datetime.hxx>
+#include <svtools/inettype.hxx>
+#include <comphelper/string.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/document/XDocumentProperties.hpp>
+
#include <svtools/parhtml.hxx>
#include "htmltokn.h"
#include "htmlkywd.hxx"
+
+using namespace ::com::sun::star;
+
+
const sal_Int32 MAX_LEN( 1024L );
//static sal_Unicode sTmpBuffer[ MAX_LEN+1 ];
const sal_Int32 MAX_MACRO_LEN( 1024 );
@@ -2080,7 +2091,6 @@ BOOL HTMLParser::InternalImgToPrivateURL( String& rURL )
return bFound;
}
-
#ifdef USED
void HTMLParser::SaveState( int nToken )
{
@@ -2093,3 +2103,241 @@ void HTMLParser::RestoreState()
}
#endif
+
+enum eHtmlMetas {
+ HTML_META_NONE = 0,
+ HTML_META_AUTHOR,
+ HTML_META_DESCRIPTION,
+ HTML_META_KEYWORDS,
+ HTML_META_REFRESH,
+ HTML_META_CLASSIFICATION,
+ HTML_META_CREATED,
+ HTML_META_CHANGEDBY,
+ HTML_META_CHANGED,
+ HTML_META_GENERATOR,
+ HTML_META_SDFOOTNOTE,
+ HTML_META_SDENDNOTE,
+ HTML_META_CONTENT_TYPE
+};
+
+// <META NAME=xxx>
+#ifdef __MINGW32__ // for runtime pseudo reloc
+static HTMLOptionEnum aHTMLMetaNameTable[] =
+#else
+static HTMLOptionEnum __READONLY_DATA aHTMLMetaNameTable[] =
+#endif
+{
+ { OOO_STRING_SVTOOLS_HTML_META_author, HTML_META_AUTHOR },
+ { OOO_STRING_SVTOOLS_HTML_META_changed, HTML_META_CHANGED },
+ { OOO_STRING_SVTOOLS_HTML_META_changedby, HTML_META_CHANGEDBY },
+ { OOO_STRING_SVTOOLS_HTML_META_classification,HTML_META_CLASSIFICATION},
+ { OOO_STRING_SVTOOLS_HTML_META_content_type, HTML_META_CONTENT_TYPE },
+ { OOO_STRING_SVTOOLS_HTML_META_created, HTML_META_CREATED },
+ { OOO_STRING_SVTOOLS_HTML_META_description, HTML_META_DESCRIPTION },
+ { OOO_STRING_SVTOOLS_HTML_META_keywords, HTML_META_KEYWORDS },
+ { OOO_STRING_SVTOOLS_HTML_META_generator, HTML_META_GENERATOR },
+ { OOO_STRING_SVTOOLS_HTML_META_refresh, HTML_META_REFRESH },
+ { OOO_STRING_SVTOOLS_HTML_META_sdendnote, HTML_META_SDENDNOTE },
+ { OOO_STRING_SVTOOLS_HTML_META_sdfootnote, HTML_META_SDFOOTNOTE },
+ { 0, 0 }
+};
+
+
+void HTMLParser::AddMetaUserDefined( ::rtl::OUString const & )
+{
+}
+
+bool HTMLParser::ParseMetaOptionsImpl(
+ const uno::Reference<document::XDocumentProperties> & i_xDocProps,
+ SvKeyValueIterator *i_pHTTPHeader,
+ const HTMLOptions *i_pOptions,
+ rtl_TextEncoding& o_rEnc )
+{
+ String aName, aContent;
+ USHORT nAction = HTML_META_NONE;
+ bool bHTTPEquiv = false, bChanged = false;
+
+ for ( USHORT i = i_pOptions->Count(); i; )
+ {
+ const HTMLOption *pOption = (*i_pOptions)[ --i ];
+ switch ( pOption->GetToken() )
+ {
+ case HTML_O_NAME:
+ aName = pOption->GetString();
+ if ( HTML_META_NONE==nAction )
+ {
+ pOption->GetEnum( nAction, aHTMLMetaNameTable );
+ }
+ break;
+ case HTML_O_HTTPEQUIV:
+ aName = pOption->GetString();
+ pOption->GetEnum( nAction, aHTMLMetaNameTable );
+ bHTTPEquiv = true;
+ break;
+ case HTML_O_CONTENT:
+ aContent = pOption->GetString();
+ break;
+ }
+ }
+
+ if ( bHTTPEquiv || HTML_META_DESCRIPTION != nAction )
+ {
+ // if it is not a Description, remove CRs and LFs from CONTENT
+ aContent.EraseAllChars( _CR );
+ aContent.EraseAllChars( _LF );
+ }
+ else
+ {
+ // convert line endings for Description
+ aContent.ConvertLineEnd();
+ }
+
+
+ if ( bHTTPEquiv && i_pHTTPHeader )
+ {
+ // #57232#: Netscape seems to just ignore a closing ", so we do too
+ if ( aContent.Len() && '"' == aContent.GetChar( aContent.Len()-1 ) )
+ {
+ aContent.Erase( aContent.Len() - 1 );
+ }
+ SvKeyValue aKeyValue( aName, aContent );
+ i_pHTTPHeader->Append( aKeyValue );
+ }
+
+ switch ( nAction )
+ {
+ case HTML_META_AUTHOR:
+ if (i_xDocProps.is()) {
+ i_xDocProps->setAuthor( aContent );
+ bChanged = true;
+ }
+ break;
+ case HTML_META_DESCRIPTION:
+ if (i_xDocProps.is()) {
+ i_xDocProps->setDescription( aContent );
+ bChanged = true;
+ }
+ break;
+ case HTML_META_KEYWORDS:
+ if (i_xDocProps.is()) {
+ i_xDocProps->setKeywords(
+ ::comphelper::string::convertCommaSeparated(aContent));
+ bChanged = true;
+ }
+ break;
+ case HTML_META_CLASSIFICATION:
+ if (i_xDocProps.is()) {
+ i_xDocProps->setSubject( aContent );
+ bChanged = true;
+ }
+ break;
+
+ case HTML_META_CHANGEDBY:
+ if (i_xDocProps.is()) {
+ i_xDocProps->setModifiedBy( aContent );
+ }
+ break;
+
+ case HTML_META_CREATED:
+ case HTML_META_CHANGED:
+ if ( i_xDocProps.is() && aContent.Len() &&
+ aContent.GetTokenCount() == 2 )
+ {
+ Date aDate( (ULONG)aContent.GetToken(0).ToInt32() );
+ Time aTime( (ULONG)aContent.GetToken(1).ToInt32() );
+ DateTime aDateTime( aDate, aTime );
+ ::util::DateTime uDT(aDateTime.Get100Sec(),
+ aDateTime.GetSec(), aDateTime.GetMin(),
+ aDateTime.GetHour(), aDateTime.GetDay(),
+ aDateTime.GetMonth(), aDateTime.GetYear());
+ if ( HTML_META_CREATED==nAction )
+ i_xDocProps->setCreationDate( uDT );
+ else
+ i_xDocProps->setModificationDate( uDT );
+ bChanged = true;
+ }
+ break;
+
+ case HTML_META_REFRESH:
+ DBG_ASSERT( !bHTTPEquiv || i_pHTTPHeader,
+ "Reload-URL aufgrund unterlassener MUSS-Aenderung verlorengegangen" );
+ break;
+
+ case HTML_META_CONTENT_TYPE:
+ if ( aContent.Len() )
+ {
+ o_rEnc = GetEncodingByMIME( aContent );
+ }
+ break;
+
+ case HTML_META_NONE:
+ if ( !bHTTPEquiv )
+ {
+ if (i_xDocProps.is())
+ {
+ uno::Reference<beans::XPropertyContainer> xUDProps
+ = i_xDocProps->getUserDefinedProperties();
+ try {
+ xUDProps->addProperty(aName,
+ beans::PropertyAttribute::REMOVEABLE,
+ uno::makeAny(::rtl::OUString(aContent)));
+ AddMetaUserDefined(aName);
+ bChanged = true;
+ } catch (uno::Exception &) {
+ // ignore
+ }
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ return bChanged;
+}
+
+bool HTMLParser::ParseMetaOptions(
+ const uno::Reference<document::XDocumentProperties> & i_xDocProps,
+ SvKeyValueIterator *i_pHeader )
+{
+ USHORT nContentOption = HTML_O_CONTENT;
+ rtl_TextEncoding eEnc = RTL_TEXTENCODING_DONTKNOW;
+
+ bool bRet = ParseMetaOptionsImpl( i_xDocProps, i_pHeader,
+ GetOptions(&nContentOption),
+ eEnc );
+
+ // If the encoding is set by a META tag, it may only overwrite the
+ // current encoding if both, the current and the new encoding, are 1-BYTE
+ // encodings. Everything else cannot lead to reasonable results.
+ if (RTL_TEXTENCODING_DONTKNOW != eEnc &&
+ rtl_isOctetTextEncoding( eEnc ) &&
+ rtl_isOctetTextEncoding( GetSrcEncoding() ) )
+ {
+ eEnc = GetExtendedCompatibilityTextEncoding( eEnc ); // #89973#
+ SetSrcEncoding( eEnc );
+ }
+
+ return bRet;
+}
+
+rtl_TextEncoding HTMLParser::GetEncodingByMIME( const String& rMime )
+{
+ ByteString sType;
+ ByteString sSubType;
+ INetContentTypeParameterList aParameters;
+ ByteString sMime( rMime, RTL_TEXTENCODING_ASCII_US );
+ if (INetContentTypes::parse(sMime, sType, sSubType, &aParameters))
+ {
+ const INetContentTypeParameter * pCharset
+ = aParameters.find("charset");
+ if (pCharset != 0)
+ {
+ ByteString sValue( pCharset->m_sValue, RTL_TEXTENCODING_ASCII_US );
+ return GetExtendedCompatibilityTextEncoding(
+ rtl_getTextEncodingFromMimeCharset( sValue.GetBuffer() ) );
+ }
+ }
+ return RTL_TEXTENCODING_DONTKNOW;
+}
+
diff --git a/svtools/source/svrtf/rtfkey2.cxx b/svtools/source/svrtf/rtfkey2.cxx
new file mode 100644
index 000000000000..5c4e1039d92c
--- /dev/null
+++ b/svtools/source/svrtf/rtfkey2.cxx
@@ -0,0 +1,1162 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: rtfkey2.cxx,v $
+ * $Revision: 1.14.134.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svtools.hxx"
+
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
+
+#include "rtfkeywd.hxx"
+
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_HEXCHAR, "\\'" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_IGNORE, "\\*" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OPTHYPH, "\\-" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SUBENTRY, "\\:" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ABSH, "\\absh" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ABSW, "\\absw" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ALT, "\\alt" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ANNOTATION, "\\annotation" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ANSI, "\\ansi" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ATNID, "\\atnid" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AUTHOR, "\\author" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_B, "\\b" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BGBDIAG, "\\bgbdiag" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BGCROSS, "\\bgcross" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BGDCROSS, "\\bgdcross" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BGDKBDIAG, "\\bgdkbdiag" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BGDKCROSS, "\\bgdkcross" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BGDKDCROSS, "\\bgdkdcross" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BGDKFDIAG, "\\bgdkfdiag" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BGDKHORIZ, "\\bgdkhoriz" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BGDKVERT, "\\bgdkvert" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BGFDIAG, "\\bgfdiag" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BGHORIZ, "\\bghoriz" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BGVERT, "\\bgvert" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BIN, "\\bin" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BINFSXN, "\\binfsxn" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BINSXN, "\\binsxn" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BKMKCOLF, "\\bkmkcolf" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BKMKCOLL, "\\bkmkcoll" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BKMKEND, "\\bkmkend" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BKMKSTART, "\\bkmkstart" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BLUE, "\\blue" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BOX, "\\box" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDRB, "\\brdrb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDRBAR, "\\brdrbar" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDRBTW, "\\brdrbtw" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDRCF, "\\brdrcf" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDRDB, "\\brdrdb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDRDOT, "\\brdrdot" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDRHAIR, "\\brdrhair" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDRL, "\\brdrl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDRR, "\\brdrr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDRS, "\\brdrs" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDRSH, "\\brdrsh" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDRT, "\\brdrt" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDRTH, "\\brdrth" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDRW, "\\brdrw" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRSP, "\\brsp" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BULLET, "\\bullet" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BUPTIM, "\\buptim" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BXE, "\\bxe" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CAPS, "\\caps" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CB, "\\cb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CBPAT, "\\cbpat" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CELL, "\\cell" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CELLX, "\\cellx" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CF, "\\cf" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CFPAT, "\\cfpat" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CHATN, "\\chatn" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CHDATE, "\\chdate" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CHDPA, "\\chdpa" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CHDPL, "\\chdpl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CHFTN, "\\chftn" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CHFTNSEP, "\\chftnsep" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CHFTNSEPC, "\\chftnsepc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CHPGN, "\\chpgn" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CHTIME, "\\chtime" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLBGBDIAG, "\\clbgbdiag" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLBGCROSS, "\\clbgcross" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLBGDCROSS, "\\clbgdcross" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLBGDKBDIAG, "\\clbgdkbdiag" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLBGDKCROSS, "\\clbgdkcross" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLBGDKDCROSS, "\\clbgdkdcross" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLBGDKFDIAG, "\\clbgdkfdiag" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLBGDKHOR, "\\clbgdkhor" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLBGDKVERT, "\\clbgdkvert" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLBGFDIAG, "\\clbgfdiag" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLBGHORIZ, "\\clbghoriz" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLBGVERT, "\\clbgvert" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLBRDRB, "\\clbrdrb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLBRDRL, "\\clbrdrl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLBRDRR, "\\clbrdrr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLBRDRT, "\\clbrdrt" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLCBPAT, "\\clcbpat" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLCFPAT, "\\clcfpat" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLMGF, "\\clmgf" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLMRG, "\\clmrg" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLSHDNG, "\\clshdng" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_COLNO, "\\colno" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_COLORTBL, "\\colortbl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_COLS, "\\cols" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_COLSR, "\\colsr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_COLSX, "\\colsx" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_COLUMN, "\\column" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_COLW, "\\colw" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_COMMENT, "\\comment" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CREATIM, "\\creatim" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CTRL, "\\ctrl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DEFF, "\\deff" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DEFFORMAT, "\\defformat" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DEFLANG, "\\deflang" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DEFTAB, "\\deftab" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DELETED, "\\deleted" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DFRMTXTX, "\\dfrmtxtx" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DFRMTXTY, "\\dfrmtxty" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DIBITMAP, "\\dibitmap" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DN, "\\dn" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DOCCOMM, "\\doccomm" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DOCTEMP, "\\doctemp" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DROPCAPLI, "\\dropcapli" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DROPCAPT, "\\dropcapt" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ABSNOOVRLP, "\\absnoovrlp" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DXFRTEXT, "\\dxfrtext" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DY, "\\dy" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_EDMINS, "\\edmins" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_EMDASH, "\\emdash" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ENDASH, "\\endash" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ENDDOC, "\\enddoc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ENDNHERE, "\\endnhere" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ENDNOTES, "\\endnotes" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_EXPND, "\\expnd" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_EXPNDTW, "\\expndtw" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_F, "\\f" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FACINGP, "\\facingp" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FACPGSXN, "\\facpgsxn" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FALT, "\\falt" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FCHARSET, "\\fcharset" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FDECOR, "\\fdecor" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FI, "\\fi" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FIELD, "\\field" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FLDDIRTY, "\\flddirty" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FLDEDIT, "\\fldedit" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FLDINST, "\\fldinst" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FLDLOCK, "\\fldlock" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FLDPRIV, "\\fldpriv" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FLDRSLT, "\\fldrslt" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FMODERN, "\\fmodern" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FN, "\\fn" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FNIL, "\\fnil" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FONTTBL, "\\fonttbl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FOOTER, "\\footer" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FOOTERF, "\\footerf" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FOOTERL, "\\footerl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FOOTERR, "\\footerr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FOOTERY, "\\footery" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FOOTNOTE, "\\footnote" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FPRQ, "\\fprq" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FRACWIDTH, "\\fracwidth" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FROMAN, "\\froman" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FS, "\\fs" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FSCRIPT, "\\fscript" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FSWISS, "\\fswiss" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FTECH, "\\ftech" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FTNBJ, "\\ftnbj" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FTNCN, "\\ftncn" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FTNRESTART, "\\ftnrestart" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FTNSEP, "\\ftnsep" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FTNSEPC, "\\ftnsepc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FTNSTART, "\\ftnstart" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FTNTJ, "\\ftntj" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_GREEN, "\\green" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_GUTTER, "\\gutter" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_GUTTERSXN, "\\guttersxn" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_HEADER, "\\header" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_HEADERF, "\\headerf" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_HEADERL, "\\headerl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_HEADERR, "\\headerr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_HEADERY, "\\headery" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_HR, "\\hr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_HYPHHOTZ, "\\hyphhotz" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_I, "\\i" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ID, "\\id" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_INFO, "\\info" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_INTBL, "\\intbl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_IXE, "\\ixe" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_KEEP, "\\keep" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_KEEPN, "\\keepn" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_KERNING, "\\kerning" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_KEYCODE, "\\keycode" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_KEYWORDS, "\\keywords" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LANDSCAPE, "\\landscape" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LANG, "\\lang" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LDBLQUOTE, "\\ldblquote" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LEVEL, "\\level" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LI, "\\li" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LIN, "\\lin" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LINE, "\\line" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LINEBETCOL, "\\linebetcol" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LINECONT, "\\linecont" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LINEMOD, "\\linemod" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LINEPPAGE, "\\lineppage" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LINERESTART, "\\linerestart" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LINESTART, "\\linestart" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LINESTARTS, "\\linestarts" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LINEX, "\\linex" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LNDSCPSXN, "\\lndscpsxn" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LQUOTE, "\\lquote" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_MAC, "\\mac" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_MACPICT, "\\macpict" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_MAKEBACKUP, "\\makebackup" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_MARGB, "\\margb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_MARGBSXN, "\\margbsxn" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_MARGL, "\\margl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_MARGLSXN, "\\marglsxn" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_MARGMIRROR, "\\margmirror" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_MARGR, "\\margr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_MARGRSXN, "\\margrsxn" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_MARGT, "\\margt" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_MARGTSXN, "\\margtsxn" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_MIN, "\\min" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_MO, "\\mo" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_NEXTCSET, "\\nextcset" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_NEXTFILE, "\\nextfile" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_NOFCHARS, "\\nofchars" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_NOFPAGES, "\\nofpages" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_NOFWORDS, "\\nofwords" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_NOLINE, "\\noline" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_NOSUPERSUB, "\\nosupersub" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_NOWRAP, "\\nowrap" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OPERATOR, "\\operator" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OUTL, "\\outl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PAGE, "\\page" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PAGEBB, "\\pagebb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PAPERH, "\\paperh" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PAPERW, "\\paperw" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PAR, "\\par" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PARD, "\\pard" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PC, "\\pc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PCA, "\\pca" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGHSXN, "\\pghsxn" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGNCONT, "\\pgncont" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGNDEC, "\\pgndec" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGNLCLTR, "\\pgnlcltr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGNLCRM, "\\pgnlcrm" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGNRESTART, "\\pgnrestart" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGNSTART, "\\pgnstart" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGNSTARTS, "\\pgnstarts" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGNUCLTR, "\\pgnucltr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGNUCRM, "\\pgnucrm" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGNX, "\\pgnx" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGNY, "\\pgny" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGWSXN, "\\pgwsxn" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PHCOL, "\\phcol" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PHMRG, "\\phmrg" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PHPG, "\\phpg" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PICCROPB, "\\piccropb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PICCROPL, "\\piccropl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PICCROPR, "\\piccropr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PICCROPT, "\\piccropt" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PICH, "\\pich" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PICHGOAL, "\\pichgoal" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PICSCALED, "\\picscaled" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PICSCALEX, "\\picscalex" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PICSCALEY, "\\picscaley" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PICT, "\\pict" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PICW, "\\picw" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PICWGOAL, "\\picwgoal" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PLAIN, "\\plain" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PMMETAFILE, "\\pmmetafile" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_POSNEGX, "\\posnegx" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_POSNEGY, "\\posnegy" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_POSX, "\\posx" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_POSXC, "\\posxc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_POSXI, "\\posxi" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_POSXL, "\\posxl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_POSXO, "\\posxo" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_POSXR, "\\posxr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_POSY, "\\posy" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_POSYB, "\\posyb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_POSYC, "\\posyc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_POSYIL, "\\posyil" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_POSYT, "\\posyt" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PRINTIM, "\\printim" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PSOVER, "\\psover" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PVMRG, "\\pvmrg" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PVPARA, "\\pvpara" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PVPG, "\\pvpg" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_QC, "\\qc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_QJ, "\\qj" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_QL, "\\ql" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_QR, "\\qr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_RDBLQUOTE, "\\rdblquote" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_RED, "\\red" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_REVBAR, "\\revbar" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_REVISED, "\\revised" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_REVISIONS, "\\revisions" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_REVPROP, "\\revprop" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_REVTIM, "\\revtim" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_RI, "\\ri" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_RIN, "\\rin" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ROW, "\\row" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_RQUOTE, "\\rquote" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_RTF, "\\rtf" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_RXE, "\\rxe" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_S, "\\s" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SA, "\\sa" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SB, "\\sb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SBASEDON, "\\sbasedon" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SBKCOL, "\\sbkcol" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SBKEVEN, "\\sbkeven" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SBKNONE, "\\sbknone" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SBKODD, "\\sbkodd" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SBKPAGE, "\\sbkpage" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SBYS, "\\sbys" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SCAPS, "\\scaps" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SECT, "\\sect" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SECTD, "\\sectd" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHAD, "\\shad" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHADING, "\\shading" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHIFT, "\\shift" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SL, "\\sl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SNEXT, "\\snext" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_STRIKE, "\\strike" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_STYLESHEET, "\\stylesheet" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SUB, "\\sub" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SUBJECT, "\\subject" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SUPER, "\\super" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TAB, "\\tab" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TB, "\\tb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TC, "\\tc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TCF, "\\tcf" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TCL, "\\tcl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TEMPLATE, "\\template" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TITLE, "\\title" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TITLEPG, "\\titlepg" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TLDOT, "\\tldot" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TLEQ, "\\tleq" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TLHYPH, "\\tlhyph" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TLTH, "\\tlth" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TLUL, "\\tlul" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TQC, "\\tqc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TQDEC, "\\tqdec" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TQR, "\\tqr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TQL, "\\tql" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TRGAPH, "\\trgaph" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TRLEFT, "\\trleft" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TROWD, "\\trowd" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TRQC, "\\trqc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TRQL, "\\trql" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TRQR, "\\trqr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TRRH, "\\trrh" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TX, "\\tx" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TXE, "\\txe" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_UL, "\\ul" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ULD, "\\uld" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ULDB, "\\uldb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ULNONE, "\\ulnone" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ULW, "\\ulw" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_UP, "\\up" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_V, "\\v" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_VERN, "\\vern" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_VERSION, "\\version" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_VERTALB, "\\vertalb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_VERTALC, "\\vertalc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_VERTALJ, "\\vertalj" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_VERTALT, "\\vertalt" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_WBITMAP, "\\wbitmap" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_WBMBITSPIXEL, "\\wbmbitspixel" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_WBMPLANES, "\\wbmplanes" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_WBMWIDTHBYTES, "\\wbmwidthbytes" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_WIDOWCTRL, "\\widowctrl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_WMETAFILE, "\\wmetafile" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_XE, "\\xe" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_YR, "\\yr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_NOBRKHYPH, "\\_" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FORMULA, "\\|" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_NOBREAK, "\\~" );
+
+
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AB, "\\ab" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ACAPS, "\\acaps" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ACF, "\\acf" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ADDITIVE, "\\additive" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ADN, "\\adn" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AENDDOC, "\\aenddoc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AENDNOTES, "\\aendnotes" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AEXPND, "\\aexpnd" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AF, "\\af" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AFS, "\\afs" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AFTNBJ, "\\aftnbj" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AFTNCN, "\\aftncn" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNALC, "\\aftnnalc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNAR, "\\aftnnar" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNAUC, "\\aftnnauc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNCHI, "\\aftnnchi" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNRLC, "\\aftnnrlc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNRUC, "\\aftnnruc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AFTNRESTART, "\\aftnrestart" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AFTNRSTCONT, "\\aftnrstcont" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AFTNSEP, "\\aftnsep" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AFTNSEPC, "\\aftnsepc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AFTNSTART, "\\aftnstart" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AFTNTJ, "\\aftntj" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AI, "\\ai" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ALANG, "\\alang" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ALLPROT, "\\allprot" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ANNOTPROT, "\\annotprot" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AOUTL, "\\aoutl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ASCAPS, "\\ascaps" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ASHAD, "\\ashad" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ASTRIKE, "\\astrike" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ATNAUTHOR, "\\atnauthor" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ATNICN, "\\atnicn" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ATNREF, "\\atnref" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ATNTIME, "\\atntime" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ATRFEND, "\\atrfend" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ATRFSTART, "\\atrfstart" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AUL, "\\aul" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AULD, "\\auld" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AULDB, "\\auldb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AULNONE, "\\aulnone" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AULW, "\\aulw" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AUP, "\\aup" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BKMKPUB, "\\bkmkpub" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDRDASH, "\\brdrdash" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRKFRM, "\\brkfrm" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CCHS, "\\cchs" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CPG, "\\cpg" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CS, "\\cs" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CVMME, "\\cvmme" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DATAFIELD, "\\datafield" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DO, "\\do" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DOBXCOLUMN, "\\dobxcolumn" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DOBXMARGIN, "\\dobxmargin" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DOBXPAGE, "\\dobxpage" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DOBYMARGIN, "\\dobymargin" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DOBYPAGE, "\\dobypage" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DOBYPARA, "\\dobypara" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DODHGT, "\\dodhgt" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DOLOCK, "\\dolock" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPAENDHOL, "\\dpaendhol" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPAENDL, "\\dpaendl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPAENDSOL, "\\dpaendsol" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPAENDW, "\\dpaendw" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPARC, "\\dparc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPARCFLIPX, "\\dparcflipx" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPARCFLIPY, "\\dparcflipy" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPASTARTHOL, "\\dpastarthol" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPASTARTL, "\\dpastartl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPASTARTSOL, "\\dpastartsol" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPASTARTW, "\\dpastartw" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPCALLOUT, "\\dpcallout" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPCOA, "\\dpcoa" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPCOACCENT, "\\dpcoaccent" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPCOBESTFIT, "\\dpcobestfit" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPCOBORDER, "\\dpcoborder" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPCODABS, "\\dpcodabs" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPCODBOTTOM, "\\dpcodbottom" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPCODCENTER, "\\dpcodcenter" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPCODTOP, "\\dpcodtop" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPCOLENGTH, "\\dpcolength" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPCOMINUSX, "\\dpcominusx" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPCOMINUSY, "\\dpcominusy" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPCOOFFSET, "\\dpcooffset" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPCOSMARTA, "\\dpcosmarta" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPCOTDOUBLE, "\\dpcotdouble" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPCOTRIGHT, "\\dpcotright" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPCOTSINGLE, "\\dpcotsingle" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPCOTTRIPLE, "\\dpcottriple" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPCOUNT, "\\dpcount" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPELLIPSE, "\\dpellipse" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPENDGROUP, "\\dpendgroup" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPFILLBGCB, "\\dpfillbgcb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPFILLBGCG, "\\dpfillbgcg" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPFILLBGCR, "\\dpfillbgcr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPFILLBGGRAY, "\\dpfillbggray" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPFILLBGPAL, "\\dpfillbgpal" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPFILLFGCB, "\\dpfillfgcb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPFILLFGCG, "\\dpfillfgcg" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPFILLFGCR, "\\dpfillfgcr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPFILLFGGRAY, "\\dpfillfggray" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPFILLFGPAL, "\\dpfillfgpal" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPFILLPAT, "\\dpfillpat" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPGROUP, "\\dpgroup" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPLINE, "\\dpline" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPLINECOB, "\\dplinecob" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPLINECOG, "\\dplinecog" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPLINECOR, "\\dplinecor" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPLINEDADO, "\\dplinedado" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPLINEDADODO, "\\dplinedadodo" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPLINEDASH, "\\dplinedash" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPLINEDOT, "\\dplinedot" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPLINEGRAY, "\\dplinegray" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPLINEHOLLOW, "\\dplinehollow" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPLINEPAL, "\\dplinepal" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPLINESOLID, "\\dplinesolid" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPLINEW, "\\dplinew" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPPOLYCOUNT, "\\dppolycount" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPPOLYGON, "\\dppolygon" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPPOLYLINE, "\\dppolyline" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPPTX, "\\dpptx" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPPTY, "\\dppty" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPRECT, "\\dprect" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPROUNDR, "\\dproundr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPSHADOW, "\\dpshadow" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPSHADX, "\\dpshadx" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPSHADY, "\\dpshady" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPTXBX, "\\dptxbx" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPTXBXMAR, "\\dptxbxmar" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPTXBXTEXT, "\\dptxbxtext" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPX, "\\dpx" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPXSIZE, "\\dpxsize" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPY, "\\dpy" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPYSIZE, "\\dpysize" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DS, "\\ds" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_EMSPACE, "\\emspace" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ENSPACE, "\\enspace" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FBIDI, "\\fbidi" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FET, "\\fet" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FID, "\\fid" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FILE, "\\file" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FILETBL, "\\filetbl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FLDALT, "\\fldalt" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FNETWORK, "\\fnetwork" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FONTEMB, "\\fontemb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FONTFILE, "\\fontfile" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FORMDISP, "\\formdisp" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FORMPROT, "\\formprot" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FORMSHADE, "\\formshade" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FOSNUM, "\\fosnum" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FRELATIVE, "\\frelative" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FTNALT, "\\ftnalt" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FTNIL, "\\ftnil" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FTNNALC, "\\ftnnalc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FTNNAR, "\\ftnnar" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FTNNAUC, "\\ftnnauc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FTNNCHI, "\\ftnnchi" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FTNNRLC, "\\ftnnrlc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FTNNRUC, "\\ftnnruc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FTNRSTCONT, "\\ftnrstcont" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FTNRSTPG, "\\ftnrstpg" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FTTRUETYPE, "\\fttruetype" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FVALIDDOS, "\\fvaliddos" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FVALIDHPFS, "\\fvalidhpfs" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FVALIDMAC, "\\fvalidmac" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FVALIDNTFS, "\\fvalidntfs" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_HYPHAUTO, "\\hyphauto" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_HYPHCAPS, "\\hyphcaps" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_HYPHCONSEC, "\\hyphconsec" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_HYPHPAR, "\\hyphpar" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LINKSELF, "\\linkself" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LINKSTYLES, "\\linkstyles" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LTRCH, "\\ltrch" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LTRDOC, "\\ltrdoc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LTRMARK, "\\ltrmark" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LTRPAR, "\\ltrpar" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LTRROW, "\\ltrrow" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LTRSECT, "\\ltrsect" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_NOCOLBAL, "\\nocolbal" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_NOEXTRASPRL, "\\noextrasprl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_NOTABIND, "\\notabind" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_NOWIDCTLPAR, "\\nowidctlpar" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OBJALIAS, "\\objalias" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OBJALIGN, "\\objalign" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OBJAUTLINK, "\\objautlink" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OBJCLASS, "\\objclass" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OBJCROPB, "\\objcropb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OBJCROPL, "\\objcropl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OBJCROPR, "\\objcropr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OBJCROPT, "\\objcropt" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OBJDATA, "\\objdata" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OBJECT, "\\object" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OBJEMB, "\\objemb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OBJH, "\\objh" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OBJICEMB, "\\objicemb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OBJLINK, "\\objlink" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OBJLOCK, "\\objlock" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OBJNAME, "\\objname" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OBJPUB, "\\objpub" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OBJSCALEX, "\\objscalex" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OBJSCALEY, "\\objscaley" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OBJSECT, "\\objsect" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OBJSETSIZE, "\\objsetsize" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OBJSUB, "\\objsub" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OBJTIME, "\\objtime" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OBJTRANSY, "\\objtransy" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OBJUPDATE, "\\objupdate" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OBJW, "\\objw" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OTBLRUL, "\\otblrul" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGNHN, "\\pgnhn" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGNHNSC, "\\pgnhnsc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGNHNSH, "\\pgnhnsh" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGNHNSM, "\\pgnhnsm" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGNHNSN, "\\pgnhnsn" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGNHNSP, "\\pgnhnsp" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PICBMP, "\\picbmp" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PICBPP, "\\picbpp" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PN, "\\pn" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNACROSS, "\\pnacross" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNB, "\\pnb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNCAPS, "\\pncaps" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNCARD, "\\pncard" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNCF, "\\pncf" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNDEC, "\\pndec" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNF, "\\pnf" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNFS, "\\pnfs" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNHANG, "\\pnhang" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNI, "\\pni" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNINDENT, "\\pnindent" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNLCLTR, "\\pnlcltr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNLCRM, "\\pnlcrm" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNLVL, "\\pnlvl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNLVLBLT, "\\pnlvlblt" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNLVLBODY, "\\pnlvlbody" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNLVLCONT, "\\pnlvlcont" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNNUMONCE, "\\pnnumonce" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNORD, "\\pnord" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNORDT, "\\pnordt" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNPREV, "\\pnprev" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNQC, "\\pnqc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNQL, "\\pnql" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNQR, "\\pnqr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNRESTART, "\\pnrestart" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNSCAPS, "\\pnscaps" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNSECLVL, "\\pnseclvl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNSP, "\\pnsp" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNSTART, "\\pnstart" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNSTRIKE, "\\pnstrike" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNTEXT, "\\pntext" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNTXTA, "\\pntxta" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNTXTB, "\\pntxtb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNUCLTR, "\\pnucltr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNUCRM, "\\pnucrm" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNUL, "\\pnul" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNULD, "\\pnuld" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNULDB, "\\pnuldb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNULNONE, "\\pnulnone" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNULW, "\\pnulw" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PRCOLBL, "\\prcolbl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PRINTDATA, "\\printdata" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PSZ, "\\psz" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PUBAUTO, "\\pubauto" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_RESULT, "\\result" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_REVAUTH, "\\revauth" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_REVDTTM, "\\revdttm" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_REVPROT, "\\revprot" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_REVTBL, "\\revtbl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_RSLTBMP, "\\rsltbmp" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_RSLTMERGE, "\\rsltmerge" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_RSLTPICT, "\\rsltpict" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_RSLTRTF, "\\rsltrtf" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_RSLTTXT, "\\rslttxt" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_RTLCH, "\\rtlch" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_RTLDOC, "\\rtldoc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_RTLMARK, "\\rtlmark" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_RTLPAR, "\\rtlpar" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_RTLROW, "\\rtlrow" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_RTLSECT, "\\rtlsect" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SEC, "\\sec" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SECTNUM, "\\sectnum" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SECTUNLOCKED, "\\sectunlocked" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SLMULT, "\\slmult" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SOFTCOL, "\\softcol" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SOFTLHEIGHT, "\\softlheight" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SOFTLINE, "\\softline" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SOFTPAGE, "\\softpage" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SPRSSPBF, "\\sprsspbf" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SPRSTSP, "\\sprstsp" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SUBDOCUMENT, "\\subdocument" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SWPBDR, "\\swpbdr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TCN, "\\tcn" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TRANSMF, "\\transmf" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TRBRDRB, "\\trbrdrb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TRBRDRH, "\\trbrdrh" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TRBRDRL, "\\trbrdrl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TRBRDRR, "\\trbrdrr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TRBRDRT, "\\trbrdrt" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TRBRDRV, "\\trbrdrv" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TRHDR, "\\trhdr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TRKEEP, "\\trkeep" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TRPADDB, "\\trpaddb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TRPADDL, "\\trpaddl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TRPADDR, "\\trpaddr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TRPADDT, "\\trpaddt" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TRPADDFB, "\\trpaddfb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TRPADDFL, "\\trpaddfl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TRPADDFR, "\\trpaddfr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TRPADDFT, "\\trpaddft" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_WRAPTRSP, "\\wraptrsp" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_XEF, "\\xef" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ZWJ, "\\zwj" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ZWNJ, "\\zwnj" );
+
+// neue Tokens zur 1.5
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ABSLOCK, "\\abslock" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ADJUSTRIGHT, "\\adjustright" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNCHOSUNG, "\\aftnnchosung" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNCNUM, "\\aftnncnum" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNDBAR, "\\aftnndbar" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNDBNUM, "\\aftnndbnum" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNDBNUMD, "\\aftnndbnumd" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNDBNUMK, "\\aftnndbnumk" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNDBNUMT, "\\aftnndbnumt" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNGANADA, "\\aftnnganada" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNGBNUM, "\\aftnngbnum" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNGBNUMD, "\\aftnngbnumd" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNGBNUMK, "\\aftnngbnumk" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNGBNUML, "\\aftnngbnuml" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNZODIAC, "\\aftnnzodiac" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNZODIACD, "\\aftnnzodiacd" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_AFTNNZODIACL, "\\aftnnzodiacl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ANIMTEXT, "\\animtext" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ANSICPG, "\\ansicpg" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BACKGROUND, "\\background" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BDBFHDR, "\\bdbfhdr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BLIPTAG, "\\bliptag" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BLIPUID, "\\blipuid" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BLIPUPI, "\\blipupi" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDRART, "\\brdrart" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDRDASHD, "\\brdrdashd" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDRDASHDD, "\\brdrdashdd" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDRDASHDOTSTR, "\\brdrdashdotstr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDRDASHSM, "\\brdrdashsm" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDREMBOSS, "\\brdremboss" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDRENGRAVE, "\\brdrengrave" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDRFRAME, "\\brdrframe" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDRTHTNLG, "\\brdrthtnlg" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDRTHTNMG, "\\brdrthtnmg" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDRTHTNSG, "\\brdrthtnsg" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDRTNTHLG, "\\brdrtnthlg" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDRTNTHMG, "\\brdrtnthmg" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDRTNTHSG, "\\brdrtnthsg" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDRTNTHTNLG, "\\brdrtnthtnlg" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDRTNTHTNMG, "\\brdrtnthtnmg" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDRTNTHTNSG, "\\brdrtnthtnsg" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDRTRIPLE, "\\brdrtriple" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDRWAVY, "\\brdrwavy" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDRWAVYDB, "\\brdrwavydb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CATEGORY, "\\category" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CGRID, "\\cgrid" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CHARSCALEX, "\\charscalex" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CHBGBDIAG, "\\chbgbdiag" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CHBGCROSS, "\\chbgcross" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CHBGDCROSS, "\\chbgdcross" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CHBGDKBDIAG, "\\chbgdkbdiag" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CHBGDKCROSS, "\\chbgdkcross" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CHBGDKDCROSS, "\\chbgdkdcross" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CHBGDKFDIAG, "\\chbgdkfdiag" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CHBGDKHORIZ, "\\chbgdkhoriz" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CHBGDKVERT, "\\chbgdkvert" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CHBGFDIAG, "\\chbgfdiag" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CHBGHORIZ, "\\chbghoriz" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CHBGVERT, "\\chbgvert" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CHBRDR, "\\chbrdr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CHCBPAT, "\\chcbpat" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CHCFPAT, "\\chcfpat" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CHSHDNG, "\\chshdng" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLPADL, "\\clpadl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLPADT, "\\clpadt" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLPADB, "\\clpadb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLPADR, "\\clpadr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLPADFL, "\\clpadfl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLPADFT, "\\clpadft" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLPADFB, "\\clpadfb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLPADFR, "\\clpadfr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLTXLRTB, "\\cltxlrtb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLTXTBRL, "\\cltxtbrl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLVERTALB, "\\clvertalb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLVERTALC, "\\clvertalc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLVERTALT, "\\clvertalt" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLVMGF, "\\clvmgf" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLVMRG, "\\clvmrg" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLTXTBRLV, "\\cltxtbrlv" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLTXBTLR, "\\cltxbtlr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CLTXLRTBV, "\\cltxlrtbv" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_COMPANY, "\\company" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CRAUTH, "\\crauth" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_CRDATE, "\\crdate" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DATE, "\\date" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DEFLANGFE, "\\deflangfe" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DFRAUTH, "\\dfrauth" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DFRDATE, "\\dfrdate" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DFRSTART, "\\dfrstart" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DFRSTOP, "\\dfrstop" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DFRXST, "\\dfrxst" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DGMARGIN, "\\dgmargin" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DNTBLNSBDB, "\\dntblnsbdb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DOCTYPE, "\\doctype" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DOCVAR, "\\docvar" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DPCODESCENT, "\\dpcodescent" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_EMBO, "\\embo" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_EMFBLIP, "\\emfblip" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_EXPSHRTN, "\\expshrtn" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FAAUTO, "\\faauto" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FBIAS, "\\fbias" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FFDEFRES, "\\ffdefres" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FFDEFTEXT, "\\ffdeftext" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FFENTRYMCR, "\\ffentrymcr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FFEXITMCR, "\\ffexitmcr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FFFORMAT, "\\ffformat" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FFHASLISTBOX, "\\ffhaslistbox" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FFHELPTEXT, "\\ffhelptext" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FFHPS, "\\ffhps" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FFL, "\\ffl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FFMAXLEN, "\\ffmaxlen" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FFNAME, "\\ffname" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FFOWNHELP, "\\ffownhelp" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FFOWNSTAT, "\\ffownstat" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FFPROT, "\\ffprot" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FFRECALC, "\\ffrecalc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FFRES, "\\ffres" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FFSIZE, "\\ffsize" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FFSTATTEXT, "\\ffstattext" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FFTYPE, "\\fftype" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FFTYPETXT, "\\fftypetxt" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FLDTYPE, "\\fldtype" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FNAME, "\\fname" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FORMFIELD, "\\formfield" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FROMTEXT, "\\fromtext" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FTNNCHOSUNG, "\\ftnnchosung" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FTNNCNUM, "\\ftnncnum" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FTNNDBAR, "\\ftnndbar" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FTNNDBNUM, "\\ftnndbnum" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FTNNDBNUMD, "\\ftnndbnumd" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FTNNDBNUMK, "\\ftnndbnumk" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FTNNDBNUMT, "\\ftnndbnumt" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FTNNGANADA, "\\ftnnganada" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FTNNGBNUM, "\\ftnngbnum" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FTNNGBNUMD, "\\ftnngbnumd" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FTNNGBNUMK, "\\ftnngbnumk" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FTNNGBNUML, "\\ftnngbnuml" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FTNNZODIAC, "\\ftnnzodiac" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FTNNZODIACD, "\\ftnnzodiacd" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FTNNZODIACL, "\\ftnnzodiacl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_G, "\\g" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_GCW, "\\gcw" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_GRIDTBL, "\\gridtbl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_HIGHLIGHT, "\\highlight" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_HLFR, "\\hlfr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_HLINKBASE, "\\hlinkbase" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_HLLOC, "\\hlloc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_HLSRC, "\\hlsrc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ILVL, "\\ilvl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_IMPR, "\\impr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_JPEGBLIP, "\\jpegblip" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LEVELFOLLOW, "\\levelfollow" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LEVELINDENT, "\\levelindent" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LEVELJC, "\\leveljc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LEVELLEGAL, "\\levellegal" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LEVELNFC, "\\levelnfc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LEVELNORESTART, "\\levelnorestart" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LEVELNUMBERS, "\\levelnumbers" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LEVELOLD, "\\levelold" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LEVELPREV, "\\levelprev" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LEVELPREVSPACE, "\\levelprevspace" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LEVELSPACE, "\\levelspace" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LEVELSTARTAT, "\\levelstartat" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LEVELTEXT, "\\leveltext" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LINKVAL, "\\linkval" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LIST, "\\list" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LISTID, "\\listid" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LISTLEVEL, "\\listlevel" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LISTNAME, "\\listname" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LISTOVERRIDE, "\\listoverride" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LISTOVERRIDECOUNT, "\\listoverridecount" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LISTOVERRIDEFORMAT, "\\listoverrideformat" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LISTOVERRIDESTART, "\\listoverridestart" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LISTOVERRIDETABLE, "\\listoverridetable" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LISTRESTARTHDN, "\\listrestarthdn" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LISTSIMPLE, "\\listsimple" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LISTTABLE, "\\listtable" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LISTTEMPLATEID, "\\listtemplateid" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LISTTEXT, "\\listtext" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LS, "\\ls" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LYTEXCTTP, "\\lytexcttp" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LYTPRTMET, "\\lytprtmet" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_MANAGER, "\\manager" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_MSMCAP, "\\msmcap" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_NOFCHARSWS, "\\nofcharsws" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_NOLEAD, "\\nolead" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_NONSHPPICT, "\\nonshppict" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_NOSECTEXPAND, "\\nosectexpand" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_NOSNAPLINEGRID, "\\nosnaplinegrid" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_NOSPACEFORUL, "\\nospaceforul" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_NOULTRLSPC, "\\noultrlspc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_NOXLATTOYEN, "\\noxlattoyen" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OBJATTPH, "\\objattph" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OBJHTML, "\\objhtml" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OBJOCX, "\\objocx" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLDLINEWRAP, "\\oldlinewrap" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OUTLINELEVEL, "\\outlinelevel" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OVERLAY, "\\overlay" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PANOSE, "\\panose" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGBRDRB, "\\pgbrdrb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGBRDRFOOT, "\\pgbrdrfoot" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGBRDRHEAD, "\\pgbrdrhead" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGBRDRL, "\\pgbrdrl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGBRDROPT, "\\pgbrdropt" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGBRDRR, "\\pgbrdrr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGBRDRSNAP, "\\pgbrdrsnap" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGBRDRT, "\\pgbrdrt" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGNCHOSUNG, "\\pgnchosung" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGNCNUM, "\\pgncnum" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGNDBNUMK, "\\pgndbnumk" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGNDBNUMT, "\\pgndbnumt" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGNGANADA, "\\pgnganada" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGNGBNUM, "\\pgngbnum" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGNGBNUMD, "\\pgngbnumd" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGNGBNUMK, "\\pgngbnumk" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGNGBNUML, "\\pgngbnuml" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGNZODIAC, "\\pgnzodiac" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGNZODIACD, "\\pgnzodiacd" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGNZODIACL, "\\pgnzodiacl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PICPROP, "\\picprop" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNAIUEO, "\\pnaiueo" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNAIUEOD, "\\pnaiueod" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNCHOSUNG, "\\pnchosung" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNDBNUMD, "\\pndbnumd" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNDBNUMK, "\\pndbnumk" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNDBNUML, "\\pndbnuml" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNDBNUMT, "\\pndbnumt" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNGANADA, "\\pnganada" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNGBLIP, "\\pngblip" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNGBNUM, "\\pngbnum" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNGBNUMD, "\\pngbnumd" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNGBNUMK, "\\pngbnumk" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNGBNUML, "\\pngbnuml" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNRAUTH, "\\pnrauth" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNRDATE, "\\pnrdate" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNRNFC, "\\pnrnfc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNRNOT, "\\pnrnot" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNRPNBR, "\\pnrpnbr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNRRGB, "\\pnrrgb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNRSTART, "\\pnrstart" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNRSTOP, "\\pnrstop" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNRXST, "\\pnrxst" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNZODIAC, "\\pnzodiac" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNZODIACD, "\\pnzodiacd" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PNZODIACL, "\\pnzodiacl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LFOLEVEL, "\\lfolevel" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_POSYIN, "\\posyin" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_POSYOUT, "\\posyout" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PRIVATE, "\\private" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PROPNAME, "\\propname" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PROPTYPE, "\\proptype" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_REVAUTHDEL, "\\revauthdel" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_REVDTTMDEL, "\\revdttmdel" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SAUTOUPD, "\\sautoupd" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SECTDEFAULTCL, "\\sectdefaultcl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SECTEXPAND, "\\sectexpand" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SECTLINEGRID, "\\sectlinegrid" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SECTSPECIFYCL, "\\sectspecifycl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SECTSPECIFYL, "\\sectspecifyl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHIDDEN, "\\shidden" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHPBOTTOM, "\\shpbottom" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHPBXCOLUMN, "\\shpbxcolumn" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHPBXMARGIN, "\\shpbxmargin" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHPBXPAGE, "\\shpbxpage" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHPBYMARGIN, "\\shpbymargin" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHPBYPAGE, "\\shpbypage" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHPBYPARA, "\\shpbypara" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHPFBLWTXT, "\\shpfblwtxt" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHPFHDR, "\\shpfhdr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHPGRP, "\\shpgrp" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHPLEFT, "\\shpleft" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHPLID, "\\shplid" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHPLOCKANCHOR, "\\shplockanchor" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHPPICT, "\\shppict" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHPRIGHT, "\\shpright" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHPRSLT, "\\shprslt" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHPTOP, "\\shptop" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHPTXT, "\\shptxt" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHPWRK, "\\shpwrk" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHPWR, "\\shpwr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHPZ, "\\shpz" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SPRSBSP, "\\sprsbsp" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SPRSLNSP, "\\sprslnsp" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SPRSTSM, "\\sprstsm" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_STATICVAL, "\\staticval" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_STEXTFLOW, "\\stextflow" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_STRIKED, "\\striked" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SUBFONTBYSIZE, "\\subfontbysize" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TCELLD, "\\tcelld" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TIME, "\\time" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TRUNCATEFONTHEIGHT, "\\truncatefontheight" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_UC, "\\uc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_UD, "\\ud" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ULDASH, "\\uldash" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ULDASHD, "\\uldashd" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ULDASHDD, "\\uldashdd" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ULTH, "\\ulth" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ULWAVE, "\\ulwave" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ULC, "\\ulc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_U, "\\u" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_UPR, "\\upr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_USERPROPS, "\\userprops" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_VIEWKIND, "\\viewkind" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_VIEWSCALE, "\\viewscale" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_VIEWZK, "\\viewzk" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_WIDCTLPAR, "\\widctlpar" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_WINDOWCAPTION, "\\windowcaption" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_WPEQN, "\\wpeqn" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_WPJST, "\\wpjst" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_WPSP, "\\wpsp" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_YXE, "\\yxe" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FRMTXLRTB, "\\frmtxlrtb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FRMTXTBRL, "\\frmtxtbrl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FRMTXBTLR, "\\frmtxbtlr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FRMTXLRTBV, "\\frmtxlrtbv" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FRMTXTBRLV, "\\frmtxtbrlv" );
+
+// MS-2000 Tokens
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ULTHD, "\\ulthd" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ULTHDASH, "\\ulthdash" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ULLDASH, "\\ulldash" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ULTHLDASH, "\\ulthldash" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ULTHDASHD, "\\ulthdashd" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ULTHDASHDD, "\\ulthdashdd" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ULHWAVE, "\\ulhwave" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ULULDBWAVE, "\\ululdbwave" );
+
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LOCH, "\\loch" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_HICH, "\\hich" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DBCH, "\\dbch" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_LANGFE, "\\langfe" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ADEFLANG, "\\adeflang" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ADEFF, "\\adeff" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ACCNONE, "\\accnone" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ACCDOT, "\\accdot" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ACCCOMMA, "\\acccomma" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TWOINONE, "\\twoinone" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_HORZVERT, "\\horzvert" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FAHANG, "\\fahang" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FAVAR, "\\favar" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FACENTER, "\\facenter" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FAROMAN, "\\faroman" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FAFIXED, "\\fafixed" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_NOCWRAP, "\\nocwrap" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_NOOVERFLOW,"\\nooverflow" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_ASPALPHA, "\\aspalpha" );
+
+// SWG spezifische Attribute
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_GRFALIGNV, "\\grfalignv" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_GRFALIGNH, "\\grfalignh" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_GRFMIRROR, "\\grfmirror" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_HEADERYB, "\\headeryb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_HEADERXL, "\\headerxl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_HEADERXR, "\\headerxr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FOOTERYT, "\\footeryt" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FOOTERXL, "\\footerxl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FOOTERXR, "\\footerxr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_HEADERYH, "\\headeryh" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FOOTERYH, "\\footeryh" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BALANCEDCOLUMN, "\\swcolmnblnc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_UPDNPROP, "\\updnprop" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PRTDATA, "\\prtdata" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BKMKKEY, "\\bkmkkey" );
+
+// Attribute fuer die freifliegenden Rahmen
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FLYPRINT, "\\flyprint" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FLYOPAQUE, "\\flyopaque" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FLYPRTCTD, "\\flyprtctd" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FLYMAINCNT, "\\flymaincnt" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FLYVERT, "\\flyvert" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FLYHORZ, "\\flyhorz" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DFRMTXTL, "\\dfrmtxtl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DFRMTXTR, "\\dfrmtxtr" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DFRMTXTU, "\\dfrmtxtu" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_DFRMTXTW, "\\dfrmtxtw" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FLYANCHOR, "\\flyanchor" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FLYCNTNT, "\\flycntnt" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FLYCOLUMN, "\\flycolumn" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FLYPAGE, "\\flypage" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_FLYINPARA, "\\flyinpara" );
+
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDBOX, "\\brdbox" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDLNCOL, "\\brdlncol" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDLNIN, "\\brdlnin" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDLNOUT, "\\brdlnout" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_BRDLNDIST, "\\brdlndist" );
+
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHADOW, "\\shadow" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHDWDIST, "\\shdwdist" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHDWSTYLE, "\\shdwstyle" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHDWCOL, "\\shdwcol" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHDWFCOL, "\\shdwfcol" );
+
+
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGDSCTBL, "\\pgdsctbl" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGDSC, "\\pgdsc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGDSCUSE, "\\pgdscuse" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGDSCNXT, "\\pgdscnxt" );
+
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_HYPHEN, "\\hyphen" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_HYPHLEAD, "\\hyphlead" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_HYPHTRAIL, "\\hyphtrail" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_HYPHMAX, "\\hyphmax" );
+
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_TLSWG, "\\tlswg" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGBRK, "\\pgbrk" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_PGDSCNO, "\\pgdscno" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SOUTLVL, "\\soutlvl" );
+
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHP, "\\shp" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SN, "\\sn" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SV, "\\sv" );
+/*
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHPLEFT, "\\shpleft" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHPTOP, "\\shptop" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHPBOTTOM, "\\shpbottom" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_SHPRIGHT, "\\shpright" );
+*/
+
+// Support for overline attributes
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OL, "\\ol" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLD, "\\old" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLDB, "\\oldb" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLNONE, "\\olnone" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLW, "\\olw" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLDASH, "\\oldash" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLDASHD, "\\oldashd" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLDASHDD, "\\oldashdd" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLTH, "\\olth" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLWAVE, "\\olwave" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLC, "\\olc" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLTHD, "\\olthd" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLTHDASH, "\\olthdash" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLLDASH, "\\olldash" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLTHLDASH, "\\olthldash" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLTHDASHD, "\\olthdashd" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLTHDASHDD, "\\olthdashdd" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLHWAVE, "\\olhwave" );
+sal_Char const SVTOOLS_CONSTASCII_DEF( sRTF_OLOLDBWAVE, "\\ololdbwave" );
+
+/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/svtools/source/svrtf/svparser.cxx b/svtools/source/svrtf/svparser.cxx
index f58a5d11a3c6..c7444dd5cbcb 100644
--- a/svtools/source/svrtf/svparser.cxx
+++ b/svtools/source/svrtf/svparser.cxx
@@ -666,4 +666,64 @@ IMPL_STATIC_LINK( SvParser, NewDataRead, void*, EMPTYARG )
return 0;
}
+/*========================================================================
+ *
+ * SvKeyValueIterator.
+ *
+ *======================================================================*/
+SV_DECL_PTRARR_DEL(SvKeyValueList_Impl, SvKeyValue*, 0, 4)
+SV_IMPL_PTRARR(SvKeyValueList_Impl, SvKeyValue*);
+
+/*
+ * SvKeyValueIterator.
+ */
+SvKeyValueIterator::SvKeyValueIterator (void)
+ : m_pList (new SvKeyValueList_Impl),
+ m_nPos (0)
+{
+}
+
+/*
+ * ~SvKeyValueIterator.
+ */
+SvKeyValueIterator::~SvKeyValueIterator (void)
+{
+ delete m_pList;
+}
+
+/*
+ * GetFirst.
+ */
+BOOL SvKeyValueIterator::GetFirst (SvKeyValue &rKeyVal)
+{
+ m_nPos = m_pList->Count();
+ return GetNext (rKeyVal);
+}
+
+/*
+ * GetNext.
+ */
+BOOL SvKeyValueIterator::GetNext (SvKeyValue &rKeyVal)
+{
+ if (m_nPos > 0)
+ {
+ rKeyVal = *m_pList->GetObject(--m_nPos);
+ return TRUE;
+ }
+ else
+ {
+ // Nothing to do.
+ return FALSE;
+ }
+}
+
+/*
+ * Append.
+ */
+void SvKeyValueIterator::Append (const SvKeyValue &rKeyVal)
+{
+ SvKeyValue *pKeyVal = new SvKeyValue (rKeyVal);
+ m_pList->C40_INSERT(SvKeyValue, pKeyVal, m_pList->Count());
+}
+
/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/svtools/source/undo/makefile.mk b/svtools/source/undo/makefile.mk
index 92a406971de3..b277fa3c906f 100644
--- a/svtools/source/undo/makefile.mk
+++ b/svtools/source/undo/makefile.mk
@@ -33,6 +33,7 @@ PRJ=..$/..
PRJNAME=svtools
TARGET=undo
+ENABLE_EXCEPTIONS=TRUE
# --- Settings -----------------------------------------------------
diff --git a/svtools/source/undo/undo.cxx b/svtools/source/undo/undo.cxx
index 76ed0a0a8e09..2f733d4f03b3 100644
--- a/svtools/source/undo/undo.cxx
+++ b/svtools/source/undo/undo.cxx
@@ -31,11 +31,14 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svtools.hxx"
+#include <com/sun/star/uno/Exception.hpp>
#include <tools/debug.hxx>
#include <svtools/undo.hxx>
+using ::com::sun::star::uno::Exception;
+
// STATIC DATA -----------------------------------------------------------
DBG_NAME(SfxUndoAction)
@@ -153,6 +156,7 @@ BOOL SfxUndoAction::CanRepeat(SfxRepeatTarget&) const
SfxUndoManager::SfxUndoManager( USHORT nMaxUndoActionCount )
: pFatherUndoArray(0)
+ , mbUndoEnabled( true )
{
pUndoArray=new SfxUndoArray(nMaxUndoActionCount);
pActUndoArray=pUndoArray;
@@ -167,6 +171,12 @@ SfxUndoManager::~SfxUndoManager()
delete pUndoArray;
}
+//------------------------------------------------------------------------
+
+void SfxUndoManager::EnableUndo( bool bEnable )
+{
+ mbUndoEnabled = bEnable;
+}
//------------------------------------------------------------------------
@@ -252,41 +262,43 @@ void SfxUndoManager::ClearRedo()
void SfxUndoManager::AddUndoAction( SfxUndoAction *pAction, BOOL bTryMerge )
{
- // Redo-Actions loeschen
- for ( USHORT nPos = pActUndoArray->aUndoActions.Count();
- nPos > pActUndoArray->nCurUndoAction; --nPos )
- delete pActUndoArray->aUndoActions[nPos-1];
-
- pActUndoArray->aUndoActions.Remove(
- pActUndoArray->nCurUndoAction,
- pActUndoArray->aUndoActions.Count() - pActUndoArray->nCurUndoAction );
-
- if ( pActUndoArray->nMaxUndoActions )
+ if( mbUndoEnabled )
{
- SfxUndoAction *pTmpAction = pActUndoArray->nCurUndoAction ?
- pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction-1] : 0;
+ // Redo-Actions loeschen
+ for ( USHORT nPos = pActUndoArray->aUndoActions.Count();
+ nPos > pActUndoArray->nCurUndoAction; --nPos )
+ delete pActUndoArray->aUndoActions[nPos-1];
+
+ pActUndoArray->aUndoActions.Remove(
+ pActUndoArray->nCurUndoAction,
+ pActUndoArray->aUndoActions.Count() - pActUndoArray->nCurUndoAction );
- if ( !bTryMerge || !(pTmpAction && pTmpAction->Merge(pAction)) )
+ if ( pActUndoArray->nMaxUndoActions )
{
- // auf Max-Anzahl anpassen
- if( pActUndoArray == pUndoArray )
- while( pActUndoArray->aUndoActions.Count() >=
- pActUndoArray->nMaxUndoActions &&
- !pActUndoArray->aUndoActions[0]->IsLinked() )
- {
- delete pActUndoArray->aUndoActions[0];
- pActUndoArray->aUndoActions.Remove(0);
- --pActUndoArray->nCurUndoAction;
- }
+ SfxUndoAction *pTmpAction = pActUndoArray->nCurUndoAction ?
+ pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction-1] : 0;
- // neue Action anh"angen
- const SfxUndoAction* pTemp = pAction;
- pActUndoArray->aUndoActions.Insert(
- pTemp, pActUndoArray->nCurUndoAction++ );
- return;
+ if ( !bTryMerge || !(pTmpAction && pTmpAction->Merge(pAction)) )
+ {
+ // auf Max-Anzahl anpassen
+ if( pActUndoArray == pUndoArray )
+ while( pActUndoArray->aUndoActions.Count() >=
+ pActUndoArray->nMaxUndoActions &&
+ !pActUndoArray->aUndoActions[0]->IsLinked() )
+ {
+ delete pActUndoArray->aUndoActions[0];
+ pActUndoArray->aUndoActions.Remove(0);
+ --pActUndoArray->nCurUndoAction;
+ }
+
+ // neue Action anh"angen
+ const SfxUndoAction* pTemp = pAction;
+ pActUndoArray->aUndoActions.Insert(
+ pTemp, pActUndoArray->nCurUndoAction++ );
+ return;
+ }
}
}
-
delete pAction;
}
@@ -368,20 +380,46 @@ void SfxUndoManager::RemoveLastUndoAction()
BOOL SfxUndoManager::Undo( USHORT )
{
- DBG_ASSERT( pActUndoArray == pUndoArray, "svtools::SfxUndoManager::Undo(), LeaveListAction() not yet called!" );
- if ( pActUndoArray->nCurUndoAction )
+ bool bUndoWasEnabled = mbUndoEnabled;
+ mbUndoEnabled = false;
+
+ BOOL bRet = FALSE;
+
+ try
{
- Undo( *pActUndoArray->aUndoActions[ --pActUndoArray->nCurUndoAction ] );
- return TRUE;
+ DBG_ASSERT( pActUndoArray == pUndoArray, "svtools::SfxUndoManager::Undo(), LeaveListAction() not yet called!" );
+ if ( pActUndoArray->nCurUndoAction )
+ {
+ Undo( *pActUndoArray->aUndoActions[ --pActUndoArray->nCurUndoAction ] );
+ bRet = TRUE;
+ }
}
- return FALSE;
+ catch( Exception& e )
+ {
+ mbUndoEnabled = bUndoWasEnabled;
+ throw e;
+ }
+ mbUndoEnabled = bUndoWasEnabled;
+ return bRet;
}
//------------------------------------------------------------------------
void SfxUndoManager::Undo( SfxUndoAction &rAction )
{
- rAction.Undo();
+ bool bUndoWasEnabled = mbUndoEnabled;
+ mbUndoEnabled = false;
+ try
+ {
+ rAction.Undo();
+ }
+ catch( Exception& e )
+ {
+ mbUndoEnabled = bUndoWasEnabled;
+ throw e;
+ }
+
+ mbUndoEnabled = bUndoWasEnabled;
}
//------------------------------------------------------------------------
@@ -409,20 +447,47 @@ USHORT SfxUndoManager::GetRedoActionId( USHORT nNo ) const
BOOL SfxUndoManager::Redo( USHORT )
{
- if ( pActUndoArray->aUndoActions.Count() > pActUndoArray->nCurUndoAction )
+ bool bUndoWasEnabled = mbUndoEnabled;
+ mbUndoEnabled = false;
+
+ BOOL bRet = FALSE;
+
+ try
{
- Redo( *pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction++] );
- return TRUE;
+ if ( pActUndoArray->aUndoActions.Count() > pActUndoArray->nCurUndoAction )
+ {
+ Redo( *pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction++] );
+ bRet = TRUE;
+ }
+ }
+ catch( Exception& e )
+ {
+ mbUndoEnabled = bUndoWasEnabled;
+ throw e;
}
- return FALSE;
+ mbUndoEnabled = bUndoWasEnabled;
+ return bRet;
}
//------------------------------------------------------------------------
void SfxUndoManager::Redo( SfxUndoAction &rAction )
{
- rAction.Redo();
+ bool bUndoWasEnabled = mbUndoEnabled;
+ mbUndoEnabled = false;
+
+ try
+ {
+ rAction.Redo();
+ }
+ catch( Exception& e )
+ {
+ mbUndoEnabled = bUndoWasEnabled;
+ throw e;
+ }
+
+ mbUndoEnabled = bUndoWasEnabled;
}
//------------------------------------------------------------------------
@@ -492,6 +557,9 @@ void SfxUndoManager::EnterListAction(
*/
{
+ if( !mbUndoEnabled )
+ return;
+
if ( !pUndoArray->nMaxUndoActions )
return;
@@ -511,6 +579,9 @@ void SfxUndoManager::LeaveListAction()
Verlaesst die aktuelle ListAction und geht eine Ebene nach oben.
*/
{
+ if ( !mbUndoEnabled )
+ return;
+
if ( !pUndoArray->nMaxUndoActions )
return;
@@ -745,3 +816,4 @@ USHORT SfxLinkUndoAction::GetId() const
}
+
diff --git a/svtools/source/uno/unoevent.cxx b/svtools/source/uno/unoevent.cxx
index 14321ecdd84c..19d40c17ce5c 100644
--- a/svtools/source/uno/unoevent.cxx
+++ b/svtools/source/uno/unoevent.cxx
@@ -492,7 +492,7 @@ SvDetachedEventDescriptor::~SvDetachedEventDescriptor()
delete aMacros[i];
}
- delete aMacros;
+ delete [] aMacros;
}
sal_Int16 SvDetachedEventDescriptor::getIndex(const sal_uInt16 nID) const
diff --git a/toolkit/inc/toolkit/controls/unocontrol.hxx b/toolkit/inc/toolkit/controls/unocontrol.hxx
index 690b34e5e8e0..d7a6d749902b 100644
--- a/toolkit/inc/toolkit/controls/unocontrol.hxx
+++ b/toolkit/inc/toolkit/controls/unocontrol.hxx
@@ -124,7 +124,7 @@ protected:
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > getParentPeer() const;
void updateFromModel();
void peerCreated();
- bool ImplMapPlaceHolder( ::rtl::OUString& rPlaceHolder );
+ bool ImplCheckLocalize( ::rtl::OUString& _rPossiblyLocalizable );
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > ImplGetCompatiblePeer( sal_Bool bAcceptExistingPeer );
virtual void ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal );
virtual void PrepareWindowDescriptor( ::com::sun::star::awt::WindowDescriptor& rDesc );
diff --git a/toolkit/source/controls/formattedcontrol.cxx b/toolkit/source/controls/formattedcontrol.cxx
index c80c3b14e63e..19fb4c3609d0 100644
--- a/toolkit/source/controls/formattedcontrol.cxx
+++ b/toolkit/source/controls/formattedcontrol.cxx
@@ -323,8 +323,11 @@ namespace toolkit
++pPropertyNames
)
{
- bSettingValue = ( BASEPROPERTY_EFFECTIVE_VALUE == GetPropertyId( *pPropertyNames ) );
- bSettingText = ( BASEPROPERTY_TEXT == GetPropertyId( *pPropertyNames ) );
+ if ( BASEPROPERTY_EFFECTIVE_VALUE == GetPropertyId( *pPropertyNames ) )
+ bSettingValue = true;
+
+ if ( BASEPROPERTY_TEXT == GetPropertyId( *pPropertyNames ) )
+ bSettingText = true;
}
m_bSettingValueAndText = ( bSettingValue && bSettingText );
diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx
index 4c84c398a3ce..92c27e33ead0 100644
--- a/toolkit/source/controls/unocontrol.cxx
+++ b/toolkit/source/controls/unocontrol.cxx
@@ -51,6 +51,7 @@
#include <tools/time.hxx>
#include <tools/urlobj.hxx>
#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
#include <vcl/svapp.hxx>
#include <vcl/wrkwin.hxx>
#include <comphelper/stl_types.hxx>
@@ -132,7 +133,6 @@ public:
inline VclListenerLock( VCLXWindow* _pLockWindow )
:m_pLockWindow( _pLockWindow )
{
-// DBG_ASSERT( m_pLockWindow, "VclListenerLock::VclListenerLock: invalid window!" );
if ( m_pLockWindow )
m_pLockWindow->suspendVclEventListening( );
}
@@ -143,7 +143,7 @@ public:
}
private:
- VclListenerLock(); // never implemented
+ VclListenerLock(); // never implemented
VclListenerLock( const VclListenerLock& ); // never implemented
VclListenerLock& operator=( const VclListenerLock& ); // never implemented
};
@@ -152,6 +152,14 @@ typedef ::std::map< ::rtl::OUString, sal_Int32 > MapString2Int;
struct UnoControl_Data
{
MapString2Int aSuspendedPropertyNotifications;
+ /// true if and only if our model has a property ResourceResolver
+ bool bLocalizationSupport;
+
+ UnoControl_Data()
+ :aSuspendedPropertyNotifications()
+ ,bLocalizationSupport( false )
+ {
+ }
};
// ----------------------------------------------------
@@ -246,33 +254,34 @@ Reference< XWindowPeer > UnoControl::ImplGetCompatiblePeer( sal_Bool bAcceptE
return xCompatiblePeer;
}
-bool UnoControl::ImplMapPlaceHolder( ::rtl::OUString& rPlaceHolder )
+bool UnoControl::ImplCheckLocalize( ::rtl::OUString& _rPossiblyLocalizable )
{
- rtl::OUString aMappedValue;
+ if ( !mpData->bLocalizationSupport
+ || ( _rPossiblyLocalizable.getLength() == 0 )
+ || ( _rPossiblyLocalizable[0] != '&' )
+ // TODO: make this reasonable. At the moment, everything which by accident starts with a & is considered
+ // localizable, which is probably wrong.
+ )
+ return false;
- Reference< XPropertySet > xPropSet( mxModel, UNO_QUERY );
- if ( xPropSet.is() )
+ try
{
- Any a;
- Reference< resource::XStringResourceResolver > xStringResourceResolver;
- a = xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" )));
- if ( a >>= xStringResourceResolver )
+ Reference< XPropertySet > xPropSet( mxModel, UNO_QUERY_THROW );
+ Reference< resource::XStringResourceResolver > xStringResourceResolver(
+ xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) ),
+ UNO_QUERY
+ );
+ if ( xStringResourceResolver.is() )
{
- if ( xStringResourceResolver.is() )
- {
- try
- {
- rPlaceHolder = xStringResourceResolver->resolveString( rPlaceHolder );
- return true;
- }
- catch ( resource::MissingResourceException& )
- {
- return false;
- }
- }
+ ::rtl::OUString aLocalizationKey( _rPossiblyLocalizable.copy( 1 ) );
+ _rPossiblyLocalizable = xStringResourceResolver->resolveString( aLocalizationKey );
+ return true;
}
}
-
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
return false;
}
@@ -285,56 +294,36 @@ void UnoControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const An
if ( mxVclWindowPeer.is() )
{
- Any aVal( rVal );
-
- // We now support a mapping for language dependent properties. This is the
- // central method to implement it.
- if (( rPropName.equalsAsciiL( "Text", 4 )) ||
- ( rPropName.equalsAsciiL( "Label", 5 )) ||
- ( rPropName.equalsAsciiL( "Title", 5 )) ||
- ( rPropName.equalsAsciiL( "HelpText", 8 )) ||
- ( rPropName.equalsAsciiL( "CurrencySymbol", 14 )) ||
- ( rPropName.equalsAsciiL( "StringItemList", 14 )) )
- {
- rtl::OUString aValue;
- uno::Sequence< rtl::OUString > aSeqValue;
+ Any aConvertedValue( rVal );
- if ( aVal >>= aValue )
+ if ( mpData->bLocalizationSupport )
+ {
+ // We now support a mapping for language dependent properties. This is the
+ // central method to implement it.
+ if (( rPropName.equalsAsciiL( "Text", 4 )) ||
+ ( rPropName.equalsAsciiL( "Label", 5 )) ||
+ ( rPropName.equalsAsciiL( "Title", 5 )) ||
+ ( rPropName.equalsAsciiL( "HelpText", 8 )) ||
+ ( rPropName.equalsAsciiL( "CurrencySymbol", 14 )) ||
+ ( rPropName.equalsAsciiL( "StringItemList", 14 )) )
{
- // Map single string value
- if (( aValue.getLength() > 0 ) &&
- ( aValue.compareToAscii( "&", 1 ) == 0 ))
+ ::rtl::OUString aValue;
+ uno::Sequence< rtl::OUString > aSeqValue;
+ if ( aConvertedValue >>= aValue )
{
- // Magic symbol '&' found at first place. Interpret as a place
- // holder identifier. Now try to map it to the real value. The
- // magic symbol must be removed.
- rtl::OUString aKeyValue( aValue.copy( 1 ));
- if ( ImplMapPlaceHolder( aKeyValue ))
- aVal <<= aKeyValue;
+ if ( ImplCheckLocalize( aValue ) )
+ aConvertedValue <<= aValue;
}
- }
- else if ( aVal >>= aSeqValue )
- {
- // Map sequence strings
- for ( sal_Int32 i = 0; i < aSeqValue.getLength(); i++ )
+ else if ( aConvertedValue >>= aSeqValue )
{
- aValue = aSeqValue[i];
- if (( aValue.getLength() > 0 ) &&
- ( aValue.compareToAscii( "&", 1 ) == 0 ))
- {
- // Magic symbol '&' found at first place. Interpret as a place
- // holder identifier. Now try to map it to the real value. The
- // magic symbol must be removed.
- rtl::OUString aKeyValue( aValue.copy( 1 ));
- if ( ImplMapPlaceHolder( aKeyValue ))
- aSeqValue[i] = aKeyValue;
- }
+ for ( sal_Int32 i = 0; i < aSeqValue.getLength(); i++ )
+ ImplCheckLocalize( aSeqValue[i] );
+ aConvertedValue <<= aSeqValue;
}
- aVal <<= aSeqValue;
}
}
- mxVclWindowPeer->setProperty( rPropName, aVal );
+ mxVclWindowPeer->setProperty( rPropName, aConvertedValue );
}
}
@@ -1383,16 +1372,28 @@ sal_Bool UnoControl::setModel( const Reference< XControlModel >& rxModel ) throw
if( xPropSet.is() )
xPropSet->removePropertiesChangeListener( xListener );
+ mpData->bLocalizationSupport = false;
mxModel = rxModel;
+
if( mxModel.is() )
{
- xPropSet = Reference< XMultiPropertySet > ( mxModel, UNO_QUERY );
- if( xPropSet.is() )
+ try
{
+ xPropSet.set( mxModel, UNO_QUERY_THROW );
+ Reference< XPropertySetInfo > xPSI( xPropSet->getPropertySetInfo(), UNO_SET_THROW );
+
Sequence< ::rtl::OUString> aNames = lcl_ImplGetPropertyNames( xPropSet );
xPropSet->addPropertiesChangeListener( aNames, xListener );
+
+ mpData->bLocalizationSupport = xPSI->hasPropertyByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ mxModel.clear();
}
}
+
return mxModel.is();
}
diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx
index 53b28cb7f2ac..771a69c532b9 100644
--- a/toolkit/source/controls/unocontrols.cxx
+++ b/toolkit/source/controls/unocontrols.cxx
@@ -230,17 +230,7 @@ void UnoEditControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, cons
{
::rtl::OUString sText;
rVal >>= sText;
- if (( sText.getLength() > 0 ) &&
- ( sText.compareToAscii( "&", 1 ) == 0 ))
- {
- // Magic symbol '&' found at first place. Interpret as a place
- // holder identifier. Now try to map it to the real value. The
- // magic symbol must be removed.
- rtl::OUString aKeyValue( sText.copy( 1 ));
- if ( UnoControl::ImplMapPlaceHolder( aKeyValue ))
- sText = aKeyValue;
- }
-
+ ImplCheckLocalize( sText );
xTextComponent->setText( sText );
bDone = sal_True;
}
@@ -3532,16 +3522,7 @@ void UnoPatternFieldControl::ImplSetPeerProperty( const ::rtl::OUString& rPropNa
{
// same comment as in UnoControl::ImplSetPeerProperty - see there
::rtl::OUString sText( Text );
- if (( Text.getLength() > 0 ) &&
- ( Text.compareToAscii( "&", 1 ) == 0 ))
- {
- // Magic symbol '&' found at first place. Interpret as a place
- // holder identifier. Now try to map it to the real value. The
- // magic symbol must be removed.
- rtl::OUString aKeyValue( Text.copy( 1 ));
- if ( UnoControl::ImplMapPlaceHolder( aKeyValue ))
- sText = aKeyValue;
- }
+ ImplCheckLocalize( sText );
xPF->setString( sText );
xPF->setMasks( EditMask, LiteralMask );
}
diff --git a/tools/bootstrp/makefile.mk b/tools/bootstrp/makefile.mk
index d0adff1278e4..60bfc57bf96b 100644
--- a/tools/bootstrp/makefile.mk
+++ b/tools/bootstrp/makefile.mk
@@ -81,18 +81,20 @@ LIB2OBJFILES=\
APP1TARGET= sspretty
APP1OBJS= $(OBJ)$/sspretty.obj
APP1LIBS= $(LB)$/$(TARGET).lib $(LB)$/$(TARGET1).lib
-APP1STDLIBS=$(SALLIB) $(VOSLIB) $(TOOLSLIB)
+APP1STDLIBS=$(SALLIB) $(VOSLIB) $(TOOLSLIB) $(BASEGFXLIB) $(UCBHELPERLIB) $(CPPULIB) $(COMPHELPERLIB) $(CPPUHELPERLIB) $(SALHELPERLIB) $(I18NISOLANGLIB)
APP2TARGET= rscdep
APP2OBJS= $(OBJ)$/rscdep.obj
APP2LIBS= $(LB)$/$(TARGET).lib $(LB)$/$(TARGET1).lib
-APP2STDLIBS= $(SALLIB) $(VOSLIB) $(TOOLSLIB)
+APP2STDLIBS= $(SALLIB) $(VOSLIB) $(TOOLSLIB) $(BASEGFXLIB) $(UCBHELPERLIB) $(CPPULIB) $(COMPHELPERLIB) $(I18NISOLANGLIB) $(CPPUHELPERLIB) $(SALHELPERLIB)
+APP2RPATH= NONE
+APP2RPATH= NONE
APP2RPATH= NONE
APP3TARGET= so_checksum
APP3OBJS= $(OBJ)$/md5.obj \
$(OBJ)$/so_checksum.obj
-APP3STDLIBS= $(TOOLSLIB) $(SALLIB)
+APP3STDLIBS= $(TOOLSLIB) $(SALLIB) $(VOSLIB) $(BASEGFXLIB) $(UCBHELPERLIB) $(CPPULIB) $(COMPHELPERLIB) $(I18NISOLANGLIB) $(CPPUHELPERLIB) $(SALHELPERLIB)
DEPOBJFILES = $(APP1OBJS) $(APP2OBJS) $(APP3OBJS)
diff --git a/transex3/inc/export.hxx b/transex3/inc/export.hxx
index 89c1cf548947..3d7eee8e1eaf 100644
--- a/transex3/inc/export.hxx
+++ b/transex3/inc/export.hxx
@@ -510,7 +510,9 @@ private:
SvFileStream aErrLog;
ByteStringSet aLanguageSet;
MergeDataHashMap aMap;
- std::vector<ByteString> aLanguages;
+ ByteStringHashMap aLanguageMap;
+ std::vector<ByteString> aLanguageList;
+ ByteStringHashMap aFilenames;
public:
diff --git a/transex3/prj/d.lst b/transex3/prj/d.lst
index 7bd8e7d3e72d..54d1ab156205 100644
--- a/transex3/prj/d.lst
+++ b/transex3/prj/d.lst
@@ -28,6 +28,7 @@ mkdir: %_DEST%\inc%_EXT%\transex3
..\scripts\localize.pl %_DEST%\bin%_EXT%\localize.pl
..\scripts\localize %_DEST%\bin%_EXT%\localize
+..\scripts\fast_merge.pl %_DEST%\bin%_EXT%\fast_merge.pl
..\inc\export.hxx %_DEST%\inc%_EXT%\transex3\export.hxx
..\inc\transex3\directory.hxx %_DEST%\inc%_EXT%\transex3\directory.hxx
diff --git a/transex3/scripts/fast_merge.pl b/transex3/scripts/fast_merge.pl
new file mode 100644
index 000000000000..266c1c0801e8
--- /dev/null
+++ b/transex3/scripts/fast_merge.pl
@@ -0,0 +1,348 @@
+:
+eval 'exec perl -wS $0 ${1+"$@"}'
+ if 0;
+#*************************************************************************
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# $RCSfile: fast_merge.pl,v $
+#
+# $Revision: 1.1.2.2 $
+#
+# last change: $Author: ihi $ $Date: 2007/07/20 10:37:53 $
+#
+# The Contents of this file are made available subject to
+# the terms of GNU Lesser General Public License Version 2.1.
+#
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2005 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
+#
+#*************************************************************************
+
+use strict;
+use Class::Struct;
+use Getopt::Long;
+use File::Temp;
+use File::Path;
+
+my @files;
+my @file_names;
+my $module_name = '';
+my @current;
+my @buffer;
+my $last_file;
+my $last_path;
+my $last_localize_file;
+my $first_run = "1";
+my $sdf_filename;
+my $merge_dir;
+my $WIN;
+my $state = "none";
+
+if ( defined $ENV{USE_SHELL} && $ENV{USE_SHELL} eq '4nt' ) { $WIN = 'TRUE'; }
+else { $WIN = ''; }
+
+$SIG{INT} = 'inthandler';
+$SIG{QUIT} = 'quithandler';
+
+struct ( sdf_obj =>
+{
+ module => '$',
+ file => '$',
+ dir => '$',
+ FILEHANDLE => '$',
+ line => '$',
+ endoffile => '$'
+}
+);
+
+parse_options();
+my $lock_file = $merge_dir."/lock.mk";
+$lock_file =~ s/\//\\/g , if ( $WIN ) ;
+acquire_lock();
+read_sdf_file_names();
+init();
+my $reference;
+my $path ;
+my $localize_file;
+while( hasLines() )
+{
+ @current = ();
+ foreach ( @files )
+ {
+ push @current , $_;
+ }
+
+ $reference = getNextIdentifier( );
+
+ @current = ();
+ foreach ( @files )
+ {
+ if( $_->module eq $reference->module && $_->dir eq $reference->dir )
+ {
+ push @current , $_ ;
+ }
+ }
+ write_lines();
+}
+if( $#current+1 ne 0 )
+{
+ ( $path , $localize_file ) = make_paths();
+ add_to_buffer();
+ write_buffer( $path , $localize_file );
+}
+release_lock();
+exit( 0 );
+
+##########################################################################################
+sub acquire_lock
+{
+ if( -e $lock_file ){
+ $state = "blocked";
+ print "WARNING: Lock file '$lock_file' 'found, waiting ....\n";
+ my $cnt = 0;
+ sleep 10 , while( -e $lock_file && $cnt++ < 180 );
+ exit( 0 );
+ }else
+ {
+ $state = "locked";
+ print "Writing lock file '$lock_file'\n";
+ open FILE, ">$lock_file" or die "Can't create lock file '$lock_file'";
+ print FILE "L10N_LOCK=YES" ;
+ close ( FILE );
+ }
+}
+sub release_lock
+{
+ print "Deleting lock file '$lock_file'\n";
+ unlink $lock_file, if( -e $lock_file );
+ $state = "none";
+}
+sub inthandler
+{
+ release_lock() , if( $state eq "locked" );
+ exit( -1 );
+}
+sub quithandler
+{
+ release_lock() , if( $state eq "locked" );
+ exit( 0 );
+}
+
+sub init
+{
+ foreach my $file ( @file_names )
+ {
+ my $obj = new sdf_obj;
+ open my $FILEHANDLE , "<$file" or die "Can't open file '$file'";
+ $obj->FILEHANDLE ( $FILEHANDLE ) ;
+ getNextSdfObj( $obj );
+ push @files, $obj ;
+ print "Open file '$file'\n";
+ }
+}
+
+# get the next module/file
+sub getNextIdentifier
+{
+ my @sorted = sort {
+ return $a->module.$a->dir cmp $b->module.$b->dir;
+ } @current ;
+ return shift @sorted;
+}
+
+# update the obj with the next line
+sub getNextSdfObj
+{
+ my $obj = shift;
+ my $line = readline ( $obj->FILEHANDLE );
+ if ( $line eq undef )
+ {
+ $obj->endoffile( "true" );
+ }
+ else
+ {
+ $line =~ /^(([^\t]*)\t([^\t]*).*)/o ;
+ if( defined $1 && defined $2 && defined $3 )
+ {
+ $obj->line ( $1 );
+ $obj->module( $2 );
+ $obj->file ( $3 );
+ $obj->dir ( getDir( $3 ) );
+ }
+ else
+ {
+ $obj->line ( "" );
+ $obj->module( "" );
+ $obj->file ( "" );
+ $obj->dir ( "" );
+ }
+ }
+ return $obj;
+}
+sub getNextSdfObjModule
+{
+ my $obj = shift;
+ while( !$obj->endoffile )
+ {
+ my $line = readline ( $obj->FILEHANDLE );
+ if ( $line eq undef )
+ {
+ $obj->endoffile( "true" );
+ }
+ else
+ {
+ $line =~ /^(([^\t]*)\t([^\t]*).*)/o ;
+ if( defined $1 && defined $2 && defined $3 )
+ {
+ $obj->line ( $1 );
+ $obj->module( $2 );
+ $obj->file ( $3 );
+ $obj->dir ( getDir( $3 ) );
+ }
+ else
+ {
+ $obj->line ( "" );
+ $obj->module( "" );
+ $obj->file ( "" );
+ $obj->dir ( "" );
+ }
+ return $obj , if( $obj->module eq $module_name )
+ }
+ }
+ #return $obj;
+}
+sub getDir
+{
+ my $path = shift ;
+ $path =~ s/\//\\/g;
+ my @tmp_path = split /\\/ , $path;
+ pop @tmp_path;
+ $path = join '\\' , @tmp_path;
+ return $path;
+}
+
+sub hasLines
+{
+ my $hasLines = "";
+ my @tmpfiles;
+ foreach ( @files )
+ {
+ push @tmpfiles , $_, if( !$_->endoffile );
+ }
+ @files = @tmpfiles;
+ return $#files+1;
+}
+
+sub make_paths
+{
+ my $localizeFile = $merge_dir."\\".$current[ 0 ]->module."\\".$current[ 0 ]->file;
+ my $path = getDir( $localizeFile );
+ if ( !$WIN ) { $path =~ s/\\/\//g; }
+
+ $localizeFile = $path."\\localize.sdf";
+ if ( !$WIN ) { $localizeFile =~ s/\\/\//g; }
+
+ return ( $path , $localizeFile );
+}
+sub write_lines
+{
+ if( $first_run ){
+ add_to_buffer();
+ my( $path , $localize_file ) = make_paths();
+ $last_path = $path;
+ $last_localize_file = $localize_file;
+ mkpath $path;
+ write_buffer( $path , $localize_file );
+ $first_run = '';
+ }
+ else
+ {
+ return , if ( $#current+1 eq 0 );
+ my( $path , $localize_file ) = make_paths();
+ if( $path eq $last_path )
+ {
+ add_to_buffer();
+ }
+ else
+ {
+ mkpath $path;
+ write_buffer( $last_path , $last_localize_file );
+ add_to_buffer();
+ $last_path = $path;
+ $last_localize_file = $localize_file;
+ }
+ }
+}
+sub add_to_buffer
+{
+ my $plainline;
+ my $afile;
+ my $amodule;
+ foreach my $elem ( @current )
+ {
+ do {
+ $amodule=$elem->module;
+ $afile=$elem->file;
+ $plainline=$elem->line;
+ push @buffer, $plainline;
+ getNextSdfObj( $elem );
+ } while ( !$elem->endoffile && $amodule eq $elem->module && $afile eq $elem->file );
+ }
+}
+sub write_buffer
+{
+ my $path = shift;
+ my $localize_file = shift;
+ my $cnt = $#buffer+1;
+ print "Write to $path $cnt lines\n";
+ open FILE , ">>$localize_file" or die "Can't open file '$localize_file'\n";
+ foreach ( @buffer )
+ {
+ print FILE $_."\n";
+ }
+ @buffer = ();
+}
+sub parse_options
+{
+ my $success = GetOptions( 'sdf_files=s' => \$sdf_filename , 'merge_dir=s' => \$merge_dir ); #, 'module=s' => \$module_name );
+ if( ! ( $sdf_filename && $merge_dir && $success ) )
+ {
+ usage();
+ exit( -1 );
+ }
+}
+
+sub usage
+{
+ print "Usage: fast_merge -sdf_files <file containing sdf file names> -merge_dir <directory>\n" ;
+}
+
+sub read_sdf_file_names
+{
+ open FILE , "<$sdf_filename" or die "Can't open file '$sdf_filename'\n";
+ while ( <FILE> )
+ {
+ push @file_names , split " " , $_ ;
+ }
+ close ( FILE );
+}
+
+
diff --git a/transex3/scripts/localize.pl b/transex3/scripts/localize.pl
index b9e478ba66bd..8d09b567b77b 100755
--- a/transex3/scripts/localize.pl
+++ b/transex3/scripts/localize.pl
@@ -13,7 +13,7 @@ eval 'exec perl -wS $0 ${1+"$@"}'
#
# $RCSfile: localize.pl,v $
#
-# $Revision: 1.18 $
+# $Revision: 1.18.6.2 $
#
# This file is part of OpenOffice.org.
#
@@ -39,10 +39,12 @@ use Getopt::Long;
use IO::Handle;
use File::Find;
use File::Temp;
+use File::Path;
use File::Copy;
use File::Glob qw(:glob csh_glob);
use Cwd;
+my $CVS_BINARY = "/usr/bin/cvs";
# ver 1.1
#
#### module lookup
@@ -61,16 +63,24 @@ BEGIN {
use lib (@lib_dirs);
#### globals ####
-my $sdffile = '';
-my $no_sort = '';
-my $outputfile = '';
-my $mode = '';
-my $bVerbose="0";
-my $srcpath = '';
+my $sdffile = '';
+my $no_sort = '';
+my $create_dirs = '';
+my $multi_localize_files = '';
+my $module_to_merge = '';
+my $sort_sdf_before = '';
+my $outputfile = '';
+my $no_gsicheck = '';
+my $mode = '';
+my $bVerbose = "0";
+my $srcpath = '';
my $WIN;
my $languages;
#my %sl_modules; # Contains all modules where en-US and de is source language
my $use_default_date = '0';
+my %is_ooo_module;
+my %is_so_module;
+my $DELIMITER;
# ( leftpart ) ( rightpart )
# prj file dummy type gid lid helpid pform width lang text helptext qhelptext title timestamp
@@ -82,21 +92,28 @@ my @sdfparticles;
#### main ####
parse_options();
+check_modules_scm();
if ( defined $ENV{USE_SHELL} && $ENV{USE_SHELL} eq '4nt' ) {
$WIN = 'TRUE';
+ $DELIMITER = "\\";
}
else {
$WIN = '';
+ $DELIMITER = "/";
}
#%sl_modules = fetch_sourcelanguage_dirlist();
if ( $mode eq "merge" ) {
- merge_gsicheck();
+ if ( ! $no_gsicheck ){
+ merge_gsicheck();
+ }
splitfile( $sdffile );
- unlink $sdffile; # remove temp file!
+ if ( ! $no_gsicheck ){
+ unlink $sdffile; # remove temp file!
+ }
}
elsif( $mode eq "extract" ) {
collectfiles( $outputfile );
@@ -126,6 +143,12 @@ sub splitfile{
open MYFILE , "< $sdffile"
or die "Can't open '$sdffile'\n";
+# my %lang_hash;
+ my %string_hash_ooo;
+ my %string_hash_so;
+ my %so_modules;
+ $so_modules{ "extras_full" } = "TRUE";
+
while( <MYFILE>){
if( /$sdf_regex/ ){
my $line = defined $_ ? $_ : '';
@@ -137,183 +160,187 @@ sub splitfile{
my $lang = defined $12 ? $12 : '';
my $plattform = defined $10 ? $10 : '';
my $helpid = defined $9 ? $9 : '';
-
next if( $prj eq "binfilter" ); # Don't merge strings into binfilter module
chomp( $line );
- $currentFile = $srcpath . '\\' . $prj . '\\' . $file;
- if ( $WIN ) { $currentFile =~ s/\//\\/g; }
- else { $currentFile =~ s/\\/\//g; }
-
- $cur_sdffile = $currentFile;
- #if( $cur_sdffile =~ /\.$file_types[\s]*$/ ){
- if( $WIN ) { $cur_sdffile =~ s/\\[^\\]*\.$file_types[\s]*$/\\localize.sdf/; }
- else { $cur_sdffile =~ s/\/[^\/]*\.$file_types[\s]*$/\/localize.sdf/; }
- #}
-
- # Set default date
- if( $line =~ /(.*)\t[^\t\$]*$/ ){
- $line = $1."\t".$default_date;
- }
-
- if( $start ){
- $start='';
- $lastFile = $currentFile; # ?
- $last_sdffile = $cur_sdffile;
- }
- if( $lang eq "en-US" ){}
- elsif( $cur_sdffile eq $last_sdffile )
+ if( is_openoffice_module( $prj ) )
{
- $block{ "$prj\t$file\t$type\t$gid\t$lid\t$helpid\t$plattform\t$lang" } = $line ;
+ $string_hash_ooo { $lang }{ "$prj\t$file\t$type\t$gid\t$lid\t$helpid\t$plattform\t$lang" } = $line;
}
else
{
- writesdf( $lastFile , \%block );
- $lastFile = $currentFile; #?
- $last_sdffile = $cur_sdffile;
- %block = ();
- #if( ! $lang eq "en-US" ) {
- $block{ "$prj\t$file\t$type\t$gid\t$lid\t$helpid\t$plattform\t$lang" } = $line ;
- #}
-
+ $string_hash_so{ $lang }{ "$prj\t$file\t$type\t$gid\t$lid\t$helpid\t$plattform\t$lang" } = $line;
}
- } #else { print STDOUT "splitfile REGEX kaputt\n";}
-
+ }
}
- writesdf( $lastFile , \%block );
- %block = ();
close( MYFILE );
+ if( !defined $ENV{SRC_ROOT} ){
+ print "Error, no SRC_ROOT in env found.\n";
+ exit( -1 );
+ }
+ my $src_root = $ENV{SRC_ROOT};
+ #print $WIN eq "TRUE" ? $src_root."\\l10n_so\n" : $src_root."/l10n_so\n";
+ my $so_l10n_path = $WIN eq "TRUE" ? $src_root."\\l10n_so\\source" : $src_root."/l10n_so/source";
+ my $ooo_l10n_path = $WIN eq "TRUE" ? $src_root."\\l10n\\source" : $src_root."/l10n/source";
+
+ #print "$so_l10n_path\n";
+ #print "$ooo_l10n_path\n";
+
+ write_sdf( \%string_hash_so , $so_l10n_path );
+ write_sdf( \%string_hash_ooo , $ooo_l10n_path );
+
+}
+sub check_modules_scm
+{
+ #my @ooo_modules;
+ #my @so_modules;
+ my $src_path = $ENV{ SRC_ROOT } ;
+ my $last_dir = getcwd();
+ chdir $src_path ;
+ my @modules = <*/.svn/entries>;
+
+ foreach my $module ( @modules )
+ {
+ #print "$module \n";
+ if( open ( FILE , "<$module" ) )
+ {
+ while( <FILE> )
+ {
+
+ my @path = split ( "/" , $module ) ;
+
+ if( /svn.services.openoffice.org/ )
+ {
+ my $mod = $path[ 0 ];
+ #push @ooo_modules , $mod;
+ $is_ooo_module{ $mod } = "true";
+ # print "$module -> ooo ";
+ }
+ elsif ( /jumbo2.germany.sun.com/ )
+ {
+ my $mod = $path[ 0 ];
+ #push @so_modules , $mod;
+ # print "$module -> so ";
+ #$so_lookup_hash{ $mod } = "true";
+ }
+ #else
+ #{
+ # print "ERROR: Is $module a SO or OOo module? Can not parese the $module/.svn/entries file ... please check mwsfinnish/merge/splitsdf.pl line 280\n";
+ # exit -1;
+ #}
+ }
+ }
+ }
+ chdir $last_dir ;
+ #print "OOO\n";
+ #print @ooo_modules;
+ #print "\nSO\n";
+ #print @so_modules;
}
-#########################################################
-#sub fetch_sourcelanguage_dirlist
+
+#sub parse
#{
-#
-# my $working_path = getcwd();
-# my %sl_dirlist;
-#
-# chdir $srcpath;
-# my @all_dirs = csh_glob( "*" );
-#
-# foreach my $file ( @all_dirs )
-# {
-# if( -d $file )
-# {
-# my $module = $file;
-# $file .= "/prj/l10n";
-# $file =~ s/\//\\/ , if( $WIN ) ;
-#
-# if( -f $file ) # Test file <module>/prj/l10n
-# {
-# $sl_dirlist{ $module } = 1;
-# if( $bVerbose eq "1" ) { print STDOUT "$module: de and en-US source language detected\n"; }
-# }
-# }
+# my $command = "$CVS_BINARY -d:pserver:anoncvs\@anoncvs.services.openoffice.org:/cvs co -c";
+# my $output = `$command`;
+# my $rc = $? << 8;
+# if ( $output eq "" || $rc < 0 ){
+# print STDERR "ERROR: Can not fetch cvs alias list, please login to the cvs server and press at the password prompt just return\ncvs -d:pserver:anoncvs\@anoncvs.services.openoffice.org:/cvs login\n";
+# exit ( -1 );
# }
+# my @list = split /\n/ , $output ;
+# foreach my $string( @list )
+# {
#
-# chdir $working_path;
+# # print "Found '$1'\n" , if( $string =~ /^(\w*)/ && $1 ne "" );
#
-# return %sl_dirlist;
+# $is_ooo_module{ $1 } = "TRUE", if( $string =~ /^(\w*)/ && $1 ne "" );
+# }
+# # foreach my $key( keys( %is_ooo_module ) )
+# #{
+# # print "$key\n";
+# #}
#}
+sub is_openoffice_module
+{
+ my $module = shift;
+ return "TRUE", if defined $is_ooo_module{ $module };
+ return "";
+}
-#sub has_two_sourcelanguages
-#{
-# my $module = shift;
-# return defined $sl_modules{ $module } ;
-#}
-sub writesdf{
-
- my $lastFile = shift;
- my $blockhash_ref = shift;
- my $localizeFile = $lastFile;
- my %index=();
-
- if( $localizeFile =~ /\.$file_types[\s]*$/ ){
- if( $WIN ) { $localizeFile =~ s/\\[^\\]*\.$file_types[\s]*$/\\localize.sdf/; }
- else { $localizeFile =~ s/\/[^\/]*\.$file_types[\s]*$/\/localize.sdf/; }
- }else {
- print STDERR "Strange filetype found '$localizeFile'\n";
- return;
- }
- if( $bVerbose ){ print STDOUT "$localizeFile\n"; }
- if( open DESTFILE , "< $localizeFile" ){
+sub write_sdf
+{
+ my $string_hash = shift;
+ my $l10n_file = shift;
- #or die "Can't open/create '\$localizeFile'";
+ foreach my $lang( keys( %{ $string_hash } ) )
+ {
+ my @sdf_file;
- #### Build hash
- while(<DESTFILE>){
- if( /$sdf_regex/ ){
- my $line = defined $_ ? $_ : '';
- my $prj = defined $3 ? $3 : '';
- my $file = defined $4 ? $4 : '';
- my $type = defined $6 ? $6 : '';
- my $gid = defined $7 ? $7 : '';
- my $lid = defined $8 ? $8 : '';
- my $lang = defined $12 ? $12 : '';
- my $plattform = defined $10 ? $10 : '';
- my $helpid = defined $9 ? $9 : '';
-
- chomp( $line );
- $index{ "$prj\t$file\t$type\t$gid\t$lid\t$helpid\t$plattform\t$lang" } = $line ;
+ # mkdir!!!!
+ my $current_l10n_file = $WIN eq "TRUE" ? $l10n_file."\\$lang\\localize.sdf" : $l10n_file."/$lang/localize.sdf";
+ print "Writing '$current_l10n_file'\n";
+ if( open DESTFILE , "< $current_l10n_file" ){
- } #else { print STDOUT "writesdf REGEX kaputt $_\n";}
+ while(<DESTFILE>){
+ if( /$sdf_regex/ ){
+ my $line = defined $_ ? $_ : '';
+ my $prj = defined $3 ? $3 : '';
+ my $file = defined $4 ? $4 : '';
+ my $type = defined $6 ? $6 : '';
+ my $gid = defined $7 ? $7 : '';
+ my $lid = defined $8 ? $8 : '';
+ my $lang = defined $12 ? $12 : '';
+ my $plattform = defined $10 ? $10 : '';
+ my $helpid = defined $9 ? $9 : '';
+ chomp( $line );
+ if ( defined $string_hash->{ $lang }{ "$prj\t$file\t$type\t$gid\t$lid\t$helpid\t$plattform\t$lang" } )
+ {
+ # Changed String!
+ push @sdf_file , $string_hash->{ $lang }{ "$prj\t$file\t$type\t$gid\t$lid\t$helpid\t$plattform\t$lang" } ;
+ $string_hash->{ $lang }{ "$prj\t$file\t$type\t$gid\t$lid\t$helpid\t$plattform\t$lang" } = undef;
+ }
+ else
+ {
+ # No new string
+ push @sdf_file , $line;
+ }
+ }
+ }
}
close( DESTFILE );
- }
- #### Copy new strings
- my @mykeys = keys( %{ $blockhash_ref } );
- my $isDirty = "FALSE";
- foreach my $key( @mykeys ){
- if( ! defined $index{ $key } ){
- # Add new entry
- $index{ $key } = $blockhash_ref->{ $key} ;
- $isDirty = "TRUE";
- }elsif( $index{ $key } ne $blockhash_ref->{ $key } ){
- # Overwrite old entry
- $index{ $key } = $blockhash_ref->{ $key };
- $isDirty = "TRUE";
- }else {
+ #Now just append the enw strings
+ #FIXME!!! Implement insertion in the correct order
+ foreach my $key ( keys ( %{ $string_hash->{ $lang } } ) )
+ {
+ push @sdf_file , $string_hash->{ $lang }{ $key } , if ( defined $string_hash->{ $lang }{ $key } );
+ #print "WARNING: Not defined = ".$string_hash->{ $lang }{ $key }."\n", if( ! defined $string_hash->{ $lang }{ $key } );
}
- }
-
- #### Write file
- if( !$bVerbose ){ print STDOUT "."; }
- if( $isDirty eq "TRUE" ){
- if( open DESTFILE , "+> $localizeFile" ){
+ # Write the new file
+ my ( $TMPFILE , $tmpfile ) = File::Temp::tempfile();
+ if( open DESTFILE , "+> $tmpfile " ){
print DESTFILE get_license_header();
- @mykeys = sort keys( %index );
- foreach my $key( @mykeys ){
- print DESTFILE ( $index{ $key } , "\n" );
- }
- close DESTFILE;
- }else {
- print STDOUT "WARNING: File $localizeFile is not writable , try to merge ...\n";
- my ( $TMPFILE , $tmpfile ) = File::Temp::tempfile();
- if( open DESTFILE , "+> $tmpfile " ){
- @mykeys = keys( %index );
- foreach my $key( @mykeys ){
- print DESTFILE ( $index{ $key } , "\n" );
- }
- close DESTFILE;
- if( move( $localizeFile , $localizeFile.".backup" ) ){
- if( copy( $tmpfile , $localizeFile ) ){
- unlink $localizeFile.".backup";
- } else { print STDERR "Can't open/create '$localizeFile', original file is renamed to $localizeFile.backup\n"; }
- } else { print STDERR "Can't open/create '$localizeFile'\n"; }
- }else{
- print STDERR "WARNING: Can't open/create '$localizeFile'\n";
+ foreach my $string( @sdf_file ){
+ print DESTFILE "$string\n";
}
- unlink $tmpfile;
- }
- }
-# if( $no_sort eq '' ){
-# sort_outfile( $localizeFile );
-# }
+ close ( DESTFILE );
+ if( move( $current_l10n_file , $current_l10n_file.".backup" ) ){
+ if( copy( $tmpfile , $current_l10n_file ) ){
+ unlink $l10n_file.".backup";
+ } else { print STDERR "Can't open/create '$l10n_file', original file is renamed to $l10n_file.backup\n"; }
+ } else { print STDERR "Can't open/create '$l10n_file'\n"; }
+ }else{
+ print STDERR "WARNING: Can't open/create '$l10n_file'\n";
+ }
+ unlink $tmpfile;
+ }
}
+#########################################################
+
sub get_license_header{
return
"#\n".
@@ -398,6 +425,41 @@ sub wanted
}
}
+sub add_paths
+{
+ my $langhash_ref = shift;
+ my $root_dir = $ENV{ SRC_ROOT };
+ my $ooo_l10n_dir = "$root_dir"."$DELIMITER"."l10n"."$DELIMITER"."source";
+ my $so_l10n_dir = "$root_dir"."$DELIMITER"."l10n_so"."$DELIMITER"."source";
+
+ if( -e $ooo_l10n_dir )
+ {
+ foreach my $lang ( keys( %{ $langhash_ref } ) )
+ {
+ my $loc_file = "$ooo_l10n_dir"."$DELIMITER"."$lang"."$DELIMITER"."localize.sdf";
+ if( -e $loc_file )
+ {
+ push @sdfparticles , "$ooo_l10n_dir"."$DELIMITER"."$lang"."$DELIMITER"."localize.sdf";
+ }
+ else { print "WARNING: $loc_file not found ....\n"; }
+ }
+ }
+ else { die "ERROR: Can not find directory $ooo_l10n_dir!!!" }
+ if( -e $so_l10n_dir )
+ {
+ foreach my $lang ( keys( %{ $langhash_ref } ) )
+ {
+ my $loc_file = "$so_l10n_dir"."$DELIMITER"."$lang"."$DELIMITER"."localize.sdf";
+ if( -e $loc_file )
+ {
+ push @sdfparticles , "$ooo_l10n_dir"."$DELIMITER"."$lang"."$DELIMITER"."localize.sdf";
+ }
+ else { #print "WARNING: $loc_file not found ....\n";
+ }
+ }
+
+ }
+}
sub collectfiles{
print STDOUT "### Localize\n";
my $localizehash_ref;
@@ -408,14 +470,14 @@ sub collectfiles{
STDOUT->autoflush( 1 );
### Search sdf particles
- print STDOUT "### Searching sdf particles\n";
+ #print STDOUT "### Searching sdf particles\n";
my $working_path = getcwd();
- chdir $srcpath;
- find ( { wanted => \&wanted , follow => 1 }, getcwd() );
- chdir $working_path;
-
- my $nFound = $#sdfparticles +1;
- print "\n $nFound files found !\n";
+ #chdir $srcpath;
+ #find ( { wanted => \&wanted , follow => 1 }, getcwd() );
+ #chdir $working_path;
+ add_paths( $langhash_ref );
+ #my $nFound = $#sdfparticles +1;
+ #print "\n $nFound files found !\n";
my ( $LOCALIZEPARTICLE , $localizeSDF ) = File::Temp::tempfile();
close( $LOCALIZEPARTICLE );
@@ -425,7 +487,7 @@ sub collectfiles{
my ( $LOCALIZE_LOG , $my_localize_log ) = File::Temp::tempfile();
close( $LOCALIZE_LOG );
- ## Get the localize de,en-US extract
+ ## Get the localize en-US extract
if( $bAll || $bUseLocalize ){
print "### Fetching source language strings\n";
my $command = "";
@@ -480,7 +542,8 @@ sub collectfiles{
}
## Get sdf particles
- open ALLPARTICLES_MERGED , "+>> $particleSDF_merged"
+#*****************
+ open ALLPARTICLES_MERGED , "+>> $particleSDF_merged"
or die "Can't open $particleSDF_merged";
## Fill fackback hash
@@ -542,7 +605,7 @@ sub collectfiles{
}
}
close ALLPARTICLES_MERGED;
-
+#***************
# Hash of array
my %output;
@@ -1040,7 +1103,8 @@ sub parse_options{
my $merge;
my $extract;
my $success = GetOptions('f=s' => \$sdffile , 'l=s' => \$languages , 's=s' => \$srcpath , 'h' => \$help , 'v' => \$bVerbose ,
- 'm' => \$merge , 'e' => \$extract , 'x' => \$no_sort , 'd' => \$use_default_date );
+ 'm' => \$merge , 'e' => \$extract , 'x' => \$no_sort , 'd' => \$use_default_date , 'c' => \$create_dirs ,
+ 'n' => \$no_gsicheck );
$outputfile = $sdffile;
#print STDOUT "DBG: lang = $languages\n";
@@ -1068,13 +1132,16 @@ sub parse_options{
if( $extract ){ $mode = "extract"; }
else { $mode = "merge"; }
}
+#my $multi_localize_files = ''; h
+#my $module_to_merge = ''; i
+#my $sort_sdf_before = ''; g
#########################################################
sub usage{
print STDERR "Usage: localize.pl\n";
print STDERR "Split or collect SDF files\n";
- print STDERR " merge: -m -f <sdffile> -l l1[=f1][,l2[=f2]][...] [ -s <sourceroot> ]\n";
+ print STDERR " merge: -m -f <sdffile> -l l1[=f1][,l2[=f2]][...] [ -s <sourceroot> ] [ -c ]\n";
print STDERR " extract: -e -f <outputfile> -l <lang> [ -s <sourceroot> ] [-d]\n";
print STDERR "Options:\n";
print STDERR " -h help\n";
@@ -1085,6 +1152,11 @@ sub usage{
print STDERR " -s <sourceroot> Path to the modules, if no \$SRC_ROOT is set\n";
print STDERR " -l ( all | <isocode> | <isocode>=fallback ) comma seperated languages\n";
print STDERR " -d Use default date in extracted sdf file\n";
+ print STDERR " -c Create needed directories\n";
+ print STDERR " -g Sort sdf file before mergeing\n";
+ print STDERR " -h File with localize.sdf's\n!";
+ print STDERR " -n No gsicheck\n";
+ print STDERR " -i Module to merge\n";
print STDERR " -v Verbose\n";
print STDERR "\nExample:\n";
print STDERR "\nlocalize -e -l en-US,pt-BR=en-US -f my.sdf\n( Extract en-US and pt-BR with en-US fallback )\n";
diff --git a/transex3/source/localize.cxx b/transex3/source/localize.cxx
index 31420cc58eeb..2f19f727b517 100644
--- a/transex3/source/localize.cxx
+++ b/transex3/source/localize.cxx
@@ -304,7 +304,26 @@ void SourceTreeLocalizer::WorkOnFile(
DirEntry aTemp( Export::GetTempFile());
ByteString sTempFile( aTemp.GetFull(), RTL_TEXTENCODING_ASCII_US );
- ByteString sExecutable( rExecutable );
+ ByteString sDel;
+#if defined(WNT) || defined(OS2)
+ sDel=ByteString("\\");
+#else
+ sDel=ByteString("/");
+#endif
+ ByteString sPath1( Export::GetEnv("SOLARVER") );
+ ByteString sPath2( Export::GetEnv("INPATH") );
+ ByteString sPath3( "bin" );
+ ByteString sPath4( Export::GetEnv("UPDMINOREXT") );
+ ByteString sExecutable( sPath1 );
+ sExecutable += sDel ;
+ sExecutable += sPath2 ;
+ sExecutable += sDel;
+ sExecutable += sPath3 ;
+ sExecutable += sPath4 ;
+ sExecutable += sDel ;
+ sExecutable += rExecutable ;
+
+
#if defined(WNT) || defined(OS2)
sExecutable += ".exe";
String sPath( Export::GetEnv( "PATH" ), RTL_TEXTENCODING_ASCII_US );
diff --git a/transex3/source/merge.cxx b/transex3/source/merge.cxx
index 3546d7e3accd..ee0f6f459655 100644
--- a/transex3/source/merge.cxx
+++ b/transex3/source/merge.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: merge.cxx,v $
- * $Revision: 1.29 $
+ * $Revision: 1.27.36.3 $
*
* This file is part of OpenOffice.org.
*
@@ -210,38 +210,39 @@ MergeDataFile::MergeDataFile( const ByteString &rFileName, const ByteString& sFi
ByteString sTEXT;
ByteString sQHTEXT;
ByteString sTITLE;
+ ByteString sHACK("HACK");
const ByteString sEmpty("");
if( !aInputStream.IsOpen() ) {
- printf("ERROR : Can't open %s\n", rFileName.GetBuffer());
- exit( -1 );
+ printf("Warning : Can't open %s\n", rFileName.GetBuffer());
+ //exit( -1 );
+ return;
}
while ( !aInputStream.IsEof()) {
+ xub_StrLen nToks;
aInputStream.ReadLine( sLine );
sLine = sLine.Convert( RTL_TEXTENCODING_MS_1252, aCharSet );
- if ( sLine.GetTokenCount( '\t' ) == 15 ) {
+ nToks = sLine.GetTokenCount( '\t' );
+ if ( nToks == 15 ) {
// Skip all wrong filenames
ByteString filename = sLine.GetToken( 1 , '\t' );
filename = filename.Copy( filename.SearchCharBackward( "\\" )+1 , filename.Len() );
if( sFile.Equals( sEmpty ) || ( !sFile.Equals( sEmpty ) && filename.Equals( sFile ) ) )
{
- sTYP = sLine.GetToken( 3, '\t' );
- sGID = sLine.GetToken( 4, '\t' );
- sLID = sLine.GetToken( 5, '\t' );
- sPFO = sLine.GetToken( 7, '\t' );
- sPFO = ByteString("HACK");
- nLANG = sLine.GetToken( 9, '\t' );
-
- sTEXT = sLine.GetToken( 10, '\t' );
- // printf("%s\n",sTEXT.GetBuffer());
- // Quote( sTEXT );
- // printf("%s\n",sTEXT.GetBuffer());
-
- sQHTEXT = sLine.GetToken( 12, '\t' );
- sTITLE = sLine.GetToken( 13, '\t' );
+ xub_StrLen rIdx = 0;
+ sTYP = sLine.GetToken( 3, '\t', rIdx );
+ sGID = sLine.GetToken( 0, '\t', rIdx ); // 4
+ sLID = sLine.GetToken( 0, '\t', rIdx ); // 5
+ sPFO = sLine.GetToken( 1, '\t', rIdx ); // 7
+ sPFO = sHACK;
+ nLANG = sLine.GetToken( 1, '\t', rIdx ); // 9
+ sTEXT = sLine.GetToken( 0, '\t', rIdx ); // 10
+
+ sQHTEXT = sLine.GetToken( 1, '\t', rIdx ); // 12
+ sTITLE = sLine.GetToken( 0, '\t', rIdx ); // 13
nLANG.EraseLeadingAndTrailingChars();
@@ -250,20 +251,22 @@ MergeDataFile::MergeDataFile( const ByteString &rFileName, const ByteString& sFi
#else
if ( !nLANG.EqualsIgnoreCaseAscii("en-US") ){
#endif
- InsertEntry( sTYP, sGID, sLID, sPFO, nLANG, sTEXT, sQHTEXT, sTITLE , filename , bCaseSensitive );
- if( nLANG.Len() > 0 ){
- bool bFound = false;
- for( unsigned int x = 0; x < aLanguages.size(); x++ ){
- if( aLanguages[ x ].Equals( nLANG ) )
- bFound = true;
- }
+ ByteStringHashMap::const_iterator lit;
+ lit = aLanguageMap.find (nLANG);
+ ByteString aLANG;
+ if (lit == aLanguageMap.end()) {
+ aLANG = nLANG;
+ aLanguageMap.insert( ByteStringHashMap::value_type( aLANG, aLANG ) );
// Remember read languages for -l all switch
- if( !bFound ) aLanguages.push_back( nLANG );
- }
+ aLanguageList.push_back( nLANG );
+ } else
+ aLANG = lit->first;
+
+ InsertEntry( sTYP, sGID, sLID, sPFO, aLANG, sTEXT, sQHTEXT, sTITLE , filename , bCaseSensitive );
}
}
}
- else if ( sLine.GetTokenCount( '\t' ) == 10 ){
+ else if ( nToks == 10 ) {
printf("ERROR: File format is obsolete and no longer supported!\n");
}
}
@@ -286,7 +289,7 @@ ByteString MergeDataFile::Dump(){
ByteString sRet( "MergeDataFile\n" );
//sRet.Append( Export::DumpMap( "aLanguageSet" , aLanguageSet ) );
- //sRet.Append( Export::DumpMap( "aLanguages" , aLanguages ) );
+ //sRet.Append( Export::DumpMap( "aLanguageList" , aLanguageList ) );
printf("MergeDataFile\n");
MergeDataHashMap::const_iterator idbg;
for( idbg = aMap.begin() ; idbg != aMap.end(); ++idbg ){
@@ -318,7 +321,7 @@ void MergeDataFile::WriteError( const ByteString &rLine )
fprintf( stderr, "%s\n", rLine.GetBuffer());
}
std::vector<ByteString> MergeDataFile::GetLanguages(){
- return aLanguages;
+ return aLanguageList;
}
/*****************************************************************************/
@@ -379,23 +382,32 @@ void MergeDataFile::InsertEntry(
const ByteString &rLID, const ByteString &rPFO,
const ByteString &nLANG, const ByteString &rTEXT,
const ByteString &rQHTEXT, const ByteString &rTITLE ,
- const ByteString &rFilename , bool bCaseSensitive
+ const ByteString &rInFilename , bool bCaseSensitive
)
/*****************************************************************************/
{
MergeData *pData;
BOOL bFound = FALSE;
- // search for MergeData
+ // uniquify the filename to save memory.
+ ByteStringHashMap::const_iterator fit = aFilenames.find (rInFilename);
+ ByteString aFilename;
+ if (fit == aFilenames.end()) {
+ aFilename = rInFilename;
+ aFilenames.insert (ByteStringHashMap::value_type (aFilename, aFilename));
+ } else
+ aFilename = fit->first;
- ByteString sKey = CreateKey( rTYP , rGID , rLID , rFilename , bCaseSensitive );
- ByteString sKey2;
+ // search for MergeData
- if( aMap.find( sKey ) != aMap.end() ){
- pData = aMap[ sKey ];
+ ByteString sKey = CreateKey( rTYP , rGID , rLID , aFilename , bCaseSensitive );
+ MergeDataHashMap::const_iterator mit;
+ mit = aMap.find( sKey );
+ if( mit != aMap.end() ){
+ pData = mit->second;
}else{
- pData = new MergeData( rTYP, rGID, rLID , rFilename );
- aMap.insert( MergeDataHashMap::value_type( CreateKey( rTYP , rGID , rLID , rFilename , bCaseSensitive ) , pData ) );
+ pData = new MergeData( rTYP, rGID, rLID, aFilename );
+ aMap.insert( MergeDataHashMap::value_type( sKey, pData ) );
}
bFound = FALSE;
diff --git a/ucbhelper/inc/ucbhelper/simpleauthenticationrequest.hxx b/ucbhelper/inc/ucbhelper/simpleauthenticationrequest.hxx
index e4190da641e5..ddb2e655de8b 100644
--- a/ucbhelper/inc/ucbhelper/simpleauthenticationrequest.hxx
+++ b/ucbhelper/inc/ucbhelper/simpleauthenticationrequest.hxx
@@ -33,6 +33,7 @@
#include <rtl/ref.hxx>
#include <ucbhelper/interactionrequest.hxx>
+#include <com/sun/star/ucb/AuthenticationRequest.hpp>
#include "ucbhelper/ucbhelperdllapi.h"
namespace ucbhelper {
@@ -61,6 +62,14 @@ class UCBHELPER_DLLPUBLIC SimpleAuthenticationRequest : public ucbhelper::Intera
rtl::Reference<
ucbhelper::InteractionSupplyAuthentication > m_xAuthSupplier;
+private:
+ void initialize( ::com::sun::star::ucb::AuthenticationRequest aRequest,
+ const sal_Bool & bCanSetRealm,
+ const sal_Bool & bCanSetUserName,
+ const sal_Bool & bCanSetPassword,
+ const sal_Bool & bCanSetAccount,
+ const sal_Bool & bAllowPersistentStoring );
+
public:
/** Specification whether some entity (realm, username, password, account)
is either not applicable at all, has a fixed value, or is modifiable.
@@ -94,6 +103,26 @@ public:
* Constructor.
*
* @param rServerName contains a server name.
+ * @param rRealm contains a realm, if applicable.
+ * @param rUserName contains a username, if available (for instance from
+ * a previous try).
+ * @param rPassword contains a password, if available (for instance from
+ * a previous try).
+ * @param rAccount contains an account, if applicable.
+ * @param bAllowPersistentStoring specifies if the credentials should stored in the passowrd container persistently
+ */
+ SimpleAuthenticationRequest( const rtl::OUString & rServerName,
+ const rtl::OUString & rRealm,
+ const rtl::OUString & rUserName,
+ const rtl::OUString & rPassword,
+ const rtl::OUString & rAccount,
+ const sal_Bool & bAllowPersistentStoring);
+
+
+ /**
+ * Constructor.
+ *
+ * @param rServerName contains a server name.
* @param eRealmType specifies whether a realm is applicable and
modifiable.
* @param rRealm contains a realm, if applicable.
@@ -120,6 +149,37 @@ public:
const rtl::OUString & rAccount
= rtl::OUString() );
+ /**
+ * Constructor.
+ *
+ * @param rServerName contains a server name.
+ * @param eRealmType specifies whether a realm is applicable and
+ modifiable.
+ * @param rRealm contains a realm, if applicable.
+ * @param eUserNameType specifies whether a username is applicable and
+ modifiable.
+ * @param rUserName contains a username, if available (for instance from
+ * a previous try).
+ * @param ePasswordType specifies whether a password is applicable and
+ modifiable.
+ * @param rPassword contains a password, if available (for instance from
+ * a previous try).
+ * @param eAccountType specifies whether an account is applicable and
+ modifiable.
+ * @param rAccount contains an account, if applicable.
+ * @param bAllowPersistentStoring specifies if the credentials should stored in the passowrd container persistently
+ */
+ SimpleAuthenticationRequest( const rtl::OUString & rServerName,
+ EntityType eRealmType,
+ const rtl::OUString & rRealm,
+ EntityType eUserNameType,
+ const rtl::OUString & rUserName,
+ EntityType ePasswordType,
+ const rtl::OUString & rPassword,
+ EntityType eAccountType,
+ const rtl::OUString & rAccount,
+ const sal_Bool & bAllowPersistentStoring);
+
/**
* This method returns the supplier for the missing authentication data,
* that, for instance can be used to query the password supplied by the
diff --git a/ucbhelper/prj/build.lst b/ucbhelper/prj/build.lst
index fb9e7d7ab45f..3f49d69c987f 100644
--- a/ucbhelper/prj/build.lst
+++ b/ucbhelper/prj/build.lst
@@ -1,4 +1,4 @@
-uh ucbhelper : offuh sal cppu cppuhelper salhelper NULL
+uh ucbhelper : offuh sal cppu cppuhelper salhelper NULL
uh ucbhelper usr1 - all uh_mkout NULL
uh ucbhelper\inc nmake - all uh_inc NULL
uh ucbhelper\source\client nmake - all uh_client uh_inc NULL
diff --git a/ucbhelper/source/provider/simpleauthenticationrequest.cxx b/ucbhelper/source/provider/simpleauthenticationrequest.cxx
index c70dc40db2f7..16570f7f012d 100644
--- a/ucbhelper/source/provider/simpleauthenticationrequest.cxx
+++ b/ucbhelper/source/provider/simpleauthenticationrequest.cxx
@@ -30,7 +30,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_ucbhelper.hxx"
-#include <com/sun/star/ucb/AuthenticationRequest.hpp>
+#include <com/sun/star/task/XMasterPasswordHandling.hpp>
#include <ucbhelper/simpleauthenticationrequest.hxx>
using namespace com::sun::star;
@@ -44,7 +44,7 @@ SimpleAuthenticationRequest::SimpleAuthenticationRequest(
const rtl::OUString & rPassword,
const rtl::OUString & rAccount )
{
- // Fill request...
+ // Fill request...
ucb::AuthenticationRequest aRequest;
// aRequest.Message = // OUString
// aRequest.Context = // XInterface
@@ -62,20 +62,73 @@ SimpleAuthenticationRequest::SimpleAuthenticationRequest(
if ( aRequest.HasAccount )
aRequest.Account = rAccount;
+ initialize(aRequest,
+ sal_False,
+ sal_True,
+ sal_True,
+ aRequest.HasAccount,
+ sal_False);
+}
+//=========================================================================
+SimpleAuthenticationRequest::SimpleAuthenticationRequest(
+ const rtl::OUString & rServerName,
+ const rtl::OUString & rRealm,
+ const rtl::OUString & rUserName,
+ const rtl::OUString & rPassword,
+ const rtl::OUString & rAccount,
+ const sal_Bool & bAllowPersistentStoring )
+{
+
+ // Fill request...
+ ucb::AuthenticationRequest aRequest;
+// aRequest.Message = // OUString
+// aRequest.Context = // XInterface
+ aRequest.Classification = task::InteractionClassification_ERROR;
+ aRequest.ServerName = rServerName;
+// aRequest.Diagnostic = // OUString
+ aRequest.HasRealm = ( rRealm.getLength() > 0 );
+ if ( aRequest.HasRealm )
+ aRequest.Realm = rRealm;
+ aRequest.HasUserName = sal_True;
+ aRequest.UserName = rUserName;
+ aRequest.HasPassword = sal_True;
+ aRequest.Password = rPassword;
+ aRequest.HasAccount = ( rAccount.getLength() > 0 );
+ if ( aRequest.HasAccount )
+ aRequest.Account = rAccount;
+
+ initialize(aRequest,
+ sal_False,
+ sal_True,
+ sal_True,
+ aRequest.HasAccount,
+ bAllowPersistentStoring);
+}
+
+void SimpleAuthenticationRequest::initialize(
+ ucb::AuthenticationRequest aRequest,
+ const sal_Bool & bCanSetRealm,
+ const sal_Bool & bCanSetUserName,
+ const sal_Bool & bCanSetPassword,
+ const sal_Bool & bCanSetAccount,
+ const sal_Bool & bAllowPersistentStoring )
+{
setRequest( uno::makeAny( aRequest ) );
// Fill continuations...
- uno::Sequence< ucb::RememberAuthentication > aRememberModes( 2 );
+ uno::Sequence< ucb::RememberAuthentication > aRememberModes( bAllowPersistentStoring ? 3 : 2 );
aRememberModes[ 0 ] = ucb::RememberAuthentication_NO;
aRememberModes[ 1 ] = ucb::RememberAuthentication_SESSION;
+ if (bAllowPersistentStoring)
+ aRememberModes[ 1 ] = ucb::RememberAuthentication_PERSISTENT;
m_xAuthSupplier
= new InteractionSupplyAuthentication(
this,
- sal_False, // bCanSetRealm
- sal_True, // bCanSetUserName
- sal_True, // bCanSetPassword
- aRequest.HasAccount, // bCanSetAccount
+ bCanSetRealm,
+ bCanSetUserName,
+ bCanSetPassword,
+ bCanSetAccount,
aRememberModes, // rRememberPasswordModes
ucb::RememberAuthentication_SESSION, // eDefaultRememberPasswordMode
aRememberModes, // rRememberAccountModes
@@ -123,31 +176,51 @@ SimpleAuthenticationRequest::SimpleAuthenticationRequest(
if ( aRequest.HasAccount )
aRequest.Account = rAccount;
- setRequest( uno::makeAny( aRequest ) );
-
- // Fill continuations...
- uno::Sequence< ucb::RememberAuthentication > aRememberModes( 2 );
- aRememberModes[ 0 ] = ucb::RememberAuthentication_NO;
- aRememberModes[ 1 ] = ucb::RememberAuthentication_SESSION;
-
- m_xAuthSupplier
- = new InteractionSupplyAuthentication(
- this,
- eRealmType == ENTITY_MODIFY, // bCanSetRealm
- eUserNameType == ENTITY_MODIFY, // bCanSetUserName
- ePasswordType == ENTITY_MODIFY, // bCanSetPassword
- eAccountType == ENTITY_MODIFY, // bCanSetAccount
- aRememberModes, // rRememberPasswordModes
- ucb::RememberAuthentication_SESSION, // eDefaultRememberPasswordMode
- aRememberModes, // rRememberAccountModes
- ucb::RememberAuthentication_SESSION // eDefaultRememberAccountMode
- );
+ initialize(aRequest,
+ eRealmType == ENTITY_MODIFY,
+ eUserNameType == ENTITY_MODIFY,
+ ePasswordType == ENTITY_MODIFY,
+ eAccountType == ENTITY_MODIFY,
+ sal_False);
+}
- uno::Sequence<
- uno::Reference< task::XInteractionContinuation > > aContinuations( 3 );
- aContinuations[ 0 ] = new InteractionAbort( this );
- aContinuations[ 1 ] = new InteractionRetry( this );
- aContinuations[ 2 ] = m_xAuthSupplier.get();
+//=========================================================================
+SimpleAuthenticationRequest::SimpleAuthenticationRequest(
+ const rtl::OUString & rServerName,
+ EntityType eRealmType,
+ const rtl::OUString & rRealm,
+ EntityType eUserNameType,
+ const rtl::OUString & rUserName,
+ EntityType ePasswordType,
+ const rtl::OUString & rPassword,
+ EntityType eAccountType,
+ const rtl::OUString & rAccount,
+ const sal_Bool & bAllowPersistentStoring )
+{
+ // Fill request...
+ ucb::AuthenticationRequest aRequest;
+// aRequest.Message = // OUString
+// aRequest.Context = // XInterface
+ aRequest.Classification = task::InteractionClassification_ERROR;
+ aRequest.ServerName = rServerName;
+// aRequest.Diagnostic = // OUString
+ aRequest.HasRealm = eRealmType != ENTITY_NA;
+ if ( aRequest.HasRealm )
+ aRequest.Realm = rRealm;
+ aRequest.HasUserName = eUserNameType != ENTITY_NA;
+ if ( aRequest.HasUserName )
+ aRequest.UserName = rUserName;
+ aRequest.HasPassword = ePasswordType != ENTITY_NA;
+ if ( aRequest.HasPassword )
+ aRequest.Password = rPassword;
+ aRequest.HasAccount = eAccountType != ENTITY_NA;
+ if ( aRequest.HasAccount )
+ aRequest.Account = rAccount;
- setContinuations( aContinuations );
+ initialize(aRequest,
+ eRealmType == ENTITY_MODIFY,
+ eUserNameType == ENTITY_MODIFY,
+ ePasswordType == ENTITY_MODIFY,
+ eAccountType == ENTITY_MODIFY,
+ bAllowPersistentStoring);
}
diff --git a/unotools/inc/unotools/accessiblerelationsethelper.hxx b/unotools/inc/unotools/accessiblerelationsethelper.hxx
index 53802862ada2..e48850e3efc8 100644
--- a/unotools/inc/unotools/accessiblerelationsethelper.hxx
+++ b/unotools/inc/unotools/accessiblerelationsethelper.hxx
@@ -43,7 +43,7 @@
#include <com/sun/star/lang/XServiceName.hpp>
#include <vos/mutex.hxx>
#include <cppuhelper/implbase1.hxx>
-#include <unotools/servicehelper.hxx>
+#include <comphelper/servicehelper.hxx>
class AccessibleRelationSetHelperImpl;
diff --git a/unotools/inc/unotools/accessiblestatesethelper.hxx b/unotools/inc/unotools/accessiblestatesethelper.hxx
index f256249c8e37..421a77b78f2b 100644
--- a/unotools/inc/unotools/accessiblestatesethelper.hxx
+++ b/unotools/inc/unotools/accessiblestatesethelper.hxx
@@ -42,7 +42,7 @@
#include <com/sun/star/lang/XServiceName.hpp>
#include <vos/mutex.hxx>
#include <cppuhelper/implbase1.hxx>
-#include <unotools/servicehelper.hxx>
+#include <comphelper/servicehelper.hxx>
class AccessibleStateSetHelperImpl;
diff --git a/unotools/inc/unotools/servicehelper.hxx b/unotools/inc/unotools/servicehelper.hxx
deleted file mode 100644
index 596e6f946a7f..000000000000
--- a/unotools/inc/unotools/servicehelper.hxx
+++ /dev/null
@@ -1,108 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: servicehelper.hxx,v $
- * $Revision: 1.5 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _UTL_SERVICEHELPER_HXX_
-#define _UTL_SERVICEHELPER_HXX_
-
-/** the UNO3_GETIMPLEMENTATION_* macros implement a static helper function
- that gives access to your implementation for a given interface reference,
- if possible.
-
- Example:
- MyClass* pClass = MyClass::getImplementation( xRef );
-
- Usage:
- Put a UNO3_GETIMPLEMENTATION_DECL( classname ) inside your class
- definitian and UNO3_GETIMPLEMENTATION_IMPL( classname ) inside
- your cxx file. Your class must inherit ::com::sun::star::uno::XUnoTunnel
- and export it with queryInterface. Implementation of XUnoTunnel is
- done by this macro.
-*/
-#define UNO3_GETIMPLEMENTATION_DECL( classname ) \
- static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw(); \
- static classname* getImplementation( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xInt ) throw(); \
- virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
-
-#define UNO3_GETIMPLEMENTATION_BASE_IMPL( classname ) \
-const ::com::sun::star::uno::Sequence< sal_Int8 > & classname::getUnoTunnelId() throw() \
-{ \
- static ::com::sun::star::uno::Sequence< sal_Int8 > * pSeq = 0; \
- if( !pSeq ) \
- { \
- ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); \
- if( !pSeq ) \
- { \
- static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq( 16 ); \
- rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); \
- pSeq = &aSeq; \
- } \
- } \
- return *pSeq; \
-} \
-\
-classname* classname::getImplementation( uno::Reference< uno::XInterface > xInt ) throw() \
-{ \
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > xUT( xInt, ::com::sun::star::uno::UNO_QUERY ); \
- if( xUT.is() ) \
- return reinterpret_cast<classname*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething( classname::getUnoTunnelId() ))); \
- else \
- return NULL; \
-}
-
-#define UNO3_GETIMPLEMENTATION_IMPL( classname )\
-UNO3_GETIMPLEMENTATION_BASE_IMPL(classname)\
-sal_Int64 SAL_CALL classname::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException) \
-{ \
- if( rId.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), \
- rId.getConstArray(), 16 ) ) \
- { \
- return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); \
- } \
- return 0; \
-}
-
-#define UNO3_GETIMPLEMENTATION2_IMPL( classname, baseclass )\
-UNO3_GETIMPLEMENTATION_BASE_IMPL(classname)\
-sal_Int64 SAL_CALL classname::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException) \
-{ \
- if( rId.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), \
- rId.getConstArray(), 16 ) ) \
- { \
- return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); \
- } \
- else \
- { \
- return baseclass::getSomething( rId ); \
- } \
-}
-
-
-#endif // _UTL_SERVICEHELPER_HXX_
-
diff --git a/vcl/aqua/inc/salgdi.h b/vcl/aqua/inc/salgdi.h
index 4c52c06a7393..11abd6086ce7 100644
--- a/vcl/aqua/inc/salgdi.h
+++ b/vcl/aqua/inc/salgdi.h
@@ -157,6 +157,7 @@ public:
void SetVirDevGraphics( CGLayerRef, CGContextRef, int nBitDepth = 0 );
void initResolution( NSWindow* );
+ void copyResolution( AquaSalGraphics& );
void updateResolution();
bool IsWindowGraphics() const { return mbWindow; }
diff --git a/vcl/aqua/source/a11y/aqua11ywrapper.mm b/vcl/aqua/source/a11y/aqua11ywrapper.mm
index 066748cc1525..d6f99c7020d6 100644
--- a/vcl/aqua/source/a11y/aqua11ywrapper.mm
+++ b/vcl/aqua/source/a11y/aqua11ywrapper.mm
@@ -178,9 +178,11 @@ static MacOSBOOL isPopupMenuOpen = NO;
-(Reference < XAccessible >)getFirstRadioButtonInGroup {
Reference < XAccessibleRelationSet > rxAccessibleRelationSet = [ self accessibleContext ] -> getAccessibleRelationSet();
- AccessibleRelation relationMemberOf = rxAccessibleRelationSet -> getRelationByType ( AccessibleRelationType::MEMBER_OF );
- if ( relationMemberOf.RelationType == AccessibleRelationType::MEMBER_OF && relationMemberOf.TargetSet.hasElements() ) {
- return Reference < XAccessible > ( relationMemberOf.TargetSet[0], UNO_QUERY );
+ if( rxAccessibleRelationSet.is() )
+ {
+ AccessibleRelation relationMemberOf = rxAccessibleRelationSet -> getRelationByType ( AccessibleRelationType::MEMBER_OF );
+ if ( relationMemberOf.RelationType == AccessibleRelationType::MEMBER_OF && relationMemberOf.TargetSet.hasElements() )
+ return Reference < XAccessible > ( relationMemberOf.TargetSet[0], UNO_QUERY );
}
return Reference < XAccessible > ();
}
diff --git a/vcl/aqua/source/gdi/salatslayout.cxx b/vcl/aqua/source/gdi/salatslayout.cxx
index f47920004f7a..98700feba39d 100755
--- a/vcl/aqua/source/gdi/salatslayout.cxx
+++ b/vcl/aqua/source/gdi/salatslayout.cxx
@@ -301,7 +301,7 @@ void ATSLayout::AdjustLayout( ImplLayoutArgs& rArgs )
int nPixelWidth = rArgs.mnLayoutWidth;
if( !nPixelWidth && rArgs.mpDXArray ) {
// for now we are only interested in the layout width
- // TODO: account for individual logical widths
+ // TODO: use all mpDXArray elements for layouting
nPixelWidth = rArgs.mpDXArray[ mnCharCount - 1 ];
// workaround for ATSUI not using trailing spaces for justification
@@ -309,14 +309,21 @@ void ATSLayout::AdjustLayout( ImplLayoutArgs& rArgs )
int i = mnCharCount;
while( (--i > 0) && IsSpacingGlyph( rArgs.mpStr[mnMinCharPos+i]|GF_ISCHAR ) )
mnTrailingSpaceWidth += rArgs.mpDXArray[i] - rArgs.mpDXArray[i-1];
+ if( i <= 0 )
+ return;
+ // #i91685# trailing letters are left aligned (right aligned for RTL)
+ mnTrailingSpaceWidth += rArgs.mpDXArray[i];
+ if( i > 0 )
+ mnTrailingSpaceWidth -= rArgs.mpDXArray[i-1];
+ InitGIA(); // ensure valid mpCharWidths[]
+ mnTrailingSpaceWidth -= Fixed2Vcl( mpCharWidths[i] );
+ // ignore trailing space for calculating the available width
nOrigWidth -= mnTrailingSpaceWidth;
nPixelWidth -= mnTrailingSpaceWidth;
- // trailing spaces can be leftmost spaces in RTL-layouts
+ // in RTL-layouts trailing spaces are leftmost
// TODO: use BiDi-algorithm to thoroughly check this assumption
if( rArgs.mnFlags & SAL_LAYOUT_BIDI_RTL)
mnBaseAdv = mnTrailingSpaceWidth;
-
- // TODO: use all mpDXArray elements for layouting
}
// return early if there is nothing to do
if( !nPixelWidth )
diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx
index b1499e2c32d5..3ee54afe2fba 100644
--- a/vcl/aqua/source/gdi/salgdi.cxx
+++ b/vcl/aqua/source/gdi/salgdi.cxx
@@ -346,64 +346,80 @@ void AquaSalGraphics::updateResolution()
void AquaSalGraphics::initResolution( NSWindow* pWin )
{
- NSScreen* pScreen = nil;
+ // #i100617# read DPI only once; there is some kind of weird caching going on
+ // if the main screen changes
+ // FIXME: this is really unfortunate and needs to be investigated
- /* #i91301#
- many woes went into the try to have different resolutions
- on different screens. The result of these trials is that OOo is not ready
- for that yet, vcl and applications would need to be adapted.
+ SalData* pSalData = GetSalData();
+ if( pSalData->mnDPIX == 0 || pSalData->mnDPIY == 0 )
+ {
+ NSScreen* pScreen = nil;
+
+ /* #i91301#
+ many woes went into the try to have different resolutions
+ on different screens. The result of these trials is that OOo is not ready
+ for that yet, vcl and applications would need to be adapted.
- Unfortunately this is not possible in the 3.0 timeframe.
- So let's stay with one resolution for all Windows and VirtualDevices
- which is the resolution of the main screen
+ Unfortunately this is not possible in the 3.0 timeframe.
+ So let's stay with one resolution for all Windows and VirtualDevices
+ which is the resolution of the main screen
- This of course also means that measurements are exact only on the main screen.
- For activating different resolutions again just comment out the two lines below.
+ This of course also means that measurements are exact only on the main screen.
+ For activating different resolutions again just comment out the two lines below.
- if( pWin )
+ if( pWin )
pScreen = [pWin screen];
- */
- if( pScreen == nil )
- {
- NSArray* pScreens = [NSScreen screens];
- if( pScreens )
- pScreen = [pScreens objectAtIndex: 0];
- }
+ */
+ if( pScreen == nil )
+ {
+ NSArray* pScreens = [NSScreen screens];
+ if( pScreens )
+ pScreen = [pScreens objectAtIndex: 0];
+ }
- mnRealDPIX = mnRealDPIY = 96;
- if( pScreen )
- {
- NSDictionary* pDev = [pScreen deviceDescription];
- if( pDev )
+ mnRealDPIX = mnRealDPIY = 96;
+ if( pScreen )
{
- NSNumber* pVal = [pDev objectForKey: @"NSScreenNumber"];
- if( pVal )
+ NSDictionary* pDev = [pScreen deviceDescription];
+ if( pDev )
{
- // FIXME: casting a long to CGDirectDisplayID is evil, but
- // Apple suggest to do it this way
- const CGDirectDisplayID nDisplayID = (CGDirectDisplayID)[pVal longValue];
- const CGSize aSize = CGDisplayScreenSize( nDisplayID ); // => result is in millimeters
- mnRealDPIX = static_cast<long>((CGDisplayPixelsWide( nDisplayID ) * 25.4) / aSize.width);
- mnRealDPIY = static_cast<long>((CGDisplayPixelsHigh( nDisplayID ) * 25.4) / aSize.height);
+ NSNumber* pVal = [pDev objectForKey: @"NSScreenNumber"];
+ if( pVal )
+ {
+ // FIXME: casting a long to CGDirectDisplayID is evil, but
+ // Apple suggest to do it this way
+ const CGDirectDisplayID nDisplayID = (CGDirectDisplayID)[pVal longValue];
+ const CGSize aSize = CGDisplayScreenSize( nDisplayID ); // => result is in millimeters
+ mnRealDPIX = static_cast<long>((CGDisplayPixelsWide( nDisplayID ) * 25.4) / aSize.width);
+ mnRealDPIY = static_cast<long>((CGDisplayPixelsHigh( nDisplayID ) * 25.4) / aSize.height);
+ }
+ else
+ {
+ DBG_ERROR( "no resolution found in device description" );
+ }
}
else
{
- DBG_ERROR( "no resolution found in device description" );
+ DBG_ERROR( "no device description" );
}
}
else
{
- DBG_ERROR( "no device description" );
+ DBG_ERROR( "no screen found" );
}
+
+ // for OSX any anisotropy reported for the display resolution is best ignored (e.g. TripleHead2Go)
+ mnRealDPIX = mnRealDPIY = (mnRealDPIX + mnRealDPIY + 1) / 2;
+
+ pSalData->mnDPIX = mnRealDPIX;
+ pSalData->mnDPIY = mnRealDPIY;
}
else
{
- DBG_ERROR( "no screen found" );
+ mnRealDPIX = pSalData->mnDPIX;
+ mnRealDPIY = pSalData->mnDPIY;
}
- // for OSX any anisotropy reported for the display resolution is best ignored (e.g. TripleHead2Go)
- mnRealDPIX = mnRealDPIY = (mnRealDPIX + mnRealDPIY + 1) / 2;
-
mfFakeDPIScale = 1.0;
}
@@ -416,6 +432,16 @@ void AquaSalGraphics::GetResolution( long& rDPIX, long& rDPIY )
rDPIY = static_cast<long>(mfFakeDPIScale * mnRealDPIY);
}
+void AquaSalGraphics::copyResolution( AquaSalGraphics& rGraphics )
+{
+ if( !rGraphics.mnRealDPIY && rGraphics.mbWindow && rGraphics.mpFrame )
+ rGraphics.initResolution( rGraphics.mpFrame->mpWindow );
+
+ mnRealDPIX = rGraphics.mnRealDPIX;
+ mnRealDPIY = rGraphics.mnRealDPIY;
+ mfFakeDPIScale = rGraphics.mfFakeDPIScale;
+}
+
// -----------------------------------------------------------------------
USHORT AquaSalGraphics::GetBitCount()
diff --git a/vcl/aqua/source/gdi/salprn.cxx b/vcl/aqua/source/gdi/salprn.cxx
index ef6258829261..a0062834e269 100644
--- a/vcl/aqua/source/gdi/salprn.cxx
+++ b/vcl/aqua/source/gdi/salprn.cxx
@@ -187,8 +187,8 @@ static struct PaperSizeEntry
{ 420, 595, PAPER_A5 },
{ 612, 792, PAPER_LETTER },
{ 612, 1008, PAPER_LEGAL },
- { 728, 1032, PAPER_B4 },
- { 516, 729, PAPER_B5 },
+ { 728, 1032, PAPER_B4_JIS },
+ { 516, 729, PAPER_B5_JIS },
{ 792, 1224, PAPER_TABLOID }
};
@@ -216,8 +216,8 @@ static Paper recognizePaper( double i_fWidth, double i_fHeight )
case 595000842: aPaper = PAPER_A4; break;
case 420000595: aPaper = PAPER_A5; break;
case 612000792: aPaper = PAPER_LETTER; break;
- case 728001032: aPaper = PAPER_B4; break;
- case 516000729: aPaper = PAPER_B5; break;
+ case 728001032: aPaper = PAPER_B4_JIS; break;
+ case 516000729: aPaper = PAPER_B5_JIS; break;
case 612001008: aPaper = PAPER_LEGAL; break;
case 792001224: aPaper = PAPER_TABLOID; break;
default:
diff --git a/vcl/aqua/source/gdi/salvd.cxx b/vcl/aqua/source/gdi/salvd.cxx
index 5ab2f27a8d42..d7690e4e38bd 100644
--- a/vcl/aqua/source/gdi/salvd.cxx
+++ b/vcl/aqua/source/gdi/salvd.cxx
@@ -87,7 +87,7 @@ AquaSalVirtualDevice::AquaSalVirtualDevice( AquaSalGraphics* pGraphic, long nDX,
if( pFrame && AquaSalFrame::isAlive( pFrame ) )
{
mpGraphics->setGraphicsFrame( pFrame );
- mpGraphics->initResolution( pFrame->mpWindow );
+ mpGraphics->copyResolution( *pGraphic );
}
}
diff --git a/vcl/inc/sft.h b/vcl/inc/sft.h
new file mode 100644
index 000000000000..efda0903afc5
--- /dev/null
+++ b/vcl/inc/sft.h
@@ -0,0 +1,641 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: sft.h,v $
+ * $Revision: 1.21 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+/* $Id: sft.h,v 1.21 2008-06-25 14:20:49 kz Exp $ */
+
+/**
+
+ *
+ * @file sft.h
+ * @brief Sun Font Tools
+ * @author Alexander Gelfenbain
+ */
+
+/*
+ * If NO_MAPPERS is defined, MapChar() and MapString() and consequently GetTTSimpleCharMetrics()
+ * don't get compiled in. This is done to avoid including a large chunk of code (TranslateXY() from
+ * xlat.c in the projects that don't require it.
+ *
+ * If NO_TYPE3 is defined CreateT3FromTTGlyphs() does not get compiled in.
+ * If NO_TYPE42 is defined Type42-related code is excluded
+ * If NO_TTCR is defined TrueType creation related code is excluded\
+ * If NO_LIST is defined list.h and piblic functions that use it don't get compiled
+ */
+
+/*
+ * Generated fonts contain an XUID entry in the form of:
+ *
+ * 103 0 T C1 N C2 C3
+ *
+ * 103 - Sun's Adobe assigned XUID number. Contact person: Alexander Gelfenbain <gelf@eng.sun.com>
+ *
+ * T - font type. 0: Type 3, 1: Type 42
+ * C1 - CRC-32 of the entire source TrueType font
+ * N - number of glyphs in the subset
+ * C2 - CRC-32 of the array of glyph IDs used to generate the subset
+ * C3 - CRC-32 of the array of encoding numbers used to generate the subset
+ *
+ */
+
+
+#ifndef __SUBFONT_H
+#define __SUBFONT_H
+
+#ifdef UNX
+#include <sys/types.h>
+#include <unistd.h>
+#endif
+#include <stdio.h>
+
+#include <sal/types.h>
+
+#ifndef NO_LIST
+#include "list.h"
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*@{*/
+#ifndef __cplusplus
+#define false 0 /**< standard false value */
+#define true 1 /**< standard true value */
+#endif
+/*@}*/
+
+/*@{*/
+ typedef sal_Int16 F2Dot14; /**< fixed: 2.14 */
+ typedef sal_Int32 F16Dot16; /**< fixed: 16.16 */
+/*@}*/
+
+ typedef struct {
+ sal_uInt16 s;
+ sal_uInt16 d;
+ } sal_uInt16pair;
+
+/** Return value of OpenTTFont() and CreateT3FromTTGlyphs() */
+ enum SFErrCodes {
+ SF_OK, /**< no error */
+ SF_BADFILE, /**< file not found */
+ SF_FILEIO, /**< file I/O error */
+ SF_MEMORY, /**< memory allocation error */
+ SF_GLYPHNUM, /**< incorrect number of glyphs */
+ SF_BADARG, /**< incorrect arguments */
+ SF_TTFORMAT, /**< incorrect TrueType font format */
+ SF_TABLEFORMAT, /**< incorrect format of a TrueType table */
+ SF_FONTNO /**< incorrect logical font number of a TTC font */
+ };
+
+#ifndef FW_THIN /* WIN32 compilation would conflict */
+/** Value of the weight member of the TTGlobalFontInfo struct */
+ enum WeightClass {
+ FW_THIN = 100, /**< Thin */
+ FW_EXTRALIGHT = 200, /**< Extra-light (Ultra-light) */
+ FW_LIGHT = 300, /**< Light */
+ FW_NORMAL = 400, /**< Normal (Regular) */
+ FW_MEDIUM = 500, /**< Medium */
+ FW_SEMIBOLD = 600, /**< Semi-bold (Demi-bold) */
+ FW_BOLD = 700, /**< Bold */
+ FW_EXTRABOLD = 800, /**< Extra-bold (Ultra-bold) */
+ FW_BLACK = 900 /**< Black (Heavy) */
+ };
+
+/** Value of the width member of the TTGlobalFontInfo struct */
+#ifndef OS2
+ enum WidthClass {
+ FWIDTH_ULTRA_CONDENSED = 1, /**< 50% of normal */
+ FWIDTH_EXTRA_CONDENSED = 2, /**< 62.5% of normal */
+ FWIDTH_CONDENSED = 3, /**< 75% of normal */
+ FWIDTH_SEMI_CONDENSED = 4, /**< 87.5% of normal */
+ FWIDTH_NORMAL = 5, /**< Medium, 100% */
+ FWIDTH_SEMI_EXPANDED = 6, /**< 112.5% of normal */
+ FWIDTH_EXPANDED = 7, /**< 125% of normal */
+ FWIDTH_EXTRA_EXPANDED = 8, /**< 150% of normal */
+ FWIDTH_ULTRA_EXPANDED = 9 /**< 200% of normal */
+ };
+#endif // OS2
+#endif /* FW_THIN */
+
+/** Type of the 'kern' table, stored in _TrueTypeFont::kerntype */
+ enum KernType {
+ KT_NONE = 0, /**< no kern table */
+ KT_APPLE_NEW = 1, /**< new Apple kern table */
+ KT_MICROSOFT = 2 /**< Microsoft table */
+ };
+
+/* Composite glyph flags definition */
+ enum CompositeFlags {
+ ARG_1_AND_2_ARE_WORDS = 1,
+ ARGS_ARE_XY_VALUES = 1<<1,
+ ROUND_XY_TO_GRID = 1<<2,
+ WE_HAVE_A_SCALE = 1<<3,
+ MORE_COMPONENTS = 1<<5,
+ WE_HAVE_AN_X_AND_Y_SCALE = 1<<6,
+ WE_HAVE_A_TWO_BY_TWO = 1<<7,
+ WE_HAVE_INSTRUCTIONS = 1<<8,
+ USE_MY_METRICS = 1<<9,
+ OVERLAP_COMPOUND = 1<<10
+ };
+
+#ifndef NO_TTCR
+/** Flags for TrueType generation */
+ enum TTCreationFlags {
+ TTCF_AutoName = 1, /**< Automatically generate a compact 'name' table.
+ If this flag is not set, name table is generated
+ either from an array of NameRecord structs passed as
+ arguments or if the array is NULL, 'name' table
+ of the generated TrueType file will be a copy
+ of the name table of the original file.
+ If this flag is set the array of NameRecord structs
+ is ignored and a very compact 'name' table is automatically
+ generated. */
+
+ TTCF_IncludeOS2 = 2 /** If this flag is set OS/2 table from the original font will be
+ copied to the subset */
+ };
+#endif
+
+
+
+
+/** Structure used by GetTTSimpleGlyphMetrics() and GetTTSimpleCharMetrics() functions */
+ typedef struct {
+ sal_uInt16 adv; /**< advance width or height */
+ sal_Int16 sb; /**< left or top sidebearing */
+ } TTSimpleGlyphMetrics;
+
+
+
+/** Structure used by the TrueType Creator and GetRawGlyphData() */
+
+ typedef struct {
+ sal_uInt32 glyphID; /**< glyph ID */
+ sal_uInt16 nbytes; /**< number of bytes in glyph data */
+ sal_uInt8 *ptr; /**< pointer to glyph data */
+ sal_uInt16 aw; /**< advance width */
+ sal_Int16 lsb; /**< left sidebearing */
+ sal_uInt16 compflag; /**< 0- if non-composite, 1- otherwise */
+ sal_uInt16 npoints; /**< number of points */
+ sal_uInt16 ncontours; /**< number of contours */
+ /* */
+ sal_uInt32 newID; /**< used internally by the TTCR */
+ } GlyphData;
+
+/** Structure used by the TrueType Creator and CreateTTFromTTGlyphs() */
+ typedef struct {
+ sal_uInt16 platformID; /**< Platform ID */
+ sal_uInt16 encodingID; /**< Platform-specific encoding ID */
+ sal_uInt16 languageID; /**< Language ID */
+ sal_uInt16 nameID; /**< Name ID */
+ sal_uInt16 slen; /**< String length in bytes */
+ sal_uInt8 *sptr; /**< Pointer to string data (not zero-terminated!) */
+ } NameRecord;
+
+
+
+/** Return value of GetTTGlobalFontInfo() */
+
+ typedef struct {
+ char *family; /**< family name */
+ sal_uInt16 *ufamily; /**< family name UCS2 */
+ char *subfamily; /**< subfamily name */
+ sal_uInt16 *usubfamily; /**< subfamily name UCS2 */
+ char *psname; /**< PostScript name */
+ sal_uInt16 macStyle; /**< macstyle bits from 'HEAD' table */
+ int weight; /**< value of WeightClass or 0 if can't be determined */
+ int width; /**< value of WidthClass or 0 if can't be determined */
+ int pitch; /**< 0: proportianal font, otherwise: monospaced */
+ int italicAngle; /**< in counter-clockwise degrees * 65536 */
+ int xMin; /**< global bounding box: xMin */
+ int yMin; /**< global bounding box: yMin */
+ int xMax; /**< global bounding box: xMax */
+ int yMax; /**< global bounding box: yMax */
+ int ascender; /**< typographic ascent. */
+ int descender; /**< typographic descent. */
+ int linegap; /**< typographic line gap.\ Negative values are treated as
+ zero in Win 3.1, System 6 and System 7. */
+ int vascent; /**< typographic ascent for vertical writing mode */
+ int vdescent; /**< typographic descent for vertical writing mode */
+ int typoAscender; /**< OS/2 portable typographic ascender */
+ int typoDescender; /**< OS/2 portable typographic descender */
+ int typoLineGap; /**< OS/2 portable typographc line gap */
+ int winAscent; /**< ascender metric for Windows */
+ int winDescent; /**< descender metric for Windows */
+ int symbolEncoded; /**< 1: MS symbol encoded 0: not symbol encoded */
+ int rangeFlag; /**< if set to 1 Unicode Range flags are applicable */
+ sal_uInt32 ur1; /**< bits 0 - 31 of Unicode Range flags */
+ sal_uInt32 ur2; /**< bits 32 - 63 of Unicode Range flags */
+ sal_uInt32 ur3; /**< bits 64 - 95 of Unicode Range flags */
+ sal_uInt32 ur4; /**< bits 96 - 127 of Unicode Range flags */
+ sal_uInt8 panose[10]; /**< PANOSE classification number */
+ sal_uInt16 typeFlags; /**< type flags (copyright information) */
+ } TTGlobalFontInfo;
+
+/** Structure used by KernGlyphs() */
+ typedef struct {
+ int x; /**< positive: right, negative: left */
+ int y; /**< positive: up, negative: down */
+ } KernData;
+
+
+/** ControlPoint structure used by GetTTGlyphPoints() */
+ typedef struct {
+ sal_uInt32 flags; /**< 00000000 00000000 e0000000 bbbbbbbb */
+ /**< b - byte flags from the glyf array */
+ /**< e == 0 - regular point */
+ /**< e == 1 - end contour */
+ sal_Int16 x; /**< X coordinate in EmSquare units */
+ sal_Int16 y; /**< Y coordinate in EmSquare units */
+ } ControlPoint;
+
+ typedef struct _TrueTypeFont TrueTypeFont;
+
+/**
+ * @defgroup sft Sun Font Tools Exported Functions
+ */
+
+
+/**
+ * Get the number of fonts contained in a TrueType collection
+ * @param fname - file name
+ * @return number of fonts or zero, if file is not a TTC file.
+ * @ingroup sft
+ */
+ int CountTTCFonts(const char* fname);
+
+
+/**
+ * TrueTypeFont constructor.
+ * The font file has to be provided as a memory buffer and length
+ * @param facenum - logical font number within a TTC file. This value is ignored
+ * for TrueType fonts
+ * @return value of SFErrCodes enum
+ * @ingroup sft
+ */
+ int OpenTTFontBuffer(void* pBuffer, sal_uInt32 nLen, sal_uInt32 facenum, TrueTypeFont** ttf); /*FOLD01*/
+#if !defined(WIN32) && !defined(OS2)
+/**
+ * TrueTypeFont constructor.
+ * Reads the font file and allocates the memory for the structure.
+ * on WIN32 the font has to be provided as a memory buffer and length
+ * @param facenum - logical font number within a TTC file. This value is ignored
+ * for TrueType fonts
+ * @return value of SFErrCodes enum
+ * @ingroup sft
+ */
+ int OpenTTFontFile(const char *fname, sal_uInt32 facenum, TrueTypeFont** ttf);
+#endif
+
+/**
+ * TrueTypeFont destructor. Deallocates the memory.
+ * @ingroup sft
+ */
+ void CloseTTFont(TrueTypeFont *);
+
+/**
+ * Extracts TrueType control points, and stores them in an allocated array pointed to
+ * by *pointArray. This function returns the number of extracted points.
+ *
+ * @param ttf pointer to the TrueTypeFont structure
+ * @param glyphID Glyph ID
+ * @param pointArray Return value - address of the pointer to the first element of the array
+ * of points allocated by the function
+ * @return Returns the number of points in *pointArray or -1 if glyphID is
+ * invalid.
+ * @ingroup sft
+ *
+ */
+ int GetTTGlyphPoints(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPoint **pointArray);
+
+/**
+ * Extracts raw glyph data from the 'glyf' table and returns it in an allocated
+ * GlyphData structure.
+ *
+ * @param ttf pointer to the TrueTypeFont structure
+ * @param glyphID Glyph ID
+ *
+ * @return pointer to an allocated GlyphData structure or NULL if
+ * glyphID is not present in the font
+ * @ingroup sft
+ *
+ */
+ GlyphData *GetTTRawGlyphData(TrueTypeFont *ttf, sal_uInt32 glyphID);
+
+#ifndef NO_LIST
+/**
+ * For a specified glyph adds all component glyphs IDs to the list and
+ * return their number. If the glyph is a single glyph it has one component
+ * glyph (which is added to the list) and the function returns 1.
+ * For a composite glyphs it returns the number of component glyphs
+ * and adds all of them to the list.
+ *
+ * @param ttf pointer to the TrueTypeFont structure
+ * @param glyphID Glyph ID
+ * @param glyphlist list of glyphs
+ *
+ * @return number of component glyphs
+ * @ingroup sft
+ *
+ */
+ int GetTTGlyphComponents(TrueTypeFont *ttf, sal_uInt32 glyphID, list glyphlist);
+#endif
+
+/**
+ * Extracts all Name Records from the font and stores them in an allocated
+ * array of NameRecord structs
+ *
+ * @param ttf pointer to the TrueTypeFont struct
+ * @param nr pointer to the array of NameRecord structs
+ *
+ * @return number of NameRecord structs
+ * @ingroup sft
+ */
+
+ int GetTTNameRecords(TrueTypeFont *ttf, NameRecord **nr);
+
+/**
+ * Deallocates previously allocated array of NameRecords.
+ *
+ * @param nr array of NameRecord structs
+ * @param n number of elements in the array
+ *
+ * @ingroup sft
+ */
+ void DisposeNameRecords(NameRecord* nr, int n);
+
+
+#ifndef NO_TYPE3
+/**
+ * Generates a new PostScript Type 3 font and dumps it to <b>outf</b> file.
+ * This functions subsititues glyph 0 for all glyphIDs that are not found in the font.
+ * @param ttf pointer to the TrueTypeFont structure
+ * @param outf the resulting font is written to this stream
+ * @param fname font name for the new font. If it is NULL the PostScript name of the
+ * original font will be used
+ * @param glyphArray pointer to an array of glyphs that are to be extracted from ttf
+ * @param encoding array of encoding values. encoding[i] specifies the position of the glyph
+ * glyphArray[i] in the encoding vector of the resulting Type3 font
+ * @param nGlyphs number of glyph IDs in glyphArray and encoding values in encoding
+ * @param wmode writing mode for the output file: 0 - horizontal, 1 - vertical
+ * @return return the value of SFErrCodes enum
+ * @see SFErrCodes
+ * @ingroup sft
+ *
+ */
+ int CreateT3FromTTGlyphs(TrueTypeFont *ttf, FILE *outf, const char *fname, sal_uInt16 *glyphArray, sal_uInt8 *encoding, int nGlyphs, int wmode);
+#endif
+
+#ifndef NO_TTCR
+/**
+ * Generates a new TrueType font and dumps it to <b>outf</b> file.
+ * This functions subsititues glyph 0 for all glyphIDs that are not found in the font.
+ * @param ttf pointer to the TrueTypeFont structure
+ * @param fname file name for the output TrueType font file
+ * @param glyphArray pointer to an array of glyphs that are to be extracted from ttf. The first
+ * element of this array has to be glyph 0 (default glyph)
+ * @param encoding array of encoding values. encoding[i] specifies character code for
+ * the glyphID glyphArray[i]. Character code 0 usually points to a default
+ * glyph (glyphID 0)
+ * @param nGlyphs number of glyph IDs in glyphArray and encoding values in encoding
+ * @param nNameRecs number of NameRecords for the font, if 0 the name table from the
+ * original font will be used
+ * @param nr array of NameRecords
+ * @param flags or'ed TTCreationFlags
+ * @return return the value of SFErrCodes enum
+ * @see SFErrCodes
+ * @ingroup sft
+ *
+ */
+ int CreateTTFromTTGlyphs(TrueTypeFont *ttf,
+ const char *fname,
+ sal_uInt16 *glyphArray,
+ sal_uInt8 *encoding,
+ int nGlyphs,
+ int nNameRecs,
+ NameRecord *nr,
+ sal_uInt32 flags);
+#endif
+
+#ifndef NO_TYPE42
+/**
+ * Generates a new PostScript Type42 font and dumps it to <b>outf</b> file.
+ * This functions subsititues glyph 0 for all glyphIDs that are not found in the font.
+ * @param ttf pointer to the TrueTypeFont structure
+ * @param outf output stream for a resulting font
+ * @param psname PostScript name of the resulting font
+ * @param glyphArray pointer to an array of glyphs that are to be extracted from ttf. The first
+ * element of this array has to be glyph 0 (default glyph)
+ * @param encoding array of encoding values. encoding[i] specifies character code for
+ * the glyphID glyphArray[i]. Character code 0 usually points to a default
+ * glyph (glyphID 0)
+ * @param nGlyphs number of glyph IDs in glyphArray and encoding values in encoding
+ * @return SF_OK - no errors
+ * SF_GLYPHNUM - too many glyphs (> 255)
+ * SF_TTFORMAT - corrupted TrueType fonts
+ *
+ * @see SFErrCodes
+ * @ingroup sft
+ *
+ */
+ int CreateT42FromTTGlyphs(TrueTypeFont *ttf,
+ FILE *outf,
+ const char *psname,
+ sal_uInt16 *glyphArray,
+ sal_uInt8 *encoding,
+ int nGlyphs);
+#endif
+
+
+/**
+ * Queries glyph metrics. Allocates an array of TTSimpleGlyphMetrics structs and returns it.
+ *
+ * @param ttf pointer to the TrueTypeFont structure
+ * @param glyphArray pointer to an array of glyphs that are to be extracted from ttf
+ * @param nGlyphs number of glyph IDs in glyphArray and encoding values in encoding
+ * @param mode writing mode: 0 - horizontal, 1 - vertical
+ * @ingroup sft
+ *
+ */
+ TTSimpleGlyphMetrics *GetTTSimpleGlyphMetrics(TrueTypeFont *ttf, sal_uInt16 *glyphArray, int nGlyphs, int mode);
+
+#ifndef NO_MAPPERS
+/**
+ * Queries glyph metrics. Allocates an array of TTSimpleGlyphMetrics structs and returns it.
+ * This function behaves just like GetTTSimpleGlyphMetrics() but it takes a range of Unicode
+ * characters instead of an array of glyphs.
+ *
+ * @param ttf pointer to the TrueTypeFont structure
+ * @param firstChar Unicode value of the first character in the range
+ * @param nChars number of Unicode characters in the range
+ * @param mode writing mode: 0 - horizontal, 1 - vertical
+ *
+ * @see GetTTSimpleGlyphMetrics
+ * @ingroup sft
+ *
+ */
+ TTSimpleGlyphMetrics *GetTTSimpleCharMetrics(TrueTypeFont *ttf, sal_uInt16 firstChar, int nChars, int mode);
+
+/**
+ * Maps a Unicode (UCS-2) string to a glyph array. Returns the number of glyphs in the array,
+ * which for TrueType fonts is always the same as the number of input characters.
+ *
+ * @param ttf pointer to the TrueTypeFont structure
+ * @param str pointer to a UCS-2 string
+ * @param nchars number of characters in <b>str</b>
+ * @param glyphArray pointer to the glyph array where glyph IDs are to be recorded.
+ *
+ * @return MapString() returns -1 if the TrueType font has no usable 'cmap' tables.
+ * Otherwise it returns the number of characters processed: <b>nChars</b>
+ *
+ * glyphIDs of TrueType fonts are 2 byte positive numbers. glyphID of 0 denotes a missing
+ * glyph and traditionally defaults to an empty square.
+ * glyphArray should be at least sizeof(sal_uInt16) * nchars bytes long. If glyphArray is NULL
+ * MapString() replaces the UCS-2 characters in str with glyphIDs.
+ * @ingroup sft
+ */
+ int MapString(TrueTypeFont *ttf, sal_uInt16 *str, int nchars, sal_uInt16 *glyphArray, int bvertical);
+
+/**
+ * Maps a Unicode (UCS-2) character to a glyph ID and returns it. Missing glyph has
+ * a glyphID of 0 so this function can be used to test if a character is encoded in the font.
+ *
+ * @param ttf pointer to the TrueTypeFont structure
+ * @param ch Unicode (UCS-2) character
+ * @return glyph ID, if the character is missing in the font, the return value is 0.
+ * @ingroup sft
+ */
+ sal_uInt16 MapChar(TrueTypeFont *ttf, sal_uInt16 ch, int bvertical);
+
+/**
+ * Returns 0 when the font does not substitute vertical glyphs
+ *
+ * @param ttf pointer to the TrueTypeFont structure
+ */
+ int DoesVerticalSubstitution( TrueTypeFont *ttf, int bvertical);
+
+#endif
+
+/**
+ * Returns global font information about the TrueType font.
+ * @see TTGlobalFontInfo
+ *
+ * @param ttf pointer to a TrueTypeFont structure
+ * @param info pointer to a TTGlobalFontInfo structure
+ * @ingroup sft
+ *
+ */
+ void GetTTGlobalFontInfo(TrueTypeFont *ttf, TTGlobalFontInfo *info);
+
+#ifdef TEST5
+/**
+ * Returns kerning information for an array of glyphs.
+ * Kerning is not cumulative.
+ * kern[i] contains kerning information for a pair of glyphs at positions i and i+1
+ *
+ * @param ttf pointer to a TrueTypeFont structure
+ * @param glyphs array of source glyphs
+ * @param nglyphs number of glyphs in the array
+ * @param wmode writing mode: 0 - horizontal, 1 - vertical
+ * @param kern array of KernData structures. It should contain nglyphs-1 elements
+ * @see KernData
+ * @ingroup sft
+ *
+ */
+ void KernGlyphs(TrueTypeFont *ttf, sal_uInt16 *glyphs, int nglyphs, int wmode, KernData *kern);
+#endif
+
+/**
+ * Returns nonzero if font is a symbol encoded font
+ */
+ int CheckSymbolEncoding(TrueTypeFont* ttf);
+
+/**
+ * returns the number of glyphs in a font
+ */
+ int GetTTGlyphCount( TrueTypeFont* ttf );
+
+/*- private definitions */ /*FOLD00*/
+
+ struct _TrueTypeFont {
+ sal_uInt32 tag;
+
+ char *fname;
+ sal_Int32 fsize;
+ sal_uInt8 *ptr;
+
+ char *psname;
+ char *family;
+ sal_uInt16 *ufamily;
+ char *subfamily;
+ sal_uInt16 *usubfamily;
+
+ sal_uInt32 ntables;
+ sal_uInt32 *goffsets;
+ sal_uInt32 nglyphs;
+ sal_uInt32 unitsPerEm;
+ sal_uInt32 numberOfHMetrics;
+ sal_uInt32 numOfLongVerMetrics; /* if this number is not 0, font has vertical metrics information */
+ sal_uInt8 *cmap;
+ int cmapType;
+ sal_uInt32 (*mapper)(const sal_uInt8 *, sal_uInt32); /* character to glyphID translation function */
+ void **tables; /* array of pointers to tables */
+ sal_uInt32 *tlens; /* array of table lengths */
+ int kerntype; /* Defined in the KernType enum */
+ sal_uInt32 nkern; /* number of kern subtables */
+ sal_uInt8 **kerntables; /* array of pointers to kern subtables */
+ void *pGSubstitution; /* info provided by GSUB for UseGSUB() */
+ };
+
+#ifdef __cplusplus
+}
+#endif
+
+/* indexes into _TrueTypeFont::tables[] and _TrueTypeFont::tlens[] */
+#define O_maxp 0 /* 'maxp' */
+#define O_glyf 1 /* 'glyf' */
+#define O_head 2 /* 'head' */
+#define O_loca 3 /* 'loca' */
+#define O_name 4 /* 'name' */
+#define O_hhea 5 /* 'hhea' */
+#define O_hmtx 6 /* 'hmtx' */
+#define O_cmap 7 /* 'cmap' */
+#define O_vhea 8 /* 'vhea' */
+#define O_vmtx 9 /* 'vmtx' */
+#define O_OS2 10 /* 'OS/2' */
+#define O_post 11 /* 'post' */
+#define O_kern 12 /* 'kern' */
+#define O_cvt 13 /* 'cvt_' - only used in TT->TT generation */
+#define O_prep 14 /* 'prep' - only used in TT->TT generation */
+#define O_fpgm 15 /* 'fpgm' - only used in TT->TT generation */
+#define O_gsub 16 /* 'GSUB' */
+#define NUM_TAGS 17
+
+#endif /* __SUBFONT_H */
diff --git a/vcl/inc/vcl/jobset.h b/vcl/inc/vcl/jobset.h
index 5d08319a7e6c..9f3eefd507d5 100644
--- a/vcl/inc/vcl/jobset.h
+++ b/vcl/inc/vcl/jobset.h
@@ -61,7 +61,7 @@ struct ImplJobSetup
String maDriver; // Driver-Name
Orientation meOrientation; // Orientation
USHORT mnPaperBin; // Papierschacht
- Paper mePaperFormat; // Papierformat
+ Paper mePaperFormat; // Papierformat
long mnPaperWidth; // Papierbreite in 100tel mm
long mnPaperHeight; // Papierhoehe in 100tel mm
ULONG mnDriverDataLen; // Laenge der systemabhaengigen Daten
diff --git a/vcl/inc/vcl/pngread.hxx b/vcl/inc/vcl/pngread.hxx
index 200b52eb6182..285af1407c1c 100644
--- a/vcl/inc/vcl/pngread.hxx
+++ b/vcl/inc/vcl/pngread.hxx
@@ -65,6 +65,8 @@ namespace vcl
std::vector< sal_uInt8 > aData;
};
const std::vector< ChunkData >& GetChunks() const;
+
+ void SetIgnoreGammaChunk( sal_Bool b );
};
}
diff --git a/vcl/inc/vcl/print.hxx b/vcl/inc/vcl/print.hxx
index fdc7f2ba9c69..b9176f4106dc 100644
--- a/vcl/inc/vcl/print.hxx
+++ b/vcl/inc/vcl/print.hxx
@@ -330,17 +330,12 @@ public:
USHORT GetPaperBin() const;
BOOL SetPaper( Paper ePaper );
BOOL SetPaperSizeUser( const Size& rSize );
- Paper GetPaper() const;
+ Paper GetPaper() const;
// returns number of available paper formats
int GetPaperInfoCount() const;
// returns info about paper format nPaper
- const vcl::PaperInfo& GetPaperInfo( int nPaper ) const;
- // sets current paper to format contained in rInfo
- BOOL SetPaperFromInfo( const vcl::PaperInfo& rInfo );
- // gets info about paper fromat best matching current paper
- const vcl::PaperInfo& GetCurrentPaperInfo() const;
-
+ const PaperInfo& GetPaperInfo( int nPaper ) const;
USHORT GetPaperBinCount() const;
XubString GetPaperBinName( USHORT nPaperBin ) const;
diff --git a/vcl/inc/vcl/prntypes.hxx b/vcl/inc/vcl/prntypes.hxx
index 84ef320de20e..681f4f972a7c 100644
--- a/vcl/inc/vcl/prntypes.hxx
+++ b/vcl/inc/vcl/prntypes.hxx
@@ -33,6 +33,7 @@
#include <tools/string.hxx>
#include <vcl/sv.h>
+#include <i18npool/paper.hxx>
// ---------------
// - Duplex Mode -
@@ -46,33 +47,6 @@ enum DuplexMode { DUPLEX_UNKNOWN, DUPLEX_OFF, DUPLEX_ON };
enum Orientation { ORIENTATION_PORTRAIT, ORIENTATION_LANDSCAPE };
-// ---------
-// - Paper -
-// ---------
-
-typedef USHORT Paper;
-#define PAPER_A3 ((Paper)0)
-#define PAPER_A4 ((Paper)1)
-#define PAPER_A5 ((Paper)2)
-#define PAPER_B4 ((Paper)3)
-#define PAPER_B5 ((Paper)4)
-#define PAPER_LETTER ((Paper)5)
-#define PAPER_LEGAL ((Paper)6)
-#define PAPER_TABLOID ((Paper)7)
-#define PAPER_USER ((Paper)8)
-
-namespace vcl
-{
-struct PaperInfo
-{
- String m_aPaperName; // user readable name of paper
- unsigned long m_nPaperWidth; // width in mm
- unsigned long m_nPaperHeight; // height in mm
-
- PaperInfo() : m_nPaperWidth( 0 ), m_nPaperHeight( 0 ) {}
-};
-}
-
// -------------------
// - QueueInfo-Types -
// -------------------
diff --git a/vcl/inc/vcl/salprn.hxx b/vcl/inc/vcl/salprn.hxx
index a80c5873cbfb..2927215034b5 100644
--- a/vcl/inc/vcl/salprn.hxx
+++ b/vcl/inc/vcl/salprn.hxx
@@ -68,7 +68,7 @@ struct VCL_DLLPUBLIC SalPrinterQueueInfo
class VCL_DLLPUBLIC SalInfoPrinter
{
public:
- std::vector< vcl::PaperInfo > m_aPaperFormats; // all printer supported formats
+ std::vector< PaperInfo > m_aPaperFormats; // all printer supported formats
bool m_bPapersInit; // set to true after InitPaperFormats
bool m_bCompatMetrics;
diff --git a/vcl/inc/vcl/syschild.hxx b/vcl/inc/vcl/syschild.hxx
index 1d4d0fafd7aa..29610e653b9d 100644
--- a/vcl/inc/vcl/syschild.hxx
+++ b/vcl/inc/vcl/syschild.hxx
@@ -46,7 +46,7 @@ class VCL_DLLPUBLIC SystemChildWindow : public Window
{
private:
using Window::ImplInit;
- SAL_DLLPRIVATE void ImplInitSysChild( Window* pParent, WinBits nStyle, SystemWindowData *pData, BOOL bShow = TRUE );
+ SAL_DLLPRIVATE void ImplInitSysChild( Window* pParent, WinBits nStyle, SystemWindowData *pData, BOOL bShow = FALSE );
// Copy assignment is forbidden and not implemented.
SAL_DLLPRIVATE SystemChildWindow (const SystemChildWindow &);
diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx
index 6f7c18ac2730..3f05383d4f80 100644
--- a/vcl/inc/vcl/window.hxx
+++ b/vcl/inc/vcl/window.hxx
@@ -983,6 +983,8 @@ public:
void DrawSelectionBackground( const Rectangle& rRect, USHORT highlight, BOOL bChecked, BOOL bDrawBorder, BOOL bDrawExtBorderOnly );
// the same, but fills a passed Color with a text color complementing the selection background
void DrawSelectionBackground( const Rectangle& rRect, USHORT highlight, BOOL bChecked, BOOL bDrawBorder, BOOL bDrawExtBorderOnly, Color* pSelectionTextColor );
+ // support rounded edges in the selection rect
+ void DrawSelectionBackground( const Rectangle& rRect, USHORT highlight, BOOL bChecked, BOOL bDrawBorder, BOOL bDrawExtBorderOnly, long nCornerRadius, Color* pSelectionTextColor, Color* pPaintColor );
void ShowTracking( const Rectangle& rRect,
USHORT nFlags = SHOWTRACK_SMALL );
diff --git a/vcl/prj/build.lst b/vcl/prj/build.lst
index cd6d32dc3d2a..aea5211d074a 100644
--- a/vcl/prj/build.lst
+++ b/vcl/prj/build.lst
@@ -1,4 +1,4 @@
-vc vcl : apple_remote BOOST:boost rsc sot ucbhelper unotools ICU:icu i18npool i18nutil unoil ridljar X11_EXTENSIONS:x11_extensions offuh basegfx basebmp tools transex3 icc SO:print_header cpputools NULL
+vc vcl : l10n apple_remote BOOST:boost rsc sot ucbhelper unotools ICU:icu i18npool i18nutil unoil ridljar X11_EXTENSIONS:x11_extensions offuh basegfx basebmp tools transex3 icc SO:print_header cpputools NULL
vc vcl usr1 - all vc_mkout NULL
vc vcl\inc nmake - all vc_inc NULL
vc vcl\source\glyphs nmake - all vc_glyphs vc_inc NULL
diff --git a/vcl/source/gdi/base14.cxx b/vcl/source/gdi/base14.cxx
index 7bdeb9f1fec7..17e616d196b4 100644
--- a/vcl/source/gdi/base14.cxx
+++ b/vcl/source/gdi/base14.cxx
@@ -646,7 +646,7 @@ const PDFWriterImpl::BuiltinFont PDFWriterImpl::m_aBuiltinFonts[ 14 ] = {
"ZapfDingbats", // PSName
820, -143, // ascend, descend
FAMILY_DONTKNOW, // family style
- RTL_TEXTENCODING_SYMBOL, // charset
+ RTL_TEXTENCODING_ADOBE_DINGBATS, // charset
PITCH_VARIABLE, // pitch
WIDTH_NORMAL, // width type
WEIGHT_NORMAL, // weight type
diff --git a/vcl/source/gdi/impimagetree.cxx b/vcl/source/gdi/impimagetree.cxx
index 64cddece1199..9e1378f22326 100644
--- a/vcl/source/gdi/impimagetree.cxx
+++ b/vcl/source/gdi/impimagetree.cxx
@@ -102,8 +102,11 @@ void loadFromStream(
rtl::OUString const & path, BitmapEx & bitmap)
{
std::auto_ptr< SvStream > s(wrapStream(stream));
- if (path.endsWithAsciiL(RTL_CONSTASCII_STRINGPARAM(".png"))) {
- bitmap = vcl::PNGReader(*s).Read();
+ if (path.endsWithAsciiL(RTL_CONSTASCII_STRINGPARAM(".png")))
+ {
+ vcl::PNGReader aPNGReader( *s );
+ aPNGReader.SetIgnoreGammaChunk( sal_True );
+ bitmap = aPNGReader.Read();
} else {
*s >> bitmap;
}
diff --git a/vcl/source/gdi/pdfwriter.cxx b/vcl/source/gdi/pdfwriter.cxx
index 9293ebf1aab2..4959a505ec41 100644
--- a/vcl/source/gdi/pdfwriter.cxx
+++ b/vcl/source/gdi/pdfwriter.cxx
@@ -246,9 +246,12 @@ void PDFWriter::DrawBitmapEx( const Point& rDestPt, const Size& rDestSize, const
void PDFWriter::DrawBitmapEx( const Point& rDestPt, const Size& rDestSize, const Point& rSrcPtPixel, const Size& rSrcSizePixel, const BitmapEx& rBitmap )
{
+ if ( !!rBitmap )
+ {
BitmapEx aBitmap( rBitmap );
aBitmap.Crop( Rectangle( rSrcPtPixel, rSrcSizePixel ) );
((PDFWriterImpl*)pImplementation)->drawBitmap( rDestPt, rDestSize, aBitmap );
+ }
}
void PDFWriter::DrawMask( const Point& rDestPt, const Bitmap& rBitmap, const Color& rMaskColor )
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 05067ee2d024..3f648fda8589 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -6,9 +6,6 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: pdfwriter_impl.cxx,v $
- * $Revision: 1.132.72.2 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -1930,7 +1927,7 @@ static ImplDevFontAttributes GetDevFontAttributes( const PDFWriterImpl::BuiltinF
aDFA.maName = String::CreateFromAscii( rBuiltin.m_pName );
aDFA.maStyleName = String::CreateFromAscii( rBuiltin.m_pStyleName );
aDFA.meFamily = rBuiltin.m_eFamily;
- aDFA.mbSymbolFlag = (rBuiltin.m_eCharSet == RTL_TEXTENCODING_SYMBOL);
+ aDFA.mbSymbolFlag = (rBuiltin.m_eCharSet != RTL_TEXTENCODING_MS_1252 );
aDFA.mePitch = rBuiltin.m_ePitch;
aDFA.meWeight = rBuiltin.m_eWeight;
aDFA.meItalic = rBuiltin.m_eItalic;
@@ -2033,7 +2030,7 @@ PDFSalLayout::PDFSalLayout( PDFWriterImpl& rPDFWriterImpl,
mrBuiltinFont( rBuiltinFont ),
mnPixelPerEM( nPixelPerEM )
{
- mbIsSymbolFont = (rBuiltinFont.m_eCharSet == RTL_TEXTENCODING_SYMBOL);
+ mbIsSymbolFont = (rBuiltinFont.m_eCharSet != RTL_TEXTENCODING_MS_1252);
SetOrientation( nOrientation );
}
@@ -2045,41 +2042,35 @@ bool PDFSalLayout::LayoutText( ImplLayoutArgs& rArgs )
SetText( aText );
SetUnitsPerPixel( 1000 );
- rtl_UnicodeToTextConverter aConv = rtl_createTextToUnicodeConverter( RTL_TEXTENCODING_MS_1252 );
+ rtl_UnicodeToTextConverter aConv = rtl_createTextToUnicodeConverter( mrBuiltinFont.m_eCharSet );
Point aNewPos( 0, 0 );
bool bRightToLeft;
for( int nCharPos = -1; rArgs.GetNextPos( &nCharPos, &bRightToLeft ); )
{
// TODO: handle unicode surrogates
- // on the other hand builtin fonts don't support them anyway
+ // on the other hand the PDF builtin fonts don't support them anyway
sal_Unicode cChar = rArgs.mpStr[ nCharPos ];
if( bRightToLeft )
cChar = static_cast<sal_Unicode>(GetMirroredChar( cChar ));
- if( cChar & 0xff00 )
+ if( 1 ) // TODO: shortcut for ASCII?
{
- // some characters can be used by conversion
- if( (cChar >= 0xf000) && mbIsSymbolFont )
- cChar -= 0xf000;
- else
- {
- sal_Char aBuf[4];
- sal_uInt32 nInfo;
- sal_Size nSrcCvtChars;
-
- sal_Size nConv = rtl_convertUnicodeToText( aConv,
- NULL,
- &cChar, 1,
- aBuf, 1,
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR,
- &nInfo, &nSrcCvtChars );
- // check whether conversion was possible
- // else fallback font is needed as the standard fonts
- // are handled via WinAnsi encoding
- if( nConv > 0 )
- cChar = ((sal_Unicode)aBuf[0]) & 0x00ff;
- }
+ sal_Char aBuf[4];
+ sal_uInt32 nInfo;
+ sal_Size nSrcCvtChars;
+
+ sal_Size nConv = rtl_convertUnicodeToText( aConv,
+ NULL,
+ &cChar, 1,
+ aBuf, sizeof(aBuf)/sizeof(*aBuf),
+ RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR,
+ &nInfo, &nSrcCvtChars );
+ // check whether conversion was possible
+ // else fallback font is needed as the standard fonts
+ // are handled via WinAnsi encoding
+ if( nConv > 0 )
+ cChar = ((sal_Unicode)aBuf[0]) & 0x00ff;
}
if( cChar & 0xff00 )
{
@@ -2088,7 +2079,7 @@ bool PDFSalLayout::LayoutText( ImplLayoutArgs& rArgs )
}
long nGlyphWidth = (long)mrBuiltinFont.m_aWidths[cChar] * mnPixelPerEM;
- long nGlyphFlags = (nGlyphWidth > 0) ? 0 : GlyphItem::IS_IN_CLUSTER;
+ long nGlyphFlags = 0; // builtin fonts don't have diacritic glyphs
if( bRightToLeft )
nGlyphFlags |= GlyphItem::IS_RTL_GLYPH;
// TODO: get kerning from builtin fonts
@@ -2782,7 +2773,7 @@ sal_Int32 PDFWriterImpl::emitBuiltinFont( const ImplFontData* pFont, sal_Int32 n
"<</Type/Font/Subtype/Type1/BaseFont/" );
appendName( pBuiltinFont->m_pPSName, aLine );
aLine.append( "\n" );
- if( pBuiltinFont->m_eCharSet != RTL_TEXTENCODING_SYMBOL )
+ if( pBuiltinFont->m_eCharSet == RTL_TEXTENCODING_MS_1252 )
aLine.append( "/Encoding/WinAnsiEncoding\n" );
aLine.append( ">>\nendobj\n\n" );
CHECK_RETURN( writeBuffer( aLine.getStr(), aLine.getLength() ) );
diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx
index 56c9025018b9..834116a9ffe9 100644
--- a/vcl/source/gdi/pngread.cxx
+++ b/vcl/source/gdi/pngread.cxx
@@ -156,6 +156,7 @@ private:
BOOL mbIDAT; // TRUE if finished with enough IDAT chunks
BOOL mbGamma; // TRUE if Gamma Correction available
BOOL mbpHYs; // TRUE if pysical size of pixel available
+ sal_Bool mbIgnoreGammaChunk;
bool ReadNextChunk();
void ReadRemainingChunks();
@@ -186,6 +187,7 @@ public:
BitmapEx GetBitmapEx( const Size& rPreviewSizeHint );
const std::vector< PNGReader::ChunkData >& GetAllChunks();
+ void SetIgnoreGammaChunk( sal_Bool bIgnore ){ mbIgnoreGammaChunk = bIgnore; };
};
// ------------------------------------------------------------------------------
@@ -205,8 +207,9 @@ PNGReaderImpl::PNGReaderImpl( SvStream& rPNGStream )
mbzCodecInUse ( sal_False ),
mbStatus( TRUE),
mbIDAT( FALSE ),
- mbGamma ( sal_False ),
- mbpHYs ( sal_False )
+ mbGamma ( sal_False ),
+ mbpHYs ( sal_False ),
+ mbIgnoreGammaChunk ( sal_False )
{
// prepare the PNG data stream
mnOrigStreamMode = mrPNGStream.GetNumberFormatInt();
@@ -382,9 +385,9 @@ BitmapEx PNGReaderImpl::GetBitmapEx( const Size& rPreviewSizeHint )
break;
case PNGCHUNK_gAMA : // the gamma chunk must precede
- {
- if ( mbIDAT == FALSE ) // the 'IDAT' and also the
- ImplGetGamma(); // 'PLTE'(if available )
+ { // the 'IDAT' and also the 'PLTE'(if available )
+ if ( !mbIgnoreGammaChunk && ( mbIDAT == FALSE ) )
+ ImplGetGamma();
}
break;
@@ -1568,4 +1571,12 @@ const std::vector< vcl::PNGReader::ChunkData >& PNGReader::GetChunks() const
return mpImpl->GetAllChunks();
}
+// ------------------------------------------------------------------------
+
+void PNGReader::SetIgnoreGammaChunk( sal_Bool b )
+{
+ mpImpl->SetIgnoreGammaChunk( b );
+}
+
+
} // namespace vcl
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 0a5fbb189885..937d966b3978 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -70,44 +70,22 @@ int nImplSysDialog = 0;
// =======================================================================
-#define PAPER_SLOPPY 50 // Bigger sloppy value as PaperInfo uses only mm accuracy!
-#define PAPER_COUNT 9
-
-// Use more accurate metric values for Letter/Legal/Tabloid paper formats
-static long ImplPaperFormats[PAPER_COUNT*2] =
-{
- 29700, 42000, // A3
- 21000, 29700, // A4
- 14800, 21000, // A5
- 25000, 35300, // B4
- 17600, 25000, // B5
- 21590, 27940, // Letter
- 21590, 35570, // Legal
- 27960, 43130, // Tabloid
- 0, 0 // USER
-};
-
-// =======================================================================
-
-Paper ImplGetPaperFormat( long nWidth100thMM, long nHeight100thMM )
+namespace
{
- USHORT i;
-
- for( i = 0; i < PAPER_COUNT; i++ )
+ static Paper ImplGetPaperFormat( long nWidth100thMM, long nHeight100thMM )
{
- if ( (ImplPaperFormats[i*2] == nWidth100thMM) &&
- (ImplPaperFormats[i*2+1] == nHeight100thMM) )
- return (Paper)i;
+ PaperInfo aInfo(nWidth100thMM, nHeight100thMM);
+ aInfo.doSloppyFit();
+ return aInfo.getPaper();
}
- for( i = 0; i < PAPER_COUNT; i++ )
+// -----------------------------------------------------------------------
+
+ static const PaperInfo& ImplGetEmptyPaper()
{
- if ( (Abs( ImplPaperFormats[i*2]-nWidth100thMM ) < PAPER_SLOPPY) &&
- (Abs( ImplPaperFormats[i*2+1]-nHeight100thMM ) < PAPER_SLOPPY) )
- return (Paper)i;
+ static PaperInfo aInfo(PAPER_USER);
+ return aInfo;
}
-
- return PAPER_USER;
}
// =======================================================================
@@ -121,8 +99,9 @@ void ImplUpdateJobSetupPaper( JobSetup& rJobSetup )
if ( pConstData->mePaperFormat != PAPER_USER )
{
ImplJobSetup* pData = rJobSetup.ImplGetData();
- pData->mnPaperWidth = ImplPaperFormats[((USHORT)pConstData->mePaperFormat)*2];
- pData->mnPaperHeight = ImplPaperFormats[((USHORT)pConstData->mePaperFormat)*2+1];
+ PaperInfo aInfo(pConstData->mePaperFormat);
+ pData->mnPaperWidth = aInfo.getWidth();
+ pData->mnPaperHeight = aInfo.getHeight();
}
}
else if ( pConstData->mePaperFormat == PAPER_USER )
@@ -997,17 +976,6 @@ USHORT Printer::GetPaperBin() const
// -----------------------------------------------------------------------
-static BOOL ImplPaperSizeEqual( unsigned long nPaperWidth1, unsigned long nPaperHeight1,
- unsigned long nPaperWidth2, unsigned long nPaperHeight2 )
-{
- const long PAPER_ACCURACY = 1; // 1.0 mm accuracy
-
- return ( (Abs( long(nPaperWidth1)-long(nPaperWidth2) ) <= PAPER_ACCURACY ) &&
- (Abs( long(nPaperHeight1)-long(nPaperHeight2) ) <= PAPER_ACCURACY ) );
-}
-
-// -----------------------------------------------------------------------
-
// Map user paper format to a available printer paper formats
void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup )
{
@@ -1016,21 +984,17 @@ void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup )
int nLandscapeAngle = GetLandscapeAngle();
int nPaperCount = GetPaperInfoCount();
- unsigned long nPaperWidth = pSetupData->mnPaperWidth/100;
- unsigned long nPaperHeight = pSetupData->mnPaperHeight/100;
+ PaperInfo aInfo(pSetupData->mnPaperWidth, pSetupData->mnPaperHeight);
// Alle Papierformate vergleichen und ein passendes raussuchen
for ( int i = 0; i < nPaperCount; i++ )
{
- const vcl::PaperInfo& rPaperInfo = GetPaperInfo( i );
+ const PaperInfo& rPaperInfo = GetPaperInfo( i );
- if ( ImplPaperSizeEqual( rPaperInfo.m_nPaperWidth,
- rPaperInfo.m_nPaperHeight,
- nPaperWidth,
- nPaperHeight ) )
+ if ( aInfo.sloppyEqual(rPaperInfo) )
{
- pSetupData->mePaperFormat = ImplGetPaperFormat( rPaperInfo.m_nPaperWidth*100,
- rPaperInfo.m_nPaperHeight*100 );
+ pSetupData->mePaperFormat = ImplGetPaperFormat( rPaperInfo.getWidth(),
+ rPaperInfo.getHeight() );
break;
}
}
@@ -1042,17 +1006,17 @@ void Printer::ImplFindPaperFormatForUserSize( JobSetup& aJobSetup )
nLandscapeAngle != 0 &&
HasSupport( SUPPORT_SET_ORIENTATION ))
{
+
+ PaperInfo aRotatedInfo(pSetupData->mnPaperHeight, pSetupData->mnPaperWidth);
+
for ( int i = 0; i < nPaperCount; i++ )
{
- const vcl::PaperInfo& rPaperInfo = GetPaperInfo( i );
+ const PaperInfo& rPaperInfo = GetPaperInfo( i );
- if ( ImplPaperSizeEqual( rPaperInfo.m_nPaperWidth,
- rPaperInfo.m_nPaperHeight,
- nPaperHeight,
- nPaperWidth ))
+ if ( aRotatedInfo.sloppyEqual( rPaperInfo ) )
{
- pSetupData->mePaperFormat = ImplGetPaperFormat( rPaperInfo.m_nPaperWidth*100,
- rPaperInfo.m_nPaperHeight*100 );
+ pSetupData->mePaperFormat = ImplGetPaperFormat( rPaperInfo.getWidth(),
+ rPaperInfo.getHeight() );
break;
}
}
@@ -1073,8 +1037,9 @@ BOOL Printer::SetPaper( Paper ePaper )
pSetupData->mePaperFormat = ePaper;
if ( ePaper != PAPER_USER )
{
- pSetupData->mnPaperWidth = ImplPaperFormats[((USHORT)ePaper)*2];
- pSetupData->mnPaperHeight = ImplPaperFormats[((USHORT)ePaper)*2+1];
+ PaperInfo aInfo(ePaper);
+ pSetupData->mnPaperWidth = aInfo.getWidth();
+ pSetupData->mnPaperHeight = aInfo.getHeight();
}
if ( IsDisplayPrinter() )
@@ -1110,9 +1075,8 @@ BOOL Printer::SetPaperSizeUser( const Size& rSize )
if ( mbInPrintPage )
return FALSE;
- MapMode aMap100thMM( MAP_100TH_MM );
Size aPixSize = LogicToPixel( rSize );
- Size aPageSize = PixelToLogic( aPixSize, aMap100thMM );
+ Size aPageSize = PixelToLogic( aPixSize, MAP_100TH_MM );
if ( (maJobSetup.ImplGetConstData()->mePaperFormat != PAPER_USER) ||
(maJobSetup.ImplGetConstData()->mnPaperWidth != aPageSize.Width()) ||
(maJobSetup.ImplGetConstData()->mnPaperHeight != aPageSize.Height()) )
@@ -1150,15 +1114,6 @@ BOOL Printer::SetPaperSizeUser( const Size& rSize )
return TRUE;
}
-
-// -----------------------------------------------------------------------
-
-static const vcl::PaperInfo& ImplGetEmptyPaper()
-{
- static vcl::PaperInfo aInfo;
- return aInfo;
-}
-
// -----------------------------------------------------------------------
int Printer::GetPaperInfoCount() const
@@ -1172,7 +1127,7 @@ int Printer::GetPaperInfoCount() const
// -----------------------------------------------------------------------
-const vcl::PaperInfo& Printer::GetPaperInfo( int nPaper ) const
+const PaperInfo& Printer::GetPaperInfo( int nPaper ) const
{
if( ! mpInfoPrinter )
return ImplGetEmptyPaper();
@@ -1185,17 +1140,6 @@ const vcl::PaperInfo& Printer::GetPaperInfo( int nPaper ) const
// -----------------------------------------------------------------------
-BOOL Printer::SetPaperFromInfo( const vcl::PaperInfo& rInfo )
-{
- MapMode aMap( MAP_MM );
- Size aSize( rInfo.m_nPaperWidth, rInfo.m_nPaperHeight );
- aSize = LogicToPixel( aSize, aMap );
- aSize = PixelToLogic( aSize );
- return SetPaperSizeUser( aSize );
-}
-
-// -----------------------------------------------------------------------
-
DuplexMode Printer::GetDuplexMode() const
{
return mpInfoPrinter ? mpInfoPrinter->GetDuplexMode( maJobSetup.ImplGetConstData() ) : DUPLEX_UNKNOWN;
@@ -1210,38 +1154,6 @@ int Printer::GetLandscapeAngle() const
// -----------------------------------------------------------------------
-const vcl::PaperInfo& Printer::GetCurrentPaperInfo() const
-{
- if( ! mpInfoPrinter )
- return ImplGetEmptyPaper();
- if( ! mpInfoPrinter->m_bPapersInit )
- mpInfoPrinter->InitPaperFormats( maJobSetup.ImplGetConstData() );
- if( mpInfoPrinter->m_aPaperFormats.empty() )
- return ImplGetEmptyPaper();
-
- MapMode aMap( MAP_MM );
- Size aSize = PixelToLogic( GetPaperSizePixel(), aMap );
- int nMatch = -1;
- long nDelta = 0;
- for( unsigned int i = 0; i < mpInfoPrinter->m_aPaperFormats.size(); i++ )
- {
- long nW = mpInfoPrinter->m_aPaperFormats[i].m_nPaperWidth;
- long nH = mpInfoPrinter->m_aPaperFormats[i].m_nPaperHeight;
- if( nW >= (aSize.Width()-1) && nH >= (aSize.Height()-1) )
- {
- long nCurDelta = (nW - aSize.Width())*(nW - aSize.Width()) + (nH - aSize.Height() )*(nH - aSize.Height() );
- if( nMatch == -1 || nCurDelta < nDelta )
- {
- nMatch = i;
- nDelta = nCurDelta;
- }
- }
- }
- return nMatch != -1 ? mpInfoPrinter->m_aPaperFormats[nMatch] : ImplGetEmptyPaper();
-}
-
-// -----------------------------------------------------------------------
-
Paper Printer::GetPaper() const
{
return maJobSetup.ImplGetConstData()->mePaperFormat;
diff --git a/vcl/source/window/keycod.cxx b/vcl/source/window/keycod.cxx
index 77af28241cb3..21030b9422fb 100644
--- a/vcl/source/window/keycod.cxx
+++ b/vcl/source/window/keycod.cxx
@@ -49,27 +49,27 @@
// =======================================================================
-static USHORT aImplKeyFuncTab[(KEYFUNC_FRONT+1)*3] =
+static USHORT aImplKeyFuncTab[(KEYFUNC_FRONT+1)*4] =
{
- 0, 0, 0, // KEYFUNC_DONTKNOW
- KEY_N | KEY_MOD1, 0, 0, // KEYFUNC_NEW
- KEY_O | KEY_MOD1, KEY_OPEN, 0, // KEYFUNC_OPEN
- KEY_S | KEY_MOD1, 0, 0, // KEYFUNC_SAVE
- 0, 0, 0, // KEYFUNC_SAVEAS
- KEY_P | KEY_MOD1, 0, 0, // KEYFUNC_PRINT
- KEY_W | KEY_MOD1, KEY_F4 | KEY_MOD1, 0, // KEYFUNC_CLOSE
- KEY_Q | KEY_MOD1, KEY_F4 | KEY_MOD2, 0, // KEYFUNC_QUIT
- KEY_X | KEY_MOD1, KEY_DELETE | KEY_SHIFT, KEY_CUT, // KEYFUNC_CUT
- KEY_C | KEY_MOD1, KEY_INSERT | KEY_MOD1, KEY_COPY, // KEYFUNC_COPY
- KEY_V | KEY_MOD1, KEY_INSERT | KEY_SHIFT, KEY_PASTE, // KEYFUNC_PASTE
- KEY_Z | KEY_MOD1, KEY_BACKSPACE | KEY_MOD2, KEY_UNDO, // KEYFUNC_UNDO
- 0, 0, 0, // KEYFUNC_REDO
- KEY_DELETE, 0, 0, // KEYFUNC_DELETE
- KEY_REPEAT, 0, 0, // KEYFUNC_REPEAT
- KEY_F | KEY_MOD1, KEY_FIND, 0, // KEYFUNC_FIND
- KEY_F | KEY_SHIFT | KEY_MOD1, KEY_SHIFT | KEY_FIND, 0, // KEYFUNC_FINDBACKWARD
- KEY_RETURN | KEY_MOD2, 0, 0, // KEYFUNC_PROPERTIES
- 0, 0, 0 // KEYFUNC_FRONT
+ 0, 0, 0, 0, // KEYFUNC_DONTKNOW
+ KEY_N | KEY_MOD1, 0, 0, 0, // KEYFUNC_NEW
+ KEY_O | KEY_MOD1, KEY_OPEN, 0, 0, // KEYFUNC_OPEN
+ KEY_S | KEY_MOD1, 0, 0, 0, // KEYFUNC_SAVE
+ 0, 0, 0, 0, // KEYFUNC_SAVEAS
+ KEY_P | KEY_MOD1, 0, 0, 0, // KEYFUNC_PRINT
+ KEY_W | KEY_MOD1, KEY_F4 | KEY_MOD1, 0, 0, // KEYFUNC_CLOSE
+ KEY_Q | KEY_MOD1, KEY_F4 | KEY_MOD2, 0, 0, // KEYFUNC_QUIT
+ KEY_X | KEY_MOD1, KEY_DELETE | KEY_SHIFT, KEY_CUT, 0, // KEYFUNC_CUT
+ KEY_C | KEY_MOD1, KEY_INSERT | KEY_MOD1, KEY_COPY, 0, // KEYFUNC_COPY
+ KEY_V | KEY_MOD1, KEY_INSERT | KEY_SHIFT, KEY_PASTE, 0, // KEYFUNC_PASTE
+ KEY_Z | KEY_MOD1, KEY_BACKSPACE | KEY_MOD2, KEY_UNDO, 0, // KEYFUNC_UNDO
+ 0, 0, 0, 0, // KEYFUNC_REDO
+ KEY_DELETE, 0, 0, 0, // KEYFUNC_DELETE
+ KEY_REPEAT, 0, 0, 0, // KEYFUNC_REPEAT
+ KEY_F | KEY_MOD1, KEY_FIND, 0, 0, // KEYFUNC_FIND
+ KEY_F | KEY_SHIFT | KEY_MOD1, KEY_SHIFT | KEY_FIND, 0, 0, // KEYFUNC_FINDBACKWARD
+ KEY_RETURN | KEY_MOD2, 0, 0, 0, // KEYFUNC_PROPERTIES
+ 0, 0, 0, 0 // KEYFUNC_FRONT
};
// -----------------------------------------------------------------------
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index adbc2a8de06e..c827905e94e6 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2487,23 +2487,8 @@ static void ImplPaintCheckBackground( Window* i_pWindow, const Rectangle& i_rRec
if( ! bNativeOk )
{
const StyleSettings& rSettings = i_pWindow->GetSettings().GetStyleSettings();
- if( i_bHighlight )
- {
- i_pWindow->Push( PUSH_ALL );
- Color aCol = rSettings.GetMenuHighlightTextColor();
- i_pWindow->SetFillColor( rSettings.GetMenuHighlightTextColor() );
- if( aCol.IsDark() )
- aCol.IncreaseLuminance( 128 );
- else
- aCol.DecreaseLuminance( 128 );
- i_pWindow->SetLineColor( aCol );
- Polygon aPoly( i_rRect );
- PolyPolygon aPolyPoly( aPoly );
- i_pWindow->DrawTransparent( aPolyPoly, 20 );
- i_pWindow->Pop();
- }
- else
- i_pWindow->DrawSelectionBackground( i_rRect, 1, FALSE, TRUE, FALSE );
+ Color aColor( i_bHighlight ? rSettings.GetMenuHighlightTextColor() : rSettings.GetHighlightColor() );
+ i_pWindow->DrawSelectionBackground( i_rRect, 0, i_bHighlight, TRUE, FALSE, 2, NULL, &aColor );
}
}
@@ -5056,11 +5041,11 @@ MenuBarWindow::MenuBarWindow( Window* pParent ) :
if( pResMgr )
{
- Bitmap aBitmap( ResId( SV_RESID_BITMAP_CLOSEDOC, *pResMgr ) );
- Bitmap aBitmapHC( ResId( SV_RESID_BITMAP_CLOSEDOCHC, *pResMgr ) );
+ BitmapEx aBitmap( ResId( SV_RESID_BITMAP_CLOSEDOC, *pResMgr ) );
+ BitmapEx aBitmapHC( ResId( SV_RESID_BITMAP_CLOSEDOCHC, *pResMgr ) );
- aCloser.maImage = Image( aBitmap, Color( COL_LIGHTMAGENTA ) );
- aCloser.maImageHC = Image( aBitmapHC, Color( COL_LIGHTMAGENTA ) );
+ aCloser.maImage = Image( aBitmap );
+ aCloser.maImageHC = Image( aBitmapHC );
aCloser.SetOutStyle( TOOLBOX_STYLE_FLAT );
aCloser.SetBackground();
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 07d56588c80e..bb1f428c6626 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -3378,7 +3378,7 @@ static void ImplDrawButton( ToolBox* pThis, const Rectangle &rRect, USHORT highl
}
if( !bNativeOk )
- pThis->DrawSelectionBackground( rRect, bIsWindow ? 3 : highlight, bChecked, TRUE, bIsWindow );
+ pThis->DrawSelectionBackground( rRect, bIsWindow ? 3 : highlight, bChecked, TRUE, bIsWindow, 2, NULL, NULL );
}
void ToolBox::ImplDrawItem( USHORT nPos, BOOL bHighlight, BOOL bPaint, BOOL bLayout )
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 676375db10bf..279775d712e4 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -9240,19 +9240,34 @@ BOOL Window::ImplGetCurrentBackgroundColor( Color& rCol )
void Window::DrawSelectionBackground( const Rectangle& rRect, USHORT highlight, BOOL bChecked, BOOL bDrawBorder, BOOL bDrawExtBorderOnly )
{
- DrawSelectionBackground( rRect, highlight, bChecked, bDrawBorder, bDrawExtBorderOnly, NULL );
+ DrawSelectionBackground( rRect, highlight, bChecked, bDrawBorder, bDrawExtBorderOnly, 0, NULL, NULL );
}
void Window::DrawSelectionBackground( const Rectangle& rRect, USHORT highlight, BOOL bChecked, BOOL bDrawBorder, BOOL bDrawExtBorderOnly, Color* pSelectionTextColor )
{
+ DrawSelectionBackground( rRect, highlight, bChecked, bDrawBorder, bDrawExtBorderOnly, 0, pSelectionTextColor, NULL );
+}
+
+void Window::DrawSelectionBackground( const Rectangle& rRect,
+ USHORT highlight,
+ BOOL bChecked,
+ BOOL bDrawBorder,
+ BOOL bDrawExtBorderOnly,
+ long nCornerRadius,
+ Color* pSelectionTextColor,
+ Color* pPaintColor
+ )
+{
if( rRect.IsEmpty() )
return;
+ bool bRoundEdges = nCornerRadius > 0;
+
const StyleSettings& rStyles = GetSettings().GetStyleSettings();
// colors used for item highlighting
- Color aSelectionBorderCol( rStyles.GetHighlightColor() );
+ Color aSelectionBorderCol( pPaintColor ? *pPaintColor : rStyles.GetHighlightColor() );
Color aSelectionFillCol( aSelectionBorderCol );
BOOL bDark = rStyles.GetFaceColor().IsDark();
@@ -9261,7 +9276,7 @@ void Window::DrawSelectionBackground( const Rectangle& rRect, USHORT highlight,
int c1 = aSelectionBorderCol.GetLuminance();
int c2 = GetDisplayBackground().GetColor().GetLuminance();
- if( !bDark && !bBright && abs( c2-c1 ) < 75 )
+ if( !bDark && !bBright && abs( c2-c1 ) < (pPaintColor ? 40 : 75) )
{
// constrast too low
USHORT h,s,b;
@@ -9272,6 +9287,14 @@ void Window::DrawSelectionBackground( const Rectangle& rRect, USHORT highlight,
aSelectionBorderCol = aSelectionFillCol;
}
+ if( bRoundEdges )
+ {
+ if( aSelectionBorderCol.IsDark() )
+ aSelectionBorderCol.IncreaseLuminance( 128 );
+ else
+ aSelectionBorderCol.DecreaseLuminance( 128 );
+ }
+
Rectangle aRect( rRect );
if( bDrawExtBorderOnly )
{
@@ -9294,7 +9317,7 @@ void Window::DrawSelectionBackground( const Rectangle& rRect, USHORT highlight,
if( bDark )
aSelectionFillCol = COL_BLACK;
else
- nPercent = 80; // just checked (light)
+ nPercent = bRoundEdges ? 90 : 80; // just checked (light)
}
else
{
@@ -9309,7 +9332,7 @@ void Window::DrawSelectionBackground( const Rectangle& rRect, USHORT highlight,
nPercent = 0;
}
else
- nPercent = 20; // selected, pressed or checked ( very dark )
+ nPercent = bRoundEdges ? 50 : 20; // selected, pressed or checked ( very dark )
}
else if( bChecked || highlight == 1 )
{
@@ -9322,7 +9345,7 @@ void Window::DrawSelectionBackground( const Rectangle& rRect, USHORT highlight,
nPercent = 0;
}
else
- nPercent = 35; // selected, pressed or checked ( very dark )
+ nPercent = bRoundEdges ? 70 : 35; // selected, pressed or checked ( very dark )
}
else
{
@@ -9338,7 +9361,7 @@ void Window::DrawSelectionBackground( const Rectangle& rRect, USHORT highlight,
nPercent = 0;
}
else
- nPercent = 70; // selected ( dark )
+ nPercent = bRoundEdges ? 80 : 70; // selected ( dark )
}
}
@@ -9368,9 +9391,18 @@ void Window::DrawSelectionBackground( const Rectangle& rRect, USHORT highlight,
}
else
{
- Polygon aPoly( aRect );
- PolyPolygon aPolyPoly( aPoly );
- DrawTransparent( aPolyPoly, nPercent );
+ if( bRoundEdges )
+ {
+ Polygon aPoly( aRect, nCornerRadius, nCornerRadius );
+ PolyPolygon aPolyPoly( aPoly );
+ DrawTransparent( aPolyPoly, nPercent );
+ }
+ else
+ {
+ Polygon aPoly( aRect );
+ PolyPolygon aPolyPoly( aPoly );
+ DrawTransparent( aPolyPoly, nPercent );
+ }
}
SetFillColor( oldFillCol );
diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx
index 0a738f829cc8..b55798608b37 100644
--- a/vcl/unx/gtk/app/gtkdata.cxx
+++ b/vcl/unx/gtk/app/gtkdata.cxx
@@ -126,14 +126,18 @@ void signalScreenSizeChanged( GdkScreen* pScreen, gpointer data )
pDisp->screenSizeChanged( pScreen );
}
+void signalMonitorsChanged( GdkScreen* pScreen, gpointer data )
+{
+ GtkSalDisplay* pDisp = (GtkSalDisplay*)data;
+ pDisp->monitorsChanged( pScreen );
+}
+
}
GdkFilterReturn GtkSalDisplay::filterGdkEvent( GdkXEvent* sys_event,
GdkEvent*,
gpointer data )
{
- GTK_YIELD_GRAB();
-
GdkFilterReturn aFilterReturn = GDK_FILTER_CONTINUE;
XEvent *pEvent = (XEvent *)sys_event;
@@ -144,6 +148,8 @@ GdkFilterReturn GtkSalDisplay::filterGdkEvent( GdkXEvent* sys_event,
CallEventCallback( pEvent, sizeof( XEvent ) ) )
aFilterReturn = GDK_FILTER_REMOVE;
+ GTK_YIELD_GRAB();
+
if (pDisplay->GetDisplay() == pEvent->xany.display )
{
// #i53471# gtk has no callback mechanism that lets us be notified
@@ -192,6 +198,8 @@ void GtkSalDisplay::screenSizeChanged( GdkScreen* pScreen )
{
rSD.m_aSize = Size( gdk_screen_get_width( pScreen ),
gdk_screen_get_height( pScreen ) );
+ if( ! m_aFrames.empty() )
+ m_aFrames.front()->CallCallback( SALEVENT_DISPLAYCHANGED, 0 );
}
}
else
@@ -201,6 +209,36 @@ void GtkSalDisplay::screenSizeChanged( GdkScreen* pScreen )
}
}
+void GtkSalDisplay::monitorsChanged( GdkScreen* pScreen )
+{
+ if( pScreen )
+ {
+ if( gdk_display_get_n_screens(m_pGdkDisplay) == 1 )
+ {
+ int nScreen = gdk_screen_get_number( pScreen );
+ if( nScreen == m_nDefaultScreen ) //To-Do, make m_aXineramaScreens a per-screen thing ?
+ {
+ gint nMonitors = gdk_screen_get_n_monitors(pScreen);
+ m_aXineramaScreens = std::vector<Rectangle>();
+ for (gint i = 0; i < nMonitors; ++i)
+ {
+ GdkRectangle dest;
+ gdk_screen_get_monitor_geometry(pScreen, i, &dest);
+ m_aXineramaScreens.push_back( Rectangle( Point(dest.x,
+ dest.y ), Size( dest.width, dest.height ) ) );
+ }
+ m_bXinerama = m_aXineramaScreens.size() > 1;
+ if( ! m_aFrames.empty() )
+ m_aFrames.front()->CallCallback( SALEVENT_DISPLAYCHANGED, 0 );
+ }
+ else
+ {
+ DBG_ERROR( "monitors for non-default screen changed, extend-me" );
+ }
+ }
+ }
+}
+
void GtkSalDisplay::initScreen( int nScreen ) const
{
if( nScreen < 0 || nScreen >= static_cast<int>(m_aScreens.size()) )
@@ -626,7 +664,10 @@ void GtkXLib::Init()
{
GdkScreen *pScreen = gdk_display_get_screen( pGdkDisp, n );
if( pScreen )
+ {
g_signal_connect( G_OBJECT(pScreen), "size-changed", G_CALLBACK(signalScreenSizeChanged), m_pGtkSalDisplay );
+ g_signal_connect( G_OBJECT(pScreen), "monitors-changed", G_CALLBACK(signalMonitorsChanged), m_pGtkSalDisplay );
+ }
}
}
diff --git a/vcl/unx/gtk/app/gtkinst.cxx b/vcl/unx/gtk/app/gtkinst.cxx
index 2692177c765a..73b4432342bf 100644
--- a/vcl/unx/gtk/app/gtkinst.cxx
+++ b/vcl/unx/gtk/app/gtkinst.cxx
@@ -114,10 +114,9 @@ extern "C"
static bool hookLocks( oslModule pModule )
{
typedef void (*GdkLockFn) (GCallback enter_fn, GCallback leave_fn);
- rtl::OUString aSymbolName( RTL_CONSTASCII_USTRINGPARAM( "gdk_threads_set_lock_functions") );
GdkLockFn gdk_threads_set_lock_functions =
- (GdkLockFn) osl_getFunctionSymbol( pModule, aSymbolName.pData );
+ (GdkLockFn) osl_getAsciiFunctionSymbol( pModule, "gdk_threads_set_lock_functions" );
if ( !gdk_threads_set_lock_functions )
{
#if OSL_DEBUG_LEVEL > 1
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index b4a0974a5c18..9dbb218403d0 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -3435,10 +3435,12 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
// FIXME: need some way of fetching toolbar icon size.
// aStyleSet.SetToolbarIconSize( STYLE_TOOLBAR_ICONSIZE_SMALL );
+ /* #i35482# do not override HC mode per force
// #i59364# high contrast mode
bool bHC = ( aStyleSet.GetFaceColor().IsDark() ||
aStyleSet.GetWindowColor().IsDark() );
aStyleSet.SetHighContrastMode( bHC );
+ */
// finally update the collected settings
rSettings.SetStyleSettings( aStyleSet );
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index 9ad5d8e13705..57f48df66c3c 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -417,6 +417,14 @@ GtkSalFrame::GtkSalFrame( SystemParentData* pSysData )
GtkSalFrame::~GtkSalFrame()
{
+ for( unsigned int i = 0; i < sizeof(m_aGraphics)/sizeof(m_aGraphics[0]); ++i )
+ {
+ if( !m_aGraphics[i].pGraphics )
+ continue;
+ m_aGraphics[i].pGraphics->SetDrawable( None, m_nScreen );
+ m_aGraphics[i].bInUse = false;
+ }
+
if( m_pParent )
m_pParent->m_aChildren.remove( this );
diff --git a/vcl/unx/headless/svpprn.cxx b/vcl/unx/headless/svpprn.cxx
index e9d726464921..c3253ed163e8 100644
--- a/vcl/unx/headless/svpprn.cxx
+++ b/vcl/unx/headless/svpprn.cxx
@@ -73,37 +73,6 @@ inline int PtTo10Mu( int nPoints ) { return (int)((((double)nPoints)*35.27777778
inline int TenMuToPt( int nUnits ) { return (int)((((double)nUnits)/35.27777778)+0.5); }
-static struct
-{
- int width;
- int height;
- const char* name;
- int namelength;
- Paper paper;
-} aPaperTab[] =
-{
- { 29700, 42000, "A3", 2, PAPER_A3 },
- { 21000, 29700, "A4", 2, PAPER_A4 },
- { 14800, 21000, "A5", 2, PAPER_A5 },
- { 25000, 35300, "B4", 2, PAPER_B4 },
- { 17600, 25000, "B5", 2, PAPER_B5 },
- { 21600, 27900, "Letter", 6, PAPER_LETTER },
- { 21600, 35600, "Legal", 5, PAPER_LEGAL },
- { 27900, 43100, "Tabloid", 7, PAPER_TABLOID },
- { 0, 0, "USER", 4, PAPER_USER }
-};
-
-static Paper getPaperType( const String& rPaperName )
-{
- ByteString aPaper( rPaperName, RTL_TEXTENCODING_ISO_8859_1 );
- for( unsigned int i = 0; i < sizeof( aPaperTab )/sizeof( aPaperTab[0] ); i++ )
- {
- if( ! strcmp( aPaper.GetBuffer(), aPaperTab[i].name ) )
- return aPaperTab[i].paper;
- }
- return PAPER_USER;
-}
-
static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData )
{
pJobSetup->meOrientation = (Orientation)(rData.m_eOrientation == orientation::Landscape ? ORIENTATION_LANDSCAPE : ORIENTATION_PORTRAIT);
@@ -113,7 +82,7 @@ static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData )
int width, height;
rData.m_aContext.getPageSize( aPaper, width, height );
- pJobSetup->mePaperFormat = getPaperType( aPaper );
+ pJobSetup->mePaperFormat = PaperInfo::fromPSName(OUStringToOString( aPaper, RTL_TEXTENCODING_ISO_8859_1 ));
pJobSetup->mnPaperWidth = 0;
pJobSetup->mnPaperHeight = 0;
if( pJobSetup->mePaperFormat == PAPER_USER )
@@ -195,7 +164,7 @@ static bool passFileToCommandLine( const String& rFilename, const String& rComma
struct stat aStat;
if( stat( aFilename.GetBuffer(), &aStat ) )
fprintf( stderr, "stat( %s ) failed\n", aFilename.GetBuffer() );
- fprintf( stderr, "Tmp file %s has modes: %o\n", aFilename.GetBuffer(), aStat.st_mode );
+ fprintf( stderr, "Tmp file %s has modes: 0%03lo\n", aFilename.GetBuffer(), (long)aStat.st_mode );
#endif
const char* argv[4];
if( ! ( argv[ 0 ] = getenv( "SHELL" ) ) )
@@ -475,14 +444,9 @@ void PspSalInfoPrinter::InitPaperFormats( const ImplJobSetup* )
for( int i = 0; i < nValues; i++ )
{
const PPDValue* pValue = pKey->getValue( i );
- vcl::PaperInfo aInfo;
- aInfo.m_aPaperName = pValue->m_aOptionTranslation;
- if( ! aInfo.m_aPaperName.Len() )
- aInfo.m_aPaperName = pValue->m_aOption;
int nWidth = 0, nHeight = 0;
m_aJobData.m_pParser->getPaperDimension( pValue->m_aOption, nWidth, nHeight );
- aInfo.m_nPaperWidth = (unsigned long)((PtTo10Mu( nWidth )+50)/100);
- aInfo.m_nPaperHeight = (unsigned long)((PtTo10Mu( nHeight )+50)/100);
+ PaperInfo aInfo(PtTo10Mu( nWidth ), PtTo10Mu( nHeight ));
m_aPaperFormats.push_back( aInfo );
}
}
@@ -628,7 +592,7 @@ BOOL PspSalInfoPrinter::SetData(
TenMuToPt( pJobSetup->mnPaperWidth ),
TenMuToPt( pJobSetup->mnPaperHeight ) );
else
- aPaper = String( ByteString( aPaperTab[ pJobSetup->mePaperFormat ].name ), RTL_TEXTENCODING_ISO_8859_1 );
+ aPaper = rtl::OStringToOUString(PaperInfo::toPSName(pJobSetup->mePaperFormat), RTL_TEXTENCODING_ISO_8859_1);
pKey = aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ) );
pValue = pKey ? pKey->getValue( aPaper ) : NULL;
diff --git a/vcl/unx/headless/svpvd.cxx b/vcl/unx/headless/svpvd.cxx
index 2d7342093e47..3f48584036f6 100644
--- a/vcl/unx/headless/svpvd.cxx
+++ b/vcl/unx/headless/svpvd.cxx
@@ -65,9 +65,14 @@ BOOL SvpSalVirtualDevice::SetSize( long nNewDX, long nNewDY )
if( ! m_aDevice.get() || m_aDevice->getSize() != aDevSize )
{
sal_uInt32 nFormat = SVP_DEFAULT_BITMAP_FORMAT;
+ std::vector< basebmp::Color > aDevPal;
switch( m_nBitCount )
{
- case 1: nFormat = Format::ONE_BIT_MSB_PAL; break;
+ case 1: nFormat = Format::ONE_BIT_MSB_PAL;
+ aDevPal.reserve(2);
+ aDevPal.push_back( basebmp::Color( 0, 0, 0 ) );
+ aDevPal.push_back( basebmp::Color( 0xff, 0xff, 0xff ) );
+ break;
case 4: nFormat = Format::FOUR_BIT_MSB_PAL; break;
case 8: nFormat = Format::EIGHT_BIT_PAL; break;
#ifdef OSL_BIGENDIAN
@@ -78,7 +83,9 @@ BOOL SvpSalVirtualDevice::SetSize( long nNewDX, long nNewDY )
case 24: nFormat = Format::TWENTYFOUR_BIT_TC_MASK; break;
case 32: nFormat = Format::THIRTYTWO_BIT_TC_MASK; break;
}
- m_aDevice = createBitmapDevice( aDevSize, false, nFormat );
+ m_aDevice = aDevPal.empty()
+ ? createBitmapDevice( aDevSize, false, nFormat )
+ : createBitmapDevice( aDevSize, false, nFormat, PaletteMemorySharedVector( new std::vector< basebmp::Color >(aDevPal) ) );
// update device in existing graphics
for( std::list< SvpSalGraphics* >::iterator it = m_aGraphics.begin();
it != m_aGraphics.end(); ++it )
diff --git a/vcl/unx/inc/plugins/gtk/gtkdata.hxx b/vcl/unx/inc/plugins/gtk/gtkdata.hxx
index fd09bcca17e3..da0f95e8623f 100644
--- a/vcl/unx/inc/plugins/gtk/gtkdata.hxx
+++ b/vcl/unx/inc/plugins/gtk/gtkdata.hxx
@@ -85,6 +85,7 @@ public:
void startupNotificationCompleted() { m_bStartupCompleted = true; }
void screenSizeChanged( GdkScreen* );
+ void monitorsChanged( GdkScreen* );
};
diff --git a/vcl/unx/inc/salgdi.h b/vcl/unx/inc/salgdi.h
index bfe25b84d150..16276cdeb5c9 100644
--- a/vcl/unx/inc/salgdi.h
+++ b/vcl/unx/inc/salgdi.h
@@ -87,7 +87,8 @@ protected:
SalColormap *m_pDeleteColormap;
Drawable hDrawable_; // use
int m_nScreen;
- void* pRenderFormat_;
+ void* m_pRenderFormat;
+ XID m_aRenderPicture;
CairoFontsCache m_aCairoFontsCache;
XLIB_Region pPaintRegion_;
@@ -215,14 +216,14 @@ public:
inline const SalVisual& GetVisual() const;
inline Drawable GetDrawable() const { return hDrawable_; }
void SetDrawable( Drawable d, int nScreen );
- inline void* GetXRenderFormat() { return pRenderFormat_; }
- inline void SetXRenderFormat( void* pRenderFormat ) { pRenderFormat_ = pRenderFormat; }
+ XID GetXRenderPicture();
+ void* GetXRenderFormat() const { return m_pRenderFormat; }
+ inline void SetXRenderFormat( void* pRenderFormat ) { m_pRenderFormat = pRenderFormat; }
inline const SalColormap& GetColormap() const { return *m_pColormap; }
using SalGraphics::GetPixel;
inline Pixel GetPixel( SalColor nSalColor ) const;
- int GetScreenNumber() const
- { return m_nScreen; }
+ int GetScreenNumber() const { return m_nScreen; }
// overload all pure virtual methods
virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY );
@@ -248,7 +249,7 @@ public:
virtual void SetROPFillColor( SalROPColor nROPColor );
virtual void SetTextColor( SalColor nSalColor );
- virtual USHORT SetFont( ImplFontSelectData*, int nFallbackLevel );
+ virtual USHORT SetFont( ImplFontSelectData*, int nFallbackLevel );
virtual void GetFontMetric( ImplFontMetricData* );
virtual ULONG GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs );
virtual ImplFontCharMap* GetImplFontCharMap() const;
diff --git a/vcl/unx/kde/kdedata.cxx b/vcl/unx/kde/kdedata.cxx
index 6dae2bd55f33..f29ef1d4ff96 100644
--- a/vcl/unx/kde/kdedata.cxx
+++ b/vcl/unx/kde/kdedata.cxx
@@ -248,7 +248,7 @@ extern "C" {
if( nMajor != 3 || nMinor < 2 || (nMinor == 2 && nMicro < 2) )
{
#if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "unsuitable qt version %d.%d.%d\n", nMajor, nMinor, nMicro );
+ fprintf( stderr, "unsuitable qt version %"SAL_PRIdINT32".%"SAL_PRIdINT32".%"SAL_PRIdINT32"\n", nMajor, nMinor, nMicro );
#endif
return NULL;
}
diff --git a/vcl/unx/kde/salnativewidgets-kde.cxx b/vcl/unx/kde/salnativewidgets-kde.cxx
index 6667520c3982..24358022d6a1 100644
--- a/vcl/unx/kde/salnativewidgets-kde.cxx
+++ b/vcl/unx/kde/salnativewidgets-kde.cxx
@@ -2035,10 +2035,12 @@ void KDESalFrame::UpdateSettings( AllSettings& rSettings )
// Scroll bar size
aStyleSettings.SetScrollBarSize( kapp->style().pixelMetric( QStyle::PM_ScrollBarExtent ) );
+ /* #i35482# do not override HC mode
// #i59364# high contrast mode
bool bHC = ( aStyleSettings.GetFaceColor().IsDark() ||
aStyleSettings.GetWindowColor().IsDark() );
aStyleSettings.SetHighContrastMode( bHC );
+ */
rSettings.SetStyleSettings( aStyleSettings );
}
diff --git a/vcl/unx/source/app/saldisp.cxx b/vcl/unx/source/app/saldisp.cxx
index 328129ef3e29..07955d426b8c 100644
--- a/vcl/unx/source/app/saldisp.cxx
+++ b/vcl/unx/source/app/saldisp.cxx
@@ -831,24 +831,28 @@ void SalDisplay::Init()
int nDisplayScreens = ScreenCount( pDisp_ );
m_aScreens = std::vector<ScreenData>(nDisplayScreens);
- const char *value;
+ mbExactResolution = false;
/* #i15507#
* Xft resolution should take precedence since
* it is what modern desktops use.
*/
- if ((value = XGetDefault (pDisp_, "Xft", "dpi")))
+ const char* pValStr = XGetDefault( pDisp_, "Xft", "dpi" );
+ if( pValStr != NULL )
{
- rtl::OString str (value);
- long dpi = (long) str.toDouble();
- aResolution_ = Pair( dpi, dpi );
- mbExactResolution = true;
+ const rtl::OString aValStr( pValStr );
+ const long nDPI = (long) aValStr.toDouble();
+ // guard against insane resolution
+ if( (nDPI >= 50) && (nDPI <= 500) )
+ {
+ aResolution_ = Pair( nDPI, nDPI );
+ mbExactResolution = true;
+ }
}
- else
+ if( mbExactResolution == false )
{
aResolution_ =
Pair( DPI( WidthOfScreen( DefaultScreenOfDisplay( pDisp_ ) ), DisplayWidthMM ( pDisp_, m_nDefaultScreen ) ),
DPI( HeightOfScreen( DefaultScreenOfDisplay( pDisp_ ) ), DisplayHeightMM( pDisp_, m_nDefaultScreen ) ) );
- mbExactResolution = false;
}
nMaxRequestSize_ = XExtendedMaxRequestSize( pDisp_ ) * 4;
diff --git a/vcl/unx/source/fontmanager/fontconfig.cxx b/vcl/unx/source/fontmanager/fontconfig.cxx
index c44e082f91bd..bc0dae480d31 100644
--- a/vcl/unx/source/fontmanager/fontconfig.cxx
+++ b/vcl/unx/source/fontmanager/fontconfig.cxx
@@ -91,6 +91,7 @@ class FontCfgWrapper
oslModule m_pLib;
FcFontSet* m_pOutlineSet;
+ int m_nFcVersion;
FcBool (*m_pFcInit)();
int (*m_pFcGetVersion)();
FcConfig* (*m_pFcConfigGetCurrent)();
@@ -248,9 +249,10 @@ oslGenericFunction FontCfgWrapper::loadSymbol( const char* pSymbol )
FontCfgWrapper::FontCfgWrapper()
: m_pLib( NULL ),
- m_pOutlineSet( NULL )
+ m_pOutlineSet( NULL ),
+ m_nFcVersion( 0 )
{
- OUString aLib( RTL_CONSTASCII_USTRINGPARAM( "libfontconfig.so.1" ) );
+ OUString aLib( RTL_CONSTASCII_USTRINGPARAM( "libfontconfig.so.1" ) );
m_pLib = osl_loadModule( aLib.pData, SAL_LOADMODULE_LAZY );
if( !m_pLib )
{
@@ -331,6 +333,19 @@ FontCfgWrapper::FontCfgWrapper()
m_pFcFreeTypeCharIndex = (FT_UInt(*)(FT_Face,FcChar32))
loadSymbol( "FcFreeTypeCharIndex" );
+ m_nFcVersion = FcGetVersion();
+#if (OSL_DEBUG_LEVEL > 1)
+ fprintf( stderr,"FC_VERSION = %05d\n", m_nFcVersion );
+#endif
+ // make minimum version configurable
+ const char* pMinFcVersion = getenv( "SAL_MIN_FC_VERSION");
+ if( pMinFcVersion )
+ {
+ const int nMinFcVersion = atoi( pMinFcVersion );
+ if( m_nFcVersion < nMinFcVersion )
+ m_pFcInit = NULL;
+ }
+
if( ! (
m_pFcInit &&
m_pFcGetVersion &&
@@ -416,8 +431,7 @@ FcFontSet* FontCfgWrapper::getFontSet()
{
m_pOutlineSet = FcFontSetCreate();
addFontSet( FcSetSystem );
- const int nVersion = FcGetVersion();
- if( nVersion > 20400 )
+ if( m_nFcVersion > 20400 ) // #i85462# prevent crashes
addFontSet( FcSetApplication );
}
#endif
diff --git a/vcl/unx/source/fontmanager/fontmanager.cxx b/vcl/unx/source/fontmanager/fontmanager.cxx
index a116749daf47..995abb5fb89f 100644
--- a/vcl/unx/source/fontmanager/fontmanager.cxx
+++ b/vcl/unx/source/fontmanager/fontmanager.cxx
@@ -2123,7 +2123,7 @@ void PrintFontManager::initialize()
const ::rtl::OUString &rSalPrivatePath = psp::getFontPath();
// search for the fonts in SAL_PRIVATE_FONTPATH first; those are
- // the TrueType fonts installed with the office
+ // the fonts installed with the office
if( rSalPrivatePath.getLength() )
{
OString aPath = rtl::OUStringToOString( rSalPrivatePath, aEncoding );
diff --git a/vcl/unx/source/gdi/salgdi.cxx b/vcl/unx/source/gdi/salgdi.cxx
index ddff0043e792..db49c97de00c 100644
--- a/vcl/unx/source/gdi/salgdi.cxx
+++ b/vcl/unx/source/gdi/salgdi.cxx
@@ -1,1481 +1,1539 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: salgdi.cxx,v $
- * $Revision: 1.53.16.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org 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 version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_vcl.hxx"
-
-#include "Xproto.h"
-
-#include "salunx.h"
-#include "saldata.hxx"
-#include "saldisp.hxx"
-#include "salgdi.h"
-#include "salframe.h"
-#include "salvd.h"
-#include "xrender_peer.hxx"
-
-#include "vcl/printergfx.hxx"
-#include "vcl/jobdata.hxx"
-
-#include "tools/debug.hxx"
-
-#include "basegfx/polygon/b2dpolygon.hxx"
-#include "basegfx/polygon/b2dpolypolygon.hxx"
-#include "basegfx/polygon/b2dpolypolygontools.hxx"
-#include "basegfx/polygon/b2dpolygontools.hxx"
-#include "basegfx/polygon/b2dpolygonclipper.hxx"
-#include "basegfx/polygon/b2dlinegeometry.hxx"
-#include "basegfx/matrix/b2dhommatrix.hxx"
-#include "basegfx/polygon/b2dpolypolygoncutter.hxx"
-
-#include <vector>
-#include <queue>
-#include <set>
-
-// -=-= SalPolyLine =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-#define STATIC_POINTS 64
-
-class SalPolyLine
-{
- XPoint Points_[STATIC_POINTS];
- XPoint *pFirst_;
-public:
- inline SalPolyLine( ULONG nPoints );
- inline SalPolyLine( ULONG nPoints, const SalPoint *p );
- inline ~SalPolyLine();
- inline XPoint &operator [] ( ULONG n ) const
- { return pFirst_[n]; }
-};
-
-inline SalPolyLine::SalPolyLine( ULONG nPoints )
- : pFirst_( nPoints+1 > STATIC_POINTS ? new XPoint[nPoints+1] : Points_ )
-{}
-
-inline SalPolyLine::SalPolyLine( ULONG nPoints, const SalPoint *p )
- : pFirst_( nPoints+1 > STATIC_POINTS ? new XPoint[nPoints+1] : Points_ )
-{
- for( ULONG i = 0; i < nPoints; i++ )
- {
- pFirst_[i].x = (short)p[i].mnX;
- pFirst_[i].y = (short)p[i].mnY;
- }
- pFirst_[nPoints] = pFirst_[0]; // close polyline
-}
-
-inline SalPolyLine::~SalPolyLine()
-{ if( pFirst_ != Points_ ) delete [] pFirst_; }
-
-#undef STATIC_POINTS
-// -=-= X11SalGraphics =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-X11SalGraphics::X11SalGraphics()
-{
- m_pFrame = NULL;
- m_pVDev = NULL;
- m_pDeleteColormap = NULL;
- hDrawable_ = None;
- pRenderFormat_ = NULL;
-
- pClipRegion_ = NULL;
- pPaintRegion_ = NULL;
-
- pPenGC_ = NULL;
- nPenPixel_ = 0;
- nPenColor_ = MAKE_SALCOLOR( 0x00, 0x00, 0x00 ); // Black
-
- pFontGC_ = NULL;
- for( int i = 0; i < MAX_FALLBACK; ++i )
- {
- mXFont[i] = NULL;
- mpServerFont[i] = NULL;
- }
-
- nTextPixel_ = 0;
- nTextColor_ = MAKE_SALCOLOR( 0x00, 0x00, 0x00 ); // Black
-
- pBrushGC_ = NULL;
- nBrushPixel_ = 0;
- nBrushColor_ = MAKE_SALCOLOR( 0xFF, 0xFF, 0xFF ); // White
- hBrush_ = None;
-
- pMonoGC_ = NULL;
- pCopyGC_ = NULL;
- pMaskGC_ = NULL;
- pInvertGC_ = NULL;
- pInvert50GC_ = NULL;
- pStippleGC_ = NULL;
- pTrackingGC_ = NULL;
-
- bWindow_ = FALSE;
- bPrinter_ = FALSE;
- bVirDev_ = FALSE;
- bPenGC_ = FALSE;
- bFontGC_ = FALSE;
- bBrushGC_ = FALSE;
- bMonoGC_ = FALSE;
- bCopyGC_ = FALSE;
- bInvertGC_ = FALSE;
- bInvert50GC_ = FALSE;
- bStippleGC_ = FALSE;
- bTrackingGC_ = FALSE;
- bXORMode_ = FALSE;
- bDitherBrush_ = FALSE;
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-X11SalGraphics::~X11SalGraphics()
-{
- ReleaseFonts();
- freeResources();
-}
-
-// -=-= SalGraphics / X11SalGraphics =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-void X11SalGraphics::freeResources()
-{
- Display *pDisplay = GetXDisplay();
-
- DBG_ASSERT( !pPaintRegion_, "pPaintRegion_" );
- if( pClipRegion_ ) XDestroyRegion( pClipRegion_ ), pClipRegion_ = None;
-
- if( hBrush_ ) XFreePixmap( pDisplay, hBrush_ ), hBrush_ = None;
- if( pPenGC_ ) XFreeGC( pDisplay, pPenGC_ ), pPenGC_ = None;
- if( pFontGC_ ) XFreeGC( pDisplay, pFontGC_ ), pFontGC_ = None;
- if( pBrushGC_ ) XFreeGC( pDisplay, pBrushGC_ ), pBrushGC_ = None;
- if( pMonoGC_ ) XFreeGC( pDisplay, pMonoGC_ ), pMonoGC_ = None;
- if( pCopyGC_ ) XFreeGC( pDisplay, pCopyGC_ ), pCopyGC_ = None;
- if( pMaskGC_ ) XFreeGC( pDisplay, pMaskGC_ ), pMaskGC_ = None;
- if( pInvertGC_ ) XFreeGC( pDisplay, pInvertGC_ ), pInvertGC_ = None;
- if( pInvert50GC_ ) XFreeGC( pDisplay, pInvert50GC_ ), pInvert50GC_ = None;
- if( pStippleGC_ ) XFreeGC( pDisplay, pStippleGC_ ), pStippleGC_ = None;
- if( pTrackingGC_ ) XFreeGC( pDisplay, pTrackingGC_ ), pTrackingGC_ = None;
- if( m_pDeleteColormap )
- delete m_pDeleteColormap, m_pColormap = m_pDeleteColormap = NULL;
-
- bPenGC_ = bFontGC_ = bBrushGC_ = bMonoGC_ = bCopyGC_ = bInvertGC_ = bInvert50GC_ = bStippleGC_ = bTrackingGC_ = false;
-}
-
-void X11SalGraphics::SetDrawable( Drawable aDrawable, int nScreen )
-{
- if( nScreen != m_nScreen )
- {
- freeResources();
- m_pColormap = &GetX11SalData()->GetDisplay()->GetColormap( nScreen );
- m_nScreen = nScreen;
- }
- hDrawable_ = aDrawable;
- nPenPixel_ = GetPixel( nPenColor_ );
- nTextPixel_ = GetPixel( nTextColor_ );
- nBrushPixel_ = GetPixel( nBrushColor_ );
-}
-
-void X11SalGraphics::Init( SalFrame *pFrame, Drawable aTarget, int nScreen )
-{
- m_pColormap = &GetX11SalData()->GetDisplay()->GetColormap(nScreen);
- hDrawable_ = aTarget;
- m_nScreen = nScreen;
-
- bWindow_ = TRUE;
- m_pFrame = pFrame;
- m_pVDev = NULL;
-
- nPenPixel_ = GetPixel( nPenColor_ );
- nTextPixel_ = GetPixel( nTextColor_ );
- nBrushPixel_ = GetPixel( nBrushColor_ );
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-void X11SalGraphics::DeInit()
-{
- hDrawable_ = None;
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-void X11SalGraphics::SetClipRegion( GC pGC, XLIB_Region pXReg ) const
-{
- Display *pDisplay = GetXDisplay();
-
- int n = 0;
- XLIB_Region Regions[3];
-
- if( pClipRegion_ /* && !XEmptyRegion( pClipRegion_ ) */ )
- Regions[n++] = pClipRegion_;
-// if( pPaintRegion_ /* && !XEmptyRegion( pPaintRegion_ ) */ )
-// Regions[n++] = pPaintRegion_;
-
- if( pXReg && !XEmptyRegion( pXReg ) )
- Regions[n++] = pXReg;
-
- if( 0 == n )
- XSetClipMask( pDisplay, pGC, None );
- else if( 1 == n )
- XSetRegion( pDisplay, pGC, Regions[0] );
- else
- {
- XLIB_Region pTmpRegion = XCreateRegion();
- XIntersectRegion( Regions[0], Regions[1], pTmpRegion );
-// if( 3 == n )
-// XIntersectRegion( Regions[2], pTmpRegion, pTmpRegion );
- XSetRegion( pDisplay, pGC, pTmpRegion );
- XDestroyRegion( pTmpRegion );
- }
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-GC X11SalGraphics::SelectPen()
-{
- Display *pDisplay = GetXDisplay();
-
- if( !pPenGC_ )
- {
- XGCValues values;
- values.subwindow_mode = ClipByChildren;
- values.fill_rule = EvenOddRule; // Pict import/ Gradient
- values.graphics_exposures = False;
-
- pPenGC_ = XCreateGC( pDisplay, hDrawable_,
- GCSubwindowMode | GCFillRule | GCGraphicsExposures,
- &values );
- }
-
- if( !bPenGC_ )
- {
- if( nPenColor_ != SALCOLOR_NONE )
- XSetForeground( pDisplay, pPenGC_, nPenPixel_ );
- XSetFunction ( pDisplay, pPenGC_, bXORMode_ ? GXxor : GXcopy );
- SetClipRegion( pPenGC_ );
- bPenGC_ = TRUE;
- }
-
- return pPenGC_;
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-GC X11SalGraphics::SelectBrush()
-{
- Display *pDisplay = GetXDisplay();
-
- DBG_ASSERT( nBrushColor_ != SALCOLOR_NONE, "Brush Transparent" );
-
- if( !pBrushGC_ )
- {
- XGCValues values;
- // values.subwindow_mode = IncludeInferiors;
- values.subwindow_mode = ClipByChildren;
- values.fill_rule = EvenOddRule; // Pict import/ Gradient
- values.graphics_exposures = False;
-
- pBrushGC_ = XCreateGC( pDisplay, hDrawable_,
- GCSubwindowMode | GCFillRule | GCGraphicsExposures,
- &values );
- }
-
- if( !bBrushGC_ )
- {
- if( !bDitherBrush_ )
- {
- XSetFillStyle ( pDisplay, pBrushGC_, FillSolid );
- XSetForeground( pDisplay, pBrushGC_, nBrushPixel_ );
- #if defined(_USE_PRINT_EXTENSION_)
- XSetBackground( pDisplay, pBrushGC_,
- WhitePixel(pDisplay, DefaultScreen(pDisplay)) );
- #else
- if( bPrinter_ )
- XSetTile( pDisplay, pBrushGC_, None );
- #endif
- }
- else
- {
- // Bug in Sun Solaris 2.5.1, XFillPolygon doesn't allways reflect
- // changes of the tile. PROPERTY_BUG_Tile doesn't fix this !
- if (GetDisplay()->GetProperties() & PROPERTY_BUG_FillPolygon_Tile)
- XSetFillStyle ( pDisplay, pBrushGC_, FillSolid );
-
- XSetFillStyle ( pDisplay, pBrushGC_, FillTiled );
- XSetTile ( pDisplay, pBrushGC_, hBrush_ );
- }
- XSetFunction ( pDisplay, pBrushGC_, bXORMode_ ? GXxor : GXcopy );
- SetClipRegion( pBrushGC_ );
-
- bBrushGC_ = TRUE;
- }
-
- return pBrushGC_;
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-GC X11SalGraphics::GetTrackingGC()
-{
- const char dash_list[2] = {2, 2};
-
- if( !pTrackingGC_ )
- {
- XGCValues values;
-
- values.graphics_exposures = False;
- values.foreground = m_pColormap->GetBlackPixel()
- ^ m_pColormap->GetWhitePixel();
- values.function = GXxor;
- values.line_width = 1;
- values.line_style = LineOnOffDash;
-
- pTrackingGC_ = XCreateGC( GetXDisplay(), GetDrawable(),
- GCGraphicsExposures | GCForeground | GCFunction
- | GCLineWidth | GCLineStyle,
- &values );
- XSetDashes( GetXDisplay(), pTrackingGC_, 0, dash_list, 2 );
- }
-
- if( !bTrackingGC_ )
- {
- SetClipRegion( pTrackingGC_ );
- bTrackingGC_ = TRUE;
- }
-
- return pTrackingGC_;
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-void X11SalGraphics::DrawLines( ULONG nPoints,
- const SalPolyLine &rPoints,
- GC pGC,
- bool bClose
- )
-{
- // errechne wie viele Linien XWindow auf einmal zeichnen kann
- ULONG nMaxLines = (GetDisplay()->GetMaxRequestSize() - sizeof(xPolyPointReq))
- / sizeof(xPoint);
- if( nMaxLines > nPoints ) nMaxLines = nPoints;
-
- // gebe alle Linien aus, die XWindows zeichnen kann.
- ULONG n;
- for( n = 0; nPoints - n > nMaxLines; n += nMaxLines - 1 )
- XDrawLines( GetXDisplay(),
- GetDrawable(),
- pGC,
- &rPoints[n],
- nMaxLines,
- CoordModeOrigin );
-
- if( n < nPoints )
- XDrawLines( GetXDisplay(),
- GetDrawable(),
- pGC,
- &rPoints[n],
- nPoints - n,
- CoordModeOrigin );
- if( bClose )
- {
- if( rPoints[nPoints-1].x != rPoints[0].x || rPoints[nPoints-1].y != rPoints[0].y )
- drawLine( rPoints[nPoints-1].x, rPoints[nPoints-1].y, rPoints[0].x, rPoints[0].y );
- }
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-// Dithern: Calculate a dither-pixmap and make a brush of it
-#define P_DELTA 51
-#define DMAP( v, m ) ((v % P_DELTA) > m ? (v / P_DELTA) + 1 : (v / P_DELTA))
-
-BOOL X11SalGraphics::GetDitherPixmap( SalColor nSalColor )
-{
- static const short nOrdDither8Bit[ 8 ][ 8 ] =
- {
- { 0, 38, 9, 48, 2, 40, 12, 50},
- {25, 12, 35, 22, 28, 15, 37, 24},
- { 6, 44, 3, 41, 8, 47, 5, 44},
- {32, 19, 28, 16, 34, 21, 31, 18},
- { 1, 40, 11, 49, 0, 39, 10, 48},
- {27, 14, 36, 24, 26, 13, 36, 23},
- { 8, 46, 4, 43, 7, 45, 4, 42},
- {33, 20, 30, 17, 32, 20, 29, 16}
- };
-
- // test for correct depth (8bit)
- if( GetColormap().GetVisual().GetDepth() != 8 )
- return FALSE;
-
- char pBits[64];
- char *pBitsPtr = pBits;
-
- // Set the pallette-entries for the dithering tile
- UINT8 nSalColorRed = SALCOLOR_RED ( nSalColor );
- UINT8 nSalColorGreen = SALCOLOR_GREEN ( nSalColor );
- UINT8 nSalColorBlue = SALCOLOR_BLUE ( nSalColor );
-
- for( int nY = 0; nY < 8; nY++ )
- {
- for( int nX = 0; nX < 8; nX++ )
- {
- short nMagic = nOrdDither8Bit[nY][nX];
- UINT8 nR = P_DELTA * DMAP( nSalColorRed, nMagic );
- UINT8 nG = P_DELTA * DMAP( nSalColorGreen, nMagic );
- UINT8 nB = P_DELTA * DMAP( nSalColorBlue, nMagic );
-
- *pBitsPtr++ = GetColormap().GetPixel( MAKE_SALCOLOR( nR, nG, nB ) );
- }
- }
-
- // create the tile as ximage and an according pixmap -> caching
- XImage *pImage = XCreateImage( GetXDisplay(),
- GetColormap().GetXVisual(),
- 8,
- ZPixmap,
- 0, // offset
- pBits, // data
- 8, 8, // width & height
- 8, // bitmap_pad
- 0 ); // (default) bytes_per_line
-
- if ( GetDisplay()->GetProperties() & PROPERTY_BUG_Tile )
- {
- if (hBrush_)
- XFreePixmap (GetXDisplay(), hBrush_);
- hBrush_ = XCreatePixmap( GetXDisplay(), GetDrawable(), 8, 8, 8 );
- }
- else
- if( !hBrush_ )
- hBrush_ = XCreatePixmap( GetXDisplay(), GetDrawable(), 8, 8, 8 );
-
- // put the ximage to the pixmap
- XPutImage( GetXDisplay(),
- hBrush_,
- GetDisplay()->GetCopyGC( m_nScreen ),
- pImage,
- 0, 0, // Source
- 0, 0, // Destination
- 8, 8 ); // width & height
-
- // destroy image-frame but not palette-data
- pImage->data = NULL;
- XDestroyImage( pImage );
-
- return TRUE;
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-void X11SalGraphics::GetResolution( sal_Int32 &rDPIX, sal_Int32 &rDPIY ) // const
-{
- const SalDisplay *pDisplay = GetDisplay();
-
- rDPIX = pDisplay->GetResolution().A();
- rDPIY = pDisplay->GetResolution().B();
- if( !pDisplay->GetExactResolution() && rDPIY < 96 )
- {
- rDPIX = Divide( rDPIX * 96, rDPIY );
- rDPIY = 96;
- }
- else if ( rDPIY > 200 )
- {
- rDPIX = Divide( rDPIX * 200, rDPIY );
- rDPIY = 200;
- }
-
- // #i12705# equalize x- and y-resolution if they are close enough
- if( rDPIX != rDPIY )
- {
- // different x- and y- resolutions are usually artifacts of
- // a wrongly calculated screen size.
- //if( (13*rDPIX >= 10*rDPIY) && (13*rDPIY >= 10*rDPIX) ) //+-30%
- {
-#ifdef DEBUG
- printf("Forcing Resolution from %" SAL_PRIdINT32 "x%" SAL_PRIdINT32 " to %" SAL_PRIdINT32 "x%" SAL_PRIdINT32 "\n",
- rDPIX,rDPIY,rDPIY,rDPIY);
-#endif
- rDPIX = rDPIY; // y-resolution is more trustworthy
- }
- }
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-USHORT X11SalGraphics::GetBitCount() // const
-{
- return GetVisual().GetDepth();
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-long X11SalGraphics::GetGraphicsWidth() const
-{
- if( m_pFrame )
- return m_pFrame->maGeometry.nWidth;
- else if( m_pVDev )
- return m_pVDev->GetWidth();
- else
- return 0;
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-long X11SalGraphics::GetGraphicsHeight() const
-{
- if( m_pFrame )
- return m_pFrame->maGeometry.nHeight;
- else if( m_pVDev )
- return m_pVDev->GetHeight();
- else
- return 0;
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-void X11SalGraphics::ResetClipRegion()
-{
- if( pClipRegion_ )
- {
- bPenGC_ = FALSE;
- bFontGC_ = FALSE;
- bBrushGC_ = FALSE;
- bMonoGC_ = FALSE;
- bCopyGC_ = FALSE;
- bInvertGC_ = FALSE;
- bInvert50GC_ = FALSE;
- bStippleGC_ = FALSE;
- bTrackingGC_ = FALSE;
-
- XDestroyRegion( pClipRegion_ );
- pClipRegion_ = NULL;
- }
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-void X11SalGraphics::BeginSetClipRegion( ULONG )
-{
- if( pClipRegion_ )
- XDestroyRegion( pClipRegion_ );
- pClipRegion_ = XCreateRegion();
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-BOOL X11SalGraphics::unionClipRegion( long nX, long nY, long nDX, long nDY )
-{
- if (!nDX || !nDY)
- return TRUE;
-
- XRectangle aRect;
- aRect.x = (short)nX;
- aRect.y = (short)nY;
- aRect.width = (unsigned short)nDX;
- aRect.height = (unsigned short)nDY;
-
- XUnionRectWithRegion( &aRect, pClipRegion_, pClipRegion_ );
-
- return TRUE;
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-bool X11SalGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& )
-{
- // TODO: implement and advertise OutDevSupport_B2DClip support
- return false;
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-void X11SalGraphics::EndSetClipRegion()
-{
- bPenGC_ = FALSE;
- bFontGC_ = FALSE;
- bBrushGC_ = FALSE;
- bMonoGC_ = FALSE;
- bCopyGC_ = FALSE;
- bInvertGC_ = FALSE;
- bInvert50GC_ = FALSE;
- bStippleGC_ = FALSE;
- bTrackingGC_ = FALSE;
-
- if( XEmptyRegion( pClipRegion_ ) )
- {
- XDestroyRegion( pClipRegion_ );
- pClipRegion_= NULL;
- }
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-void X11SalGraphics::SetLineColor()
-{
- if( nPenColor_ != SALCOLOR_NONE )
- {
- nPenColor_ = SALCOLOR_NONE;
- bPenGC_ = FALSE;
- }
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-void X11SalGraphics::SetLineColor( SalColor nSalColor )
-{
- if( nPenColor_ != nSalColor )
- {
- nPenColor_ = nSalColor;
- nPenPixel_ = GetPixel( nSalColor );
- bPenGC_ = FALSE;
- }
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-void X11SalGraphics::SetFillColor()
-{
- if( nBrushColor_ != SALCOLOR_NONE )
- {
- bDitherBrush_ = FALSE;
- nBrushColor_ = SALCOLOR_NONE;
- bBrushGC_ = FALSE;
- }
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-void X11SalGraphics::SetFillColor( SalColor nSalColor )
-{
- if( nBrushColor_ != nSalColor )
- {
- bDitherBrush_ = FALSE;
- nBrushColor_ = nSalColor;
- nBrushPixel_ = GetPixel( nSalColor );
- if( TrueColor != GetColormap().GetVisual().GetClass()
- && GetColormap().GetColor( nBrushPixel_ ) != nBrushColor_
- && nSalColor != MAKE_SALCOLOR( 0x00, 0x00, 0x00 ) // black
- && nSalColor != MAKE_SALCOLOR( 0x00, 0x00, 0x80 ) // blue
- && nSalColor != MAKE_SALCOLOR( 0x00, 0x80, 0x00 ) // green
- && nSalColor != MAKE_SALCOLOR( 0x00, 0x80, 0x80 ) // cyan
- && nSalColor != MAKE_SALCOLOR( 0x80, 0x00, 0x00 ) // red
- && nSalColor != MAKE_SALCOLOR( 0x80, 0x00, 0x80 ) // magenta
- && nSalColor != MAKE_SALCOLOR( 0x80, 0x80, 0x00 ) // brown
- && nSalColor != MAKE_SALCOLOR( 0x80, 0x80, 0x80 ) // gray
- && nSalColor != MAKE_SALCOLOR( 0xC0, 0xC0, 0xC0 ) // light gray
- && nSalColor != MAKE_SALCOLOR( 0x00, 0x00, 0xFF ) // light blue
- && nSalColor != MAKE_SALCOLOR( 0x00, 0xFF, 0x00 ) // light green
- && nSalColor != MAKE_SALCOLOR( 0x00, 0xFF, 0xFF ) // light cyan
- && nSalColor != MAKE_SALCOLOR( 0xFF, 0x00, 0x00 ) // light red
- && nSalColor != MAKE_SALCOLOR( 0xFF, 0x00, 0xFF ) // light magenta
- && nSalColor != MAKE_SALCOLOR( 0xFF, 0xFF, 0x00 ) // light brown
- && nSalColor != MAKE_SALCOLOR( 0xFF, 0xFF, 0xFF ) )
- bDitherBrush_ = GetDitherPixmap(nSalColor);
- bBrushGC_ = FALSE;
- }
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-void X11SalGraphics::SetROPLineColor( SalROPColor nROPColor )
-{
- switch( nROPColor )
- {
- case SAL_ROP_0 : // 0
- nPenPixel_ = (Pixel)0;
- break;
- case SAL_ROP_1 : // 1
- nPenPixel_ = (Pixel)(1 << GetVisual().GetDepth()) - 1;
- break;
- case SAL_ROP_INVERT : // 2
- nPenPixel_ = (Pixel)(1 << GetVisual().GetDepth()) - 1;
- break;
- }
- nPenColor_ = GetColormap().GetColor( nPenPixel_ );
- bPenGC_ = FALSE;
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-void X11SalGraphics::SetROPFillColor( SalROPColor nROPColor )
-{
- switch( nROPColor )
- {
- case SAL_ROP_0 : // 0
- nBrushPixel_ = (Pixel)0;
- break;
- case SAL_ROP_1 : // 1
- nBrushPixel_ = (Pixel)(1 << GetVisual().GetDepth()) - 1;
- break;
- case SAL_ROP_INVERT : // 2
- nBrushPixel_ = (Pixel)(1 << GetVisual().GetDepth()) - 1;
- break;
- }
- bDitherBrush_ = FALSE;
- nBrushColor_ = GetColormap().GetColor( nBrushPixel_ );
- bBrushGC_ = FALSE;
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-void X11SalGraphics::SetXORMode( bool bSet, bool )
-{
- if( !bXORMode_ == bSet )
- {
- bXORMode_ = bSet;
- bPenGC_ = FALSE;
- bBrushGC_ = FALSE;
- bMonoGC_ = FALSE;
- bCopyGC_ = FALSE;
- bInvertGC_ = FALSE;
- bInvert50GC_ = FALSE;
- bStippleGC_ = FALSE;
- bTrackingGC_ = FALSE;
- }
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-void X11SalGraphics::drawPixel( long nX, long nY )
-{
- if( nPenColor_ != SALCOLOR_NONE )
- XDrawPoint( GetXDisplay(), GetDrawable(), SelectPen(), nX, nY );
-}
-
-void X11SalGraphics::drawPixel( long nX, long nY, SalColor nSalColor )
-{
- if( nSalColor != SALCOLOR_NONE )
- {
- Display *pDisplay = GetXDisplay();
-
- if( (nPenColor_ == SALCOLOR_NONE) && !bPenGC_ )
- {
- SetLineColor( nSalColor );
- XDrawPoint( pDisplay, GetDrawable(), SelectPen(), nX, nY );
- nPenColor_ = SALCOLOR_NONE;
- bPenGC_ = False;
- }
- else
- {
- GC pGC = SelectPen();
-
- if( nSalColor != nPenColor_ )
- XSetForeground( pDisplay, pGC, GetPixel( nSalColor ) );
-
- XDrawPoint( pDisplay, GetDrawable(), pGC, nX, nY );
-
- if( nSalColor != nPenColor_ )
- XSetForeground( pDisplay, pGC, nPenPixel_ );
- }
- }
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-void X11SalGraphics::drawLine( long nX1, long nY1, long nX2, long nY2 )
-{
- if( nPenColor_ != SALCOLOR_NONE )
- {
- if ( GetDisplay()->GetProperties() & PROPERTY_BUG_DrawLine )
- {
- GC aGC = SelectPen();
- XDrawPoint (GetXDisplay(), GetDrawable(), aGC, (int)nX1, (int)nY1);
- XDrawPoint (GetXDisplay(), GetDrawable(), aGC, (int)nX2, (int)nY2);
- XDrawLine (GetXDisplay(), GetDrawable(), aGC, nX1, nY1, nX2, nY2 );
- }
- else
- XDrawLine( GetXDisplay(), GetDrawable(),SelectPen(),
- nX1, nY1, nX2, nY2 );
- }
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-void X11SalGraphics::drawRect( long nX, long nY, long nDX, long nDY )
-{
- if( nBrushColor_ != SALCOLOR_NONE )
- {
- XFillRectangle( GetXDisplay(),
- GetDrawable(),
- SelectBrush(),
- nX, nY, nDX, nDY );
- }
- // Beschreibung DrawRect verkehrt, deshalb -1
- if( nPenColor_ != SALCOLOR_NONE )
- XDrawRectangle( GetXDisplay(),
- GetDrawable(),
- SelectPen(),
- nX, nY, nDX-1, nDY-1 );
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-void X11SalGraphics::drawPolyLine( ULONG nPoints, const SalPoint *pPtAry )
-{
- drawPolyLine( nPoints, pPtAry, false );
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-void X11SalGraphics::drawPolyLine( ULONG nPoints, const SalPoint *pPtAry, bool bClose )
-{
- if( nPenColor_ != 0xFFFFFFFF )
- {
- SalPolyLine Points( nPoints, pPtAry );
-
- DrawLines( nPoints, Points, SelectPen(), bClose );
- }
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-void X11SalGraphics::drawPolygon( ULONG nPoints, const SalPoint* pPtAry )
-{
- if( nPoints == 0 )
- return;
-
- if( nPoints < 3 )
- {
- if( !bXORMode_ )
- {
- if( 1 == nPoints )
- drawPixel( pPtAry[0].mnX, pPtAry[0].mnY );
- else
- drawLine( pPtAry[0].mnX, pPtAry[0].mnY,
- pPtAry[1].mnX, pPtAry[1].mnY );
- }
- return;
- }
-
- SalPolyLine Points( nPoints, pPtAry );
-
- nPoints++;
-
- /* WORKAROUND: some Xservers (Xorg, VIA chipset in this case)
- * do not draw the visible part of a polygon
- * if it overlaps to the left of screen 0,y.
- * This happens to be the case in the gradient drawn in the
- * menubar background. workaround for the special case of
- * of a rectangle overlapping to the left.
- */
- if( nPoints == 5 &&
- Points[ 0 ].x == Points[ 1 ].x &&
- Points[ 1 ].y == Points[ 2 ].y &&
- Points[ 2 ].x == Points[ 3 ].x &&
- Points[ 0 ].x == Points[ 4 ].x && Points[ 0 ].y == Points[ 4 ].y
- )
- {
- bool bLeft = false;
- bool bRight = false;
- for(unsigned int i = 0; i < nPoints; i++ )
- {
- if( Points[i].x < 0 )
- bLeft = true;
- else
- bRight= true;
- }
- if( bLeft && ! bRight )
- return;
- if( bLeft && bRight )
- {
- for( unsigned int i = 0; i < nPoints; i++ )
- if( Points[i].x < 0 )
- Points[i].x = 0;
- }
- }
-
- if( nBrushColor_ != SALCOLOR_NONE )
- XFillPolygon( GetXDisplay(),
- GetDrawable(),
- SelectBrush(),
- &Points[0], nPoints,
- Complex, CoordModeOrigin );
-
- if( nPenColor_ != 0xFFFFFFFF )
- DrawLines( nPoints, Points, SelectPen(), true );
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-void X11SalGraphics::drawPolyPolygon( sal_uInt32 nPoly,
- const sal_uInt32 *pPoints,
- PCONSTSALPOINT *pPtAry )
-{
- if( nBrushColor_ != SALCOLOR_NONE )
- {
- ULONG i, n;
- XLIB_Region pXRegA = NULL;
-
- for( i = 0; i < nPoly; i++ ) {
- n = pPoints[i];
- SalPolyLine Points( n, pPtAry[i] );
- if( n > 2 )
- {
- XLIB_Region pXRegB = XPolygonRegion( &Points[0], n+1, WindingRule );
- if( !pXRegA )
- pXRegA = pXRegB;
- else
- {
- XXorRegion( pXRegA, pXRegB, pXRegA );
- XDestroyRegion( pXRegB );
- }
- }
- }
-
- if( pXRegA )
- {
- XRectangle aXRect;
- XClipBox( pXRegA, &aXRect );
-
- GC pGC = SelectBrush();
- SetClipRegion( pGC, pXRegA ); // ??? doppelt
- XDestroyRegion( pXRegA );
- bBrushGC_ = FALSE;
-
- XFillRectangle( GetXDisplay(),
- GetDrawable(),
- pGC,
- aXRect.x, aXRect.y, aXRect.width, aXRect.height );
- }
- }
-
- if( nPenColor_ != SALCOLOR_NONE )
- for( ULONG i = 0; i < nPoly; i++ )
- drawPolyLine( pPoints[i], pPtAry[i], true );
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-sal_Bool X11SalGraphics::drawPolyLineBezier( ULONG, const SalPoint*, const BYTE* )
-{
- return sal_False;
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-sal_Bool X11SalGraphics::drawPolygonBezier( ULONG, const SalPoint*, const BYTE* )
-{
- return sal_False;
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-sal_Bool X11SalGraphics::drawPolyPolygonBezier( sal_uInt32, const sal_uInt32*,
- const SalPoint* const*, const BYTE* const* )
-{
- return sal_False;
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-void X11SalGraphics::invert( ULONG nPoints,
- const SalPoint* pPtAry,
- SalInvert nFlags )
-{
- SalPolyLine Points ( nPoints, pPtAry );
-
- GC pGC;
- if( SAL_INVERT_50 & nFlags )
- pGC = GetInvert50GC();
- else
- if ( SAL_INVERT_TRACKFRAME & nFlags )
- pGC = GetTrackingGC();
- else
- pGC = GetInvertGC();
-
- if( SAL_INVERT_TRACKFRAME & nFlags )
- DrawLines ( nPoints, Points, pGC, true );
- else
- XFillPolygon( GetXDisplay(),
- GetDrawable(),
- pGC,
- &Points[0], nPoints,
- Complex, CoordModeOrigin );
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-BOOL X11SalGraphics::drawEPS( long,long,long,long,void*,ULONG )
-{
- return FALSE;
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-SystemGraphicsData X11SalGraphics::GetGraphicsData() const
-{
- SystemGraphicsData aRes;
-
- aRes.nSize = sizeof(aRes);
- aRes.pDisplay = GetXDisplay();
- aRes.hDrawable = hDrawable_;
- aRes.pVisual = GetDisplay()->GetVisual( m_nScreen ).GetVisual();
- aRes.nScreen = m_nScreen;
- aRes.nDepth = GetDisplay()->GetVisual( m_nScreen ).GetDepth();
- aRes.aColormap = GetDisplay()->GetColormap( m_nScreen ).GetXColormap();
- aRes.pRenderFormat = pRenderFormat_;
- return aRes;
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-// B2DPolygon support methods
-
-namespace { // anonymous namespace to prevent export
-// the methods and structures here are used by the
-// B2DPolyPolygon->RenderTrapezoid conversion algorithm
-
-// compare two line segments
-// assumption: both segments point downward
-// assumption: they must have at least some y-overlap
-// assumption: rA.p1.y <= rB.p1.y
-bool IsLeftOf( const XLineFixed& rA, const XLineFixed& rB )
-{
- bool bAbove = (rA.p1.y <= rB.p1.y);
- const XLineFixed& rU = bAbove ? rA : rB;
- const XLineFixed& rL = bAbove ? rB : rA;
-
- const XFixed aXDiff = rU.p2.x - rU.p1.x;
- const XFixed aYDiff = rU.p2.y - rU.p1.y;
-
- if( (rU.p1.y != rL.p1.y) || (rU.p1.x != rL.p1.x) )
- {
- const sal_Int64 n1 = (sal_Int64)aXDiff * (rL.p1.y - rU.p1.y);
- const sal_Int64 n2 = (sal_Int64)aYDiff * (rL.p1.x - rU.p1.x);
- if( n1 != n2 )
- return ((n1 < n2) == bAbove);
- }
-
- if( (rU.p2.y != rL.p2.y) || (rU.p2.x != rL.p2.x) )
- {
- const sal_Int64 n3 = (sal_Int64)aXDiff * (rL.p2.y - rU.p1.y);
- const sal_Int64 n4 = (sal_Int64)aYDiff * (rL.p2.x - rU.p1.x);
- if( n3 != n4 )
- return ((n3 < n4) == bAbove);
- }
-
- // both segments overlap
- return false;
-}
-
-struct HalfTrapezoid
-{
- // assumptions:
- // maLine.p1.y <= mnY < maLine.p2.y
- XLineFixed maLine;
- XFixed mnY;
-};
-
-struct HalfTrapCompare
-{
- bool operator()( const HalfTrapezoid& rA, const HalfTrapezoid& rB ) const
- {
- bool bIsTopLeft = false;
- if( rA.mnY != rB.mnY ) // sort top-first if possible
- bIsTopLeft = (rA.mnY < rB.mnY);
- else // else sort left-first
- bIsTopLeft = IsLeftOf( rA.maLine, rB.maLine );
- // adjust to priority_queue sorting convention
- return !bIsTopLeft;
- }
-};
-
-typedef std::priority_queue< HalfTrapezoid, std::vector<HalfTrapezoid>, HalfTrapCompare > HTQueueBase;
-// we need a priority queue with a reserve() to prevent countless reallocations
-class HTQueue
-: public HTQueueBase
-{
-public:
- void reserve( size_t n ) { c.reserve( n ); }
- int capacity() { return c.capacity(); }
-};
-
-typedef std::vector<XTrapezoid> TrapezoidVector;
-
-class TrapezoidXCompare
-{
- const TrapezoidVector& mrVector;
-public:
- TrapezoidXCompare( const TrapezoidVector& rVector )
- : mrVector( rVector ) {}
- bool operator()( int nA, int nB ) const
- { return IsLeftOf( mrVector[nA].left, mrVector[nB].left ); }
-};
-
-typedef std::multiset< int, TrapezoidXCompare > ActiveTrapSet;
-
-class TrapezoidYCompare
-{
- const TrapezoidVector& mrVector;
-public:
- TrapezoidYCompare( const TrapezoidVector& rVector )
- : mrVector( rVector ) {}
- bool operator()( int nA, int nB ) const
- { return (mrVector[nA].bottom < mrVector[nB].bottom); }
-};
-
-typedef std::multiset< int, TrapezoidYCompare > VerticalTrapSet;
-} // end of anonymous namespace
-
-// draw a poly-polygon
-bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly, double fTransparency)
-{
- // nothing to do for empty polypolygons
- const int nPolygonCount = rPolyPoly.count();
- if( nPolygonCount <= 0 )
- return TRUE;
-
- // nothing to do if everything is transparent
- if( (nBrushColor_ == SALCOLOR_NONE)
- && (nPenColor_ == SALCOLOR_NONE) )
- return TRUE;
-
- // cannot handle pencolor!=brushcolor yet
- if( (nPenColor_ != SALCOLOR_NONE)
- && (nPenColor_ != nBrushColor_) )
- return FALSE;
-
- // TODO: remove the env-variable when no longer needed
- static const char* pRenderEnv = getenv( "SAL_DISABLE_RENDER_POLY" );
- if( pRenderEnv )
- return FALSE;
-
- // check xrender support for trapezoids
- XRenderPeer& rRenderPeer = XRenderPeer::GetInstance();
- if( !rRenderPeer.AreTrapezoidsSupported() )
- return FALSE;
-
- // check xrender support for matching visual
- Visual* pVisual = GetVisual().GetVisual();
- XRenderPictFormat* pVisualFormat = rRenderPeer.FindVisualFormat( pVisual );
- if( !pVisualFormat )
- return FALSE;
-
- // don't bother with polygons outside of visible area
- const basegfx::B2DRange aViewRange( 0, 0, GetGraphicsWidth(), GetGraphicsHeight() );
- const basegfx::B2DRange aPolyRange = basegfx::tools::getRange( rPolyPoly );
- const bool bNeedViewClip = !aPolyRange.isInside( aViewRange );
- if( !aPolyRange.overlaps( aViewRange ) )
- return TRUE;
-
- // convert the polypolygon to trapezoids
-
- // first convert the B2DPolyPolygon to HalfTrapezoids
- HTQueue aHTQueue;
- aHTQueue.reserve( 16384 ); // TODO: use decomposed number of points
- for( int nOuterPolyIdx = 0; nOuterPolyIdx < nPolygonCount; ++nOuterPolyIdx )
- {
- ::basegfx::B2DPolygon aOuterPolygon = rPolyPoly.getB2DPolygon( nOuterPolyIdx );
-
- // get rid of bezier segments
- if( aOuterPolygon.areControlPointsUsed() )
- aOuterPolygon = ::basegfx::tools::adaptiveSubdivideByDistance( aOuterPolygon, 0.125 );
-
- // clip polygon against view
- // (the call below for removing self intersections can be made much cheaper by this)
- basegfx::B2DPolyPolygon aClippedPolygon( aOuterPolygon );
- if( bNeedViewClip )
- {
- // TODO: move clipping before subdivision when clipPolyonRange learns to handle curves
- aClippedPolygon = basegfx::tools::clipPolygonOnRange( aOuterPolygon, aViewRange, true, false );
- DBG_ASSERT( aClippedPolygon.count(), "polygon confirmed to overlap with view should not get here" );
- if( !aClippedPolygon.count() )
- continue;
- }
-
- // test and remove self intersections
- // TODO: make code intersection save, then remove this test
- basegfx::B2DPolyPolygon aInnerPolyPoly(basegfx::tools::solveCrossovers( aClippedPolygon));
- const int nInnerPolyCount = aInnerPolyPoly.count();
- for( int nInnerPolyIdx = 0; nInnerPolyIdx < nInnerPolyCount; ++nInnerPolyIdx )
- {
- ::basegfx::B2DPolygon aInnerPolygon = aInnerPolyPoly.getB2DPolygon( nInnerPolyIdx );
- const int nPointCount = aInnerPolygon.count();
- if( !nPointCount )
- continue;
-
- aHTQueue.reserve( aHTQueue.size() + 8 * nPointCount );
-
- // convert polygon point pairs to HalfTrapezoids
- // connect the polygon point with the first one if needed
- XPointFixed aOldXPF = { 0, 0 };
- XPointFixed aNewXPF;
- for( int nPointIdx = 0; nPointIdx <= nPointCount; ++nPointIdx, aOldXPF = aNewXPF )
- {
- const int k = (nPointIdx < nPointCount) ? nPointIdx : 0;
- const ::basegfx::B2DPoint& aPoint = aInnerPolygon.getB2DPoint( k );
-
- // convert the B2DPoint into XRENDER units
- if(getAntiAliasB2DDraw())
- {
- aNewXPF.x = XDoubleToFixed( aPoint.getX() );
- aNewXPF.y = XDoubleToFixed( aPoint.getY() );
- }
- else
- {
- aNewXPF.x = XDoubleToFixed( basegfx::fround( aPoint.getX() ) );
- aNewXPF.y = XDoubleToFixed( basegfx::fround( aPoint.getY() ) );
- }
-
- // check if enough data is available for a new HalfTrapezoid
- if( nPointIdx == 0 )
- continue;
- // ignore vertical segments
- if( aNewXPF.y == aOldXPF.y )
- continue;
-
- // construct HalfTrapezoid as topdown segment
- HalfTrapezoid aHT;
- if( aNewXPF.y < aOldXPF.y )
- {
- aHT.maLine.p1 = aNewXPF;
- aHT.maLine.p2 = aOldXPF;
- }
- else
- {
- aHT.maLine.p2 = aNewXPF;
- aHT.maLine.p1 = aOldXPF;
- }
-
- aHT.mnY = aHT.maLine.p1.y;
-
-#if 0 // ignore clipped HalfTrapezoids
- if( aHT.mnY < 0 )
- aHT.mnY = 0;
- else if( aHT.mnY > 10000 )
- continue;
-#endif
-
- // queue up the HalfTrapezoid
- aHTQueue.push( aHT );
- }
- }
- }
-
- if( aHTQueue.empty() )
- return TRUE;
-
- // then convert the HalfTrapezoids into full Trapezoids
- TrapezoidVector aTrapVector;
- aTrapVector.reserve( aHTQueue.size() * 2 ); // just a guess
-
- TrapezoidXCompare aTrapXCompare( aTrapVector );
- ActiveTrapSet aActiveTraps( aTrapXCompare );
-
- TrapezoidYCompare aTrapYCompare( aTrapVector );
- VerticalTrapSet aVerticalTraps( aTrapYCompare );
-
- while( !aHTQueue.empty() )
- {
- XTrapezoid aTrapezoid;
-
- // convert a HalfTrapezoid pair
- const HalfTrapezoid& rLeft = aHTQueue.top();
- aTrapezoid.top = rLeft.mnY;
- aTrapezoid.bottom = rLeft.maLine.p2.y;
- aTrapezoid.left = rLeft.maLine;
-
-#if 0
- // ignore empty trapezoids
- if( aTrapezoid.bottom <= aTrapezoid.top )
- continue;
-#endif
-
- aHTQueue.pop();
- if( aHTQueue.empty() ) // TODO: assert
- break;
- const HalfTrapezoid& rRight = aHTQueue.top();
- aTrapezoid.right = rRight.maLine;
- aHTQueue.pop();
-
- aTrapezoid.bottom = aTrapezoid.left.p2.y;
- if( aTrapezoid.bottom > aTrapezoid.right.p2.y )
- aTrapezoid.bottom = aTrapezoid.right.p2.y;
-
- // keep the full Trapezoid candidate
- aTrapVector.push_back( aTrapezoid );
-
- // unless it splits an older trapezoid
- bool bSplit = false;
- for(;;)
- {
- // check if the new trapezoid overlaps with an old trapezoid
- ActiveTrapSet::iterator aActiveTrapsIt
- = aActiveTraps.upper_bound( aTrapVector.size()-1 );
- if( aActiveTrapsIt == aActiveTraps.begin() )
- break;
- --aActiveTrapsIt;
-
- XTrapezoid& rLeftTrap = aTrapVector[ *aActiveTrapsIt ];
-
- // in the ActiveTrapSet there are still trapezoids where
- // a vertical overlap with new trapezoids is no longer possible
- // they could have been removed in the verticaltraps loop below
- // but this would have been expensive and is not needed as we can
- // simply ignore them now and remove them from the ActiveTrapSet
- // so they won't bother us in the future
- if( rLeftTrap.bottom <= aTrapezoid.top )
- {
- aActiveTraps.erase( aActiveTrapsIt );
- continue;
- }
-
- // check if there is horizontal overlap
- // aTrapezoid.left==rLeftTrap.right is allowed though
- if( !IsLeftOf( aTrapezoid.left, rLeftTrap.right ) )
- break;
-
- // split the old trapezoid and keep its upper part
- // find the old trapezoids entry in the VerticalTrapSet and remove it
- typedef std::pair<VerticalTrapSet::iterator, VerticalTrapSet::iterator> VTSPair;
- VTSPair aVTSPair = aVerticalTraps.equal_range( *aActiveTrapsIt );
- VerticalTrapSet::iterator aVTSit = aVTSPair.first;
- for(; (aVTSit != aVTSPair.second) && (*aVTSit != *aActiveTrapsIt); ++aVTSit ) ;
- if( aVTSit != aVTSPair.second )
- aVerticalTraps.erase( aVTSit );
- // then update the old trapezoid's bottom
- rLeftTrap.bottom = aTrapezoid.top;
- // enter the updated old trapzoid in VerticalTrapSet
- aVerticalTraps.insert( aVerticalTraps.begin(), *aActiveTrapsIt );
- // the old trapezoid is no longer active
- aActiveTraps.erase( aActiveTrapsIt );
-
- // the trapezoid causing the split has become obsolete
- // so its both sides have to be re-queued
- HalfTrapezoid aHT;
- aHT.mnY = aTrapezoid.top;
- aHT.maLine = aTrapezoid.left;
- aHTQueue.push( aHT );
- aHT.maLine = aTrapezoid.right;
- aHTQueue.push( aHT );
-
- bSplit = true;
- break;
- }
-
- // keep or forget the resulting full Trapezoid
- if( bSplit )
- aTrapVector.pop_back();
- else
- {
- aActiveTraps.insert( aTrapVector.size()-1 );
- aVerticalTraps.insert( aTrapVector.size()-1 );
- }
-
- // mark trapezoids that can no longer be split as inactive
- // and recycle their sides which were not fully resolved
- static const XFixed nMaxTop = +0x7FFFFFFF;
- XFixed nNewTop = aHTQueue.empty() ? nMaxTop : aHTQueue.top().mnY;
- while( !aVerticalTraps.empty() )
- {
- const XTrapezoid& rOldTrap = aTrapVector[ *aVerticalTraps.begin() ];
- if( nNewTop < rOldTrap.bottom )
- break;
- // the reference Trapezoid can no longer be split
- aVerticalTraps.erase( aVerticalTraps.begin() );
-
- // recycle its sides that were not fully resolved
- HalfTrapezoid aHT;
- aHT.mnY = rOldTrap.bottom;
- if( rOldTrap.left.p2.y > rOldTrap.bottom )
- {
- aHT.maLine = rOldTrap.left;
- aHTQueue.push( aHT );
- }
- if( rOldTrap.right.p2.y > rOldTrap.bottom )
- {
- aHT.maLine = rOldTrap.right;
- aHTQueue.push( aHT );
- }
- }
- }
-
- // create xrender Picture for polygon foreground
- SalDisplay::RenderEntry& rEntry = GetDisplay()->GetRenderEntries( m_nScreen )[ 32 ];
- if( !rEntry.m_aPicture )
- {
- Display* pXDisplay = GetXDisplay();
-
- rEntry.m_aPixmap = ::XCreatePixmap( pXDisplay, hDrawable_, 1, 1, 32 );
- XRenderPictureAttributes aAttr;
- aAttr.repeat = true;
-
- XRenderPictFormat* pXRPF = rRenderPeer.FindStandardFormat( PictStandardARGB32 );
- rEntry.m_aPicture = rRenderPeer.CreatePicture( rEntry.m_aPixmap, pXRPF, CPRepeat, &aAttr );
- }
-
- // set polygon foreground color and opacity
- XRenderColor aRenderColor = GetXRenderColor( nBrushColor_ , fTransparency );
- rRenderPeer.FillRectangle( PictOpSrc, rEntry.m_aPicture, &aRenderColor, 0, 0, 1, 1 );
-
- // notify xrender of target drawable
- // TODO: cache the matching xrender picture in the X11SalGraphics
- Picture aDst = rRenderPeer.CreatePicture( hDrawable_, pVisualFormat, 0, NULL );
-
- // set clipping
- if( pClipRegion_ && !XEmptyRegion( pClipRegion_ ) )
- rRenderPeer.SetPictureClipRegion( aDst, pClipRegion_ );
-
- // render the trapezoids
- const XRenderPictFormat* pMaskFormat = rRenderPeer.GetStandardFormatA8();
- rRenderPeer.CompositeTrapezoids( PictOpOver,
- rEntry.m_aPicture, aDst, pMaskFormat, 0, 0, &aTrapVector[0], aTrapVector.size() );
-
- // release xrender-counterpart of target drawable
- // TODO: use scoped xrender picture
- rRenderPeer.FreePicture( aDst );
-
- return TRUE;
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin eLineJoin)
-{
- const XRenderPeer& rRenderPeer = XRenderPeer::GetInstance();
- if( !rRenderPeer.AreTrapezoidsSupported() )
- return false;
-
- // get the area polygon for the line polygon
- basegfx::B2DPolygon aPolygon = rPolygon;
- if( (rLineWidth.getX() != rLineWidth.getY())
- && !basegfx::fTools::equalZero( rLineWidth.getY() ) )
- {
- // prepare for createAreaGeometry() with anisotropic linewidth
- basegfx::B2DHomMatrix aAnisoMatrix;
- aAnisoMatrix.scale( 1.0, rLineWidth.getX() / rLineWidth.getY() );
- aPolygon.transform( aAnisoMatrix );
- }
-
- // AW: reSegment no longer needed; new createAreaGeometry will remove exteme positions
- // and create bezier polygons
- //if( aPolygon.areControlPointsUsed() )
- // aPolygon = basegfx::tools::reSegmentPolygonEdges( aPolygon, 8, true, false );
- //const basegfx::B2DPolyPolygon aAreaPolyPoly = basegfx::tools::createAreaGeometryForSimplePolygon(
- // aPolygon, 0.5*rLineWidth.getX(), eLineJoin );
- const basegfx::B2DPolyPolygon aAreaPolyPoly(basegfx::tools::createAreaGeometry(aPolygon, 0.5*rLineWidth.getX(), eLineJoin));
-
- if( (rLineWidth.getX() != rLineWidth.getY())
- && !basegfx::fTools::equalZero( rLineWidth.getX() ) )
- {
- // postprocess createAreaGeometry() for anisotropic linewidth
- basegfx::B2DHomMatrix aAnisoMatrix;
- aAnisoMatrix.scale( 1.0, rLineWidth.getY() / rLineWidth.getX() );
- aPolygon.transform( aAnisoMatrix );
- }
-
- // temporarily adjust brush color to pen color
- // since the line is drawn as an area-polygon
- const SalColor aKeepBrushColor = nBrushColor_;
- nBrushColor_ = nPenColor_;
-
- // draw each area polypolygon component individually
- // to emulate the polypolygon winding rule "non-zero"
- bool bDrawOk = true;
- const int nPolyCount = aAreaPolyPoly.count();
- for( int nPolyIdx = 0; nPolyIdx < nPolyCount; ++nPolyIdx )
- {
- const ::basegfx::B2DPolyPolygon aOnePoly( aAreaPolyPoly.getB2DPolygon( nPolyIdx ) );
- bDrawOk = drawPolyPolygon( aOnePoly, 0.0);
- if( !bDrawOk )
- break;
- }
-
- // restore the original brush GC
- nBrushColor_ = aKeepBrushColor;
- return bDrawOk;
-}
-
-// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_vcl.hxx"
+
+#include "Xproto.h"
+
+#include "salunx.h"
+#include "saldata.hxx"
+#include "saldisp.hxx"
+#include "salgdi.h"
+#include "salframe.h"
+#include "salvd.h"
+#include "xrender_peer.hxx"
+
+#include "vcl/printergfx.hxx"
+#include "vcl/jobdata.hxx"
+
+#include "tools/debug.hxx"
+
+#include "basegfx/polygon/b2dpolygon.hxx"
+#include "basegfx/polygon/b2dpolypolygon.hxx"
+#include "basegfx/polygon/b2dpolypolygontools.hxx"
+#include "basegfx/polygon/b2dpolygontools.hxx"
+#include "basegfx/polygon/b2dpolygonclipper.hxx"
+#include "basegfx/polygon/b2dlinegeometry.hxx"
+#include "basegfx/matrix/b2dhommatrix.hxx"
+#include "basegfx/polygon/b2dpolypolygoncutter.hxx"
+
+#include <vector>
+#include <queue>
+#include <set>
+
+// -=-= SalPolyLine =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#define STATIC_POINTS 64
+
+class SalPolyLine
+{
+ XPoint Points_[STATIC_POINTS];
+ XPoint *pFirst_;
+public:
+ inline SalPolyLine( ULONG nPoints );
+ inline SalPolyLine( ULONG nPoints, const SalPoint *p );
+ inline ~SalPolyLine();
+ inline XPoint &operator [] ( ULONG n ) const
+ { return pFirst_[n]; }
+};
+
+inline SalPolyLine::SalPolyLine( ULONG nPoints )
+ : pFirst_( nPoints+1 > STATIC_POINTS ? new XPoint[nPoints+1] : Points_ )
+{}
+
+inline SalPolyLine::SalPolyLine( ULONG nPoints, const SalPoint *p )
+ : pFirst_( nPoints+1 > STATIC_POINTS ? new XPoint[nPoints+1] : Points_ )
+{
+ for( ULONG i = 0; i < nPoints; i++ )
+ {
+ pFirst_[i].x = (short)p[i].mnX;
+ pFirst_[i].y = (short)p[i].mnY;
+ }
+ pFirst_[nPoints] = pFirst_[0]; // close polyline
+}
+
+inline SalPolyLine::~SalPolyLine()
+{ if( pFirst_ != Points_ ) delete [] pFirst_; }
+
+#undef STATIC_POINTS
+// -=-= X11SalGraphics =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+X11SalGraphics::X11SalGraphics()
+{
+ m_pFrame = NULL;
+ m_pVDev = NULL;
+ m_pDeleteColormap = NULL;
+ hDrawable_ = None;
+ m_aRenderPicture = 0;
+ m_pRenderFormat = NULL;
+
+ pClipRegion_ = NULL;
+ pPaintRegion_ = NULL;
+
+ pPenGC_ = NULL;
+ nPenPixel_ = 0;
+ nPenColor_ = MAKE_SALCOLOR( 0x00, 0x00, 0x00 ); // Black
+
+ pFontGC_ = NULL;
+ for( int i = 0; i < MAX_FALLBACK; ++i )
+ {
+ mXFont[i] = NULL;
+ mpServerFont[i] = NULL;
+ }
+
+ nTextPixel_ = 0;
+ nTextColor_ = MAKE_SALCOLOR( 0x00, 0x00, 0x00 ); // Black
+
+ pBrushGC_ = NULL;
+ nBrushPixel_ = 0;
+ nBrushColor_ = MAKE_SALCOLOR( 0xFF, 0xFF, 0xFF ); // White
+ hBrush_ = None;
+
+ pMonoGC_ = NULL;
+ pCopyGC_ = NULL;
+ pMaskGC_ = NULL;
+ pInvertGC_ = NULL;
+ pInvert50GC_ = NULL;
+ pStippleGC_ = NULL;
+ pTrackingGC_ = NULL;
+
+ bWindow_ = FALSE;
+ bPrinter_ = FALSE;
+ bVirDev_ = FALSE;
+ bPenGC_ = FALSE;
+ bFontGC_ = FALSE;
+ bBrushGC_ = FALSE;
+ bMonoGC_ = FALSE;
+ bCopyGC_ = FALSE;
+ bInvertGC_ = FALSE;
+ bInvert50GC_ = FALSE;
+ bStippleGC_ = FALSE;
+ bTrackingGC_ = FALSE;
+ bXORMode_ = FALSE;
+ bDitherBrush_ = FALSE;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+X11SalGraphics::~X11SalGraphics()
+{
+ ReleaseFonts();
+ freeResources();
+}
+
+// -=-= SalGraphics / X11SalGraphics =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+void X11SalGraphics::freeResources()
+{
+ Display *pDisplay = GetXDisplay();
+
+ DBG_ASSERT( !pPaintRegion_, "pPaintRegion_" );
+ if( pClipRegion_ ) XDestroyRegion( pClipRegion_ ), pClipRegion_ = None;
+
+ if( hBrush_ ) XFreePixmap( pDisplay, hBrush_ ), hBrush_ = None;
+ if( pPenGC_ ) XFreeGC( pDisplay, pPenGC_ ), pPenGC_ = None;
+ if( pFontGC_ ) XFreeGC( pDisplay, pFontGC_ ), pFontGC_ = None;
+ if( pBrushGC_ ) XFreeGC( pDisplay, pBrushGC_ ), pBrushGC_ = None;
+ if( pMonoGC_ ) XFreeGC( pDisplay, pMonoGC_ ), pMonoGC_ = None;
+ if( pCopyGC_ ) XFreeGC( pDisplay, pCopyGC_ ), pCopyGC_ = None;
+ if( pMaskGC_ ) XFreeGC( pDisplay, pMaskGC_ ), pMaskGC_ = None;
+ if( pInvertGC_ ) XFreeGC( pDisplay, pInvertGC_ ), pInvertGC_ = None;
+ if( pInvert50GC_ ) XFreeGC( pDisplay, pInvert50GC_ ), pInvert50GC_ = None;
+ if( pStippleGC_ ) XFreeGC( pDisplay, pStippleGC_ ), pStippleGC_ = None;
+ if( pTrackingGC_ ) XFreeGC( pDisplay, pTrackingGC_ ), pTrackingGC_ = None;
+ if( m_pDeleteColormap )
+ delete m_pDeleteColormap, m_pColormap = m_pDeleteColormap = NULL;
+
+ if( m_aRenderPicture )
+ XRenderPeer::GetInstance().FreePicture( m_aRenderPicture ), m_aRenderPicture = 0;
+
+ bPenGC_ = bFontGC_ = bBrushGC_ = bMonoGC_ = bCopyGC_ = bInvertGC_ = bInvert50GC_ = bStippleGC_ = bTrackingGC_ = false;
+}
+
+void X11SalGraphics::SetDrawable( Drawable aDrawable, int nScreen )
+{
+ // shortcut if nothing changed
+ if( hDrawable_ == aDrawable )
+ return;
+
+ // free screen specific resources if needed
+ if( nScreen != m_nScreen )
+ {
+ freeResources();
+ m_pColormap = &GetX11SalData()->GetDisplay()->GetColormap( nScreen );
+ m_nScreen = nScreen;
+ }
+
+ hDrawable_ = aDrawable;
+ SetXRenderFormat( NULL );
+ if( m_aRenderPicture )
+ {
+ XRenderPeer::GetInstance().FreePicture( m_aRenderPicture );
+ m_aRenderPicture = 0;
+ }
+
+ if( hDrawable_ )
+ {
+ nPenPixel_ = GetPixel( nPenColor_ );
+ nTextPixel_ = GetPixel( nTextColor_ );
+ nBrushPixel_ = GetPixel( nBrushColor_ );
+ }
+}
+
+void X11SalGraphics::Init( SalFrame *pFrame, Drawable aTarget, int nScreen )
+{
+#if 0 // TODO: use SetDrawable() instead
+ m_pColormap = &GetX11SalData()->GetDisplay()->GetColormap(nScreen);
+ hDrawable_ = aTarget;
+ m_nScreen = nScreen;
+ SetXRenderFormat( NULL );
+ if( m_aRenderPicture )
+ XRenderPeer::GetInstance().FreePicture( m_aRenderPicture ), m_aRenderPicture = 0;
+
+ nPenPixel_ = GetPixel( nPenColor_ );
+ nTextPixel_ = GetPixel( nTextColor_ );
+ nBrushPixel_ = GetPixel( nBrushColor_ );
+#else
+ m_pColormap = &GetX11SalData()->GetDisplay()->GetColormap(nScreen);
+ m_nScreen = nScreen;
+ SetDrawable( aTarget, nScreen );
+#endif
+
+ bWindow_ = TRUE;
+ m_pFrame = pFrame;
+ m_pVDev = NULL;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void X11SalGraphics::DeInit()
+{
+ SetDrawable( None, m_nScreen );
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void X11SalGraphics::SetClipRegion( GC pGC, XLIB_Region pXReg ) const
+{
+ Display *pDisplay = GetXDisplay();
+
+ int n = 0;
+ XLIB_Region Regions[3];
+
+ if( pClipRegion_ /* && !XEmptyRegion( pClipRegion_ ) */ )
+ Regions[n++] = pClipRegion_;
+// if( pPaintRegion_ /* && !XEmptyRegion( pPaintRegion_ ) */ )
+// Regions[n++] = pPaintRegion_;
+
+ if( pXReg && !XEmptyRegion( pXReg ) )
+ Regions[n++] = pXReg;
+
+ if( 0 == n )
+ XSetClipMask( pDisplay, pGC, None );
+ else if( 1 == n )
+ XSetRegion( pDisplay, pGC, Regions[0] );
+ else
+ {
+ XLIB_Region pTmpRegion = XCreateRegion();
+ XIntersectRegion( Regions[0], Regions[1], pTmpRegion );
+// if( 3 == n )
+// XIntersectRegion( Regions[2], pTmpRegion, pTmpRegion );
+ XSetRegion( pDisplay, pGC, pTmpRegion );
+ XDestroyRegion( pTmpRegion );
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+GC X11SalGraphics::SelectPen()
+{
+ Display *pDisplay = GetXDisplay();
+
+ if( !pPenGC_ )
+ {
+ XGCValues values;
+ values.subwindow_mode = ClipByChildren;
+ values.fill_rule = EvenOddRule; // Pict import/ Gradient
+ values.graphics_exposures = False;
+
+ pPenGC_ = XCreateGC( pDisplay, hDrawable_,
+ GCSubwindowMode | GCFillRule | GCGraphicsExposures,
+ &values );
+ }
+
+ if( !bPenGC_ )
+ {
+ if( nPenColor_ != SALCOLOR_NONE )
+ XSetForeground( pDisplay, pPenGC_, nPenPixel_ );
+ XSetFunction ( pDisplay, pPenGC_, bXORMode_ ? GXxor : GXcopy );
+ SetClipRegion( pPenGC_ );
+ bPenGC_ = TRUE;
+ }
+
+ return pPenGC_;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+GC X11SalGraphics::SelectBrush()
+{
+ Display *pDisplay = GetXDisplay();
+
+ DBG_ASSERT( nBrushColor_ != SALCOLOR_NONE, "Brush Transparent" );
+
+ if( !pBrushGC_ )
+ {
+ XGCValues values;
+ // values.subwindow_mode = IncludeInferiors;
+ values.subwindow_mode = ClipByChildren;
+ values.fill_rule = EvenOddRule; // Pict import/ Gradient
+ values.graphics_exposures = False;
+
+ pBrushGC_ = XCreateGC( pDisplay, hDrawable_,
+ GCSubwindowMode | GCFillRule | GCGraphicsExposures,
+ &values );
+ }
+
+ if( !bBrushGC_ )
+ {
+ if( !bDitherBrush_ )
+ {
+ XSetFillStyle ( pDisplay, pBrushGC_, FillSolid );
+ XSetForeground( pDisplay, pBrushGC_, nBrushPixel_ );
+ #if defined(_USE_PRINT_EXTENSION_)
+ XSetBackground( pDisplay, pBrushGC_,
+ WhitePixel(pDisplay, DefaultScreen(pDisplay)) );
+ #else
+ if( bPrinter_ )
+ XSetTile( pDisplay, pBrushGC_, None );
+ #endif
+ }
+ else
+ {
+ // Bug in Sun Solaris 2.5.1, XFillPolygon doesn't allways reflect
+ // changes of the tile. PROPERTY_BUG_Tile doesn't fix this !
+ if (GetDisplay()->GetProperties() & PROPERTY_BUG_FillPolygon_Tile)
+ XSetFillStyle ( pDisplay, pBrushGC_, FillSolid );
+
+ XSetFillStyle ( pDisplay, pBrushGC_, FillTiled );
+ XSetTile ( pDisplay, pBrushGC_, hBrush_ );
+ }
+ XSetFunction ( pDisplay, pBrushGC_, bXORMode_ ? GXxor : GXcopy );
+ SetClipRegion( pBrushGC_ );
+
+ bBrushGC_ = TRUE;
+ }
+
+ return pBrushGC_;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+GC X11SalGraphics::GetTrackingGC()
+{
+ const char dash_list[2] = {2, 2};
+
+ if( !pTrackingGC_ )
+ {
+ XGCValues values;
+
+ values.graphics_exposures = False;
+ values.foreground = m_pColormap->GetBlackPixel()
+ ^ m_pColormap->GetWhitePixel();
+ values.function = GXxor;
+ values.line_width = 1;
+ values.line_style = LineOnOffDash;
+
+ pTrackingGC_ = XCreateGC( GetXDisplay(), GetDrawable(),
+ GCGraphicsExposures | GCForeground | GCFunction
+ | GCLineWidth | GCLineStyle,
+ &values );
+ XSetDashes( GetXDisplay(), pTrackingGC_, 0, dash_list, 2 );
+ }
+
+ if( !bTrackingGC_ )
+ {
+ SetClipRegion( pTrackingGC_ );
+ bTrackingGC_ = TRUE;
+ }
+
+ return pTrackingGC_;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void X11SalGraphics::DrawLines( ULONG nPoints,
+ const SalPolyLine &rPoints,
+ GC pGC,
+ bool bClose
+ )
+{
+ // errechne wie viele Linien XWindow auf einmal zeichnen kann
+ ULONG nMaxLines = (GetDisplay()->GetMaxRequestSize() - sizeof(xPolyPointReq))
+ / sizeof(xPoint);
+ if( nMaxLines > nPoints ) nMaxLines = nPoints;
+
+ // gebe alle Linien aus, die XWindows zeichnen kann.
+ ULONG n;
+ for( n = 0; nPoints - n > nMaxLines; n += nMaxLines - 1 )
+ XDrawLines( GetXDisplay(),
+ GetDrawable(),
+ pGC,
+ &rPoints[n],
+ nMaxLines,
+ CoordModeOrigin );
+
+ if( n < nPoints )
+ XDrawLines( GetXDisplay(),
+ GetDrawable(),
+ pGC,
+ &rPoints[n],
+ nPoints - n,
+ CoordModeOrigin );
+ if( bClose )
+ {
+ if( rPoints[nPoints-1].x != rPoints[0].x || rPoints[nPoints-1].y != rPoints[0].y )
+ drawLine( rPoints[nPoints-1].x, rPoints[nPoints-1].y, rPoints[0].x, rPoints[0].y );
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+// Dithern: Calculate a dither-pixmap and make a brush of it
+#define P_DELTA 51
+#define DMAP( v, m ) ((v % P_DELTA) > m ? (v / P_DELTA) + 1 : (v / P_DELTA))
+
+BOOL X11SalGraphics::GetDitherPixmap( SalColor nSalColor )
+{
+ static const short nOrdDither8Bit[ 8 ][ 8 ] =
+ {
+ { 0, 38, 9, 48, 2, 40, 12, 50},
+ {25, 12, 35, 22, 28, 15, 37, 24},
+ { 6, 44, 3, 41, 8, 47, 5, 44},
+ {32, 19, 28, 16, 34, 21, 31, 18},
+ { 1, 40, 11, 49, 0, 39, 10, 48},
+ {27, 14, 36, 24, 26, 13, 36, 23},
+ { 8, 46, 4, 43, 7, 45, 4, 42},
+ {33, 20, 30, 17, 32, 20, 29, 16}
+ };
+
+ // test for correct depth (8bit)
+ if( GetColormap().GetVisual().GetDepth() != 8 )
+ return FALSE;
+
+ char pBits[64];
+ char *pBitsPtr = pBits;
+
+ // Set the pallette-entries for the dithering tile
+ UINT8 nSalColorRed = SALCOLOR_RED ( nSalColor );
+ UINT8 nSalColorGreen = SALCOLOR_GREEN ( nSalColor );
+ UINT8 nSalColorBlue = SALCOLOR_BLUE ( nSalColor );
+
+ for( int nY = 0; nY < 8; nY++ )
+ {
+ for( int nX = 0; nX < 8; nX++ )
+ {
+ short nMagic = nOrdDither8Bit[nY][nX];
+ UINT8 nR = P_DELTA * DMAP( nSalColorRed, nMagic );
+ UINT8 nG = P_DELTA * DMAP( nSalColorGreen, nMagic );
+ UINT8 nB = P_DELTA * DMAP( nSalColorBlue, nMagic );
+
+ *pBitsPtr++ = GetColormap().GetPixel( MAKE_SALCOLOR( nR, nG, nB ) );
+ }
+ }
+
+ // create the tile as ximage and an according pixmap -> caching
+ XImage *pImage = XCreateImage( GetXDisplay(),
+ GetColormap().GetXVisual(),
+ 8,
+ ZPixmap,
+ 0, // offset
+ pBits, // data
+ 8, 8, // width & height
+ 8, // bitmap_pad
+ 0 ); // (default) bytes_per_line
+
+ if ( GetDisplay()->GetProperties() & PROPERTY_BUG_Tile )
+ {
+ if (hBrush_)
+ XFreePixmap (GetXDisplay(), hBrush_);
+ hBrush_ = XCreatePixmap( GetXDisplay(), GetDrawable(), 8, 8, 8 );
+ }
+ else
+ if( !hBrush_ )
+ hBrush_ = XCreatePixmap( GetXDisplay(), GetDrawable(), 8, 8, 8 );
+
+ // put the ximage to the pixmap
+ XPutImage( GetXDisplay(),
+ hBrush_,
+ GetDisplay()->GetCopyGC( m_nScreen ),
+ pImage,
+ 0, 0, // Source
+ 0, 0, // Destination
+ 8, 8 ); // width & height
+
+ // destroy image-frame but not palette-data
+ pImage->data = NULL;
+ XDestroyImage( pImage );
+
+ return TRUE;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void X11SalGraphics::GetResolution( sal_Int32 &rDPIX, sal_Int32 &rDPIY ) // const
+{
+ const SalDisplay *pDisplay = GetDisplay();
+
+ rDPIX = pDisplay->GetResolution().A();
+ rDPIY = pDisplay->GetResolution().B();
+ if( !pDisplay->GetExactResolution() && rDPIY < 96 )
+ {
+ rDPIX = Divide( rDPIX * 96, rDPIY );
+ rDPIY = 96;
+ }
+ else if ( rDPIY > 200 )
+ {
+ rDPIX = Divide( rDPIX * 200, rDPIY );
+ rDPIY = 200;
+ }
+
+ // #i12705# equalize x- and y-resolution if they are close enough
+ if( rDPIX != rDPIY )
+ {
+ // different x- and y- resolutions are usually artifacts of
+ // a wrongly calculated screen size.
+ //if( (13*rDPIX >= 10*rDPIY) && (13*rDPIY >= 10*rDPIX) ) //+-30%
+ {
+#ifdef DEBUG
+ printf("Forcing Resolution from %" SAL_PRIdINT32 "x%" SAL_PRIdINT32 " to %" SAL_PRIdINT32 "x%" SAL_PRIdINT32 "\n",
+ rDPIX,rDPIY,rDPIY,rDPIY);
+#endif
+ rDPIX = rDPIY; // y-resolution is more trustworthy
+ }
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+USHORT X11SalGraphics::GetBitCount() // const
+{
+ return GetVisual().GetDepth();
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+long X11SalGraphics::GetGraphicsWidth() const
+{
+ if( m_pFrame )
+ return m_pFrame->maGeometry.nWidth;
+ else if( m_pVDev )
+ return m_pVDev->GetWidth();
+ else
+ return 0;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+long X11SalGraphics::GetGraphicsHeight() const
+{
+ if( m_pFrame )
+ return m_pFrame->maGeometry.nHeight;
+ else if( m_pVDev )
+ return m_pVDev->GetHeight();
+ else
+ return 0;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void X11SalGraphics::ResetClipRegion()
+{
+ if( pClipRegion_ )
+ {
+ bPenGC_ = FALSE;
+ bFontGC_ = FALSE;
+ bBrushGC_ = FALSE;
+ bMonoGC_ = FALSE;
+ bCopyGC_ = FALSE;
+ bInvertGC_ = FALSE;
+ bInvert50GC_ = FALSE;
+ bStippleGC_ = FALSE;
+ bTrackingGC_ = FALSE;
+
+ XDestroyRegion( pClipRegion_ );
+ pClipRegion_ = NULL;
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void X11SalGraphics::BeginSetClipRegion( ULONG )
+{
+ if( pClipRegion_ )
+ XDestroyRegion( pClipRegion_ );
+ pClipRegion_ = XCreateRegion();
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+BOOL X11SalGraphics::unionClipRegion( long nX, long nY, long nDX, long nDY )
+{
+ if (!nDX || !nDY)
+ return TRUE;
+
+ XRectangle aRect;
+ aRect.x = (short)nX;
+ aRect.y = (short)nY;
+ aRect.width = (unsigned short)nDX;
+ aRect.height = (unsigned short)nDY;
+
+ XUnionRectWithRegion( &aRect, pClipRegion_, pClipRegion_ );
+
+ return TRUE;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+bool X11SalGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& )
+{
+ // TODO: implement and advertise OutDevSupport_B2DClip support
+ return false;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void X11SalGraphics::EndSetClipRegion()
+{
+ bPenGC_ = FALSE;
+ bFontGC_ = FALSE;
+ bBrushGC_ = FALSE;
+ bMonoGC_ = FALSE;
+ bCopyGC_ = FALSE;
+ bInvertGC_ = FALSE;
+ bInvert50GC_ = FALSE;
+ bStippleGC_ = FALSE;
+ bTrackingGC_ = FALSE;
+
+ if( XEmptyRegion( pClipRegion_ ) )
+ {
+ XDestroyRegion( pClipRegion_ );
+ pClipRegion_= NULL;
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void X11SalGraphics::SetLineColor()
+{
+ if( nPenColor_ != SALCOLOR_NONE )
+ {
+ nPenColor_ = SALCOLOR_NONE;
+ bPenGC_ = FALSE;
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void X11SalGraphics::SetLineColor( SalColor nSalColor )
+{
+ if( nPenColor_ != nSalColor )
+ {
+ nPenColor_ = nSalColor;
+ nPenPixel_ = GetPixel( nSalColor );
+ bPenGC_ = FALSE;
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void X11SalGraphics::SetFillColor()
+{
+ if( nBrushColor_ != SALCOLOR_NONE )
+ {
+ bDitherBrush_ = FALSE;
+ nBrushColor_ = SALCOLOR_NONE;
+ bBrushGC_ = FALSE;
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void X11SalGraphics::SetFillColor( SalColor nSalColor )
+{
+ if( nBrushColor_ != nSalColor )
+ {
+ bDitherBrush_ = FALSE;
+ nBrushColor_ = nSalColor;
+ nBrushPixel_ = GetPixel( nSalColor );
+ if( TrueColor != GetColormap().GetVisual().GetClass()
+ && GetColormap().GetColor( nBrushPixel_ ) != nBrushColor_
+ && nSalColor != MAKE_SALCOLOR( 0x00, 0x00, 0x00 ) // black
+ && nSalColor != MAKE_SALCOLOR( 0x00, 0x00, 0x80 ) // blue
+ && nSalColor != MAKE_SALCOLOR( 0x00, 0x80, 0x00 ) // green
+ && nSalColor != MAKE_SALCOLOR( 0x00, 0x80, 0x80 ) // cyan
+ && nSalColor != MAKE_SALCOLOR( 0x80, 0x00, 0x00 ) // red
+ && nSalColor != MAKE_SALCOLOR( 0x80, 0x00, 0x80 ) // magenta
+ && nSalColor != MAKE_SALCOLOR( 0x80, 0x80, 0x00 ) // brown
+ && nSalColor != MAKE_SALCOLOR( 0x80, 0x80, 0x80 ) // gray
+ && nSalColor != MAKE_SALCOLOR( 0xC0, 0xC0, 0xC0 ) // light gray
+ && nSalColor != MAKE_SALCOLOR( 0x00, 0x00, 0xFF ) // light blue
+ && nSalColor != MAKE_SALCOLOR( 0x00, 0xFF, 0x00 ) // light green
+ && nSalColor != MAKE_SALCOLOR( 0x00, 0xFF, 0xFF ) // light cyan
+ && nSalColor != MAKE_SALCOLOR( 0xFF, 0x00, 0x00 ) // light red
+ && nSalColor != MAKE_SALCOLOR( 0xFF, 0x00, 0xFF ) // light magenta
+ && nSalColor != MAKE_SALCOLOR( 0xFF, 0xFF, 0x00 ) // light brown
+ && nSalColor != MAKE_SALCOLOR( 0xFF, 0xFF, 0xFF ) )
+ bDitherBrush_ = GetDitherPixmap(nSalColor);
+ bBrushGC_ = FALSE;
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void X11SalGraphics::SetROPLineColor( SalROPColor nROPColor )
+{
+ switch( nROPColor )
+ {
+ case SAL_ROP_0 : // 0
+ nPenPixel_ = (Pixel)0;
+ break;
+ case SAL_ROP_1 : // 1
+ nPenPixel_ = (Pixel)(1 << GetVisual().GetDepth()) - 1;
+ break;
+ case SAL_ROP_INVERT : // 2
+ nPenPixel_ = (Pixel)(1 << GetVisual().GetDepth()) - 1;
+ break;
+ }
+ nPenColor_ = GetColormap().GetColor( nPenPixel_ );
+ bPenGC_ = FALSE;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void X11SalGraphics::SetROPFillColor( SalROPColor nROPColor )
+{
+ switch( nROPColor )
+ {
+ case SAL_ROP_0 : // 0
+ nBrushPixel_ = (Pixel)0;
+ break;
+ case SAL_ROP_1 : // 1
+ nBrushPixel_ = (Pixel)(1 << GetVisual().GetDepth()) - 1;
+ break;
+ case SAL_ROP_INVERT : // 2
+ nBrushPixel_ = (Pixel)(1 << GetVisual().GetDepth()) - 1;
+ break;
+ }
+ bDitherBrush_ = FALSE;
+ nBrushColor_ = GetColormap().GetColor( nBrushPixel_ );
+ bBrushGC_ = FALSE;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void X11SalGraphics::SetXORMode( bool bSet, bool )
+{
+ if( !bXORMode_ == bSet )
+ {
+ bXORMode_ = bSet;
+ bPenGC_ = FALSE;
+ bBrushGC_ = FALSE;
+ bMonoGC_ = FALSE;
+ bCopyGC_ = FALSE;
+ bInvertGC_ = FALSE;
+ bInvert50GC_ = FALSE;
+ bStippleGC_ = FALSE;
+ bTrackingGC_ = FALSE;
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void X11SalGraphics::drawPixel( long nX, long nY )
+{
+ if( nPenColor_ != SALCOLOR_NONE )
+ XDrawPoint( GetXDisplay(), GetDrawable(), SelectPen(), nX, nY );
+}
+
+void X11SalGraphics::drawPixel( long nX, long nY, SalColor nSalColor )
+{
+ if( nSalColor != SALCOLOR_NONE )
+ {
+ Display *pDisplay = GetXDisplay();
+
+ if( (nPenColor_ == SALCOLOR_NONE) && !bPenGC_ )
+ {
+ SetLineColor( nSalColor );
+ XDrawPoint( pDisplay, GetDrawable(), SelectPen(), nX, nY );
+ nPenColor_ = SALCOLOR_NONE;
+ bPenGC_ = False;
+ }
+ else
+ {
+ GC pGC = SelectPen();
+
+ if( nSalColor != nPenColor_ )
+ XSetForeground( pDisplay, pGC, GetPixel( nSalColor ) );
+
+ XDrawPoint( pDisplay, GetDrawable(), pGC, nX, nY );
+
+ if( nSalColor != nPenColor_ )
+ XSetForeground( pDisplay, pGC, nPenPixel_ );
+ }
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void X11SalGraphics::drawLine( long nX1, long nY1, long nX2, long nY2 )
+{
+ if( nPenColor_ != SALCOLOR_NONE )
+ {
+ if ( GetDisplay()->GetProperties() & PROPERTY_BUG_DrawLine )
+ {
+ GC aGC = SelectPen();
+ XDrawPoint (GetXDisplay(), GetDrawable(), aGC, (int)nX1, (int)nY1);
+ XDrawPoint (GetXDisplay(), GetDrawable(), aGC, (int)nX2, (int)nY2);
+ XDrawLine (GetXDisplay(), GetDrawable(), aGC, nX1, nY1, nX2, nY2 );
+ }
+ else
+ XDrawLine( GetXDisplay(), GetDrawable(),SelectPen(),
+ nX1, nY1, nX2, nY2 );
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void X11SalGraphics::drawRect( long nX, long nY, long nDX, long nDY )
+{
+ if( nBrushColor_ != SALCOLOR_NONE )
+ {
+ XFillRectangle( GetXDisplay(),
+ GetDrawable(),
+ SelectBrush(),
+ nX, nY, nDX, nDY );
+ }
+ // Beschreibung DrawRect verkehrt, deshalb -1
+ if( nPenColor_ != SALCOLOR_NONE )
+ XDrawRectangle( GetXDisplay(),
+ GetDrawable(),
+ SelectPen(),
+ nX, nY, nDX-1, nDY-1 );
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void X11SalGraphics::drawPolyLine( ULONG nPoints, const SalPoint *pPtAry )
+{
+ drawPolyLine( nPoints, pPtAry, false );
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void X11SalGraphics::drawPolyLine( ULONG nPoints, const SalPoint *pPtAry, bool bClose )
+{
+ if( nPenColor_ != 0xFFFFFFFF )
+ {
+ SalPolyLine Points( nPoints, pPtAry );
+
+ DrawLines( nPoints, Points, SelectPen(), bClose );
+ }
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void X11SalGraphics::drawPolygon( ULONG nPoints, const SalPoint* pPtAry )
+{
+ if( nPoints == 0 )
+ return;
+
+ if( nPoints < 3 )
+ {
+ if( !bXORMode_ )
+ {
+ if( 1 == nPoints )
+ drawPixel( pPtAry[0].mnX, pPtAry[0].mnY );
+ else
+ drawLine( pPtAry[0].mnX, pPtAry[0].mnY,
+ pPtAry[1].mnX, pPtAry[1].mnY );
+ }
+ return;
+ }
+
+ SalPolyLine Points( nPoints, pPtAry );
+
+ nPoints++;
+
+ /* WORKAROUND: some Xservers (Xorg, VIA chipset in this case)
+ * do not draw the visible part of a polygon
+ * if it overlaps to the left of screen 0,y.
+ * This happens to be the case in the gradient drawn in the
+ * menubar background. workaround for the special case of
+ * of a rectangle overlapping to the left.
+ */
+ if( nPoints == 5 &&
+ Points[ 0 ].x == Points[ 1 ].x &&
+ Points[ 1 ].y == Points[ 2 ].y &&
+ Points[ 2 ].x == Points[ 3 ].x &&
+ Points[ 0 ].x == Points[ 4 ].x && Points[ 0 ].y == Points[ 4 ].y
+ )
+ {
+ bool bLeft = false;
+ bool bRight = false;
+ for(unsigned int i = 0; i < nPoints; i++ )
+ {
+ if( Points[i].x < 0 )
+ bLeft = true;
+ else
+ bRight= true;
+ }
+ if( bLeft && ! bRight )
+ return;
+ if( bLeft && bRight )
+ {
+ for( unsigned int i = 0; i < nPoints; i++ )
+ if( Points[i].x < 0 )
+ Points[i].x = 0;
+ }
+ }
+
+ if( nBrushColor_ != SALCOLOR_NONE )
+ XFillPolygon( GetXDisplay(),
+ GetDrawable(),
+ SelectBrush(),
+ &Points[0], nPoints,
+ Complex, CoordModeOrigin );
+
+ if( nPenColor_ != 0xFFFFFFFF )
+ DrawLines( nPoints, Points, SelectPen(), true );
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void X11SalGraphics::drawPolyPolygon( sal_uInt32 nPoly,
+ const sal_uInt32 *pPoints,
+ PCONSTSALPOINT *pPtAry )
+{
+ if( nBrushColor_ != SALCOLOR_NONE )
+ {
+ ULONG i, n;
+ XLIB_Region pXRegA = NULL;
+
+ for( i = 0; i < nPoly; i++ ) {
+ n = pPoints[i];
+ SalPolyLine Points( n, pPtAry[i] );
+ if( n > 2 )
+ {
+ XLIB_Region pXRegB = XPolygonRegion( &Points[0], n+1, WindingRule );
+ if( !pXRegA )
+ pXRegA = pXRegB;
+ else
+ {
+ XXorRegion( pXRegA, pXRegB, pXRegA );
+ XDestroyRegion( pXRegB );
+ }
+ }
+ }
+
+ if( pXRegA )
+ {
+ XRectangle aXRect;
+ XClipBox( pXRegA, &aXRect );
+
+ GC pGC = SelectBrush();
+ SetClipRegion( pGC, pXRegA ); // ??? doppelt
+ XDestroyRegion( pXRegA );
+ bBrushGC_ = FALSE;
+
+ XFillRectangle( GetXDisplay(),
+ GetDrawable(),
+ pGC,
+ aXRect.x, aXRect.y, aXRect.width, aXRect.height );
+ }
+ }
+
+ if( nPenColor_ != SALCOLOR_NONE )
+ for( ULONG i = 0; i < nPoly; i++ )
+ drawPolyLine( pPoints[i], pPtAry[i], true );
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+sal_Bool X11SalGraphics::drawPolyLineBezier( ULONG, const SalPoint*, const BYTE* )
+{
+ return sal_False;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+sal_Bool X11SalGraphics::drawPolygonBezier( ULONG, const SalPoint*, const BYTE* )
+{
+ return sal_False;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+sal_Bool X11SalGraphics::drawPolyPolygonBezier( sal_uInt32, const sal_uInt32*,
+ const SalPoint* const*, const BYTE* const* )
+{
+ return sal_False;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+void X11SalGraphics::invert( ULONG nPoints,
+ const SalPoint* pPtAry,
+ SalInvert nFlags )
+{
+ SalPolyLine Points ( nPoints, pPtAry );
+
+ GC pGC;
+ if( SAL_INVERT_50 & nFlags )
+ pGC = GetInvert50GC();
+ else
+ if ( SAL_INVERT_TRACKFRAME & nFlags )
+ pGC = GetTrackingGC();
+ else
+ pGC = GetInvertGC();
+
+ if( SAL_INVERT_TRACKFRAME & nFlags )
+ DrawLines ( nPoints, Points, pGC, true );
+ else
+ XFillPolygon( GetXDisplay(),
+ GetDrawable(),
+ pGC,
+ &Points[0], nPoints,
+ Complex, CoordModeOrigin );
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+BOOL X11SalGraphics::drawEPS( long,long,long,long,void*,ULONG )
+{
+ return FALSE;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+XID X11SalGraphics::GetXRenderPicture()
+{
+ if( !m_aRenderPicture )
+ {
+ // check xrender support for matching visual
+ // find a XRenderPictFormat compatible with the Drawable
+ XRenderPeer& rRenderPeer = XRenderPeer::GetInstance();
+ XRenderPictFormat* pVisualFormat = static_cast<XRenderPictFormat*>(GetXRenderFormat());
+ if( !pVisualFormat )
+ {
+ Visual* pVisual = GetDisplay()->GetVisual( m_nScreen ).GetVisual();
+ pVisualFormat = rRenderPeer.FindVisualFormat( pVisual );
+ if( !pVisualFormat )
+ return 0;
+ // cache the XRenderPictFormat
+ SetXRenderFormat( static_cast<void*>(pVisualFormat) );
+ }
+
+ // get the matching xrender target for drawable
+ m_aRenderPicture = rRenderPeer.CreatePicture( hDrawable_, pVisualFormat, 0, NULL );
+ }
+
+#if 0
+ // setup clipping so the callers don't have to do it themselves
+ // TODO: avoid clipping if already set correctly
+ if( pClipRegion_ && !XEmptyRegion( pClipRegion_ ) )
+ rRenderPeer.SetPictureClipRegion( aDstPic, pClipRegion_ );
+#endif
+
+ return m_aRenderPicture;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+SystemGraphicsData X11SalGraphics::GetGraphicsData() const
+{
+ SystemGraphicsData aRes;
+
+ aRes.nSize = sizeof(aRes);
+ aRes.pDisplay = GetXDisplay();
+ aRes.hDrawable = hDrawable_;
+ aRes.pVisual = GetDisplay()->GetVisual( m_nScreen ).GetVisual();
+ aRes.nScreen = m_nScreen;
+ aRes.nDepth = GetDisplay()->GetVisual( m_nScreen ).GetDepth();
+ aRes.aColormap = GetDisplay()->GetColormap( m_nScreen ).GetXColormap();
+ aRes.pRenderFormat = m_pRenderFormat;
+ return aRes;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+// B2DPolygon support methods
+
+namespace { // anonymous namespace to prevent export
+// the methods and structures here are used by the
+// B2DPolyPolygon->RenderTrapezoid conversion algorithm
+
+// compare two line segments
+// assumption: both segments point downward
+// assumption: they must have at least some y-overlap
+// assumption: rA.p1.y <= rB.p1.y
+bool IsLeftOf( const XLineFixed& rA, const XLineFixed& rB )
+{
+ bool bAbove = (rA.p1.y <= rB.p1.y);
+ const XLineFixed& rU = bAbove ? rA : rB;
+ const XLineFixed& rL = bAbove ? rB : rA;
+
+ const XFixed aXDiff = rU.p2.x - rU.p1.x;
+ const XFixed aYDiff = rU.p2.y - rU.p1.y;
+
+ if( (rU.p1.y != rL.p1.y) || (rU.p1.x != rL.p1.x) )
+ {
+ const sal_Int64 n1 = (sal_Int64)aXDiff * (rL.p1.y - rU.p1.y);
+ const sal_Int64 n2 = (sal_Int64)aYDiff * (rL.p1.x - rU.p1.x);
+ if( n1 != n2 )
+ return ((n1 < n2) == bAbove);
+ }
+
+ if( (rU.p2.y != rL.p2.y) || (rU.p2.x != rL.p2.x) )
+ {
+ const sal_Int64 n3 = (sal_Int64)aXDiff * (rL.p2.y - rU.p1.y);
+ const sal_Int64 n4 = (sal_Int64)aYDiff * (rL.p2.x - rU.p1.x);
+ if( n3 != n4 )
+ return ((n3 < n4) == bAbove);
+ }
+
+ // both segments overlap
+ return false;
+}
+
+struct HalfTrapezoid
+{
+ // assumptions:
+ // maLine.p1.y <= mnY < maLine.p2.y
+ XLineFixed maLine;
+ XFixed mnY;
+};
+
+struct HalfTrapCompare
+{
+ bool operator()( const HalfTrapezoid& rA, const HalfTrapezoid& rB ) const
+ {
+ bool bIsTopLeft = false;
+ if( rA.mnY != rB.mnY ) // sort top-first if possible
+ bIsTopLeft = (rA.mnY < rB.mnY);
+ else // else sort left-first
+ bIsTopLeft = IsLeftOf( rA.maLine, rB.maLine );
+ // adjust to priority_queue sorting convention
+ return !bIsTopLeft;
+ }
+};
+
+typedef std::priority_queue< HalfTrapezoid, std::vector<HalfTrapezoid>, HalfTrapCompare > HTQueueBase;
+// we need a priority queue with a reserve() to prevent countless reallocations
+class HTQueue
+: public HTQueueBase
+{
+public:
+ void reserve( size_t n ) { c.reserve( n ); }
+ int capacity() { return c.capacity(); }
+};
+
+typedef std::vector<XTrapezoid> TrapezoidVector;
+
+class TrapezoidXCompare
+{
+ const TrapezoidVector& mrVector;
+public:
+ TrapezoidXCompare( const TrapezoidVector& rVector )
+ : mrVector( rVector ) {}
+ bool operator()( int nA, int nB ) const
+ { return IsLeftOf( mrVector[nA].left, mrVector[nB].left ); }
+};
+
+typedef std::multiset< int, TrapezoidXCompare > ActiveTrapSet;
+
+class TrapezoidYCompare
+{
+ const TrapezoidVector& mrVector;
+public:
+ TrapezoidYCompare( const TrapezoidVector& rVector )
+ : mrVector( rVector ) {}
+ bool operator()( int nA, int nB ) const
+ { return (mrVector[nA].bottom < mrVector[nB].bottom); }
+};
+
+typedef std::multiset< int, TrapezoidYCompare > VerticalTrapSet;
+} // end of anonymous namespace
+
+// draw a poly-polygon
+bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly, double fTransparency)
+{
+ // nothing to do for empty polypolygons
+ const int nPolygonCount = rPolyPoly.count();
+ if( nPolygonCount <= 0 )
+ return TRUE;
+
+ // nothing to do if everything is transparent
+ if( (nBrushColor_ == SALCOLOR_NONE)
+ && (nPenColor_ == SALCOLOR_NONE) )
+ return TRUE;
+
+ // cannot handle pencolor!=brushcolor yet
+ if( (nPenColor_ != SALCOLOR_NONE)
+ && (nPenColor_ != nBrushColor_) )
+ return FALSE;
+
+ // TODO: remove the env-variable when no longer needed
+ static const char* pRenderEnv = getenv( "SAL_DISABLE_RENDER_POLY" );
+ if( pRenderEnv )
+ return FALSE;
+
+ // check xrender support for trapezoids
+ XRenderPeer& rRenderPeer = XRenderPeer::GetInstance();
+ if( !rRenderPeer.AreTrapezoidsSupported() )
+ return FALSE;
+ Picture aDstPic = GetXRenderPicture();
+ // check xrender support for this drawable
+ if( !aDstPic )
+ return FALSE;
+
+ // don't bother with polygons outside of visible area
+ const basegfx::B2DRange aViewRange( 0, 0, GetGraphicsWidth(), GetGraphicsHeight() );
+ const basegfx::B2DRange aPolyRange = basegfx::tools::getRange( rPolyPoly );
+ const bool bNeedViewClip = !aPolyRange.isInside( aViewRange );
+ if( !aPolyRange.overlaps( aViewRange ) )
+ return true;
+
+ // convert the polypolygon to trapezoids
+
+ // first convert the B2DPolyPolygon to HalfTrapezoids
+ // #i100922# try to prevent priority-queue reallocations by reservering enough
+ int nHTQueueReserve = 0;
+ for( int nOuterPolyIdx = 0; nOuterPolyIdx < nPolygonCount; ++nOuterPolyIdx )
+ {
+ const ::basegfx::B2DPolygon aOuterPolygon = rPolyPoly.getB2DPolygon( nOuterPolyIdx );
+ const int nPointCount = aOuterPolygon.count();
+ nHTQueueReserve += aOuterPolygon.areControlPointsUsed() ? 8 * nPointCount : nPointCount;
+ }
+ nHTQueueReserve = ((4*nHTQueueReserve) | 0x1FFF) + 1;
+ HTQueue aHTQueue;
+ aHTQueue.reserve( nHTQueueReserve );
+ for( int nOuterPolyIdx = 0; nOuterPolyIdx < nPolygonCount; ++nOuterPolyIdx )
+ {
+ const ::basegfx::B2DPolygon aOuterPolygon = rPolyPoly.getB2DPolygon( nOuterPolyIdx );
+
+ // render-trapezoids should be inside the view => clip polygon against view range
+ basegfx::B2DPolyPolygon aClippedPolygon( aOuterPolygon );
+ if( bNeedViewClip )
+ {
+ aClippedPolygon = basegfx::tools::clipPolygonOnRange( aOuterPolygon, aViewRange, true, false );
+ DBG_ASSERT( aClippedPolygon.count(), "polygon confirmed to overlap with view should not get here" );
+ if( !aClippedPolygon.count() )
+ continue;
+ }
+
+ // render-trapezoids have linear edges => get rid of bezier segments
+ if( aClippedPolygon.areControlPointsUsed() )
+ aClippedPolygon = ::basegfx::tools::adaptiveSubdivideByDistance( aClippedPolygon, 0.125 );
+
+ // test and remove self intersections
+ // TODO: make code intersection save, then remove this test
+ basegfx::B2DPolyPolygon aInnerPolyPoly(basegfx::tools::solveCrossovers( aClippedPolygon));
+ const int nInnerPolyCount = aInnerPolyPoly.count();
+ for( int nInnerPolyIdx = 0; nInnerPolyIdx < nInnerPolyCount; ++nInnerPolyIdx )
+ {
+ ::basegfx::B2DPolygon aInnerPolygon = aInnerPolyPoly.getB2DPolygon( nInnerPolyIdx );
+ const int nPointCount = aInnerPolygon.count();
+ if( !nPointCount )
+ continue;
+
+ aHTQueue.reserve( aHTQueue.size() + 8 * nPointCount );
+
+ // convert polygon point pairs to HalfTrapezoids
+ // connect the polygon point with the first one if needed
+ XPointFixed aOldXPF = { 0, 0 };
+ XPointFixed aNewXPF;
+ for( int nPointIdx = 0; nPointIdx <= nPointCount; ++nPointIdx, aOldXPF = aNewXPF )
+ {
+ const int k = (nPointIdx < nPointCount) ? nPointIdx : 0;
+ const ::basegfx::B2DPoint& aPoint = aInnerPolygon.getB2DPoint( k );
+
+ // convert the B2DPoint into XRENDER units
+ if(getAntiAliasB2DDraw())
+ {
+ aNewXPF.x = XDoubleToFixed( aPoint.getX() );
+ aNewXPF.y = XDoubleToFixed( aPoint.getY() );
+ }
+ else
+ {
+ aNewXPF.x = XDoubleToFixed( basegfx::fround( aPoint.getX() ) );
+ aNewXPF.y = XDoubleToFixed( basegfx::fround( aPoint.getY() ) );
+ }
+
+ // check if enough data is available for a new HalfTrapezoid
+ if( nPointIdx == 0 )
+ continue;
+ // ignore vertical segments
+ if( aNewXPF.y == aOldXPF.y )
+ continue;
+
+ // construct HalfTrapezoid as topdown segment
+ HalfTrapezoid aHT;
+ if( aNewXPF.y < aOldXPF.y )
+ {
+ aHT.maLine.p1 = aNewXPF;
+ aHT.maLine.p2 = aOldXPF;
+ }
+ else
+ {
+ aHT.maLine.p2 = aNewXPF;
+ aHT.maLine.p1 = aOldXPF;
+ }
+
+ aHT.mnY = aHT.maLine.p1.y;
+
+#if 0 // ignore clipped HalfTrapezoids
+ if( aHT.mnY < 0 )
+ aHT.mnY = 0;
+ else if( aHT.mnY > 10000 )
+ continue;
+#endif
+
+ // queue up the HalfTrapezoid
+ aHTQueue.push( aHT );
+ }
+ }
+ }
+
+ if( aHTQueue.empty() )
+ return TRUE;
+
+ // then convert the HalfTrapezoids into full Trapezoids
+ TrapezoidVector aTrapVector;
+ aTrapVector.reserve( aHTQueue.size() * 2 ); // just a guess
+
+ TrapezoidXCompare aTrapXCompare( aTrapVector );
+ ActiveTrapSet aActiveTraps( aTrapXCompare );
+
+ TrapezoidYCompare aTrapYCompare( aTrapVector );
+ VerticalTrapSet aVerticalTraps( aTrapYCompare );
+
+ while( !aHTQueue.empty() )
+ {
+ XTrapezoid aTrapezoid;
+
+ // convert a HalfTrapezoid pair
+ const HalfTrapezoid& rLeft = aHTQueue.top();
+ aTrapezoid.top = rLeft.mnY;
+ aTrapezoid.bottom = rLeft.maLine.p2.y;
+ aTrapezoid.left = rLeft.maLine;
+
+#if 0
+ // ignore empty trapezoids
+ if( aTrapezoid.bottom <= aTrapezoid.top )
+ continue;
+#endif
+
+ aHTQueue.pop();
+ if( aHTQueue.empty() ) // TODO: assert
+ break;
+ const HalfTrapezoid& rRight = aHTQueue.top();
+ aTrapezoid.right = rRight.maLine;
+ aHTQueue.pop();
+
+ aTrapezoid.bottom = aTrapezoid.left.p2.y;
+ if( aTrapezoid.bottom > aTrapezoid.right.p2.y )
+ aTrapezoid.bottom = aTrapezoid.right.p2.y;
+
+ // keep the full Trapezoid candidate
+ aTrapVector.push_back( aTrapezoid );
+
+ // unless it splits an older trapezoid
+ bool bSplit = false;
+ for(;;)
+ {
+ // check if the new trapezoid overlaps with an old trapezoid
+ ActiveTrapSet::iterator aActiveTrapsIt
+ = aActiveTraps.upper_bound( aTrapVector.size()-1 );
+ if( aActiveTrapsIt == aActiveTraps.begin() )
+ break;
+ --aActiveTrapsIt;
+
+ XTrapezoid& rLeftTrap = aTrapVector[ *aActiveTrapsIt ];
+
+ // in the ActiveTrapSet there are still trapezoids where
+ // a vertical overlap with new trapezoids is no longer possible
+ // they could have been removed in the verticaltraps loop below
+ // but this would have been expensive and is not needed as we can
+ // simply ignore them now and remove them from the ActiveTrapSet
+ // so they won't bother us in the future
+ if( rLeftTrap.bottom <= aTrapezoid.top )
+ {
+ aActiveTraps.erase( aActiveTrapsIt );
+ continue;
+ }
+
+ // check if there is horizontal overlap
+ // aTrapezoid.left==rLeftTrap.right is allowed though
+ if( !IsLeftOf( aTrapezoid.left, rLeftTrap.right ) )
+ break;
+
+ // split the old trapezoid and keep its upper part
+ // find the old trapezoids entry in the VerticalTrapSet and remove it
+ typedef std::pair<VerticalTrapSet::iterator, VerticalTrapSet::iterator> VTSPair;
+ VTSPair aVTSPair = aVerticalTraps.equal_range( *aActiveTrapsIt );
+ VerticalTrapSet::iterator aVTSit = aVTSPair.first;
+ for(; (aVTSit != aVTSPair.second) && (*aVTSit != *aActiveTrapsIt); ++aVTSit ) ;
+ if( aVTSit != aVTSPair.second )
+ aVerticalTraps.erase( aVTSit );
+ // then update the old trapezoid's bottom
+ rLeftTrap.bottom = aTrapezoid.top;
+ // enter the updated old trapzoid in VerticalTrapSet
+ aVerticalTraps.insert( aVerticalTraps.begin(), *aActiveTrapsIt );
+ // the old trapezoid is no longer active
+ aActiveTraps.erase( aActiveTrapsIt );
+
+ // the trapezoid causing the split has become obsolete
+ // so its both sides have to be re-queued
+ HalfTrapezoid aHT;
+ aHT.mnY = aTrapezoid.top;
+ aHT.maLine = aTrapezoid.left;
+ aHTQueue.push( aHT );
+ aHT.maLine = aTrapezoid.right;
+ aHTQueue.push( aHT );
+
+ bSplit = true;
+ break;
+ }
+
+ // keep or forget the resulting full Trapezoid
+ if( bSplit )
+ aTrapVector.pop_back();
+ else
+ {
+ aActiveTraps.insert( aTrapVector.size()-1 );
+ aVerticalTraps.insert( aTrapVector.size()-1 );
+ }
+
+ // mark trapezoids that can no longer be split as inactive
+ // and recycle their sides which were not fully resolved
+ static const XFixed nMaxTop = +0x7FFFFFFF;
+ XFixed nNewTop = aHTQueue.empty() ? nMaxTop : aHTQueue.top().mnY;
+ while( !aVerticalTraps.empty() )
+ {
+ const XTrapezoid& rOldTrap = aTrapVector[ *aVerticalTraps.begin() ];
+ if( nNewTop < rOldTrap.bottom )
+ break;
+ // the reference Trapezoid can no longer be split
+ aVerticalTraps.erase( aVerticalTraps.begin() );
+
+ // recycle its sides that were not fully resolved
+ HalfTrapezoid aHT;
+ aHT.mnY = rOldTrap.bottom;
+ if( rOldTrap.left.p2.y > rOldTrap.bottom )
+ {
+ aHT.maLine = rOldTrap.left;
+ aHTQueue.push( aHT );
+ }
+ if( rOldTrap.right.p2.y > rOldTrap.bottom )
+ {
+ aHT.maLine = rOldTrap.right;
+ aHTQueue.push( aHT );
+ }
+ }
+ }
+
+ // create xrender Picture for polygon foreground
+ SalDisplay::RenderEntry& rEntry = GetDisplay()->GetRenderEntries( m_nScreen )[ 32 ];
+ if( !rEntry.m_aPicture )
+ {
+ Display* pXDisplay = GetXDisplay();
+
+ rEntry.m_aPixmap = ::XCreatePixmap( pXDisplay, hDrawable_, 1, 1, 32 );
+ XRenderPictureAttributes aAttr;
+ aAttr.repeat = true;
+
+ XRenderPictFormat* pXRPF = rRenderPeer.FindStandardFormat( PictStandardARGB32 );
+ rEntry.m_aPicture = rRenderPeer.CreatePicture( rEntry.m_aPixmap, pXRPF, CPRepeat, &aAttr );
+ }
+
+ // set polygon foreground color and opacity
+ XRenderColor aRenderColor = GetXRenderColor( nBrushColor_ , fTransparency );
+ rRenderPeer.FillRectangle( PictOpSrc, rEntry.m_aPicture, &aRenderColor, 0, 0, 1, 1 );
+
+ // set clipping
+ // TODO: move into GetXRenderPicture?
+ if( pClipRegion_ && !XEmptyRegion( pClipRegion_ ) )
+ rRenderPeer.SetPictureClipRegion( aDstPic, pClipRegion_ );
+
+ // render the trapezoids
+ const XRenderPictFormat* pMaskFormat = rRenderPeer.GetStandardFormatA8();
+ rRenderPeer.CompositeTrapezoids( PictOpOver,
+ rEntry.m_aPicture, aDstPic, pMaskFormat, 0, 0, &aTrapVector[0], aTrapVector.size() );
+
+ return TRUE;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+bool X11SalGraphics::drawPolyLine(const ::basegfx::B2DPolygon& rPolygon, const ::basegfx::B2DVector& rLineWidth, basegfx::B2DLineJoin eLineJoin)
+{
+ const XRenderPeer& rRenderPeer = XRenderPeer::GetInstance();
+ if( !rRenderPeer.AreTrapezoidsSupported() )
+ return false;
+
+ // get the area polygon for the line polygon
+ basegfx::B2DPolygon aPolygon = rPolygon;
+ if( (rLineWidth.getX() != rLineWidth.getY())
+ && !basegfx::fTools::equalZero( rLineWidth.getY() ) )
+ {
+ // prepare for createAreaGeometry() with anisotropic linewidth
+ basegfx::B2DHomMatrix aAnisoMatrix;
+ aAnisoMatrix.scale( 1.0, rLineWidth.getX() / rLineWidth.getY() );
+ aPolygon.transform( aAnisoMatrix );
+ }
+
+ // AW: reSegment no longer needed; new createAreaGeometry will remove exteme positions
+ // and create bezier polygons
+ //if( aPolygon.areControlPointsUsed() )
+ // aPolygon = basegfx::tools::reSegmentPolygonEdges( aPolygon, 8, true, false );
+ //const basegfx::B2DPolyPolygon aAreaPolyPoly = basegfx::tools::createAreaGeometryForSimplePolygon(
+ // aPolygon, 0.5*rLineWidth.getX(), eLineJoin );
+ const basegfx::B2DPolyPolygon aAreaPolyPoly(basegfx::tools::createAreaGeometry(aPolygon, 0.5*rLineWidth.getX(), eLineJoin));
+
+ if( (rLineWidth.getX() != rLineWidth.getY())
+ && !basegfx::fTools::equalZero( rLineWidth.getX() ) )
+ {
+ // postprocess createAreaGeometry() for anisotropic linewidth
+ basegfx::B2DHomMatrix aAnisoMatrix;
+ aAnisoMatrix.scale( 1.0, rLineWidth.getY() / rLineWidth.getX() );
+ aPolygon.transform( aAnisoMatrix );
+ }
+
+ // temporarily adjust brush color to pen color
+ // since the line is drawn as an area-polygon
+ const SalColor aKeepBrushColor = nBrushColor_;
+ nBrushColor_ = nPenColor_;
+
+ // draw each area polypolygon component individually
+ // to emulate the polypolygon winding rule "non-zero"
+ bool bDrawOk = true;
+ const int nPolyCount = aAreaPolyPoly.count();
+ for( int nPolyIdx = 0; nPolyIdx < nPolyCount; ++nPolyIdx )
+ {
+ const ::basegfx::B2DPolyPolygon aOnePoly( aAreaPolyPoly.getB2DPolygon( nPolyIdx ) );
+ bDrawOk = drawPolyPolygon( aOnePoly, 0.0);
+ if( !bDrawOk )
+ break;
+ }
+
+ // restore the original brush GC
+ nBrushColor_ = aKeepBrushColor;
+ return bDrawOk;
+}
+
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
diff --git a/vcl/unx/source/gdi/salgdi2.cxx b/vcl/unx/source/gdi/salgdi2.cxx
index 5a01b7f13d39..1d8e80df0663 100644
--- a/vcl/unx/source/gdi/salgdi2.cxx
+++ b/vcl/unx/source/gdi/salgdi2.cxx
@@ -796,21 +796,15 @@ bool X11SalGraphics::drawAlphaBitmap( const SalTwoRect& rTR,
if( rPeer.GetVersion() < 0x02 )
return false;
- const SalDisplay* pSalDisp = GetDisplay();
- const SalVisual& rSalVis = pSalDisp->GetVisual( m_nScreen );
- Display* pXDisplay = pSalDisp->GetDisplay();
-
// create destination picture
- // TODO: scoped Pixmap and Pictures
- Visual* pDstXVisual = rSalVis.GetVisual();
- XRenderPictFormat* pDstVisFmt = rPeer.FindVisualFormat( pDstXVisual );
- if( !pDstVisFmt )
- return false;
-
- Picture aDstPic = rPeer.CreatePicture( hDrawable_, pDstVisFmt, 0, NULL );
+ Picture aDstPic = GetXRenderPicture();
if( !aDstPic )
return false;
+ const SalDisplay* pSalDisp = GetDisplay();
+ const SalVisual& rSalVis = pSalDisp->GetVisual( m_nScreen );
+ Display* pXDisplay = pSalDisp->GetDisplay();
+
// create source Picture
int nDepth = m_pVDev ? m_pVDev->GetDepth() : rSalVis.GetDepth();
const X11SalBitmap& rSrcX11Bmp = static_cast<const X11SalBitmap&>( rSrcBitmap );
@@ -829,7 +823,12 @@ bool X11SalGraphics::drawAlphaBitmap( const SalTwoRect& rTR,
if( !aSrcPM )
return false;
- XRenderPictFormat* pSrcVisFmt = pDstVisFmt;
+ // create source picture
+ // TODO: use scoped picture
+ Visual* pSrcXVisual = rSalVis.GetVisual();
+ XRenderPictFormat* pSrcVisFmt = rPeer.FindVisualFormat( pSrcXVisual );
+ if( !pSrcVisFmt )
+ return false;
Picture aSrcPic = rPeer.CreatePicture( aSrcPM, pSrcVisFmt, 0, NULL );
if( !aSrcPic )
return false;
@@ -843,16 +842,16 @@ bool X11SalGraphics::drawAlphaBitmap( const SalTwoRect& rTR,
// an XImage needs its data top_down
// TODO: avoid wrongly oriented images in upper layers!
const int nImageSize = pAlphaBuffer->mnHeight * pAlphaBuffer->mnScanlineSize;
- const char* pSrc = (char*)pAlphaBuffer->mpBits;
+ const char* pSrcBits = (char*)pAlphaBuffer->mpBits;
char* pAlphaBits = new char[ nImageSize ];
if( BMP_SCANLINE_ADJUSTMENT( pAlphaBuffer->mnFormat ) == BMP_FORMAT_TOP_DOWN )
- memcpy( pAlphaBits, pSrc, nImageSize );
+ memcpy( pAlphaBits, pSrcBits, nImageSize );
else
{
- char* pDst = pAlphaBits + nImageSize;
+ char* pDstBits = pAlphaBits + nImageSize;
const int nLineSize = pAlphaBuffer->mnScanlineSize;
- for(; (pDst -= nLineSize) >= pAlphaBits; pSrc += nLineSize )
- memcpy( pDst, pSrc, nLineSize );
+ for(; (pDstBits -= nLineSize) >= pAlphaBits; pSrcBits += nLineSize )
+ memcpy( pDstBits, pSrcBits, nLineSize );
}
// the alpha values need to be inverted for XRender
@@ -866,7 +865,7 @@ bool X11SalGraphics::drawAlphaBitmap( const SalTwoRect& rTR,
*pCDst = ~*pCDst;
const XRenderPictFormat* pAlphaFormat = rPeer.GetStandardFormatA8();
- XImage* pAlphaImg = XCreateImage( pXDisplay, pDstXVisual, 8, ZPixmap, 0,
+ XImage* pAlphaImg = XCreateImage( pXDisplay, pSrcXVisual, 8, ZPixmap, 0,
pAlphaBits, pAlphaBuffer->mnWidth, pAlphaBuffer->mnHeight,
pAlphaFormat->depth, pAlphaBuffer->mnScanlineSize );
@@ -904,7 +903,6 @@ bool X11SalGraphics::drawAlphaBitmap( const SalTwoRect& rTR,
rPeer.FreePicture( aAlphaPic );
XFreePixmap(pXDisplay, aAlphaPM);
rPeer.FreePicture( aSrcPic );
- rPeer.FreePicture( aDstPic );
return true;
}
@@ -922,20 +920,10 @@ bool X11SalGraphics::drawAlphaRect( long nX, long nY, long nWidth,
return false;
XRenderPeer& rPeer = XRenderPeer::GetInstance();
- if( rPeer.GetVersion() < 0x02 )
+ if( rPeer.GetVersion() < 0x02 ) // TODO: replace with better test
return false;
- const SalDisplay* pSalDisp = GetDisplay();
- const SalVisual& rSalVis = pSalDisp->GetVisual( m_nScreen );
-
- // create destination picture
- // TODO: scoped Pixmap and Pictures
- Visual* pDstXVisual = rSalVis.GetVisual();
- XRenderPictFormat* pDstVisFmt = rPeer.FindVisualFormat( pDstXVisual );
- if( !pDstVisFmt )
- return false;
-
- Picture aDstPic = rPeer.CreatePicture( hDrawable_, pDstVisFmt, 0, NULL );
+ Picture aDstPic = GetXRenderPicture();
if( !aDstPic )
return false;
@@ -948,9 +936,6 @@ bool X11SalGraphics::drawAlphaRect( long nX, long nY, long nWidth,
nX, nY,
nWidth, nHeight );
- // cleanup
- rPeer.FreePicture( aDstPic );
-
return true;
}
diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx
index 9cbd9a075dff..d1a60cda4097 100644
--- a/vcl/unx/source/gdi/salgdi3.cxx
+++ b/vcl/unx/source/gdi/salgdi3.cxx
@@ -1023,29 +1023,22 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout )
void X11SalGraphics::DrawServerAAFontString( const ServerFontLayout& rLayout )
{
- Display* pDisplay = GetXDisplay();
- XRenderPeer& rRenderPeer = XRenderPeer::GetInstance();
-
- // find a XRenderPictFormat compatible with the Drawable
- XRenderPictFormat* pVisualFormat = static_cast<XRenderPictFormat*>(GetXRenderFormat());
- if( !pVisualFormat )
- {
- Visual* pVisual = GetDisplay()->GetVisual( m_nScreen ).GetVisual();
- pVisualFormat = rRenderPeer.FindVisualFormat( pVisual );
- // cache the XRenderPictFormat
- SetXRenderFormat( static_cast<void*>(pVisualFormat) );
- }
-
- DBG_ASSERT( pVisualFormat!=NULL, "no matching XRenderPictFormat for text" );
- if( !pVisualFormat )
+ // get xrender target for this drawable
+ Picture aDstPic = GetXRenderPicture();
+ if( !aDstPic )
return;
// get a XRenderPicture for the font foreground
+ // TODO: move into own method
+ XRenderPeer& rRenderPeer = XRenderPeer::GetInstance();
+ XRenderPictFormat* pVisualFormat = (XRenderPictFormat*)GetXRenderFormat();
+ DBG_ASSERT( pVisualFormat, "we already have a render picture, but XRenderPictFormat==NULL???");
const int nVisualDepth = pVisualFormat->depth;
SalDisplay::RenderEntry& rEntry = GetDisplay()->GetRenderEntries( m_nScreen )[ nVisualDepth ];
if( !rEntry.m_aPicture )
{
// create and cache XRenderPicture for the font foreground
+ Display* pDisplay = GetXDisplay();
#ifdef DEBUG
int iDummy;
unsigned uDummy;
@@ -1067,12 +1060,10 @@ void X11SalGraphics::DrawServerAAFontString( const ServerFontLayout& rLayout )
XRenderColor aRenderColor = GetXRenderColor( nTextPixel_ );
rRenderPeer.FillRectangle( PictOpSrc, rEntry.m_aPicture, &aRenderColor, 0, 0, 1, 1 );
- // notify xrender of target drawable
- Picture aDst = rRenderPeer.CreatePicture( hDrawable_, pVisualFormat, 0, NULL );
-
// set clipping
+ // TODO: move into GetXRenderPicture()?
if( pClipRegion_ && !XEmptyRegion( pClipRegion_ ) )
- rRenderPeer.SetPictureClipRegion( aDst, pClipRegion_ );
+ rRenderPeer.SetPictureClipRegion( aDstPic, pClipRegion_ );
ServerFont& rFont = rLayout.GetServerFont();
X11GlyphPeer& rGlyphPeer = X11GlyphCache::GetInstance().GetPeer();
@@ -1096,12 +1087,9 @@ void X11SalGraphics::DrawServerAAFontString( const ServerFontLayout& rLayout )
unsigned int aRenderAry[ MAXGLYPHS ];
for( int i = 0; i < nGlyphs; ++i )
aRenderAry[ i ] = rGlyphPeer.GetGlyphId( rFont, aGlyphAry[i] );
- rRenderPeer.CompositeString32( rEntry.m_aPicture, aDst,
+ rRenderPeer.CompositeString32( rEntry.m_aPicture, aDstPic,
aGlyphSet, aPos.X(), aPos.Y(), aRenderAry, nGlyphs );
}
-
- // cleanup
- rRenderPeer.FreePicture( aDst );
}
//--------------------------------------------------------------------------
diff --git a/vcl/unx/source/gdi/salprnpsp.cxx b/vcl/unx/source/gdi/salprnpsp.cxx
index b3fdfaef56ce..2cf4e3baedd3 100644
--- a/vcl/unx/source/gdi/salprnpsp.cxx
+++ b/vcl/unx/source/gdi/salprnpsp.cxx
@@ -126,37 +126,6 @@ inline int PtTo10Mu( int nPoints ) { return (int)((((double)nPoints)*35.27777778
inline int TenMuToPt( int nUnits ) { return (int)((((double)nUnits)/35.27777778)+0.5); }
-static struct
-{
- int width;
- int height;
- const char* name;
- int namelength;
- Paper paper;
-} aPaperTab[] =
-{
- { 29700, 42000, "A3", 2, PAPER_A3 },
- { 21000, 29700, "A4", 2, PAPER_A4 },
- { 14800, 21000, "A5", 2, PAPER_A5 },
- { 25000, 35300, "B4", 2, PAPER_B4 },
- { 17600, 25000, "B5", 2, PAPER_B5 },
- { 21600, 27900, "Letter", 6, PAPER_LETTER },
- { 21600, 35600, "Legal", 5, PAPER_LEGAL },
- { 27900, 43100, "Tabloid", 7, PAPER_TABLOID },
- { 0, 0, "USER", 4, PAPER_USER }
-};
-
-static Paper getPaperType( const String& rPaperName )
-{
- ByteString aPaper( rPaperName, RTL_TEXTENCODING_ISO_8859_1 );
- for( unsigned int i = 0; i < sizeof( aPaperTab )/sizeof( aPaperTab[0] ); i++ )
- {
- if( ! rtl_str_compareIgnoreAsciiCase( aPaper.GetBuffer(), aPaperTab[i].name ) )
- return aPaperTab[i].paper;
- }
- return PAPER_USER;
-}
-
static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData )
{
pJobSetup->meOrientation = (Orientation)(rData.m_eOrientation == orientation::Landscape ? ORIENTATION_LANDSCAPE : ORIENTATION_PORTRAIT);
@@ -166,7 +135,8 @@ static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData )
int width, height;
rData.m_aContext.getPageSize( aPaper, width, height );
- pJobSetup->mePaperFormat = getPaperType( aPaper );
+ pJobSetup->mePaperFormat = PaperInfo::fromPSName(OUStringToOString( aPaper, RTL_TEXTENCODING_ISO_8859_1 ));
+
pJobSetup->mnPaperWidth = 0;
pJobSetup->mnPaperHeight = 0;
if( pJobSetup->mePaperFormat == PAPER_USER )
@@ -248,7 +218,7 @@ static bool passFileToCommandLine( const String& rFilename, const String& rComma
struct stat aStat;
if( stat( aFilename.GetBuffer(), &aStat ) )
fprintf( stderr, "stat( %s ) failed\n", aFilename.GetBuffer() );
- fprintf( stderr, "Tmp file %s has modes: %o\n", aFilename.GetBuffer(), aStat.st_mode );
+ fprintf( stderr, "Tmp file %s has modes: 0%03lo\n", aFilename.GetBuffer(), (long)aStat.st_mode );
#endif
const char* argv[4];
if( ! ( argv[ 0 ] = getenv( "SHELL" ) ) )
@@ -544,14 +514,9 @@ void PspSalInfoPrinter::InitPaperFormats( const ImplJobSetup* )
for( int i = 0; i < nValues; i++ )
{
const PPDValue* pValue = pKey->getValue( i );
- vcl::PaperInfo aInfo;
- aInfo.m_aPaperName = pValue->m_aOptionTranslation;
- if( ! aInfo.m_aPaperName.Len() )
- aInfo.m_aPaperName = pValue->m_aOption;
int nWidth = 0, nHeight = 0;
m_aJobData.m_pParser->getPaperDimension( pValue->m_aOption, nWidth, nHeight );
- aInfo.m_nPaperWidth = (unsigned long)((PtTo10Mu( nWidth )+50)/100);
- aInfo.m_nPaperHeight = (unsigned long)((PtTo10Mu( nHeight )+50)/100);
+ PaperInfo aInfo(PtTo10Mu( nWidth ), PtTo10Mu( nHeight ));
m_aPaperFormats.push_back( aInfo );
}
}
@@ -730,7 +695,7 @@ BOOL PspSalInfoPrinter::SetData(
TenMuToPt( pJobSetup->mnPaperWidth ),
TenMuToPt( pJobSetup->mnPaperHeight ) );
else
- aPaper = String( ByteString( aPaperTab[ pJobSetup->mePaperFormat ].name ), RTL_TEXTENCODING_ISO_8859_1 );
+ aPaper = rtl::OStringToOUString(PaperInfo::toPSName(pJobSetup->mePaperFormat), RTL_TEXTENCODING_ISO_8859_1);
pKey = aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ) );
pValue = pKey ? pKey->getValueCaseInsensitive( aPaper ) : NULL;
diff --git a/vcl/unx/source/gdi/salvd.cxx b/vcl/unx/source/gdi/salvd.cxx
index 915c42661fdc..66e582e231b7 100644
--- a/vcl/unx/source/gdi/salvd.cxx
+++ b/vcl/unx/source/gdi/salvd.cxx
@@ -121,16 +121,14 @@ void X11SalGraphics::Init( X11SalVirtualDevice *pDevice, SalColormap* pColormap,
if (m_pDeleteColormap != pOrigDeleteColormap)
delete pOrigDeleteColormap;
- hDrawable_ = pDevice->GetDrawable();
+ const Drawable aVdevDrawable = pDevice->GetDrawable();
+ SetDrawable( aVdevDrawable, m_nScreen );
+
m_pVDev = pDevice;
m_pFrame = NULL;
bWindow_ = pDisplay->IsDisplay();
bVirDev_ = TRUE;
-
- nPenPixel_ = GetPixel( nPenColor_ );
- nTextPixel_ = GetPixel( nTextColor_ );
- nBrushPixel_ = GetPixel( nBrushColor_ );
}
// -=-= SalVirDevData / SalVirtualDevice -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
@@ -274,3 +272,4 @@ void X11SalVirtualDevice::GetSize( long& rWidth, long& rHeight )
rWidth = GetWidth();
rHeight = GetHeight();
}
+
diff --git a/vcl/unx/source/gdi/xrender_peer.cxx b/vcl/unx/source/gdi/xrender_peer.cxx
index 861bf0e454aa..d8f2045c6fde 100644
--- a/vcl/unx/source/gdi/xrender_peer.cxx
+++ b/vcl/unx/source/gdi/xrender_peer.cxx
@@ -82,7 +82,7 @@ void XRenderPeer::InitRenderLib()
// we don't know if we are running on a system with xrender library
// we don't want to install system libraries ourselves
// => load them dynamically when they are there
- OUString aLibName( RTL_CONSTASCII_USTRINGPARAM( "libXrender.so.1" ));
+ const OUString aLibName( RTL_CONSTASCII_USTRINGPARAM( "libXrender.so.1" ));
mpRenderLib = osl_loadModule( aLibName.pData, SAL_LOADMODULE_DEFAULT );
if( !mpRenderLib ) {
#ifdef DEBUG
@@ -93,98 +93,81 @@ void XRenderPeer::InitRenderLib()
return;
}
- OUString aQueryExtensionFuncName(RTL_CONSTASCII_USTRINGPARAM("XRenderQueryExtension"));
oslGenericFunction pFunc;
- pFunc = osl_getFunctionSymbol( mpRenderLib, aQueryExtensionFuncName.pData);
+ pFunc = osl_getAsciiFunctionSymbol( mpRenderLib, "XRenderQueryExtension" );
if( !pFunc ) return;
mpXRenderQueryExtension = (Bool(*)(Display*,int*,int*))pFunc;
- OUString aQueryVersionFuncName(RTL_CONSTASCII_USTRINGPARAM("XRenderQueryVersion"));
- pFunc = osl_getFunctionSymbol( mpRenderLib, aQueryVersionFuncName.pData);
+ pFunc = osl_getAsciiFunctionSymbol( mpRenderLib, "XRenderQueryVersion" );
if( !pFunc ) return;
mpXRenderQueryVersion = (void(*)(Display*,int*,int*))pFunc;
- OUString aVisFormatFuncName(RTL_CONSTASCII_USTRINGPARAM("XRenderFindVisualFormat"));
- pFunc = osl_getFunctionSymbol( mpRenderLib, aVisFormatFuncName.pData);
+ pFunc = osl_getAsciiFunctionSymbol( mpRenderLib, "XRenderFindVisualFormat" );
if( !pFunc ) return;
mpXRenderFindVisualFormat = (XRenderPictFormat*(*)(Display*,Visual*))pFunc;
- OUString aStdFormatFuncName(RTL_CONSTASCII_USTRINGPARAM("XRenderFindStandardFormat"));
- pFunc = osl_getFunctionSymbol( mpRenderLib, aStdFormatFuncName.pData);
+ pFunc = osl_getAsciiFunctionSymbol( mpRenderLib, "XRenderFindStandardFormat" );
if( !pFunc ) return;
mpXRenderFindStandardFormat = (XRenderPictFormat*(*)(Display*,int))pFunc;
- OUString aFmtFuncName(RTL_CONSTASCII_USTRINGPARAM("XRenderFindFormat"));
- pFunc = osl_getFunctionSymbol( mpRenderLib, aFmtFuncName.pData);
+ pFunc = osl_getAsciiFunctionSymbol( mpRenderLib, "XRenderFindFormat" );
if( !pFunc ) return;
mpXRenderFindFormat = (XRenderPictFormat*(*)(Display*,unsigned long,
const XRenderPictFormat*,int))pFunc;
- OUString aCreatGlyphFuncName(RTL_CONSTASCII_USTRINGPARAM("XRenderCreateGlyphSet"));
- pFunc = osl_getFunctionSymbol( mpRenderLib, aCreatGlyphFuncName.pData);
+ pFunc = osl_getAsciiFunctionSymbol( mpRenderLib, "XRenderCreateGlyphSet" );
if( !pFunc ) return;
mpXRenderCreateGlyphSet = (GlyphSet(*)(Display*,const XRenderPictFormat*))pFunc;
- OUString aFreeGlyphFuncName(RTL_CONSTASCII_USTRINGPARAM("XRenderFreeGlyphSet"));
- pFunc = osl_getFunctionSymbol( mpRenderLib, aFreeGlyphFuncName.pData);
+ pFunc = osl_getAsciiFunctionSymbol( mpRenderLib, "XRenderFreeGlyphSet" );
if( !pFunc ) return;
mpXRenderFreeGlyphSet = (void(*)(Display*,GlyphSet))pFunc;
- OUString aAddGlyphFuncName(RTL_CONSTASCII_USTRINGPARAM("XRenderAddGlyphs"));
- pFunc = osl_getFunctionSymbol( mpRenderLib, aAddGlyphFuncName.pData);
+ pFunc = osl_getAsciiFunctionSymbol( mpRenderLib, "XRenderAddGlyphs" );
if( !pFunc ) return;
mpXRenderAddGlyphs = (void(*)(Display*,GlyphSet,Glyph*,const XGlyphInfo*,
int,const char*,int))pFunc;
- OUString aFreeGlyphsFuncName(RTL_CONSTASCII_USTRINGPARAM("XRenderFreeGlyphs"));
- pFunc = osl_getFunctionSymbol( mpRenderLib, aFreeGlyphsFuncName.pData);
+ pFunc = osl_getAsciiFunctionSymbol( mpRenderLib, "XRenderFreeGlyphs" );
if( !pFunc ) return;
mpXRenderFreeGlyphs = (void(*)(Display*,GlyphSet,Glyph*,int))pFunc;
- OUString aCompStringFuncName(RTL_CONSTASCII_USTRINGPARAM("XRenderCompositeString32"));
- pFunc = osl_getFunctionSymbol( mpRenderLib, aCompStringFuncName.pData);
+ pFunc = osl_getAsciiFunctionSymbol( mpRenderLib, "XRenderCompositeString32" );
if( !pFunc ) return;
mpXRenderCompositeString32 = (void(*)(Display*,int,Picture,Picture,
const XRenderPictFormat*,GlyphSet,int,int,int,int,const unsigned*,int))pFunc;
- OUString aCreatPicFuncName(RTL_CONSTASCII_USTRINGPARAM("XRenderCreatePicture"));
- pFunc = osl_getFunctionSymbol( mpRenderLib, aCreatPicFuncName.pData);
+ pFunc = osl_getAsciiFunctionSymbol( mpRenderLib, "XRenderCreatePicture" );
if( !pFunc ) return;
mpXRenderCreatePicture = (Picture(*)(Display*,Drawable,const XRenderPictFormat*,
unsigned long,const XRenderPictureAttributes*))pFunc;
- OUString aSetClipFuncName(RTL_CONSTASCII_USTRINGPARAM("XRenderSetPictureClipRegion"));
- pFunc = osl_getFunctionSymbol( mpRenderLib, aSetClipFuncName.pData);
+ pFunc = osl_getAsciiFunctionSymbol( mpRenderLib, "XRenderSetPictureClipRegion" );
if( !pFunc ) return;
mpXRenderSetPictureClipRegion = (void(*)(Display*,Picture,XLIB_Region))pFunc;
- OUString aFreePicFuncName(RTL_CONSTASCII_USTRINGPARAM("XRenderFreePicture"));
- pFunc = osl_getFunctionSymbol( mpRenderLib, aFreePicFuncName.pData);
+ pFunc = osl_getAsciiFunctionSymbol( mpRenderLib, "XRenderFreePicture" );
if( !pFunc ) return;
mpXRenderFreePicture = (void(*)(Display*,Picture))pFunc;
- OUString aRenderCompositeFuncName(RTL_CONSTASCII_USTRINGPARAM("XRenderComposite"));
- pFunc = osl_getFunctionSymbol( mpRenderLib, aRenderCompositeFuncName.pData);
+ pFunc = osl_getAsciiFunctionSymbol( mpRenderLib, "XRenderComposite" );
if( !pFunc ) return;
mpXRenderComposite = (void(*)(Display*,int,Picture,Picture,Picture,
int,int,int,int,int,int,unsigned,unsigned))pFunc;
- OUString aFillRectangleFuncName(RTL_CONSTASCII_USTRINGPARAM("XRenderFillRectangle"));
- pFunc=osl_getFunctionSymbol( mpRenderLib, aFillRectangleFuncName.pData);
+ pFunc = osl_getAsciiFunctionSymbol( mpRenderLib, "XRenderFillRectangle" );
if( !pFunc ) return;
mpXRenderFillRectangle = (void(*)(Display*,int,Picture,const XRenderColor*,
int,int,unsigned int,unsigned int))pFunc;
- OUString aCompositeTrapsFuncName( RTL_CONSTASCII_USTRINGPARAM("XRenderCompositeTrapezoids"));
- pFunc=osl_getFunctionSymbol( mpRenderLib, aCompositeTrapsFuncName.pData);
+ pFunc = osl_getAsciiFunctionSymbol( mpRenderLib, "XRenderCompositeTrapezoids" );
#if 0 // not having trapezoid support is supported
if( !pFunc ) return;
#endif
mpXRenderCompositeTrapezoids = (void(*)(Display*,int,Picture,Picture,
const XRenderPictFormat*,int,int,const XTrapezoid*,int))pFunc;
- OUString aAddTrapsFuncName( RTL_CONSTASCII_USTRINGPARAM("XRenderAddTraps"));
- pFunc=osl_getFunctionSymbol( mpRenderLib, aAddTrapsFuncName.pData);
+ pFunc = osl_getAsciiFunctionSymbol( mpRenderLib, "XRenderAddTraps" );
#if 0 // not having trapezoid support is supported
if( !pFunc ) return;
#endif
diff --git a/vcl/unx/source/plugadapt/salplug.cxx b/vcl/unx/source/plugadapt/salplug.cxx
index 2177c9549eff..0c791ca8091f 100644
--- a/vcl/unx/source/plugadapt/salplug.cxx
+++ b/vcl/unx/source/plugadapt/salplug.cxx
@@ -79,8 +79,7 @@ static SalInstance* tryInstance( const OUString& rModuleBase )
SAL_LOADMODULE_DEFAULT );
if( aMod )
{
- OUString aSym( RTL_CONSTASCII_USTRINGPARAM( "create_SalInstance" ) );
- salFactoryProc aProc = (salFactoryProc)osl_getFunctionSymbol( aMod, aSym.pData );
+ salFactoryProc aProc = (salFactoryProc)osl_getAsciiFunctionSymbol( aMod, "create_SalInstance" );
if( aProc )
{
pInst = aProc( aMod );
@@ -113,7 +112,7 @@ static SalInstance* tryInstance( const OUString& rModuleBase )
{
#if OSL_DEBUG_LEVEL > 1
std::fprintf( stderr, "could not load symbol %s from shared object %s\n",
- OUStringToOString( aSym, RTL_TEXTENCODING_ASCII_US ).getStr(),
+ "create_SalInstance",
OUStringToOString( aModule, RTL_TEXTENCODING_ASCII_US ).getStr() );
#endif
osl_unloadModule( aMod );
diff --git a/vcl/unx/source/printer/printerinfomanager.cxx b/vcl/unx/source/printer/printerinfomanager.cxx
index cf5a4a886c41..b3e5b4667a6a 100644
--- a/vcl/unx/source/printer/printerinfomanager.cxx
+++ b/vcl/unx/source/printer/printerinfomanager.cxx
@@ -44,6 +44,8 @@
#include "tools/debug.hxx"
#include "tools/config.hxx"
+#include "i18npool/paper.hxx"
+
#include "rtl/strbuf.hxx"
#include "osl/thread.hxx"
@@ -154,77 +156,9 @@ void PrinterInfoManager::setCUPSDisabled( bool bDisable )
void PrinterInfoManager::initSystemDefaultPaper()
{
- bool bSuccess = false;
-
- // try libpaper
-
- // #i78617# workaround missing paperconf command
- FILE* pPipe = popen( "sh -c paperconf 2>/dev/null", "r" );
- if( pPipe )
- {
- char pBuffer[ 1024 ];
- *pBuffer = 0;
- fgets( pBuffer, sizeof(pBuffer)-1, pPipe );
- pclose( pPipe );
-
- ByteString aPaper( pBuffer );
- aPaper = WhitespaceToSpace( aPaper );
- if( aPaper.Len() )
- {
- m_aSystemDefaultPaper = OUString( OStringToOUString( aPaper, osl_getThreadTextEncoding() ) );
- bSuccess = true;
- #if OSL_DEBUG_LEVEL > 1
- fprintf( stderr, "paper from paperconf = %s\n", aPaper.GetBuffer() );
- #endif
- }
- if( bSuccess )
- return;
- }
-
- // default value is Letter for US (en_US), Cannada (en_CA, fr_CA); else A4
- // en will be interpreted as en_US
-
- // note: at this point m_aSystemDefaultPaper is set to "A4" from the constructor
-
- // check for LC_PAPER
- const char* pPaperLang = getenv( "LC_PAPER" );
- if( pPaperLang && *pPaperLang )
- {
- OString aLang( pPaperLang );
- if( aLang.getLength() > 5 )
- aLang = aLang.copy( 0, 5 );
- if( aLang.getLength() == 5 )
- {
- if( aLang.equalsIgnoreAsciiCase( "en_us" )
- || aLang.equalsIgnoreAsciiCase( "en_ca" )
- || aLang.equalsIgnoreAsciiCase( "fr_ca" )
- )
- m_aSystemDefaultPaper = OUString( RTL_CONSTASCII_USTRINGPARAM( "Letter" ) );
- }
- else if( aLang.getLength() == 2 && aLang.equalsIgnoreAsciiCase( "en" ) )
- m_aSystemDefaultPaper = OUString( RTL_CONSTASCII_USTRINGPARAM( "Letter" ) );
- return;
- }
-
- // use process locale to determine paper
- rtl_Locale* pLoc = NULL;
- osl_getProcessLocale( &pLoc );
- if( pLoc )
- {
- if( 0 == rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( pLoc->Language->buffer, pLoc->Language->length, "en") )
- {
- if( 0 == rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( pLoc->Country->buffer, pLoc->Country->length, "us")
- || 0 == rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( pLoc->Country->buffer, pLoc->Country->length, "ca")
- || pLoc->Country->length == 0
- )
- m_aSystemDefaultPaper = OUString( RTL_CONSTASCII_USTRINGPARAM( "Letter" ) );
- }
- else if( 0 == rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( pLoc->Language->buffer, pLoc->Language->length, "fr") )
- {
- if( 0 == rtl_ustr_ascii_compareIgnoreAsciiCase_WithLength( pLoc->Country->buffer, pLoc->Country->length, "ca") )
- m_aSystemDefaultPaper = OUString( RTL_CONSTASCII_USTRINGPARAM( "Letter" ) );
- }
- }
+ m_aSystemDefaultPaper = rtl::OStringToOUString(
+ PaperInfo::toPSName(PaperInfo::getSystemDefaultPaper().getPaper()),
+ RTL_TEXTENCODING_UTF8);
}
// -----------------------------------------------------------------
diff --git a/vcl/util/linksvp/makefile.mk b/vcl/util/linksvp/makefile.mk
index 8e7d6f35ef83..e5e82323af5c 100644
--- a/vcl/util/linksvp/makefile.mk
+++ b/vcl/util/linksvp/makefile.mk
@@ -54,6 +54,7 @@ SHL1LIBS=$(LIB1TARGET)
SHL1DEPN=$(LB)$/libvcl$(DLLPOSTFIX)$(DLLPOST)
SHL1STDLIBS=\
$(VCLLIB)\
+ $(I18NPAPERLIB)\
$(BASEBMPLIB)\
$(BASEGFXLIB)\
$(TOOLSLIB) \
diff --git a/vcl/util/makefile.mk b/vcl/util/makefile.mk
index 08d6f9197f28..96c28980118f 100644
--- a/vcl/util/makefile.mk
+++ b/vcl/util/makefile.mk
@@ -170,8 +170,9 @@ SHL1STDLIBS+=\
$(SOTLIB) \
$(UNOTOOLSLIB) \
$(TOOLSLIB) \
+ $(I18NPAPERLIB) \
$(I18NISOLANGLIB) \
- $(I18NUTILLIB) \
+ $(I18NUTILLIB) \
$(COMPHELPERLIB) \
$(UCBHELPERLIB) \
$(CPPUHELPERLIB) \
@@ -264,6 +265,7 @@ SHL2DEPN=$(SHL1IMPLIBN) $(SHL1TARGETN)
# libs for generic plugin
SHL2STDLIBS=\
$(VCLLIB)\
+ $(I18NPAPERLIB) \
$(TOOLSLIB) \
$(VOSLIB) \
$(BASEGFXLIB) \
diff --git a/vcl/win/source/gdi/MAKEFILE.MK b/vcl/win/source/gdi/MAKEFILE.MK
index d50abc1b5aa3..a6d84d41f3ea 100644
--- a/vcl/win/source/gdi/MAKEFILE.MK
+++ b/vcl/win/source/gdi/MAKEFILE.MK
@@ -44,7 +44,6 @@ TARGET=salgdi
# --- #105371#
.IF "$(COM)"=="GCC"
-CDEFS += -UWINVER -DWINVER=0x0400
.ELSE
CFLAGS += -DWINVER=0x0400
.ENDIF
diff --git a/vcl/win/source/gdi/salnativewidgets-luna.cxx b/vcl/win/source/gdi/salnativewidgets-luna.cxx
index b99f0e2a6ce0..5a5703e10944 100644
--- a/vcl/win/source/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/source/gdi/salnativewidgets-luna.cxx
@@ -100,18 +100,12 @@ VisualStylesAPI::VisualStylesAPI()
if ( mhModule )
{
- OUString queryFuncName( RTL_CONSTASCII_USTRINGPARAM( "OpenThemeData" ) );
- lpfnOpenThemeData = (OpenThemeData_Proc_T) osl_getSymbol( mhModule, queryFuncName.pData );
- queryFuncName = OUString( RTL_CONSTASCII_USTRINGPARAM( "CloseThemeData" ) );
- lpfnCloseThemeData = (CloseThemeData_Proc_T) osl_getSymbol( mhModule, queryFuncName.pData );
- queryFuncName = OUString( RTL_CONSTASCII_USTRINGPARAM( "GetThemeBackgroundContentRect" ) );
- lpfnGetThemeBackgroundContentRect = (GetThemeBackgroundContentRect_Proc_T) osl_getSymbol( mhModule, queryFuncName.pData );
- queryFuncName = OUString( RTL_CONSTASCII_USTRINGPARAM( "DrawThemeBackground" ) );
- lpfnDrawThemeBackground = (DrawThemeBackground_Proc_T) osl_getSymbol( mhModule, queryFuncName.pData );
- queryFuncName = OUString( RTL_CONSTASCII_USTRINGPARAM( "DrawThemeText" ) );
- lpfnDrawThemeText = (DrawThemeText_Proc_T) osl_getSymbol( mhModule, queryFuncName.pData );
- queryFuncName = OUString( RTL_CONSTASCII_USTRINGPARAM( "GetThemePartSize" ) );
- lpfnGetThemePartSize = (GetThemePartSize_Proc_T) osl_getSymbol( mhModule, queryFuncName.pData );
+ lpfnOpenThemeData = (OpenThemeData_Proc_T)osl_getAsciiFunctionSymbol( mhModule, "OpenThemeData" );
+ lpfnCloseThemeData = (CloseThemeData_Proc_T)osl_getAsciiFunctionSymbol( mhModule, "CloseThemeData" );
+ lpfnGetThemeBackgroundContentRect = (GetThemeBackgroundContentRect_Proc_T)osl_getAsciiFunctionSymbol( mhModule, "GetThemeBackgroundContentRect" );
+ lpfnDrawThemeBackground = (DrawThemeBackground_Proc_T)osl_getAsciiFunctionSymbol( mhModule, "DrawThemeBackground" );
+ lpfnDrawThemeText = (DrawThemeText_Proc_T)osl_getAsciiFunctionSymbol( mhModule, "DrawThemeText" );
+ lpfnGetThemePartSize = (GetThemePartSize_Proc_T)osl_getAsciiFunctionSymbol( mhModule, "GetThemePartSize" );
}
else
{
diff --git a/vcl/win/source/gdi/salprn.cxx b/vcl/win/source/gdi/salprn.cxx
index cc359da97cd9..ecf91aea7c1b 100644
--- a/vcl/win/source/gdi/salprn.cxx
+++ b/vcl/win/source/gdi/salprn.cxx
@@ -894,6 +894,24 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS
}
switch( CHOOSE_DEVMODE(dmPaperSize) )
{
+ case( DMPAPER_LETTER ):
+ pSetupData->mePaperFormat = PAPER_LETTER;
+ break;
+ case( DMPAPER_TABLOID ):
+ pSetupData->mePaperFormat = PAPER_TABLOID;
+ break;
+ case( DMPAPER_LEDGER ):
+ pSetupData->mePaperFormat = PAPER_LEDGER;
+ break;
+ case( DMPAPER_LEGAL ):
+ pSetupData->mePaperFormat = PAPER_LEGAL;
+ break;
+ case( DMPAPER_STATEMENT ):
+ pSetupData->mePaperFormat = PAPER_STATEMENT;
+ break;
+ case( DMPAPER_EXECUTIVE ):
+ pSetupData->mePaperFormat = PAPER_EXECUTIVE;
+ break;
case( DMPAPER_A3 ):
pSetupData->mePaperFormat = PAPER_A3;
break;
@@ -903,20 +921,138 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS
case( DMPAPER_A5 ):
pSetupData->mePaperFormat = PAPER_A5;
break;
+ //See http://wiki.services.openoffice.org/wiki/DefaultPaperSize
+ //i.e.
+ //http://msdn.microsoft.com/en-us/library/dd319099(VS.85).aspx
+ //DMPAPER_B4 12 B4 (JIS) 257 x 364 mm
+ //http://partners.adobe.com/public/developer/en/ps/5003.PPD_Spec_v4.3.pdf
+ //also says that the MS DMPAPER_B4 is JIS, which makes most sense. And
+ //matches our Excel filter's belief about the matching XlPaperSize
+ //enumeration.
+ //
+ //http://msdn.microsoft.com/en-us/library/ms776398(VS.85).aspx said
+ ////"DMPAPER_B4 12 B4 (JIS) 250 x 354"
+ //which is bogus as it's either JIS 257 × 364 or ISO 250 × 353
+ //(cmc)
case( DMPAPER_B4 ):
- pSetupData->mePaperFormat = PAPER_B4;
+ pSetupData->mePaperFormat = PAPER_B4_JIS;
break;
case( DMPAPER_B5 ):
- pSetupData->mePaperFormat = PAPER_B5;
+ pSetupData->mePaperFormat = PAPER_B5_JIS;
break;
- case( DMPAPER_LETTER ):
+ case( DMPAPER_QUARTO ):
+ pSetupData->mePaperFormat = PAPER_QUARTO;
+ break;
+ case( DMPAPER_10X14 ):
+ pSetupData->mePaperFormat = PAPER_10x14;
+ break;
+ case( DMPAPER_NOTE ):
pSetupData->mePaperFormat = PAPER_LETTER;
break;
- case( DMPAPER_LEGAL ):
- pSetupData->mePaperFormat = PAPER_LEGAL;
+ case( DMPAPER_ENV_9 ):
+ pSetupData->mePaperFormat = PAPER_ENV_9;
break;
- case( DMPAPER_TABLOID ):
- pSetupData->mePaperFormat = PAPER_TABLOID;
+ case( DMPAPER_ENV_10 ):
+ pSetupData->mePaperFormat = PAPER_ENV_10;
+ break;
+ case( DMPAPER_ENV_11 ):
+ pSetupData->mePaperFormat = PAPER_ENV_11;
+ break;
+ case( DMPAPER_ENV_12 ):
+ pSetupData->mePaperFormat = PAPER_ENV_12;
+ break;
+ case( DMPAPER_ENV_14 ):
+ pSetupData->mePaperFormat = PAPER_ENV_14;
+ break;
+ case( DMPAPER_CSHEET ):
+ pSetupData->mePaperFormat = PAPER_C;
+ break;
+ case( DMPAPER_DSHEET ):
+ pSetupData->mePaperFormat = PAPER_D;
+ break;
+ case( DMPAPER_ESHEET ):
+ pSetupData->mePaperFormat = PAPER_E;
+ break;
+ case( DMPAPER_ENV_DL):
+ pSetupData->mePaperFormat = PAPER_ENV_DL;
+ break;
+ case( DMPAPER_ENV_C5):
+ pSetupData->mePaperFormat = PAPER_ENV_C5;
+ break;
+ case( DMPAPER_ENV_C3):
+ pSetupData->mePaperFormat = PAPER_ENV_C3;
+ break;
+ case( DMPAPER_ENV_C4):
+ pSetupData->mePaperFormat = PAPER_ENV_C4;
+ break;
+ case( DMPAPER_ENV_C6):
+ pSetupData->mePaperFormat = PAPER_ENV_C6;
+ break;
+ case( DMPAPER_ENV_C65):
+ pSetupData->mePaperFormat = PAPER_ENV_C65;
+ break;
+ case( DMPAPER_ENV_ITALY ):
+ pSetupData->mePaperFormat = PAPER_ENV_ITALY;
+ break;
+ case( DMPAPER_ENV_MONARCH ):
+ pSetupData->mePaperFormat = PAPER_ENV_MONARCH;
+ break;
+ case( DMPAPER_ENV_PERSONAL ):
+ pSetupData->mePaperFormat = PAPER_ENV_PERSONAL;
+ break;
+ case( DMPAPER_FANFOLD_US ):
+ pSetupData->mePaperFormat = PAPER_FANFOLD_US;
+ break;
+ case( DMPAPER_FANFOLD_STD_GERMAN ):
+ pSetupData->mePaperFormat = PAPER_FANFOLD_DE;
+ break;
+ case( DMPAPER_FANFOLD_LGL_GERMAN ):
+ pSetupData->mePaperFormat = PAPER_FANFOLD_LEGAL_DE;
+ break;
+ case( DMPAPER_ISO_B4 ):
+ pSetupData->mePaperFormat = PAPER_B4_ISO;
+ break;
+ case( DMPAPER_JAPANESE_POSTCARD ):
+ pSetupData->mePaperFormat = PAPER_POSTCARD_JP;
+ break;
+ case( DMPAPER_9X11 ):
+ pSetupData->mePaperFormat = PAPER_9x11;
+ break;
+ case( DMPAPER_10X11 ):
+ pSetupData->mePaperFormat = PAPER_10x11;
+ break;
+ case( DMPAPER_15X11 ):
+ pSetupData->mePaperFormat = PAPER_15x11;
+ break;
+ case( DMPAPER_ENV_INVITE ):
+ pSetupData->mePaperFormat = PAPER_ENV_INVITE;
+ break;
+ case( DMPAPER_A_PLUS ):
+ pSetupData->mePaperFormat = PAPER_A_PLUS;
+ break;
+ case( DMPAPER_B_PLUS ):
+ pSetupData->mePaperFormat = PAPER_B_PLUS;
+ break;
+ case( DMPAPER_LETTER_PLUS ):
+ pSetupData->mePaperFormat = PAPER_LETTER_PLUS;
+ break;
+ case( DMPAPER_A4_PLUS ):
+ pSetupData->mePaperFormat = PAPER_A4_PLUS;
+ break;
+ case( DMPAPER_A2 ):
+ pSetupData->mePaperFormat = PAPER_A2;
+ break;
+ case( DMPAPER_DBL_JAPANESE_POSTCARD ):
+ pSetupData->mePaperFormat = PAPER_DOUBLEPOSTCARD_JP;
+ break;
+ case( DMPAPER_A6 ):
+ pSetupData->mePaperFormat = PAPER_A6;
+ break;
+ case( DMPAPER_B6_JIS ):
+ pSetupData->mePaperFormat = PAPER_B6_JIS;
+ break;
+ case( DMPAPER_12X11 ):
+ pSetupData->mePaperFormat = PAPER_12x11;
break;
default:
pSetupData->mePaperFormat = PAPER_USER;
@@ -927,17 +1063,6 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS
// -----------------------------------------------------------------------
-static BOOL ImplPaperSizeEqual( short nPaperWidth1, short nPaperHeight1,
- short nPaperWidth2, short nPaperHeight2 )
-{
- const short PAPER_SLOPPY = 1; // 0.1 mm accuracy
-
- return ( (Abs( nPaperWidth1-nPaperWidth2 ) <= PAPER_SLOPPY) &&
- (Abs( nPaperHeight1-nPaperHeight2 ) <= PAPER_SLOPPY) );
-}
-
-// -----------------------------------------------------------------------
-
static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, ImplJobSetup* pSetupData, ULONG nFlags )
{
if ( !pSetupData || !pSetupData->mpDriverData )
@@ -979,6 +1104,9 @@ static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS
switch( pSetupData->mePaperFormat )
{
+ case( PAPER_A2 ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_A2;
+ break;
case( PAPER_A3 ):
CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_A3;
break;
@@ -988,11 +1116,8 @@ static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS
case( PAPER_A5 ):
CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_A5;
break;
- case( PAPER_B4 ):
- CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_B4;
- break;
- case( PAPER_B5 ):
- CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_B5;
+ case( PAPER_B4_ISO):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_ISO_B4;
break;
case( PAPER_LETTER ):
CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_LETTER;
@@ -1003,6 +1128,136 @@ static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS
case( PAPER_TABLOID ):
CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_TABLOID;
break;
+#if 0
+ //http://msdn.microsoft.com/en-us/library/ms776398(VS.85).aspx
+ //DMPAPER_ENV_B6 is documented as:
+ //"DMPAPER_ENV_B6 35 Envelope B6 176 x 125 mm"
+ //which is the wrong way around, it is surely 125 x 176, i.e.
+ //compare DMPAPER_ENV_B4 and DMPAPER_ENV_B4 as
+ //DMPAPER_ENV_B4 33 Envelope B4 250 x 353 mm
+ //DMPAPER_ENV_B5 34 Envelope B5 176 x 250 mm
+ case( PAPER_B6_ISO ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_ENV_B6;
+ break;
+#endif
+ case( PAPER_ENV_C4 ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_ENV_C4;
+ break;
+ case( PAPER_ENV_C5 ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_ENV_C5;
+ break;
+ case( PAPER_ENV_C6 ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_ENV_C6;
+ break;
+ case( PAPER_ENV_C65 ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_ENV_C65;
+ break;
+ case( PAPER_ENV_DL ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_ENV_DL;
+ break;
+ case( PAPER_C ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_CSHEET;
+ break;
+ case( PAPER_D ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_DSHEET;
+ break;
+ case( PAPER_E ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_ESHEET;
+ break;
+ case( PAPER_EXECUTIVE ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_EXECUTIVE;
+ break;
+ case( PAPER_FANFOLD_LEGAL_DE ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_FANFOLD_LGL_GERMAN;
+ break;
+ case( PAPER_ENV_MONARCH ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_ENV_MONARCH;
+ break;
+ case( PAPER_ENV_PERSONAL ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_ENV_PERSONAL;
+ break;
+ case( PAPER_ENV_9 ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_ENV_9;
+ break;
+ case( PAPER_ENV_10 ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_ENV_10;
+ break;
+ case( PAPER_ENV_11 ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_ENV_11;
+ break;
+ case( PAPER_ENV_12 ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_ENV_12;
+ break;
+ //See the comments on DMPAPER_B4 above
+ case( PAPER_B4_JIS ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_B4;
+ break;
+ case( PAPER_B5_JIS ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_B5;
+ break;
+ case( PAPER_B6_JIS ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_B6_JIS;
+ break;
+ case( PAPER_LEDGER ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_LEDGER;
+ break;
+ case( PAPER_STATEMENT ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_STATEMENT;
+ break;
+ case( PAPER_10x14 ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_10X14;
+ break;
+ case( PAPER_ENV_14 ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_ENV_14;
+ break;
+ case( PAPER_ENV_C3 ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_ENV_C3;
+ break;
+ case( PAPER_ENV_ITALY ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_ENV_ITALY;
+ break;
+ case( PAPER_FANFOLD_US ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_FANFOLD_US;
+ break;
+ case( PAPER_FANFOLD_DE ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_FANFOLD_STD_GERMAN;
+ break;
+ case( PAPER_POSTCARD_JP ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_JAPANESE_POSTCARD;
+ break;
+ case( PAPER_9x11 ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_9X11;
+ break;
+ case( PAPER_10x11 ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_10X11;
+ break;
+ case( PAPER_15x11 ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_15X11;
+ break;
+ case( PAPER_ENV_INVITE ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_ENV_INVITE;
+ break;
+ case( PAPER_A_PLUS ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_A_PLUS;
+ break;
+ case( PAPER_B_PLUS ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_B_PLUS;
+ break;
+ case( PAPER_LETTER_PLUS ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_LETTER_PLUS;
+ break;
+ case( PAPER_A4_PLUS ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_A4_PLUS;
+ break;
+ case( PAPER_DOUBLEPOSTCARD_JP ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_DBL_JAPANESE_POSTCARD;
+ break;
+ case( PAPER_A6 ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_A6;
+ break;
+ case( PAPER_12x11 ):
+ CHOOSE_DEVMODE(dmPaperSize) = DMPAPER_12X11;
+ break;
default:
{
short nPaper = 0;
@@ -1023,13 +1278,11 @@ static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS
}
if ( (nPaperSizeCount == nPaperCount) && pPapers && pPaperSizes )
{
+ PaperInfo aInfo(pSetupData->mnPaperWidth, pSetupData->mnPaperHeight);
// compare paper formats and select a good match
for ( ULONG i = 0; i < nPaperCount; i++ )
{
- if ( ImplPaperSizeEqual( (short)(pSetupData->mnPaperWidth/10),
- (short)(pSetupData->mnPaperHeight/10),
- (short)pPaperSizes[i].x,
- (short)pPaperSizes[i].y ) )
+ if ( aInfo.sloppyEqual(PaperInfo(pPaperSizes[i].x*10, pPaperSizes[i].y*10)))
{
nPaper = pPapers[i];
break;
@@ -1041,12 +1294,10 @@ static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS
// all paper sizes with portrait orientation only!!
if ( !nPaper && nLandscapeAngle != 0 )
{
+ PaperInfo aRotatedInfo(pSetupData->mnPaperHeight, pSetupData->mnPaperWidth);
for ( ULONG i = 0; i < nPaperCount; i++ )
{
- if ( ImplPaperSizeEqual( (short)(pSetupData->mnPaperWidth/10),
- (short)(pSetupData->mnPaperHeight/10),
- (short)pPaperSizes[i].y,
- (short)pPaperSizes[i].x ) )
+ if ( aRotatedInfo.sloppyEqual(PaperInfo(pPaperSizes[i].x*10, pPaperSizes[i].y*10)) )
{
nPaper = pPapers[i];
break;
@@ -1284,11 +1535,7 @@ void WinSalInfoPrinter::InitPaperFormats( const ImplJobSetup* pSetupData )
ImplDeviceCaps( this, DC_PAPERNAMES, (BYTE*)pNamesBuffer, pSetupData );
for( DWORD i = 0; i < nCount; ++i )
{
- vcl::PaperInfo aInfo;
- aInfo.m_nPaperWidth = (pPaperSizes[i].x + 5) / 10;
- aInfo.m_nPaperHeight = (pPaperSizes[i].y + 5) / 10;
- pNamesBuffer[(i+1)*64-1] = '\0'; // make very long names zero terminated
- aInfo.m_aPaperName = pNamesBuffer + (i*64);
+ PaperInfo aInfo(pPaperSizes[i].x * 10, pPaperSizes[i].y * 10);
m_aPaperFormats.push_back( aInfo );
}
rtl_freeMemory( pNamesBuffer );
@@ -1299,11 +1546,7 @@ void WinSalInfoPrinter::InitPaperFormats( const ImplJobSetup* pSetupData )
ImplDeviceCaps( this, DC_PAPERNAMES, (BYTE*)pNamesBuffer, pSetupData );
for( DWORD i = 0; i < nCount; ++i )
{
- vcl::PaperInfo aInfo;
- aInfo.m_nPaperWidth = (pPaperSizes[i].x + 5) / 10;
- aInfo.m_nPaperHeight = (pPaperSizes[i].y + 5) / 10;
- pNamesBuffer[(i+1)*64-1] = '\0'; // make very long names zero terminated
- aInfo.m_aPaperName = ImplSalGetUniString( (const char*)(pNamesBuffer + (i*64)) );
+ PaperInfo aInfo(pPaperSizes[i].x * 10, pPaperSizes[i].y * 10);
m_aPaperFormats.push_back( aInfo );
}
rtl_freeMemory( pNamesBuffer );
diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index 0689b8710655..8d9347e7e352 100755
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -1172,62 +1172,52 @@ static bool InitUSP()
if( !aUspModule )
return (bUspEnabled = false);
- OUString queryFuncName( RTL_CONSTASCII_USTRINGPARAM( "ScriptIsComplex" ) );
pScriptIsComplex = (HRESULT (WINAPI*)(const WCHAR*,int,DWORD))
- osl_getSymbol( aUspModule, queryFuncName.pData );
+ osl_getAsciiFunctionSymbol( aUspModule, "ScriptIsComplex" );
bUspEnabled &= (NULL != pScriptIsComplex);
- queryFuncName = OUString( RTL_CONSTASCII_USTRINGPARAM( "ScriptItemize" ) );
pScriptItemize = (HRESULT (WINAPI*)(const WCHAR*,int,int,
const SCRIPT_CONTROL*,const SCRIPT_STATE*,SCRIPT_ITEM*,int*))
- osl_getSymbol( aUspModule, queryFuncName.pData );
+ osl_getAsciiFunctionSymbol( aUspModule, "ScriptItemize" );
bUspEnabled &= (NULL != pScriptItemize);
- queryFuncName = OUString( RTL_CONSTASCII_USTRINGPARAM( "ScriptShape" ) );
pScriptShape = (HRESULT (WINAPI*)(HDC,SCRIPT_CACHE*,const WCHAR*,
int,int,SCRIPT_ANALYSIS*,WORD*,WORD*,SCRIPT_VISATTR*,int*))
- osl_getSymbol( aUspModule, queryFuncName.pData );
+ osl_getAsciiFunctionSymbol( aUspModule, "ScriptShape" );
bUspEnabled &= (NULL != pScriptShape);
- queryFuncName = OUString( RTL_CONSTASCII_USTRINGPARAM( "ScriptPlace" ) );
pScriptPlace = (HRESULT (WINAPI*)(HDC, SCRIPT_CACHE*, const WORD*, int,
const SCRIPT_VISATTR*,SCRIPT_ANALYSIS*,int*,GOFFSET*,ABC*))
- osl_getSymbol( aUspModule, queryFuncName.pData );
+ osl_getAsciiFunctionSymbol( aUspModule, "ScriptPlace" );
bUspEnabled &= (NULL != pScriptPlace);
- queryFuncName = OUString( RTL_CONSTASCII_USTRINGPARAM( "ScriptGetLogicalWidths" ) );
pScriptGetLogicalWidths = (HRESULT (WINAPI*)(const SCRIPT_ANALYSIS*,
int,int,const int*,const WORD*,const SCRIPT_VISATTR*,int*))
- osl_getSymbol( aUspModule, queryFuncName.pData );
+ osl_getAsciiFunctionSymbol( aUspModule, "ScriptGetLogicalWidths" );
bUspEnabled &= (NULL != pScriptGetLogicalWidths);
- queryFuncName = OUString( RTL_CONSTASCII_USTRINGPARAM( "ScriptApplyLogicalWidth" ) );
pScriptApplyLogicalWidth = (HRESULT (WINAPI*)(const int*,int,int,const WORD*,
const SCRIPT_VISATTR*,const int*,const SCRIPT_ANALYSIS*,ABC*,int*))
- osl_getSymbol( aUspModule, queryFuncName.pData );
+ osl_getAsciiFunctionSymbol( aUspModule, "ScriptApplyLogicalWidth" );
bUspEnabled &= (NULL != pScriptApplyLogicalWidth);
- queryFuncName = OUString( RTL_CONSTASCII_USTRINGPARAM( "ScriptJustify" ) );
pScriptJustify = (HRESULT (WINAPI*)(const SCRIPT_VISATTR*,const int*,
int,int,int,int*))
- osl_getSymbol( aUspModule, queryFuncName.pData );
+ osl_getAsciiFunctionSymbol( aUspModule, "ScriptJustify" );
bUspEnabled &= (NULL != pScriptJustify);
- queryFuncName = OUString( RTL_CONSTASCII_USTRINGPARAM( "ScriptGetFontProperties" ) );
pScriptGetFontProperties = (HRESULT (WINAPI*)( HDC,SCRIPT_CACHE*,SCRIPT_FONTPROPERTIES*))
- osl_getSymbol( aUspModule, queryFuncName.pData );
+ osl_getAsciiFunctionSymbol( aUspModule, "ScriptGetFontProperties" );
bUspEnabled &= (NULL != pScriptGetFontProperties);
- queryFuncName = OUString( RTL_CONSTASCII_USTRINGPARAM( "ScriptTextOut" ) );
pScriptTextOut = (HRESULT (WINAPI*)(const HDC,SCRIPT_CACHE*,
int,int,UINT,const RECT*,const SCRIPT_ANALYSIS*,const WCHAR*,
int,const WORD*,int,const int*,const int*,const GOFFSET*))
- osl_getSymbol( aUspModule, queryFuncName.pData );
+ osl_getAsciiFunctionSymbol( aUspModule, "ScriptTextOut" );
bUspEnabled &= (NULL != pScriptTextOut);
- queryFuncName = OUString( RTL_CONSTASCII_USTRINGPARAM( "ScriptFreeCache" ) );
pScriptFreeCache = (HRESULT (WINAPI*)(SCRIPT_CACHE*))
- osl_getSymbol( aUspModule, queryFuncName.pData );
+ osl_getAsciiFunctionSymbol( aUspModule, "ScriptFreeCache" );
bUspEnabled &= (NULL != pScriptFreeCache);
if( !bUspEnabled )
diff --git a/vcl/win/source/window/MAKEFILE.MK b/vcl/win/source/window/MAKEFILE.MK
index 9a65a5000ccf..17e73db1e75e 100644
--- a/vcl/win/source/window/MAKEFILE.MK
+++ b/vcl/win/source/window/MAKEFILE.MK
@@ -43,7 +43,7 @@ ENABLE_EXCEPTIONS=TRUE
# --- #105371#
.IF "$(COM)"=="GCC"
-CDEFS += -UWINVER -DWINVER=0x0400 -D_WIN32_WINNT=0x0501
+CFLAGS += -D_WIN32_WINNT=0x0501
.ELSE
CFLAGS += -DWINVER=0x0400 -D_WIN32_WINNT=0x0501
diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx
index 140e506686fc..57ad272bcf51 100644
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -358,16 +358,12 @@ SalFrame* ImplSalCreateFrame( WinSalInstance* pInst,
void *pFunc = NULL;
if( pLib )
{
- OUString queryFuncName( RTL_CONSTASCII_USTRINGPARAM( "SetLayeredWindowAttributes" ) );
- pFunc = osl_getSymbol( pLib, queryFuncName.pData );
+ pFunc = osl_getAsciiFunctionSymbol( pLib, "SetLayeredWindowAttributes" );
}
lpfnSetLayeredWindowAttributes = ( SetLayeredWindowAttributes_Proc_T ) pFunc;
- if ( pFunc )
- bLayeredAPI = 1;
- else
- bLayeredAPI = 0;
+ bLayeredAPI = pFunc ? 1 : 0;
}
}
static const char* pEnvTransparentFloats = getenv("SAL_TRANSPARENT_FLOATS" );
@@ -2113,8 +2109,7 @@ void WinSalFrame::StartPresentation( BOOL bStart )
{
OUString aLibraryName( OUString::createFromAscii( aOS.szPathName ) );
oslModule mhSageInst = osl_loadModule( aLibraryName.pData, SAL_LOADMODULE_DEFAULT );
- OUString queryFuncName( RTL_CONSTASCII_USTRINGPARAM( "System_Agent_Enable" ) );
- pSalData->mpSageEnableProc = (SysAgt_Enable_PROC) osl_getSymbol( mhSageInst, queryFuncName.pData );
+ pSalData->mpSageEnableProc = (SysAgt_Enable_PROC)osl_getAsciiFunctionSymbol( mhSageInst, "System_Agent_Enable" );
}
else
pSalData->mnSageStatus = DISABLE_AGENT;